Posts

Showing posts from September, 2010

multithreading - Long running background thread causes HTTP request to timeout -

i have spring 3.0 webmvc application running on tomcat 7. on application startup kick off background thread load in-memory cache records db. thread typically takes on hour load data db. in same application have @controller annotated class exposes rest interface clients can objects loaded cache. one of our requirements rest requests made prior data load being finished return service_unavailable (503) http code client immediately. accomplish set simple check of boolean flag each request method in controller makes before doing work. if value false method should return 503 code. loader thread set flag true once completed load allow request methods function normally. the problem background thread seems causing http requests sent controller timeout after 30 seconds instead of hitting flag , returning 503 code client. i'm not expert in tomcat threading issues , wonder if i'm doing wrong when creating long running background thread? using "implements runnable" method

How to populate a textbox in vb.net -

i have gridview contais textbox in row 0. i able read textbox 2 instructions: dim control control = gridview.rows(0).findcontrol("textbox") dim valueintextbox textbox = ctype(cntrol, textbox) my question is, how can send data textbox, example sent letter "a" textbox?. suggestion? i using line try populate textbox textbox disappear: gridview.rows(0).cells(0).text = "a" thanks. you can set text using following lines: dim control control = gridview.rows(0).findcontrol("textbox") if control isnot nothing dim valueintextbox textbox = ctype(cntrol, textbox) valueintextbox.text = "some text" end if

iOS - How To Align UIAlertActions Properly? -

i adding checkmark item selected user in uialertcontroller(actionsheetstyle). however, once checkmark added, item checkmark not aligned other items. since items center-aligned this: item aaa item bbb ✓ item ccc i want them this: item aaa item bbb ✓ item ccc so tried added spaces @ end of labels no checkmark. still has no effect on alignment. is there anyway this? thanks! try add invisible unicode symbols.

winforms - C# Form Button Padding -

Image
in c# form i'am trying make nicely looking button cant on text "padding" problem. problematic button desired button i made mind of how should can't achieve it. supposed flat button black borders , "options" text in (like on second picture). kind of "padding" hides pretty big part of text. changing font size kinda helped want perserve button's ~16px height , font small can fit in there unreadable. i've tried setting button's padding property 0. thinking workaround overriding onpaint event / making multiple controls (like, combine label) i'am worried performance impact. hm took shot @ it, best do. i used image flat button, border providing grey area beyond black border. sort of workaround. whatever. here image button background . and code button: // // button1 // this.button1.backcolor = system.drawing.color.fromargb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); this.button1.b

javascript - How to access json object using node.js express.js -

Image
my json this var jsonobj = json.stringify(arr, null, 4); console.log(jsonobj); my output this i want access each , every element in json. plese provide me solution task from can tell looks have array of objects , within object sub array ("subacts"). able iterate on objects in "subacts" array need iterate on way: jsonobject.foreach(function(object) { object.subacts.foreach(function(subobject) { console.log(subobject); }); }); this iterate through entire object , print console subacts array objects.

Retrieving data while rendering form in django -

