Posts

Showing posts from July, 2013

java - Build only the nodes matching certain criteria using Lexer and HTMLParser -

i'm parsing huge documents not performant parse wholesale or build dom. div nodes contain information want build part of dom , analyze there. ideally use lightweight lexer (i using htmlparser.org's, java lexer i've been able find), , when see node of interest, build node. is there clean way using these technologies? haven't found way parse resource other text or url - thought maybe it's possible manually setting lexer. 1 problem setlexer in parser mutates lexer (which affects parsing of *entire document),, assume because writer of class unaware there better languages write obfuscated code in java. idea how put these together?

networking - Understanding the process of receiving network packets -

i started learn linux networking , packets filtering. in iptables documentation stated that: if packet destined box, packet passes downwards in diagram, input chain. if passes this, any processes waiting packet receive it . so, suppose there're 3 server apps on host. servers , b tcp servers , , c udp server . true, if receive udp packet, at ip level packet delivered apps a, b, c? or sockets of apps & b wouldn't receive packet @ all? tcp servers , udp servers operate in different ways. at 1 tcp server listen on given tcp port (corner cases ignored sake of simplicity). connection requests (encapsulated in ip packets) destined port "accepted" 1 process (more accurately, accepted process has file descriptor corresponding 1 listening endpoint). combination of [remote_address,remote_port] , [local_address,local_port] unique. tcp server doesn't receive "packets", receives stream of data doesn't have specific relationship underlyin...

Toggling elements order when switching views with jQuery -

i'm working set of elements has both list view (default) , grid view. used unordered list fake table view , able switch grid view without having create different markup. (i want avoid use of absoluted positioned elements on place) list view <ul class="list"> <li class="header"> <div class="image">image</div> <h2 class="name">name</h2> <p class="date">start date</p> <p class="title">title</p> </li> <li class="even"> <div class="image"><img src="http://www.placehold.it/200x200" alt=""></div> <h2 class="name">adam ant</h2> <p class="date">1995</p> <p class="title">specialist</p> </li> <li class="odd"> <div class="image"><img src="http://www.plac...

How to reward sender when accept facebook invites on iOS and Android -

my client wants make small game ios , android rewards users when friends accept invites through facebook. i've read several questions , solutions found on site getting "from" , "to" fields facebook request. however, on mobile, when new user clicks notification on fb apps, he/she redirected appstore page , need download app first. after downloading, when new user opens , logs in app, how can know sender can reward him?

Markers for Google maps not in right spot -

Image
i have created google map using google maps rails gem. using custom svg markers. the markers not appearing on proper location (see dallas or chicago in attached image). in controller have created hash object. have tried adjust marker's position marker_anchor property, doesn't appear have effect on position of image on map. tried using int 1-9 format or richmarker (ie [1, true]) did not work either. @hash = gmaps4rails.build_markers(@cities_for_map) |city, marker| marker.lat city.latitude marker.lng city.longitude marker.picture({ "url" => "/images/maps/regular.marker.svg", "width" => 13, "height" => 13, "marker_anchor" => [0, 50] }) marker.infowindow render_to_string(:partial => "/destinations/map_tile.html", :locals => { :city => city}) end am trying modify wrong property or bug gem? @apneadiving solved use need use anchor, not marker_anchor. ass...

ms office - O365 Calendar API recurring meeting info not returned -

i using o365 api calendar, understand in preview. when querying /calendar/events endpoints, created events returned, not seem returning correct "recurrence" info. made several events in o365 recur every workday no end date, api not seem return info. is there workaround meeting recurring info? photohunts, see recurrence information, need navigate specific event. example: https://outlook.office365.com/ews/odata/me/events('aamkadu5owrjmwiwlthmntmtngm0nc1im2uwlwezode3njzlotawyqbgaaaaaabhjwdlvpxlriwlplz9wovhbwagqpuo3lpftzqqq7hnvcbiaaab3pf9aabbcwib9ta-tatlczumgiyyaachmwvwaaa=') you see information below: recurrence: { pattern: { type: "weekly", interval: 1, month: 0, index: "first", firstdayofweek: "sunday", dayofmonth: 0, daysofweek: [ "thursday" ] }, range: { type: "enddate", startdate: "2014-07-03t00:00:00-07:00", enddate: "2014-12-31t00:00:00-08:00", numberofoccurrences: 0 } } ...

