Posts

Showing posts from May, 2012

actionscript 3 - JSON loads from Local Server, but it doesnt from Remote Server -

i new coding , finished testing codes local server , moving them remote server. works ok when on local server, when uploaded them onto remote server,(everything works fine, except 1 class file). 1 specific class file having problem, when on local server, loading speed slow, wondering if because passing 3 urlrequest thru it. doesn't load @ when on remote server. i wondering if split them , using addchild other class files if help. time! mend = new urlrequest("http://rentaid.info/myaccount_1.php"); mend.method = urlrequestmethod.post; variablesss = new urlvariables(); variablesss.username = s7.statusname.text; mend.data = variablesss; nloader = new urlloader(); nloader.dataformat = urlloaderdataformat.text; nloader.load(mend); send = new urlrequest("http://rentaid.info/autojson.php"); send.method = urlrequestmethod.post; ...

ajax - Response Already Commited Error for JSF2 Apache MyFaces -

version : apache myfaces 2.1.14 , richfaces 4.3.5 issue: we migrating jsf 1.2 jsf 2. facing strange issue : when ajax operation performed , getting below error , page not refreshed (or rerended usual) org.apache.myfaces.context.servlet.servletexternalcontextimpl setresponsecontenttype severe: cannot set content type. response committed this question similar jsf 2.0 response commented (ajax) , seems no 1 has answered question. comes @ specific page , same code @ other places works fine , error random in nature? is apache myfaces ? please if inputs available . the xhtml ajax tags causing these issues : a4j:commandlink , a4j:ajax that occurs because there error on render response phase , part of response has been send client. algorithm try render error page can't because response has been sent problem. the solution avoid commit, increasing buffer size of response. use javax.faces.facelets_buffer_size web config parameter (by default 1024 bytes). ...

ios - Setting Accessory on cell in viewDidLoad -