i have form fields. want display fields in form except two. 1 field data needs displayed. able form not able retrieve data db display. model.py class company(models.model): status_choices=( ('service','service'), ('product','product'), ) user=models.onetoonefield(settings.auth_user_model) company_name=models.charfield(max_length=250) company_address=models.charfield(max_length=250) company_telephone=models.charfield(max_length=250,blank=true) company_email=models.charfield(max_length=250,blank=true) company_website=models.charfield(max_length=250,blank=true) vat=models.charfield(max_length=250,blank=true) service_tax=models.charfield(max_length=250,blank=true) company_pan=models.charfield(max_length=250,blank=true) company_bankdetails=models.charfield(max_length=250,blank=true) invoice_type=models.charfield(max_length=250,choices=status_choices,default=

Can we assign more memory to the Spark APP than cluster it self? -

say spark cluster stand alone cluster. master having 1gb memory , slave having 1gb memory. when submit application cluster, can specify how memory driver program , worker program can have. possible specify higher value 10gb driver , 10gb worker? i mean happen if program submitted requiring more memory cluster self. (let assume physical computer having enough memory) spark has feature called "dynamic allocation". can turned on using spark.dynamicallocation.enabled = true more details here http://www.slideshare.net/databricks/dynamic-allocation-in-spark

ios - can't get image from URL? (NSURLErrorDomain error -1100) -

Image
i trying load jpeg: https://i.groupme.com/638x640.jpeg.d4f31c747b534baca03d12db5a2b6193 but error the operation couldn’t completed. (nsurlerrordomain error -1100.) from this post , found error means: kcfurlerrorfiledoesnotexist . strange because there image there. from this post , seemed issue https protocol, after implemented solution switch http , got error: app transport security has blocked cleartext http (http://) resource load since insecure. temporary exceptions can configured via app's info.plist file. ... the resource not loaded because app transport security policy requires use of secure connection. and same error continues popup after making necessary plist changes: how download image in ios? update so found download ok https if use code: nsdata* thedata = [nsdata datawithcontentsofurl:[nsurl urlwithstring:@"https://i.groupme.com/638x640.jpeg.d4f31c747b534baca03d12db5a2b6193"]]; uiimage *image = [uiimage imagewithdata:thedata]; but

javascript - How to Convert a Numeric Digit to an Alphabetical Grade, Dynamically? -

the code below calculates users grade point average a+ e-. possible, within following fiddle, display next grade point average grade a+ e-. far, user types in grades a+ e- , converts result grade point average. if new fiddle please provided, appreciated, still new coding. fiddle thank html: <button class="button" data-bind="click: addclass">add new class</button> <button class="button"> apply </button> <hr> <ul align="center" data-bind="foreach: classes"> <li> <label>subject:</label><input type="text" data-bind="value: title" placeholder="e.g: english"/> <select disabled data-bind="value: credits"> <option selected data-bind="value: credits">1</option> </select> <label>grade:</label> <input type="text" data-bind=

python - How to use urllib.urlencode? What are the the type of those two variables -

if : postdata = urllib.urlencode({ 'zip':'98105', 'zipcode':'98115' }) for 'zip', type of 'first position variable'. html id, or html class, or what? '98105', value trying change? urlencode creates "websafe" urls you. postdata = urllib.urlencode({ 'zip':'98105', 'zipcode':'98115' }) in case postdata equals 'zipcode=98115&zip=98105' convert mapping object or sequence of two-element tuples “percent-encoded” string, suitable pass urlopen() above optional data argument. useful pass dictionary of form fields post request. resulting string series of key=value pairs separated '&' characters, both key , value quoted using quote_plus() above. when sequence of two-element tuples used query argument, first element of each tuple key , second value. value element in can sequence , in case, if optional parameter doseq ev

PHP POST array with empty and isset -

i have following multiple checkbox selection: <input type="checkbox" name="fruit_list[]" value="apple">apple <input type="checkbox" name="fruit_list[]" value="banana">banana <input type="checkbox" name="fruit_list[]" value="mango">mango <input type="checkbox" name="fruit_list[]" value="orange">orange form connects processor.php via post method. validation: if ( empty($_post['fruit_list']) ){ echo "you must select @ least 1 fruit.<br>"; } else{ foreach ( $_post['fruit_list'] $frname ){ echo "favourite fruit: $frname<br>"; } } my questions (above code works! unclear points me): if don't select of checkboxes , submit form, $_post array contain index called $_post['fruit_list'] ? assuming answer "no", how possible use empty() non existed a

python 3.5 - geopy geocode does not map addr - browser googlemap does -

i trying map list of (~320+) texas addresses lat,lng. i started using geopy (simple example) , worked addresses failed on set of addresses. so integrated backup googlemaps geocode... failed. below code... see address_to_geopt. yet, when submit failed addresses via browser, finds address... tips on how more reliable hits? googleapi should use (see address_to_geopt_googlemaps()) class geomap(dbxls): def __init__(self, **kwargs): super(umcgeomap, self).__init__(**kwargs) # geo locator self.gl = nominatim() self.gmaps = googlemaps.client(key='mykeyisworking') shname = self.xl.sheet_names[0] if 'sheet' not in kwargs else kwargs['sheet'] self.df = self.xl.parse(shname) def address_to_geopt(self, addr): l = self.geolocation(addr) if l : return (l.latitude, l.longitude) return (np.nan, np.nan) def address_to_geopt_googlemaps(self, addr): geocode = self.gmap

c# - Visual Studio 2015 Add Publish Version Number -

Image
in previous vs versions adding publish version easy. need go project properties -> publish , specify publish number shown in below figure. but project properties window visual studio 2015. here can't find location specify publish version did on previous vs versions. have dropped functionality add publish version numbers or have moved place?? microsoft deprecated add-ins in visual studio 2015 build number increment add-in no longer working. your possible replacement vsincrementer ( link )

php - drupal 8 configuring in GAE Issue -

i using php gae downloaded drupal 8 stable drupal.org added app.yaml ran localhost port of 9083 configured issue drupal bit slow , css not loading whether need thing crack or add configuration. while searching in logs found example loading multiple times. get /core/install.php http/1.1 200 if found or share me regarding issue welcome note : thinking due css not loading gae takes time.

cloud9 ide - Can c9 workspace be used to run a website? -

i have application created using hugely popular , cool c9.io workspace. c9.io workspaces go idle mode when haven't accessed them sometime. means website published no longer running once goes idle mode. i cant find documentation settings keep workspace going idle mode. does know of way keep workspace active always? i'm engineer @ cloud9. cloud9 meant used development platform only, not website hosting. workspaces stopped resources can freed other users when you're not using it. that's how we're able offer such generous plans. if you'd have website online permanently while still using cloud9 i'd recommend buying cheap vps hosting provider , creating ssh workspace in cloud9 connecting vps.

keystore signature not working android -

i have been working on application quite while without problem. 2 weeks ago generated keystore sign application. matter of fact develop on 2 machines @ home , in office. since generated keystore keep getting message whenever change machine: installation failed since device has application same package different signature. in order proceed, have uninstall existing application. warning: uninstalling remove application data! want uninstall existing application? thanks

powershell - Automatise Adduser for Windows Active Directory 2008 -

i add lot of users active directory users group based on csv specifics informations phone numero, email, job ... i around internet , found "method" using powershell. but, it's add basic infos name, surname, login , password. is there webpage referencing new-aduser cmd ? i found on website http://blogs.technet.com/b/pascals/archive/2013/08/09/cr-233-er-des-utilisateurs-de-test-dans-ad-avec-un-mini-script-powershell.aspx thanks, i use quest ad cmdlets makes easier ad manipulation. you can download cmdlets here . you can add phone number, webpage, etc. default, or can use -includedproperties addition. here syntax new user creation.

Count query giving different result with same time range in mongodb -

i doing aggregation of records in collection time interval of 5 minute using match follows { "$match" : { "timestamp" : { "$gt" : 1460953500000 , "$lte" : 1460953800000}) scrip run @ time interval 10:01, (interval 9:55 10:00) 10:06, (interval 10:00 10:05) after running above match query getting different count. count of document changes till 1-2 minute after time passed example run query of count in collection query hit time 10:01:05 db.xxx.count({ "timestamp" : { "$gt" : 1460953500000 , "$lte" : 1460953800000}) count : 44350 10:01:015 db.xxx.count({ "timestamp" : { "$gt" : 1460953500000 , "$lte" : 1460953800000}) count : 44578 10:01:40 db.xxx.count({ "timestamp" : { "$gt" : 1460953500000 , "$lte" : 1460953800000}) count : 44830 and time onward count become stable. i have found https://docs.mongodb.org/manual/core/journaling/#jou

regex - How to find & replace a pattern with string in ruby? -

my file is: [root@test etc]# cat nrpe.cfg command[check_users]=/usr/local/nagios/libexec/check_users -w 30 -c 35 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1 command[check_hda]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sdb command[check_procs]=/usr/local/nagios/libexec/check_procs -w 200 -c 250 want replace /dev/sdb /dev/xvda1 in ruby first let's write text file: str =<<bitter_end command[check_users]=/usr/local/nagios/libexec/check_users -w 30 -c 35 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20 command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1 command[check_hda]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sdb command[check_procs]=/usr/local/nagios/libexec/check_procs -w 200 -c 250 bitter_end fname_in = &quo

QT: how to show linux command output in text browser -

i want run linux command programmatically , show output in text browser. here code: void mainwindow::on_pushbutton_clicked(){ qstring qstr; file *cl = popen("ifconfig eth0", "r"); char buf[1024]; while (fgets(buf, sizeof(buf), cl) != 0) { qstr = qstring::fromutf8(buf); ui->textbrowser->settext(qstr); } pclose(ls); } but got nothing in text browser. if change qstr in ui->textbrowser->settext(qstr); arbitrary "string" ,it works fine. helps?! thanks. in example popen use: qstr += qstring::fromutf8(buf); but better use qprocess. dynamic output use: qprocess* ping_process = new qprocess(this); connect(ping_process, &qprocess::readyreadstandardoutput, [=] { ui->textbrowser->append(ping_process->readallstandardoutput()); }); ping_process->start("ping", qstringlist() << "8.8.8.8"); for use lambda not forget add in .pro file: config += c++11

python 2.7 - Creating a bootstrap table with data from MySQLdb in flask -

hello guys trying create bootstrap table data mysql database. getting error local variable data referenced before assignment. please code below. app.py code @app.route("/viewsingle", methods=['post','get']) def singleview(): if request.method=="post": if request.form['submit']=="view continent": c,conn = connection() c.execute('''select * country''') data = c.fetchall () c.close () conn.close () return render_template("view.html",data=data) view.html <div class = "one1-div"> <div class ="container"> <form class="form-group" action="{{ url_for('singleview') }}" method=post> <table class="table"> <thead> <tr> <th>firstname</th> <th>lastname</th>

c++ - Custom Qt QGraphicsItem tooltip -

i'm looking ways implement simple custom tooltip qgraphicsitem . i know can use settooltip set text tooltip. want change text dynamically when mouse hovers @ different parts of qgraphicsitem object. what i'm thinking when event qevent::tooltip , change tooltip text in event handler. however, cannot find event function recieve qevent::tooltip qgraphicsitem . or there ways handle event mouse hovers 2 seconds. how can make it? you implement hovermoveevent in derived qgraphicsitem class, , set tooltip based on position within graphics item void myitem::hovermoveevent(qgraphicsscenehoverevent* event) { qpointf p = event->pos(); // use p.x() , p.y() set tooltip accrdingly, example: if (p.y() < height()/2) settooltip("upper half"); else settooltip("bottom half"); } notice have enable hover events item.

c# - Datetime Formatting giving it a specific culture doesn't change how day is printed out -

is datetime format strictly dependent on language of os being used? because following doesn't work: datetime date = datetime.now; var uscultureinfo = cultureinfo.createspecificculture("en-us"); console.writeline(date.tostring("dddd mm-dd-yy"),uscultureinfo); i'd result print out saturday, 06-29-2013 day gets printed out in korean 토요일, 06-29-2013 . you victim of composite formatting overload console.writeline pass format string , series of object inserted in placeholders of format string you need write in way console.writeline(date.tostring("dddd mm-dd-yy",uscultureinfo)); and right day text. see specs here datetime.tostring(format, iformatprovider)

java - Hibernate Properties or configuration file to use -

for hibernate project recommended use hibernate.properties file or hibernate.cfg.xml file. use?? and please can u specify why use properties instead configuration , vice versa which use best hibernate.properties file or hibernate.cfg.xml file the hibernate.properties old way represent connection information, newest versions (2.0+), has been replaced xml-based configuration file, since more flexible , has more features. however, there's thread explaining how combine them both, should have @ thread: how use hibernate.properties file instead of hibernate.cfg.xml . you should have hibernate documentation http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html , chapter 3.7. xml configuration file.

ios - How to include multiple OS X images in .travis.yml -

i new travis , want include multiple os x images can test build on different os x platforms os x 10.10 , os x 10.9 xcode 7.3 (os x 10.11) – osx_image: xcode7.3 xcode 6.4 (os x 10.10) – osx_image: xcode6.4 xcode 6.2 (os x 10.9) – osx_image: beta-xcode6.2 here current .travis.yml language: objective-c osx_image: xcode7.3 install: - carthage update nimble quick --platform ios --no-use-binaries - carthage update alamofire --no-use-binaries script: - xcodebuild clean test -project restofire.xcodeproj -scheme restofire-ios -sdk iphonesimulator only_active_arch=no -destination 'name=iphone 6,os=9.3' you can use build matrix test on different versions of os x specifying different osx_image , vaguely explained in testing project on multiple operating systems . sample .travis.yml: language: objective-c matrix: include: - osx_image: xcode7.3 - osx_image: xcode7.1

php - Combine arrays with a common value into a new array -

i working on project , stuck on question have 1 array below $arr1 = array( array ( 'id' => '1', 'city' => 'a.bad', ), array ( 'id' => '2', 'city' => 'pune', ), array ( 'id' => '1', 'city' => 'mumbai', ) ); and have compare id , want output below. $result = array( array( 'id'='1', 'city'='a.bad','mumbai' ), array( 'id'='2', 'city'='pune' ) ); if have same id in first 1 a.bad take , in third 1 has id 1 , city mumbai combine id 1 , city a.bad , mumbai , other records filtered in same manner. loop through array , generate new array depending on id .you can try - $n

sql server - SQL function performance -

i have function used on view. function [dbo].[calculateamount] ( @id int, @price decimal(24,4)) declare @computedvalue decimal(24,4) set @computedvalue = case when (select table1.id dbo.[table1] table1 join dbo.[table2] table2 on table2.id = table1.id table1.id = @id // conditions here // null @price else @price * cast('1.0368' decimal(24,4)) end so basically, wanted check if id passed parameter existing on table1. if returned row, multiply price 1.0368, if not price remain is. my problem here performance. using on view returns 17000 rows. view running, 45 minutes on 12000th row. any ideas or suggestion improve performance of view? edit i calling on view this: [dbo].[calculateamount](id, price) price along select statement. if place use function in view, why not encapsulate logic in view: alter view dbo.yourview select <columns>, calculatedprice = case when t1.id null <tables>.price

java - considering the use case of user selecting reverse time interval in android app -

the android app notify user between time interval user selects. settings have 2 timepickers store time1 , time2 i planning store time in int format suggested following link link --> store time in int data type in sql following above approach while comparing current time:- use case 1 time1 | time2 | currenttime 03:00(180 int) | 06:00(360 int) | 05:00(300 int) time1 <= currenttime <= time2 (user receive notification) use case 2   (time2 < time1) should allow user select time 2 time1 | time2 | currenttime 22:00(1320 int) | 01:00(60 int) | 23:00(1380 int) time1 < currenttime > time2 1320 < 1380 > 60 22:00 < 23:00 < 01:00 ( respect realtime when user wants notified @ midnight) in case user should notification if reverse time allowed. considering user wants notification during midnight. if((currentime > time2 && currentime <= 1439)|

android - Pick Image and Pdf using single intent -

i know can use following to pick images : intent.settype("image/*"); to pick pdf files : intent.settype("application/pdf"); so there way can pick single entity either pdf or images through single intent? here example: private intent getfilechooserintent() { string[] mimetypes = {"image/*", "application/pdf"}; intent intent = new intent(intent.action_get_content); intent.addcategory(intent.category_openable); if (build.version.sdk_int >= build.version_codes.kitkat) { intent.settype(mimetypes.length == 1 ? mimetypes[0] : "*/*"); if (mimetypes.length > 0) { intent.putextra(intent.extra_mime_types, mimetypes); } } else { string mimetypesstr = ""; (string mimetype : mimetypes) { mimetypesstr += mimetype + "|"; } intent.settype(mimetypesstr.substring(0, mimetypesstr.length() - 1)); }

How to compare a string to a string in Forth? -

how compare 2 strings in forth? and can in if statement or should make helper boolean variable? here's code have far. way, iox@ input user. : var compile: variable complile: ; : lock compile: var realpass$ compile: realpass$ "password" ! compile: ." enter password: " compile: var pass$ compile: iox@ pass$ ! compile: var match compile: realpass$=pass$ match ! unknown token: realpass$=pass$ the ansi word compare strings compare (c-addr_1 u_1 c-addr_2 u_2 -- n) . n equals 0 if 2 strings compared equal. forth eschews explicit variables in favor of using stack using if directly without variable fine. : pwcheck compare if ." entry denied." else ." welcome friend." cr ; s" hello" ok s" goodbye" ok pwcheck not wanted here. ok s" howdy" ok s" howdy" ok pwcheck welcome friend. ok

javascript - How to check throw error on response in node js when my query result rowCount is 0 -

Image
if rowcount o need send on res failed. if rowcount 1 need send res status success. kindly me out. when tried take print (client.query) coming json(result on attached image) var query = client.query("select * pp_user_profile email_id = '"+req.query.email_id+"' , user_password= '"+req.query.user_password+"'"); console.log(client.query); query.on("end", function (result) { if (result.length > 0) { if (result) console.log("test:" + result); res.write('failed'); } else{ console.log(result); client.end(); res.writehead(200, {'content-type': 'text/plain'}); res.write('success'); res.end(); } change if...else condition way. if(result.rowcount === 1){ // code goes here } else{ // code goes here }

How to pass $_GET in pagination in php -

this code works if running pagination, when there $_get variable passed shows first page , when clicked on next loads data in db , runs beginning. i know how can pass $_get variable passed. <?php if ($currentpagerec > 1) { echo " <a href='{$_server['php_self']}?currentpagerec=1'>first page</a> "; prevpagerec = $currentpagerec - 1; echo " <a href='{$_server['php_self']}?currentpagerec=$prevpagerec'>previous page</a> "; } ($x = ($currentpagerec - $rangerec); $x < (($currentpagerec + $rangerec) + 1); $x++) { if (($x > 0) && ($x <= $totalpagesrec)) { if ($x == $currentpagerec) { echo " [<b>$x</b>] "; } else { echo " <a href='{$_server['php_self']}?currentpagerec=$x'>$x</a> "; } } } if ($currentpagerec != $totalpagesrec) { $nextpagerec = $curren

javascript - Change the title of strut action showing in browser -

Image
i'm trying open pdf file in browser through struts action. when open window showing me name of action instead of title trying set window. how should set title window? as shown in image, viewpdfdocument.do appears in window , in title of window. want change it. i think there should .properties file somewhere in project, can change .title value within file

php - Option value selected for loop -

i trying create selected value of previous output. (the user fills in form , submits, returns form) , want selected value value user used. the vraagnummer , answer given in url parameter , dropdown menu of items available in list created in loop. got stuck on part.. how create option selected value if created in loop? usually put in option value = $vraagnummer selected> <?php echo $vraagnummer ?></option in case wouldn't work. suppose? anyone knows how fix this? same a/b/c/d. how put in selected value of answer value selected while still keeping others option. kind regards, if(!empty($_get['vraagnummer'])){ $vraagnummer = $_get['vraagnummer']; if(!empty($_get['answer'])){ $answer = $_get['answer']; } } echo $vraagnummer; echo $answer; ?> <form id="start" method="post" action="index.php?test=true&qu

d3.js - D3 reusable chart tootip follows wrong chart when update -

i created 2 graphs based on mike bostock's towards reusable charts, here link visualization: http://jhjanicki.github.io/reusable-chart-tooltip/ tooltip (the circle , vertical line now) seems ok @ first, when either select dropdown item or click on button, line , circle works graph clicked or selected, if go other graph, instead of having tooltip follow lines on graph, seems follow different invisible line instead. i've been stuck on couple of weeks , wondering if point me in right direction. thank much! , here link repo: https://github.com/jhjanicki/reusable-chart-tooltip the problem both graphs have same xscale , yscale so when ever change data reset domain: xscale .domain(d3.extent(data, function(d) { return d.date; })) .range([0, width- margin.left - margin.right]); and both graphs looking @ same xscale calculation below fail on mouse over. xscale.invert(d3.mouse(this)[0]), you can understand case both graphs same. works. moment change data 1 of

watch os 2 - WatchOS: Inserting pages in page-based navigation -

i'm using -[wkinterfacecontroller presentcontrollerwithnames:contexts:] modally present dynamically-created set of pages. there may occasions want insert page in set of pages while visible. possible, or set of pages fixed once visible? i have devised method achieve this, it's messy. better solution considerable improvement. each wkinterfacecontroller in group of pages has uuid property assigned using context , stored during awakewithcontext: the wkinterfacecontroller presents group of pages retains arrays of wkinterfacecontroller names , contexts before presenting them when 1 of pages needs insert/delete pages set, posts notification presenting wkinterfacecontroller the presenting wkinterfacecontroller makes changes required in retained arrays of wkinterfacecontroller names , contexts the presenting wkinterfacecontroller dismisses current group of pages , re-presents them using updated name/context arrays the presenting wkinterfacecontroller posts

c# - WPF Ribbon ApplicationMenu open and close event -

i'm using wpf ribbon application menu: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11877 https://msdn.microsoft.com/de-de/library/ff799534(v=vs.110).aspx how can close application (file) menu programmatically? how can detect if user opens application menu? didn't found appropriated event you need isdropdownopen property , related event(s). xaml (this .net 4.5+, 4.0 same, difference in namespace prefix): <stackpanel> <ribbon> <ribbon.applicationmenu> <ribbonapplicationmenu x:name="menu" dropdownopened="ribbonapplicationmenu_dropdownopened"> <ribbonapplicationmenuitem header="foo"/> <ribbonapplicationmenuitem header="bar"/> </ribbonapplicationmenu> </ribbon.applicationmenu> </ribbon> </stackpanel> code-behind: public partial class mainwind

Filter search and pjax not working in yii2 gridview -

i used crud generator in yii2 generate codes, want make sorting, filter search , pjax working on gridview, sorting working perfectly, filter search , pjax not working.. below code.. controller.. actionindex $searchmodel = new productsearch(); $dataprovider = $searchmodel->search(yii::$app->request->queryparams); return $this->render('index', [ 'searchmodel' => $searchmodel, 'dataprovider' => $dataprovider, my view file index.php <?php echo $this->render('_search', ['model' => $searchmodel]); ?> <?php pjax::begin(); ?> <?= gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'pager' => [ 'firstpagelabel' => 'first', 'lastpagelabel' => 'last', 'prevpagelabel' => '<span class="glyphicon glyphicon-chevron-left"></span>',

iphone - Frame wrong when viewcontroller pushed using auto layout -

i'm working on ios app. i have uiviewcontroller uses auto layout. if create view controller in app delegate , set window's root view controller, layout appears expected. if, however, make navigation controller root view controller when app launches (the navigationcontroller's root view controller different view controller), either push other view or present modally, layout wrong. to diagnose problem, put following statement in viewdidappear method: nslog(@"x:%f y:%f w:%f h:%f", self.view.frame.origin.x, self.view.frame.origin.y, self.view.frame.size.width, self.view.frame.size.height); when main view root view controller (which produces desired result), output: x:0.000000 y:20.000000 w:320.000000 h:460.000000 when main view presented modally, output: x:76.000000 y:250.000000 w:168.000000 h:0.000000 is there reason view's frame different when presented modally opposed being root view controller? thank assistance can offer!

ruby - ActiveRecord objects - querying retrieved records -

this puzzling me. i have: person = person.find_or_create_by(user_id: some_id) previous_person = person.where('user_id < ?' some_id).limit(1).order('user_id desc') binding.pry in pry do: person.user_id => 12 previous_person.user_id nomethoderror: undefined method `user_id' #<activerecord::relation::activerecord_relation_person:0x007fdd24d635b8> why can't access user_id previous_person? (apologies typos - wasn't direct copy , paste) doh. can' believe fell again! of course, person.where returns array. the correct code previous_person = person.where('user_id < ?' some_id).order('user_id desc').first

angular - How to use exhaustMap in ReactiveX/rxjs 5 in TypeScript -

i wondering how can process array each value returns promise in same order they're specified. example, let's want call multiple ajax calls in order: var array = [ 'http://example.org', 'http://otherexample.org', 'http://anotherexample.org', ]; there's basicaly same question: how can use rxjs hold off requests ajax call until previous 1 resolves , suggests using flatmapfirst . since i'm using angular2 ( beta-15 @ moment) in typescript uses rxjs@5.0.0-beta.2 found out flatmapfirst has been renamed exhaustmap . but operator isn't listed in observable.ts , therefore can't use it. it's not present in bundled version of rxjs https://code.angularjs.org/2.0.0-beta.15/rx.js . so, how supposed use it? or there other way need? package.json lists lot of build scripts, should force use 1 of them? edit: should mention i'm using reactivex/rxjs library, not reactive-extensions/rxjs operator concatmap() d

Perl WWW::Mechanize Slow down requests to avoid HTTP Code 429 -

i've written perl script fetch , parse webpage, fill forms , collect information, after while denied server http error 429 many requests . sent many requests in short amount of time server ip has been blacklisted. how "slow down" requests/script avoid again , not hurt anyone? there way perl module www::mechanize ? sub getlinksofall { $i ( 1 .. $maxpages ) { $mech->follow_link( url_regex => qr/page$i/i ); push @links, $mech->find_all_links( url_regex => qr/http:\/\/www\.example\.com\/somestuffs\//i ); } foreach $links (@links) { push @links2, $links->url(); } @new_stuffs = uniq @links2; } sub getnumberofpages { push @numberofpages, $mech->content =~ m/\/page(\d+)"/gi; $maxpages = ( sort { $b <=> $a } @numberofpages )[0]; } sub getdataabout { foreach $stuff ( @new_stuffs ) { $mech->get($stuff); $g = $mech->content; $t = $mec

vba - Excel -Access DB -ADO. Memory Leak-> System Resource Exceeded -

im using excel vba clean large csv files. load csv files access database using sql queries perform data transformation activities. process in abstract goes this open excel --> on start click crate access database --> load csv files different tables --> different ddl dml statements on database using adoddb connection --> output final data. the problem facing here memory usage goes excel. seems access db processing added excel itself. error "system resource exceeded" . each time query executed. memory usage goes high , never comes down. queries on around 10k 100k records in 3-4 tables. why memory usage never comes down? every time ddl/dml query open adodb connection , close it. close recordsets after use , set nothing. still memory usage never comes down. saw different articles related. discussing data in same excel file. in case no data kept in memory or in excel file. i saw 1 article microsoft here talks data in excel itself. https://support.mic

java - Error scanning invalid input -

this program needs return 'invalid input' if other row between 0-4 input, getting error: exception in thread "main" java.util.inputmismatchexception @ java.util.scanner.throwfor(unknown source) @ java.util.scanner.next(unknown source) @ java.util.scanner.nextint(unknown source) @ java.util.scanner.nextint(unknown source) @ ass.puzzle.play(puzzle.java:147) @ ass.puzzle.main(puzzle.java:18) you need catch thrown exception else if (input.equals("c")) { system.out.println("what column? (1-4)"); try{ int column = s.nextint(); s.nextline(); if (column <= 4){ rotatecolumn(currentarr,column - 1); print(currentarr); b++; } else system.out.println("invalid input"); }catch (inputmismatchexception ex){ system.out.println("invalid input"); }

javascript - Get props from child form component , ReactJS -

i new react . i writing component arrayinput contains multiple(based on state) input box. and arrayinput need handle each input box's onchange event. i hope specific props/attribute (in case , "index") on these dramatically generated input box i search many posts , docs can't find correct way. i know can use this.ref[inputboxref] (react 14+) actual dom node , find has no "attribute" or "data" when using $(domnode).attr('index') or $(domnode).data('index') . window.arrayinput = react.createclass({ ......other methods handlechange:function(ref,event){ var dominputbox = this.refs[ref]; //trying index attribute of input } render:function(){ var self = this; return ( <div classname="input-wrapper" > <label&g

javascript - Moving from Ionic 1 to ionic 2 -

trying port app ionic 1 ionic 2, got few queries: how can setup push/pop pages links work when click on image, rather button? do background images still work same ionic 1, doesn't seem work in ionic 2? what correct way paste entire css ionic app, rather seperate bits in ionic 2 compile scss files? how can comment out typescript? have tried /* , how list of products stored in factories.js used , imported in ionic 2? jsfiddle(dot)net/vgthumsm/ where controller code , js functions underneath pasted .ts file? jsfiddle(dot)net/qov7bh0w/ in order push (or pop) page on navcontroller stack, need respond event in code afaik. background images should work fine using css. app/theme/app.core.scss best bet comments work same javascript comments. // line commented /* commented out stuff on several lines */

c# - How to open a textfile in XNA/monogame(beginner here)? -

Image
okay, working in xna , want open textfile should open in textfile. here code: if (keyboard.getstate().iskeydown(keys.g) == true) { var filetoopen = "name.txt"; var process = new process(); process.startinfo = new processstartinfo() { useshellexecute = true, filename = filetoopen }; process.start(); process.waitforexit(); } however error occurs , cant find textfile open. did in normal consol application , added new item textfile project , worked fine in console application, in xna not seem work @ all. also im not educated in file directory things , need quick fix. text files placed in area: i hope of somehelp im trying give information possible. note streamwriting textfiles in directory location shown in image link works fine , give name of file

What is the formal name of the data-structure/algorithm for particle simulations presented here? -

for computer simulate system of n particles in universe interact each other, 1 use rough algorithm: for interval dt=10ms each particle in universe each particle b in universe interact(a,b,dt) each particle in universe integrate(a,dt) it heavy, calling interact n^2 times per tick - thus, unfeasible simulate many particles. of time, though, particles near interact less strongly. idea take advantage of fact, creating graph each node particle , each connection distance. particles near interact more particles far. example, for interval dt=10ms each particle in universe each particle b 0m <= distance < 10m interact(a,b,dt) interval dt=20ms each particle in universe each particle b 10m <= distance < 20m interact(a,b,dt) interval dt=40ms fro each particle in universe each particle in b 20m <= distance < 40m interact(a,b,dt) (...etc) interval dt=10ms each particle in universe integrate(a,dt) this super

linux - egrep regex operation not working as expected -

i have file content such: [text_id=2] [text_rev=3] [no_of_bytes=16] 0010002$%!003000040000000010100 [txt] ff ff [txt_id=2$@] [txt_rev=3] [no_of_bytes=17] 0010002003000040000000010100 [txt] ff ff $%^& i want identify other 0-9 , a-z , a-z , space , enter , tab junk character. i have make sure = or [ or ] when comes part of [context=val] line, valid character. if comes in other line junk character. for example in 9th line of file if comes = , [ or ] , junk: 0010002003000040000000010100=[ so i'm using below: egrep -v "^[' '0-9a-za-z\t\n\v\f\r]*$|^[ ]*\[[a-z].*\_*[a-z]*=*[0-9]*\][ ]*$" sspr.240, gives output as: 0010002$%!003000040000000010100 $%^& however not considering line: [txt_id=2$@] how can modify egrep statement? you can try like: egrep -v '^([[:space:]]*\[[[:alnum:]_]+=?[[:alnum:]_]*][[:space:]]*|[[:alnum:][:space:]_]*)$' file

azure active directory - Using AADL Access Token to Preview Sharepoint Online Document -

i'm developing hybrid mobile application connects sharepoint online. authentication has been handled cordova aadl gives access token after successful login azure active directory. i'm able search sharepoint online document library using search rest api. want open/preview search result document in app using access token. there way ? please help

javascript - How to remove/reset window.onfocus function? -

this has been driving me nuts. when load page initiate window.onfocus function: initializefocusdetecttor: function () { window.onfocus = function () { var options = { usefade: false } $.overwatch.worker.getview("/overwatch/updatewatch", function () { $.overwatch.init(); }, options); } } however don't want behavior on every page don't know how remove/reset this. i have tried window.onfocus = null; window.onfocus = function(){return;}; window.onfocus = ""; but not work if change use jquery event handling, can remove (e.g. off ). initializefocusdetecttor: function () { $(window).on('focus.mine', function () { var options = { usefade: false } $.overwatch.worker.getview("/overwatch/updatewatch", function () { $.overwatch.init(); }, options); }); }); // condition - turn off $(window).off(&

classification - Does Weka setClassIndex and setAttributeIndices start attribute from different rage? -

i using weka classification. using 2 function, "setclassindex" , "setattributeindices". dataset have 2 attributes, class , 1 more attribute. following instances in database: @relation sms_test @attribute spamclass {spam,ham} @attribute mes string @data ham,'go until jurong point' ham,'ok lar...' spam,'free entry in 2 wkly' following part of code. traindata.setclassindex(0); filter = new stringtowordvector(); filter.setattributeindices("2"); this code running fine. when set, train.setclassindex (" 1 ") or filter.setattributeindices(" 1 ") , code stops running. setclassindex function take argument starting 0 , setattributeindices takes argument starting 1? how identify weka function starts counting 0 or 1? do setclassindex function take argument starting 0 yes, index starts 0. and setattributeindices takes argument starting 1? yes, indices start 1 source: