Posts

Showing posts from June, 2010

java - How to set end attribute dynamically with Struts2 iterator in JSP -

<% registeraction aro=new registeraction(); int count=aro.getli().size(); %> <s:iterator value="li" begin="0" end="1"> <fieldset> name : <s:property value="name" /><br/> password : <s:property value="password" /><br/> email : <s:property value="email" /><br/> gender : <s:property value="gender" /><br/> country : <s:property value="country" /><br/> </fieldset> </s:iterator> how set end attribute value dynamically iteration, reading count variable ? if use end="<%=count%>" not working. if use end="count" it's working getting same result multiple of numbers if refresh page or reload. you can use #attr notation in ognl read variables set within scritplet blocks, if push them in pagecontext

android - Sending a notification-only payload to GCM using AWS SNS -

i trying send mobile push notifications gcm via aws sns. according latest gcm 3.0 documentation , 1 may include either "notification" payload or "data" payload (or both). if send notification payload, gcm take care of showing notification on end-user device you. using amazon sns console, tried sending notification-only payload, encountered following error: invalid parameter: message reason: invalid notification protocol gcm: data key expected in json message (service: amazonsns; status code: 400; error code: invalidparameter) i'm sending: { "gcm":"{\"notification\":{\"title\":\"test message\"}}" } i suspect might issue sns still conforming previous version of gcm , therefore expects "data" key, i'm not sure. else having similar problem or have experience this? thanks! edit: clarify, want send gcm notification payload , have display alert user automatically described in d

angularjs - Bower Install Error EPERM rename sb-admin theme -

i trying install sb-admin theme on local machine , getting below error. tried clear cache of bower & npm, reinstalled bower nothing worked. error: bower json3#~3.3.1 eperm eperm, rename 'c:\users\vi842397\appdata\local\bower\cache\packages\82636d37515077f172c7d039afaa3315\3.3.2' stack trace: error: eperm, rename 'c:\users\vi842397\appdata\local\bower\cache\packages\82636d37515077f172c7d039afaa3315\3.3.2' @ error (native) console trace: error @ standardrenderer.error (c:\users\vi842397\appdata\roaming\npm\node_modules\bower\lib\renderers\standardrenderer.js:82:37) @ logger. (c:\users\vi842397\appdata\roaming\npm\node_modules\bower\bin\bower:110:22) @ logger.emit (events.js:107:17) @ logger.emit (c:\users\vi842397\appdata\roaming\npm\node_modules\bower\node_modules\bower-logger\lib\logger.js:29:39) @ c:\users\vi842397\appdata\roaming\npm\node_modules\bower\lib\commands\index.j

c# - JIRA XML Export contains HTML characters -

i trying parse xml export jira. example: https://jira.atlassian.com/si/jira.issueviews:issue-xml/demo-4778/demo-4778.xml when open in browser , right click -> save -> xml expected. when try use c# content there problem nodes this: <description> <p>go browser <br/> open application<br/> log in page <br/> click on categories button<br/> click on add button <br/> not able add category on categories table <br/> given me error message </p> </description> the problem contain html characters inside , not converted in c# world characters. example: <br/> escaped & lt;br/& gt; instead of being treated newline. problem doesn't exist when download browser , load file, difference? this code: webrequest request = webrequest.createhttp("https://jira.atlassian.com/si/jira.issueviews:issue-xml/demo-4778/demo-4778.xml"); using (webresponse response = request.getresponse())

kwargs to python instance method -

i need pass kwargs python instance method following error below. class test(object): def __init__(self): print 'initializaed' def testmethod(self,**kwargs): each in kwargs: print each x = test() x.testmethod({"name":"mike","age":200}) error: traceback (most recent call last): file "c:\users\an\workspace\scratch\scratch\test.py", line 20, in <module> x.testmethod({"name":"mike","age":200}) typeerror: testmethod() takes 1 argument (2 given) x.testmethod({"name":"mike","age":200}) this invokes testmethod() 2 positional arguments - 1 implicit (the object instance, i.e. self ) , other 1 dictionary gave it. to pass in keyword arguments, use ** operator unpacking dictionary key=value pairs, this: x.testmethod(**{"name":"mike","age":200}) this tr

queryExecute ColdFusion syntax vs Railo/Lucee syntax -

i have bunch of code has been written against railo server. trying move of code on cf11 box , lucee box. i have been using queryexecute this: rt = queryexecute( sql = 'select * translation translationid = :translationid , translatedstr = :translatedstr' , params = {translationid: arguments.translationid , translatedstr: arguments.translatedstr} , options= {datasource: application.ds} ); i under impression syntax same on cf11 getting error : parameter validation error queryexecute function. built-in coldfusion function cannot accept assignment statement parameter, although can accept expressions. example, queryexecute(d=a*b) not acceptable. the above executequery works fine on lucee. going need go through whole code base , make work on both cf11 , on lucee. can someone, more familiar acf, tell me best way this. appears acf having trouble param names. if remove sql = , p

javascript - ng-repeat only works for variable {{ x }} outside of angle brackets ("<>")? -

