Posts

Showing posts from May, 2012

node.js - Resetting a Node application to a known state when testing with supertest -

i write black box tests against node applications using supertest. app loads database fixtures , black box tests exercise database strenuously. i'd reset app state between tests (so can run different combinations of tests without having worry particular database state). the ideal thing able reload app another: var app = require(../app.js).app; but happens once when run mocha (as should require calls). think can wrapping tests in multiple mocha calls batch file, developers used running npm test , , them keep doing that. how this? the require function cache result , won't re-run module. can delete module cache: delete require.cache[require.resolve('../app')]; if didn't work, can try resetting whole cache: require.cache = {} but might introduce bugs, because modules developed in way thinking executed once in whole process runtime. the best way fix write module minimum global state, means instead of storing app module-level value , requ...

Crossreferencing in xtext - also for native types -

i'm trying set xtext grammar has following characteristics. sketch(!): class: properties += property* ; resource: properties += property* ; link : // no classes here, no common resource , class [resource] <-> [resource] ; basictype: 'int' | 'long' ; property: // not supported name ':' basictype | [resource] | [class] // tried // name ':' eobject ; my question is: how can solve situation, crossreference property type 'resource' or 'class' or basictype? i tried eobject basetype , resolve crossreferences in custom scopeprovider , dont know how use basictypes (int or long) type properties. first can introduce common supertypes defining rule dont call parent: child1 | child2 then can reference things defined somewhere else. have define them explicitely or change grammar xtext entity example, primitive type

wso2is - Update user password methods breaks in external Read Write LDAP mode of WSO2 Identity Server -

i using external apacheds ldap wso2 is. can update user password via management console well. works fine. tried use useradmin service this. used changepasswordbyuser method in that. have consumed service using soapui. can send first update request fine. looked @ ldap , update succeeded. can log in management console using updated password. when tried update second time onwards using updated password, sends response, <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:body> <soapenv:fault> <faultcode>soapenv:server</faultcode> <faultstring>can not access directory service</faultstring> <detail> <ns:useradminuseradminexception xmlns:ns="http://org.apache.axis2/xsd"> <useradminexception xsi:type="ax2627:useradminexception" xmlns="http://org.apache.axis2/xsd" ...

java - Disabling of all GWT child widgets works strange -

