Posts

Showing posts from May, 2012

slowdown - Fastest Ubuntu version for development -

i'm using ubuntu development. today installed new 11.04. boot time twice/three times fast. not need fancy graphics want focus on developing web apps , desktop/console apps. i read every release ubuntu tends slow down bit , many people claim it's bloated. in experience, version of ubuntu fastest? thanks, frank (ps: if have idea better os ubuntu pls let me know. 1 of ubuntu's strong points me integration of synaptic though, sets me don't have waste time on configuration.) yes correct, ubuntu quite bloated. if plan use development recommend fedora; sure many others agree me on this. you may have take additional time setup way want it, happier in long run. http://fedoraproject.org/

regex - Strip Trademark Symbol from string Python -

i'm trying prep data designer. i'm pulling data out of sql server python on windows machine (not sure if os important). how make string 'official trademark™' = 'official trademark'? also, further information/reading on unicode or pertinent subject matter me become little more independent. help! edited: perhaps should have included code. i'm getting error during run time: 'unicodedecodeerror: 'ascii' codec can't decode byte 0x99 in position 2:ordinal not in range(128).' here code: row.note = 'tm™ data\n' t = row.note t = t.rstrip(os.linesep).lstrip(os.linesep) t = t.replace(u"\u2122",'') the trademark symbol unicode character u+2122 , or in python notation u"\u2122" . just search , replace: 'string'.replace(u"\u2122", '')

tsql - Great Circle Distance Formula: T-SQL -

so have table bunch of different addresses in it. need proc select addresses in table within specified distance in miles passed in lat/long values. so example of table: - messageid - lat (float) - long (float) proc passing in lat/long pair (both float s well) int (miles) i found http://www.sqlteam.com/forums/topic.asp?topic_id=81360 calculate actual formula can't figure out modify in proc form able go through entire list of addresses , give me id 's of addresses <= miles (that pass in), lat/long pass in. can here? thanks! sql server 2008 using spacial function stdistance return distance in meters geography::point(@lat1, @lon1, 4326).stdistance(geography::point(@lat2, @lon2, 4326))

google maps - Android: myLocationOverlay.runOnFirstFix Too Slow -

does have ideas in speeding process setting initial point google maps, centering on current location. must possible works fine in native google maps app has noticeable delay in custom application using: mylocationoverlay.runonfirstfix(new runnable() { public void run() { findme(); } }); where find me includes: if(mylocationoverlay.getmylocation() != null){ mapview.getcontroller().animateto(mylocationoverlay.getmylocation()); } as far know, native maps service , application loading on system startup , prepares in background wchich makes load maps faster. check in running processes in settings. cloud same or make dirty workaround wchich did once: display progress dialog before load (after setcontentview in onload) , close after done on map need ;)

html - Change Top And Bottom Border of a Vertical List on Hover -

Image
i decided on effect vertical drop down list. basically, each list element separated 1px grey bar. effect easy, apply bottom-border: solid 1px black; on hover, want top , bottom borders of selected item become white. unfortunately, setting top , bottom borders on list item element, not change bottom border of list item above , end top border staying black , bottom border becoming white. is there css way achieve effect? the desired effect shown here: this perfect use of nonexistent previous-sibling selector . unfortunately, being nonexistent @ all, i'd take different approach. if can change border on top , next-sibling selector work perfectly: ul > li:hover, ul > li:hover + li { border-top: 1px solid white; } demo: http://jsfiddle.net/mattball/znr94/

java - How to get browsed filepath in jsp..............? -

hi selecting txt/xls file through , need pass same function read content , not happening me ....... how can pass file path file content reader function code using browse file: <input type="file" name="uploadfile" id="uploadfile" size="40" value=""/> bufferedreader bf = new bufferedreader(new filereader(*** file path here ***)); bufferedreader bf = new bufferedreader(new filereader("cia.txt")); i want dynamic selected files file reader...... thank you.. if variable "uploadfile" file type variable(need be) try uploadfile.getabsolutepath() btw server side technology using(framework)

iphone - OpenGL ES code to revise -

i´m creating opengl es project , i´m trying show textures, works problem use of memory, every 5 seconds increments 1 mb, think i´m doing wrong, i´m not using of apple recommendations tray sure, want know if code have bug, there how i´m paiting: // generate vertex buffer object (vbo) glgenbuffers(1, &ui32vbo); // bind vbo can fill data glbindbuffer(gl_array_buffer, ui32vbo); // set buffer's data // calculate verts size: (3 vertices * stride (3 glfloats per each vertex)) glbufferdata(gl_array_buffer, uisize, verts, gl_static_draw); // bind vbo can fill data glbindbuffer(gl_array_buffer, ui32vbo); glenableclientstate(gl_vertex_array); glvertexpointer(3, gl_float, 20, 0); // stride = 20 bytes glbindtexture(gl_texture_2d, textid); glenableclientstate(gl_texture_coord_array); gltexcoordpointer(2, gl_float, 20, (void *)12); gldrawarrays(gl_triangle_fan, 4, 4); // bind vbo can fill data glbindbuffer(gl_array_buffer, 0); thank much!!! you should gener...

asp.net - Why IE executes javascript slower than Mozilla FF -

why ie executes javascript slower mozilla ff? when user pagemethods data web server. ie takes more time mozilla ff. there way can execute asp.net project faster in ie same ff? this depends how write javascsript. both browsers have strengths , weaknesses, although test ie9, javascript far superior previous versions. i've seen many cases in prior versions firefox outperformed ie - thats how in cases. funny though ie outperformed google's chrome browser (at least on 1 particular test anyways) on youtube performance : )

