Posts

Showing posts from January, 2015

android - ListView inside ScrollView issue -

Image
i need make layout picture below. can see have user info area, review area , comments area. the entire layout should scrollable, because review should long, , review have lot of comments. also comments area listview, thought should use scrollview scroll layout, doesn't work listview. is there solution? here picture when use listview header , footer . do not ever use listview inside scrollview because listview contain functionality of scrolling. use fill_parent width , height automatically scroll. android:layout_width="fill_parent" android:layout_height="fill_parent" and scrolling whole layout can put review part inside header of listview

iphone - Parsing Json into array -

i have following json file, [ { "var1": { }, "var2": "exemple 1", "var3": data, "var4": data, "var5": data, "var6": [ { "var7": { }, "var8": 25, "var9": 0, "var10": 0 }, { "var7": { }, "var8": 12, "var9": 1, "var10": 0 }, { "var7": { }, "var8": 12, "var9": 2, "var10": 0 } ], "var11": 300, "var12": data, "var13": 1, "var14": data, "var15": data, "var16": 2, "var17": data, "var18": data }, ] i want store elements array access them all. should store every variable in array itself, , have ...

user interface - Latitude and Longitude standalone gui -

i've searched on web , here similar question unfortunately didn't found right answer. i make gui in python, or in c#, retrieve latitude , longitude on entire earth click, via link: http://www.itouchmap.com/latlong.html how can sort out this?

How to do a basic remote procedure call (RPC) in Telegram? -

i'm attempting create small program can demonstrate features of telegram api. wish able register , authenticate users via sms. according user authorization guide , need invoke auth.sendcode rpc. however, codebase inadequately documented , proving hard into. how send auth.sendcode remote procedure call in telegram? please provide code snippet shows starting set , initialization. try this... tlsentcode sentcode; try { sentcode = api.dorpccallnonauth(new tlrequestauthsendcode(phone, 0, 5, "your app id", "en")); } catch (rpcexception e) { if (e.geterrorcode() == 303) { int destdc; if (e.geterrortag().startswith("network_migrate_")) { destdc = integer.parseint(e.geterrortag().substring("network_migrate_".length())); } else if (e.geterrortag().startswith("phone_migrate_")) { destdc = integer.parseint(e.geterrortag().substring(...

wpf - Adding to ObservableCollection and ListViewCollection grouping -

i have observablecollection , i'm using listviewcollection provide grouping particular property, in case myproperty. the problem when add objects observablecollection grouping isn't updated in listview in ui until call .refresh() method on listcollectionview. see data in listview control, isn't grouping. i'm implementing inotifypropertychanged in stuff object. here example of code. observablecollection<stuff> mystuff = new observablecollection<stuff>(); mylistview.itemsource = mystuff; mylistcollectionview = (listcollectionview)collectionviewsource.getdefaultview(mylistview.itemssource); var groupdescription = new propertygroupdescription("myproperty"); mylistcollectionview .groupdescriptions.add(groupdescription); stuff newstuff = new stuff(); newstuff.myproperty = "group a"; mystuff.add(newstuff); // once added here, listview shows item, doesn't show correct grouping @ point anyone see may doing wrong. in advance po...

c# - What to pass as string argument to constructor? -