Image
i have 2 table view controllers, "root" , "detail". in root view have cell says "status". need able change that. when click seguewayd detailed view shows statuses can pick (static cells). when click on status, checkmark displayed. checkmark needs displayed when status chosen. checkmark should visible seguawayd in root view. i able display checkmark next status click cell. when want checkmark displayed when i'm seguawayd, doesn't show. code im using - (void) setcheckmarkonindexpath:(nsindexpath *)indexpath { uitableviewcell *cell = [self.tableview cellforrowatindexpath:indexpath]; cell.accessorytype = uitableviewcellaccessorycheckmark; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [self setcheckmarkonindexpath:indexpath]; } - (void)viewdidload { [super viewdidload]; // indexpathforrow set third cell demo [self setcheckmarkonindexpath:[nsindexpath indexpathforrow:2...

diff - Difference between files skipping useless data -

let's have 2 files containing xml, , want search difference in files, looking @ tags, skipping others... example: file1 <xml> <key>key1</key> <value>value1</value> <useless_tag>something</useless_tag> </xml> file2 <xml> <key>key1</key> <value>value2</value> <useless_tag>something_else</useless_tag> </xml> so i'd point out 2 files different because of content in "value" tag, , not 1 in "useless_tag". i'd stuff recursively inside multilevel folders... i'm on windows , debian... is there way can that? thanks all

javascript - cannot perform operations on a Metamorph that is not in the DOM -

so using ember 1.5.1 , ember-data 1.0.0 beta7 i have following routes app.router.map -> @resource "items" @resource 'item', path: '/items/:id item fetched server. these 2 routes work fine if start on route; weird thing happens when start on item page (/items/1), try navigate /items/ through link action handled function this.transitiontoroute("items") in itemcontroller. got following error: attempting transition items ember.js?body=1:3524 transition #2: items: calling beforemodel hook ember.js?body=1:3524 transition #2: items: calling deserialize hook ember.js?body=1:3524 error while loading route: error: cannot perform operations on metamorph not in dom. @ metamorph.checkremoved (http://localhost:3000/assets/ember.js?body=1:27009:15) @ metamorph.html (http://localhost:3000/assets/ember.js?body=1:26979:12) @ object.dommanager.empty (http://localhost:3000/assets/ember.js?body=1:27974:16) @ object.ember.merge.empty (http://localhost...

sql - Get the first and last record of each item for the month -

product id quantity dateadded 1 100 4/1/14 2 200 4/2/14 3 300 4/2/14 1 80 4/3/14 3 40 4/5/14 2 5 4/6/14 1 10 4/7/14 i using sql statement display first , last record of each item: select productid, min(quantity) starting, max(quantity) ending records dateadded between '2014-04-01' , '2014-04-30' group productid, quantity but getting same values starting , ending columns. want achieve this: product id starting ending 1 100 10 2 200 5 3 300 40 you getting same quantities because aggregating quantity in group by product. version of query, written be: select productid, min(quantity) starting, max(quantity) ending records dateadded between '2014-04-01' , '2014-04-30' group pr...

javascript - Slider not scrolling through image -

having issue responsive slider - working fine removing changes still not scrolling through images? here code (this sitting in header): <script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script> <script src="responsiveslides.min.js"></script> <div style="heigt: 500px;"> <ul class="rslides" id="slider1"> <li><img src="img/businessbig.jpg" alt="" ></li> <li><img src="img/cateringbig.jpg" alt=""></li> <li><img src="img/nurseriesbig.jpg" alt=""></li> </ul> </div> sat @ bottom of page: <script type="text/javascript"> $(document).ready(function() { $('#nav-mobile ul').hide(); $('#nav-mobile').click(function(e) { $(...

html - Links inside Twitter Bootstrap Dropdown menu won't work -

i have fetched admin template based on twitter bootstrap. i'm designing dropdown menu. seems links inside menu don't work (its effect close menu). here code: <ul class="nav navbar-nav navbar-right navbar-user"> <!-- others links --> <?php $auth = zend_auth::getinstance(); ?> <?php if($auth->hasidentity()):?> <li class="dropdown user-dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-user"></i> <?php echo $auth->getidentity()->user_name.' '.$auth->getidentity()->user_lastname;?><b class="caret"></b></a> <ul class="dropdown-menu" role="menu"> <li><a href="http://www.google.com/"><i class="fa fa-user"></i> profil</a></li> ...

python - Regression function by weighted least squares using scikit-learn -

i want use scikit-learn 's decisiontreeregressor , need different criterion. there way make own decision function? rather mean squared error, need use regression tree based on weighted least squares. what best modification be? i'm thinking need modify tree change way feature_importances_ calculated. however, checked code of tree.py , while mentions tree_.computer_feature_importances() , can't sem find make edits.

Change app UI from notification action in android -

i working on to-do list android app has feature of users being able set reminders shown in notification bar. notification contains "completed" action associated it. when action pressed, makes changes sql lite database. works fine if app closed. if app still open , press on notification action, ui doesnt change automatically. have close app , start again see changed data. there way cause activity reload in way reflect changes if activity open. there several solutions: use dataprovider , call context.getcontentresolver().notifychange() notify observers new data appropriate uri use localbroadcastmanager register receiver in activity , later notify changes. use non standard methods of notifying updated data. instance otto so, recommend read observer pattern because solutions it.

jquery - javascript:Shifting the <li> -

i have 3 <li> <li id="li_93_n:90" class="ligrid" data-upindex="" data-itemindex="'9001'" data-itemid="'93_n:90'" style=""> blah1</li> <li id="li_50_n:90" class="ligrid" data-upindex="" data-itemindex="'9002'" data-itemid="'50_n:90'" style=""> blah2</li> <li id="li_91_n:90" class="ligrid" data-upindex="" data-itemindex="'9003'" data-itemid="'91_n:90'" style=""> blah3</li> and have insert 1 more <li> @ second postion , have shift blah2 , blah3 <li id="li_80_n:90" class="ligrid" data-upindex="" data-itemindex="'9002'" data-itemid="'80_n:90'" style=""> blah-blah</li> and change data-itemindex of blah2 , blah3 90...

java - Upgrading from jetty 7 to jetty 9 -

i'm running jetty 7 web application , upgrade jetty 9. project based on spring framework , uses maven dependency management. once upgrade jetty, fails start because of following error: java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.eclipse.jetty.start.main.invokemain(main.java:473) @ org.eclipse.jetty.start.main.start(main.java:615) @ org.eclipse.jetty.start.main.main(main.java:96) caused by: java.lang.noclassdeffounderror: javax/servlet/http/httpservletrequest @ java.lang.class.getdeclaredconstructors0(native method) @ java.lang.class.privategetdeclaredconstructors(class.java:2493) @ java.lang.class.getconstructor0(class.java:2803) @ java.lang.class.newinstance(class.java:345) @ org.eclipse.jetty...

db2 - SQL nested select statement; -

Image
i need make new table based on datatable schema. not sure if can using nested sql select statements or else. select cola, colb, colc, cold, (select cole table cola=120) cole table cola = 122 just using nested select cole , giving alias column.

php - New 5.4 array short array syntax: Good practice? -

i'd use new short array syntax: # old syntax $foo = array( 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => array( 'key1' => 'value2', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', ), ); # new syntax $bar = [ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => [ 'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3', 'key4' => 'value4', ], ]; is syntax considered practice right now? or should stay old syntax? usually practice related logic of code , not it's syntax, there's reason made new array syntax , reason is: faster coding , easier read. practice irrelevant her...

master - Any other solutions to the MineSweeperMaster in Google code jam 2014 qualification round? -

below solution, solves problem. hope can see solutions uses dynamic programming or other algorithms (except brute force) try put 0 cells board. below steps of algorithm: set remains = r * c - m. 1) m = 0: free spaces. print "." in cells , overwrite cell "c". 2) remains = 1: same idea, . print "*" in cells , overwrite cell "c". 3) if r==1, or c==1: solution put "*" in first m cells, , "c" in last cell, other cells "." (exchanged position of case 4) , 5). comments @thecomputerguy.) 4) in other cases, if remains 2, 3, 5, 7, "impossible". else: 5) if r==2, or c==2: if m % 2==0, have solution: in first m/2 columns or rows "*", , "c" in last cell, other cells "." if m % 2 == 1, "impossible". 6) fill mines (0,0), line line, left right, down. need consider special cases: set rs = m / c; cs = m % c 6.1) if rs < r - 2, , cs < c - 1, filled, ...

