Posts

Showing posts from August, 2015

java - Cluster Management using JMX -

i trainee , have new issue figure out, dealing jmx. my company using jmanage because contains application cluster support, can perform operations accross tomcat clusters. however, jmanage not maintained anymore, , got dead nodes without knowing reason. as non java users working jmanage, mission find jmx console web application have cluster support. i searched on internet , couldn't find equivalent jmanage does. found lot of jconsole jminix, mc4j it's not company expected. didn't find documentation jolokia , clustering. want make sure software exits, prefer ask if know web app can use replace jmanage? if not case, have try building new software doing this. first software develop, have advice how can it? starting jmanage open source code , investigate doesn't work? helpful have other points of views before starting! :) thank help! search jmx cascading/opendmk. there mavenized github repo of opendmk bridge multiple mbean servers.

file io - Backup a while with added timestamp and delete original in a loop -

the main part of code work when manually started, not needed when used external program initiate, felt doing aio better .. when added few lines delete file after backed , loop (marked pt1, pt2, pt3 in code), following syntax error: line: 66 char 1 syntax error 800a03ea ms vbscript compilation error as reference these links checked , copied from: constantly file, when file exist, run command http://www.devhut.net/2013/11/15/vbscript-backup-a-file-and-add-a-date-time-stamp/ '--------------------------------------start of added code pt1' '---------------------------------end of added code pt1' dim objfso dim ssourcefolder dim sdestfolder dim sdbfile dim sdatetimestamp const over_write_files = true set objfso = createobject("scripting.filesystemobject") ssourcefolder = "c:\program files\n h p" sbackupfolder = "c:\program files\n h p\archivedata" sdbfile = "n-h-p" sdbfileext = "csv"

c++ - Pass non-const vector<string> to a function that takes a reference to const vector<const string>? -

i have function want able accept const vector<const string> want user able pass vector<string> well. thought make function argument reference const , non-const vector still accepted, it's not. here's example: void test(const vector<const string> &v) { return; } int main( int argc, char *argv[] ) { vector<string> v; test(v); return 0; } the error receive is: error c2664: 'test' : cannot convert parameter 1 'std::vector<_ty>' 'const std::vector<_ty> &' why doesn't example work , how suggest make function work user can pass const vector<const string> , vector<string> ? thanks this post maybe can you. can force call in (horrible) way test(*reinterpret_cast<vector<const string>*>(&v)); that in way illustrates why not possible automatic conversion. break container's rules: vector<string> v = {"a", "b"}; vec

google analytics - Is it possible to track custom vars in real-time GA view? -

i starting google analytics , found custom variables useful (using classic analytics now). exploring panel see section custom variables under non-real-time section . however, if head real-time section, there no evidence custom vars going appear there (i.e. can seen under non-real-time section). checking documentation not clarify talk custom vars not specify if appear or not under real-time section. knows? it impossible documentation list not case, if not documented , not visible in interface it's in cases safe assume not there. however google has documented visible in real time reports , there no report custom vars.

android - CountDownTimer inside fragment: manage pause and resume fragment -

i have fragment countdowntimer object , pause timer when fragment goes in background, resume when fragment comes again foreground. code: @override public void onpause() { super.onpause(); active = false; try { synchronized (countdowntimer) { countdowntimer.wait(); log.i("timer", "wait"); } } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } @override public void onresume() { super.onresume(); if (countdowntimer != null) { countdowntimer.notifyall(); log.i("timer", "notify"); } } in way, timer stops countdown when put fragment background, don't restart when recall foreground. what's wrong?

Where to store webservice urls in android application -

i'm new android development. i'm working on application calls web services registration, login, etc... i'm storing url , other constants static final object in class. best way of doing or should use preferences or string.xml saving url assures secured when decompiling apk? is best way of doing or should use preferences or string.xml saving url assures secured when decompiling apk? rooted phones can modified provide access private preferences etc. if code obfuscated , strings encrypted, urls can still exposed. the answer not keep url secret rather secure web service calls in reliable way. post not have enough information elaborate on security best suit app / service. take @ oauth ; how amazon aws secures web service calls. start.

JavaScript API for Office: How to get currently selected cell identifier? -