php - regular expressions for file types - jQuery uploader issue -

i'm trying implement jquery uploader webpage. files in right places, , we're using standard regular expression comes software ( /.+$/i ), believe should accept files. but when try , upload file, quits straight away , gives error: filetype not allowed . filename i'm trying upload 1234.jpg . anyone ideas? i've tried googling it, not come across same problem specific uploader. appreciated! if file 0 bytes won't upload.

php - Is there any query that can do database modification from one column to multiple columns? -

i using mysql. have table called entries. table has column called body. body column has string data (about 500 words long). now, want transfer above body column column_1,column_2,.... column_300 contains nth word in each body column. so, if body column has data "i ate lunch today", column_1 have 'i' , column_2 have 'ate', , on. guess can work in php, have been wondering if possible in query in mysql. see: split value 1 field two

python - Reading gzip file that is currently being written to -

my program lot of file processing, , files large prefer write them gzip. 1 challenge need read files being written. not problem without gzip compression, when compression on, reading complains failed crc, presume might have compression info not being flushed when writing. there way use gzip python such that, when write , flush file (but not close file), can read well? i think flushing data file (compressed) writes data file, headers written on close() , need close file first, , after can open , read data need. if need write large data ammounts, can try use database, postgresql or mysql can specify table compression (archive, compressed), , able insert data table, , read it, database software rest (compression, decompression on inserts, selects).

How to get view any file functionality as we get in gmail using asp.net -

i have create code view type of file in browser able view in gmail. even though user not have required software installed should able view it. the file should not open in separate window. the file should opened in browser itself thanks in advance you'll need process on server-side data structure can rendered in html/css/js on client

C Wrapper for C++: How to deal with C++ templates? -

earlier asking writing c wrapper c++ classes ( c wrapper c++ ), clear. there's 1 more question though: how deal c++ templates? let's class: template<typename t> class temp { t get(); void set(t t); } is there elegant way write c wrapper? you have write separate wrapper each specialization.

richfaces - maven-compiler-plugin won't upgrade from 2.0.2.SP1 to 2.3.2 -

i'm maven newbie, have been studying maven week now, have 5 years experience using ant, i'm able come speed without trouble. have read through documentation @ maven.apache.org twice -- several hundred pages of reading. have created several test apps using several different maven archetypes better understanding i've read through documentation. now, i'm setting new project , finer points coming play... i think know why maven-compiler-plugin won't upgrade latest release, 2.3.2, when run mvn versions:use-latest-release but need know if there workaround, or if should concerned. first, here's snip of pom.xml: <plugin> <artifactid>maven-compiler-plugin</artifactid> <version>2.3.2</version> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> as can see sp...

mysqli multi query - mysql_connect() does connect to MySQL -

i in terrible situation. php works mysql database when use mysqli connection code, when try connect database using <?php mysql_connect("localhost", "admin", "1admin") or die(mysql_error()); echo "connected mysql<br />"; ?> i don't error message. rather browser goes offline or error message. have been trying figure out 2 weeks. in php both mysql , mysqli lines uncommented. using windows 7 64 bit. try using 127.0.0.1 instead of localhost.

ios - CoreData delete save Error -

