Posts

Showing posts from August, 2010

c# - Can anyone spot why my XNA model doesn't render correctly? -

my last question put on hold because tried provide of source code (which pretty small example is). problem able draw quad , position camera , face towards {0,0,0}. whatever reason, when draw model should soldier standing in center, don't see it. while debugging see model loaded correctly, has bones/meshes etc unsure of why don't see it. my camera setup such: public class cameramanager : gamecomponent { private graphicsdevicemanager fgraphicsdevicemanager; public matrix viewmatrix { get; private set; } public matrix projectionmatrix { get; private set; } public vector3 cameraposition { get; set; } public vector3 cameratarget { get; set; } public float aspectratio { get; set; } public float nearclip { get; set; } public float farclip { get; set; } public float viewangle { get; set; } public cameramanager(game pgame, graphicsdevicemanager pgraphicsdevicemanager) : base(pgame) { fgraphicsdevicemanager = pgraphicsdevic...

ios - Xcode, static libraries and headers -

Image
i know question has been asked several times. have read many questions , accepted answers: no 1 works me. i have problem within these settings: one project lib created , compiled 'static library' ios one project app created empty app links against lib project the lib project used 'subproject' within app project. i created second time scratch following instructions (step step) available at: apple doc - static libraries . the project app compiles fine. linker finds static library. can use classes defined in lib when building storyboard, app cannot find single .h file exported lib. in previous attempt modified of variables found in previous questions , answers (srcroot, etc.) none worked. so question: there found way find headers starting instructions provided apple themselves? if not loosing days finding stupid header files, consider hilarious such simple task (for apple wrote 2 pages of documentation) hard do. i using xcode 5.1.1 on os x 10.9.2. ...

unit testing - Android JUnitTests - Is it possible to create a public static method for Method and Field Reflections? -

i know how can access private method or field class within test class : to access private method myclass , named void dosomething() : import java.lang.reflect.invocationtargetexception; import java.lang.reflect.method; ... try { method method = myclass.class.getdeclaredmethod("dosomething", (class[])null); // (class[])null parameterless methods method.setaccessible(true); method.invoke(localinstanceofmyclass); } catch (nosuchmethodexception ex){ ex.printstacktrace(); } catch (illegalaccessexception ex){ ex.printstacktrace(); } catch (illegalargumentexception ex){ ex.printstacktrace(); } catch (invocationtargetexception ex) { ex.printstacktrace(); } to access private field myclass , named boolean myfield : import java.lang.reflect.field; ... try { field field = myclass.class.getdeclaredfield("myfield"); field.setaccessible(true); field.set(localinstanceofmyclass, true); // true value want assign myfield } catc...

sql - query a json key in postgres json field -

say have in postgres stored in json field called “data” this { "custa": { "name": "customer a", }, "custb": { "name": "customer b", }, "custc": { "name": "customer c", } } how can query return record contains key “custa” ? or better value of “custa” "name": "customer a" trying cant use keyword key select * invoices data->>key = 'custa'; select '{ "custa": { "name": "customer a" }, "custb": { "name": "customer b" }, "custc": { "name": "customer c" } }'::json#>>'{custa}'; ?column? ------------------------------ { + "name": "customer a"+ } (1 row) note: have trailing co...

ios - Can I use attributes with plist xml? -

this question should straight-forward, i'm having hard time finding straight-forward answer. can plist elements have attributes? example, <key info="dates"> <array> <date>2012-06-01t23:03:26z</date> <date>2014-02-25t00:05:57z</date> <date>2014-05-14t23:06:36z</date> </array> be legal in plist xml? i ask because i'm required use plist xml data files in titanium app. without user-defined tags or attributes, i'm finding difficult parse plist xml, regular xml quite simple because can use specific tags selectors.

Creating a 3D road in Android OpenGL ES -

i'm trying create simple game in android. road meant games temple run or subway surf simpler , abstract opengl es without other libraries. i've read lot of basic tutorials explains 3d construction logic , used basic sample of creating 3d cube rotates. i trying use sample create game road. made square more rectangle , duplicate 30x5 square road. i've tried many combinations , internet find solution , yet have problems\questions: how set 30x5 squares 1 next another? i'm getting squares unwanted gap i want set vieweye point (the "camera") 45 degrees middle of first row, player see road upon him next, want move along road. iv'e seen rotate , how works. there way same viewpoint or need change squares drawing z's? i see ondrawframe() calling on , on many times. control fps, i've seen on internet people have used there own fps calculation sleep(). isn't there built 1 already? glrenderer code: import javax.microedition.khronos.egl.eg...

jquery - Dynamically added fields in cascading drop down not cloning styles and ignoring change function -

i creating 4 fields in form select product type. order of fields goes this: category > type > size > color if changes category or type selection, of next fields should reset. works fine on first set of fields, if clicks "add product" button, cloned set of fields ignores code have written works on first. don't see error messages , i'm not sure going wrong. here fiddle: http://jsfiddle.net/gajsu/ and here not working correctly: if make selection in first drop down see corresponding product types appear. if click add product - both fields cloned. want whole ul cloned "display: none" style defined last 3 list items should not ignored - product category should display, when load it. if change category in cloned drop down (2nd product), options in second don't reset in first one. i hope makes sense. know there plugins can build myself can learn. thanks in advance help. jquery $(document).ready(function() { $(...

php - codeigniter CI merchant paypal -

Image
i need paypal integration paying order. integrate api http://ci-merchant.org/ . works needs to.. go paypal website, give me option pay after press pay button relocate sucess definded page , offcourse doesnt make payment. here php code paypal: $this->load->library('merchant'); $this->merchant->load('paypal_express'); $settings = $this->merchant->default_settings(); $settings = array( 'username' => '*', 'password' => '*', 'signature' => '*', 'test_mode' => false, 'solution_type' => array('type' => 'select', 'default' => 'sole', 'options' => array( 'sole' => 'merchant_solution_type_sole', 'mark' => 'merchant_solution_type_mark')), 'landing_page' => array(...

css - Place Lightbox close button on top right area -

how can this? mine appears in bottom right side. using lightbox v2.7.1. replacement code v2.8.1. move both close button , caption top. lightbox.prototype.build = function() { var self = this; $('<div id="lightboxoverlay" class="lightboxoverlay"></div><div id="lightbox" class="lightbox"><div class="lb-datacontainer"><div class="lb-data"><div class="lb-details"><span class="lb-caption"></span><span class="lb-number"></span></div><div class="lb-closecontainer"><a class="lb-close"></a></div></div></div><div class="lb-outercontainer"><div class="lb-container"><img class="lb-image" src="data:image/gif;base64,r0lgodlhaqabaiaaap///waaach5baeaaaaalaaaaaabaaeaaaicraeaow==" /><div class="lb-nav">...

c# - Transforming web.config Transform files across environments and projects -

so here dilemma. have web.config file. have fifteen transform files, once each environment (lab1, lab2, etc., alpha, beta, prod, etc.). multiply 30 projects. rather trying maintain 15 transform files across 30 projects like: parse each transform file. each environment/configuration/setting, store data parsed file in database. create "master" transform file merge of environment-specific transform files (assuming web.release.config have majority of transforms) allow user run c# program accesses database , based on desired environment, takes master transform file , replaces settings (ie "value") environment/configuration specific values db. what have: c# program stores env/config/setting in db. can create , update. powershell program calls above set or set of env/config/setting. what need: way parse transform file, identify each transform call, , store env/config/setting value in db. then best way "merge" 15 transform config files master transfo...

ios - New custom class file not appearing -

i trying create app on xcode5, nothing major it's first one. i'm having trouble getting new file appear in custom class called "game" (files created game.h , game.m) i create new file after right clicking on project name on top left corner, clicking new file "objective-c class", rename "game" hit create , it's done, both appear straight away under project name, drag them down other files keep tidy. i highlight second view screen or game screen, click third icon @ top right corner go custom class drop down options change second view "game" it's not there??? i've deleted , retried many times mention, , need change "view controller" "game" ... am missing somewhere? first of all, if you're creating uiviewcontroller subclass, should have suffix viewcontroller , shouldn't effect problem you're having. sometimes necessary save newly created file before auto-complete in custom ...

ruby - Reverting changes in .bash_profile? -

i wanted delete ruby , rvm removed path .bash_profile. deleted whole rvm folder using rm . now there shouldn't calling rvm, , error message keeps arising if cd .. go directory. -bash: /users/doris/.rvm/scripts/initialize: no such file or directory why doing , how can fix it? sounds did this, sure... have in .bash_profile file. make sure removed line: [[ -s "$home/.rvm/scripts/rvm" ]] && source "$home/.rvm/scripts/rvm" # load rvm shell session *as function* then make sure logout , login again.

javascript - Accessing current context within JQuery validator -

i have custom jquery validator validates if email entered exists in list. displaying 3 input fields using foreach in cshtml. have 1 input field in code. in "validator.addmethod", trying access text field using $(this). returning validator. here code: $.validator.addmethod("emailtextfield", function (value, element) { var designeeid = $(this).attr("data-level"); var newemail = $("#txtupdate" + designeeid).val(); var exists = true; $("#emaillist" + designeeid + " > .list-group-item > .email").each(function () { if ($(this).html().tolowercase() == newemail.tolowercase()) { exists = false; } }); return exists; }, "email exists in list."); }); i using 'data-level' access particular textfield first "this" in above code. returns validator. if give in class of textfield instead of "this", ...

visual studio 2013 - Code First Migrations, Database Projects, and SQL Azure -

we in process of developing new site plan host on azure. none of have done before, has raised interesting challenges. first, using code first , using migrations update database. having issues figuring out how deploy database azure, ended creating database project. there bunch of azure specific issues deployment, , errors if don't rectify valid sql azure doesn't allow use. seemed me should able code first on azure site did on local site, , found this article seems address issue. what wondering though, best practices. i assume don't need database projects anymore, not sure that. best practice managing databases visual studio 2013 , code first. the approach in article above seems fine system in pre-production, once system in production , has live data, recommended approach? how protect mistakes accidentally changing setting tells visual studio recreate database? any thoughts or ideas appreciated. first state understanding, when using entity framewor...

ios - Stop using app with certificate -

i create app distribution build , custom udid. there way stop users of using it? or when stopped? have @ expiry date of distribution certificate, give hard cut-off date when no longer able use it. unfortunately there no way revoke certificate within build, have wait until expires guarantee shut-off.

underscore.js - Merge multidimensional array using Underscorejs -

[{"ic_value1":"ptp-1","in_id":"80"},{"ic_value1":"ptp-2","in_id":"81"},{"ic_value1":"ptp-3a","in_id":"82"},{"ic_value1":"ptp-3b","in_id":"83"},{"ic_value1":"ptp-4","in_id":"84"},{"ic_value1":"ptp-5a","in_id":"85"},{"ic_value1":"ptp-5b","in_id":"86"},{"ic_value1":"ptp-6","in_id":"87"},{"ic_value1":"ptp-7","in_id":"88"},{"ic_value1":"ptp-8","in_id":"89"},{"ic_value1":"ptp-9a","in_id":"90"},{"ic_value1":"ptp-9b","in_id":"91"},{"ic_value1":"ptp-10","in_id":"92"},{"ic_val...

rust - How to reference multiple members in an array? -

i have array of 2 players. have variable, current_num equal player in array current player. have while loop iterates through main game logic current_num updated, stays same. assigned current_player , next_player variable each iteration of loop so: while !self.board.check_win() { let ref mut current_player = self.players[current_num]; let ref mut next_player = self.players[(current_num+1)%2]; /* game logic */ } this doesn't work because try borrow self.players[..] twice. don't need next_player variable if somehow store next player inside first player object, can't create cyclic data structures in rust seems. fought hard compiler accomplish following: player1.next = &player2; player2.next = &player1; unfortunately doesn't seem possible.... if is, rather along lines of: current_player.next().do_something(); instead of needing next_player variable. able do: current_player = current_player.next(); for switching next player wouldn't ha...

php - Facebook api does not upload image -

my issue discussed here couldn't open file "" error in facebook php api and php script is //variables going post facebook $fbpermissions = 'publish_stream,user_photos'; //required facebook permissions $piclocation = 'fb_cover_images/cover7.jpg'; $msg_body = array( 'message' => 'i liked pic '. $homeurl . ' perfect cover photo.', 'url' => "http://my_site.com/$piclocation" ); if ($fbuser){ //user logged in facebook, post our image try { $uploadphoto = $facebook->api('/me/photos', 'post', $msg_body ); } catch (facebookapiexception $e) { echo $e->getmessage(); //output error } } else{ $loginurl = $facebook->getloginurl( array('scope'=>$fbpermissions,'return_url'=>$return_url)); header('location: ' . $loginurl); } if set 'url' => "http://my_site.com/$piclocation" getting (#200) permi...

sqlite - When should I use Loaders? and when asynctask? (Android) -

i still confused. have read several tutorials of loaders , asynctask in android can't understand differences in cases. example: your app can't continue without information provided asynctask or loader if need information mysql database, better? and...what if need information sqlite database? maybe, might need data url. your app can continue without information provided asynctask or loader if need information mysql database, better? and...what if need information sqlite database? maybe, might need data url. if consider must mention more differences or other case, can write it. well, both of them used perform asynchronous operations, doesn't matter if app can or can't continue without information. if app can continue wihtout data, still need process asynchronously avoid anr message. one reason choose loader or asynctask if need data updates. advantage of loaders keep track of data accessing , deliver new results when data changes. other ...

reporting services - How to implement Optional Parameters filtering using SSRS report against Sharepoint List -

i wonder if can create conditional caml filtering within report itself.. modify caml query based on filter parameters provided. if not, i'm seeking advices on best method create ssrs reports within sp2010 can that. thanks this way such thing ([parameter1] = "" or field1 contains [parameter1]) , ([parameter2] = "" or field2 contains [parameter2]) thanks junlasak

ios - Drawing lines in part of a UIViewController -

drawing in uiview works uses entire screen. have uiviewcontroller lot of text , results being displayed. want add draw lines showing tilt , roll angle of a ship.i cgaffinetransform rotate prefer not to. what have not worked out how implement cg components in uiviewcontroller addressing part of screen. is allowed?

ios - NSException with UIImagePickerController -

i'm building first ios 7 ipad app in xcode 5 - need issue. i'm following this tutorial: i don't quite understand writer means with: "so open testpickerviewcontroller.h , want add in following class reference." uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> i got view controller.h file here: #import "viewcontroller.h" @interface detailviewcontroller : viewcontroller <uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> { uiimagepickercontroller *imgpicker; iboutlet uiimageview *customimage; } @property(nonatomic, retain)uiimagepickercontroller *imgpicker; @end my view controller.m file: #import "detailviewcontroller.h" @interface detailviewcontroller () @end @implementation detailviewcontroller @synthesize imgpicker, customimage; - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (...

c# - Blend crash with ObservableAsPropertyHelper -

microsoft blend 2013 crashes when try load wpf solution developed in visual studio 2013. (abbreviated) error message receive is: system.exception: onerror occurred on object (usually observableaspropertyhelper) break binding or command. prevent this, subscribe thrownexceptions property of objects ---> system.invalidoperationexception: no connection string named 'recipemodelcontainer' found in application config file. the application builds fine , executes when run it. before particular issue started, blend consistently showed missing connection string message; message originated when set datacontext in code-behind, , has persisted ever since transferred datacontext reference xaml. in case, connection string there. i experimenting reactiveui develop user control, , using observableaspropertyhelper property. here property: private observableaspropertyhelper<ilist<string>> _matches; public ilist<string> matches { { return _matche...

javascript - Show GIF images in 9Gag style -

i know how show gif file after clicking jpg file in 9gag.com i'm using timthumb.php jpg image. https://code.google.com/p/timthumb/ here code below <div class="images"> <img alt="image title" src="timthumb.php?src=myimage.jpg&amp;w=500&amp;q=100"> </div> i want show original image after clicking jpg. can point me out way using jquery or javascripts. note: image loop there can more 1 image. really appropriate help. this can done jquery library. html <div class="images"> <img class="thumb" alt="image title" src="http://i.stack.imgur.com/rur4z.png" gif="http://ourbunkers.0catch.com/grunt.gif"/> <img class="thumb" alt="image title" src="http://i.stack.imgur.com/rur4z.png" gif="http://ourbunkers.0catch.com/grunt.gif"/> <img class="thumb" alt="image title" src=...

mysql - How to insert a double quotes in a variable in php -

i trying send query this: $sql = "select id loto_users email=".$email." limit 1"; echo $sql; //to control $result = mysql_query($sql); when that, returns me: select id loto_users email=xxx@gmail.com limit 1 you have error in sql syntax; check manual corresponds mysql server version right syntax use near '@gmail.com limit 1' @ line 1 then tried run line in mysql web interface. copy-paste this: select id loto_users email=xxx@gmail.com limit 1 it gave me same error msg. added double quotes before , after email adress: select id loto_users email="xxx@gmail.com" limit 1 now, runs... in interface. want in php file have no idea how create variable capable includes double quotes. or there other way? just add single quotes string need: $sql = "select id loto_users email='".$email."' limit 1"; but, if really want double quotes, escape them: $sql = "select id loto_users email...

php problems in search function -

im trying add search function. want work that: exmple if have 5 field, , user wrote in 2, search based on 2 field. mean not neccesary write information in 5 field, want search happen in filled fields. and works if write in fields (for have 2). , if write in 1 field doesnt show anything. code: <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="container"> <h1>Поиск</h1> <form action="search_form.php" method="post"> <p>Направление</p> <input type="text" name="course" /> <p>Форма обучения</p> <input type="text" name="form" /> <input type="submit" value="Искать"> </form> <?php $db = mysql_connect("localhost", "root", "") or die (mysql_error ()); mysql_select_db("un...

Excel VBA failure of repeated Evaluate method -

i have written little tool in vba charts function pass string (e.g. "1/(1+x)" or "exp(-x^2)"). use built-in evaluate method parse formula. nub of function, evaluates function of variable @ given value: function eval(func string, variable string, value double) double eval = evaluate(replace(func, variable, value)) end function this works fine, e.g. eval("x^2, "x", 2) = 4. apply element-wise down array of x values generate graph of function. now want enable tool chart definite integral of function. have created integrate function takes input formula string , uses evaluate evaluate @ various points , approximate integral. actual integrate function uses trapezoidal rule, simplicity's sake let's suppose this: function integrate(func string, variable string, value double) double integrate = value * (eval(func, variable, 0) + eval(func, variable, value)) / 2 end function this works expected, e.g. integrate("t", "t...

c# - How to display the contents of a list into a DataGridView in winforms -

my problem simple. making calendar school project. need add properties list of objects in order save event calendar. have managed add things list, have not found way display events of list in winforms. professor suggested use datagridview display contents of list. can show me how can bind objects in list datagridview, , whenever add list adds grid? appreciated. here have far: public static list<event> events = new list<event>(); [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new form1()); } public static void addevent(string eventdate, string eventtitle, string eventinfo) { event event = new event(); event.eventdate = eventdate; event.eventdate = eventtitle; event.eventinfo = eventinfo; events.add(event); } } class event { public string eventdate { get; set; } public s...

php - How do I determine if the client is accessing the website through intranet or internet? -

the situation have wordpress install on iis 7.5 accesses internet through proxy , parts of website make client side external request (images, youtube videos etc.) needs users enter proxy credentials if accessing site through intranet. i hide elements of site if accessed through intranet , have functional if accessed through internet. i found this answer helped bit (and yes changed local_addr because of iis) fails because of proxy. internet requests site go through proxy on same network, thinks every request intranet request. so, how can improve function work in situation if know proxy ip? function is_intranet() { $serverip = explode('.',$_server['local_addr']); $localip = explode('.',$_server['remote_addr']); return ( ($serverip[0] == $localip[0]) && (in_array($serverip[0],array('127','10','172','192') ) ) ); } proxy? suppose mean reverse-proxy. if so, many reverse proxi...

android - How to return just applications from package manager? -

can type of application determined applicationinfo object ? by type mean, determine if widget or application. alternatively can list of of applications not include widgets returned getpackagemanager()? below code i'm trying return applications widgets returned also: list<applicationinfo> appinfolist = context.getpackagemanager() .getinstalledapplications(packagemanager.get_activities); i don't believe can query app or without widgets. can check activityinfo.metadata field of every registered broadcast receiver. contains instance of bundle class. receivers having widget must have metadata name android.appwidget.provider in bundle. final packagemanager pm = act.getpackagemanager(); final intent widgetintent = new intent("android.appwidget.action.appwidget_update"); final list<resolveinfo> receivers = pm.querybroadcastreceivers(widgetintent, packagemanager.get_meta_data); // optional part (see note below) (resolveinfo...

Handling a batch REST request in PHP -

for php application integrating rest service capable of receiving multiple nested http requests @ once. identical google calendar api: https://developers.google.com/google-apps/calendar/batch however, not sure best way parse single request multiple requests. request server (from google example) this: post /batch http/1.1 authorization: bearer your_auth_token host: host content-type: multipart/mixed; boundary=batch_foobarbaz content-length: total_content_length --batch_foobarbaz content-type: application/http content-id: <item1:12930812@barnyard.example.com> /farm/v1/animals/pony --batch_foobarbaz content-type: application/http content-id: <item2:12930812@barnyard.example.com> put /farm/v1/animals/sheep content-type: application/json content-length: part_content_length if-match: "etag/sheep" { "animalname": "sheep", "animalage": "5" "peltcolor": "green", } --batch_foobarbaz the ...

c# - Address custom enum values by order -

usually can address each item in enum it's ordered position (0, 1, 2, 3...), if i've created enum custom values (as below), there still way address each item declared order (e.g., off = 0, _5m = 1, _15m = 2, etc.), rather value? enum waittime { off = 0, _5m = 5, _15m = 15, _30m = 30, _1h = 60, _2h = 120, _3h = 180, _6h = 360, _12h = 720, _1d = 1440, _2d = 2880 } in c# can use enum.getvalues() method. it retrieves array of values of constants in specified enumeration. elements of array sorted binary values of enumeration constants. array enumelementsinarray = enum.getvalues(typeof(waittime)); int firstelement = enumelementsinarray[0]; int secondelement = enumelementsinarray[1]; but know that, return aray after sorting elements values. of course, enum work want.

sublimetext3 - Sublime Text 3 custom PHP auto-completion does not work -

here's default auto-completion "switch": switch (variable) { case 'value': # code... break; default: # code... break; } but wish turn just: switch () { case '': break; case '': break; } because don't modify "#code here..." every time. i navigated "c:\users\user\appdata\roaming\sublime text 2\packages\php" and opened "switch(-).sublime-snippet" , modified into: <snippet> <content><![cdata[switch ($0) { case '$0': break; case '$0': break; }]]></content> <tabtrigger>switch</tabtrigger> <scope>source.php</scope> <description>switch …</description> but nothing works. there syntax error? or modify wrong file? if tagged question correctly, modified wrong file - need edit sublime text 3 version. bit more difficult directly, since file wrapped in .sublime-package ...

javascript - How can an object's property access other property? -

this question has answer here: self-references in object literal declarations 17 answers why can't in javascript? var big = { a:1, b:2, c:3, d:big.a } how can object's 1 property access another? //--------------------------------edited below ---------------------------------- thanks answers, found question: when this: var big = { : 1, b : 2, c : 3, d : this.a } console.log(big.d); it's undefined however, when this: var big = { : 1, b : 2, c : 3, d : function(){console.log(this.a)} } big.d(); it logs out 1 i wonder what's going on here, because function in second code somehow makes 'this' accessible? thanks. you can var big = { a:1, b:2, c:3}; big.d = big.a; in code when using d:big.a still not defined i'e. big not defined ...

Perl: adding error checking -

i have following code , wondered how add error checking? my $login = "https://steamcommunity.com/login/home/?goto=market%2f"; $username = "usr"; $password = "pass"; $mech = www::mechanize->new(); $mech->cookie_jar(http::cookies->new()); $mech->get($login); $mech->form_name('loginform'); $mech->field(login => $username); $mech->field(passwd => $password); $mech->click(); thanks in advance seb morris there no "error condition" such when internet login fails. have @ html returned site check whatever text sent when login fails. you should use html::treebuilder::xpath parse , navigate html. note many sites use javascript modify page after has been delivered client. www::mechanize doesn't support javascript, may not able want.

Why can't I connect my Android device to localhost using the Intel XDK app? -

i'm novice in app development. i'm using intel xdk make android app. the app works connecting database in backend done symfony, , behaving fine in emulator. want test real device, using pc localhost, through wifi. read have retrieve localhost ip address ipconfig, , use ip connection. however, when test app doesn't connect. strange thing if use mobile browser same url, connection works: can see xml files use fetch database information. the code connection in app: xmlhttp=new xmlhttprequest(); xmlhttp.onerror=transferfailed; xmlhttp.open("get","http://192.xxx.x.x/symfony/web/app_dev.php/api/v1/reportes/reportes.xml",false); the onerror function: function transferfailed(e) { alert("error al conectar:"+e.target.status); } as said, connection doesn't work , alert message: "error al conectar: 0" if put address http://192.xxx.x.x/symfony/web/app_dev.php/api/v1/reportes/reportes.xml in mobile browser corre...

php - Zend 2 callables vs Factories - too many factories? -

i have not found answer question on so far think quite common issue when have big module.php file lot of callables instantiate services. refactor such module.php service manager configuration factory classes seems have create lot of such factories, 1 factory 1 service. can done seems lot of work. worth doing? ask in such situations - stick callables (no point in refactoring, little gains) or create dozens of factory classes if necessary? cheers.

c++ - cocos2d-x custom draw produces weird results -

i have subclassed sprite , in draw(renderer, const kmmat4&, bool) method, used library facilitates opengl shaders (not using deferred rendering cocos does). enclosed custom calls between glpushattrib(gl_all_attrib_bits) , glpopattrib() . can (sometimes) see resulting custom drawn sprite other sprites managed cocos drawn in incorrect positons, wrong colors/textures or not drawn @ all. subclassing node did not change thing. have considered ccdrawnode... using v3.0 in mac os 10.8.x mac build. have ensure cocos gl-pipeline not affected (and make both work expected)? edit: asking is; isn't enough use glpushattrib(gl_all_attrib_bits) , glpopattrib() ?

postgresql - How to upgrade Postgres93.app -

i have postgres93.app installed (version 9.3.1), , cannot enable or run plpython, presumably because of this: https://github.com/postgresapp/postgresapp/issues/150 . how upgrade latest postgresxx.app version , preserve existing data? simple installing new app version, or need backup , restore, move/upgrade data files, etc, databases wish preserve? thanks. i received reply via twitter need install updated app. i'll post if not go smoothly.

http - Limit for concurrent connections to the same host in Node.js -

why code (or similar) var http = require('http'); var async = require('async'); async.forever(function(next) { http.get('http://google.com', function(res) { next(); }); }); executing 5 times latest released node (0.10.28)? by default, node sends http requests connection: keep-alive header set, connection not closed after 1 request. , default maximum number of concurrent connections same server:port set 5. controlled http.globalagent.maxsockets property. it's mentioned in documentation it's hard find if don't know or don't read through docs. also, these classes being rewritten , next releases have different behaviour.

d3.js - nvd3 line chart with string values on x-axis -

i'm new nvd3 charts. need line chart, string-values on x-axis chart should bar chart , need line, instead of bars my result looks line chart values mapped x=0 my code nv.addgraph(function() { var chart = nv.models.linechart() .useinteractiveguideline(true) .transitionduration(350) .x(function(d) { return d.x}) .y(function(d) { return d.y}) .showlegend(true) .showyaxis(true) .showxaxis(true); chart.xaxis.tickvalues(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]); d3.select(element + ' svg') .datum(data) .call(chart); nv.utils.windowresize(chart.update); return chart; }); and data [{"color":"#a215af","key":"products","values":[ {"label":"monday","y":0,"x":"monday"}, {"label":"t...

c++ - Functions using structure read from file return no output? -

i supposed declare structure holds name , grades of unknown number of students. here how did it: struct student { char name[30]; int grade1, grade2, grade3; }; then, have text file containing information each student on different lines. read way. student info[20]; int nr_students,i=0,k=0; fstream infile; infile.open("in.txt"); fstream outfile; outfile.open("out.txt"); while(!eof) { infile>>info[i].name; infile>>info[i].grade1; infile>>info[i].grade2; infile>>info[i].grade3; i++; } nr_students=i; avg_promovability(outfile,info, nr_students); i not think works properly, since nr_students remains 0, apparently. also, first function: void avg_promovability(fstream &outfile,student *info, int nr_students) { int i; float sum=0,j=0,avg; (i=0;i<nr_students;i++) if(info[i].grade1 >=5 && info[i].grade2>=5 && info[i].grade3>=5 ) { sum=sum + info[...

javascript - Why Number.prototype.toPrecision() returns weird results with precision greater than 16 in Chrome and Firefox and not in IE11 -

i know in javascript maximun , minimun safe numbers of precision 16 (tested in chrome): number.max_safe_integer → 9007199254740991 number.min_safe_integer → -9007199254740991 however number.prototype.toprecision() allows numbers greater 16, until 21. in range results wierd (wierd = don't understand right now): 6.789.toprecision(21) → "6.78899999999999970157" /*¿why "70157" ending in chrome(34.0.1847.137) , firefox(29.0.1)?*/ 2.345.toprecision(21) → "2.34500000000000019540" /*¿why "19540" ending in chrome , firefox?*/ ie11(11.0.99) returns expected: 6.789.toprecision(21) → "6.78900000000000000000" 2.345.toprecision(21) → "2.34500000000000000000" ¿is bug in javascript engines of chrome(v8) , firefox(spidermonkey)? ¿is ie11 javascript engine (chakra) better in it's number.prototype.toprecision() interpretation?