Posts

Showing posts from April, 2011

c# - overloading explicit CAST operator with user-defined interface parameter -

c# - overloading explicit CAST operator with user-defined interface parameter - at these given classes [activerecord] public class basemoo : activerecordbase [activerecord] public class foo : basemoo { } somewhere in code do var fooobj = new foo(); // fooobj basemoo obj = fooobj; here seek cast var newfooobj = (foo)obj; // , goes if changes classes this: [activerecord(lazy=true)] public class basemoo : activerecordbase [activerecord(lazy=true)] public class foo : basemoo { } making lazyest @ these lines: var fooobj = new foo(); // fooobj basemoo obj = fooobj; the ar creates non foo instance instead basemooproxy object var newfooobj = (foo)obj; // throws invalidcast exception as sugested @adam houldsworth in this question i overloads foo explicit operator in way public static explicit operator foo(nhibernate.proxy.inhibernateproxy nhproxy) { var resultobj = (foo)nhproxy.insomewayigettheoriginalobject(); // insomewayigettheoriginalobje...

java - Is there a simple way of parsing this text into a Map -

java - Is there a simple way of parsing this text into a Map - i receive response service below. how parse map ? first thought of split @ whitespace doesn't work value might contain spaces e.g. @ value of sa key in below response. one alternative thought of split @ whitespace provided previous character double quote. not sure how write regex though. tx="0000000000108000001830001" fi="" os="8" ci="qu01sf1s2032" aw="sss" sa="1525 windward concourse" parse @ quotes. utilize regular look find each key/value pair, assuming each value in quotes. question be, rules if value contains embedded quotes? (are escaped using '\' or such? regardless, not accounted in below...) for example: (\w+)="([^"]*)" this give groups #1 , #2 can used provide key , value, respectively. run in loop, using java's matcher.find() method, until find of pairs. sample code: string input = ...

iphone - Difference between Icon properties in info.plist? -

iphone - Difference between Icon properties in info.plist? - i'm working on iphone app , i'm not sure plist property utilize out of following: could shed lite on each of them , difference between them? apple requires include icon measures 57x57 pixels. if going utilize image, set under icon file property. however, apple recommends include images of different sizes different purposes, such retina display, ipad, , search bar. if going include multiple images, create app better, retina one, include of images in icon files property. note not need icon file property if using icon files property. i still developing ios 4 not know icon files (ios 5) property assume there new places icon might pop in ios 5 not pop in older ios versions. place images under property. hope helps. iphone ios xcode

asp.net - Change folder permission after deploy -

asp.net - Change folder permission after deploy - i have in application folder save files uploaded users. folder needs write permision apppool user. untill did manualy. my question is, if done somehow automatic ? maybe running script after deploy or this. i have not tried out myself, seems if deployment bundle stuff in vs2010: http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/ asp.net asp.net-mvc deployment

c# - Google Contacts API - After getting the access token (oauth) -

c# - Google Contacts API - After getting the access token (oauth) - i managed access token google's contacts api when seek create phone call retrieve logged in user's profile, 401 unauthorized error... i did research , followed steps mentioned in "various" google documentations ( this one , this one , many others) no use... so far think i'm signing request wrong. here's i'm doing after access token. string outurl,querystring; string sig = oauth.generatesignature(new uri("https://www.google.com/m8/feeds/contacts/default/full"), server.urlencode(oauth.consumerkey), oauth.consumersecret, oauth.token, null, "get", timestamp, nonce, out outurl, out querystring); string requrl = "https://www.google.com/m8/feeds/contacts/default/full?access_token=" + oauth.token + "&oauth_signature_method=hmac-sha1&oauth_signature=" + server.urlencode(sig) + "&oauth_consumer_key=" + oauth.consumerkey + ...

Android autoCompleteTextView changes with screensize? -

Android autoCompleteTextView changes with screensize? - hello fellow android developpers, i have problem regarding autocompletetextview. i'm developping on tablet, , customized nicely. when run on tablet, looks this: this want - visible, little items, bluish instead of orange. cool. , happens when run exact same app on smaller device, illustration nexus-s: the original views disappear, have orange stuff, , see 1 suggested item @ time or 2 @ best. not intended. if run app not in landscape, in portrait, works fine. insane. know can maintain custom layout on smaller screen? the sec image shown here result of auto finish text view or edit text when device in landscape mode. if device in portrait mode display suggestions in vertical list, , landscape mode display in horizontal list , tries fill entire screen edit text , soft keyboard. i faced same problem, please check android developers website info supporting multiple screens, may help you. new answe...