java - import JPA Model from gradle sub-project in Spring -

in android project, want use shared model library rest server(jpa) project structure: ├── android │ └ ... │ ├── model │   ├── build.gradle │   └── src │   └── com │   └── model // error @ runtime │   └── customer.java ├── server │   ├── build.gradle │   └── src │   └── com │   └── server │   ├── application.java │   ├── customercontroller.java │   ├── customerrepository.java │   └── model // works fine │   └── customer.java ├── build.gradle i using gradle sub-projects manage dependency works fine @ compile time. when run application, spring can't resolve jpa annotations. when move model class server project, works fine. exception in thread "main" org.springframework.beans.factory.beancreationexception: error creating bean name 'requestmappinghandlermapping' defined in class path resource [...] instan...

powershell - Retrieving the full name of files, filtered by date -

$date = [datetime]("05/19/2014") gci -recurse | select-object fullname,lastwritetime | where-object { $_.lastwritetime.toshortdatestring() -ge $date.toshortdatestring() } | format-table i'm trying find list of files have been altered on or after 19th of may, 2014. 2 things happening here: i'm getting files have been altered far 2009 the table's columns wide, i'd 100 or characters (i wrong eyeballing this) how can proper list of files , additionally, how can sort them in such manner readable? the issue may in how doing comparison. datetime.toshortdatestring method uses whatever short date pattern current culture process using. unfortunately, can't think of example make date in 2009 appear greater date in 2014 in string form. try comparing date-time object directly. compare dates using date property such: $date = [datetime]("05/19/2014") gci -recurse | select-object fullname,lastwritetime | where-object { $_.lastwri...

(Flex & actionscript 3) convert result in datagrid control to json data -

i want convert result in spark datagrid cotrol json data i'm using actionscript 3 , flex this datagrid : <s:datagrid id="_gridcentre" left="5" right="5" top="5" bottom="5" bordervisible="true" dataprovider="{getcentreresult.lastresult}" fontsize="11"> <s:columns> <s:arraylist> <s:gridcolumn visible="false" datafield="codecentre"headertext="code"/> <s:gridcolumn datafield="nomcentre" headertext="nom centre"/> <s:gridcolumn datafield="typecentre" headertext="type centre"/> <s:gridcolumn datafield="milieurecepteur" headertext="milieu récepteur"/> </s:arraylist> </s:columns> </s:datagrid> i did code, not working : var result:object = ...

NServiceBus Dependency Injection not working for Saga Timeouts -