i new angularjs. trying out ng-repeat , found problem in code (shown below) <ul class="dropdown-menu" role="menu" ng-init="names=finddomains()"> <li><a style="cursor:pointer" ng-repeat="x in names" ng-click="selectdomain({{ x }})">{{ x }}</a></li> </ul> the idea have drop-down menu (e.g. name "test") on page. when clicked, displays selections, , options displayed contents in <li></li> . options returned set function finddomains() , initialized ng-init . when particular option (content in <li></li> ) selected (e.g. name "opt1"), text of drop-down menu updated name of option ("opt1" replaces "test"). implemented function selectdomain() since same content displayed , call selectdomain() , put 2 {{x}} calling ng-repeat , hoping same option displayed calls selectdomain() . however, else seems working fine ( finddomains

sockets - Java URL with Socks4 Proxy -

my problem can't use socks4 proxies urls because of bug in java. give me malformed reply socks server exeption. what i've tried: url url = new url("https://google.com"); urlconnection con = url.openconnection(p); i've tried several proxies make sure proxy not dead. sorry bad english :d.

Bash for loop pull text from file recursively -

i having trouble writing bash loop script can extract contents of specific file common many child directories under parent directory. directory structure: /parent/child/grand_child/great_grand_child/file in there many child, grandchild, , great grandchild folders. i want script (in english): for every grand_child folder, in every child folder: search through 1 great_grand_child folder find file named 0001.txt print text in row 10 of 0001.txt output file in next column of output file, print full directory path file text extracted from. my script far: for in /parent/**; if [ -d "$i" ]; echo "$i" fi done can have designing script? far gives me path each grand_child folder, don't know how isolate 1 great_grand_child folder, , ask text in row 10 of 0001.txt file inside great_grand_child folder. thanks in advance guidance or help. # every grandchild directory parent/child/grandchild grandchild in parent/*/* # file $grandchild/g

windows - Custom icon overlays for namespace extension -

i'm implementing namespace extension represents remote file system on server , have icon overlays show file state (locked) in question here: icon overlay handlers namespace extension that question answered there , i've done suggested: created additional shell extension ishelliconoverlayidentifier interface implemented: in ishelliconoverlayidentifier.getoverlayinfo return icon file , icon index. in ishelliconoverlayidentifier.ismemberof return s_false not show overlay other files in system. in main nse i've implemented ishelliconoverlay interface , retrieve icon overlay system image list using shgeticonoverlayindex function. the problem is: shgeticonoverlayindex returns -1. but! if return s_ok result of ishelliconoverlayidentifier.ismemberof - shgeticonoverlayindex starts give correct overlay index! of course in case overlay added files in system including nse. the interesting thing if return s_false in subesequent calls of ishelliconoverlayidentifier.ismemb

interface - Trying to understand scala trait -

i new scala. don't understand scala traits properly. have read similar java interfaces methods need not abstract. how can declare scala trait , instantiate in following code. btw, following code working fine. trait fooable { def foo: unit = { println("this foo") } } object main { def main(args: array[string]): unit = { println("this morking") val foo = new fooable{} foo.foo } } output - morking foo thanks in advance. scala traits more general both java interfaces , abstract classes. you can use trait interface, can use store implementation, can use define common super-type: trait message case class text(text: string) extends message case class data(data: bytestring) extends message multiple traits can 'mixed in' class: class myclass extends traita traitb traitc where conflict identically named methods resolved simple rule: last trait takes precedence. code: trait traita {

How to insert empty element in IBM JSF? -

i tired create empty <td> element in jsf page under panelgrid tag no luck. used below options <h:outputtext value="& nbsp;" escape="false"/> <h:outputtext value=" " /> style="margin-left: 5px;" <h:outputtext value="&amp;nbsp;" escape="false"/> at last used <!-- empty--> resolved problem in local machine failed in integrated environment. verified there no configuration in web.xml remove comments if any. still not sure why <!-- empty --> didn't work in integration environment. agree may not effective way trying learn whats happening really.

Is it possible to prevent Google Docs From converting PDF? -

i'd open pdf in google docs (not previewer) without having docs convert file, 3rd party pdf viewers not option need run google script on file also. pdf->doc conversion useless, removes formatting , leaves worthless document in it's wake. no, there not. google apps script documentapp can work google docs type files anyway. depending on trying accomplish @ driveapp apis, modifications document contents require google type file.

python - Memory leak when using py7zlib to open .7z archives -

i trying use py7zlib open , read files stored in .7z archives. able this, appears causing memory leak. after scanning through few hundred .7z files using py7zlib, python crashes memoryerror. don't have problem when doing equivalent operations on .zip files using built-in zipfile library. process .7z files follows (look subfile in archive given name , return contents): with open(filename, 'rb') f: z = py7zlib.archive7z(f) names = z.getnames() if subname in names: subfile = z.getmember(subname) contents = subfile.read() else: contents = none return contents does know why causing memory leak once archive7z object passes out of scope if closing .7z file object? there kind of cleanup or file-closing procedure need follow (like zipfile library's zipfile.close())?

bxslider - How make ticker text to come in single line instead of goes to the next line -

i using bxslider jquery in site news ticker, plugin works fine problem news goes next row , expand whole header makes website looks little bit awkward. how can achieve news ticker in single line ? html <ul id="top-ticker"> <li>test test test test test test test test</li> </ul> javascript code jquery(function($) { if( $("#top-ticker").length > 0 ) { var topticker = $('#top-ticker').bxslider({ mode: 'vertical', pager: false, controls: false, auto: true, speed: 4000, onsliderload: function() { $('#top-ticker').addclass('ticker-loaded'); } }); } }); css style /* top ticker */ #top-ticker { list-style: none; margin: 0; padding: 0; } #top-ticker li { display: block; padding: 1px 0 } #top-ticker li + li { display: none; } #top-ticker.ticker-loaded li + li { display: block; } .fl-page-bar-text .bx-wrapper .bx-viewp