php - Using a constant inside a static array -

php - Using a constant inside a static array - im on php 5.2.x i have loader class looks so: class loader { static $account_nameclasses = array( 'db' => '/home/account_name/public_html/includes/php/db.php', 'skin' => '/home/account_name/public_html/includes/php/skin.php', 'api' => '/home/account_name/public_html/api/apiclass.php', 'search' => '/home/account_name/public_html/includes/php/search.php', 'user' => '/home/account_name/public_html/includes/php/user.php' ); static function loader($classname) { $filename = self::$account_nameclasses[$classname]; if(file_exists($filename)){ require_once $filename; }else{ homecoming false; } } } spl_autoload_register(array(account_name_loader, 'loader')); as can see, repeat /home/account_name/public_html/includes/ph...

Is there any good redmine plugin for integration testing? -

Is there any good redmine plugin for integration testing? - actually follow procedure testing http://www.exforsys.com/tutorials/testing/integration-testing-whywhathow.html and i'm trying find redmine plugin job far find testing plugins related automated tests cover jenkins. so needed link above describes redmine plugin. suggestions please? i not sure how want redmine job. utilize plan test cases , track results. out-of-the-box functionality, creating handful of custom fields , statuses. custom fields: create 1 field each of columns in article's sample test case table. statuses: create few statuses such draft & approved (to used during planning phase), , failed, passed, closed (to used while testing underway). if you're going have multiple iterations of integration testing, can utilize versions functionality plan them , track progress on each wave of testing. if i'm missing point, or if there's missing functionality you'd need p...

html5 video interactive objects -

html5 video interactive objects - does know if html5 video allows objects buttons, menu, etc connected timeline? youtube flash player this: in specific moment, show object (banner, links, comments) on video defined seconds. thanks yes , no, it's possible create interactive video-based presentations using html5 video objects requires lot more video object itself. can nest video canvas object mess actual video image frames, can overlay visual html element on top of video object animate these, can command video playback buttons, click events etc. can have video object command rest of page time-based listeners. popcorn.js really , easy learn, allowing of mentioned. http://popcornjs.org http://popcornjs.org/demos html5 video

objective c - How can i format the HTML contents of mail in iphone ? -

objective c - How can i format the HTML contents of mail in iphone ? - i using mfmailcomposer mailing.i convert contents of url in string , utilize string send mail service . problem html file contains button link image , when mail service gives 2 blank icon html page.how can remove icons before mail service send. if not necessary convert url content string. pass html in mfmailcomposer . but if want observe tags in content of url parse whole html of url , check button(input) tag. , can check completed button tag also. ignore statements between starting , ending point of tags , create html content. njoy coding... :) objective-c ios5 xcode4.2 mfmailcomposer

cpan - cpanm perl modules installed to user directory -