i've come conclusion functionality not available in javascript api office v1.1, thought i'd make sure here first. i identifier (ie. "a1") of selected cell, cannot find in api supports this. find odd seems arbitrary requirement , can set current selection using identifier document.gotobyidasync method. does know if there method access information? one hacky way might able follows: add binding region of sheet care about add change handler binding call getselecteddataasync , store value call setselecteddataasync arbitrary string. trigger change handler. in change handler's callback, data binding search string , calculate identifier index restore data hope helps, might little fragile though. edit: looks bindingselectionchanged callback gets event position information (startrow, startcolumn, rowcount, columncount) no need hack above :)

c# - In debug mode, is there a way to break(pause the execution) whereever it is? -

Image
if put breakpoint somewhere in code, pausing when program read line of code. sometimes while program running, want pause it. not know line of code reading currently. possible pause execution whereever is, if breakpoint exists there? is possible pause execution whereever is, if breakpoint exists there? yes, when debugging , these options: on debug menu, click break all keyboard shortcut: ctrl + alt + break using gui, click on highlighted pause icon:

namespaces from header files in c++ -

i have created noname namespace variables inside in header, want initialize them in .cpp , see in main.cpp. noname namespace expecting work fine without mentioning namespace in .cpp. error if in .cpp had totally new , b. has idea how resolve it? xx.h namespace { int a; int b; } .cpp #include "xx.h" = 5; b = 10; main.cpp #include <iostream> #include "xx.h" int main() { std::cout << "values" << << b << std::endl; } you may not use assignment statements outside functions. may declare or/and define objects . valid code be namespace { int = 5; int b = 10; } main.cpp #include <iostream> #include "xx.h" int main() { std::cout << "values" << << b << std::endl; } take account objects declared in unnamed namespaces have internal linkage. means if header included in more 1 module in each module declares separate namespace. c

ios - SpriteKit Texture Atlas Generator Error 2048 x 2048 -

i'm trying include 2045 x 1536 background png in atlas folder (myapp.atlas) i following error textureatlas : sprikekit texture atlas generator error cannot fit input texture maximum supported dimensions of 2048 x 2048 does know why is?

php - Ajax form building in yii -

in view have several buttons. when user press them want tell server button pressed, server create form, pass html view, , place in specific div. depending on selector changes in form, want view ask server again data, bring , pass parts of form. i can jquery ajax requests, using php file on server side, , again jquery html manipulations when receive answer, thought maybe things done smarter in yii , there better practice of how ? the process same pretty without yii. of methods yii ones instead though.

HTML / PHP Email Form: Submit button doesn't respond -

i'm working on quote submission form company, , running issue form functionality (namely, submit button nothing). currently, form below: <form action="quotethanks.php" form id="contact-form"> <fieldset> <p> <label class="name"> <input type="text" name="first" value="first name:*"> <span class="errors"><span class="error">*this not valid name.</span> <span class="empty">*this field required.</span></span></label> <label class="name"> <input type="text" name="last" value="last name:*"> <span class="errors"><span class="error">*this not valid name.</span> <span class="empty">*this field required.</span></span></label> <label class="name">

c++ - Multiple Declaration error ignored in classes, why? -

consider following code fragment: int test; //global variable class base { int test; //private member of base public: void getit() { cin>>test; } }; class derived: public base { public: void check() { test++; //neither access global test nor member of base } }; in above code, observe variable test . first declared globally , again declared inside class in private scope. my question first question how compiler allowing multiple declaration variable test , why not giving error? also, when function check() tries access test , compiler gives error. know private members not inherited , not accessible outside class, exists global variable, must accessible. second question which test present inside check() whether global 1 or 1 declared inside class base ? also, how access global test ? how compiler allowing multiple declaration variable test , why not giving error

YouTube API v3 only returning a subset of Channels -

i'm trying query of channels in category using youtube api v3. i'm seeing subset of total data though , not full dataset. for example if run get https://www.googleapis.com/youtube/v3/channels?part=snippet&categoryid=gctxvzawm&key={your_api_key} i following response { "kind": "youtube#channellistresponse", "etag": "\"vl8g1mjp6hnwwlbxdxcr2a3miyk/yqdrdouh3lti0g5e97wjidvi9h8\"", "nextpagetoken": "cauqaa", "pageinfo": { "totalresults": 201, "resultsperpage": 5 }, "items": [ ... ] } so can see i'm getting 201 channels returned , there more 201 music channels on youtube. if go through of pages i'm not seeing channels less 100k subscribers. should use search api? return data? if should use search, what's point of channels api? thanks! from docs: https://developers.google.com/youtube/v3/docs/channels/list