c# - Moq - Setup with constraint? -

i'm trying stub this: public t getcommand<t>() t : icommand, new() i'm using moq (c#), , code looks this: _mockedbusinessfactory.setup(x => x.getcommand<icommand>()); but there question: how deal new() constraint? any idea? maybe this: var stub = new mock<icommand>(); stub.setup( //... setup stub mockedbusinessfactory.setup(x => x.getcommand<icommand>()).returns(stub.object); ps. i'm not moq user

javascript - Included script works no fully -

i have velocity file , these part of code inside <input type="radio" name="activity" class ='message' id="#springurl('/resources/ajax/notify/test.html')"> i have added notifications.js file. inside these notifications.js file code alert(); or $(window).load(function(){ alert(); }); works , can't perform code $(".message").click(function(){ alert("message"); }); how can access ".message" class inside notifications.js file? i've included notifications.js <script src="#springurl('/resources/js/notifications.js')"></script>

c# 3.0 - Getting Error: return statement is missing in switch statement -

i thought switch case written correctly got error: return statement missing in last bracket. please find below code: public string geturl(string code ) { switch (code) { case "1": return "#"; case "2": return "#"; case "3": return "#"; case "4": return "#"; case "5": return "#"; case "6": return "#"; case "7": return "#"; } } thanks in advance what missing default case. string should function return if none of cases mentioned occur. e.g. pass "unknown" method geturl . so add default case , things should work fine. the code should like public string geturl(string code ) {

oracle - Is there a way to compare multiple rows in one column in PL/SQL? -

i've been using sql on 25 years, i'm relatively new oracle. previous experience has been in db2, , sql server. i asked write script through table following layout: orderno int clientid varchar(20) order_date datetime productcode varchar(5) creditlimit money accountno varchar(25) the users enter client's creditaccountno on every order. (i know should pulled table, it's homegrown application, , didn't write way. someday, i'll them let me fix that.) the problem that, while clients have more 1 credit account, have one. users mistakenly enter wrong account no. want me write script looks @ each clientid, , display clients have multiple account numbers in table. normally, have (pseudocode): clientid cursor read distinct clientid order cursor read order record clientid if first iteration, set variable x = accountno if accountno <> x print clientid, x, accountno read next row l

javascript - Order data before selecting an option in dropdown -

i have dropdown options can order data in html: <select ng-model="sortorder" ng-options="option.value option.name item in options"></select> further have code populates data ng-repeat , uses sortorder model sort data dropdown options: <div ng-repeat="hello in worlds" | filter:searchquery | orderby: sortorder" it works fine , data gets sorted options in dropdown order data in alphabetical order before click on option in dropdown list. or maybe option can selected default , sorts data. i've been searching answer here on stackoverflow haven't been able find any. assuming following values in sortorder model: $scope.options = [ { name: 'name' value: 'name' }, { name: 'address' value: 'address' } ]; where name , address properties of worlds model. this takes care of sortby - need sortin feature - ascending or descending. u

C# Quick PictureBox image and Resource image comparsion -

i've been dealing problem way long. wanted compare, if picturebox has same image 1 in resources, naturally went this; if(picturebox1.image==properties.resources.image1) { console.writeline("hello!"): } but didn't work. so, tried differently; if(picturebox1.image.equals(properties.resources.image1)) that didn't work. tried bitmap; bitmap temp = new bitmap(properties.resources.image1); if(temp==properties.resources.image1) it didn't work. searched internet (including stackoverflow) , answers 50 lines long. there really no simple way compare picturebox image resource image?! in comment @idle_mind suggested using tags compare images, , seems easiest way it! again help!

android - MIMETYPE returning null in CursorLoader -

i have listfragment has cursoradapter inflating row items. using android contact provider inflating list items. able add custom mimetype contacts contactprovideroperation.the value inserted expected. when trying use custom mimetype selection parameter returning cursorloader not working. below code: return new cursorloader(getcontext(), data.content_uri, new string[]{data.contact_id,data.data1}, data.mimetype+"= ?", new string{"vnd.cursor.item/mimetype"}, null) i added breakpoint selection. seems cursorloader not accepting mimetype selection parameter.please me on this. below code add data: arraylist<contentprovideroperation> ops = new arraylist<contentprovideroperation>(); ops.add(contentprovideroperation.newupdate(data.content_uri) .withselection(data.contact_id+"= ?"+data.mimetype+"= ?", new string[]{contactid,"vnd.cursor.item/mimetype"}) .withvalue(da

c++ - What compiler is in Visual Studio 2015 -

can tell me compiler built-in visual studio 2015 c++ projects? tried , tried older version compilers , it's giving me other compiling results. gnu c++ version 4.8.2 or newer version? they have own compiler goes visual c++ _____ here mapping of ide version compiler version. release major compiler version each major ide version. visual studio 2005 - visual c++ 8.0 visual studio 2008 - visual c++ 9.0 visual studio 2010 - visual c++ 10.0 visual studio 2012 - visual c++ 11.0 visual studio 2013 - visual c++ 12.0 visual studio 2015 - visual c++ 14.0 visual studio 2017 - visual c++ 14.1 so explicitly answer question, visual studio 2015 uses compiler visual c++ 14.0

ruby on rails - Devise DatabaseAuthenticatable not accessing database -

i having same problem warden not accessing database (devise) -- integrating devise rails 4.0.5 application. i've followed instructions letter. however, when attempt log in, can tell stepping through in debugger warden isn't trying query database. far can tell thinks :database_authenticatable strategy invalid. can shed light on this? in advance! edit: digging further, used debugger force-run strategy , can see error message generate " @message=:not_found_in_database," - however, it's not hitting database! it turned out had custom view causing problem -- link discussion devise core maintainers here: https://github.com/plataformatec/devise/issues/3700

java - Conversion byte decimal to byte bcd -

i need convert delphi function java function. function convert byte decimal byte bcd: function bytetobcd(number : byte) : byte; begin result:= ((number div 10) shl 4) or (number mod 10); end; you can this public static int bytetobcd(byte b) { assert 0 <= b && b <= 99; // 2 digits only. return (b / 10 << 4) | b % 10; } it not clear stuck on answer trivia.

asp.net mvc - Break Out of an ActionResult without Redirect -

is there way straight break-out actionresult method? i'm running manual verification in form's submit controller. if validation fails, want exit out of method. no redirect, nothing. stop in it's tracks , exit out. break or exit. exist, or have have return redirect()? simply use code return view(); , if want return something, can use typed , return in view following : return view(model);

android - Error to parse date: "Unparseable date: "Jue 28-05-2016 22:30" (at offset 0)" -

i'm new in android , want parse string date convert calendar object , send android calendar. string value jue 28-05-2015 22:30 (jue jueves, thursday in spanish) , code looks this: fechaevento = calendar.getinstance(); begintime ="jue 28-05-2016 22:30" final simpledateformat sdf = new simpledateformat("eee dd-mm-yyyy kk:mm"); btncalendar.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { try { fechaevento.settime(sdf.parse(begintime)); intent intent = new intent(intent.action_insert) .setdata(calendarcontract.events.content_uri) .putextra(calendarcontract.extra_event_begin_time, fechaevento.gettimeinmillis()) .putextra(calendarcontract.events.title, nameevento.gettext().tostring()) .putextra(calendarcontract.events.description, descriptionevento.ge

winforms - Projectitem unavailable when trying to save a form that contains a StatusStrip -

Image
i added empty status strip in empty form , when try save error pops 1 time: on next attempt can save until change statusstrip . when start application or re-open designer show statusstrip , none of added buttons in statusstrip . however, produced designer code still contains code of buttons. does experienced bug or there way further information solve it? restarting visual studio solved temporary issue @ me.

Pulling Bright Local API Data into my Ruby on Rails App - API Docs written in PHP -

i'm trying build rails app pulls data several different seo tool api's. bright local (see api docs here - http://apidocs.brightlocal.com/ ) api doc examples written in php, can't read great. so first, ask specific question, how write batch request in ruby: <?php use brightlocal\api; use brightlocal\batches\v4 batchapi; $api = new api('[insert_api_key]', '[insert_api_secret]'); $batchapi = new batchapi($api); $result = $batchapi->create(); if ($result['success']) { $batchid = $result['batch-id']; } also, suggestions how can bring myself snuff on using api's in rails apps? our docs show php examples - although planning expand on , ruby 1 of languages we'll looking add. a simple command line curl request above php code this: curl --data "api-key=<your api key here>" https://tools.brightlocal.com/seo-tools/api/v4/batch and return response this: {"success":true,"batch-id&

Website on Macs is ssl certified (Chrome)? Stylesheet not working -

hi i'm accessing http://videobrochurecanada.ca/ on macs , prompting ssl certificate error , not running stylesheet. works fine on pcs chrome. can fix this? the ssl certificate returned when accessing videobrochurecanada.ca has wrong name. it's issued newserver.dolcemag.com . see ssl labs report (archived here .)

SQLITE: select rows where a certian column is contained in a given string -

i have table has column named "directory" contains strings like: c:\mydir1\mysubdir1\ c:\mydir2 j:\myotherdir ... i like select mytable directory contained within 'c:\mydir2\something\' this query should give me result: c:\mydir2 ok, i've found sqlite has function instr seems work purpose. not sure performance, though.

python - Scraping data from multiple websites, merging the data and indexing in Elasticsearch -

i'm using scrapy scrape data on products (product name , manufacturer) website. i'm using pipeline ( http://github.com/noplay/scrapy-elasticsearch ) index data directly elasticsearch search engine. i'd scrape data site (either using api or scrapy again) provides data on manufacturers , reputation (a simple ranking of top 250 manufacturers example). in elasticsearch index example document might have following fields: product name: ifruit 7 (scraped site a) product manufacturer: pear (scraped site , site b) manufacturer ranking: 17 (scraped site b) what simplest way combine scraped data in elasticsearch index each document stored information product name, manufacturer , product ranking? best try , merge data within scraping process, or try , combine 2 json files, or adapt pipeline, or mess around data once been indexed in elasticsearch? or there better solution? it's possible manufacturer may spelled differently/phrased differently in 2 data sets well. how issue

python - how to post image on facebook in your page -

i create facebook profile , create page https://www.facebook.com/pages/animated-gif/872749676114274?fref=nf . 1. install facebook python sdk. 2. create application , access token facebook profile. 3. can submit post in facebook profile use code import requests face_token = 'access_token' post = 'post text' post.replace(' ', '+') requests.post("https://graph.facebook.com/me/feed/?message=" + post + "&access_token=" + access_token) all ok. how can submit post facebook on behalf of animated gif https://www.facebook.com/pages/animated-gif/872749676114274 page? thank you create album graph = facebook.graphapi(access_token) path = "1640987309510499/albums" post_args = {'access_token':access_token,'name':"animated gifs collection ", 'message':"animated gifs collection "} post_data = urllib.urlencode(post_args) file = urllib2.urlopen("https

c++ - UWP/WinRT: How to enable undo hooks on a TextBox? -

the textbox class supports undo, present , functional in context menu. i implement undo/redo buttons found in every common document editor such microsoft word. disabled when have no action take, , when there undo/redo stack move through, pressing buttons cause textbox's contents undo , redo. looking @ textbox api , there doesn't seem mention of how hook undo data. discussion mention undo present on context menu. how undo/redo hooks implemented on textbox? if makes difference, i'm coding in c++/cx. you can record history manually textchanged event. undo command used display input. hook control seems not possible. handle contextmenuopening event textbox , can modify popup own commands, example own undo/redo history. a sample: https://code.msdn.microsoft.com/windowsapps/context-menu-sample-40840351 works fine uwp.

python - Numpy 1 Degree of Freedom -

in following code i'm confused third line means. ddof = 1 do. tried looking up, still don't quite understand concept or purpose. appreciate if point me in right direction. thanks data = stats.binom.rvs(n = 10, p = 0.3, size = 10000) print "mean: %g" % np.mean(data) print "sd: %g" % np.std(data, **ddof=1**) degrees of freedom important concept may want look up , computational difference straight forward, consider these: in [20]: x = np.array([6,5,4,6,6,7,2]) in [21]: np.std(x) out[21]: 1.5518257844571737 #default ddof=0, does: in [22]: np.sqrt((((x-x.mean())**2)/len(x)).sum()) out[22]: 1.5518257844571737 in [23]: np.std(x, ddof=1) out[23]: 1.6761634196950517 #what ddof=1 does: in [24]: np.sqrt((((x-x.mean())**2)/(len(x)-1)).sum()) out[24]: 1.6761634196950517 in languages ( r , sas etc), default return std of ddof=1. numpy 's default ddof=0, worth noting.

ios - How to drag the cell on right in UITableView when tap, like in Snapchat? -

Image
in snapchat application on main screen if tapped on cell contact - cell drag left right (look @ screen). how can this? p.s. similar effect has ios lock screen when tap on camera on right bottom corner. thanks in advanced. add pangesturerecognizer tableview . track gesture recognizer states, , check translation.x value see position of drag. get view of drag = cell have. shift position of cell based on translation.x value, , @ time, move whatever view want show beneath it. [note: if want view slide left right, use translation.x value. check threshold of movement, if exceeds, leave view open. if not exceed, animate view cell's frame set normal. [you can use velocity property along translation - gives user better experience. same swipe] p.s. if still don't it, suggest google 'ios uitableviewcell swipe reveal` sure find plenty of examples. peace.

angularjs - Error: request entity too large (mean.io) -

i trying parse .srt file , saving parsed object in mongodb collection. when i'm uploading big srt file, getting entity large error. googled around , found express config line increase size limit of request didn't seem trick. when submit file saving: js console: post (angular.js:10514) http://localhost:3000/api/subtitles 500 (internal server error) here complete error: error: request entity large @ readstream (/users/egills/meanpanda/node_modules/body-parser/node_modules/raw-body/index.js:179:15) @ getrawbody (/users/egills/meanpanda/node_modules/body-parser/node_modules/raw-body/index.js:97:12) @ read (/users/egills/meanpanda/node_modules/body-parser/lib/read.js:68:3) @ jsonparser (/users/egills/meanpanda/node_modules/body-parser/lib/types/json.js:121:5) @ layer.handle [as handle_request] (/users/egills/meanpanda/node_modules/meanio/lib/core_modules/server/node_modules/express/lib/router/layer.js:95:5) @ trim_prefix (/user

csv - Why does Excel parse numbers with more than two decimal places as whole numbers? -

excel uses windows regional settings list separator , decimal separator csv files. attempting localize csv reports in our application french , german users. using semi-colons csv delimiter , commas decimal separators french , german versions of each csv. i've set local windows regional settings use semi colons , commas decimal separators. when open following test file in excel, excel parses numbers 2 or less decimal characters correctly ... based on regional settings. however, numbers 3 or more decimal places parsed whole numbers. so, string 12,3000 parsed 123 000 (one hundred twenty 3 thousand). test.csv: "decimal separator";"in quotes";"number" "period";"false";4.283333 "period";"true";"4.283333" "period";"false";0.283333 "period";"true";"0.283333" "comma";"false";4,283333 "comma";"true";"4,28

visual studio - Strategy for unshelving large shelveset that is also old -

i spent couple months creating single large shelveset. shelved couple months ago. want merge mainline. the base of shelveset 4 months old, , mainline has marched forward during time. is there known strategy dealing mess? find point in time "a couple of months" ago , create branch that. unshelve changes branch. commit changes, merge branch trunk. may have baseless merge; i'm not sure off top of head. in future, don't use shelvesets since not intended used replacement branches. shelvesets intended allow short-term suspension of work in progress.

Emacs: embed Graphviz diagrams in Markdown documents -

i've used org-mode writing documents mix code & diagrams & explanatory text. i'm wondering whether similar thing possible markdown-mode - there way put embedded graphviz code in markdown document, have key combo processes diagram , outputs png in local directory, , embed png in output? if so, skip .org step. my main use case here create readme files git repositories in github or atlassian stash, fwiw.

Visual Studio wpf project C# contextmenu icon next to mrenuitem -

i've got big problem despite efforts cannot add icon next menu item in notifyicon contextmenu. want create contextmenu icons render using windows theme changing looks accordingly windows version. i've tried using custom render ownerdraw more contextmenustrip , render same on windows versions not desired effect. wonder possible icons in tray contextmenu using visual studio , c# code , keep windows , feel. if knows solution grateful. i assuming using windows 10 , visual studio 2015 community or similar, if not, let me know if more different! check out guide universal windows platform (uwp) apps if using uwp, universal windows programming using xaml, might consider using: adaptive scaling, in case use xaml tag . in case of relative panel see objects move around , adapt in windows 10 media way, screen size. modify adaptive action using xaml. jerry nixon has great blog on xaml , c#, read it. hope helps out.

php - Nginx, always use specific file for specific extension -

not sure how word or best way ask looking way in nginx run specific file php. basically if file php file run file instead. so request www.domain.com/info.php run /home/user/system/request.php instead. the reason have older tool need adjustments , want split off code gradually make compatible laravel. rather adding require @ top of 3000+ files rather load code, using path load specific file (this way gradually bits , pieces can rebuilt in laravel seamlessly). any ideas? try try_files directive: location ~ \.php$ { try_files $uri /home/user/system/request.php; # php-fpm config } http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files

python - exec a global variable from an extern module -

i have extern module want set "exec" expressions global (because need pass strings variables names) so, have function like def fct_in_extern_module(): exec 'a = 42' in globals() return none and in main script have import extern_module extern_module.fct_in_extern_module() thus, why have nameerror: name 'a' not defined while if (in main script) def fct_in_main(): exec 'b = 42' in globals() fct_in_main() >>> b 42 any idea how can affect set string 'a' variable name in extern module ? thanks ! globals() means "the globals dict of this module". thus, way have chosen code extern_module.py not affect globals dict of other module. one way fix: define as: def fct_in_extern_module(where): exec 'a = 42' in and call as: extern_module.fct_in_extern_module(globals()) of course, usual, exec not best way solve problem. better: def fct_in_extern_module(where): whe

angularjs - Angular OrderBy by object property in sub array -

i have table... <table width="100%"> <thead> <tr ng-repeat="row in data.rows | limitto:1"> <th ng-repeat="col in row.columns" ng-show="{{col.visible}}" ng-click="updatesortorder(col.headertext)"> <a href>{{ col.headertext }}</a> </th> </tr> </thead> <tbody> <tr ng-repeat="row in data.rows | orderby: ??? "> <td ng-repeat="col in row.columns" ng-show="{{col.visible}}"> {{ col.value }} </td> </tr> </tbody> </table> and have json file following data structure... "rows": [{ "columns": [{ "headertext": "policy number", "value": "a123456

c# - Using a List within a dataset as tablix properties -

i have large output report create 7 - 10 tables plus ton of individual cells populate. is possible use list inside of dataset tablix properties/dataset? or need create new dataset each table? as example of mean: public class librarymodel { .... public list<bookmodel> books { get; set; } public list<areamodel> area { get; set; } .... } public class bookmodel { public string author { get; set; } public string isbn { get; set; } public double price { get; set; } public string title { get; set; } } public class areamodel { public string name { get; set; } public string genre { get; set; } public bool hasadultcontent { get; set; } } in case able use librarymodel dataset in report , use bookmodel 1 table , areamodel table? , if so, how able that? solution found can set model in manner each list item not show item field. each list item has imported new dataset. in reporting service show librarymodel (books) rather using bookmodel dataset.

css - Adding background image for Bootstrap list-group-item -

i have sprite i'm able display per each list-group-item . however, i'm not able individually style each image .one, .two etc. <div class="list-group"> <a href="#" class="list-group-item one">one</a> <a href="#" class="list-group-item two">two</a> <span class="list-group-item three">share <span class="fb"><!--display fb icon--></span></span> </div> less: place text on left, align image on right side, works. want style individual images within each .list-group-item . images repeat themselves, have position them on center of each anchor tag, , display pixel parts. .list-group-item { width:100% height: 50px; float: left; overflow: hidden; text-align:left; background: url("sprite.png") right no-repeat; } .one { top:0; left:-15px;} i tried adding images explicitly, this: <div clas

php - Subquery to see if a field in a separate table is null or empty for the same id -

i getting authors way: $feat_authors = $wpdb->get_results("select id, user_nicename $wpdb->users display_name <> 'admin' order rand() limit 3"); but want check in seperate database table: wp_usermeta there field meta_key='description' see if value is not empty or null associated id (user_id , id first table match). selecting , printing wp_usermeta yields: array ( [0] => stdclass object ( [umeta_id] => 19 [user_id] => 2 [meta_key] => first_name [meta_value] => rita ) [1] => stdclass object ( [umeta_id] => 20 [user_id] => 2 [meta_key] => last_name [meta_value] => santos ) [2] => stdclass object ( [umeta_id] => 21 [user_id] => 2 [meta_key] => nickname [meta_value] => rita ) [3] =>

c# - .ToString() does not raise an exception on double? or long? while it will raise an exception on null string -

i have 3 properties follow:- public nullable<double> speed { get; set; } public nullable<int64> processorcount { get; set; } public string cpuname { get; set; } now inside asp.net mvc5 web application's controller class, if pass null above 3 variables, follow:- query["prospeed"] = sj.speed.tostring(); query["procores"] = sj.processorcount.tostring(); query["protype"] = sj.cpuname.tostring(); then tostring() raise exception on null string sj.cpuname.tostring(); , can adivce why tostring() not raise exception if try convert double? or long? contain null values string, raise null reference exception if string null ? to simplify it: int? x = null; string result = x.tostring(); // no exception here null isn't null reference . it's null value of type int? , i.e. value of type nullable<int> hasvalue false. you're invoking nullable<t>.tostring() method on value. no null references involved,

java - Testing a random number generator -

Image
i having trouble printing out first 2 columns of results in table new programming having issues , wondering issue in code. brief states must create: a parameterless static int method, randint() , return random integer in range 0..9 inclusive. method include call math.random() . a static void method named randtest takes single integer argument, n. should perform following actions: declare int array of 10 elements named counts. used record how each possible value returned randint . call randint n times, each time incrementing count of element of counts corresponding value returned. print results console in clear tabular form. output should following: this code: import java.util.arrays; public class randnumgenerator { public static int randint(){ double n = math.random()*10; return (int) n; } public static void randtest(int n){ int [] counts = new int [10]; for(int i=0;i<n;i++){ counts[i] = randint();

serial port - python 2.7 - converting float to bytes and looping through the bytes -

i'm trying send float series of 4 bytes on serial. have code looks works: ser.write(b'\xcd') #sending byte representation of 0.1 ser.write(b'\xcc') ser.write(b'\xcc') ser.write(b'\x3d') but want able send arbitary float. i want able go through each byte individually won't example: bytes = struct.pack('f',float(0.1)) ser.write(bytes) because want check each byte. i'm using python 2.7 how can this? you can use struct module pack float binary data. loop through each byte of bytearray , write them output. import struct value = 13.37 # arbitrary float bin = struct.pack('f', value) b in bin: ser.write(b)

c# - How to sync selection index between two ListBoxes -

Image
i have 2 listboxes: listbox1, listbox2. if select item in first listbox1, item of same index must automatically selected in listbox2. so, if select item 1 in listbox1 then, item 1 selected automatically in listbox2 , on. not: found examples not work. private void listboxcontrol2_selectedindexchanged(object sender, eventargs e) { listboxcontrol5.selectedindex = listboxcontrol2.selectedindex; } edit: i solved using selected index code in this answer in selectedvaluechanged event. private void listboxcontrol2_selectedvaluechanged(object sender, eventargs e) { listboxcontrol5.selectedindex = listboxcontrol2.selectedindex; } here's sample may want explore more, try add listbox to form (in sample 3 listboxes) should following: and here's source select same index whenever click on item on it: public partial class form1 : form { public form1() { initializecomponent(); initializelistboxes(); } private voi

recursion - How does (co)recursive definition work in Haskell? -

i'm playing around language start learning , puzzled beyond wits how recursive definition works. for example, let's take sequence of triangular numbers ( tn n = sum [1..n] ) the solution provided was: triangularnumbers = scanl1 (+) [1..] so far, good. but solution did come was: triangularnumbers = zipwith (+) [1..] $ 0 : triangularnumbers which correct. now question is: how translate lower level implementation? happens behind scene when such recursive definition met? here simple recursive function gives nth triangular number: triag 0 = 0 triag n = n + triag (n-1) your solution triag' = zipwith (+) [1..] $ 0 : triag' more fancy: it's corecursive ( click , click ). instead of calculating nth number reducing value of smaller inputs, define whole infinite sequence of triangular numbers recursively specifying next value, given initial segment. how haskell handle such corecursion? when encounters definition, no calculation performed, d

java - Using interface callbacks in Android -

i trying write simple chat application on android. it takes speech, converts text, sends server. i want able use texttospeech read response server gives. i keep getting java.lang.nullpointerexception: attempt invoke interface method 'void {myappname}.mycallback.callbackcall()' on null object reference . have looked @ other questions similar answers, conflicting, "the interface should instantiated first" or "you don't instantiate interfaces", etc., , confusing me. the receiver: public class mainactivity extends actionbaractivity implements texttospeech.oninitlistener, mycallback { ... private void sendtoserver(string msg) { cthread = new clientthread(); cthread.msg = msg; thread thread = new thread(cthread); thread.start(); } @override public void callbackcall() { log.d("callback", cthread.serverresponsesaved); // speaking here. } } the actual code responsi

apache - .Htaccess RewriteRule (Subdomain vs Request_URI) -

i have several domain names, each own multiple subdomains. currently, have global rewriterule domain specific request_uri meant rest apis. .htaccess rewriteengine on rewriterule ^/?api/(.*)$ /api/inbound.php [nc,l] affected url examples: acct.domain1.com/api/clients/123 my.domain2.com/api/tasks/2323 new.domain3.com/api/products/1212 and rule works great! now i've started using these subdomains: api.domain1.com/api/clients/123 api.domain2.com/api/tasks/2323 api.domain3.com/api/products/1212 though still works, it's annoyingly redundant. so, if subdomain happens " api , sandbox , api.test , or chosen nuance i'm going omit /api/ path url. how rewriterule scenario? examine http host header value rewritecond : rewriteengine on rewritecond %{http_host} ^api(\.test)?|sandbox rewriterule ^/?(.*)$ /api/inbound.php [nc,l]

Add views dynamically android -

i trying add textviews dynamically activity , able added textviews getting added next each other on right side , want have each textview underneath each other. here code: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); linearlayout linearlayout = (linearlayout)findviewbyid(r.id.linearlayout); for(int x = 0;x < 10; x++){ linearlayout layout = new linearlayout(this); textview tv = new textview(this); tv.settext("text view "+x); layout.setorientation(linearlayout.horizontal); layout.addview(tv); linearlayout.addview(layout); } } main xml: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height

No Module Named neo4j in Travis-CI integrated with Python Django -

i have built small python application in django framework, neo4j database hosted on graphene db. integrating travis-ci continuous integration application on github, however, stuck on getting error in travis like: importerror: no module named 'neo4j' below .travis.yml file: language: python python: - "3.4" - "2.7" # command install dependencies install: - pip install -q django==$django_version - pip install py2neo - pip install neo4django - pip install -r requirements.txt # command run tests script: python eb_django_app/neo4j/manage.py test env: - django_version=1.8.3 branches: only: - master manage.py : import os import sys py2neo import neo4j py2neo import serviceroot graphenedb_url = os.environ.get("graphene db url", "http://localhost:7474/") graph = serviceroot(graphenedb_url).graph if __name__ == "__main__": os.environ.setdefault("django_settings_module", "neo4j.settings") django.c

javascript - Trying to pass a populated array to my res.render. Not sure how to make a proper async callback -

i trying write takes lists of ips database, , retrieves information servers, populates object, , passes object array. seem able make each object populate, , can tell, it's being passed array, when webpage loads (or console log of array), it's empty. have reason believe has being written synchronously. i'm still new async/sync differences , functionality. tried few different methods thought work, no matter what, seem getting empty array. app.get('/', function (req,res) { //1) read out entries database. db.all('select * servers', function (err,rows) { var servers = rows; var serverlist = []; //2) parse each 1 each steamserverstatus servers.foreach( function (server) { var ip = server.ip; var port = server.port; //3) populate array each object steamserverstatus.getserverstatus(ip, port, function (serverinfo) { var servertoken = {};

unit testing - android tests for an activity inside a directory -

Image
i using android studio . noticed idea created package (without being referenced in manifest file or in gradle build file). when run test against mainactivity , going well, when want run test activity inside package i message : java.lang.runtimeexception: unable resolve activity for: intent { act=android.intent.action.main flg=0x10000000 cmp=com.echopen.asso.echopen/.custom.customactivity } @ android.app.instrumentation.startactivitysync(instrumentation.java:384) @ android.test.instrumentationtestcase.launchactivitywithintent(instrumentationtestcase.java:119) @ android.test.instrumentationtestcase.launchactivity(instrumentationtestcase.java:97) @ android.test.activityinstrumentationtestcase2.getactivity(activityinstrumentationtestcase2.java:104) @ com.echopen.asso.echopen.custom.customactivitytest.setup(customactivitytest.java:19) you can add customactivity in manifest file <activity android:name=".custom.customactivity"> </activity>

Removing Python List Items that Contain 2 of the Same Elements -

i have list mylist, contains items of form mylist = [('a','b',3), ('b','a',3), ('c','d',1), ('d','c',1), ('e','f',4)] the first , second items equal , third , fourth, although first , second elements swapped. keep 1 of each final list looks this: a,b,3 c,d,1 e,f,4 if yo want keep order of tuple, , keep first tuple when there duplicates , can : >>> sets = [ frozenset(x) x in mylist ] >>> filtered = [ mylist[i] in range(len(mylist)) if set(mylist[i]) not in sets[:i] ] >>> filtered [('a', 'b', 3), ('c', 'd', 1), ('e', 'f', 4)] if prefer not use variable : filtered = [ mylist[i] in range(len(mylist)) if set(mylist[i]) not in [ frozenset(x) x in mylist ][:i] ]

html - Python Flask Get Data Attribute From Form -

hopefully there simple answer problem. want data post in flask not standard textfield value. trick want try , find solution without using javascript, im attempting use python. this not specific example instead simplified one. i want value of "data-status" <form action="/myurl/" method="post"> <div data-status="mydatahere" class="classname"></div> </form> python @app.route('/myurl/', methods=['post']) def myurl(): #python 'data-status' value here. thanks can provide answer. you can't. if you're reason unable change html, suggest make on submit event. take @ other question: how add additional fields form before submit?

php - phpunit fails after a number of tests -

i run phpunit command line laravel website. the output (first line) is: .................fffffffffffffffff.fffffffff.fffffffffffffffff. 63 / 105 ( 60%) however, tests run fine individually. it's when run them of them fail. all errors show code 500, 200 expected. example: <pre> not ok 99 - failure: teamtest::testapishow --- message: 'a request ''http://localhost/api/v1/teams/1'' failed. got 500 code instead.' severity: fail </pre> details error occurs in line 47 of [..]vendor/laravel/framework/src/illuminate/database/connectors/connector.php line 47: return new pdo($dsn, $username, $password, $options); full output: http://pastebin.com/bt29w7lz config of phpunit: http://pastebin.com/pbt59axm it may case there many database connections open. both postgresql , mysql have limit on number of connections available, , phpunit neither pools connections nor return connections pool once used. i have increase maxi