i have following situation: protected mobilewalletrequestbase(xmldocument xmldoc, string request) { _xmldoc = xmldoc; } protected mobilewalletrequestbase() : this(new xmldocument(), ?) { _xmldoc.loadxml("<?xml version=\"1.0\" encoding=\"utf-8\"?><request/>"); } what should write in second constructor in order pass string value? one approach use default argument: protected mobilewalletrequestbase(xmldocument xmldoc, string request="foo") { // you're not using request in here, unclear what's needed _xmldoc = xmldoc; } protected mobilewalletrequestbase() : this(new xmldocument()) // don't { _xmldoc.loadxml("<?xml version=\"1.0\" encoding=\"utf-8\"?><request/>"); }

Batch Delete with Entity Framework and Microsoft Azure -

i use entity framework 6.1, mvc5, asp.net 4.5 , azure websites (free) + azure sql. when try delete 45 000 entities, takes more 45 minutes. have navigation properties in entities. i tried : context.contacts.removerange(db.groups.find(id).contacts.tolist()); and : foreach(var contact in db.groups.find(id).contacts.tolist()) { context.database.executesqlcommand("delete contacts contactid = {0}", contact.contactid); } i'm sure it's not normal... causing problem ? when calling .tolist() pulling of entities memory start. , looping through these calling same piece of sql 45000 times if understand situation. you shouldn't need entire object returned delete it. suggest pulling out ids of contacts delete selecting id in query: var ids = db.groups.find(id).contacts.select(x => x.contactid).tolist(); i implementing either entityframeworkextensions library( https://github.com/loresoft/entityframework.extended ) handle (making sure batc...

c - Read failed with error msg "Invalid argument" -

i try read data 1 fd, failed error message"invalid argument!". struct inotify_event eventhdr; int head_read_len = (int)read(ctx->fd, (void *)&eventhdr, sizeof(inotify_event)); if(head_read_len == -1){ _debug("read eventhdr failed!!!!\n"); perror("read eventhdr!"); //print "invalid argument." } else{ _debug("read eventhdr succeed!!!!, head_read_len:%d, name:%s\n", head_read_len, eventhdr.name); lseek(ctx->fd, seek_cur, -head_read_len); } notes: the struct inotify_event used inotify system call, man inotify more details. fd guaranteed valid inotify file descriptor. what seems problem? valuable insights? the reason that: fd of inotify system call can not partially read.otherwise, return "invalid argument"! use buffer large enough bytes!

android - Setting up sale on Google Play with price below 0.99 USD -

Image
one of our apps (m-parking) has turned 2 years old week ago , developers reward our current users limited-time offer (1 month) of "premium license" (in-app payment item) sale 50% price discount. the in-app billing pricing pages say: you cannot set price of “0” (free) which leads 1 believe can set 0.01, reality different , same app pricing --> can't put price lower 0.99 usd (and equivalents in other currencies). proof: so, problem (at least many of us) know it possible because bought apps/games priced @ $0.49 , $0.25. the goal current "premium license" item price 8.89 sek (1.35 usd) , set price @ 4.49 sek (0.67 usd , equivalents) 1 month. is possible , how can achieve that? it's not possible developer set lower price on google play store. times you've seen cheaper prices when google has special sale, it's google select apps put on sale. other app stores have other price limits, may able publish apps on those. e...

c# - Main is a 'type' but is used like a 'variable' -

basically, attempted use code found stackoverflow associated colision detection wanted between pictureboxes. however, encounter error stating form name type used variable. code here: foreach (control picturebox in main) { if (player.bounds.intersectswith(picturebox.bounds)) { } } in foreach loop. underlining word main, stating these exact words: 'namespace.main' 'type' used 'variable' main class . can't iterate on class, have iterate on object. (in case), have iterate on collection of control objects. think maybe wanted: foreach (control picturebox in controls) here, i'm iterating on controls property of current object. assuming doing inside instance of main . otherwise, need reference form object , use: foreach (control picturebox in myformobject.controls)

iphone - Perform an action after user dismiss the app on iOS -

i want perform action, ten seconds after app goes background , in condition user didn't app during time. for doing so, using code: -(void)applicationdidenterbackground:(uiapplication *)application{ uibackgroundtaskidentifier __block bgtask = 0; uiapplication *app = [uiapplication sharedapplication]; bgtask = [app beginbackgroundtaskwithexpirationhandler:^{ [app endbackgroundtask:bgtask]; bgtask = uibackgroundtaskinvalid; }]; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ [self checksession]; }); } -(void)checksession{ sleep(10); if([[uiapplication sharedapplication] applicationstate] != uiapplicationstateactive) { nslog(@"do action after 10 seconds"); } else{ nslog(@"do nothing after 10 seconds"); } } the problem if user terminate app while in background (by swipe , dismiss it) , before 10 seco...

EXCEL: Need cross dependence on cells to work a simple formula -

essentially need type number cell a1 , have reflect cell b , c. type b , have reflect , c. , type c , have reflect , b. (obviously can't depend on each other automatically, have send info other 2 cells after completing manual entry of value in either of 3 cells.) case: a1=1 , b2=60 , c1=3600 respectively - hours, minutes, seconds. what need type 5400 c1 , end 90 in b1, , 1.5 in a1. after if type 2 in a1, end 120 in b1 , 7200 in c1. etc. thx in advance. (don't know if need vba) btw know of spreadsheet web service doesn't have downloads, annoying registrations etc. have been alot faster if linked here, people don't need login , register see example... here's solution future reference. kudos ragulduy it. private sub worksheet_change(byval target range) if not intersect(target, range("a1:c1")) nothing application.enableevents = false if target.address = "$a$1" range("b1") = range("a1...

Why PHP continue to output to CSV file after fclose()? -

on web page, writing data csv file using below code , closing fclose(); header('content-type: text/csv; charset=utf-8'); header('content-disposition: attachment; filename='.$filename); $out = fopen('php://output', 'w'); fputcsv($out, $cvs_cols); fclose($out); echo "hello world"; // sneaks csv!? why "hello world" gets csv download file when has fclose()? want output rest of html page displayed in browser. how can that? after 1 http request follows 1 response. cannot send content type text/csv , content type text/html @ same time (maybe yes spdy , not pure http). fclose closes file descriptor not output browser. you should set content-length header , put in filesize. mark baker gave important point in comments: echo , writing php://output puts content same stream: stdout . other options write csv memory (but senseless if don't use it) or file. read more streams: http://www.php.net/manual/en/features.co...

javascript - error callback function is fired even if request is successful -

i have script uses ajax send mail. have tested checking email receive mail , true enough, ajax request successful. checked console window of firefox browser , shows me successful message. problem here instead of done callback function, error callback function fired. may wonder why i'm still using error function instead of fail . reason because when tried using fail function, doesn't trigger alertbox have set inside it. did go , use error function again since @ least triggers alertbox made. here script: <script type="text/javascript"> var submitbutton = $('#submit'); // variable cache button element var alertbox1 = $('.success'); // variable cache meter element var alertbox2 = $('.alert'); var closebutton1 = $('.close1'); // variable cache close button element var closebutton2 = $('.close2'); // variable cache close button elemen...

Android Displaying Version Name on Splash Screen Using Gradle -

i developing android app using splash screen. i want display app's version name @ bottom of layout, using gradle , version name/version code isn't in manifest.xml file, in build.gradle file. how can access version code? i'm guessing want programmatically? packageinfo package = getpackagemanager().getpackageinfo(getpackagename(), 0); version = package.versionname; versioncode = package.versioncode;

LDAP in PHP code "Can't contact LDAP server" in windows server -

i have problem in connecting ldap windows server using php. codes below: <?php $ldaprdn = 'myusername'; // ldap rdn or dn $ldappass = 'mypassword'; // connect ldap server $ldapconn = ldap_connect("ldap://mydomain") or die("could not connect ldap server."); ldap_set_option($ldapconn, ldap_opt_protocol_version, 3); ldap_set_option($ldapconn, ldap_opt_referrals, 0); if ($ldapconn) { var_dump(ldap_bind($ldapconn, $ldaprdn, $ldappass)); if ($ldapbind) { echo "ldap bind successful..."; } else { echo ldap_error($ldapconn); echo "ldap bind failed..."; } } ?> i "can't contact ldap server" error message. if used .net application using same username, password, , domain, connection made successfully. doing wrong in codes or perhaps configuration should made?

concurrent.futures - Scala Future does not return anything when allocating too much memory -

using scala-ide 3.0.3 (based on scala 2.10.4), following code completes correctly displaying first 10 values of computed list future future completed message: import scala.concurrent._ import scala.concurrent.duration._ import scala.util.{failure, success} import executioncontext.implicits.global object futurenonblocking extends app { val f1: future[list[int]] = future { val t = list.range(1, 50).filter(_ % 2 == 0) println("done") t } f1.oncomplete { case success(value) => println(value.take(10)) case failure(e) => println("something bad happened") } await.complete(f1, 30 seconds) } however, changing range list.range(1, 50) list.range(1, 5000) not display , (the failure not triggered). logically, seems related memory issue don't understand happening there. even stranger, running code in repl not cause issue. missing there? it turns out whole thing not issue memory manage...

Why does Qt not work with dll injection? -

i working on program extract text messages third party program, dont have enter tooltip text manually in excel sheets. using dll injection , have hooked microsoft's textoutw function. program gives me messages want. hook successful. now, want put "cloths" (a gui) on program , have decided go qt. designed gui , have put dll engine gui. after have done this, tried out program, program not hook anymore. dll hook code , else same, except in qt environment now. i suspected unicode/multibyte problem, after have set original "non-qt" code unicode , reinserted piece of code qt project, still not work. i have done research in internet, interesting source said have use qwidget::winid, have tried , still nothing works. there no error message, no console output whatsoever... i kinda stuck @ problem hours now... hope guys can me! jonathan

ruby - shift the binding of block with args -

i'm learning ruby writing simple dsl. dsl used support event sourcing block. class coupon include aggregateroot attr_reader :status on :couponapprovedevent |event| #want update @status of coupon instance #but binding coupon class @status = 'approved' end #other instance methods of coupon end the "on" methods of coupon maps block given event, used reconstitute aggregate. defined in module aggregateroot: module aggregateroot attr_reader :events def handle event operation = self.class.event_handlers[event.class.name.to_sym] operation.call event end def self.included(clazz) clazz.class_eval @event_handlers = {} def self.on event_clazz, &operation @event_handlers[event_clazz] = operation end def self.event_handlers @event_handlers end end end end but following...

apache - Plone taking a long time to respond to byte-range request -

we have 2 upgraded plone 4.3.2 instances behind haproxy load balancer behind apache. we limit each plone instance serving 2 concurrent requests using haproxy configuration. we encountered issue whereby client sent 4 byte-range requests in quick succession pdf each took between 6 , 8 minutes response. locked available requests 6 minutes , haproxy timed out other requests in queue. pdf stored atfile object in plone believe should have been migrated blob storage in our recent upgrade. my question steps should take prevent similar scenario in future? i'm interested in: how debug why byte-range requests on otherwise lightly loaded server should take long respond how plone.app.blob deals byte-range requests is possible configure apache such byte-range requests served cache not back-end server as requested here haproxy.cfg superfluous configuration stripped out. global maxconn 450 spread-checks 3 defaults log /dev/log local0 m...

c++ - Storing char pointers then fill it later on -

i'm having small issue here, i'm storing char pointer ( rather array ), in void pointer following: char result[255]; cevariable result_var(cetype::string, result); now result_var passed on engine, stored pointer, variable structure accessed later on: ( m_pdata void*, pointing char array ) strcpy((char*)pvar->m_pdata, "42"); but no data written it, , i'm sure points result array, checked addresses. maybe have gotten wrong in understanding of void pointers, following seems work: ( testing ) char dest[255]; void*ptr = dest; strcpy((char*)ptr, "asdsa"); std::cout << dest; the result array turns unreadable format, random memory. maybe never written to. question may issue be? edit: cevariable:: class cevariable { public: cevariable() {} cevariable(cetype t, void* mem) { m_type = t; m_pdata = mem; } // variable type cetype m_type; // variable data ptr void* m_pdata; }...

android - Keep BroadcastReceiver on configuration change -

i'm perhaps thinking wrong... i'm using background service in application track location updates frequently. since there exists possibility location client can disconnect or connection can fail have in these methods (in service) implemented intent broadcast message new intent(broadcast_connection_failed); when received app can take appropriate actions (like update gui tracking turned off , on) so i've done far register connection failed receiver inside activity when gps service turned on, not unregister when app goes background (since want receive broadcasts in background). creates problem me because whenever configuration changed (screen rotating etc.) try register connection failed receiver again (and since it's registered) throw exception ( activity com.bla.bla.mainactivity has leaked intentreceiver... ) so regarding how should elegantly solve this?

Excel: Save as csv via vba and manually results in a different file -

Image
i need save several xlsm files csv in order import them in other programs (such r etc.). i've written necessary import routines in other programs , work nicely case 1: case 1: manually saving xlsm csv if use option , manually save each file csv , click yes on prompts, .csv file looks similar normal excel file when opened again within excel. standard column view, , nothing comma separated etc. (maybe is, doesn't way..) case 2: saving xlsm vba csv here different file when opened again in excel. 1 looks "real" csv file values being comma separated. my questions are: 1. why there difference? 2. how can programmatically reach case 2 vba? or impossible? if 2 impossible have rewrite import code routines handle "normal" csv file...not difficult still lot of work , i'm wondering why there difference.. q1: don't think there difference, @ least not in example pulled together. q2: try out: i've got 3 example xlsm files in c:\stack\...