Moving live() from jquery 1.4 to jquery 1.11 -

i have following piece of code: $(".watermark").live('focus', function() { $tb = $(this); if ($tb.val() == this.title) { $tb.val(""); $tb.removeclass("water"); } }).live('blur', function() { ... } }).blur(); how can upgrade/rewrite code take advantage of latest jquery features? here's jsfiddle http://jsfiddle.net/6ekvv/ since .live() deprecated of version 1.7 , removed in version 1.9. can use .on() instead: $(".water").addclass('watermark'); $(".watermark").on('focus', function() { $tb = $(this); if ($tb.val() == this.title) { $tb.val(""); $tb.removeclass("water"); } }).on('blur', function() { $tb = $(this); if ($.trim($tb.val()) == "") { $tb.val(this.title); $tb.addclass("water"); } }).blur();

ios - Rename function doesn't work on XCode 5.1 -

Image
i using xcode 5.1 on mac os x. have problem can't press 'preview'button when try rename variable selected, first time works ok, next time can't. because preview button disabled don't know why? know what's problem? here screenshot: thanks. to rename must give different name. have u tried giving different name?

How to create UUID in JSNI of the input elements? -

how create uuid in jsni each input element. each time of call id's of input elements must change , new entries must inserted in database every new form. finally succeeded in doing getting values directly in variable fname=a.value; a input box of jsni , fname variable value being stored.

objective c - What does the [SomeClass self] syntax do? -

i studying sample code provided apple sketch , stumbled upon syntax haven't seen before. it's in sktgraphicview.m in function moveselectedgraphicswithevent: nsrect selbounds = [[sktgraphic self] boundsofgraphics:selgraphics]; i have never seen [someclass self] syntax before. in case self subclass of nsview , boundsofgraphics: class method sktgraphic subclass of nsobject . the self method defined in nsobject protocol , every object instance of class or class object (of type class ) supports method. returns object called on, i.e. like: - (id) self { return self; } so self on instance returns instance, , on class object returns class object. the following therefore holds: [x self] == x yes instance , class objects x and line equivalent to: nsrect selbounds = [sktgraphic boundsofgraphics:selgraphics]; so what does . why apple wrote way, that's different question...

php - Imagecord function is not getting accessed after clicking the submit button in form -