[request2 setentity:entity]; nspredicate * predicate2 = [ nspredicate predicatewithformat:@"logoframenum == %@",[nsnumber numberwithint:7]]; [request2 setpredicate:predicate2]; nsmanagedobject * collectionlist2 = [[ managedobjectcontext executefetchrequest:request2 error:&error2] objectatindex:0]; nslog(@"context :%@", deletecontext1); [managedobjectcontext deleteobject:collectionlist2]; bool yesorno = [collectionlist2 isdeleted]; nslog(@"yesorno : %i", yesorno); nserror * error10; nslog(@"[managedobjectcontext ] : %@", deletecontext1); [collectionlist2 release]; if (![managedobjectcontext save:&error10]) { // update handle error appropriately. nslog(@"unresolved error %@, %@", error10, [error userinfo]); exit(-1); // fail } there more source above it. change variables or data coredata performed same nsmanagedobjectcontex have ther...

Problem importing binary registry key into Windows -

i exported binary (reg_binary) registry value computer (ie setting). need re-import computer (both windows 7). when try import registry file (same 1 exported), error: "cannot import file.reg. not data written registry. keys open system or other processes." i've tried importing in safe mode no avail. after general research, seems need import binary data special way, can't seem make work. registry key: windows registry editor version 5.00 [hkey_current_user\software\microsoft\internet explorer\user preferences] "88d7d0879dab32e14de5b3a805a34f98aff34f5977"=hex:01,00,00,00,d0,8c,9d,df,01,15,\ d1,11,8c,7a,00,c0,4f,c2,97,eb,01,00,00,00,35,9a,4f,4f,a4,58,47,4b,b0,5d,78,\ 59,a6,1d,01,df,00,00,00,00,02,00,00,00,00,00,03,66,00,00,c0,00,00,00,10,00,\ 00,00,60,cf,a0,df,fc,ef,bc,e4,f4,71,a7,e8,ad,4c,3b,5f,00,00,00,00,04,80,00,\ 00,a0,00,00,00,10,00,00,00,80,30,65,dd,2e,3e,2e,45,c0,5b,09,8f,3e,f2,88,79,\ 50,00,00,00,24,c2,46,26,e7,85,28,9a,fd,e0,5f,78,ba,...

Android layout weight problem -

Image
friends, i have written following layout code , buttons displayed on screen equally not seems work 1 guide me mistake doing? ![<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="@color/color_panel_background" > <imagebutton android:layout_height="wrap_content" android:id="@+id/currentlocation" android:layout_weight="1" android:layout_width="fill_parent" android:src="@drawa...

c# - DevExpress Filter Editor : DropdownList -

Image
when constructing filter in filter editor , can provide list of possible values ? example : can have here combobox possible values instead of textedit ? yes, possible. should handle filtereditorcreated event of gridview shown below: private void gridview1_filtereditorcreated(object sender, devexpress.xtragrid.views.base.filtercontroleventargs e) { devexpress.xtraeditors.repository.repositoryitemcombobox combo = new devexpress.xtraeditors.repository.repositoryitemcombobox(); combo.items.add("item 1"); combo.items.add("item 2"); e.filtercontrol.filtercolumns["productname"].setcolumneditor(combo); }

php - Setting up a cron job with Webmin -

i trying setup cron job using webmin run every 5 min. needs target .php file , run php script in file. when enter path file in "command" field, doesn't work. wondering doing wrong, , put file path need cron job run. thanks! system -> scheduled cron jobs click create new scheduled cron job . in command box enter /usr/bin/php -q /var/www/path/to/your_php_script.php click "times , dates selected below .." radio button click "selected.." under minutes section select 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 (use control key) , click 'save' button .

Retrieving array/sub-array name for use in php -

i have multi-dimensional array of databases, generated server: // place db tables array $da_db = array( 'test' => array( // test.users 'users' => array('fname','lname','info'), // test.webref_rss_details 'webref_rss_details' => array('id','title','link','description','language','image_title','image_link','item_desc','image_width','image_height','image_url','man_edit','webmaster','copyright','pubdate','lastbuild','category','generator','docs','cloud','ttl','rating','textinput','skiphours','skipdays'), // test.webref_rss_items 'webref_rss_items' => array('id','title','description','link','guid','pubdate','author','category','com...

r - Can't find SummaryReporter output -

i've looked everywhere can't find summaryreporter writes tests report? if there's single failure script stops error. ideally, tests run , results outputted file. there documentation testthat package @ wiki: https://github.com/hadley/devtools/wiki/testing in nutshell, can embed multiple expect_that statements in each test_that . towards end of page, in section 'testing files , directories' there information 3 different reporters (stop, minimal , summary). i have found quite robust. if test_that finds error, reports error , carries on remainder of tests. ps. experience test results printed console. run testing within r environment, not os command line.

php - Basic ajax get request -

i'm making calendar 2 links, 1 go month , other go forward month. this cal.php file: <div class='cal_wrapper' id='cal'> <?php echo "<a href='cal.php?month=m&year=y'>prev month</a>"; echo "<a href='cal.php?month=m&year=y'>next month</a>"; echo $calendar; ?> </div> what i'm trying use jquery/ajax update what's inside cal_wrapper div without having refresh page. i've hard can't find examples of getting done without using html form. how can send 2 variables through request, month , year, should pretty basic..but i'm going cross eyed trying find on internets.. first give link classes echo "<a class='month_selector' href='cal.php?month=m&year=y'>prev month</a>"; echo "<a class='month_selector' href='cal.php?month=m&year=y'>next month</a>"; then loa...

java - Using a rotation vector in earlier Android systems -

hey, application writing need use data given in sensor.type_rotation_vector . bad news program, among others, g1 device, runs android 1.6, i.e. api level 4, , not 9 needed. nevertheless, pretty positive phone have sort of gyroscope, means should possible me exact orientation of phone. so, question is, how do it? thank in advance. i don't think g1 has gyroscope - it has basic accelerometers . here 's interesting post how program use accelerometers when available , not crash when aren't. [update] if phone has gyroscope, require android 2.3 (and above) on phone access it.

parameters - Finding out SQLParameters of a SQLCommand -

at point in past, in vb6 days, remember being able create sql command object (not same 1 today's .net flavour), , have sql parameters automatically filled in. this allowed me do things passing in parameters knew exist, , if 2 different clients using different versions of database, call procedures knowing still meaningful response. something this: dim cmd sqlcommand set cmd = new sqlcommand(connection) cmd.commandtext = "magicstoredprocedure" cmd.commandtype = commandtype.storedprocedure if cmd.parameters.count > 0 if cmd.parameters(0).name = "@firstparameter" cmd.parameters("@firstparameter").value = somevalue end if end if dim r recordset set r = cmd.executerecordset() i remember doing this, cannot find examples of own, , trying in .net not seem work @ all. examples have seen (and have searched time) add parameters manually. any pointers? i have found sqlcommandbuilder.deriveparameters procedure, wanted. sql...

c# - DateTime getting todays Month in if statement -

i want if statement if month == january example load else if month == april load else. can please thanks you can use month property, range 1-12: int month = datetime.now.month; if(month == 4) //april {..

Remove beginning of PHP string until it's 13 characters? -

i have variable needs it's value's shortened until 13 characters. needs chop off characters beginning of string. built php? the following should work you: $str = substr($str, -13);

php - High CPU usage when using cron job and sending emails -

i have website sends daily writing reminders users based on timezone , hour settings. eg: user in new york (america/new_york) prefers receive reminder @ 9pm. in current implementation (after many changes), store timezone , notify_hour in settings table , find users complex , heavy mysql query. the query slow, added indexes , made faster. after find users try send emails through external smtp server (sendgrid.com). ive set cron job run every 10 minutes , check 200 users. have 2000 active users. works fine this. of users located in iran (asia/tehran) , of them have selected 9pm receive reminder. peak hour between 8pm , 11pm irst. but server admin says cron job uses cpu. 25% high. tried debug script, query fast when comes sending emails through smtp server, takes longer: email reminder has been sent 4 people - query: 0.75444 seconds ---- system: 11.18443 seconds. ---- email reminder has been sent 0 people - query: 0.65488 seconds ---- system: 0.68821 seconds. ---- email remin...

core data - How do I check if an NSSet contains an object of a kind of class? -

Image
how implement following instance method nsset : - (bool)containsmemberofclass:(class)aclass here's why want know: core data model: how add facebook authorization user's authorizations nsset , if 1 doesn't exist. in other words, user can have many authorizations (in case choose add twitter (e.g.) authorization in future) should have 1 of each kind of authorization. so, if (![myuser.authorizations containsmemberofclass:[facebook class]]) , add facebook authorization instance myuser . unfortunately, have loop through of authorizations , check: @interface nsset (containsadditions) - (bool)containskindofclass:(class)class; - (bool)containsmemberofclass:(class)class; @end @implementation nsset (containsadditions) - (bool)containskindofclass:(class)class { (id element in self) { if ([element iskindofclass:class]) return yes; } return no; } - (bool)containsmemberofclass:(class)class { (id element in self) { if ...

jquery - Create a basic Grid using KnockoutJS Mapping plugin and MVC 3 -

i have searched high , low , tried various patterns seems cannot work right. 1 time got work there code figured there had easier way , broken. goal... understand basics of how use ko mapping , mvc have grid load.. , possibly use form update it. cannot find examples working situation. here down now. here action: public jsonresult list() { var result = new jsonresult(); result.data = _service.getweightstats(); return json(result, jsonrequestbehavior.allowget); } here class: public class weightstat { public int id { get; set; } [required] public double weight { get; set; } public double? neck { get; set; } public double? chest { get; set; } public double? bicept { get; set; } public double? waist { get; set; } public double? hip { get; set; } public double? thigh { get; set; } public double? calf { get; set; } [required] public datetime date { get; set; } [required] public string timeofday...

python - Is there some django app to manage followers and followings? -

i manage users connections followers , followings twitter , other social media sites. there app this? perhaps django-relationships 1 looking for.

php - Choose an index for mysql table -

the table i got table contains price 1 000 000 articles. articles got uniques id-number table contains prices multiple stores. if 2 stores got same article uniques id not unique table. table structure table articles id int price in store varchar(40) daily use except queries using id-number users need run daily updates data csv-files insert/update each article in table. choosen procedure try select article , perform either insert or update. question with in mind, key should choose? here solutions ive been considering: fulltext index of fields isbn , store add field value generated by isbn , store set primary key one table per store , use isbn primary key use compound primary key consisting of store id , article id - that'll give unique primary key each item on per-store basis , don't need separate field (assuming store id , article id in table). ideally should have 3 tables... like: article ------------------------------------...

jms - How to build ActiveMQ-CPP Stomp only client -

is possible build activemq-cpp client support stomp protocol? regular native library dependencies big embedded device , want build client stomp support. please advise. thank you. this not possible activemq-cpp client. of course contribute project make possible.

model view controller - Integrating an already build PHP mvc website to wordpress -

i have made website php/mysql using mvc architecture. wish transfer these stuff wordpress. how go on doing that? saw wp mvp plugin cant figure out how working. thanks i realize original question asked year ago. since had ran same issue in past, , found easy solution, thought i'd post come across this. what use mvc in wordpress rokkomvc , not plugin, rather integrates directly theme. can use better manage ajax requests (using mvc instead of global functions in functions.php), divide code , use through out theme. i've found easy , painless way port code on cakephp right wordpress.

php - Joomla 1.0 issue with com_frontpage and RSS reader -

i have 99% working rss reader in php built joomla frontpage, regardless of published article newest (i.e. top of list) has following code built url.. url works ok, looks untidy. option=com_frontpage&itemid=56 so rss link looks this: <a href="option=com_frontpage&itemid=56http://www........">title</a> the http://www ... correct link unknown reason joomla adding component link it. all other rss links don't have this. there no issues in rss script. checked, double checked, checked else. it must happening in joomla. any 1 got ideas. thanks p.s. know it's joomla 1.0 , bad. it's heavily modified backend in other areas not effecting , on internal server only. added code function check prepending annoyance , remove it. if($this->link) { //check multiple http if($index == 0 && !preg_match("/^http/i", $this->link)){ $this->link = substr($this->link, strpos(...

Many-to-Many insert failing - Entity Framework 4.1 DbContext -

i using db first method, ef 4.1 dbcontext poco code gen. my database has many-to-many relationship shown below: employee employeeid employeename account accountid accountname employeeaccount employeeid accountid the problem occurs when trying insert new employee, , assign them pre existing account, doing below: employee emp = new employee(); emp.employeename = "test"; emp.accounts.add(methodthatlooksupaccountbyname("someaccountname")); context.employees.add(emp); context.savechanges(); the sql executing (incorrectly), attempting insert new [account] record, , failing on constraint violation. of course, should not insert new [account] record, should insert new [employeeaccount] record, after inserting [employee]. any advice? thanks. methodthatlooksupaccountbyname method return attached or detached object? in case, may try attach object returns context. employee emp = new employee(); emp.employeename = "test"; var...

javascript - Event which triggers before DOMContentLoaded -

in firefox extension using domcontentloaded detect page load , insert html. there event triggers before , still document available @ time? there content-document-global-created notification sent out when document created, before content added (to precise, happens when browser receives http headers of response , knows isn't redirect or such). that's earliest point can document. domcontentloaded event fired once gecko finishes downloading contents of document, that's earlies point can access complete dom. in between there bunch of other events, e.g. lots of progress listener events - 1 use depends on trying do, there no general answer.

oop - Why should we place interfaces with classes that use them rather than those that implement them? -

Image
i going through article robert c. martin , @ 1 place gave example this: the first image shows there's cyclic dependency between 2 packages. remove dependency new interface added in second image. b implements interface , y uses it. , martin makes following point: interfaces included in package uses them, rather in package implements them. my question is, why should arrange interfaces way? reasoning behind packaging interfaces way? according common closure principle classes change should stay together. interface closer implementer or user, in terms of change??? technically, user no closer interface implementor. in terms of change both need change when interface changes. however, why interface change? the user calls interface can independent of whatever implementor available. therefore definition of interface dictated needs of user. as user dictates definition of interface, there no point changing interface if user doesn't need it. implementor re...

android - how can get the phone number and mails ID and name -

kindly me how can phone numbers, names , emailid kindly me i think link you http://www.higherpass.com/android/tutorials/working-with-android-contacts/

mysqldump - ERROR 1005 (HY000) at line 156: Can't create table 'db1.testtable' (errno: 121) -

i restoring databases mysqldump file , getting following error: error 1005 (hy000) @ line 156: can't create table 'db1.testtable' (errno: 121) as sql has been created mysqldump utility, confused how error has appeared in sql code! the relevant lines in dump.sql are: create table `testtable` ( `username` varchar(255) not null, `password` varchar(255) not null, `emailaddress` varchar(255) not null ) engine=innodb default charset=latin1; thanks, jim errno 121 means duplicate key error. table exists in innodb internal data dictionary, though .frm file table has been deleted. common reason getting errno 121 in table creation. possible reason name conflict in foreign key constraint name. constraint names must unique in database, table names are. what innodb print in .err log?

linux - Adding an || regex to a bash ``ed one-liner in a perl script -

i trying add || regex bash ``ed one-liner in perl script, if makes sense. my $result = `df -h | grep -ve '^filesystem|tmpfs|cdrom|none' | awk '{ print \$1 "\t" \$5 " used."}'`; # .private maybe same /dev/sdb1 i'm trying remove # trying add || (m/\.private/) above print "$result"; so removing lines output start filesystem, tmpfs, cdrom or none, @ present, , "or lines containing .private" one-liner, if possible... i have below also, want reproduce results above code... my @result2 =shell::df ("-h"); shift @result2; # rid of "filesystem..." for( @result2 ){ next if ((/^tmpfs|tmpfs|cdrom|none/) || (m/\.private/)); @words2 = split('\s+', $_); print $words2[0], "\t", $words2[4], " used\.\n"; } you need add \.private part current regexp: grep -ve '^filesystem|tmpfs|cdrom|none|\.private' on side note, pattern ^filesystem|tmpfs|cdrom|none might ...

Usefulness of extending jQuery core -

i discovered method of extending core jquery init function (which gets called anytime use $() or jquery() function). not possible using ordinary proxy pattern following code makes work: var originit = jquery.fn.init; jquery.fn.init = function(selector, context, rootjquery) { if (some condition) { //custom code here, possibly returning other jquery object //what jquery return } return originit.call(jquery.fn, selector, context, rootjquery); } my question might useful, since realized initial intent of using caching of selectors problematic (since affect behavior of other plugins -- ended using separate function caching). so thought i'd share method , i'm curious hear other ideas potential uses of it. thought maybe used support custom selectors of kind, although i'm not sure when needed since jquery offers lot of selectors. you find jquery has method build around concept. jquery.sub() this allows extend jquery locally without...

int array to opengl texture in android -

i'm trying add efects camera in android, found things on internet got stuck when creating texture, i use funcion decodeyuv420sp() returns me int[width*height] rgb array hex values each array position, now, want create opengl texture of array dont know how, can convert each hex value r_g_b separated , put opengl doesn't work this: mnewtexture = new int[width*height*4] for(int i=0; i<mrgb.length; i=i+4){ mnewtexture[i] = getr(mrgb[i]) ; //r mnewtexture[i+1] = getg(mrgb[i]) ; //g mnewtexture[i+2] = getb(mrgb[i]) ; //b mnewtexture[i+3] = geta(mrgb[i]); //a } to convert hex value rgba (from 0 255) and convert opengl texture: gl.glbindtexture(gl10.gl_texture_2d, tex); gl.glteximage2d(gl10.gl_texture_2d, 0, gl10.gl_rgba, 1024, 512, 0, gl10.gl_rgba, gl10.gl_float, floatbuffer.wrap(mnewtexture)); gl.gltexparameterf(gl10.gl_texture_2d, gl10.gl_texture_min_fi...

HTML UL LI CSS: How to change the marker to something other than disc, square, circle, or an image? -

the web filled advice & example pages how change ul li marker other dot or square or circle. many of them suggest using gif file, not prepared do. all of these examples have 1 thing in common: don't work in firefox. mean, it's extraordinary! not 1 of them functions claimed. the main suggestion use li:before { content: "(expression)"; }; this not work. neither when places inside <style> </style> , nor when placed inside style="" . can please explain method bring real , genuine effect of changing dot/square/circle of choosing? for example, let's make star character. i found creative way of doing this. check out developer did css: http://nicolasgallagher.com/pure-css-gui-icons/demo/ under "user interaction" half way down made star icon using css. is looking for? i found, copied, pasted code snippet star icon. http://jsfiddle.net/jchwe/1/

Get a subdomain of a URL using ColdFusion -

how can subdomain of url using coldfusion? for example, had following url: http://support.foo.com how 'support'? is there built in function this? here's basic idea: <cfset domain = cgi.server_name> <cfset subdomain = ""> <cfif listfirst(domain, ".") neq "foo" , listfirst(domain, ".") neq "www"> <cfset subdomain = listfirst(domain, ".")> </cfif>

BLToolkit + T4 generation + PostgreSQL database, possible? -

want generate data layer using bltoolkit , t4 templates , postgresql. receive exception running t4 template, based on 1 suggested documentation : error 5 running transformation: system.argumentnullexception: value cannot null. parameter name: type, @ system.activator.createinstance(type type, boolean nonpublic) (...) working in vsnet08, libraries referenced, connecting mssql works ok, , @ first, seems correct, leave something... this .tt template: <#@ template language="c#v3.5" hostspecific="true" #> <#@ output extension=".generated.cs" #> <#@ include file="bltoolkit.ttinclude" #> <#@ include file="postgresql.ttinclude" #> <#@ include file="pluralsingular.ttinclude" #> <# connectionstring = "<connection string postgresql database"; dataproviderassembly = @"..\references\npgsql.dll"; generatemodel(); #> most t4 can't find np...

jquery - ASP.NET MVC - Validation Summary and BlockUI -

so i've been blocking page "loading" message using following code logon page <input id="submit" type="submit" value="log on" onclick="block();"/> if there's error validation though, block message stay there forever. what's best way present block message takes validation account? if validation being triggered automatically , stopping form posting, move block(); call forms onsubmit attribute: <form onsubmit="block();"> this way, trigger when form submits, rather when user clicks button when form may invalid.

javascript - Saving the whole EditorGrid with a single Ajax request -

i save extjs (3.3.1) editorgrid single ajax request. i've created editorgrid, based on arraystore. var store = new ext.data.arraystore({ data: arraydata, fields: [ 'id', 'qty', 'idservice', 'idsubscription', 'description', 'vat', 'amount' ] }); [...] var grid = { xtype: 'editorgrid', store: store, view: gridview, colmodel: colmodel, selmodel: selmodel, striperows: true, tbar: tbar, autoheight: true, width: 872, clickstoedit: 1 }; i've created save button following handler: app.inv.savebuttonhandler = function () { var myform = ext.getcmp("formheader").getform(); if (!myform.isvalid()) { ext.messagebox.alert('form not submitted', 'please complete form , try again.'); return; } myform.el.mask('please wait', 'x-mask-loading'); ext....

sql - Mysql trigger issue (i think it's firing) -

i have issue trigger on mysql database. have table such follows: id int not null auto_increment (pk) parent_id int not null, rank int not null what i'm trying use trigger update rank next highest +10 when have same parent_id, doesn't seem working. delimiter $$ drop trigger if exists after_insert $$ create trigger after_insert after insert on mytable each row begin if exists (select rank mytable parent_id = new.parent_id , id != new.id order rank desc limit 1) update mytable set rank = 10 id = new.id; else update mytable set rank = 20 id = new.id; end if; end $$ i've tried setting new rank variable , calling update statement using that, , again didn't work. created table log values being selected , worked can't quite understand what's going on. case of, although trigger "after insert" insert hasn't happened can't update row it's inserted? reason ask is, i've tried updating rank different values e.g 1 , 2 ...

Tomcat not executing Servlets service() method -

i have web applications in tomcat 5.5 .i have default configuration tomcat i hit url various servlets , these normal servlets , , response expected , but response , nothing in it.it gives me blank response i tried debugged same , found service() [doget / dopost] of particular servlet not being executed. i checked access logs of tomcat found request hitting atleast servlet 192.168.0.116 - - [14/oct/2011:11:40:31 +0530] "get /myapp/myservlet http/1.1" 200 - why container not executing service()?

wordpress - Exclude latest post from category X but display the rest? -

i show posts exclude newest post 'featured' category, other posts cat should display. idea should add loop achieve this? don't understand it! $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array('paged' => $paged, 'category_name' => 'featured', 'offset' => '1')); if(have_posts() : while(have_posts()) : the_post(); // blah blah layout here endwhile; endif; wp_reset_query;

postgresql - Java Crosstab - preparedstatement query -

i have typical crosstab query static parameters. works fine createstatement. want use preparestatement query instead. string query = "select * crosstab( 'select rowid, a_name, value test a_name = ''att2'' or a_name = ''att3'' order 1,2' ) ct(row_name text, category_1 text, category_2 text, category_3 text);"; preparedstatement stat = conn.preparestatement(query); resultset rs = stat.getresultset(); stat.executequery(query); rs = stat.getresultset(); while (rs.next()) { //todo } but not seem work. i psqlexception - can't use query methods take query string on preparedstatement. any ideas missing? you have fallen confusing type hierarchy of preparedstatement extends statement : preparedstatement has same execute*(stri...

destroying an object in javascript -

this know quite basic one, but, please tell me how can destroy object in javascript, created dynamically. actually have created instance of nicedit javascript text editor, , after taking user's input in , saving entered text, want destroy it. here's snippet of code im using create instance: myniceditor = new niceditor(); here nicedit variable global. and here's how im destroying right now: myniceditor = undefined; inside function. but, not deleting. know b'coz when create instance using same variable name, i'm able see last entered text, has saved internally. plz help.. just @ documentation , stated clearly.

Java class variable number -

i'm learning java , have question. i created class named "driver" , hold driver's information (name , birthday). to create new driver need do: driver d1 = new driver("john", "01/01/1980"); now imagine have program read x drivers information file. how can create x drivers? my problem i'm thinking need x variables x drivers variables can hard-coded me... or can use array or collection ( list or set ): list<driver> drivers = new arraylist<driver>(); drivers.add(new driver(..)); drivers.add(new driver(..)); when reading file use loop. on each iteration add object list.

Is this a good way to create a dynamic webpage using PHP? -

i'm trying create dynamic webpage using include() in php. php page has following codes - literally, that's file contains: <?php session_start(); $dbname = $_request['dbname']; $tbname = $_request['tbname']; $dbtype = $_request['dbtype']; include('header.php'); switch($dbtype) { case 'calender': include('calenderpage.php'); exit; case 'news': include('newspage.php'); exit; case 'gallery': include('gallerypage.php'); exit; } include('footer.php'); ?> do think it's way of creating dynamic php page? what show fine. done bit simpler using array: <?php session_start(); // explicitly using $_get or $_post better $_request $dbname = $_get['dbname']; $tbname = $_get['tbname']; $dbtype = $_get['dbtype']; include('header.php'); // sure have array of allowed pages // people ca...

c# - Linq multi keyword search -

i have situation have keyword column in table contains comma separated keywords. user can provide multiple search terms search against keyword column. example user provides below search terms "one,two,three" , db column may contain of "one" ,"two", "three" or none of them. how can write query matches against of provided search term. i have tried below string[] searchterm = {"one","two","three"}; query =product.where( p=> searchterm.any(val => p.keywords.contains(val))); and var query=db.products; foreach (string searchword in searchterm) { query = query.where(c => c.keywords.contains(searchword )); } but not working me. thanks, if split text provided user in different keywords, in converting "one,two",three" in string[], like: string [] keys = keywords.split(','); var query = new list<product>(); foreach (var item in keys) { query = qu...

android - Is there a way to specify a Layout to use for a ListView when the adapter is empty? -

i have complex empty view in layout, icon, text, button, etc. it easy select view within layout.xml use when listview empty, similar to getlistview().setemptyview(findviewbyid(r.id.empty)); code sets empty view works fine when resides in layout.xml file. now want refactor view own empty.xml layout file, , have coded similar following: // setup empty layout.xml layoutinflater vi = (layoutinflater) this.getsystemservice(context.layout_inflater_service); view vlempty = vi.inflate(r.layout.empty, null); // find empty layout view vempty = vlempty.findviewbyid(r.id.llempty); vempty.setonclicklistener(ocl); // find listview vlistview = (listview) findviewbyid(r.id.lvwords); vlistview.setemptyview(vempty); the problem details within llempty never show up; exact same layout , view works withing main layout, not refactored own xml file. has got work? i doubt setemptyview() automatically makes supplied view child of container in activity. personally, i'd use ...

python - ImageField won't delete file when using os.unlink() -

i have model: class userprofile(models.model): """(userprofile description)""" user = models.foreignkey(user) image = models.imagefield(upload_to=upload_to) def save(self): os.unlink(self.image.path) super(userprofile, self).save() the script fails on unlink() method, , says file cannot found. ideas? the error says (2, 'no such file or directory') you need more specific debugging. furthermore, way you've written code ensures errors happen. i'm not entirely sure, wouldn't surprised if value userprofile.image isn't set before userprofile record created. so rewrite code thusly: class userprofile(models.model): user = models.foreignkey(user) image = models.imagefield(upload_to=upload_to) def save(self): if self.image.path: try: os.unlink(self.image.path) except exception, inst: raise exception(...

c# - How to get columns Primary key constraints using SqlConnection.GetSchema() -

i have code of ado.net dynamically detect database schema, need how unique columns constraints , primary key constraints using getschema method on sqlconnection . code have: conn.open(); sqlcommand msqlcommand = new sqlcommand("sp_pkeys", conn); msqlcommand.commandtype = commandtype.storedprocedure; msqlcommand.parameters.add( "@table_name", sqldbtype.nvarchar).value = tablename; sqldatareader mreader = msqlcommand.executereader( (commandbehavior.keyinfo | commandbehavior.schemaonly)); //executereader(); datatable schema = mreader.getschematable(); mreader.close(); conn.close(); there nothing in call getschematable on sqlconnection allow figure out. it might seem can, using iskey column value, should return true contributes uniquely identifying record in table. however, documentation iskey column (emphasis mine): true : column 1 of set of columns in rowset that, taken together, uniquely identify row. set of columns is...

multithreading - Seek help, "error: GC operation on unregistered thread. Thread registered implicitly." -

i hit error "malloc: *** auto malloc[731]: error: gc operation on unregistered thread. thread registered implicitly. break on auto_zone_thread_registration_error() debug." my app works , when users double click row in nstableview, url row, ask webview load page url: [tableview setdoubleaction:@selector(doubleclickaction:)]; ... - (ibaction)doubleclickaction:(id)sender { ... /* cause malloc error */ [[webview mainframe] loadrequest: [nsurlrequest requestwithurl: row.url]]; } so how fix ? thanks! so got reply https://bugs.webkit.org/show_bug.cgi?id=59938 , "this fixed in r81825. it’s harmless message can ignored."

php - How to implement implode in foreach? -

here trying add comma in values got foreach loop. values coming together, want echoed comma separated. please suggest me gotta . know, gotta use implode, don't know how in loop. foreach($_post['insert'] $interested) { if(!preg_match('/^[-a-z0-9\., ]+$/id', $interested)) continue; echo $interested; } if want leave code relatively untouched (though fixed confusing indentation)... $interestedvalues = array(); foreach($_post['insert'] $interested) { if(!preg_match('/^[-a-z0-9\., ]+$/id', $interested)) continue; $interestedvalues[] = $interested; } echo implode(',', $interestedvalues); ...or 1 liners seem fashionable... echo implode(',', preg_grep('/^[-a-z\d., ]+$/id', $_post['insert']));

java - Best way for handle Read HTTPRequst post data on Restful api -

what best way of save data using restful web service without using ajax? example need add new customer database using submit button. best way of transfer data format (text,json,xml) ? how read post or data httprequest object? if can please give me example in java . thank i think need separate concepts bit. "restful web service" web service designed using rest principals , whereas ajax set of technologies used on client side asynchronous requests multiple resources (without reloading page). web service shouldn't care how http request generated, contents of http request. now if you're concerned writing rest service in java, highly recommend looking jax-rs , reference implementation jersey . there lots of examples of how , running. can use messagebodyreader implementations convert data http request entity java objects. obviously not way started writing restful web service in java, 1 way.

CakePHP application automatically logs out within few seconds -

i have used cakephp in application. has weird problem. times user being automatically logged out after within few secs. how stop auto log out? i have set below codes in app/config/core.php: configure::write('session.timeout', '120'); configure::write('security.level', 'low'); the best way set session time out in app/config/core.php . configure::write('session', array( 'defaults' => 'php', 'timeout' => 20,//20minutes 'autoregenerate' => true,//resets session on activity 'cookietimeout' => 1440 ));

windows - Can task-switching keyboard shortcuts be disabled in W7 using Delphi? -

my application has had mode years customer can 'disable access os'. feature goes against grain (at least far windows concerned) there installations app program should ever visibile machine operator amd in case such feature useful. the technigue used built several 'layers': hide taskbar , button. disable task-switching. disable main form system icons. to disable taskbar used: // handle taskbar , button.. taskbar := findwindow('shell_traywnd', nil); startbutton := findwindow('button', nil); // hide taskbar , button if taskbar <> 0 showwindow( taskbar, sw_hide ); if startbutton <> 0 showwindow( startbutton, sw_hide ); // set work area whole screen r := rect( 0,0,screen.width,screen.height ); systemparametersinfo( spi_setworkarea, 0, @r, 0 ); this worked , still seems fine on w7. researching how disable task-switching years ago turned technique of 'pretending' app screen saver (other terrible things renamin...

MySQL- Trigger updating ranking -

i'm creating db "team" table nfl teams, , have assigned them ranking (standing in nfl), attribute called "ranking". i want create trigger such if ranking updated, of others updated appropriately. however, can't figure out way loop through table. example, assume team @ rank 5 moves rank 3, how rank 3 become 4, , 4 5? if need more info, feel free ask, i'll provide asap. if know id of team update (lets call 42) , old , new rank (old: 5, new: 3), it's not hard: update team set rank=rank+1 rank between 3 , 5; update team set rank=3 id=42;

c++ - Making DrawText break a string -

so can make drawtext break string if string has spaces, or if put in \r\n @ end of string. however, long string has no spaces or line breaks in continues past drawing rectangle , gets clipped. prevent this, if possible. nothing in format flags drawtext stood out me make happen. ideas? what normally use dt_wordbreak flag. drawtext documentation on msdn , this: breaks words. lines automatically broken between words if word extend past edge of rectangle specified lprect parameter. carriage return-line feed sequence breaks line. if not specified, output on 1 line. however, have single unbreakable line - is, there no words. you need after breaks yourself. can solve 2 ways: use drawtext dt_calcrect calculate size of rectangle - loop, shortening string, until you've found string first line, repeat remaining string. is, find subset index 0-n fits horizontally in width of drawing area; find string n+1-m fits horizontally again; repeat un...

java - Writing JSON using Jackson blocks my TimerTask -

i write json every 5th second. i'm using jackson write json, seem block timertask. if don't write json, timertask run every 5th second, when try write json it's blocked , run once. how can fix this? public class mytimertask extends timertask { public static void main(string[] args) { timer timer = new timer(); // execute mytimertask every 5th second timer.scheduleatfixedrate(new mytimertask(), 1000l, 5 * 1000l); } @override public void run() { system.out.println("timertask"); // write json system.out objectmapper mapper = new objectmapper(); try { mapper.writevalue(system.out, "hello"); } catch (exception e1) { e1.printstacktrace(); } } } here stack dump timer thread: "timer-0" prio=6 tid=0x02488000 nid=0x10ec in object.wait() [0x04a6f000] java.lang.thread.state: timed_waiting (on object monitor) @ java.l...

iphone - How to remove a subview (or all subviews of a view) -

i have method in alloc , init uiview (`tabsclippedview = [[[uiview alloc] initwithframe:tabsclippedframe] autorelease];`). this view has view added (`tabsview = [[[uiview alloc] initwithframe:tabsframe] autorelease];`). then initiate couple of buttons (e.g. `uibutton* btn = [[[uibutton alloc] initwithframe:frame] autorelease];`) and add them subview of view. now time time, need delete buttons , assign them again. best way delete entire view or subview added buttons? how need (without memory leaking etc.)? would simple self.tabsview = nil; suffice delete view , of subviews (i.e. buttons)? or better delete superview well, start entirely scratch: self.tabsclippedview = nil; since uiview autoreleased, need remove superview. there removefromsuperview method. so, you'd want call [self.tabsview removefromsuperview] . long property declaration set retain that's you'll need.