i need disable childs widgets of custom panel. have such method this: public static void disablechilds(widget widget) { if(widget instanceof haswidgets) { iterator<widget> iter = ((haswidgets) widget).iterator(); while(iter.hasnext()) { widget element = iter.next(); //window.alert(element.getclass().tostring()); if(element instanceof hasenabled) { ((hasenabled) element).setenabled(false); } disablechilds(element); } } } the problem code works on firefox(24.5.0) , if window.alert(element.getclass().tostring()); is uncommented. not want work on chrome(35.0.1916.114) @ all. i grateful help.

symfony - Different versions of PHP on OS X 10.9 -

i trying symphony framework installed on laptop (running os x 10.9 mavericks), far can't started because of error messages the first thing not being error seems have multiple versions of php running , remove except latest version (5.5.12). can please tell me how can achieve this? i compiled , built newest version of php source , installed (which should replace original version), seeing 2 different versions when using phpinfo() webpage , php -v command line: phpinfo(): php version 5.4.24 php -v: php 5.5.12 (cli) (built: may 29 2014 11:21:46) i compiled , built newest version of php source , installed (which should replace original version), seeing 2 different versions when using phpinfo() webpage , php -v command line: php command line 100% different php loaded via apache module. wiping out old version won’t solve issue & might cause other issues. don’t ever attempt that. instead install version of php want run , edit apache config load proper...

Where and how ASP.NET MVC 5 implement jQuery/AJAX validation during registration and Login -

i using built-in mvc 5 template in visual studio 2013. far saw, mvc 5 framework seems it's implemented jquery/ajax validation during registration , login, because when tried input invalid data account and/or password fields, error messages appear without refreshing page. so can please explain how mvc 5 framework achieve effect? guess using css classes? as of mvc3, using jquery's unobtrusive validation , described in blog post brad wilson . post walks through how unobtrusive validation works, , how ms applies attributes fields.

SAS proc tabulate questions -

my dataset looks this: id var1 var2 var3 1 0 1 b 0 0 1 b 1 1 0 0 0 0 1 1 1 my expected output be: id var1 var2 var3 2 1 3 b 1 1 1 can this? i've not access sas right try following:- proc tabulate data = in; class id; var var:; table id, sum=''*(var1 var2 var3); run;

How to tint an Android bitmap in White? -

i want colorize bitmap different colors. this se question able tint different colors when draw on canvas. paint p = new paint(color.red); colorfilter filter = new lightingcolorfilter(color.red, 1); p.setcolorfilter(filter); but seems not work color.white (maybe because bitmap colorized in 1 color). want have white shape of original bitmap (only transparent + white) ok. reply here people might face problem. in order keep shape of bitmap, , colorize need use porterduffcolorfilter instead of lightingcolorfilter used initially. filter = new porterduffcolorfilter(color.white, porterduff.mode.src_atop); mpaint.setcolorfilter(filter); the second parameter porterduff.mode , can find complete list here

ssl - Apache not checking crl for revoked certificates -

i'm having issue can't identify cause of. i set-up testing purposes local ca , webserver in virtualbox under ubuntu. i'm willing try client certificate-authentification. i got far, can't access webserver without having valid certificate in browser. the problem is, after revoking certificate, still access server. in default-ssl.conf (which loaded) have set : sslcarevocationfile /etc/ssl/ca/crl/crl.pem "crl.pem" created using "openssl ca -gencrl /etc/ssl/ca/crl/crl.pem" openssl crl -in /etc/ssl/ca/crl/crl.pem -text generates following : certificate revocation list (crl): version 2 (0x1) signature algorithm: sha256withrsaencryption issuer: /c=au/st=some-state/o=internet widgits pty ltd last update: may 29 13:10:55 2014 gmt next update: jun 28 13:10:55 2014 gmt crl extensions: x509v3 crl number: 4106 revoked certificates: serial number: 01 revocatio...

javascript - How to get DOM from xul file? (not overlay) -

<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="&loading_title;"> <description id="loading_description" flex="1">&wait_msg;</description> </window> how loading_description? (firefox extension) i tried: firebug.console.log(document.getelementbyid('loading_description')); result null. thanks in advance.

c++ - Multiple Insertion Points wxWidgets -

basically, want make similar "split lines" in sublime using wxwidgets. our textctrl contains text aaaaaa bbbbbb cccccc ffffff what want when user selects these lines , uses feature (with highlighted - select all), should like aaaaaa| bbbbbb| cccccc| dddddd| where | carets. basically, want have multiple carets in 1 wxrichtextctrl. idea how can achieve that? wxrichtextctrl doesn't support this, wxstyledtextctrl does, see scintilla documentation .

sql server - Conditional WHERE clause to combine two queries -

i have large select into statement in t-sql script , have 2 separate select into 's differing 1 or condition in where clause. if variable @cycle_nbr = 1 have doing 1 select into , if @cycle_nbr = 0 have doing other select into . i wondering if there way in 1 select into @cylce_nbr condition in where itself. here where clause: where ((a.gl_indicator = '0' or a.gl_indicator = '1') , (a.gl_ins_type = '1' or a.gl_ins_type = '3' ) , rel_file_nbr null , a.alpha_line not '%z' , mis_process_dt >= @start_dt , acctg_cyc_ym = @acctg_cyc) or (a.prem_sys_cd='t' , acctg_cyc_ym = @acctg_cyc ) i want last condition or (a.prem_sys_cd='t' , acctg_cyc_ym = @acctg_cyc ) in there if @cycle_nbr = 1 . can put if in there somewhere make work? or have stick if(@cycle_nbr = 1) run select else run other select ? include variable in or statement, i.e., or (a.prem_sys...

excel vba - Replacing a range based on criteria using a macro vba -

thank in advance. pretty new vba trying have single column of cells copied 1 column , pasted number based on single criteria, can change. have list in column e , list in column f. want able pull data cells in column e based on adjacent cell in column f. basically, whatever name type "l7", macro pull data column e corresponds name. have far: private sub worksheet_change (byval target range) if target.value = "" exit sub dim rn rn = 15 if target.row = 7 , target.column = 12 each cel in range("e:e") if cel.offset(0,1).value = cel.value range("l" & rn).value = cel.value rn = rn+1 end if next cel end if end sub now, want do. works if change name in cell "l7". problem not replace data previous time macro ran. if have list of 20 names , 10 names , run macro pull list of 20 names first, won't clear out names list when pull second. i attempted several different t...

selenium - Tests running silently without window appearing -

Image
apologies, i'm still new selenium please bear me explain this. currently selenium tests running on remote machine no window opens when i'm remotely logged machine! my setup is: remote machine has 2 admin users selenium grid2 , node windows service. machine running windows server 2012 services having interactive services enabled. i using selenium 2.42.1 iedriver version 2.42.0 tests being built , run remotely on our build server. i think that's everything, if there's more information please let me know i'd know why cannot view tests running. just clarification, tests running , pass or fail necessary, can't see if i'm remote logged machine. update there has been interesting progress on issue still no resolution. decided try , run node command line , funny enough tests run no problems , browser window displayed. so if has idea why browser window appear when running node command line not when running node service great. i'm using jav...

google api - GA API: Request a new refresh token with valid access token -

i came app didn't handle google analytics api omniauth revoke correctly , have slew of users have revoked information , when reauthorizing our app don't the permission window our app approved. the issue i'm having when "reauthorize" out asking permission receive valid access token refresh token doesn't come it. understandable parameter sent on initial permission grant. is possible create curl request ga refresh token valid access token? to force reauthorization, can set approval_prompt parameter force . need set access_type parameter offline new refresh token.

javascript - Value not changing when radio button is pressed - AngularJS -

what i'm trying when product selected different types of product brought in browser. here's got: script.js function showctrl($scope, $http) { $scope.products = [ { "category":"pens", "label":"p1", "images":"d-u-b/pens.png" }, { "category":"cozies", "label":"p2", "images":"d-u-b/cozie.png" } ]; $scope.prod = {"name": "cozies"}; $scope.typselect = 'plain'; $http.get("products/"+$scope.prod.name+".json").success(function(data){ $scope.type = data; }); } customo.php(code snippet being called) <div class="pro" ng-repeat="product in products"> <label for="{{product.label}}" class="p"> <input id="{{product.label}}" type="radio" ng-model="prod.name" name="name" value="{{product...

image - java moving jlabel with picture inside other jlabel bounds -

im programing game in netbeans in java have 2 jlabels first jlabel1 want move around because has figure picture usualy use jlabel1.setlocation(x,y); // problem focuses on whole frame , starts coordinates upper-left corner of frame i want coordinating within jlabel2 wich has picture inside coordinate 0,0 on upper-left of jlabel2 (upper-left of jlabel2 picture) possible , how tnx answers i figured out first int x=jlabel2.getx(); int y=jlabel2.gety(); so start coordiante @ coordinates of jlabel2 and add desired x , y related picture int desired_x=20; int desired_y=20; jlabel1.setlocation(x+desired_x,y+desired_y);

html - specify class AFTER pseudo element in CSS -

is there anyway specify class after pseudo element? example, want find :last-child of parent - , if child has x-class, style accordingly. scss, relatively easier, project i'm working on doesn't use sass. any ideas? here's trying do...which obvs wrong: form .entry-form-wrap :last-child.nested-tmpl-inner html complex post, i've included general block of code give idea of flow: <form> <div class="entry-form-wrap"> <div class="some-class" /> <div class="some-class" /> <div class="some-class nested-tmpl-inner" /> </div> </form> it's not obvs wrong. can specify class right after pseudo, :pseudo.class . check fiddle: http://jsfiddle.net/fyy4t/

postgresql 9.1 - ActiveRecord::StatementInvalid: PG::DatatypeMismatch: ERROR: column is of type integer[] but default expression is of type integer Rails 4.1.1 -

i using rails 4.1.1 , pg (0.17.1) gem having error while running migration activerecord::statementinvalid: pg::datatypemismatch: error: column "page_ids" of type integer[] default expression of type integer here migration code class createpages < activerecord::migration def change create_table :pages |t| t.string :name t.integer :page_ids, array: true, null: false, default: '{}' t.timestamps end end end the array: true not working try: t.integer :page_ids, array: true, null: false, default: []

jquery - Assistance with z index causing various errors -

please have @ webpage - http://dev.topyaps.com/how-awesome-are-you this post built wordpress plugin developed. facing various issues because of z index property of elements. issues - 1) on scroll menu merges floating bar on page. css of menu - kodda_container { z-index: 999 !important; width: 1220px; height: 40px !important; background-color: ; border-top: solid transparent; border-right: solid transparent; border-bottom: solid transparent; border-left: solid transparent; background-image: -webkit-linear-gradient(top, transparent, transparent); } css of floating bar - .scorebox { background: #fafafa; border: 1px solid #d1d1d1; width: 100%; z-index: 997; } 2) on clicking submit button center box appears. center box has on top while hides. css of center box - element.style { padding: 6px; word-wrap: break-word; position: fixed; top: 50%; left: 50%; margin-top: -18px; margin-left: -206px; z-index: 999; display: block...

Elasticsearch - How to boost score by the results of an aggregation? -

my use case follows: execute search against products , boost score salesrank relative other documents in results. top 10% sellers should boosted factor of 1.5 , top 25-10% should boosted factor of 1.25. percentiles calculated on results of query, not entire data set. feature being used on-the-fly instant results user types, single character queries still return results. so example, if search "widget" , 100 results, top 10 sellers returned boosted 1.5 , top 10-25 boosted 1.25. i thought of using percentiles aggregation feature calculate 75th , 90th percentiles of result set. post /catalog/product/_search?_source_include=name,salesrank { "query": { "match_phrase_prefix": { "name": "n" } }, "aggs": { "sales_rank_percentiles": { "percentiles": { "field" : "salesrank", "percents" : [75, 90] } } } } this gets me f...

java - Cant create activity in Dialog Fragment -

i have activity 2 imagebuttons. activity extended dialogfragment. whenever trying create intent like: intent in = new intent(this, chatactivity.class) it giving error suggestion remove arguments. how can create these intents on imagebuttons? votingactivity.java public class votingdialog extends dialogfragment{ private imagebutton isupport; private imagebutton iagainst; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate){ final view view = inflater.inflate(r.layout.activity_voting_dialog, container); getdialog().requestwindowfeature(window.feature_no_title); final imagebutton isupport = (imagebutton) view.findviewbyid(r.id.isupport); final imagebutton iagainst = (imagebutton) view.findviewbyid(r.id.iagainst); isupport.setonclicklistener(new onclicklistener() { @override public void onclick(view view) { // todo auto-generated meth...

ios - How to programmatically display a view -- with an "x" button to close the view? -

i trying programmatically display view containing image , "x" button -- in code labeled *btndismiss -- close view. here issue: code display image , "x" button. however, clicking "x" button doesn't close view -- both image , "x" button remain visible. i'm new xcode, please provide verbose responses (if leave out answer, might not able fill in blanks!) note: if have solution how show imageview "x" button make both imageview , "x" button disappear, welcome. here code: #import "xyzviewcontroller.h" @interface xyzviewcontroller () @end @implementation xyzviewcontroller - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. uiviewcontroller *vc = [[uiviewcontroller alloc] init]; [self presentviewcontroller:vc animated:yes completion:nil]; uiimageview *bgimage = [[uiimageview alloc] initwithframe:cgrectmake(5, 5, 200, 200)]; bgima...

mysql - PHP/SQL Check if a similar entry already exists in the database -

i have search on website , im trying show list of popular search terms on site sort of works isn't matching strings close enough. this i'm using: $sql = "select * db r_name '%".$searchname."%' or r_number '%".$searchname."%' however if user searches game name , searches game name (reviews) add 2 entries database, there way similarity test before entering entry ? yes, there way requires fiddle little. there search called soundex, match things close. might not perfect solution question, might started in right direction. select * db soundex( db.r_name ) soundex( '{$searchname}' ); i believe if have entry 'lowercasexd' , , soundex like('what lowercasexd?'), find entry that's associated 'lowercasexd'. aware type of search take little while run compare '=' searches on indexed databases(on database 5-6k entries per second) not recommended big. if want near-perfect solution,...

javascript - Jquery to check the height of all children -

this question has answer here: use jquery/css find tallest of elements [duplicate] 3 answers <a href="#" class="button">button</a> <div class="parent"> <div class="child">content 01</div> <div class="child">content 02</div> <div class="child">content 03</div> <div class="child">content 04</div> <div class="child">content 05</div> </div> here's html, have written rollover a.button , div.parent visible, , on rollout, div.parent 's visibility set hidden. i write script that, on a.button hover, jquery checks each height of div.child in div.parent , figures out tallest, , sets div.parent 's height. i know there each loop, don't know how , compare values. than...

javascript - CSS and active state nav elements -

Image
making active nav element menu isn't difficult, here example. http://jsfiddle.net/6neb6/38/ <ul> <li><a href="" title="home">home</a></li> <li class="active"><a href="" title="deals">deals</a></li> <li><a href="" title="support">support</a></li> <li><a href="" title="contact">contact</a></li> </ul> css: html { filter: expression(document.execcommand("backgroundimagecache", false, true)); } ul { background: url(http://shared.web2works.co.uk/tmp/tab-bg-top.png) no-repeat; height: 51px; font-family: arial; font-size: 14px; } ul li { float: left; height: 51px; } ul li { display:block; background: url(http://shared.web2works.co.uk/tmp/nav-seperator.gif) no-repeat top right; padding: 17px 20px 17px 21px; text-dec...

xml - java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x12 in android -

i'm getting above error xml below. issue? <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/question" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="20dp" android:layout_margintop="20dp" android:text="what name?" android:textcolor="@android:color/black" /> <radiogroup android:id="@+id/answer_group" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/question" android:layout_marginleft="20dp" android:layout_margintop="10dp" > <relativelayout ...

javascript - How to match this regex or null? -

i have javascript function validates user input shown below: function validaterugsize(rug_size) { var regex = /^(\d{1,2})(\')? (\d{1,2})("|\'\')? (x|x)? ?(\d{1,2})(\')? (\d{1,2})("|\'\')?$/; return regex.test(rug_size); } which gets called here: if (!validaterugsize(rug_size[i])) { $("#sizelabel" + i).text("please enter valid rug size."); $("#sizelabel" + i).css("color", "red"); $("#size" + i).focus(); return false; } else { $("#sizelabel" + i).text(""); } i want user's input valided if user enters value there. don't want require input, however. how can done? you need add condition: if((rug_size[i].length > 0){ if (!validaterugsize(rug_size[i])) { $("#sizelabel" + i).text("please enter valid rug size."); $("#sizelabel" + i).css("color", "red...

c - How do you configure XCode to find header files and symbols in an "External Build System" project -

i'm trying set xcode 5.1 project c php-extension development. gnu autoconf/automake project 1 prerequisite step. i created new "external build system" project. made 2 targets, 1 runs prerequisite "phpize" command creates gnu autoconf files. have target runs gnu ./configure script. works great. next, tried adding .c , .h files project. when open them, , try click on #include .h file or external symbol, xcode says "symbol not found", system stuff <stdio.h>. in normal xcode project, there way configure header/include search paths. external build system project, see no way this. my questions: for project uses ./configure , make, "external build system" project type correct type? if so, in project type, how set header/include search paths code navigation works? analyze doesn't seem work right, either.

javascript - How to decode character entity references -

i know unescape can convert %u6f22%u5b57 漢字: unescape("%u6f22%u5b57"); but how can convert &#x6f22;&#x5b57; 漢字? if can provide hints, i'll happy. regular expressions rescue! var input = "&#x6f22;&#x5b57;"; return unescape(input.replace(/&#x(\w{4});/g, '%u$1'));

Documentation for Google Analytics Tracker -

i'm using google analytic's tracker android, , i'm having trouble finding documentation of tracker's methods online. particularly, i'd documentation sendevent(). the tracker in com.google.analytics.tracking.android.tracker which version of sdk using? if it's v4 can find documentation , example here: https://developers.google.com/analytics/devguides/collection/android/v4/events

How can I color code a graph in Excel using VBA, using the RGB mix? -

i use vba modify color in graph/chart in excel based on values in 3 cells (correlated rgb). for example, cells a1 (red), a2 (green), , a3 (blue) each have value correspond color. based upon values, bar graph color change whatever rgb color indicated. 115-20-110 give me pink bar color. i have activechart.seriescollection.interior.color = rgb(a1, a2, a3) but don't know vba , isn't working. appreciated, , if there less obtuse way interested of course. thank you try: activechart.seriescollection(1).interior.color = rgb(range("a1").value, _ range("a2").value, _ range("a3").value) seriescollection represents of series on chart - need pick 1 color...

javascript - JS - Promise + geolocation.watchPosition -

i'm trying use javascript promise geolocation, can't make work correctly geolocation.watchposition , then clause being called once : function geolocation() { this._options = { enablehighaccuracy: true, maximumage : 10000, timeout : 7000 } } geolocation.prototype = { watchid() { return this._watchid; }, set watchid(watchid) { this._watchid = watchid; }, options() { return this._options; }, // hascapability: function() { return "geolocation" in navigator; }, _promise: function(promise) { var geolocation = this; if (promise == "getposition") return new promise(function(ok, err) { navigator.geolocation.getcurrentposition( ok.bind(geolocation), err.bind(geolocation), geolocation.options ); }); else if (promise == "watchposition") return new promise(function(ok, err) { geolocation.watchid = navigator.geolocation.watchposition( ...

Php / Mysql number formating -

this question has answer here: print currency number format in php 5 answers i trying have output displayed commas in number. sure im being stupid cannot think of how make work. looking format number output prices. appreciated. echo "</tr></table><br>"; echo mysql_result($result,$i,"shortdescription")."<br><br>"; echo "<div style=\"background-color:#fdffdb\">"; echo "<table border=1 cellpadding=5>"; echo "<tr>"; echo "<td class=txt width=200><b>price low season</b><br><i>may 15th - nov 30th</i></td>"; echo "<td class=txt width=200><b>price high season</b><br><i>dec 1st - may 14th</i></td>"; ...

regex - Two regular expressions in C# - what's the difference? -

this question has answer here: what non-capturing group? question mark followed colon (?:) mean? 11 answers what difference between following regular expressions write(?:line)? and write(line)? i asking for: understand concept need write regular expression match following variations word international : int,tntl,international a group ?: non capturing group meaning not included in result. //will match "writeline" or "write", ignore line in result write(?:line)? //*match* -> *captured as* //writeline -> write //write -> write //will match "writeline" or "write" write(line)? //*match* -> *captured as* //writeline -> writeline //write -> write regex #2 correct me if didn't understand correctly. if want replace int or tntl international , : var result = regex.replace...

session - Hibernate ObjectNotFoundException, but object exists -

edit: error right, pay me no mind. tl;dr: when try create link between 2 instances in service, hibernate complains 1 of them isn't found, though exists. appears have started happening after upgrading grails 2.3.8. so, application call tracking application. has users , , in order know whether user available, have class called resourceavailability : class resourceavailability { def grailsapplication call callinstance user resource resourcestatus resourcestatus date datecreated // ... constraints, etc ... } (there no link user resourceavailability.) when user logs in, accepts call, or otherwise changes status, previous availability status deleted table , new status created. way can track how long has, e.g., been ready while calls waiting, or how long it's been since accepted call. without bunch of error handling code, here's meat of call controller's accept action: def accept(long id, long...

java - Accessing local files on Tomcat -

i'm using apache tomcat 7 , have servlet lists files in directory , allows users download files clicking on link. here problem: the files accessing in servlet not in project directory itself. in directory outside of tomcat directory itself i.e. project in /opt/apache-tomcat-7.0.53 files in /files/ when use anchor tag, can't reference using href="" because assumes directory within webcontent folder of project. i tried doing href="file:///files/<file name> not click on link download file must wrong. anyone know how work around this? edit: should point out isn't running on local machine. on server. you're better off looking @ tomcat aliases . let mount external directories in web app's context, , have tomcat serve file directly. addenda: the part of url before : called "scheme". examples include "http", "https", "ftp", "file". the scheme tells browser "what ...

java - Where should I store a variable that I want to access thru out my tomcat REST ws? -

i have rest webservice running in tomcat version 7 using jersey 1.18. each request comes in has custom header called 'request-id'. store request id in place classes have access request id , can use logging. the main thing is, has on per request basis. request-id request different of request b. where can store such variable? sort of context valid on per request basis - can point me in right direction? --su you can store in threadlocal . have careful it. need store on receiving request , clear when returning response. want write static utility methods store , retrieve request id that: public class requestidutil { private static final threadlocal<string> requestidholder = new threadlocal<string>(); private requestidutil() { // prevent initialization } public static void setrequestid(string requestid) { requestidholder.set(requestid); } /** * * @return requestid * */ publi...

php - Get user information from mysql database -

i'm trying easy user management. want select , display information mysql database. i have connected database , works fine. , have log in form , registration works fine. when user logged in want display information , user should able update it. can use simple thing this: <?php $firstname= $_session['user_name']; $email= $_session['user_email']; if ($email!= null) { echo $email; } else { echo 'no email found'; } ?> you leaving lot out, hard know want do, can use update statement change database values have been inserted. update users set user_email = 'some_email' user_name = 'some_user'; other i'm not sure you're asking for. whole html form?

orchardcms - Orchard Projection Page Default View -

i using orchard 1.8 , have created new content type (called pressrelease), query results , projection view query custom template (using url alternates in format list-projectionpage-url-pressrelease.cshtml ) , of working fine. the 1 part has me stumped is, if use theme machine theme (untouched), projection view show in unordered list corresponding autoroute links individual contentitem entities, metadata , on. i'm trying figure out how access things such autoroute url specific item, metadata (create/publish dates) , on use things facebook share button. i'm trying recreate default view, albeit customizations. here code list-projectionpage-url-pressrelease.cshtml : @using orchard.utility.extensions; @using system.linq @functions { public class pressrelease { public pressrelease() { this.attachments = new list<attachment>(); } public string title { get; set; } public string source { get; set; } public datetime publishdate { get; set...

c++ - Which operator i should call? -

i have little problem operators in c++. have following code: class segment{ public: double a, b; segment(double a=0, double b=0) : a(a), b(b) {} // segment operator&(const segment & d){ // segment ss; // if (d >= this.a && d<this.b) // { // return 1; // } // else{ // return 0; // } // } }; int main (){ //segment seg2(2,5); segment seg(2,3), s = 2*((seg-2)/2+seg)/3+1; pokaz(s); cout << (s(5) ? "true" : "false") << endl; } i call operator using s(5) return me true if 5 between 2 , 5 , false if not... dont know how call kind of operator.. know it's maybe noob question learning operators , need little help.. me , show how correctly call operator? fight 3 hours no effects :( you have following code: s = 2*((seg-2)/2+seg)/3+1 seg...

jQuery HighCharts: DateTime X Axis Data label issues -

i have bunch of monthly datetime based data points need map in line chart. trying accomplish: i need points plotted on chart i need line charts of 3 series begin on first data point @ bottom left (january 1st). the first data point needs display text phrase , rest need remain formatted date. please take @ jsfiddle. http://jsfiddle.net/fwgdw/7/ $(function () { $('#container').highcharts({ chart: { type: 'spline' }, title: { text: 'performance chart' }, subtitle: { text: 'monthly date inverval' }, xaxis: { type: 'datetime', datetimelabelformats: { month: '%b-%y', year: '%b-%y'}, /*showfirstlabel: false, startontick: true*/ }, yaxis: { min: 0 }, tooltip: { headerformat: '<b>{series.name}</b><br>', pointformat: '{point.x:%e. %b}: {point.y:.2f} m'}, seri...

python - How do numpy and GMPY2 compare with GMP in terms of speed? -

i understand gmpy2 supports gmp library , numpy has fast numerical libraries. want know how speed compares writing c (or c++) code gmp. since python scripting language, don't think ever fast compiled language, have been wrong these generalizations before. i can't gmp work on computer, can't run tests. if could, general math addition , maybe trig functions. i'll figure out gmp later. numpy , gmpy2 have different purposes. numpy has fast numerical libraries achieve high performance, numpy restricted working vectors or arrays of low-level types - 16, 32, or 64 bit integers, or 32 or 64 bit floating point values. example, numpy access highly optimized routines written in c (or fortran) performing matrix multiplication. gmpy2 uses gmp, mpfr, , mpc libraries multiple-precision calculations. isn't targeted towards vector or matrix operations. the python interpreter adds overhead each call external library. whether or not slowdown significant depends on...

javascript - Angular route wildcard possible/workaround? -

i made isactive function set active class on menu element. the function follow: $scope.isactive = function (path) { if (path == $location.path()) { return true; } else { return false; } } in html use: <li ng-class="{active: isactive('/page')}"> <a href="page">page</a></li> but html defined once in template. great use: isactive('/page*') so beyond '/page' url active state. does knows workaround, because haven't found yet on forums , angular documention, guess isn't there yet.. possibly ? $scope.isactive = function (path) { var strregexpattern = '\\b'+path+'\\b'; if( document.location.pathname.match(new regexp(strregexpattern,'g')) ) { return true; } else { return false; } } i don't know if can substitute document.location.pathname.match(... // vani...