</head> <body> <?php function aftersubmit() { $myname = $_post['myname']; if(isset($myname)){ echo ($myname); } } function imagecord() { if(isset($xcoord) && isset($ycoord)){ $xcoord=$_post["myimage_x"]; $ycoord=$_post["myimage_y"]; echo ("x=".$xcoord); echo ("y=".$ycoord); } } if(isset($_post['submitbutton'])){ aftersubmit(); imagecord(); } ?> imagecord() function not getting accessed, aftersubmit button in php. want click on image , after submit should display coordinates. modified function function imagecord() { if(isset($_post["myimage_x"]) && isset($_post["myimage_y"])){ $xcoord=$_post["myimage_x"]; $ycoord=$_post["myimage_y"]; echo ("x=".$xcoord);

jquery - AngularJS $scope won't update when ng-model is updated -

i have following html <input id="zoom" name="zoom" style="width:100px" type="text" ng-model="user.zoomlvl"> when run below updates above html input field google.maps.event.addlistener(map, 'zoom_changed', function() { mapzoom(); }); function mapzoom(){ valzoom = map.getzoom(); $('#zoom').val(valzoom); } but $scope.user.zoomlvl still not update when zoom_changed has updated input field. if you're using events not part of angular (e.g. zoom_changed ), don't run $scope.$apply() @ end ng-click would. that's why $scope not updated. therefore, in event need add $scope.$apply() function mapzoom(){ valzoom = map.getzoom(); //$('#zoom').val(valzoom); // better $scope.user.zoom1v1 = valzoom $scope.$apply(); }

wordpress - Page search feature results in duplicate page for SEO -

i'm using wordpress theme titled enfold features 'search' functionality. functionality results in 2 url's every page (according search engine spider). first actual page , second link drives search feature. e.g. http://www.bhutantravelbureau.com/about-bhutan/ & http://www.bhutantravelbureau.com/about-bhutan/?s= to search engine appear 2 pages same content , has negative impact on search engine rankings. i've attempted fix using yoast seo identify pages not found in search results, , added user-agent: * disallow: /?s= to robots.txt file. unfortunately has not fixed issue. other disabling search feature, have ideas how can fix this? you can't handle on robots.txt because search engines ignore empty query strings. you have problem site, have every time double content, alone because domain dont handle www. , non-www subdomain. use 301-redirects , opt 1 domain (either www.domain.com or domain.com).

android - How to press two (or more) buttons at once -

my app has 12 buttons sounds, 1 button can pressed @ once. need enable multitouch in app? here's code of activity: import java.io.ioexception; public class myactivity extends activity implements view.ontouchlistener { button button1, button2, button3; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button1 = (button) findviewbyid(r.id.button); button2 = (button) findviewbyid(r.id.button2); button3 = (button) findviewbyid(r.id.button3); button beatsound1 = (button)this.findviewbyid(r.id.button4); beatsound1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { playsound(beat2); log.d("my", "cow"); } }); button beatsound2 = (button)this.findviewbyid(r.id.button5); beatsound2.setonclicklistener(new view.onclicklistener() { @override

regex - Capturing repeated word sequence -

in perl, match text pattern a11a , g22g , x33x below regex works fine ([a-z])(\d)\g2\g1 now want match repeating groups similar above having space in between words like abcd 101 abcd 101 ( catch entire string in single regex pattern in 1 single line text or paragraph ) how this...i tried below pattern wont work ([a-za-z]*\s)([0-9]*\s)\g1\g2 #logic : words followed space in 1 group , #numbers followed space in 2nd group regex101 demo also, please explain why above regex fails capture desired text pattern!!! edit one more complication : assume pattern [words][space][numbers][space][words][space][numbers] #assume [numbers] , [word] same ....so in last [numbers] case, [space] doesn't follow, how filter then...because regex group capture like: ([0-9]*\s) fails capture last part if repeated, and ([0-9]*) fail capture mid-part if repeated!! ?? regex 101 your problem regex expects space @ end, because have included space in captu

asp.net mvc 4 - Alternative to sending data to view in List? -

i learning .net mvc , finished first application. @ minute trying send multiple list of data view, each list mulitple fields , populating multiple tables these lists. example have animals table in db, want pull records table , display of them in table in view. have db treatment table , want display records table in separate unrelated table in view in past have declared list in viewmodel (below) , populated list required, not useful takes 2 fields, value, , text public ienumerable<selectlistitem> treatmentlist { get; set; } im not sure if have made problem clear. appreciated thanks you may consider 2 approaches: using viewbag store ienumerable, not need put in view model you may consider use select list public selectlist treatmentlist { get; set; }

ios - Informing APNS about badge count -

i've implmented simple server pushing notifications ios devices , can't imagine how handle badges . i've read topics , know it's not solution handle them manually on device, it's server job... everything clear still don't know , couldn't find anywhere how let server know there unreaded notifications on device? mean in uiapplicationdelegate info beeing read? just guys imagine problem: application running in foreground , receives push notification. user doesn't enter app badge visible. after 5 mins comes notification (again badge value set 1 in payload). and scenario happen many times apns still pushing payload same value badge. the number of badges can obtained method [application applicationiconbadgenumber] inside application:didfinishlaunchingwithoptions: method. hope helps! update: after clarifying question, i'll update answer accepted solution. future searchers: what if backend increase badge every time when

android - Is it possible to make a complex ListView's divider? -

is possible make divider drawable consists of 3 images - 2 ends of lines , middle should stretch. idea make @ layout - have ends fixed size - wrap_content , middle part stretched. is possible - make in xml drawable or programmatically? thx in advance like pskink said, can use 9patch drawable divider. convert bitmap 9patch, use draw9patch utility in tools directory in android sdk. drag bitmap draw9patch app window, draw black line on top of stretchable area (on topmost pixel line). once done, save bitmap 9 patch (e.g. your_divider.9.png) , use drawable listview: <listview android:divider="@drawable/your_divider" ... /> more info on 9-patches available here: http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch

c# - login using ADO.NET Entity Data Model -

net entity data model data form users table has foreign key usertypeid table usertypes the code works fine want code data form tow tables tow tables have foreign key called usertypeid ex table1(foreign key usertypeid) table2((foreign key usertypeid)) var result = _datamoel.users.firstordefault(i => i.username.equals(txtuser.text) && i.password.equals(txtpass.text)); if (result != null ) { result.usertypereference.load(); session["username"] = txtuser.text; if (result.usertype.typename.equals("admin")) response.redirect("admin/adminhomepage.aspx"); else if (result.usertype.typename.equals("clerk")) response.redirect("clerk/clerkpage.aspx"); } else lblmsgw.text = "username/passsword not correct! please change username/passsword , try again";

sails.js - Is it possible to lift a SailsJS app synchronously? -

it handy testing . it avoid boilerplate of having lift app on every spec. my current code: beforeeach(function(done) { sails.lift({ log: { level: 'error' } }, function(err, sails) { app = sails.express.app // beforeeach related stuff done() }) } i want put on specs_global.js : app = sails.lift({ log: { level: 'error' } }).express.app edit: my problem beign unable lift sails syncronously the problem want instanteate sails once all specs, expensive task , want integration specs run fast possible. want avoid boilerplate of calling sails lift on each of specs files. no, sails.load , sails.lift both asynchronous. you're doing right thing in test (just make sure call sails.lower in aftereach method). take @ current sails integration tests example of how it. keep in mind might not need lift , lower before each individual test--in cases might okay lift once before suite runs , use instance tests. in case, can use

bouncycastle - XAdES BES timestamp verification error -

i trying use xades4j library verification uses bouncycastle xades-bes , getting following stacktrace: xades4j.verification.timestampinvalidsignatureexception: verification failed property 'signaturetimestamp': invalid token signature @ xades4j.verification.timestampverifierbase.getex(timestampverifierbase.java:114) @ xades4j.verification.timestampverifierbase.verify(timestampverifierbase.java:89) @ xades4j.verification.timestampverifierbase.verify(timestampverifierbase.java:38) @ xades4j.verification.qualifyingpropertiesverifierimpl.verifyproperties(qualifyingpropertiesverifierimpl.java:59) @ xades4j.verification.xadesverifierimpl.getvalidationdate(xadesverifierimpl.java:250) @ xades4j.verification.xadesverifierimpl.verify(xadesverifierimpl.java:174) @ com.signapplet.sign.signcomponent.verify(signcomponent.java:663) caused by: xades4j.providers.timestamptokensignatureexception: invalid token signature or certificate @ xades4j.provider

swing - java help, Total and Enter buttons in the class are not working, I tried to review the action listener for both buttons -

/** java class works sales simulator, have difficulty working total , enter buttons, problem total , enter buttons, cannot figure why these buttons not working!! */ // import applications java library import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.text.*; // starting cashregister class public class cashregister extends jframe { //initiate value double subtotal = 0.0; // stores subtotal of items purchased // jlabel , jtextfield enter amount private jlabel amountjlabel; private jtextfield amountjtextfield; // jbuttons enter numbers in amountjtextfield private jbutton onejbutton; private jbutton twojbutton; private jbutton threejbutton; private jbutton fourjbutton; private jbutton fivejbutton; private jbutton sixjbutton; private jbutton sevenjbutton; private jbutton eightjbutton

yql - Yahoo Finance API reports incorrect quotes (so it seems) -

i retrieving quotes yahoo finance today, , received strange values. consider following query: http://query.yahooapis.com/v1/public/yql?q=select%20date%2c%20open%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3d%20%22jah%22%20and%20startdate%20%3d%20%222013-03-1%22%20and%20enddate%20%3d%20%222013-04-10%22&diagnostics=true&env=store%3a%2f%2fdatatables.org%2falltableswithkeys which retrieves quotes jarden corporation, starting @ 2013/03/01, 2013/04/01. @ dates 2013/03/18 , 2013/03/19, there sudden price drop of 20 dollars. price drop not visible on yahoo finance website ( http://finance.yahoo.com/echarts?s=jah+interactive#symbol=jah;range=1y ), or other financial source matter. therefore, think quote data has wrong. fun fact if take price retrieved api @ 2013-03-18 (the last incorrect price), multiply 2/3, arrive @ price displayed on website (64.24 * 0.6666666667 = 42.16). does have slightest idea of going on here? on mar 19, 2013 there 3: 2 stock s

c# - Passing fields from a table into a Model -

i have method pass data datagridview model: for (rows = 0; rows < cview.datagridview1.rows.count; rows++) { if (cview.datagridview1.rows[rows].cells[col].value != null) { // creates model, populates each field cells in table. smodel = new supplierid_model(); smodel.xsec = convert.todouble(cview.datagridview1.rows[rows].cells[0].value); smodel.insulation = convert.tostring(cview.datagridview1.rows[rows].cells[1].value); // etc... // passes model database. } else { // passes empty fields dummy variables avoid null entries in db. supppartno = string.empty; xsec = string.empty; insul = string.empty; // etc... } } i know issue in specific instance have 2 empty lines @ bottom of datagridview, causing else not implemented properly. comes smodel.xsec = convert.todouble... , says "input string not in correct format". edit: have tried while loop, gets caught

html - Vim batch delete/replace XML tags, but not content -

i have set of xmls , want remove or replace of tags ie) <name>john doe</name> , want left john doe or john doe, thanks help for exact textual match of <name>john doe</name> , can use following :substitute command: :%s#<name>\(john doe\)</name>#\1#g this capture name inside tag (assuming contents can different), , replace entire match first captured group ( \1 ). for more information, :help :substitute has details. learn how commands , navigate built-in :help ; comprehensive , offers many tips. won't learn vim fast other editors, if commit continuous learning, it'll prove powerful , efficient editor. this basic substitution works in vim sed . automated processing of multiple files, i'd prefer latter. a stern warning parsing xml regular expressions note xml rather complex format many equivalent representations. regular expressions not powerful enough correctly process possible variants. it's alright qui

How to use remote location property file in spring re loadable message resource in java -

i have distributed system 8 app servers running tomcat on it. spring application. want use property file located on others server tomcat read there only. using reloadableresourcebundlemessagesource use auto refreshing feature. bean definition <bean id="messagesource" class="org.springframework.context.support.reloadableresourcebundlemessagesource"> <property name="basenames" > <list> <value>file:///192.168.1.10//var/ratelimit</value> </list> </property> <property name="cacheseconds" value="60"></property> </bean> and calling property this system.out.println(messagesource.getmessage("testprop", null, null)); i not load file using ip address. could please me on this. this use read external properties file on http: <bean id="messagesource" class="org.sprin

javascript - jQuery UI Draggbles - constrain movement by NOT allowing drag inside an area -

i'm using jquery ui draggables on page, drag words relevant boxes. http://marmiteontoast.co.uk/fyp/login-register/register-username-builder.php js fiddle it uses constrain keep within general div of page, can't drag outside area. as (hopefully) obvious, intended drag 1 green word green box, 1 purple purple etc. however, want couple of things. using constrain round other way. want not allow dragging boxes colours e.g: word (1) can dragged box (1) only. hit edge of purple box. same goes other colours. try , drag them wrong box , they'll stopped @ edge. if statement once item dragged box, nothing can dragged again. unless remove word, useable again (to limit 1 word per box). this basic code have far draggables: // draggies $( ".draggable" ).draggable({ containment: "#dragarea", scroll: false }); $( ".slot.one" ).droppable({ drop: function() { $(".tick.one").fadein("fast"); } }); $( ".slot.two&

c# - Return value from a method if the method throws an exception -

it's monday again , have question c# basics. happens return value method if method throws exception? specifically, happening "under hood" when exception being thrown inside method , effect have on return value? in situation, how return value calculated internally? let's there 2 scenarios: 1 return value of type int , of type object . default(t) going called internally when exception occurs? in such case, should consider return value of type int 0 while return value object null ? the short, oversimplified answer it won't return anything . code "breaks" wherever exception occurs , goes down stack until catches it. even if do happen catch exception, variable tried initialize method's return value remain before method called: var = 5; try { = mymethodthatthrowsanexception(); } catch { // @ point, variable still equals 5. } i should mention shouldn't feel concerned function's return value if throws exception. if

Bash how to check if a string is a number(can be negative) -

this question has answer here: how test if variable number in bash? 34 answers i want check if string number, tried way: if ${string} == *[!0-9]* else echo number but when have negative number, says it's not number, , want work negative numbers too. try script #!/bin/bash string=$1 if [[ "$string" =~ ^(-)?[0-9]+$ ]]; echo 'number' else echo 'not number' fi this works integers. if want match , decimal number use test "$string" =~ ^-?[0-9]+(\.[0-9]+)?$

ios - Set the header in ASIHTTPRequest -

i'm using asihttprequest access web based api , need set header app authentication. note not server level authentication @ api level. i've tried every thing find , of answers on web ones here @ www.stackoverflow.com tell me use like: [request addrequestheader:@"username" value:@"asdf"]; this not work me. guy built api i'm using told me need set header as: authorization: truerest username=personname&password=pass&apikey=dfiu6aewruif3bismillah4rah3anarahimiimi22mydad so tried following: nsurl *url = [nsurl urlwithstring:@"http://ifish-uk.co.uk/rest_users/login.json"]; asihttprequest *request = [asihttprequest requestwithurl:url]; [request addrequestheader:@"username" value:@"myuser"]; [request addrequestheader:@"password" value:@"mypass"]; [request addrequestheader:@"apikey" value:@"dfiu6aewruif3bismillah4rah3anarahimiimi22mydad"]; but didn't work... tried s

nuget - VSIX dependency based on visual studio version -

i had created visual studio extension (vsix) compatible vs2010 , vs2012. had nuget package manager dependency. want make compatible vs2013. added vs2013 supported products. but, istallation fail. apparently, nuget team have changed identfier vsix extension vs2013. cannot change identifier new 1 affect vs2010/12. <references> <reference id="nupacktoolsvsix.microsoft.67e54e40-0ae3-42c5-a949-fddf5739e7a5"> <name>nuget package manager</name> <moreinfourl>http://docs.nuget.org/</moreinfourl> </reference> </references> is there way add depndencies vsix based on visual studio version. can add 1 more reference nuget vs2013. or there workaround this? the new identifier vs2013 nuget extension nuget.67e54e40-0ae3-42c5-a949-fddf5739e6a5 you can either of following: remove reference nuget extension. result in risk of package load errors or other errors if users not have nuget installed, or if hav

javascript - Character counter supposed to cut text off but does not when it is copied in -

i have character counter cuts off text , doesn't allow user keep typing once maximum limit has been reached. works when text being entered reason when text greater max copied in cuts off of text , means the count still greater max. displays 0 characters remaining when copied in when count characters still greter max. function textcounter(field,field2,maxlimit) { var countfield = document.getelementbyid(field2); if ( field.value.replace(/\n/g, "\n\r").length > maxlimit ) { field.value = field.value.replace(/\n/g, "\n\r").substring( 0,maxlimit).replace(/\n\r/g, "\n"); } else { countfield.value = maxlimit - field.value.replace(/\n/g, "\n\r").length; } } above javascript function. when text copied in greater max cuts text off @ correct part form can submitted. generally speaking, i'd take @ maxlength attribute. http://www.w3schools.com/tags/att_input_maxlength.asp specifically speaking, guess code not bei

asp.net - IIS URL Rewrite Rule - IIS 7 -

i've following functional asp.net url: www.netway.com/z/about.aspx , want shorten url www.netway.com/about . when users type www.netway.com/about in browser, point www.netway.com/z/about.aspx . i've tried following rewrite rule it's not working: <rewrite> <rules> <rule name="shorter url"> <match url="about" /> <action type="rewrite" url="z/about.aspx" logrewrittenurl="true" /> </rule> </rules> </rewrite> hi can please following link. it's showing way remove .aspx extensions. http://forums.iis.net/p/1150350/2003891.aspx you can following also. http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

osx - Qt Creator Error Messages Mac OS 10.9 -

"cannot create file /users/[username]/.config/qtproject/qtcreator/qtversion.xml: no such file or directory" i message 4 or 5 times upon startup. did clean install today. different permission problem error found earlier on here. installer did not create .config file or cannot see or access it. how fix error?

What is the correct way to navigate using the Twitter Bootstrap Navbar? -

i creating webpage using twitter bootstrap 3. instinct using navbar have each item navigate new href. however, i've seen handled in different ways. some pages navigate new href , trigger page load, presumably using template of sort use same navbar code across html pages, discussed in this question . other pages i've seen appear hiding or displaying divs content. @ first glance appears come tradeoff--on 1 hand, once loaded, can have snappy, responsive page. on other, initial page loads end being huge on large website. other pages use navbar items scroll particular place in tall page. when use these pages, find navigation not using navbar items disorienting. solution, too, imagine becomes less attractive page size increases. still others use navbar items add query parameter reloads page. i'm not sure how these it, , least common approach i've found. my question is: "bootstrap way" it? no doubt valid. there discussion somewhere of tradeoffs , motiva

jquery - display days of the week javascript -

i display in list days of week. current day want display word today. how can javascript? <ul class="week-days"> <li><a href="#"><span id="firstd">today</span></a></li> <li><a href="#"><span id="secondd">tue</span></a></li> <li><a href="#"><span id="thirdd">wed</span></a></li> <li><a href="#"><span id="forthd">thu</span></a></li> <li><a href="#"><span id="fifthd">fri</span></a></li> <li><a href="#"><span id="sixthd">sat</span></a></li> <li><a href="#"><span id="seventhd">sun</span></a></li> </ul> you can accomplish adding @ bottom of page

java - Android LinearLayout, last added children stealing click for onClickListener -

setup: i have custom linearlayout has textview , imageview inside (my attempts resolve issue commented out): public class mytextview extends linearlayout { private final textview textview; private final imageview imageview; public mytextview(context context, attributeset attrs) { super(context, attrs); setorientation(vertical); textview = new textview(context); imageview = new imageview(context); layoutparams layoutparams = new layoutparams(layoutparams.match_parent, layoutparams.wrap_content); imageview.setlayoutparams(layoutparams); imageview.setimageresource(r.drawable.img); /* imageview.setduplicateparentstateenabled(true); textview.setduplicateparentstateenabled(true); */ /* imageview.setfocusable(false); textview.setfocusable(false); textview.settextisselectable(false); */ addview(textview); addview(imageview); /* thi

Constructor not called c++ -

i have code in dll: game::game(int width, int height) : world(width, height), renderer("game", 800, 600), font(), text(), keyboard() { // code } keyboard pointer keyboard object. code inside constructor called, keyboard object remains null. why object not being created? the keyboard constructor: keyboard() { = new key('a'); b = new key('b'); c = new key('c'); d = new key('d'); e = new key('e'); f = new key('f'); g = new key('g'); h = new key('h'); = new key('i'); j = new key('j'); k = new key('k'); l = new key('l'); m = new key('m'); n = new key('n'); o = new key('o'); p = new key('p'); q = new key('q'); r = new key('r'); s = new key('s'); t = new key('t'); u = new key('u'); v = new key('v'); w = new key('w'); x = new key('x&

selecteditem - Handling selected item changed in mvvm from a user control -

i have user control defined in separate project (to reuse) has 2 comboboxes , button. using user control in other projects. user control has view model class. view model class handles selected item changed in combobox , has command delegate handle button click. now question when use user control within control in project want event raised within owning control whenever new item selected in combobox. also, when button clicked in resuable control want event raised in owning control can execute additional logic. can suggest best way handle this? thanks, ranjith

ember.js - extending EmberDefaultResolver with Ember-App-Kit -

i'm making custom resolver based on pattern below robin ward [ video / 15sec] trick have mobile device "mob_template.hbs" first before loading "template.hbs" app.resolver = emberdefaultresolver.extend({ resolvetemplate: function(parsedname){ var t = this._super(parsedname); if app.mobileactive){ return this._super('mob_' + parsedname) || t; } return t; } }); however i'm using ember app kit , uses special version of resolver : i can't tell what's going on in there or need produce similar functionality. have idea? i've tried results in nothing being resolved: var app = ember.application.extend({ //... resolver: ember.defaultresolver.extend({ resolve: function(fullname) { var parsedname = this.parsename(fullname), resolvemethodname = parsedname.resolvemethodname; if (!(parsedname.name && parsedname.type)) { throw new typeer

jsp - Accessing c:var variable inside sql:param -

i facing problem in accessing jsp "core tag" in jsp "sql tag" query. code : <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %> <sql:setdatasource var="myds" driver="org.postgresql.driver" url="jdbc:postgresql://localhost:xxxx/xyz" user="xyz" password="test123" /> <% string user_email = session.getattribute("email").tostring(); out.println("email = "+ user_email); %> <c:set var="emailid" value= "${user_email}"/> <sql:query var="listusers" datasource="${myds}"> select * developer_apikey_registration email_id = ? ; <sql:param value="${emailid}"/> </sql:query> i not able email value here. although checked coming correctly in session attri

How to load thread support in C++ with cmake and Android NDK -

i have problem using threads in application. writing c++ files, used in android, compiled ndk , cmake. have no idea how load thread support. there have write cmakelists or makefile or that? absolute beginner in writing c++ code... if using cmake android, e.g. https://github.com/taka-no-me/android-cmake , enable std::thread should specify android_toolchain_name=arm-linux-androideabi-4.8 and android_stl=gnustl_static (or gnustl_shared ),