Posts

Showing posts from August, 2010

pdf.js get info about embedded fonts -

i using pdf.js. fetching text blocks font info object { str: "blabla", dir: "ltr", width: 191.433141, height: 12.546, transform: array[6], fontname: "g_d0_f2" } is possible somehow more information g_d0_f2 . notice pdf.js gettextcontent not , not suppose match glyphs in pdfs. pdf32000 specification has 2 different algorithms text display , extraction. if can lookup font data in page.commonobjs, might not helpful extracted text content display due glyphs encoding mismatch. the page's gettextcontent doing text extraction , getoperatorlist gets (glyph) display operators. see how src/display/svg.js renderer displays glyphs.

ios - UIImageJPGRepresentation and UIImagePNGRepresentation crash -

i have imagepicker , selecting on image want upload it. need uiimage to nsdata . have used uiimagepngrepresentation , uiimagejpegrepresentation . both of cases app crash. works simulator crash in device in second time. first time works perfect. first, before using method debug image view object , after check length of nsdata after conversion.

matlab - Automatic Code Identation -

i have huge code , testing purpose have add whole script infinite while loop there short way (without pressing space each row) add space indentation whole code consider part of 1 while loop ? such example when press ctrl +r comments out line ctrl - i / cmd - i automatically indent file. other wse select multiple row , use tab / shift - tab move them backwards , forwards. for indentation must, matlab language not care not must indent it. additionally, can execute code command line, script or function called umar , command line type while 1, umar; end .

javascript - Select and hidden -