ios - UILabel of a TableViewCell changes position on reloadData and onClick -

Image
i have tableview inside viewcontroller , every time try reloaddata or click cell. specific label moves higher , stays there. before reload or click!: after reloaddata or click cell: any ideas going wrong? i call read function data in database , store them in nsmutablearray sitetableobjectsarray. dispatch_async(backgroundqueue, ^(void){ [self read:^(bool finished) { if(finished){ dispatch_async(dispatch_get_main_queue(), ^{ sitetableobjectsfinalarray = [sitetableobjectsarray copy]; nssortdescriptor *sortdescriptor = [[nssortdescriptor alloc] initwithkey:@"work.title" ascending:yes]; nsarray *sortdescriptors = [nsarray arraywithobject: sortdescriptor]; sitetableobjectsfinalarray = [sitetableobjectsfinalarray sortedarrayusingdescriptors:sortdescriptors]; [self.tableview reloaddata]; }); } ...

ios - Can't put a single quote before the year in NSDateFormatter -

i want format date follows: mon, apr 14 '09 the dateformat i'm setting nsdateformatter eee, mmm dd 'yy shows: mon, apr 14 'yy if take out single quote before year, last 2 digits of year it's not obvious it's year because single quote gone. help? i've tried putting ''' , '\'' , , '\''' before 'yy' doesn't work, although last 2 produced 'yy , ''09 from http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#date_format_patterns : in patterns, 2 single quotes represents literal single quote, … in case: [formatter setdateformat:@"eee, mmm dd ''yy"];

php - How to query from two tables with the condition of a third -

i have 3 tables: location user_location image i need make query takes locationes liked user toggether locations images in third table image. for managed this: "select location.* location left join userlocation on location.id = userlocation.location_id userlocation.user_id=:user_id: but retrives locations user liked. need images of every location. how do that? you need move condition on clause: select l.*, (ul.user_id not null) hasuser location l left join userlocation ul on l.id = ul.location_id , ul.user_id = :user_id: the where clause filters output in such way turns left join inner join .

devexpress - empty row and column while Exporting Several XtraGrid Controls to a Single Excel File -

i have read this article , tested, works problem there 1 wide empty column (column a) , 1 wide empty row (row 1) in every sheet (in excel file). know setting of printingbase class. how can remove first empty column , row ? i have found answer own question: var compositelink = new compositelinkbase(); var link1 = new printablecomponentlinkbase(); // margins in sheet1 link1.margins.left = 0; link1.minmargins.left = 0; link1.component = dg1; compositelink.links.add(link1); // export excel :)

mysql - Textarea Being Picky over Input -

in text area: <textarea rows="12" cols="76" name="skills" input id = "skills" placeholder="skills:" class = "textbox" ><?php echo $skills; ?> </textarea> it being picky on accepts. example wont accept apostrophe's on own line , wont accept bunch of commas on own line. how can make text box accept everything? note: characters can typed in, wont saved in mysql database. here code use save contents of text area mysql database. session_start(); $id=$_get['id']; // connect server , select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); // data sent form $bio=$_post['bio']; $sql = "update members set bio = '$bio' id = $id"; $result=mysql_query($sql); mysql_close(); header("location:userprofilesetti...

has many - Adding, updating and removing associated classes in Grails -

i have following relations: class host { static hasmany = [ips: hostip, groups: hostgroup] static belongsto = [hostgroup] string dns } class hostip { static belongsto: [host: host] string ip } class hostgroup { static hasmany = [ hosts: host ] string name } i have form in gsp allows edition of host. have dynamic add-edit-remove list add, edit , delete new , current host ips, if host has 2 ips (ip1 , ip2), ip1 removed, ip2 modified ip3 , ip4 added, data sent controller: original data displayed in form: ips[0].id = 8 ips[0].ip = ip1 ips[1].id = 9 ips[1].ip = ip2 sent data when submitted: ips[1].id = 9 ips[1].ip = ip3 ips[2].ip = ip4 this means, that, ip1 removed, neither id or ip sent (its fields removed form), , new ip4 sent (new dynamic field added), without id, doesn't exist yet. so, when doing binddata(host, params) , , save() , ip2 updated ip3, , ip4 created, ip1 not deleted. normal behaviour of binddata ? if not, can forced? i...

asp.net - Add DiscussionsList app to default.aspx in SharePoint 2013 -

i'm trying add sharepoint discussionslist app site defintion. according him how done. <webpartpages:webpartzone runat="server" frametype="none" id="left" title="loc:main"> <zonetemplate> <webpartpages:clientwebpart runat="server" featureid="00bfea71-6a49-43fa-b535-d15c05500108" productwebid="effe939b-9566-4a32-be39-7564aa48247c" webpartname="discussionslist" title="my webpart title" description="webpart description" webpart="true" id="discussionslist" > </webpartpages:clientwebpart> </zonetemplate> </webpartpages:webpartzone> i got featureid here . when load page instead of app error displayed , don't understand it. mean? did forget add? the discussionslist clientwebpart in featu...

hadoop - Log file into Hive -

i have log file "sample.log" looks below: 41 texas 2000 42 louisiana4 3211 43 texas 5000 22 iowa 4998p in log file first column id, second state name , third amount. if see state name has louisiana4 , sales total has 4998p. how can cleanse can insert hive (using python or other way?). please show steps? i want insert hive table tblsample: table schema is: create table tblsample( id int, state string, sales int) row format delimited fields terminated '\t' stored textfile location '/user/cloudera/staging' ; to load data hive table do: load data local inpath '/home/cloudera/sample.log' table tblsample; thank you! you load data hive table , use udfs cleanse data , load table. far more efficient python running mapr reduce.

networking - cellular network NAT traversal -

i tried implement udp hole punching algorithm application. when both peers contacted server revealing public ip 3g cellular nat assigned constant external port same internal udp port,however, 3g cellular nat changed internal->external port mapping depending on destination . hence, example, if c static ip server a->c mapped port 1234 whereas a->b mapped port 5678. way udp hole punching failed. as cellular nats use cgn, there no upnp/nat-pmp support. have read pcp cgn functionality similar these, however, didn't find protocol information on pcp. does know if there way overcome destination-variable port mapping issue? either port forwarding(like pcp) or traversal( preffered ). one last thing. there proofs of concept skype, viber , importantly torrent downloaders depend on vuze-core(frostwire) work on android on 3g , other cellular networks. must have found solution that... thanks in advance!

objective c - How to change leftBarbuttonItem title? -

Image
i want change leftbarbutton title. i've tried uibarbuttonitem *newbackbutton = [[uibarbuttonitem alloc] initwithtitle:@"back" style:uibarbuttonitemstylebordered target:nil action:nil]; [[self navigationitem] setleftbarbuttonitem:newbackbutton]; but brings changes but want how can possible? it may helpful uibarbuttonitem *backbarbutton = [[uibarbuttonitem alloc] initwithtitle:@"back" style:uibarbuttonitemstyledone target:self action:@selector(backaction:)]; self.navigationitem.leftbarbuttonitem = backbarbutton;

html - I want to redirect nitroindia.org to www.nitroindia.org in godaddy windows hosting -

this question has answer here: asp.net mvc: how redirect non www www , vice versa 6 answers i wanted redirect website nitroindia.org www.nitroindia.org in windows hosting w.ith web.config file. replaced web.config file gave me resultant 500 internal server error. <?xml version=�1.0? encoding=�utf-8? ?> <configuration> <system.webserver> <rewrite> <rules> <rule name=�redirect ml2? stopprocessing=�true�> <match url=�.*� /> <conditions> <add input=�{http_host}� pattern=�^nitroindia.org$� /> </conditions> <action type=�redirect� url=�http://www.nitroindia.org/{r:0}� redirecttype=�permanent� /> </rule> </rules> </rewrite> </system.webserver> </configuration> my default file name index.html i'm guessing using iis 7.5 , below should work: <?xml version=...

c# - Adding the solution name as base of namespace for all projects -

so have solution in visual studio 2013. solution tree looks this: mysolution >myprojecta >myprojectb >myprojectc the default each class in project folder has namespace same project folder name. but each class in each project folder have namespace starts solution name. example if there class named myclass in myprojecta want it's namespace mysolution.myprojecta is there way automatically in visual studio? go , change namespaces self...but rather love see if possible automatiaclly. in each project's settings, there default namespace used whenever add new files project. default value project name, can customize it. can change , new files added use desired namespace. for existing files, find , replace can provide relatively quick cleanup (find: namespace myprojecta -> replace with: namespace mysolution.myprojecta , search within current project).

Xslt replace tag -

we have xslt file creates following tags: <fininstnid> <bic /> </fininstnid> or <fininstnid> <bic>bicabc</bic> </fininstnid> this must replaced by: <fininstnid> <othr> <id>notprovided</id> </othr> </fininstnid> how have change current xslt looks like: <xsl:template match="/"> <xsl:text disable-output-escaping="yes">&lt;?xml version="1.0" encoding="utf-8"?&gt;</xsl:text> <xsl:copy-of select="wt:envelope/wt:body/wt:messageparts/*" /> </xsl:template> the input xml data must changed looks like: <document xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" :tech:xsd:pain.001.001.03" xsi:schemalocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd">- <cstmrcdttrfinitn> <grphdr> <msgid...

c# - Mathf.Tan giving strange results -

i have 1 problem in finding tan angle in unity3d game. the code follows b = mathf.deg2rad * (90.0f - angle); float tan = mathf.tan (b); debug.log ("value of b : " + b + " tan of b : " + tan); here value angle 0. the problem me when calculate using calculator result of b 1.570796327 correct , value of tan 0.027422438 when calculator in degree mode , **infinity ** in radians mode the debug log results follows value of b : 1.570796 tan of b : -2.287733e+07 what problem? please excuse if wrong. due inaccuracies in floating point numbers, tangent calculated angle on π/2 rad (90 deg), resulting in large negative answer. if want better account case, should check if b close enough pi/2 : if is, tangent undefined. e.g. // if necessary, account 3pi/2 (270 deg) if (math.abs(b - math.pi / 2) < 0.00001) // undefined or infinite else // finite, calculate tangent normal

c - String prints nothing -

first, know use of malloc in instance poor practice; curious why following code doesn't work (logically, there no compile or runtime errors) #include <stdio.h> #include <stdlib.h> #include <string.h> //function remove n number of characters replicated string char* remove_beginning(int n, char a[], int size) { int i; char *p=malloc(size-(1+n)); for(i = n ;i < size-1; i++) { p[i] = a[i]; } return p; } int main(){ char *str = "123456789"; char *second = remove_beginning(5, str, strlen(str)); printf("%s\n", second); return 0; } p[i] should p[i-n] , need copy null also: #include <stdio.h> #include <stdlib.h> #include <string.h> //function remove n number of characters replicated string char* remove_beginning(int n, char a[], int size) { int i; char *p=malloc(size-(n-1)); for(i = n ;i <= size; i++) { p[i-n] = a[i]; } return p; } int main(){ char *str = "123...

javascript - getElementsByClassName returns undefined even though the element is in the DOM -

i trying fetch elements dom of page using getelementsbyclassname . seems simple enough, problem undefined though element in document (unless misunderstood things). any idea why? document.getelementsbyclassname('masonry-column')[0].getelementsbyclassname('subject-details')[6] returns undefined . document.getelementsbyclassname('masonry-column')[0].getelementsbyclassname('subject-details') returns: [div.subject-details, div.subject-details, div.subject-details, div.subject-details, div.subject-details, item: function, nameditem: function] 0: div.subject-details 1: div.subject-details 2: div.subject-details 3: div.subject-details 4: div.subject-details 5: div.subject-details 6: div.subject-details // need element 7: div.subject-details 8: div.subject-details length: 9 __proto__: htmlcollection i fetching elements early. if example call function after few seconds delay, works expected. ...

html - Navigation Div Affecting Other Nav Elements -

i have several div elements acting main navigation. when page active, have separate div element each height of div higher. seems affect line height/position of other divs on page reason. here sass #neo_mainnav { /* main navigation */ position: fixed; bottom: 35px; width: 480px; .nav_text { font: 14pt arial, helvetica, sans-serif; text-align: center; vertical-align: middle; line-height: 35px; } #video_nav { float: left; margin-right: 10px; width: 112.50px; height: 35px; background: #66a9c6; } #video_nav_active { float: left; margin-right: 10px; width: 112.50px; height: 50px; background: #66a9c6; } #gallery_nav { float: left; margin-right: 10px; width: 112.50px; height: 35px; ...

c# - Using DevexpressGridview BeforeGetCallbackResult -

im using devexpress gridview , want trigger javascript "gridviewsettings.beforegetcallbackresult " don't find how this. should simple enough im missing something! settings.beforegetcallbackresult = (s, e) => { //run js function: getstatusmessages() here! }; anny ideas? edit 1; found solution settings.clientsideevents.endcallback = "getstatusmessages"; it missed; solution: settings.clientsideevents.endcallback = "getstatusmessages";

php - How to add new listener in the best way? -

i have project on zf 1.x , want use eventdispatcher symfony component. have 2 services user , topic. after success user authentication need activate user's topics. create event - authenticationevent , fire event after authentication in user service this $dispatcher->dispatch('user.authentication.success', new authenticationevent($user)); but need add listener? code looks like $listener = new topiclistener(); $dispatcher->addlistener('user.authentication.success', array($listener, 'onauthenticationaction')); i had method authenticate in user service , there code lines calling method activate($user) activate topics in success case of authentication. whereupon had coupling between user , topic service. why decided use eventdispatcher. so best place adding listeners? in bootstrap part of code? i don't know zf. must add listener before dispatch event. has "bootsrap" file? add listener there (or in front controller). ...

Android: LocationManager service stops updating when set to NETWORK_PROVIDER -

right, situation follows; we have developed app checks location of user every 5-10 minutes location specific content. so, i've created service stick background (so can update when app isn't directly in foreground) in locationcontroller created check latest known location. when it's finished, cleans , location sent database (which necessity concept). this works fine, long check location gps_provider. however, when switch around network_provider, may check location once more before dying completely. i've tried multiple options prevent problem, nothing seems working update service when swap 1 setting. here few snippets should relevant service: updateservice: @override public void oncreate() { super.oncreate(); log.d("debug", "created service"); powermanager mgr = (powermanager)getsystemservice(context.power_service); wakelock = mgr.newwakelock(powermanager.partial_wake_lock, "mywakelock"); wakelock.acquire(...

opencv - orb descriptor computation on provided keypoints -

i using opencv 2.4.8. declaring orb such: int patchsize = 31; orb orb(1000,1.0f,1,patchsize,0,2,orb::harris_score,patchsize); doesn't patch size mean there should (patchsize-1)/2 space around keypoint? i providing keypoints @ coordinates 15 pixels margins vertically , horizontally, such positions fail produce descriptors. for example, image 240x320 point (15,15) fails described, though there enough pixels ( 0,1,....14 -> 15 pixels). opencv uses keypointsfilter::runbyimageborder selected edgethreshold (which patchsize ) eliminate keypoints close image border orb computation (the file modules/features2d/src/orb.cpp , if want have look; line 669 in computekeypoints ). so margin 31, , not 15. hope helps!

javascript - Binding input with directive in AngularJS -

i have directive appears when element form ng-repeat list clicked on. far directive has no toggle, appears when item clicked, , destroyed , recreated when another element clicked. the problem i'm having once have ng-repeat list displayed , user clicks on element, directive appear, if user filters list, element binded directive disappear, directive still there. i've tried adding ng-focus="hideversions = true" in input filters, , ng-hide="hideversions" in container wrapping directive, far no luck. here's filter: <input ng-show="artist.name" ng-model="$parent.album" ng-focus="hideversions = true" placeholder="filter release name""/> and directive: angular.module('myapp').directive('thedirective', function($http, $compile) { return { restrict: 'a', scope: { position: '@', last: '@', release: '=' }, link: f...

java - How to generate a unique key for a string content? -

i looking algorithm creates unique key string. generated key string should same every instance of execution of code. want serialize key , string file , deserialize (binary file)it on other platform android application , set top box, etc... can 1 me in regards? you can use hashcode() function. http://docs.oracle.com/javase/7/docs/api/java/lang/string.html#hashcode()

javascript - jQuery - Can't receive data -

i have problem, using jquery/ajax run form, send data external file, , update part of page. ran problem: the external site works. prints out div id="content" when run site manually. but when im trying receive data document through jquery, not return field. it runs other code on external file fine, executes database calls in external file fine. there no data returned, when code executed, text of "testlog" div (text here) disappears, isn't replaced. so can me why can't retrieve data external file? first, here relevant part of file want import into: <script> $(document).ready(function() { $( "#moven" ).submit(function( event ) { // stop form submitting event.preventdefault(); var $form = $( ); term = $form.find( "input[name='direction']" ).val(); var posting = $.post( "/modules/world/movement/move.php", { direction: term } ); posting.done(function( data ) { var content = $(...

c++ - GMock passing a mocked object into another, and calling a stubed method is still calling real logic -

i'm trying pass mocked object object's method , call it, same result call real method. fooa.h - real class #ifndef fooa_h #define fooa_h class fooa { public: fooa(); virtual int method(int a, int b, int c, int d); }; #endif // fooa_h fooa.cpp #include "fooa.h" fooa::fooa() { } int fooa::method(int a, int b, int c, int d) { return a+b+c+d; } mockedfooa.h - mocked version of fooa #ifndef mockedfooa_h #define mockedfooa_h #include "fooa.h" #include <gmock/gmock.h> class mockedfooa : public fooa { public: mock_method4( method, int(int a, int b, int c, int d) ); }; #endif // mockedfooa_h calculator.h class invokes method fooa class #include "fooa.h" #include <iostream> class calculator { public: calculator() { } void docalc(fooa foo) { int = 3, b =4 ,c = 12, d = 41; std::cout<<foo.method(a,b,c,d)<<std::endl; } }; and main function #include "mockedfoo...

vb.net - Returning subfolder names within dated folder -

Image
i'm trying pull list of directories sit inside dated folder structure. within each dated folder number of 'jobs' want return name of 1st level of folders the below code gets right level of folder detail result displays full path each dir string in system.io.directory.getdirectories("c:\working") dim dirinfo new system.io.directoryinfo(dir) each sdir string in system.io.directory.getdirectories(dirinfo.tostring) dim sdirinfo new system.io.directoryinfo(sdir) chkimpexp.items.add(sdir) next next this display following however display directory name right of 3rd backslash (westdale - 28023 - cash+spirit example) hopefully enough information. many thanks ' renamed dir d dir() function in microsoft.visualbasic each d in system.io.directory.getdirectories("c:\working") each sdir in system.io.directory.getdirectories(d) dim di = new directoryinfo(sdir) chkimpe...

actionscript 3 - Web socket & Flash socket clients connect to one Node.js -

i've got problem connecting flash client node.js server. short story : for first time i'm building node.js server should used both web client (websocket) flash client (socket). web client, of course, works charm, can't on flash one. security_error. after day of research think it's because of policy file not being loaded. ideas (primus on top of engine.io) ? long story : i'm using primus thought i'll need because have both web sockets , flash sockets handle. not sure if accurate? :) i'm using engine.io 'transformer/transporter' - main framework layer uses. won't discuss standard web client (using chrome , primus-client), it's easy setup. i'm using simple , standard sockets in as3: _socket = new socket(); _socket.addeventlistener(event.connect, onsocketconnect); //... _socket.addeventlistener(securityerrorevent.security_error, onsecurityerror); _socket.addeventlistener(ioerrorevent.io_error, onioerror); _socket.connect(...

c++ - How to create a lookup table -

basically i've realised way i've coded project need implement form of lookup table, have never done before , therefore don't know how , googling doesn't give clear set of instructions i need lookup table user can input function command line , pass in parameters function, no idea start i don't know requirements, imagine sth this: you might want have c++ function pointers . make own struct holds: name of function pointer function vector of variants (for example boost or write your own ) hold arguments validate function see if arguments , function pointer fit create each function user can call instance of struct. display user , let him choose. in second step, let him enter values arguments.

postgresql - Postgres and c3p0 invalid timezone error during connection -

i following error when trying connect standalone java application postgres: org.postgresql.util.psqlexception: fatal: invalid value parameter "timezone": "america/new_york" @ org.postgresql.core.v3.connectionfactoryimpl.readstartupmessages(connectionfactoryimpl.java 572) ... @ com.mchange.v2.c3p0.drivemanagerdatasource.getconnection(drivemanagerdatasource.java: 164) ... (sorry, have type in hand because of setup). i using postgres 9.3.3 postgis 2.1.1 extensions, postgres 9.3-1100 jdbc driver , 0.2.6.3 c3p0 library. i on both linux , windows systems. when changed tz gmt on linux system connection works, that's not solution. any idea con fix this? thanks, ken pavel horal had correct answer. postgres installation messed , root had access /usr/local/pgsql_933/share/timezone/america directory. once did chmod on , files in problem went away.

How to pass CLI options to heroku pg:psql? -

given heroku pg:psql works, connects database and $sql valid sql query when run heroku pg:psql -c $sql then expect see results of query and expect heroku exit status code of 0 instead, -c option ignored, $sql not executed, , interactive prompt shown. looks bug, sorry :-/ i've reported it. it appears pg:extras might culprit, , if didn't have that, may work. see here try heroku plugins:uninstall heroku-pg-extras there's work around - pipe command in: <<< "select count(*) features;" | heroku pg:psql -a appname -c -

css - Gradient background within a DIV has vertical tiling -

Image
i'm still getting head around use of gradients in css. reason, when try set gradient background main div, background appears odd vertical tiling. have tried combinations of background-repeat property, cannot seem fix this. here's full code div, there's plenty of commented lines i've tried different code snippets attempt fix - result in same tiling effect: #centralbox { border: 2px solid black; border-top: none; border-bottom: none; width: 980px; height: 100%; margin-left: auto; margin-right: auto; /*background-color: #91c1d1;*/ /*background-repeat: no-repeat;*/ /*background: -webkit-linear-gradient(top, #91c1d1, #91d1c1);*/ /*background: -webkit-linear-gradient(top left, #000000, #ffffff);*/ /*background: -webkit-background-size: auto;*/ background: -webkit-gradient(linear, left top, right bottom, color-stop(0, #ffffff), color-stop(1, #91c1d1)); } note, i'm using webkit until can hang of gradient properties, implement other browser support. this ho...

haskell - Recursive function of a list -

i'm little confused recursive function on haskell, can explain me better ? cut [] = ([],[]) cut (x:[]) = ([x],[]) cut (x:y:l) = let (xs,ys) = cut l in (x:xs,y:ys) p.s. : "let...in" part confusing me lot ! haskell let has following syntax: let <bindings> in <expression> so create bindings , use in expression. example: λ> let = 3 in + 3 6 the type of cut function cut :: [a] -> ([a], [a]) . so, function cut returns tuple of type ([a],[a]) , pattern matched in let expression of cut function. variable xs pattern matched first element of tuple i.e [a] , next variable ys pattern matched second element of tuple list.

How to automatically set a random string ID in Laravel when a user registers -

i set unique random string (str_random) user id automatically when user registered. where put code? 'id' => str_random(32); i thought should go in user.php (model). you in model: public static function boot() { parent::boot(); static::creating(function($table) { $table->id = str_random(32); }); }

javascript - Rendering coordinates on leaflet map view using ajax in ember -

[]i trying feed data (via ajax call json file) both handlebars template , leaflet map. current setup, data reaches handlebars template fine, doesn't render coordinates data leaflet map. suspect missing basic piece of ember.js puzzle. please advise me? html/handlebars templates: <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui"> <title>sbk_3.0.8</title> <link rel="stylesheet" href="css/leaflet.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <script type="text/x-handlebars" data-template-name="application"> {{outlet}} </script> <script type="text/x-handlebars" data-template-name="index"> {{view app.mapview id="map" contentbinding="this"}} ...

php - Is there any way to prevent users from seing private pictures using the absolute path? -

imagine situation user uploads picture see (picture public) user decides make picture private picture visible him, since picture set private on db. there problem this: the other users can still access picture absolute path. there way prevent this? store images outside web root, , have php script determines if current user has permission access it, returning image contents if or 403 forbidden error if not. you can make file look you're serving original image: http://example.com/images/sunnytrees.jpg use .htaccess : rewriteengine on rewriterule images/(.*) image.php?file=$1 [l] then image.php can be: <?php $file = $_get['file']; // use $file file information, eg. in database if( $it_exists && $has_permission_to_view) { readfile("/root/path/to/real/images/".$file); exit; } else header("http/1.1 403 forbidden");

javascript - Select2 blocks while images load into DOM -

i use select 2 show entries database have imageurl. my format-function dropdown items looks this: function formatdropdown(item) { var result = "<img src='" + item.mapimageurl + "'>&nbsp;" + item.name return result; } item.mapimageurl contains simple url image should displayed. now server takes second or 2 resolve images beiing displayed. unfortunately dropwdown blocks in time. i create select2 following code: stationselector.select2({ placeholder: 'choose station', allowclear: true, data: { results: stations, text: 'name' }, formatselection: formatdisplay, formatresult: formatdropdown, is there way make select not waiting / blocking till image loaded? nice, if use / open box without blocking , images appear afterwards. are there extensions deferred image loading? at least found solution. using style sets background, doesnt caus...

ipad - ios in-house deployment, as a developer, how-to deploy the same application for multiple enterprises (with same app ID and multiple account) -

i'm working in software editor company, , make application adobe air. until now, had deployed applications pc , android, now, have deploy application ios. the fact have developped 1 application, , deploy multiple enterprises make same job. franchised companies, same work, same application, not same companies legal point of view. today, asked our customer pay enterprise developper account apple (with them duns numbers), , add me admin member. => way if want deploy ios application made me, paid customer ? have ask customer pay every year enterprise account apple, can't deploy account? the real problem want use same application id deploy all. so, when want add app id on account, website tells me id used, that's normal, it's me company account ! but, how can deploy application has same app id multiple companies multiple enterprises developer account ? have deploy provisionning profile ? or can deploy certificate made account, , provisionning profile company ...

How to configure syslog for logging in Python -

i have started use logging module in python. python code logs via several handlers in code still use syslog module. when tried replace , add handler logging, found out output differs. logging.handlers.sysloghandler(address = "/dev/log") ... logging.error("foo") syslog.syslog(syslog.log_err, "foo") the output is: apr 14 16:42:33 hroch journal: foo apr 2 10:11:51 hroch myscript: unable connect/login fencing device attempt use logging.formatter did not bring success part after colon changed. the address= parameter sysloghandler() should (host, port) tuple. try leaving off; default ('localhost', syslog_udp_port) , might want.

c# - Exception using Rx and Await to accomplish reading file line by line async -

i learning use rx , tried sample. not fix exception happens in highlighted while statement - while(!f.endofstream) i want read huge file - line line - , every line of data - want processing in different thread (so used observeron) want whole thing async. want use readlineasync since returns task , can convert observables , subscribe it. i guess task thread create first, gets in between rx threads. if use observe , subscribe using currentthread, still cannot stop exception. wonder how accomplish neatly aysnc rx. wondering if whole thing done simpler ? static void main(string[] args) { rxwrapper.readfilewithrxasync(); console.writeline("this should called before file read begins"); console.readline(); } public static async task readfilewithrxasync() { task t = task.run(() => readfilewithrx()); await t; } public static void readfilewithrx() { string file = @"c:\filewithlonglist...