i having problems getting nservicebus 4.6.1 dependency injection working saga timeouts. using self-hosting in asp.net web application , have property injection setup. works when messages sent web controllers however, when timeout message handled in saga same di property not being set , null. here key bits of setup: global.asax.cs public class mvcapplication : system.web.httpapplication { public static iwindsorcontainer container { get; private set; } protected void application_start() { configureioc(); arearegistration.registerallareas(); globalconfiguration.configure(webapiconfig.register); filterconfig.registerglobalfilters(globalfilters.filters); routeconfig.registerroutes(routetable.routes); bundleconfig.registerbundles(bundletable.bundles); devicemanagerdbinitializer.instance.initializedatabase(); configurenservicebus(); } protected void application_end() { if (container...

java ee - EntityManager not injected into MDB (although other resources are) -

in following code, queues injected correctly, entity manager not. not experienced javaee , @ loss why doesn't work. hints appreciated! i use openejb application container. using code below, queue , connectionfactory injected correctly; however, entitymanager null . far know, 1 can use @persistencecontext in managed entity (i.e., bean) it. or need define in ejb-jar.xml file? here code looks like: the mdb: public class serverbean implements messagelistener { @resource private connectionfactory factory; @resource(name = "queue") private queue queue; @persistencecontext private entitymanager em; //methods... } ejb-jar.xml: <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" metadata-complete="true"> <enterprise-beans> <message-driven> <ejb-name>serverbean</ejb-name> <ejb-class>foo.serverbean</ejb-class> <messaging-type>javax.jms.messagelistener...

asp.net web api - Nuget installs old version of package Newtonsoft.Json because of WebAPI dependency -

i have website , dll project. in dll packages.config used package: <package id="newtonsoft.json" version=" 6.0.3 " targetframework="net451" /> in web site packages.config use package: <package id="microsoft.aspnet.webapi" version="5.1.2" targetframework="net451" />. package has dependency "newtonsoft.json version >= 4.5.11 " added line: <package id="newtonsoft.json" version="6.0.3" targetframework="net451" /> when launch "update-package -reinstall" nuget checks microsoft.aspnet.webapi depends on newtonsoft.json, nuget overwrites web site packages.config line <package id="newtonsoft.json" version=" 4.5.11 " targetframework="net451" /> , copies newtonsoft.json 4.5.11 "bin" folder of site. also bin folder has dll depends on fresh version of newtonjson , not work.. i tried command "update-pa...

sql - MySQL Transaction/Commit Query -

just quick question need ask, mysql table using myisam storage engine , looking @ previous questions queries under engine automatically committed (no transactions allowed auto-commit). now, mean, if following query: update `exampletable` set `examplefield` += '50' ...; update `exampletable2` set `examplefield2` -= '50' ...; it either succeed (and autocommit/update both) or fail , update neither? or definition of query incorrect , myisam autocommit 1 command @ once? -so cannot above query reliably under myisam? (bonus question) if so, have heard of innodb engine supports transactions. use instead? how speed losing in return reliable queries? thanks help. basically i'm asking: code above 1 query myisam autocommit, or sql treated 2 queries? in myisam, code show treated 2 queries. concurrent client see data changed in progress. if want transaction isolation no concurrent thread can see data until commit, need use innodb. i recommend in...

objective c - JSON array Parsing issue in iOS -

i've got json request i'm able add nsdictionary i'm unable access part of json string. here sample { "resp": { "success": "true", "who": { "userid": 234, }, "students": [ { "id": 1, "name": john }, { "id": 2, "name": jane } ], } } i storing data in nsmutabledictionary , passing function should run through each student , process them accordingly. here i've got far , it's not working: -(void)foo:(nsmutabledictionary*)json { nsarray *students = json[@"students"]; for(nsmutabledictionary *student in students) { nslog(@"student id: %@", student[@"id"]); } } when debugging can see json object , students belongs under resp value. first of all, check json on validity http://jsonlint.com . corrected json next modifications: { "resp": { ...

c# - MVC 4 - Captcha.Mvc -

i have captcha control mvc 4 page , cannot show message if input incorrect. i'm used doing things through jquery , on success something, when here lose modelstate.isvalid. so, when run code captcha control loads fine on page shows 5 letters in image line says 'refresh' , textbox beneath input submit button on index page post controller. when input wrong refreshes image no message saying wrong, know wrong because controller says modelstate.isvalid false want load new image , display input incorrect. when input correct refreshes image still no message or anything. want stay there , input correct , disable textbox. my question: how can described above? my code below: controllers/homecontroller.cs using system.web.mvc; using captchademo.mvc4.viewmodels; using captchamvc; using captchamvc.attributes; using captchamvc.infrastructure; namespace captchademo.mvc4.controllers { public class homecontroller : controller { // get: /home/ publi...

php - How to show slug on HTML id in Wordpress -

i trying id have slug such id="the_title" if title title. such use custom css n js things specific post. can using php want know if there wordpress specific code in word or two. the_title() here want that <h3 class= "serviceslist" id="what put here post's slug"><?php the_title(); ?> : <a href="#"><i class="fa fa-chevron-down"></i></a></h3> there's no built-in function displaying slug. however, can global $post object: <h3 class= "serviceslist" id="<?php echo $post->post_name ?>"> <?php the_title() ?> : <a href="#"><i class="fa fa-chevron-down"></i></a> </h3>

javascript - How to notify in Google Chrome using window.Notification? -

i'm trying display desktop notifications using window.notification object, not it. this code: var noti = new notification("bob: hi", { tag: 'chat_bob' }); noti.show(); that works on firefox, without noti.show() statement, not in google chrome. doesn't work after user grants permissions.

scala - Default executioncontext with blocking calls -

i understand using blocking notifies thread pool block of code pass contains long-running or blocking operations. allowing pool temporarily spawn new workers ensure starvation never happens. use blocking blocks @ places thinking may not ideal continue using blocking blocks default executioncontext since there must cost associated in creating temporary workers , destroying them etc. instead create separate execution context run blocking calls avoid creation/destroying costs of worker threads have enough pool size in dedicated execution context. or it's okay use 1 executioncontext , continue using blocking blocks? basically db calls blocking , going wrapped in async{blocking{}} (if continue using 1 executioncontext). there hundred or more dao blocking apis. , potentially thousands of users hitting system.

null - Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION? -

when java vm crashes exception_access_violation , produces hs_err_pidxxx.log file, indicate? error null pointer exception. caused bug in jvm, or there other causes malfunctioning hardware or software conflicts? edit: there native component, swt application on win32. most of times bug in vm. can caused native code (e.g. jni calls). the hs_err_pidxxx.log file should contain information problem happened. you can check "heap" section inside file. many of vm bugs caused garbage collection (expecially in older vms). section should show if garbage running @ time of crash. section shows, if sections of heap filled (the percentage numbers). the vm more crash in low memory situation otherwise.

ASP.NET Identity: Authorize attribute with roles doesn't work on Azure -

i published new asp.net mvc web site identity , owin authorization on azure. front-end works great, got problem back-end. use [authorize] attribute admin controllers check if user has required role access it, this: [authorize(roles = "admin")] on localhost when using remote azure sql database works fine. on azure, controller authorize attribute roles loading several minutes , throws: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specified) authorize attribute without roles works fine. adding code web.config fixes issue. <system.webserver> <modules> <remove name="rolemanager" /> </modules> </system.webserver> i know late have real answer you. thought i...

php - QueryFilter not working in DynamoDB -

i'm trying query queued notifications of table 'notifications' table in dynamodb. global secondary indexes: name: idto-time-index hash key: idto (number) range key: time (number) why i'm getting results , not ones status=='queued' ? $params = array( 'tablename' => 'notifications', 'indexname' => 'idto-time-index', 'keyconditions' => array( "idto" => array( "attributevaluelist" => array( array('n' => 1) ), "comparisonoperator" => "eq" ) ), 'scanindexforward' => false, 'queryfilter' => array( "status" => array( "attributevaluelist" => array( array('s' => (string)"queued") ), "comparisonoperator" => "eq" ...

r - How to know if any images were captured by the grDevices:png function? -

i have following code capture images device png(filename="g:\\temp\\images1\\image%04d.png") and dev.off() @ end of script it works long have code in script creates/outputs image(s). but if script not contain image plotting code , still blank image(the default 1 created when run png function) in specified folder . is there way not add default image or delete if code not output image for ex following script png(filename="g:\\temp\\images1\\image%04d.png") x<- 2+ 3 dev.off() after dev.off() , possible not have images in specified folder , or there way know if default image overwritten @ all

sql server 2008 - Determine what param to use in Select statement in a Stored Procedure -

i have stored procedure returns common query, need call in several functions functions may call through period id or others through header id, far know how can determine param use in order retrive data properly, have implemented. create procedure dbo.gettfdrecordinfo @periodid int = null, @headerid int = null begin select -- have lot more fields , joins here, that's why need statement in single call through either period id or header id * nt_csrtnvperiodinfo t -- how can make possible shown above, can use "case when"? ( /* if @periodid null t.headerid = @headerid if @headerid null t.periodid = @periodid */ ) end go -- swtich between params exec nt_csrtnvperiodinfo null, 2654 exec nt_csrtnvperiodinfo 196, null this answer: create procedure dbo.gettfdrecordinfo ...

report - Wordpress WooCommerce Customer List not populating -

i using woocommerce wordpress site. when logged in wordpress admin area, go woocommerce > reports > customers tab > click on customer list. this list should populated name, username, email, location, orders, spent, last order, , actions. however, nothing showing though have done test orders logged in user , guest. can why customer list not populating? if user completes transaction guest, information not saved in customer list. when user signs account, saved customer, , information on customer list comes from. also logged in customer or admin / manager? possible if not logged in customer info not displayed.

css - absolutely positioned image disappears in chrome -

http://www.poda.dreamhosters.com/ see "sample blog post" area.... there's image there. when applied absolute positioning (i want use css clip), disappears. in inspector can select image , see outline of be. doesn't seem z-index issue... turned off background colours elements behind , couldn't see image. help me find image please.... i'm using plugin, have limited control on html output unless want edit plugin files... (wordpress) try it: #featured_post_widget-2 img { /* ... */ clip: rect(0px, 346px, 162px, 0px); } instead of: rect(0px,0px,20px,0px);

android - send double[] to Asynctask -

i receive double array extras, need things on background send double array asynctask. @ point syntax error, like how pass double array (confparams) asyntask. my code: final double confparams[]= extras.getdoublearray("confparams"); alertdialog.builder builder = new alertdialog.builder(a_2_att_eleccion.this); builder.setmessage(msg_calc) .settitle(r.string.a_2_dialwhatcalculatetitle) .seticon(android.r.drawable.ic_dialog_alert) .setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { new calculate_asyntask().execute(confparams); } }); builder.setneutralbutton("cancel",new dialoginterface.onclicklistener() { ...

virtual - How to Hotspot Google Maps Business View? -

how create hotspot in virtual tour google maps business view? place navigation menu navigate through virtual tour google maps business view ... thank in advance. check out www.tourdash.com google approved application hotspots , navigation menu google business view. can licence through google trusted photographer though. there other solutions have been developed well, should able google them!

javascript - Promise's second .then() not failing -

this question has answer here: chained promises not passing on rejection 3 answers i'm having trouble chaining .then() calls promise. when executing following code: var prom = new promise(function(resolve, reject) { //let's fail reject(error("buuuu!")); }); var thenable = prom.then( function(done) { console.log("first handler: done!: argument: ", done); return "first then: done"; }, function(fail) { console.error("first handler: fail!. argument: ", fail); return "first then: fail"; } ).then( function(done) { console.info("second handler: done!. argument: ", done); }, function(fail) { console.error("second handler: fail!. argument: ", fail); } ); this prints following in console: first handler: fa...

javascript - Backbone.js back button not loading proper view -

in backbone application, i'm trying figure out why when click button on page, url changes appropriately actual browser display not. here's 1 flow: go application: elections/ starting page: elections/#profile/manage/:id/ page clicked to: elections/#profile/manage/:id/personalinfo/ back button clicked. should end displaying elections/#profile/manage/:id/ however when button clicked, page display doesn't change, url. i'm not sure what's causing nor how around this. i've read things options backbone.history.start() command, whenever add it, nothing displays. not sure how go fixing problem. can point me in right direction? (i can expand code samples if need be, thought might easier read) elections/app.js - called elections/index.html require.config({ baseurl: 'js/lib', paths: { app: '../app', tpl: '../tpl', bootstrap: 'bootstrap/js/', }, shim: { 'backbone...

Creating a Java Object from JSON Object containing JSON Maps using GSON -

so, i've been doing gson while, ran issue of using json maps, understand key value pairs value json object. to give idea i'm coming from, here's json { "configs":[ { "com.hp.sdn.adm.alert.impl.alertmanager":{ "trim.alert.age":{ "def_val":"14", "desc":"days alert remains in storage (1 - 31)", "val":"14" }, "trim.enabled":{ "def_val":"true", "desc":"allow trim operation (true/false)", "val":"true" }, "trim.frequency":{ "def_val":"24", "desc":"frequency in hours of trim operations (8 - 168)", "val":"24" } } ...

javascript - Kendo scrolling listview not working -

i trying scroll list view top when button clicked, doesn't seem working. here example... http://jsbin.com/jofijowa/1/edit essentially, trying move list view this... function scrolltop() { console.log("hello world"); //debug var scroller = $("#flat-listview").kendomobilescroller() console.log(scroller); //debug scroller.scrolltop(0); } #flat-listview being id of ul any ideas? thanks the kendo mobile scroller uses scrolltop when view has native scrolling enabled. when isn't - uses css transforms scrolling instead. if use reset method of scroller, scroll top regardless of current scrolling type.

c - ANSI Key Sequences -

platform: linux 3.2.0 x86 (debian wheezy) compiler: gcc 4.7.2 (debian 4.7.2-5) i writing function reads ansi escape sequences generated keys , returns macro corresponding key entered. have tested function , reads arrow keys properly. function can read arrow keys , want add control/alternate combinations, function keys, home, insert, etc. cannot seem find list of ansi escape sequences keys. in fact found copy of ecma-48 , confused when there no mention of escape sequences keys. know can list of ansi escape sequences correspond function keys, arrow keys, etc.? i'm pretty sure arrow keys brought somewhere in ecma048, frankly found document pretty impenetrable. so, instead, i'll direct ctlseqs.txt document xterm source code: http://invisible-island.net/xterm/ctlseqs/ctlseqs.txt this document focuses more on control sequences used control output, describe input control sequences in detail well. search heading alt , meta keys start of relevant section.

vba - Excel to Powerpoint Hyperlink URLs -

i have code running in excel builds powerpoint presentation in ppt 2010. i have working, except last part adding hyperlink (that in cell reference q2 , link specific youtube video. set ppt = getobject(, "powerpoint.application") set pptslide = ppt.activepresentation.slides(ppt.activepresentation.slides.count) imagenum = 1 each opptshp in pptslide.shapes '~~> need work on picture place holders if opptshp.placeholderformat.type = ppplaceholderpicture opptshp if imagenum = 1 paths = "pathoption1" else if imagenum = 2 paths = "pathoption2" if imagenum = 3 paths = "pathoption3" if imagenum = 4 paths = "pathoption4" pptslide.shapes.addpicture paths & objworkbook.worksheets(1).cells(i, 11).value & ".jpg", msofalse, msotrue, _ .left, .top, .width, .height ...

linux - Kernel crashes when doing thermal_zone_device_unregister() -

i trying install dummy thermal zone device in sys/class/thermal using kernel module. doing insmod register device works perfectly.. struct thermal_zone_device *tz_dev; //declared globally... ... //in init function tz_dev = thermal_zone_device_register("tsensor", 2,null,&tsensor_ops, 0,0, 0,0); where tsensor_ops points struct thermal_zone_device_ops bunch of dummy callback functions. however, when rmmod following code, thermal_zone_device_unregister(tz_dev); i message saying killed! reply , dmesg gives me error null pointers. way me recover reboot machine. there way avoid this? ok fixed it. specific version of linux, thermal_sys framework requires have function declared get_crit_temp. if don't define this, try remove device file upon unregistering device , end null reference error. note not apply linux versions above 3.0

visual studio - Javascript unit tests for Web Api REST services? -

i have web api controller action takes quite complex object argument. it's passed webservice json, of course, , supposed deserialize instance of c# class. i have unit tests in business layer convince me json serialization/deserialization of class in question works expected. and have c# unit tests running against web api controllers, passing instances of class actions, ensure if controller actions have right behavior, given correct objects. my problem: these objects complicated enough constructing improper json isn't going easy. intent create convenience functions, in javascript, aid in construction, , i'd have unit tests make sure work, , unit tests ensure properly-formatted json deserialized target class expected. that means need create, in vs2013 solution, way run javascript, both self-contained unit tests, , calls against web api webservice. any suggestions tooling work best that? i'd can contained within visual studio, can configured msbuild target. ...

javascript - Iterate over sockets in socket.io v1? "...has no method 'clients'" -

before able write this: io.sockets.clients().foreach(function (socket) { socket.emit(signal,data); }); now, cannot , error object #<namespace> has no method 'clients' is there way this? socket v1.0. (or 1.0.2 think). for know can use io.emit() , iterate on sockets , perform functions on them in timer. can refactor callbacks , set timer on io.on() , think need able use references (i think javascript make copy of object socket in case instead of referencing it?) here's example setinterval(function(){ io.sockets.clients().foreach(function (socket) { socket.emit('newmessage',somecalculations()); }); },1000); if info connected sockets has send single socket (var in io.sockets.connected) { var s = io.sockets.connected[i]; if (socket.id === s.id) { continue; } socket.emit('notify_user_state', s.notify_user_state_data) }

objective c - NSView containing NSOpenGLView doesn't redraw after a subview is removed -

i have mac os x (10.9) application custom nsview main nswindow's contentview property. thing custom view override drawrect: it's transparent. transparency required nsopenglview visible (see below): /* transparent nsview subclass */ - (void)drawrect:(nsrect)dirtyrect { nslog(@"drawing rect"); [[nscolor clearcolor] set]; nsrectfillusingoperation(dirtyrect, nscompositeclear); } the contentview has nsopenglview subview, surface order set -1 (it's 'below' main nswindow, transparent): /* nsopenglview subclass: */ glint order = -1; [self.openglcontext setvalues:&order forparameter:nsopenglcpsurfaceorder]; i instantiate webview , place subview of custom view: _webview = [[webview alloc] initwithframe:frame]; [_webview setmaintainsbackforwardlist:no]; [_webview settranslatesautoresizingmaskintoconstraints:no]; [_webview setdrawsbackground:no]; [_window.contentview addsubview:_webview]; the webview small box in window (on top of nsopengl...

Express REST API - Delete Method -

i getting stuck on delete method api. application requires user log in , can add courses. courses stored in nested array inside user model. want user able cancel (delete) course view , have course deleted user's profile on server. getting 404 response event though variables comparing identical. this ajax call delete specific course: jquery.ajax({ url: "/test/signups/5387c1a0fb06e48f4658170c", type: "delete", success: function (data, textstatus, jqxhr) { console.log("post resposne:"); console.dir(data); console.log(textstatus); console.dir(jqxhr); } }); this delete method: app.delete('/test/signups/:id', isloggedin, function(req, res) { user.findone({'_id': req.user.id }, function(err, user) { if (err) return done(err); if (user) { var found = false; var singlesignup = user.signup.filter(function(e){ return e._id == req.params.id })[0...

django - href with a plist link not resolving in python app -

i have legacy code moving on our django project , wondering why href not resolve anticipated. should open enterprise version of our mobile app. when clicked interpreted url django , therefore 403 page not found. i'm assuming django hates formatting of url but, gives? <a href="itms-services://?action=download-manifest&url=https://dl.dropbox.com/s/lwnsbatj8snq07o/myapp.plist"><button type='button' class='btn-default'>download</button></a> this can't possibly have django. django doesn't - , can't - change way browser interprets links: serves html browser.

c - CONTROL \ crashes call to getline -

the following code produces " quit (core dumped) " when run , type control \. don't hit return. got code tutorial book. i tried debugging gcc this: (at blank line it's running getline , i'm typing control \.) 14 bytes_read = getline (&my_string, &nbytes, stdin); (gdb) program received signal sigquit, quit. 0x004011e5 in main () @ myfile.c:14 14 bytes_read = getline (&my_string, &nbytes, stdin); (gdb) ...when single step it. #include <stdio.h> #include <stdlib.h> int main() { int bytes_read; int nbytes = 100; char *my_string; puts ("please enter line of text."); /* these 2 lines heart of program. */ my_string = (char *) malloc (nbytes + 1); bytes_read = getline (&my_string, &nbytes, stdin); if (bytes_read == -1) { puts ("error!"); } else { puts ("you typed:"); puts (my_string); } retur...

ios - UIToolbar background image faded -

Image
i want show green image on uitoolbar. image , code used are: [topbar insertsubview:[[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"title-bar.png"]] autorelease] atindex:0]; i succesfully load image. image not showing properly. dimmed shown below. am missing something? how can configure show image same?

java - Extended Class And implemented interface having same method name -

in java, if have classa extends classx , implements interfacey , , both classx , interfacey have methodc() , why don't have give implementation of methodc() in classa ? kind of method overloading ? because if classx has implementation of methodc() , classa extends classx , classa does have implementation of methodc() - classx 's implementation of it. if classa has it's own implementation of methodc() , called method overriding - classa 's implementation override implementation of super class ( classx ). overloading different issue entirely: overloading occurs when class has multiple methods same name/return type take different parameters. useful when want able perform same or similar operations different inputs, , has nothing overriding , useful when have subclass implementation of particular method needs different of super-class. see here helpful discussion differences between them.

node.js - [Error: failed to connect to [localhost:27017]] . This error is occuring On mongodb -

this question has answer here: node.js failing connect mongodb 1 answer my sample code here. learning book developing_backbone.js_applications have installed mongodb on pc. searched on site answers no clue. has got solutions? thanks! // module dependencies. var application_root = __dirname, express = require('express'), //web framework path = require('path'), //utilities dealing file paths mongoose = require('mongoose'); //mongodb integration //create server var app = express(); // configure server app.configure(function () { //parses request body , populates request.body app.use(express.bodyparser()); //checks request.body http method overrides app.use(express.methodoverride()); //perform route lookup based on url , http method app.use(app.router); //where serve static content app.use(express.st...

android - appwidget onupdate not called as well as button click not working after some time -

i having simple widget has 3 button 3 different system operation. i made xml in xml folder , code below. <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minwidth="292dp" android:updateperiodmillis="86400000" android:minheight="32dp" android:initiallayout="@layout/activity_main"> my layout file below <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="80dp" android:gravity="top" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:background="#d8f781" > <button android:id="@+id/button1" android:layout_width="wrap_content" android:...

android - onClickListener not triggered during animation -

i have followed this answer animate imageview. animation works perfect. had added onclicklistener imageview. onclicklistener works when image @ rest, not animating. while animating, imageview doesn't trigger onclicklistener action. problem here? how can rectify it? please me out.

sql - How to select data from database where today date between startdate and enddate? -

i working select data today date between startdate , enddate. have tried not work. can give me solution on it? this have tried : $stmt = "select tbl1.* "._const_tbl_vote." tbl1, "._const_tbl_vote_answer." tbl2" ; $stmt .= " ".$date." between tbl1.publishing_startdate , tbl1.publishing_enddate"; try adding '' around $date variable like $stmt = "select tbl1.* "._const_tbl_vote." tbl1, "._const_tbl_vote_answer." tbl2" ; $stmt .= " '".$date."' between tbl1.publishing_startdate , tbl1.publishing_enddate";

html5 download attribute won't work in chrome -

i have javascript code construct download link: <a download="report.csv" href="data:application/csv;charset=utf-8,(data appended here)"></a> when click it, download file 'download' instead of 'report.csv'. doubt if that's because browser doesn't support html5 since download attribute html5 feature. test browser (chrome) shows support html5. 1 know why won't work? thanks. if remember correctly, charset attribute not supported anymore in html5. you can try append data converted base64

oop - C++ BODMAS precedence -

i need implement calculator using c++ oop can input expression format (2+3-6*(5-3)+ 6)/4 string. program should validate , calculation according bodmas precedence. there inbuilt method in c++ me check bodmas precedence of string? standard c++ not provide built-in parsing libraries, you'll have third-party one. quick search shows quite few options (e.g. if use boost, try spirit ).

Android on Time execute -

i developing app need time related work . want execute particular service @ 9pm 6pm, in days monday , sunday not execute service, kindly me . i think you're looking alarmmanager, can schedule methods [related question] alarm manager example i hope helps

php - Codeigniter image upload with text field validation -

in codeigniter have add_main_products function upload image database , before want validate text field <input type="text" name="product_name"> . how do inside add_main_products() function function add_main_products(){ $config['upload_path'] = 'application/views/uploads/'; $config['allowed_types'] = 'gif|jpg|png|jpeg'; $this->load->library('upload', $config); if (!$this->upload->do_upload('userfile')) { $error = array('error' => $this->upload->display_errors()); $this->load->view('admin/admin_add_mainproduct', $error); } else { $this->mod_products->add_main_product($this->upload->data()); $data = array('upload_data' => $this->upload->data()); $this->load->view('admin/admin_add_mainproduct', $d...

linux - Safer alternative to MATLAB's `system` command -

i have been using matlab's system command result of linux commands, in following simple example: [junk, result] = system('find ~/ -type f') this works expected, unless user types matlab's command window @ same time. during long find command not uncommon. if happens user's input seems mixed result of find command (and things break). as example, instead of: /path/to/file/one /path/to/file/two /path/to/file/three /path/to/file/four i might get: j/path/to/file/one u/path/to/file/two n/path/to/file/three k/path/to/file/four in order demonstrate easily, can run like: [junk, result] = system('cat') type command window , press ctrl+d close stream. result variable whatever typed in command window. is there safer way me call system commands matlab without risking corrupted input? wow. behavior surprising. sounds worth reporting bug mathworks. tested on os x, , see same behavior. as workaround, re-implement system() using calls ...

How to select all entries of a MySQL table except the last one? -

how select entries last 1 in mysql? tried following statement: select * table name order id select id lot_master `id auto increment` order id decs limit 1 how can achieve this? select name shopping_cart id<>(select max(id) shopping_cart);

javascript - BufferGeometry offsets and indices -

i wondering while "offsets" , "indices / index" are. offsets e.g. mentioned in https://github.com/mrdoob/three.js/blob/dev/src/core/buffergeometry.js , indices mentioned in indexedgeometry, can't find anymore in dev tree. although indices seem rather obvious , although dive code figure out maybe-correct answer myself i'd love hear "official" statement :) thanks! there 2 ways defining geometries: non-indexed "vertices": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ], "normals": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ] in mode every triangle position defined , can't reuse data. triangle 0: [ 0, 1, 2, 3, 4, 5, 6, 7, 8 ] indexed "indices": [ 0, 1, 2, ... ], "vertices": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ], "normals": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, ... ] in mode, indices define order of data. first triangle using indices 0 , 1 , , 2 . these indices used fetch vertices , norm...