cpan - cpanm perl modules installed to user directory - i'm new perl , trying install net::sftp module running cpanm net::sftp i tried install , after 5-10 minutes failed following ! configure failed math-gmp-2.06. see /users/applemacbookpro/.cpanm/build.log details. ! bailing out installation net-ssh-perl-1.34. retry --prompt or --force. ! bailing out installation net-sftp-0.10. retry --prompt or --force. 19 distributions installed but, when tried install again, noticed message: can't write /opt/local/lib/perl5/site_perl/5.12.3 , /opt/local/bin: installing modules /users/applemacbookpro/perl5 so, have bunch of modules installed in ~/perl5 directory - going run problems if install using sudo , perl modules located in 2 separate directories? perl searches modules based on @inc, can see perl -v . (that's uppercase "v".) if have module installed in 2 locations, first 1 found in @inc 1 loaded. perl wouldn't know in /users/applemacb...

javascript - Animate a "print" element with raphael js -

javascript - Animate a "print" element with raphael js - i know if possible animate print raphaeljs? because this: var text = paper.print(10,10,"text here",font,20).animate({transform:"t100,100"},500); doesn't work @ all... thanks raphael's documentation says .print() returns set, need treat such... var text = paper.print(10,10,"text here",font,20) text.foreach(function(){ this.animate({transform:"t100,100"},500); }) i must tried code , text returns empty array, might have improve luck. javascript raphael

java - On transactions and event listeners -

java - On transactions and event listeners - let me see if understand correctly. normally, should strive set operations belong 1 "unit of work" under same transaction, right? helps revert state of db in case of exception somewhere along chain of operations. however, in particular case, have old service, not easy plug current code. hence have maintain running separately, , give rights same database current application stores data. the problem comes when have insert new item db. have phone call service. if under 1 transaction, service start looking record in db, before transaction has committed. thus, started using event listeners, namely postinserteventlistener , postdeleteeventlistener. now works ok, since transaction commits beforehand, totally disrupts code architecture. have built series of services inject each other, , have declare 2 listener classes. guess, best can create coordinator service implement 2 listener interfaces, in way totally couple hibernat...

exception - Selenium 2.18.0 - UnhandledAlertException upon driver initialization, how can you handle it? -

exception - Selenium 2.18.0 - UnhandledAlertException upon driver initialization, how can you handle it? - i did mistaked , updated pom.xml selenium 2.18.0 unhandledalertexception during operation new feature: alert handling in firefox , ie: throwing unhandledalertexception if alert nowadays during operation. unhandled alert dismissed mitigate repeat exceptions. but if phone call driver = new internetexplorerdriver(); it results in modal dialog nowadays exception, because current scheme needs proxy credentials, filled looping auto-it script (just in case needs it): dim $arrtitle[2] = ["authentification required", "windows security"] while 1 $stitle in $arrtitle if winexists($stitle) winactivate($stitle); send("{home}"); send("+{end}"); send("{del}"); send("user"); send("{tab}"); send("{home}"); send("+{end}...

codeigniter - Converting arrays in php -

codeigniter - Converting arrays in php - how convert array this: array ( [0] => dog [1] => cat [2] => goat [3] => pig [4] => gorilla ) into this: array(array('dog'), array('cat'), array('goat'), array('gorilla')); i'm trying started codeigniter's table class , needs format 1 above work. foreach($array $item) { $result[] = array($item); } php codeigniter

javascript - applying a timed hold after mouseover to a css hover element -

javascript - applying a timed hold after mouseover to a css hover element - this simple using javascript or jquery, cannot wrap head around it. providing sample using simple css box :hover applied in different color. want box go hover would, want hover lastly set amount of time, regardless of mouse motion after hover. after set time has finished, hover reset normal. if user accidentally hover on #box while hover beingness held not reset, go on hold until after set time has finished. here html , css #box { width: 200px; height:300px; background-color: #00ccff; } #box:hover { width: 200px; height:300px; background-color: #669933; } <!doctype html> <html> <head> </head> <body> <div id="box" </div> </body> css .box-normal { width: 200px; height:300px; background-color: #00ccff; ...

ios - tabbar memory management -

ios - tabbar memory management - a tab bar based app 5 tabs switching option...how suppose manage memory efficiently? switching between tab frequent how manage scenario? or all tab remain active no matter what? thats bad option... please describe in detail regarding tab bar memory management let uikit handle it. shouldn't worry. uikit unload views sees fit (and told in viewdidunload of view controllers). so instance: you start on tab 1. tab 1 view controller view loaded. you tap on tab 2. tab 2's view controller loaded , tab 1's view controller still around. more time goes on, tap on other tabs loads other view controllers. uikit notices memory running bit low or wants bit of tidy (you have no command on this). go , unload of view controllers' views (but never 1 you're viewing). you should of course of study citizen , release hold onto in view controller in viewdidunload can create 1 time again when view wants loaded again. ...

PHP exceptions: where to put dynamic data? -

PHP exceptions: where to put dynamic data? - i'm in process of rewriting error handling of pear's text_languagedetect exceptions , don't know dynamic info in exceptions: throw new text_languagedetect_exception( 'language database not exist.', text_languagedetect_exception::db_not_found ); here i'd include file name tried opened, question where set it: language database /path/to/file.ext not exist. language database "/path/to/file.ext" not exist. language database not exist: /path/to/file.ext language database not exist: "/path/to/file.ext" 1+2 proper english language sentences, while 3+4 create easy grep message in code. also, extracting file name code easier in 3+4. which 1 should use, why? another question is: should set file name? when set exception message, may give attackers info file construction on server if sees message. without file name, it's harder debug. you should utilize m...

java - How to dance around a NullPointerException? -

java - How to dance around a NullPointerException? - i'm trying check whether or not move legal in game othello, using eclipse , gridworld. first thing location check if valid, in order check validity location, needs not null. problem is, 1 of requirements of beingness legal move is null/empty/unoccupied. how avoid this? have pointed out error supposedly at. (sorry if confused anyone.) public boolean islegal(location loc1) { boolean islegal = false; string currentcolor = currentplayer.getcolor(); int row = loc1.getrow(); int col = loc1.getcol(); if(board.isvalid(loc1)) { if(board.get(loc1) == null) { for(location temploc : board.getvalidadjacentlocations(loc1)) { **if(!board.get(temploc).equals(currentcolor))** { if((row != temploc.getrow()) && (col == temploc.getcol())) { //count column ...

node.js - Base64 encoding for Sec-WebSocket-Accept value -

node.js - Base64 encoding for Sec-WebSocket-Accept value - a while ago, started experimenting websockets node.js taking care of backend. working fine, when homecoming protocol has been updated , can't work anymore. specifically, problem sec-websocket-accept header. seem doing wrong when calculating it, although can't fathom might be. far can tell, i'm next instructions on wikipedia dot. here's code: var magicstring = "258eafa5-e914-47da-95ca-c5ab0dc85b11"; var secwskey = req.headers['sec-websocket-key']; var hash = require('crypto') .createhash('sha1') .update(secwskey + magicstring) .digest('hex'); var b64hash = new buffer(hash).tostring('base64'); var handshake = "http/1.1 101 web socket protocol handshake\r\n" + "upgrade: websocket\r\n" + "connection: upgrade\r\n" + "sec-websocket-accept: "...

reporting services - Substitute command for OVER in SSRS -

reporting services - Substitute command for OVER in SSRS - how can implement over() command in ssrs 2008? is there trick it, or stuck? and if indeed not able utilize over(), how can utilize partition in ssrs report? over() satisfies requirements, , telerian (another member) helpful pointing out - ssrs doesn't seem able utilize reporting. every time utilize variant of over() or partition in ssrs select statement, rebuffed scheme - thoughts or work-arounds? the error message receiving 2008 query studio was: the on sql build or statement not supported. this may due not including column alias summarised column - next sql generates usable dataset me in ssrs: select d.*, row_number() on (partition date order id) rn dbo.mytable d reporting-services ssrs-2008

.net - WPF Printing Large Report Causes OutOfMemoryException -

.net - WPF Printing Large Report Causes OutOfMemoryException - i've created fixeddocument study printed monthly. average 350 pages in length half pages beingness ~200kb jpeg images. study displays nicely in documentviewer, nail problems when attempting print it. when using documentviewer1.print() if seek , print first 3rd of months info eg. 120 pages, works fine. if seek whole month, @ 160th page next error system.outofmemoryexception: insufficient memory go on execution of program. @ system.windows.media.imaging.bitmapsource.criticalcopypixels(int32rect sourcerect, intptr buffer, int32 buffersize, int32 stride) @ system.windows.media.imaging.bitmapsource.criticalcopypixels(int32rect sourcerect, array pixels, int32 stride, int32 offset) @ microsoft.internal.gdiexporter.cgdibitmap.load(bitmapsource pbitmap, byte[] buffer, pixelformat loadformat) @ microsoft.internal.gdiexporter.cgdirendertarget.drawbitmap(bitmapsource pimage, byte[] buffer, re...

javascript - How to send my jQuery form to node.js connect-form -

javascript - How to send my jQuery form to node.js connect-form - server side, utilize below function (used espressjs middleware) function objcreation(req, res, next){ req.form.complete(function(err, fields, files){ if (err) { next(err); } else { // set params in request obj = {}; obj.label = fields.label; // check if image provided if(files.image){ // move file right dir var fs = require("fs"); var folder = '/var/images/'; var src = files.image.path; var filename = files.image.name; var target = folder + filename; obj.filename = filename; req.obj = obj; fs.rename(src, target, function (status) { next(); }); } else { obj.filename = 'nofile'; req.obj = obj; next(); } } }); } basically, receives fields of form submitted. function uses...

python - access session users in models -

python - access session users in models - is there possible way access session users in models, iam override save method in models needs user check role , save, , using djangorestframework apis calls save method in models , in advance you pass save function request object 1 of views. class mymodel(models.model): def save(self, *args, **kwargs): request = kwargs.pop('request', none) print request # request object if passed save() # whatever you'd request here. super(mymodel, self).save(*args, **kwargs) def myview(request): mymodel.objects.save(request=request) python django models

mysql - Select rows from one table, join most recent row from other table with one-to-many relationship -

mysql - Select rows from one table, join most recent row from other table with one-to-many relationship - what select specific set of rows 1 table (table a) , bring together table (table b), such 1 record appear table a, joined recent record table b, based on datetime column. for example, table has construction (heavily simplified): id | col_1 | col_2 ---+-----------+---------------- 1 | | else 2 | val_1 | val_2 3 | stuff | ting 4 | goats | sheep and table b looks this: id | fk_a | datetime_col | col_3 ---+-----------+---------------------+-------- 1 | 1 | 2012-02-01 15:42:14 | note 1 2 | 1 | 2012-02-02 09:46:54 | note 2 3 | 1 | 2011-11-14 11:18:32 | note 3 4 | 2 | 2009-04-30 16:49:01 | note 4 5 | 4 | 2013-06-21 15:42:14 | note 5 6 | 4 | 2011-02-01 18:44:24 | note 6 what result set looks this: id | col_1 | col_2 | datetime_col | col_3 ---+--------...

c++ - Why does string copy fail for already allocated string -

c++ - Why does string copy fail for already allocated string - possible duplicate: simple modification of c strings using pointers why fail , give unhandled exception in vs2010 when running function stringcopy_test() ? note when uncomment out comment, , comment out sec line in stringcopy_test() , works fine. void stringcopy_test() { char* str1 = "hello"; char* str2 = "world"; //char* str2 = (char*) malloc(sizeof(char)*(stringlength(str1) + 1)); cout << "copying \"" << str1 << "\": " << stringcopy(str2, str1) << "\n\n"; } char* stringcopy(char* dest, char* src) { if ((*dest = *src) != '\0') stringcopy(dest + 1, src + 1); homecoming dest; } str2 constant string, can't modify it. below code work void stringcopy_test() { char* str1 = "hello"; char str2[ 100 ] ; cout << "copying \"" << str1 <...

sql server - select query, compare null records -

sql server - select query, compare null records - i'm writing sql server query: select * vwapplicationlist status='unassigned' , bbl '%' + @bbl + '%' , unitorappartmentnumber '%'+@appartment+'%' , residencetypedescription '%'+@residencetypedescription+'%' , sn1 '%'+@sn1+'%' , sn2 '%'+@sn2+'%' the problem field "sn2" null in several records. how can compare them? if want positive result on comparison: ... , coalesce(sn2, @sn2) '%' + @sn2 + '%' if want negative result (assuming @sn2 not empty string): ... , coalesce(sn2, '') '%' + @sn2 + '%' sql-server select null

php - SugarCRM Get Last Email Date and Search on it -

php - SugarCRM Get Last Email Date and Search on it - so have been working sugarcrm pretty extensively lately , need able display lastly date contact emailed search based on how long ago contact emailed. i can create logic hook lastly email date cannot search based on value of that. so looked in searchfields.php , found next code gets email of contact. 'email' => array ( 'query_type' => 'default', 'operator' => 'subquery', 'subquery' => 'select eabr.bean_id email_addr_bean_rel eabr bring together email_addresses ea on (ea.id = eabr.email_address_id) eabr.deleted=0 , ea.email_address like', 'db_field' => array ( 0 => 'id', ), ), using info decided create new array next code lastly email date. need sorted or actual lastly email date if contact emailed multiple times point. 'last_email_c' => array ( 'query_type...

jdbc - What is sql Type -10 (relating it Sql Server's nvarchar(max)) -

jdbc - What is sql Type -10 (relating it Sql Server's nvarchar(max)) - i've been investigating issues with jtds' mis-reporting of sql server's varchar(max) , nvarchar(max) column types (which recommended replacement of text , ntext ). between inet, jtds, ms jdbc database drivers, consistent column definition found using rs = connection.getmetadata().getcolumns(null,null,tablename,columnname); rs.next(); rs.getint("sql_data_type"); (see link above source etc) where sql_data_type "unused" for varchar(max) drivers homecoming -1 => longvarchar . however, nvarchar(max) homecoming -10. type this, , how standard? ah, see; java sql type constants derive sql standard somewhere. [the msdn page shows -10 sqldmo_dtypentext (as opposed -1 s sqldmo_dtypetext )][1]. can't find page oracle, presumably because it's invested in java , so java.sql.types` reference them. sql-server jdbc varcharmax

PHP script is duplicating Joomla! module content -

PHP script is duplicating Joomla! module content - i have found little script have used within joomla template check , see if there module assigned particular module position on current page. <?php $attribs['style'] = 'xhtml'; $modules_html = ''; foreach (jmodulehelper::getmodules( 'module_position' ) $module) $modules_html .= jmodulehelper::rendermodule( $module, $attribs ); $show_module=trim($modules_html) != ''; if ($show_module) { ?> <jdoc:include type="modules" name="module_position" style="xhtml" /> <?php } ?> the script works duplicates module wrapper div , title output follows: <div class="moduletable"> <h3>module title</h3> <div class="moduletable"> <h3>module title</h3> <p>content here</p...

hibernate - JPA its not Autowiring -

hibernate - JPA its not Autowiring - im getting null pointer exception when seek autowire dao object ... allow me show code! (im using maven + hibernate + spring + jpa) @repository public class daofriendimp implements daofriend{ private entitymanagerfactory emf = persistence.createentitymanagerfactory("persistence"); private entitymanager entitymanager = emf.createentitymanager(); @persistencecontext(unitname = "persistence") public void setentitymanager(entitymanager entitymanager) { this.entitymanager = entitymanager; } @override public boolean save(person person, person friend) { throw new unsupportedoperationexception("not supported yet."); } @override public list<person> getallfriendofpersonwithid(int id) { person person = entitymanager.find(person.class, id); homecoming person.getfriends(); } @override public boolean delete(person person, person friend) { throw new unsupportedoperationexception("not supp...

jquery - How to make live preview based on information entered in a form? PhP/ajax? -

jquery - How to make live preview based on information entered in a form? PhP/ajax? - i'm working on 1 project , handy implement "live preview" feature in it. problem is not kind of typed text preview "e.g. 1 on stackoverflow when create question". working on different. example, have form inputs (background color, padding value, margin value etc...) each time user updates 1 of inputs wan't show preview of updated object next form, lets object div styled basing on user entered in form. how can accomplish feature? jquery based solution preferable. edit: how form looks <form id="div_builder"> <input type="text" name="background_color"/> <input type="text" name="padding"/> <input type="text" name="margin"/> </form> not testet should work (with jquery)... <form id="div_builder"> <input type="text" n...

grails - convert plain old groovy to JSON -

grails - convert plain old groovy to JSON - what's simplest way respond in json using grails? e.g. next doesn't work. boolean = false render json directly documentation, like render(contenttype: "text/json") { hello = "world" } json grails groovy

Facebox on Rails not loading external remote link -

Facebox on Rails not loading external remote link - i'm trying open item's link on facebox, using next code: <a href=<%= item.link%> rel="facebox"><%= item.title%></a> it works correctly when link leads image or action within site, i'm trying open external link, , doesn't work. any hints appreciated, give thanks you. ruby-on-rails facebox

uiscrollview - how to display the UISrcollView vertical Bar? -

uiscrollview - how to display the UISrcollView vertical Bar? - i define uilabel within uiscrollview in ipad. how display uisrcollview vertical bar when text bigger scrollview ? when touch scrollview vertical bar appeared, how display without touching ? regards fred i think, not possible. setting showsverticalscrollindicator , showshorizontalscrollindicator properties can display scroll bar. you can utilize flashscrollindicators when view becomes visible. guide user scrollable content available. uiscrollview uilabel

iphone - BSD sockets and timeouts in iOS -

iphone - BSD sockets and timeouts in iOS - i setup socket alternative this: struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 0; if (setsockopt(sockfd, sol_socket, so_rcvtimeo, &tv, sizeof(tv)) == -1) { perror("setsockopt"); exit(1); } when socket blocks forever on recv phone call when set tv_usec 1 socket timesout expected. expected behavior? help in understanding appreciated. from official posix.1 manual page: the default alternative value zero, indicates receive operation not time out. so if set timeout 0 same default no timeout. iphone ios ipad sockets unix

jquery - Doing javascript on an appended HTML item within an accordion -

jquery - Doing javascript on an appended HTML item within an accordion - okay, i'm populating accordion json data. way know how appending html div. here's code: $.getjson('/industry_tree.json', function(data) { $("#accordion").accordion(); (i in data) { acc_html += '<h3><a href="#">'+data[i].data+'</a></h3>'; acc_html += '<div>'; (j in data[i].children) { acc_html += '<li>'+data[i].children[j].data+'</li>'; } acc_html += '</div>'; } console.log(acc_html); $("#accordion").append(acc_html); $("#accordion").accordion("destroy").accordion({autoheight: false}); }); i want <li> execute sort of js everytime it's clicked. problem is, i'm not sure how if i'm adding via append. ...

android - syncadapter without internet connection -

android - syncadapter without internet connection - i have sync adapter works fine. not need net connection because needs sync addressbook local storage (my application). when wifi turned off , device not have net connection android disables sync in business relationship & synch settings activity. is there way maintain synch adapter on when connection off? add extra sync_extras_manual before calling requestsync(account,authority, extras); extras.putboolean(contentresolver.sync_extras_manual, true); contentresolver.requestsync(account,authority, extras); android connection android-syncadapter

java - DatabaseException CommunicationsException: Communications link failure -

java - DatabaseException CommunicationsException: Communications link failure - i utilize ubuntu & net-beans. create java desktop database application netbeans wizard. utilize mysql database can open & run query services → databases. when run got exception below. when clean & build project run jar file, same exception. have installed windows in same machine dual boot way, , have same mysql database & java. when run jar file create using ubuntu netbeans, run in windows , show database data. did other way also, create same java application in windows netbeans using same database , run both withing netbeans , jar file. when seek run in ubuntu, both in netbeans & jar file show below exception. [toplink info]: 2012.01.29 11:16:58.898--serversession(285416048)--toplink, version: oracle toplink essentials - 2.0.1 (build b09d-fcs (12/06/2007)) jan 29, 2012 11:16:59 org.jdesktop.application.application$1 run severe: application class customerrecords...

networking - mapping network printers c# -

networking - mapping network printers c# - is possible network printer path using next convention in c# computername\printername printersettings.installed printer gives out printer name not path information. thanks in advance a quick , dirty way info utilize iwshruntimelibrary library (wshom.ocx). wshnetwork network = new wshnetwork(); var printers = network.enumprinterconnections(); (int = 0; < printers.count(); += 2) { console.writeline(printers.item(i) + " \t" + printers.item(i+1)); } ...but more forwards looking approach utilize info contained within winspool's printer_info_2 construction returned getprinter method. http://www.pinvoke.net/default.aspx/structures/printer_info_2.html http://msdn.microsoft.com/en-us/library/windows/desktop/dd162845%28v=vs.85%29.aspx http://www.pinvoke.net/default.aspx/winspool.getprinter http://msdn.microsoft.com/en-us/library/windows/desktop/dd144911%28v=vs.85%29.aspx c# networking pr...

cuda - Why is cudaMalloc giving me an error when I know there is sufficient memory space? -

cuda - Why is cudaMalloc giving me an error when I know there is sufficient memory space? - i have tesla c2070 supposed have 5636554752 bytes of memory. however, gives me error: int *buf_d = null; err = cudamalloc((void **)&buf_d, 1000000000*sizeof(int)); if( err != cudasuccess) { printf("cuda error: %s\n", cudageterrorstring(err)); homecoming exit_error; } how possible? have maximum memory pitch? here gpu's specs: device 0: "tesla c2070" cuda driver version: 3.20 cuda runtime version: 3.20 cuda capability major/minor version number: 2.0 total amount of global memory: 5636554752 bytes multiprocessors x cores/mp = cores: 14 (mp) x 32 (cores/mp) = 448 (cores) total amount of constant memory: 65536 bytes total amount of shared memory per block: 49152 bytes total number of registers available per block: 32768 warp size: 32 maximum number of threads per block: 1024 maximum sizes of each dimension of block: 1024 ...

Javascript setTimeOut fires any way when i load new section with ajax -

Javascript setTimeOut fires any way when i load new section with ajax - javascript settimeout fires way when load new section ajax. wrote javascript function check if page idle 5 seconds hide header , bottom nav of page. during page load proccess clicked new tab load new content. happens when new section loaded through jquery fires previouse timeout function. stuck it. here code of wait , load new section wait code check idle state: function checkidlehome() { //check idle if no event occured if((navigator.useragent.match(/iphone/i)) || (navigator.useragent.match(/ipod/i)) || (navigator.useragent.match(/ipad/i))) { var events = ['ontouchstart','ontouchend','ontouchmove'], = events.length, timer, delay = 5000, logout = function () { // whatever want // after period of inactivity //alert('lazy boy'); //alert('i fired'); ...

eclipse - Fast and interactive PHP IDE? -

eclipse - Fast and interactive PHP IDE? - possible duplicate: any php ide, preferably free or cheap? what best ide php? could recommend me php ide? i've tried notepad++ (a great text editor, but.. text editor) , netbeans. i've worked eclipse on java too. netbeans, eclipse damn slow. started lagging every 3 seconds or so.. most of import features are: auto-tab, auto-completion of opened functions, html tags, syntax highlight, auto-generation of comments functions, function , class hints (it should able "look" classes , methods netbeans). so, basicaly looking netbeans-like lightweight text editor :) any ideas? i haven't tried myself i've heard many people raving phpstorm. it's not free have 30 day license can see if it's worth paying for. i've been trying out sublimetext describe lightweight ide. it's not feature-laden netbeans/eclipse set every update. vim on other hand lightweight gets default doesn't ...

app config - How to set system.net settings inside wpf application -

app config - How to set system.net settings inside wpf application - in wpf project getting error: private void btnretrieve_click(object sender, routedeventargs e) { uri uri = new uri("http://10.214.36.245", urikind.absolute); using (webclient wc = new webclient()) { byte[] barr = wc.downloaddata(uri); string sdata = new string(barr.select(a => convert.tochar(a)).toarray()); tbretrieveddata.text = sdata; } } it same in windows form application: private void btnclicked(object sender, eventargs e) { webclient wc = new webclient(); var c = wc.downloaddata("http://10.214.36.245"); } solution in the server committed protocol violation. section=responsestatusline error. in windows form application easy: but don't know how implement solution wpf application. if added app.config file , changed it's content according solution shows error: ps: it's runtime code below don't want ut...

wordpress - Cannot add custom page template to my child theme -

wordpress - Cannot add custom page template to my child theme - i'm running wordpress 3.3.1. i'm writing kid theme modifies default twentyeleven theme. seems normal, except when add together custom page template, doesn't appear in add/edit screen (so can't utilize it!). to elaborate on "normal", here's working: kid theme appears , activates normally. css code (in style.css) appearing. files template hierarchy working (ex: front-page.php, page.php) i've read , reread codex, , custom page template file ("coming-soon.php") seems have right header: <?php /* template name: coming */ so why won't show under "template" drop-down??? i've added custom templates dozens of times , never had problem. possible difference can think of i'm writing kid theme (even though codex says shouldn't matter), or perhaps it's difference in newest update of wp. i can't duplicate you're seeing ...

c# - Where do you place your validation logic? -

c# - Where do you place your validation logic? - how construction code in next scenario: several business objects (e.g.person, house, etc), , between them, need validate user inputs (which come in textboxes). go in either: each business object the winforms codebehind a seperate (static?) class. thanks each business object. have classically made each 1 implement ivalidator interface spits out validation errors object. c# oop

php - The function "header" does not work -

php - The function "header" does not work - i have problem header. when page processed exit(); if($validate=='true') { $_session['nome'] = $nome; $_session['cognome'] = $cognome; $_session['email'] = $email; $_session['telefono'] = $telefono; $_session['cellulare'] = $cellulare; $_session['password'] = $password; $_session['societa'] = $societa; $_session['pi'] = $pi; $_session['cf'] = $tax; $controllor = md5(uniqid(rand(), true)); ob_start(); header("location: index.php?nav=8&controllor=".$controllor); ob_end_flush(); exit(); } all variables above filled correctly , $validate equal 'true'. firstly, using output buffering avoid writing proper code should avoided; potentially have saved this. secondly, way using output buffering avoid ...

ios - Can an app receive bluetooth data if it is locked? -

ios - Can an app receive bluetooth data if it is locked? - simply question. see other devices stating can, built on older platforms. sample code great. yes, possible. need set uibackgroundmodes "bluetooth-central" in info.plist file. note also, technical q&a qa1657 in ios developer library says following the external accessory framework designed allow ios applications communicate hardware accessories developed under apple's mfi licensee program. mfi compliant accessories can implemented wired devices, meaning plug in ios device's 30-pin connector, or wireless devices, whereby utilize bluetooth communication channel. either way, application uses external accessory framework not notified of accessory's presence unless accessory identifies beingness mfi compliant, i.e., designed interface ios application. developer reference says there core bluetooth framework low energy devices in ios5, it's bluetooth 4.0 devices (btle) only, on ipho...

c# - FileUpload file cleared after uploading it with ftp -

c# - FileUpload file cleared after uploading it with ftp - i'm having problem processing uploaded file after has been uploaded ftp. the file user uploads contains xml. have save file disk i'm not able write file straight disk utilize ftp save it. after saved needs processed save contents in database. xmlreader fails error "no root element detected". after debugging came conclusion file empty. i tried re-create file (where xsdupload file uploaded user): fileupload test = new fileupload(); test = xsdupload; but i'm not shure if copys file in memory. the ftp upload function followed: public string uploadxsd(string filename, fileupload xsd) { ftpwebrequest request = (ftpwebrequest)webrequest.create(url + '/' + filename); request.method = webrequestmethods.ftp.uploadfile; request.credentials = new networkcredential(username, password); streamreader sourcestream = new streamreader(xsd.filecontent...