c# - Edit specific item from list -

i ask how can edit item collection. example: in collection mylist (string name, datetime event). make event moved next year. i tried: public class classevent { public string name { get; set; } public datetime date { get; set; } public classevent(string name, datetime date) { name = name; date = date; } myclass: public list<classevent> event= new list<classevent>(); public void addevent(string name, datetime myevent) { classevent ev = new classevent(name, myevent.date); event.add(ev); } mainform: forach( var in myclass.event) { if(a.myevent == datetime.today) { myclass.addevent(a.name, a.myevent.addyears(1); } but doesnt work. you can't modify collection within foreach loop. use for loop isntead: to add new items collection: // pay attention: backward loop for(int = myclass.event.count - 1; >= 0; --i) { ...

ios - Parse the Anchor tags and the content using NSXMLParse -

i want parse html tags inside "comparison" node <comparison> <a href="/cgi-bin/amazon.cgi?b0050amjyu">amazon.com</a> ($34.36) | <a href="/cgi-bin/walmart.cgi?16904483">walmart.com</a> ($34.36) | <a href="/cgi-bin/rakuten.cgi?219782579">rakuten.com</a> ($34.36) | <a href="/cgi-bin/bestbuy1.cgi?mp1307815397">bestbuy.com</a> ($34.36) </comparison> the o\p getting is bestbuy.com ($34.36) the expected o\p amazon.com ($34.36) walmart.com ($34.36) rakuten.com ($34.36) bestbuy.com ($34.36) but want display 4 items. please help. code - (void)parser:(nsxmlparser *)parser didstartelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qualifiedname attributes:(nsdictionary *)attributedict { currentelementvalue = [nsmutablestring string]; [uiapplication sharedapplication].networkactivi...

Android youtube Api skip video -

i working android youtube api.i create youtube api project.i can play video youtube api.now want skip video in button click.i wrote code witch can skip video ,but when click in button have bed result.youtubeplayerview loading twice. code public class mainactivity extends youtubebaseactivity implements youtubeplayer.oninitializedlistener { static private final string developer_key = "***********"; private string video = "*******"; private button b1; private youtubeplayer player1; public int endtime = 65000; private playerstyle style; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); youtubeplayerview youtubeview = (youtubeplayerview) findviewbyid(r.id.youtube_view); b1 = (button) findviewbyid(r.id.button1); youtubeview.initialize(developer_key, this); youtubeview.setenabled(false); style = playerstyle.chromeless; b1.setonclicklistener(...

asp.net - How to rdirect to some another page on another website using IIS 7? -

i have website used number of users, when tried update new changes has downtime. want display page hosted on other server or domain using iis settings, possible. know can using app_offline.htm page, don't want use manual process. there setting on iis using can redirect website page when website suffering downtime. a possible solution have iis site configured on same server, bound same domain , port. site stopped. when want maintenance can stop main site , start site instead. but awkward workaround functionality available in using app_offline.htm.

java - How to name resource file in android other than english -

i want name resource file レオウ.png (japanese). however, there error when loading resource. wonder if there way can that. all resources id'd r.java. r.java must conform programming nomenclature standards because, well, it's java source code. resource name violates because identifiers can composed of _, a..z, a..z , 0..9 characters (and can't start digit). wouldn't create variable japanese kanji name, likewise can't resource file, because need access through r.java (r.drawable.xxx).

hyperlink - How to give link to Second (Particular) page from all pages in MS Word? -

i have table of contents on page number 2 , want give link same page pages of document, if created link in footer, not click-able. so should done? the following seems work here: insert bookmark on page want link (or use bookmark there). let's called "xyz" insert text box in footer. insert following field code { pageref xyz \h } where { } special field code braces can insert using ctrl-f9 on windows word. strange! only checked in word 2010.

javascript - BackboneJS Significance of Model/Collection urlRoot/URL -

let's have person model/collection below; define([ 'base/basemodel' ], function(basemodel) { var person = basemodel.extend({ idattribute: "personid", urlroot: "manapp/person/", defaults: { "personid": null } return person; }); define([ 'base/basecollection', 'model/person' ], function(basecollection, person) { var personcollection = basecollection.extend({ url: "manapp/person", model: person }); return personcollection; }); as can see, have urlroot/url attribute in model/collection. my question significance of specifying values attribute? corresponding rest resource? if yes, operation ? when use model , collection them ? the urlroot , url define server paths request sent. edit: backbone docs: url: returns relative url model's resource located on server. if models located somewhere else, overr...

what is Yii::app() in php framework yii -

i new yii. want know yii::app() . searched it, not able understand exactly. please read information link.you understand it. yii documentation

c# - How to use Time Trigger in background task in Windows 8 JS Metro App -

i have requirement have call service in background after every let 1 hour informations server. working on javascript metro application. have tried background task , used time trigger , have scheduled triggered in every 15 minutes. called first time , never called. didn't close background task because want run time , call service @ scheduled time. have used microsoft background task sample reference. please tell me should best approach call service in background. how use time trigger , why time trigger doesn't called after first time? please share code sample or walkthrough if any. thanks first thing should close background task instructed in documentation - if tasks don't behave nicely, platform might suspend , refuse run them time. should let platform handle triggering of events based on triggers , conditions define instead of trying bend system. also, remember there's cpu , data usage quotas background tasks present, 1 can't massive amount of p...

ios - Constrained Based Layout Issue -

for life of me, can't figure 1 out. using auto layout in story board , works fine, when ignore error. layout shows no warnings or errors, still error. i've studied , guess can't read enough tell me conflicting.... any here appreciated.. ( "<nslayoutconstraint:0xac58860 v:[uibutton:0xac579c0(22)]>", "<nslayoutconstraint:0x9df1030 v:[uiview:0xfc9eb70(1)]>", "<nslayoutconstraint:0x9df17b0 v:[uiview:0xfc9e470(22)]>", "<nslayoutconstraint:0x9df0810 v:|-(0)-[uibutton:0xac579c0] (names: '|':uiview:0xfc9e470 )>", "<nslayoutconstraint:0x9df05e0 v:[uibutton:0xac579c0]-(0)-[uiview:0xfc9eb70]>", "<nslayoutconstraint:0x9df00c0 v:[uiview:0xfc9eb70]-(0)-[uitableview:0xdb1aa00]>", "<nslayoutconstraint:0x9defc60 v:[uitableview:0xdb1aa00]-(0)-| (names: '|':uiview:0xfc9e470 )>" ) attempt recover breaking constraint <n...

c# - How to link parent and child ids? -

i have following table pnlparentid id operator 12 13 * 12 14 * 12 15 * 20 1 - 20 2 - 13 21 / 13 20 / i have created foreach loop rows , add dataset.then dataset ones children...but lost of how link them ?? string dbconnection = "data source=test;initial catalog=test;integrated security=sspi;"; string mycommand = "select pnlparentid , operator [test].[dbo].[dimpnl] group pnlparentid,operator"; dataset ds = getdataset(mycommand, dbconnection); using (sqlconnection connection = new sqlconnection(dbconnection)) { connection.open(); using (sqlcommand command = new sqlcommand(mycommand, connection)) { dataset ds1 = new dataset(); datatable dt = new datatable(); sqldataadapter da = new sqldataadapter(command); da.fill(ds1, "test"); dt = ds1.tables["test...

How to change a line chart series's color according to the the point's value in Kendo UI? -

for example,i have series have 5 points , values 5,10,15,20,25,now want change color of part series contains point1(value:5) point2(value:10) red,and want change color of part series contains point2(value:10) point2(value:15) green,and on,how that?now can change color of whole series,but not know how change part of series according value? change whole series function ondatabound(e) { e.sender.options.series[0].color= "red"; } just example,i can change color of point,but can not change line between start point , end point. my example the color option of series can set function called during rendering. here short demo: <div id="chart"></div> <script> $("#chart").kendochart({ series: [{ data: [1, 2], color: function(point) { if (point.value > 1) { return "red"; } // use default series theme color } }] });

asp.net - How to redirect extension less URL using HttpHandlers/ HttpModules -

i want add dynamic routing or redirect website 1 can utilize multiple url same page. want implement dynamically same using global.asax, not able find regarding same topic. below sample url , dummy table structure data holds multiple url same page. can add dynamically routes global.asax file suppose if have multiple routes same page example http://website.com/about http://website.com/en/about http://website.com/en/about-us while actual url page http://website.com/en/about-us . my question is: there way can dynamically define these routes in global.asax file in such way reads url entered users http://website.com/about , compares database table , redirects correct page http://website.com/en/about-us ? if option a not possible how can achieve same using httphandlers/httpmodules . this link show configuration of httphandlers not actual code handler taking consideration following table structure: id url_name url actual_url ...

visual studio 2010 - MVC3 EF5 query plan caching -

i have mvc3 project target framework 4.0. developing under vs2010. have .net 4.5 installed of machine. i read ef4 , dbcontext not support compiled query , query plan caching. so changed referenced library ef4 ef5, because version caches query default , still using mvc3 , vs2010. in vs2010 cannot set target framework 4.5 web project. so question is: how can determine, if ef5 in mvc3 caches linq queries? there static class, contains these queries or? answer is, .net 4.0 ef4.4 not support autocompiled queries. visit msdn forum post

php - Facing issue with Twitter API due to LIMITs -

i using twitter api fetch tweets based on hash tag. cron job runs every 1 minute. in each run of cron job, there lots of requests sent twitter fetch tweets containing hash tag (these hash tags saved database , can added more our application. each time these hash tags fetched database , based on these hash tags requests being made twitter api.) now issue when number of requests reached limit window (15 minutes window), api sends error message “rate limit exceed”. , window, no requests possible. i don’t want let stop working. there other apis type of real time application can use? or other solution there?

java - spring transaction not working? -

hi try develop spring , hibernate app transactions , using spring 4.x , hibernate 4.x , here code snippet applicationcontext.xml <tx:annotation-driven /> <context:annotation-config /> <context:component-scan base-package="com.xyx.service" /> <context:component-scan base-package="com.xyz.dao" /> <import resource="conf/spring/persistence.xml" /> servlet-context.xml <context:component-scan base-package="com.xyx.webservice.components" /> <mvc:annotation-driven /> <bean id="jsonmessageconverter" class="org.springframework.http.converter.json.mappingjackson2httpmessageconverter"> </bean> <!-- configure plugin json request , response in method handler --> <bean class="org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter"> <property name="messageconverters...

cordova - Images take a long time to load phonegap application on iOS -

i'm loading set of thumbnails list in phonegap application dynamically. function use load images: var getuserimage = function(src) { // render users profile image var $profileimage; if ( typeof src ==='undefined' || src === 'placeholder.jpg' || src === '') { // avoid hitting server $profileimage = $('<img />', { class: 'profile-image responsive-image', src: 'img/placeholder.png' }); } else { var imgsrc = $.app.config.imagepath + src + '?width=200&height=200&crop=auto'; $profileimage = $('<img />', { class: 'profile-image responsive-image', src: imgsrc }).one('error', onimageloaderror); } return $profileimage; }; i modified else statement console.log on images load event. images (each around 10-15kb) take on minute load! isn't server issue, works absolu...

jquery - Why Input having blank Values? While Printing HTML -

this html <form action="" method="post" id="form"> <div id="jj"> <input type="text" value=""/> <input type="text" value=""/> <input type="text" value=""/> <input type="text" value=""/> </div> <input type="submit" value="submit"> </form> i have send html of jj id div page create pdf using https://code.google.com/p/dompdf/ my jquery code : $('#form').submit(function(){ //$('#textarea').val($('#jj').html()); console.log($('#jj').html()); return false; }); every time when fill input , click on submit. console having html of blank input values. why????? want values of input also. console output: <input type="text" value=""> <input type="text" value=""> <input type=...

asp.net - Webmethod error with Jquery Ajax post function -

in asp.net 3.5 website, have jquery located in aspx page should execute function in code-behind. have used webmethod approach. here error: system.argumentexception: unknown web method cloneitem. parameter name: methodname here relevant code: aspx page relevant part of jquery: <%@ page language="vb" masterpagefile="~/pages/masterpage.master" title="planning" %> <%@ register tagprefix="pwc" namespace="pwc" %> <asp:content id="content1" contentplaceholderid="contentplaceholder1" runat="server"> <pwc:planning runat="server" skinfilename="core/planning.ascx" id="planning" secured="true"/> $("#dialog-form").dialog({ autoopen: false, height: 300, width: 350, modal: true, buttons: { "create clone": function () { var cloneitem = $('inpu...

user interface - python- using delay between tkinter's listbox prints -

all want make time delay between each print on listbox included on gui . havent managed result far. tried use time.sleep () ... , after method. here code : from tkinter import * def func() : = int (e.get()) x in range (0,i): listbox.insert (end, i) i-=1 master = tk() master.title("hi") e=entry (master ) e.pack() listbox = listbox(master) listbox.pack() b = button(master, text="get", width=10, command=func) b.pack() mainloop() when you're using gui, should use after instead of sleep. if sleep, gui stop updating, won't refreshed displays , nothing work want to. to desired result in code, have several options. 1 of them using after call function inserts listbox , pass new argument each iteration. first, you'll have modify button command pass initial argument function using lambda expression: b = button(master, text="get", width=10, command=lambda: func(int(e.get()))) next, structure funct...

Camel + Java DSL Fluent builder with real ActiveMQ Broker -

i'm trying implement wiretap java dsl fluent builders , gives following example code snippet. from("direct:start") .to("log:foo") .wiretap("direct:tap") .to("mock:result"); this works if run mock example (e.g. camel-example-jms-file). if take sample code , try substitute real broker instance , queue replace mock objects fails error below. from("tcp://localhost:61616") .to("ativemq:atsupdatequeue") .wiretap("activemq:fdmcapturequeue"); then fails org.apache.camel.failedtocreaterouteexception: failed create route route2: route(route2)[[from[tcp://localhost:61616?queue=atsupdateque... because of failed resolve endpoint: tcp://localhost:61616?queue=atsupdatequeue due to: no component found scheme: tcp i've googled extensively , example i've found use virtual mock queues none seem illustrate working real broker , cannot find documentation on uri specification camel. the important par...

Update View with updated data in Android -

i noob in android. suppose have 2 activity in android app. activity , b, on activity on click on 1 button activity b . here activity b want update view updated data in activity a. got updated data in activity b should use here localbroadcastreceiver or ?? when press app should show me updated data in activity a should use our custom callback here update ui view data of activity activity b ?? no, shouldn't use broadcastreceiver that. method depends on size of data want transfer activity b activity a . if it's quite small, can start activity b startactivityforresult , data @ onactivityresult method (in activity b should use setresult once done). if size of data quite big, it's better use db storing instead of keeping in memory.

When can copy elision occur in c++ (apart from RVO and NRVO) -

i understand copy elision can occur in cases other when returning function. i'm not able find evidence of it. can give example of when copy elision occur? i've tried following, none of 3 copies optimised out class mystring { public: mystring(const char* str) : mystr(str) { } mystring(const mystring& str) : mystr(str.mystr) { } std::string mystr; }; class myclass { public: myclass(mystring str) : mystring(str) {} mystring mystring; }; int main() { mystring test("hello"); std::cout << myclass(test).mystring.mystr << std::endl; return 0; }

controller - How I can get the tuples in tables N to N in laravel? -

Image
i have following data model a technician can have many services , service can have many technical tecnico model class tecnico extends eloquent{ protected $table = 'tecnico'; protected $fillable = array('auth_token'); public function servicios(){ return $this->belongstomany('servicio', 'servicio_tecnico', 'idtecnico', 'idservicio'); } } servicio model class servicio extends eloquent{ protected $table = 'servicio'; public function detalleservicio(){ return $this->hasone('detalle_servicio', 'iddetalle_servicio'); } public function tecnicos(){ return $this->belongstomany('tecnico', 'servicio_tecnico', 'idservicio', 'idtecnico'); } } i'm trying services of particular technician according "auth_token" serviciocontroller class serviciocontroller extends basecontroller{ public function obtenerservicios($auth){ if($auth != ...

Stata: Reshaping dataset – bringing variable labels to variable values -

i have dataset containing different product values generated in each simulation, following layout: +------------+-------+-------+-------+ | simulation | v1 | v2 | v3 | +------------+-------+-------+-------+ | 1 | 0,500 | 0,400 | 0,300 | | 2 | 0,900 | 0,800 | 0,800 | | 3 | 0,100 | 0,200 | 0,300 | +------------+-------+-------+-------+ the variable names v1, v2, v3 labelled product ids , not displayed @ header of dataset. need reshape dataset long format this: +------------+----+----------+-------+ | simulation | id | label | value | +------------+----+----------+-------+ | 1 | v1 | 01020304 | 0,500 | | 1 | v2 | 01020305 | 0,400 | | 1 | v3 | 01020306 | 0,300 | | 2 | v1 | 01020304 | 0,900 | | 2 | v2 | 01020305 | 0,800 | | 2 | v3 | 01020306 | 0,800 | | 3 | v1 | 01020304 | 0,100 | | 3 | v2 | 01020305 | 0,200 | | 3 | v3 | 01020306 | 0,300 | +------------+----+----...

wordpress - Woocommerce: Changing the "# in stock" text -

i need change " # in stock " text " # deals left ". i added following code function.php file removes actual number. add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2); function custom_get_availability( $availability, $_product ) { //change text "in stock' 'special order' if ( $_product->is_in_stock() ) $availability['availability'] = __('spots left', 'woocommerce'); //change text "out of stock' 'sold out' if ( !$_product->is_in_stock() ) $availability['availability'] = __('sold out', 'woocommerce'); return $availability; } can this? you can try below code: add_filter( 'woocommerce_get_availability', 'custom_get_availability', 1, 2); function custom_get_availability( $availability, $_product ) { global $product; $stock = $product->get_total_stock(); if ( $_product->is_in_stock() ) $a...

javascript - Angularjs, How to destroy partials even using back button from browser? -

i have a,b,c partials in angular. start using page b , , b c. staying @ c, want destroy a, b, c partials (maybe using logout function or similar) if want return using button b or keeping pressing button navigate directly a, how control situation , else? (for example redirect page). someone knows how it? thanks in advance. if have controller each partial can use $destroy, event triggred angular whenever controllers scope destroyed $destroy() removes current scope (and of children) parent scope. removal implies calls $digest() no longer propagate current scope , children. removal implies current scope eligible garbage collection. the $destroy() used directives such ngrepeat managing unrolling of loop. just before scope destroyed $destroy event broadcasted on scope. application code can register $destroy event handler give chance perform necessary cleanup. below example on how use it ctrl.directive('handledestroy', function(...

if statement - SQL checking if value exists through multiple different tables -

lets have unique 23-digit identifier of file. check whether identifier present in of columns of rows in given tables. these tables different columns. is there select me achieve this? example scenario can this: fileid = 534bde4c322755995941083 tablea (columna, columnb, columnc) tableb (columnd) tablec (columne, columnf) i return record contain unique identifier , nothing more it. number of tables various columns. is there sql statement me this? i can iterate through records, columns, , tables seems huge overkill such task. you can use unpivot ... select vals tablea unpivot( vals n in (columna, columnb, columnc) ) vals = '534bde4c322755995941083' union select columnd tableb columnd = '534bde4c322755995941083' union select vals tablec c unpivot( vals n in (columne, columnf) ) vals = '534bde4c322755995941083'

javascript - firebase simple login tutorial missing user -

tutorial: http://www.thinkster.io/angularjs/wbhtrlwhir/6-authenticating-users-with-a-service i'm following tutorial , seems i'm losing user register. here auth.js factory: 'use strict'; app.factory('auth', function($firebasesimplelogin, firebase_url, $rootscope){ var ref = new firebase(firebase_url); var auth = $firebasesimplelogin(ref); var auth = { register : function(user) { return auth.$createuser(user.email, user.password); }, signedin : function() { // problem: authuser null console.log(auth.user); return auth.user !== null; }, logout : function () { auth.$logout(); } }; $rootscope.signedin = function () { return auth.signedin(); }; return auth; }); here auth.js controller: 'use strict'; app.controller('authctrl', function($scope, $location, auth){ if (auth.signedin()) { ...

java - How to make Lucene search faster? -

all. have 12 large indexes, , each bigger 20gb. application trying make instance of indexsearcher search every request of user. because user can select index wants search. performance of application very bad. user should wait 5 minutes 1 search. application shows 50 documents per page. , of course repeat 50 times retrieve data show using 'for statement'. performance test, i've tried search using matchalldocsquery, , takes 10 seconds, find 7,598,870 documents. i can't know why application slow. after many times googling... i've read document says making instance of indexsearcher costly. if merge indexes, 317gb after merge, , using 1 indexsearcher instance search w/ filter, faster before? please me. can't test freely because application on customer's intranet. sorry english. you won't more general advice listed in official wiki . however, answer point costly index searcher - searcher cheap, indexreader expensive. you potentially c...

Java Reflection getDeclaredMethod(...) Returning Null -

i have imported qualified name of class , created instance of class. proceeded acquire private method name of class: invokecallwebservice invokecallwebservice = new invokecallwebservice(); method method = null; try { method = invokecallwebservice.getclass().getdeclaredmethod("fully qualified class name.geturl", string.class); } catch (securityexception e) { system.out.println(e.getcause()); } catch (nosuchmethodexception e) { system.out.println(e.getcause()); } system.out.println(method.getname()); an exception thrown because method null. not sure reason class exists in different project , package or because need specify second argument many times there parameters in method. can invoke on private method? here stack trace: java.lang.nosuchmethodexception: invokecallwebservice.geturl(java.lang.string) @ java.lang.class.getdeclaredmethod(class.java:1937) @ com.geico.debug.debug.main(debug.java:39) you have class first, , class, metho...

pattern matching - scala Nil type matchs against arraybuffer -

i found strange working construct in scala: (arraybuffer[int]():seq[int]) match { case nil => "whoo" case _ => "nayyy" } which returns "whoo" apparently works partially for vectors , not pattern matching. can explain me that? nil does not have method named unapply . how possible? with objects, unapply not involved (that case if had used hypothetical case nil() => ... ). instead, equality checked using equals method. equality collections defined in terms of elements. e.g. list(1,2,3) == vector(1,2,3) // true! the same happens nil equals empty sequence: vector() == nil // true collection.mutable.arraybuffer() == nil // true

delphi - Rave - Print band at the bottom of the page -

i recreated report (which made quickreports) in rave project. quickreport had band on , band had aligntobottom property set true makes band print @ bottom of page. how same effect using rave? i tend use databand , set position absolute measure how many cm down page. not ideal different paper sizes etc works in "controlled setting". make sure region stops above space allowed footer band or details band may overlap absolutely positioned band

Cloud Services in the New Azure Preview Portal (April 2014) -

in new azure portal preview (april 2014), cannot find existing cloud services can see in old portal. in new browse menu there list of elements such databases, websites ... etc. .. no cloud services. cloud services? thank answer. cloud services not yet enabled in new portal. today limited set of features available while portal still in developer preview phase, expect see additional azure features being enabled soon. see http://azure.microsoft.com/en-us/documentation/preview-portal/ information features available today, or http://channel9.msdn.com/blogs/windows-azure/azure-preview-portal walkthrough.

How do I create views of objects in Entity Framework 6? -

let's suppose following tables: tablea tableaid int, pk, non-null name varchar(50), non-null tableb tablebid int, pk, non-null name varchar(50), non-null tableatotableb tableatotablebid int, pk, non-null tableaid int, fk, non-null tablebid int, fk, non-null then let's wanted view bind display: select a.tableaid, a.name, count(*) countoftableatotablebid tablea inner join tableatotableb ab on a.tableaid = ab.tableaid group a.tableaid, a.name what easiest way retrieve views in entity framework it's easy each row returned still tablea object? should return in 1 query database well. basically want return tablea object additional columns display purposes, internally should still accessed tablea object. hope makes sense. i'm struggling how entity framework attempts deal complex views of multiple objects in efficient , easy manage way.

c# - CMD closes after a second -

so after pressing "launch" button, cmd opens , closes right after second or so. can see, i'm trying open .exe file through cmd parameter line. works when manually, when put c#... system.diagnostics.processstartinfo proc = new system.diagnostics.processstartinfo(); string host = textbox1.text; string fp = textbox2.text; string port = textbox4.text; string time = textbox5.text; string threads = textbox3.text; string type = "get"; string param = string.format( " /c {0} start c:/dos.exe " + host + port + fp + time + threads + type, environment.newline); system.diagnostics.process.start("cmd.exe", param).waitforexit(); use console.read() @ end cmd waits key pressed before closes

javascript - Using range slider to change div height -

seen examples using range input control rotation of div javascript, cant see how change other properties such height , opacity. here example: function rotate(value) { x=document.getelementbyid('div1') x.style.webkittransform="rotate(" + value + "deg)"; } <input type="range" min="0" max="360" value="0" onchange="rotate(this.value)"> thanks help. for more generalized solution, can create generic setstyleon method. jsfiddle js: function setstyleon(rule, targetid, value) { x = document.getelementbyid(targetid); x.style[rule] = value; } html: <label>rotation</label> <input type="range" min="0" max="360" value="0" onchange="setstyleon('webkittransform', 'div1', 'rotate(' + this.value + 'deg')"> <label>opacity</label> <input type='range' min='0...