i have simple select several options. have hidden input. i want valorize hidden input selected option. so if: <select id="type" name="type"> <option value=""><fmt:message key="select.value" bundle="${g}" /></option> <option value="0"><fmt:message key="intermediary.document.attachment.logo" bundle="${i}" /></option> <option select="selected" value="riskassess"><fmt:message key="intermediary.document.attachment.riskassess" bundle="${i}" /></option> </select> i want this: <input type="hidden" id="type" name="type" value="advpf3" /> someone can me? thx. if have in plain javascript, var e = document.getelementbyid("selectid"); e.addeventlistener("change",function(){ //get selecte...

java - Leading zero in BigInteger multiplication -

i use simple function multiply big integers. 1 more leading 0 byte included output. why happened , how can prevent it? ps: , b less mod private byte[] multiply(final byte[] a, final byte[] b, final biginteger mod) { biginteger m1 = new biginteger(1, a); biginteger m2 = new biginteger(1, b); biginteger out = m1.multiply(m2).mod(mod); res = out.tobytearray(); } the 0 byte added if (positive) value has first byte 128 255. this byte needed resulting byte has @ least 1 sign bit ( https://docs.oracle.com/javase/7/docs/api/java/math/biginteger.html#tobytearray%28%29 ) biginteger.valueof(5l).tobytearray() returns byte array 1 byte (5). biginteger.valueof(128l).tobytearray() returns byte array 2 bytes (0 , 128 in unsigned representation). distinguish result from biginteger.valueof(-128l).tobytearray() which returns byte array 2 bytes (255, 128 in unsigned representation)

java - Error:The number of method references in a .dex file cannot exceed 64K & Error:Execution failed for task ':app:transformClassesWithDexForDebug'? -

i runnig app in android studio emulaor nexux 5 api 24 still below error after spending time n google came conclusion if running on device verion prior 5.0 , api 21 need set multidex if running app more 5.0 , api 21 in case not required set multidex. i not able understand cause of error below. in advance error:the number of method references in .dex file cannot exceed 64k. learn how resolve issue @ https://developer.android.com/tools/building/multidex.html error:execution failed task ':app:transformclasseswithdexfordebug'. com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: java.lang.unsupportedoperationexception

html - Check to see if form fields are empty using javascript -

i have working function checks if of forms fields not blank. part of form, have hidden div appear if 1 of fields has answer of yes selected in drop down. when have drop down item selected yes, function check if 1 of fields left empty, , when drop down has answer of no, don't want function check values of hidden div items. can't seem figure out way accomplish this. have tried far. variable label2 contains value of drop down menu, yes/no. function validateoverage() { var drive2 = document.forms["overage"]["drivers2"].value; var prodes2 = document.forms["overage"]["proddes2"].value; var sizes2 = document.forms["overage"]["size2"].value; var cases2 = document.forms["overage"]["cs2"].value; var bottle2 = document.forms["overage"]["btls2"].value; var initials2 = document.forms["overage"]["chkitls2"].value; var label2 = document.form...

c# - Passing list of objects to model with object property MVC 5 -

i trying pass list of javascript objects class object type parameter so: [httppost, route("save")] public async task<jsonresult> save (int id, list<basedynamicsavemodel> models) { var widgets = await datacontext.widgets .asnotracking() .where(e => e.isactive) .tolistasync(); var messages = new list<object>(); if (models != null) { foreach (var model in models) { if (model.model != null) { var widget = widgets.firstordefault(e => e.name.equals(model.widgetname, stringcomparison.invariantcultureignorecase)); var dynamicviewmodel = (idynamicviewmodel)activator.createinstance(type.gettype("registration.models.dynamic." + model.widgetname + "viewmodel")); dynamicviewmodel.listorder = widget.listorder.hasvalue ? widget.listorder.value : 0; ...

r - using readr want to use col_only() option -

my question how use read_csv read columns name. example: tmp <- read_csv("outcome-of-care-measures.csv") dim(tmp) [1] 4706 46 names(tmp)[c(11,17,23)] [1] "hospital 30-day death (mortality) rates heart attack" [2] "hospital 30-day death (mortality) rates heart failure" [3] "hospital 30-day death (mortality) rates pneumonia" if want use read_csv , use col_only() option how can read 1 of these columns @ time. only thing come was: tt <- read_csv("outcome-of-care-measures.csv", col_types = cols_only(hospital 30-day death (mortality) rates heart attack=col_character()), n_max = 10) error: unexpected numeric constant in "tt <- read_csv("outcome-of-care-measures.csv", col_types = cols_only(hospital 30 i have solid hunch problem lays using name of column given names() , need guidance. trying follow example in book: logdates <- read_csv("data/2016-07-20.csv.gz", col_types = cols_only(da...

Python split data from arduino serial to raspberry -

i have output serial arduino on raspberry 30.27|34.00\n 30.27|32.00\n 30.21|33.00\n code on raspberry: import serial ser = serial.serial('/dev/ttyacm0', 9600) while 1 : ser.readline() i want spit this x=30.21 y=33.00 is possible if data send in real time, thanks.. using same code have, try: import serial ser = serial.serial('/dev/ttyacm0', 9600) while 1 : data=ser.readline() x=data.split("|")[0] y=data.split("|")[1] print "x=",x print "y=",y you can streamline code more wanted make step step easier reading.

java - Daily Batch file processing exception -

i'm accessing sftp server .xml file contains information. i'm reading file , processing data updating database whatever needs updated. the file day specific, like: "file20161117". problem here is, how take care of exceptions on following day? let's batch fails, throws exception , not update. want create way verify there no errors left behind. should use table , link file's name? thank time. rhaeg

c# - Ray hit testing with Model3D -

i need test ray-model intersections. know there build in method test ray intersection viewport3d ( https://blogs.msdn.microsoft.com/wpf3d/2009/05/18/3d-hit-testing/ ) i can't find way use test model3d. need test whole model intersection, not visible part. any appreciated. ok. think have found solution. can is: modelvisual3d testmodel = new modelvisual3d(); testmodel.content = model; //model model3dgroup ... rayhittester(testmodel, origin, direction); and works supposed!

javascript - Update ReactJS app using websocket -

i trying supervision page customer, struggling updating reactjs app in real time. supervision page can contains sixteen video flux, can or cannot in service @ same time. when generate page django, build initial list stored in js variable : var anims = {{list|safe}} my reactjs code single video flux following : var modelflux = react.createclass({ displayname : "flux player", proptypes: { animid: react.proptypes.number.isrequired, }, componentdidmount:function() { //generating player }, render: function() { var newdivid = 'iv' + this.props.animid; return( react.createelement('div',{classname:'col-md-3 col-sm-6 col-xs-12'}, react.createelement('div', {id:"content"}, react.createelement('div',{id:newdivid,classname:'smallpl'}) ) ) ) } }) then, use following generate x ...

c# - Where should I put logic for run once after web api server is bootstrapped? -

for example have server: using (httpselfhostserver server = new httpselfhostserver(config)) { server.openasync().wait(); console.writeline("press enter quit."); console.readline(); } and controller: public class productscontroller : apicontroller { // here route("....") public product getproductbyid(int id) { var product = productsprovider.firstordefault((p) => p.id == id); if (product == null) { throw new httpresponseexception(httpstatuscode.notfound); } return product; } } after server unexpectedly terminated want process requests cached in database. how can call controller/action or simulate request after server bootstrapped?

java - Can't catch the custom exception in the onError() method in Rxjava -

i want deal exception myself , example ,show proper toast, write responsefunc below: public final class responsefunc<t> implements func1<baseresponse<t>, observable<t>> { @override public observable<t> call(baseresponse<t> response) { if (!response.issuccess()) { switch (response.geterror().getcode()) { case 404: { throw new errorresponseexception("say sorry")); } // , many other case here 404 500... default: { return observable.error(new errorresponseexception(response.geterror().getmessage())); } } } else { return observable.just(response.getdata()); } } } ps: here errorresponseexception extends runtimeexception but can't message "say sorry" or other exceptions thrown myself in subscriber's onerror() method (or observer's onerror() method). when print stack traces ,i...

java - Unable to broadcast a large ConcurrentHashMap in Spark 1.5.0 -

i using spark 1.5.0 cloudera distribution , in java code trying broadcast concurrent hashmap. in map() function, when try read broadcast variable, nullpointer exception in resource manager logs. can please me out? unable find resolution this. following code snippet: // broadcasting before calling mapper final broadcast<concurrenthashmap<constantkeys, object>> constantmapfinal = context.broadcast(constantmap); ....... // in map function javardd<string> outputrdd = temprdd.map(new org.apache.spark.api.java.function.function() { private static final long serialversionuid = 6104325309455195113l; public object call(final object arg0) throws **exception { concurrenthashmap<constantkeys, object> constantmap = constantmapfinal.value(); // ...

talend - Compare String using tMap -

i using talend prepare dataware. want compare string contents of column using tmap component , create variable store in db. problem == operator not give right result (example: row2.recipient == "text"?"text":"" "" ) , if use .equals errors when executing. you error if row2.recipient null, , "==" should not used when comparing strings. correct syntax : "text".equals(row2.recipient)?"text":"" then prevent nullpointerexceptions.

sql server - How to use a newly defined column name in the where clause of a query in sql 2008 -

i have query in sql server 2008 like: select t1.id, matchids = (select dbo.getcommadelimitedstring(t2.id) #temp t2 t1.id != t2.id , t1.patientid=t2.patientid , t1.hcn=t2.hcn ) #temp t1 this query has output like: id matchids 1 2,5,6 2 1,5,6 3 null 4 null 5 1,2,6 6 1,2,5 what want rid of rows matchids null. when try add matchids not null clause main query, not accepting saying invalid column name matchids and not want write same query used assign matchids in clause well. in case, best way provide it? any appreciated. just move query cross apply select t1.id, cs.matchids #temp t1 cross apply (select dbo.getcommadelimitedstring(t2.id) #temp t2 t1.id != t2.id , t1.patientid=t2.patientid , t1.hcn=t2.hcn) cs (matchids)

java - charset of the attribute values in Jsoup -

i use jsoup , need pick attribute values of tags inside html document in ascii-encoding maintaining them are, without converting them. so, have following html document <!doctype html> <head> <meta charset="ascii"> </head> <body> <div title="2 &gt; 1, 1 > 0, &agrave; vs &egrave;"> 3 &gt; 2, 1 > 0 </div> </body> which want parse means of jsoup. i need extract value of title attribite is: 2 &gt; 1, 1 > 0, &agrave; vs &egrave; . i've create document object doc below (it in kotlin, don't think important here): val charset = charset.forname("ascii") val doc = jsoup.parse(file("test.html").readtext(charset)) doc.outputsettings().charset(charset) when print out doc means of println(doc.tostring()) i following string <!doctype html> <html> <head> <meta charset="ascii"> ...

javascript - Calculate total time based on a .cpuprofile file -

i created javascript cpu profile chrome , saved .cpuprofile file. using file, want calculate "total time" each node in profile (as can seen in chrome profiler when load file.) i found out how calculate "self time" here . know how extend "total time"? i looking bottom profile times. interested, have created npm package called cpuprofile calculates necessary times.

Match two cells to place a value in Excel -

if have function right / left a b - 1 b c - 2 d 4 - 3 e - 4 2 - 5 4 d - 6 2 e - 7 how can place value of - x right side? e.g. e has 7 on left. moving 7 right side a b - 1 b-1 c - 2 d-6 4 - 3 e-7 - 4 i-4 2 - 5 4 d - 6 2 e - 7 i've tried using match function , index not wanted. thank much.

drop down menu - Is an accordian list possible in SharePoint? -

i looking set home page our group in sharepoint has 4 areas. kind of foresee 4 columns of accordion menus. problem not items under drop down have web page links. is possible do? possible add icons @ top of each column represent areas are? pretty new sharepoint design , taking class boss wanting done make more user-friendly. i prefere use jquery or javascript driven accordeon solve problem. can fetch item through sharepoint rest api or jsom. there lot of examples out there long copy in here: how create dynamic accordions in sharepoint pages csr code samples #6 (accordion) customize rendering of list view in sharepoint 2013: displaying list items in accordion

While iterating over dictionary, remove elements not required and move further in dictionary(Python) -

my concern here if name_3[0]>50, add html table , if name_3[0]<=50, discard , iterate next value in dictionary because don't want add entry below 50. below logic think of. can iterate through next value ? for name_1 in sorted(any_dictionary.keys()): name_2 in sorted(any_dictionary[name_1].keys()): name_3 in any_dictionary[name_1][name_2]: if (name_3[0] > 50): size_kb = name_3[0] address=name_3[1] html += """<tr> <td>{}</td> <td>{}</td> <td>{:,}</td> <td>{:,} [{}]</td> <td>{}</td> </tr>\n""".format(name_1, name_2, size_kb, name_3[2], name_3[...

ios - Wrong frame adding ViewController View as subview -

i'm working on custom scrollview display different views of different types pagination. for view in views { view.frame = frame frame.origin.x += width } contentviewwidth.constant = width * cgfloat(pages.count) self.setneedsupdateconstraints() works kind of custom view subclass. now have add viewcontroller "page", doing: parentviewcontroller?.addchildviewcontroller(containedviewcontroller) let width = scrollview.frame.size.width let height = scrollview.frame.size.height var frame = cgrect(x: 0, y: 0, width: width, height: height) containedviewcontroller.view.frame = frame pages.append(containedviewcontroller.view) contentview.addsubview(containedviewcontroller.view) containedviewcontroller.didmove(toparentviewcontroller: parentviewcontroller) i right frame when setting it, bug inspecting complete scrollview totally random frame size. i'm using scrollview full screen on...

c++ - Is there any danger of assigning a const char* to a string? -

i assigning const char* value string. checking condition , setting string empty default value. in parameterised constructor setting string empty follows classname:: classname(x x, string name):x(x), name(){} i set string empty once done using name=""; is above approach of initialisation correct? also there risk of assigning const char* string? const char* diag; string name; name= diag; the class std::string has corresponding constructors , assignment operators objects of type char * . problem can arise relative objects of type when initializer null pointer. take account if there declared variable this const char *name = ""; then name not null pointer. pointer first character (character '\0' ) of array of type const char[1] corresponds "empty" string literal , has static storage duration. if write example std::strig s( name ); or std::string s = name; then empty object s of type std::string becsuse th...

Recommendations on SaaS architecture books? -

does have suggestions on books on software as service (saas) architecture? company looking start providing platform product , looking examples of architecture design implementations. (one important thing note we'll using azure our cloud provider.) here suggested reading material azure service provider start on feel of scenarios accomplish. recommend video material book ramp quick , has high replay-ability. all mvp talks azure on channel 9, talks focus on interesting scenarios , cases mvps tackled of azure : https://channel9.msdn.com/blogs/mvp-azure most of azure data exposed shows, saas provider have decide , how keep customer data, show offers lot of interesting ways save data small company huge big data mining level, https://channel9.msdn.com/shows/data-exposed power apps , flow training, you have stitch solutions , give simple mobile experience during time customer, handy tool works surprising flow , power apps, ever on flow can upgraded azure functions a...

css - Different problems with my font -

i'm looking regarding font issues have. i'm working on new online store , we're using swedish e-commerce platform. have access css code, not html. i'm using "questrial" font, looks great in chrome , safari (i have mac). however, on firefox doesn't good. i'm using "all-small-caps" headlines , links in menu , these become thick in firefox. this brings me next question. logged in , checked how @ phone (galaxy s6) , surprise, none of headlines nor links in small caps - regular letters. it's obvious phones browser don't "all-small-caps". my question if there can fix these 2 problems? down below find relevant css code i'm using @ moment. any appreciated! <pre> { color: grey; font-weight: normal; } li { font-size: 18px; font-variant: all-small-caps; letter-spacing: 3px; font-weight: normal; } h1, h2, h3, h4, h5, h6 { font-variant: all-small-caps; letter-spaci...

Programatically stop Azure Service Fabric service -

we have several services running in asf cluster. possible take pause/stop/restart service in asf cluster across nodes programatically? at moment cannot stop 'service' in service fabric. can remove it. can start/stop, enable/disable nodes within cluster. there enhancement request in azure feedback forums have service start/stop feature. vote , wait implemented. https://feedback.azure.com/forums/293901-service-fabric/suggestions/13714473-ability-to-stop-disable-services-without-removing

wordpress - Using checkboxes for variations in WooCommerce to allow multiple choice -

Image
i've been using woocommerce while 1 issue causing me problem. client i'm making site provides training courses , presentations, , partiular product (or presentation) allows several different options added cart, each own price. so, base price zero. there 8 different presentations user can select via checkbox on existing website - somehow need replicate using woocommerce on new site can use drop downs variations, , far can see allows 1 option chosen. feasible way can see working if add 8 different dropdowns each 8 presentations within them , customer selects many different ones want. bit cumbersome though , potentially can cause user error (selecting same presentation twice example). i have attached screenshot of i'd ideally within woocommerce, there way achievable? don't mind using plugins if it's way. you can way: 1) edit content-single-product.php: 2) product $product = wc_get_product( $productid ) 3) check if $product->product_type == ...

c# - WPF Bind datagrid column to child collection of the collection that is bound to the datagrid -

first want i'm pretty new wpf. i'm trying bind collection datagrid column child property of collection bind datagrid. collection bind datagrid: public class commonuseparameterdata : observable { private string _currentname; public string currentname { { return _currentname; } set { if (_currentname == value) return; _currentname = value; raisepropertychanged("currentname"); } } private string _currentvalue; public string currentvalue { { return _currentvalue; } set { if (_currentvalue == value) return; _currentvalue = value; raisepropertychanged("currentvalue"); } } private commonuseparametertypevalue _currenttypevalue; public commonuseparametertypevalue currenttypevalue { { return _currenttypevalue; } set { if (_currenttypevalue == value) return; _currenttypevalue = value; raisepropertychanged("currenttypev...

javascript - JS Check if input string is valid code and run input -

so couldn't find on this. idea have user input (text) , want check if valid code in js , run if is. i know can if (typeof userinput === "function") { if userinput function, user input string input @ point, i'm quite stuck, , contains arguments or other code. as example, input may "alert('test')" , valid, , run that, "madeupfunction(lol)" invalid. i'm happy if can functions working , not js code. you can extract string until first ( in order function name, , test exists using typeof eval(funcname) . use function constructor make sure syntax valid rest of arguments without executing code. you can return function executes user entered, note there may security issues if decide execute function. function parsefunctioncall(str) { var funcname = str.slice(0, str.indexof('(')); if (typeof eval(funcname) === 'function') { return new function(str); } else { throw new error('i...

multithreading - Autodesk's Fbx Python and threading -

i'm trying use fbx python module autodesk, seems can't thread operation. seems due gil not relased. has found same issue or doing wrong? when doesn't work, mean code doesn't release thread , i'm not able else, while fbx code running. there isn't of code post, know whether did happen try. update: here example code, please note each fbx file 2gb import os import fbx import threading file_dir = r'../fbxfiles' def parse_fbx(filepath): print '-' * (len(filepath) + 9) print 'parsing:', filepath manager = fbx.fbxmanager.create() importer = fbx.fbximporter.create(manager, '') status = importer.initialize(filepath) if not status: raise ioerror() scene = fbx.fbxscene.create(manager, '') importer.import(scene) # freeup memory rootnode = scene.getrootnode() def traverse(node): print node.getname() in range(0, node.getchildcount()): child...

database - MySQL cursor fetch NULL -

Image
why both variables output null ? select part of cursor working properly. create procedure p2() begin # account table declare accountid int; declare accountname varchar(1000); # 1. cursor finished/done variable comes first declare done int default 0; # 2. curser declaration , select declare c_account_id_name cursor select accountid, accountname temp.test; # 3. continue handler defined last declare continue handler sqlstate '02000' set done = true; open c_account_id_name; set accountid = 0; set accountname = ''; read_loop: loop fetch c_account_id_name accountid, accountname; if done leave read_loop; end if; select accountname; end loop; end; variable , select attribute in cursor can't same...it's mysql bug. work dr...

javascript - Private NPM: How can the latest version of a module be installed? -

using private npm , common commands seem not work: npm install without specific @version :: issue npm outdated :: issue npm update :: issue npm view <private-package-name> versions :: (haven't found issue yet) also note npm v , npm show , , npm info aliases likewise don't work frequently, not know latest version of private module team maintains. fall on 1 of commands listed above, seem inoperative. how can install package without knowing latest version? if understand question, installing latest package be: npm install <package_name>@latest --save

How is security implemented in an ASP.NET MVC REST API application? -

i reading here, http://blog.scottlogic.com/2016/01/20/restful-api-with-aspnet50.html but missing how security. what security model used api? do give consumer generated "key"? windows authentication? mobile? i have found blog post helpful when implementing security web api. @ owin token based authentication first. blog describes usage angularjs client including mobile.

excel - How can I provide a calculated value that is based on two other values in an Aspose.Cells PivotTable? -

i adding data fields pivottable so: int totalqty_column = 4; int totalprice_column = 5; . . . pivottable.addfieldtoarea(aspose.cells.pivot.pivotfieldtype.data, totalqty_column); pivottable.addfieldtoarea(aspose.cells.pivot.pivotfieldtype.data, totalprice_column); or, providing more context: aspose.cells.pivot.pivottablecollection pivottables = pivottablesheet.pivottables; int colcount = columns_in_data_sheet; string lastcolasstr = reportrunnerconstsandutils.getexcelcolumnname(colcount); int rowcount = sourcedatasheet.cells.rows.count; string sourcedataarg = string.format("sourcedatasheet!a1:{0}{1}", lastcolasstr, rowcount); int index = pivottablesheet.pivottables.add(sourcedataarg, "a7", "pivottablesheet"); aspose.cells.pivot.pivottable pivottable = pivottables[index]; pivottable.addfieldtoarea(aspose.cells.pivot.pivotfieldtype.row, description_column); pivottable.addfieldtoarea(aspose.cells.pivot.pivotfieldtype.column, monthyr_column); pivot...

Why is my full text search not working in SQL Server? -

Image
table columns: table data: full text index definition: create unique index idx_fulltext_workorder on workorder(id); create fulltext index on workorder (description) key index idx_fulltext_workorder on full_text_catalog; query: select * [dbo].[workorder] contains([description], '"priorité 8"') incorrect result: 9 (all) rows of table, instead of single 1 corresponding query. also why query (notice * character): select * [dbo].[workorder] contains([description], '"priorité 8*"') not returning result @ (0)?

google app engine python - Using Firebase authentication with appengine decorator -

i'd use firebase authenticate/authorize user in web app, use appengine decorator in python make api calls user's google contacts/calendar backend if user authenticates google account. possible carry on firebase authentication/authorization appengine decorator?

Scala: How do I make those codes more simple? -

how make following codes more simple? quite new scala. in advance! example 1: def xsum(n: int): int = { if (n<10) n else n%10+xsum(n/10) } example 2: def num(n: int): int = { if (xsum(n)%10==0) n else (100-xsum(n))%10 + n*10 } def xsum(n: int): int = { if (n<10) n else n%10 + xsum(n/10) } example 3: def tru(n: int): boolean = { n==0 || xsum(n)%10==0 } def xsum(n: int): int = { if (n<10) n else n%10 + xsum(n/10) } def xsum(n:int):int= n.tostring.map(_-'0').sum

html - RegEx says all my inputs are false for a float number (JavaScript) -

this question has answer here: why regex constructors need double escaped? 4 answers my objective check if number has been input form via html meets following... is number between 0.01 , 100.0 is float number e.g. of format 00.01 my regex - " \d{1,3}\.\d{1,2} " - when check on regexr appears correct... http://regexr.com/3eme3 however code returning false... going wrong? (i've checked both non parsed float number , parsed float number) function checkagegrade(){ var agegradevalue = document.getelementsbyname("agegrade")[0].value; console.log("age grade input: " + agegradevalue); var correctdigits = new regexp("\d{1,3}\.\d{1,2}"); console.log("correct digits: " + correctdigits); if(!hasvalue(agegradevalue)){ document.submitrunnertime.agegrade.value = "-1"; } ...

softlayer - Error while capturing flex image -

i running following code. ` restapiclient client = new restapiclient(baseurl).withcredentials(username, apikey); account.service service = account.service(client); service.withmask().hardware(); service.withmask().hardware().fullyqualifieddomainname(); service.withmask().hardware().id(); account account = service.getobject(); string hwname="bmtest.domain.com"; hardware hw1=null; for(hardware h : account.gethardware()){ if(h.getfullyqualifieddomainname().equalsignorecase(hwname)) { hw1 = h; } } hardware.service svc= hardware.service(client); svc=hw1.asservice(client); try{ template template = new template(); template.setname(hw1.getfullyqualifieddomainname()+"-hwimg-1"); template.setdescription("image of "+hw1.getfullyqualifieddomainname()); system.out.println("starting image capture"); svc.captureimage(template);` but following error: `starting image capture com.softlayer.api.apiexception$internal: ...

angularjs - Defining routes for a angular module -

i have mainapp.js file , put code on it: var mainapp = angular.module('mainapp', []); **//routes** mainapp.config(['$routeprovider', function ($routeprovider) { $routeprovider .when('/index', { templateurl: '/views/admin/index.html' } ); }]); when run application without routes section, ok when add them mainapp.js file face $injector:modulerr error in browser. i try clear browser cache, check html pages sure including mainapp.js file , replace codes these: var mainapp = angular.module('mainapp', []).config(config); config.$inject = ['$routeprovider']; function config($routeprovider) { $provider .when('/index', { templateurl: '/views/admin/index.html' } ); } but nothing happened , face error again. can me? thanks you need inject ngroute dependency, refer angular-router library, <script src="https://ajax.googleapis.com/ajax/lib...

node.js - Node and Firebase Cloud Messaging TypeError -

keep receiving typeerror , cant figure out why. installed firebase using ( npm install firebase --save ). here code: var firebase = require("firebase"); // firebase var express = require('express'); // express instaniated different way serving static webpages var app = express(); // express app include // set port app.listen(8085); // initialize firebase var config = { apikey: "aiza...............", authdomain: ".....firebaseapp.com", databaseurl: "...............", storagebucket: "..........appspot.com", messagingsenderid: "..............." }; firebase.initializeapp(config); // create url using firebase app.get('/fcmtest', function (req, res) { const messaging = firebase.messaging(); messaging.requestpermission() .then(function () { console.log("...

reporting services - SSRS - report location -

ssrs - deployed report while , can't find it. need find can download it. how find out folder on ssrs report server? know report name , ssrs server on. try on reportserver database. select name, path catalog c type = 2 , name '%whatever%'

swift - Speech Synthesis on iOS weird errors on loading, and no concurrency -

i'm using speech synth in avfoundation, creating instance of voice this: import avfoundation class canspeak { let voices = avspeechsynthesisvoice.speechvoices() let voicesynth = avspeechsynthesizer() var voicetouse: avspeechsynthesisvoice? init(){ voice in voices { if voice.name == "arthur" { voicetouse = voice } } } func saythis(_ phrase: string){ let utterance = avspeechutterance(string: phrase) utterance.voice = voicetouse utterance.rate = 0.5 voicesynth.speak(utterance) } } i have 2 problems. there's no concurrency. calling function multiple times results in queuing of strings speak. don't want that. if there's multiple calls function, close together, i'd voice begin speaking, if means speaking on itself. how make happen? 2 - odd errors don't understand on loading: 2016-11-18 03:03:07.103349 mysktest...

javascript - Accesing the object's property form a nested function -

this question has answer here: how access correct `this` inside callback? 5 answers here java script code. var fiat = { make: "fiat", model: "500", year: 1957, color: "medium blue", passengers: 2, convertible: false, mileage: 88000, fuel: 0, started: false, start: function() { if (this.fuel == 0) { console.log("the car on empty, fill before starting!"); } else { this.started = true; } }, stop: function() { this.started = false; }, drive: function() { function update(){ this.fuel-=-1; } if (this.started) { if (this.fuel > 0) { console.log(this.make + " " + this.model + " goes zoom zoom!"); ...

loops - AHK: Remove Duplicates While Parsing Text Into Array -

i work @ doctors office doing billing, , i've been writing code streamline billing process. must include diagnoses in billing software, copy whole chart, , parse array newlines looking prefix icd-10, , if 2 codes on same line, separates (via comma). before that, removes part (if exists) of chart includes canceled procedures canceled procedures aren't charged. sometimes, multiple of same diagnosis included in chart purpose of ordering procedure (it's automatic), , need add each diagnosis array once. [...] sendinput, ^a clipboard := sendinput, ^c clipwait blockinput, mousemoveoff lstring := clipboard sleep, 200 ifinstring, lstring, canceled orders { lstringleft := substr(lstring, 1, instr(lstring, "canceled orders")-1) sleep, 20 lstringright := substr(lstring, instr(lstring, "allergies of")) sleep, 20 lstring...

Upload file to file system in grails while using scaffolding to generate controllers and views -

i'm using grails 2.2.2 . in project, i'm scaffolding controllers , views domain. want upload file , store uploaded file on file system, instead of database. in db, i'm going store location of uploaded file. i googled bit found way store uploaded file in db defining byte[] property , don't want that. please tell me how save uploaded file on file system scaffolding you can't scaffolding. you'd have implement actual action in controller. assuming want save file in save() action: def save() { def somefile = request.getfile("somefile") // create new file somewhere store uploaded file: def file = new file("/some/path/for/file.foo") somefile.transferto(file) } obviously, there's better ways manage in terms of paths , doing in service, etc. that's gist , takeaway can't scaffolded.

java - How to access JNDI DataSource with Play Framework -

according documentation: https://www.playframework.com/documentation/2.5.x/javadatabase#exposing-the-datasource-through-jndi i need entry in application.conf expose datasource in jndi: db.default.driver=org.h2.driver db.default.url="jdbc:h2:mem:play" db.default.jndiname=defaultds i've added "tyrex" % "tyrex" % "1.0.1" librarydepenencies in build.sbt . from reading several other posts on this, sound should able use datasource ds = (datasource) play.api.libs.jndi.initialcontext().lookup("defaultds"); to fetch datasource jndi. however, when try throws following exception: javax.naming.namenotfoundexception: defaultds not found @ tyrex.naming.memorycontext.internallookup(unknown source) @ tyrex.naming.memorycontext.lookup(unknown source) @ javax.naming.initialcontext.lookup(initialcontext.java:417) the main reason i'm trying quartz can re-use datasource/connectionpool created play instead of defi...

Spring boot 1.4.2 with Tomcat 8.5.8 crashes, port already in use. Works fine with Tomcat 8.5.6 -

i've got 2 relatively simple spring boot apps. both use tomcat 8.5.6 spring boot 1.4.2. , work fine. for grins , giggles, changed tomcat version latest version in tree, 8.5.8. now, neither app starts. "port 8080 in use". somehow, spring boot seems start port 8080 twice (or not catching fact has started , tries again). any ideas? the problem caused tomcat team refactoring embedded startup in way broke spring boot. it's fixed in tomcat 8.5.9

javascript - telegram-mt-node POST response OK, but buffer expects Uint8Array but gets TypedArray -

i working on telegram web client app , able make successful post , encrypted response telegram server inside telegram-mt-node the root of problem comes down buffer array parsed after response: uncaught typeerror: "list" argument must array of buffers the array expects in telegram-mt-node is: uint8array, receives typedarray instead. first post header is: accept:*/* accept-encoding:gzip, deflate accept-language:en-us,en;q=0.8 cache-control:no-cache connection:keep-alive content-length:40 host:149.154.167.40:443 origin:null pragma:no-cache user-agent:mozilla/5.0 (macintosh; intel mac os x 10_10_5) applewebkit/537.36 (khtml, gecko) chrome/49.0.2623.87 safari/537.36 the request payload encrypted the response header is: access-control-allow-headers:origin, content-type access-control-allow-methods:post, options access-control-allow-origin:* access-control-max-age:1728000 cache-control:no-store connection:keep-alive content-length:84 content-type:application/octe...

c# - GetLocalWorkspaceInfo always get null -

my problem similar tfs api: getlocalworkspaceinfo returns null , except using visual studio 2015, answers don't work me. , tried getalllocalworkspaceinfo, returns null well. thanks i have tested code snippet referred in vs 2015 , got successful result. make sure have reference dlls in vs 2015: c:\program files (x86)\microsoft visual studio 14.0\common7\ide\commonextensions\microsoft\teamfoundation\t‌​eam explorer and in code snippet, need use console.writeline output workspace information want: private static workspace findworkspacebypath(tfsteamprojectcollection tfs, string workspacepath) { versioncontrolserver versioncontrol = tfs.getservice<versioncontrolserver>(); workspaceinfo workspaceinfo = workstation.current.getlocalworkspaceinfo(workspacepath); if (workspaceinfo != null) { console.writeline(workspaceinfo.computer); console.writeline(workspaceinfo.displaynam...

Is it possible to ad a different text in each ad created via Facebook -

i want create facebook ad client , embed different unique code in each of text/image. not find such way automatically achieve that. using " https://www.facebook.com/ads/manager/ " create ads. so can create different text/image in each ad. unique code can append url parameters (url_tags) url on ad creation flow.

angular - angular2 ngbdatepicker how to format date in inputfield -

i using bootstrap implemenatation angular2' ng-bootstrap.github.io i wants format date displayed in input field model. looked @ api didn't find example other ngbdateparserformatter without explaning :( in angular1 simple adding attribute format="mm/dd/yyyy". can 1 ? i created issue , found answer on following link https://github.com/ng-bootstrap/ng-bootstrap/issues/1056

c# - Adding EventTrigger on a ListView inside DataTemplate results in XamlParseException -

i'm creating wpf app using mvvmlight. defined listview inside tabcontrol datatemplate, so: <tabcontrol.contenttemplate> <datatemplate> <listview itemssource="{binding builds}" scrollviewer.horizontalscrollbarvisibility="disabled" selecteditem="{binding selectedbuild, mode=twoway}" selectionmode="single"> <i:interaction.triggers> <i:eventtrigger eventname="mousedoubleclick"> <i:invokecommandaction command="{binding buildselectedcommand}"/> </i:eventtrigger> </i:interaction.triggers> </listview> </datatemplate> </tabcontrol.contenttemplate> but xaml designer returns error (preventing load of designer preview): xamlobjectwriterexception: collection property 'system.windows.contr...

html - Django Rest - Create method, returns error 405 Method Not Allowed -

i created view create new object. in drf default page works fine, when try create simple html page user interface (by adding renderer_classes , template_name view), following error occurs: 405 method not allowed. i created html page retrieve/update client detail information, , works fine. however, unable create new client. models.py class client(models.model): client_rut = models.charfield(max_length=12, unique=true, verbose_name="rut") client_name = models.charfield(max_length=250, verbose_name="nombre cliente") client_region = models.charfield(max_length=50, verbose_name="region") client_tel = models.charfield(max_length=20, blank=true, verbose_name="telefono") client_email = models.emailfield(blank=true, verbose_name="e-mail") is_active = models.booleanfield(default=true, verbose_name="activo") class meta: ordering = ['client_rut'] def __str__(self): retur...

Using Git to Figure out How Long a Line of Text Has Been In a File -

suppose have file1.txt in git repository. suppose file has line of text: an old line of text . is there way figure out, through git (or other unix utility?) how many days line of text has been in file? you can use datefrom=$(git log --pretty=format:'%cd' --date=format:'%y-%m-%d' -s 'line find' -- file1.txt) that result in date of commit introduced string. log searches commit history -s option finds first introduction of string --pretty=format:'%ad' prints committer date --date=format formats date now this: https://unix.stackexchange.com/questions/215934/whats-a-smart-way-to-count-the-number-of-days-since-x get: echo $(( (`date +%s` - `date +%s -d $(datefrom)`) / 86400 )) which results in number of days introducing commit. ofcourse can put in 1 command , make alias, or can create git-command-name script , put user/bin folder , git recognize git command can invoke git command-name 'line find'

php - Laravel Eloquent query unexpected result -

i've found query result unexpected. it's laravel 5.2 we have following entity: user method: public function roles() : belongstomany { return $this->belongstomany(role::class)->withpivot('timestamp'); } each user can have many roles, have role entity (but doesn't matter in question) , pivot table user_role timestamp field (and ids of course), because hold information time, when user achieved specific role. i want users theirs last assigned role when create query (in user context in repository): $this->with(['roles' => function($query) { $query->orderby('timestamp', 'desc'); }])->all(); the result contain users roles entities inside ordered timestamp - it's ok. want retrieve one last role inside each user entity not all ordered. so... $this->with(['roles' => function($query) { $query->orderby('timestamp', 'desc')->limit(1); }])->all(...