Posts

Showing posts from March, 2015

c++ - Matching contours to level images - OpenCV -

Image
is possible match & level contours in image? possibly symmetric matching? if so, matcher use purpose? demonstration image: in image of lovely imac, can see images passed in unleveled. because took first image @ different height second image.. example: (first image capture) (second image capture) so, instead of matching features on image, wondering if opencv has feature matcher limit me match edges of 1 image ends, , other 1 begins. way, straighten them up. what use: bestof2nearestmatcher gridadaptedfeaturedetector gfttdetector siftdescriptorextractor refining camera parameters based on features basic opencv sample what hope result: my target result align images in demonstration image above. i kind of working on same issue. can surely limit feature points using mask. in case know there 50% overlap in adjacent images, have used features in later half (x > im.cols)of first image , initial half of second image(x < im.co...

Java response.sendRedirect() not clearing angularjs state providers url after # -

currently working in angular js , j2ee frameworks. currently http:something.com/home/#/main but if redirect above url java servlet using response.sendredirect("http:something.com/login/") it redirects me page in browsers url "#/main" remains after redirecting below.... http:something.com/login/#/main. i don't want angulars state after redirection. thanks in advance the prevailing browser behaviour preserve url fragments after redirects . if location in redirect contains url fragment, override carried on url fragment. so append empty url fragment (hash mark # ) redirect clears being carried over. response.sendredirect("http://something.com/login/#")

php - WP Cron Job Runs On Every Page Load -

i trying wrap head around wp cron jobs , have been playing around following snippet of code, supposed send email specified email address once hour, provided of course visitor has visited site , triggered job (wp cron jobs aren't apparently real chron jobs, i've come understand). now, job works in email gets sent email address, there 2 problems: the email gets sent multiple times per chron job cron jobs seem triggered on every page load though it's not supposed run more once hour here's code (retrived wp_schedule_event not firing ): if ( ! wp_next_scheduled( 'prefix_hourly_event' ) ) { wp_schedule_event( time(), 'hourly', 'prefixhourlyevent'); } add_action( 'prefixhourlyevent', 'prefix_do_this_hourly' ); function prefix_do_this_hourly() { wp_mail('myemail@gmail.com','cron working', 'cron working: ','',''); } would able give me idea of why not 1 email ge...

Java debugging on CodeHS -

i need debugging this; problems on lines 10-13. says can't convert string int, don't know how fix it. code looks word "bug" within given strings. public class bughunter extends consoleprogram { public void run() { string test1 = "debug"; string test2 = "bugs bunny"; string test3 = "boogie"; string test4 = "baby buggie"; int index1 = findbug(test1); int index2 = findbug(test2); int index3 = findbug(test3); int index4 = findbug(test4); printbug(test1, index1); printbug(test2, index2); printbug(test3, index3); printbug(test4, index4); } // returns index of string "bug" inside string str // if str not contain string "bug", returns -1 public string findbug(string str) { str.indexof("bug"); } public void printbug(string test, int index) { ...

ios - EXC_BAD_ACCESS Using IBInspectable -

Image
i trying use ibinspectable add borders views. extension uiview { private func getborder(integer: int) -> uirectedge { if integer == 1 { return .top } else if integer == 2 { return .left } else if integer == 3 { return .right } else if integer == 4 { return .bottom } return .all } @ibinspectable var border: int? { { return self.border } set (value) { self.border = value v in addborder(edges: self.getborder(integer: self.border!)) { self.addsubview(v) } } } @ibinspectable var bordercolor: uicolor? { { return self.bordercolor } set (value) { self.bordercolor = value //exc_bad_access here v in addborder(edges: self.getborder(integer: self.border!), color: bordercolor!) { self.addsubview(v) ...

html - CSS vw and vh but relative to the parent instead of viewport -

i'm trying create fixed aspect ratio box resizes not overflow parent. the classic padding-bottom trick able define height in terms of parent width, , testable here allows element grow taller parent width increases. not good. using vh , vw however, can accomplish want restriction parent dimensions of viewport. testable here . <style> div { max-width: 90vw; max-height: 90vh; height: 50.625vw; /* height defined in terms of parent width (90*9/16) */ width: 160vh; /* width defined in terms of parent height, missing padding-bottom trick (90*16/9) */ background: linear-gradient(to right, gray, black, gray); } </style> <div></div> is there way have vh , vw equivalent references parent instead of viewport? or there complimentary trick padding-bottom trick fixes problems? css ratio property? also, images have sort of intrinsic ratio , i'm unsure how take advantage of this. you can use similar did in maintain aspect...

python - Interpret regular expression -

this question has answer here: what differences between lazy, greedy , possessive quantifiers? 1 answer i'm trying parse output looks below. 1 192.168.1.1 0.706 ms 0.654 ms 0.697 ms 2 10.10.10.10 4.215 ms 4.199 ms 4.175 ms 3 123.123.123.123 4.000 ms * * i have regular expression works, follows. this regex works: re.compile(r'^\s*(\d+)\s+?([\s\s]+?(?=^\s*\d+\s+))', re.m) this capture each line properly. ('1', ' 192.168.7.1 0.706 ms 0.654 ms 0.697 ms\n') ('2', ' 10.10.10.10 4.215 ms 4.199 ms 4.175 ms\n') ('3', ' 123.123.123.123 4.000 ms * *\n') my question bold ? in front of (?=^\s*\d+\s+) i.e. changing regular expression follows. this regex not work . difference ? mark removed. re.compile(r'^\s*(\d+)\s+?([\s\s]+(?=^\s*\d+\s+))...

cryptography - How to encrypt a message with AES encryption? -

this question has answer here: encrypt string using openssl command line 3 answers i read article pirate bay's secret aes encrypted message being solved. (this old news) the solver used command in linux terminal decrypt message. echo "jyo7wnzc8xht47qkwohfdvj6sc2qh+x5tbct+uetocijcjqnp/2f1viebr+ty0cz" | openssl aes-128-cbc -k $(printf wearetpb | sha256sum | head -c 32 | tr '[:lower:]' '[:upper:]') -nosalt -nopad -iv 0 -base64 -d -p the decrpyted message link: https://www.youtube.com/watch?v=-yeg9dgrhha i want encrpyt own custom message same way pirate bay did. assume need change encrypted text custom message , change command encrypt, rather decrypt. how do this? it should simple as: echo -n "https://stackoverflow.com/q/39197703/5128464" | openssl aes-128-cbc -k $(printf wearetpb | sha256sum | head -c 32 | tr...

ecmascript 6 - How can I write a generator in a JavaScript class? -

usually, write code this: //definition exports.getreply = function * (msg){ //... return reply; } //usage var msg = yield getreply ('hello'); but how can write , use generator in , out of es6 class? tried this: class reply{ *getreply (msg){ //... return reply; } *otherfun(){ this.getreply(); //`this` seem have no access `getreply` } } var reply = new reply(); reply.getreply(); //out of class,how can access `getreply`? i tried: class reply{ getreply(){ return function*(msg){ //... return reply; } } } all of these 2 methods seem wrong answers. how can write generator functions in class correctly? edit: add more examples. class definition (almost) correct.the error in instantiation var reply = new reply(); . tries redefine variable assigned class name. generator function expected yield something. elaborated little op code show working examp...

r - ggplot alter map fill opacity by second variable -

i'm creating cloropleth map of u.s each county colored proportion of 2012 votes obama. i'd vary opacity of county overlays population (similar done here ). i've tried adding alpha = populationvariable geom_map aes, without luck. here current code. can point me in right direction? gg <- ggplot() gg <- gg + geom_map(data=mapc, map=mapc, aes(x=long, y=lat, map_id=id, group=group, fill=mapc$proportionobama)) gg = gg+ scale_fill_gradient2(limits= c(0,100), name="proportion of votes obama", low="#e5000a", high="#0012bf",mid="#720964", midpoint=50) gg = gg + theme_map() +coord_equal() gg <- gg + geom_path(data = maps, aes(long,lat, group=group), colour="gray50", size=.25) gg = gg + theme(legend.position="right") gg i think alpha needs variable that's mapped between 0 , 1. ggplot documentation shows fractional value. hue scale - http://docs.ggplot2.org/0.9.3.1/scale_hue.html color fil...

sql - Multiple update rows with a column as parameter -

i'm trying update multiple rows in table: nip | attendancedate | intime | outtime ---------------------------------------------------------------------------------------------- 1105321|2016-08-30 00:00:00.000|1900-01-01 00:00:00.000|1900-01-01 00:00:00.000 1105321|2016-08-31 00:00:00.000|1900-01-01 00:00:00.000|1900-01-01 00:00:00.000 1105321|2016-09-01 00:00:00.000|1900-01-01 00:00:00.000|1900-01-01 00:00:00.000 1105321|2016-09-02 00:00:00.000|1900-01-01 00:00:00.000|1900-01-01 00:00:00.000 i want update intime & outtime . i know can this update attendance set intime = '2016-08-30 08:00:00.000', outtime = '2016-08-30 18:00:00.000' nip = '1105321' , attendancedate = '2016-08-30' but query, must 1 one. so, question can update once? don't need update 1 one. possible? sorry bad english. update : so don't need update attendance set intime = '2016-08-30 0...

javascript - attr not working in IE -

i'm newbie jquery. i'm trying add "input" tag form in different select case. $(document).ready(function() { $("select[name=inputsource]").change(function() { if (this.value == 3) { eth_input = true; $(".page_ip").attr("form", "broadcastform"); } else { eth_input = false; $(".page_ip").attr("form", ""); } }); }); but attr seems not working ie. search article people suggest use data-* ie browser. problem still need change "form" attribute in order make input form. there anyway apply attr change "form" attribute? it's not form attribute isn't being applied code. it's ie doesn't support it (not ie11). details , possible workaround in question , answers (and other questions , answers linked it).

c# - Instance of an abstract class not working -

i'm sure many of mark repeaed second see title. please bear me..facing complicated issue. :) thanks reading till here :d so, have class called infoclass, abstract- public abstract class infoclass { public abstract string brand { get; set; } public abstract string brandcount { get; set; } } i have service in i'm making list out of it..and down line tryin make instance of same. not able to- [webmethod] public void getinfolist() { list<infoclass> listinformations = new list<infoclass>(); . . . //going ahead in program i've created reader . . . . while (rdr.read()) { //this block not working infoclass advertises = new infoclass(); advertises.brand = convert.tostring(rdr["brand"]); } please me out alternative code. i'm sure class meant abstract, cant c...

sql server - SQL Sum Column Between Two Dates -

Image
i have problem sum price column between 2 dates in sql server. i have query : select oslp.slpname salesman, cast(oinv.doctotal float) achiev, oinv.taxdate oinv inner join inv1 on inv1.docentry = oinv.docentry inner join oslp on oinv.slpcode = oslp.slpcode inner join oitm on inv1.itemcode = oitm.itemcode inner join omrc on oitm.firmcode = omrc.firmcode inner join ocrd on oinv.cardcode = ocrd.cardcode oslp.slpname '01-2 ika' , oinv.taxdate between '20160804' , '20160806' group oslp.slpname, oinv.doctotal, oinv.taxdate the result of query above : i have added sum on "cast(oinv.doctotal float) achiev" : cast(sum(oinv.doctotal) float) achiev but, returns wrong result : the correct result of achiev column on dates should 4906230 many help! update (solved) have solved problem. add distinct sum query, because there duplicate of data in query. query : select oslp.slpname sal...

Javascript: Constructor or Literal notation? -

this question more aimed @ developers professionally, , or work freelancers/in teams/for businesses/etc. is using literal javascript notation more sought after constructor notation? matter kind of notation use when writing javascript? employers care, or there more professional notation? literal notation var snoopy = { species: "beagle", age: 10 }; constructor notation var buddy = new object(); buddy.species = "golden retriever"; buddy.age = 5; if literal notation work situation, more compact , preferred on second method. there types of properties cannot expressed in literal notation must set manually assigning property in second scheme. for example if want refer other property on object, can't in literal definition have property assignment on constructed object. var snoopy = { species: "beagle", age: 10 }; snoopy.peopleage = convertdogagetopeopleage(snoopy.age); what refer "constructor notation"...

android - Line edittext have space from top -

Image
i want create line edittext , set it's height match parent when display have space top shown in below image. here code : public class lineedittext extends edittext { private rect mrect; private paint mpaint; public lineedittext(context context, attributeset attrs) { super(context, attrs); mrect = new rect(); mpaint = new paint(); mpaint.setstyle(paint.style.fill_and_stroke); mpaint.setcolor(color.parsecolor("#afaaaa")); } @override protected void ondraw(canvas canvas) { int height = getheight(); int line_height = getlineheight(); int count = height / line_height; if (getlinecount() > count) count = getlinecount(); rect r = mrect; paint paint = mpaint; int baseline = getlinebounds(0, r); (int = 0; < count; i++) { canvas.drawline(r.left, baseline + 1, r.right, baseline + 1, paint); baseline += getlineheight(); } super.ondraw(canvas); } edittext.xml <?xml versi...

javascript - Draggable pin not updating coordinates in Google Maps API -

i have code allows users insert pins in google maps, clicking on map. i'm trying make pin draggable, added draggable:true, in initialization of markers. not updating field coordinates. works if user clicks in place. missing? // global "map" variable var map = null; var marker = null; // popup window pin, if in use var infowindow = new google.maps.infowindow({ size: new google.maps.size(150,50) }); // function create marker , set event window function function createmarker(latlng, name, html) { var contentstring = html; var marker = new google.maps.marker({ position: latlng, map: map, zindex: math.round(latlng.lat()*-100000)<<5 }); google.maps.event.addlistener(marker, 'click', function() { infowindow.setcontent(contentstring); infowindow.open(map,marker); }); google.maps.event.trigger(marker, 'click'); return m...

bitmap - How can I lock my object using C# in dll -

i have i/p camera , function repeating , receiving each frame. public bitmap processframe(bitmap frame) { } here buffering place buffering last 100 bitmaps: lock (writer) { bm[now] = new bitmap(frame); = (now == 99) ? 0 : + 1; } when press record record video, need save every buffered bitmaps , after have save incoming bitmaps received after pressing record. when press record , using code below save buffered bitmaps video file lose of incoming frames. incoming frames while processing section, dropped , don't want drop them. lock (writer) { (int = now; < 150; i++) { if (bm[i] == null) break; writer.writevideoframe(bm[i]);//adding frame existing open file } if (now != 0) { (int = 0; < - 1; i++) { writer.writevideoframe(bm[i]);//adding frame existing open file } } } here part incoming frames saved in video file lock (writer) { writer.writevideoframe(frame);//adding frame existing ope...

asp.net mvc - Is Ajax POST an acceptable technique for changing server state? -

i designing new website , considering using ajax post requests better user experience. using ajax post requests changing server state acceptable design practice? security concerns in using ajax post requests? recommended restrict server state changes http post only? edit i using asp.net mvc web framework implementation. post, put, patch , delete (although last 1 barely used) request types traditionally alter server state. in order answer question, important consider framework using, each 1 might have different best practices. from technical point of view, practically same, have different semantic meanings , conventions attached them. if use post everything, doubt complain

Android Lolipop SDcard Permission -

i developing application which uses permission of write_external_storage ,i using line delete files sdcard : intent intent = new intent(intent.action_open_document_tree); when use intent ask permission give external storage again , again, don't want this.

How to import third lib in rnplay(React Native Playground)? -

i found question existed in react-native-gallery , , want test in rnplay , how import react-native-gallery in rnplay ? directly import encounter error 'unable resolve module react-native-gallery '. this not possible atm. according about page : you may use native modules react native itself, or include in our build. your app may not work if uses features not available in our supported react native versions. your app can't yet refer locally stored assets, since have no way package @ runtime.

Get stack trace in Java -

how exception stack trace in java? can use thread.currentthread().getstacktrace().but error linenumber correctly: java.lang.arithmeticexception: / 0 @ me.edagarli.main.main(main.java:32) wrongly: java.lang.arithmeticexception: / 0 java.lang.thread.getstacktrace(thread.java:1589) me.edagarli.main.main(main.java:54) public string getfullerrordescription(exception exceptionobj ) { string textmsg = ""; if (exceptionobj != null) { stacktraceelement[] ste = exceptionobj.getstacktrace(); textmsg += "\nin file : " + ste[index].getclassname() + " "; textmsg += "\nin method : " + ste[index].getmethodname() + "() "; textmsg += "\nat line :" + ste[index].getlinenumber() + " "; } system.err.println(textmsg); return textmsg; }

MS Access Form Style -

Image
my question styling form. if create "split form" in ms access, it's design in flatty style: but whenever create form "form design" has old styled edges design: i'm using ms access 2013. tryed change formatting options no success. there way can make form design flatty in split form? that controlled form.borderstyle property. the first 1 "thin", second "sizable".

java - Locked object found on oracle.jdbc.driver.T4CConnection -

Image
i using jmc perform application profiling , did not see locked/thread contention shown in screenshot below. ran sql below (every few secs) did not return result. select (select username v$session sid=a.sid) blocker, a.sid, ' blocking ', (select username v$session sid=b.sid) blockee, b.sid v$lock a, v$lock b a.block = 1 , b.request > 0 , a.id1 = b.id1 , a.id2 = b.id2; what caused of lock database connection? database record/table locks? below thread dump have extracted during execution of program when seems running forever. java.lang.thread.state: runnable @ java.net.socketinputstream.socketread0(native method) @ java.net.socketinputstream.socketread(socketinputstream.java:116) @ java.net.socketinputstream.read(socketinputstream.java:170) @ java.net.socketinputstream.read(socketinputstream.java:141) @ oracle.net.ns.packet.receive(packet.java:283) @ oracle.net.ns.datapacket.receive(datapacket.j...

python - AttributeError: probability estimates are not available for loss='hinge' -

text_clf = pipeline([('vect',countvectorizer(decode_error='ignore')), ('tfidf',tfidftransformer()), ('clf',sgdclassifier(loss = 'hinge',penalty = 'elasticnet',alpha = 1e-3,n_iter = 10, random_state = 40))]) text_clf = text_clf.fit(traindocs+valdocs,np.array(trainlabels+vallabels)) predicted = text_clf.predict_proba(testdocs) how can predicted probability of every test sample? thanks!

teamcity - Visual Studio .sln runner - Octopus Packaging - Append to package ID string not working -

i using teamcity visual studio (.sln) build step. in build step have "run octopack" setting enabled , package version set team city build number. i include specific string in each produced package id , seem 'append package id' setting available in build step best/easiest way achieve this. string include here never shows in produced .nupkg files. am misunderstanding purpose of setting or there additional requirements use field? in order use functionality you'll need upgrade octopack version @ least 3.0.6 install-package octopack -version 3.0.6 hope helps

Flink Queryable state not working -

i running flink ide. storing data in queryable is working, somehow when query it, throws exception exeception failure(akka.actor.actornotfound: actor not found for: actorselection[anchor(akka.tcp://flink@127.0.0.1:6123/), path(/user/jobmanager)]) my code: config.setstring(configconstants.job_manager_ipc_address_key,"localhost") config.setstring(configconstants.job_manager_ipc_port_key,"6123") @throws[throwable] def recover(failure: throwable): future[array[byte]] = if (failure.isinstanceof[assertionerror]) return futures.failed(failure) else { // @ startup failures expected // due races. make sure don't // fail test. return patterns.after(retrydelay, test_actor_system.scheduler, test_actor_system.dispatcher, new callable[future[array[byte]]]() { @throws[exception] def call: future[array[byte]] = return getkvstatewithretries(queryname, key, serializedkey) }) } } @suppresswarnings(array("unchecked")) private def getkvs...

php - I get 0 value everytime in selected option -

i create 1 form in html boostrap , connect database. i'm able input values whatever type in form. snowdrop list 0 value in table database. <div class="dropdown form-group"> <select class="form-control" name="exp"> <option value="experience">experience</option> <option value="0 yr">0 yr</option> <option value="<1 yr"><1 yr</option> <option value="<2 yr">2 yr</option> <option value="<3 yr">3 yr</option> <option value="<4 yr">4 yr</option> <option value="<5 yr">5 yr</option> <option value="<6 yr">6 yr</option> <option value="<7 yr">7 yr</option> <option value="<8 yr">8 yr</option...

svn - Is there a way to do a really SPARSE checkout for git? -

i saw question here , question 2010 , talks git version < 2 mostly. , of given answers seem indicate: can restrict "current" checkout; have full history locally. the later thing problem. moved svn git our main repository; , .git has 8, 9 gb (a lot of history, , lot of huge files). but: 1 tiny directory in huge repository small python tool (lets call px) own , use daily. before moving backend git, use git-svn, twice: full checkout of huge repository containing (for real development work); , sparse checkout containing px. now wondering if git 2.95 in 2016 provides option use git used git-svn before. meaning - having working git px, px only.

Archiving folder and node jenkins -

jenkins seems archive jobs on master node. problem archive quite big, , master node used several service. not right place data. is there configuration or plugin can use set archiving locations? you can select custom location storing build data (which includes archives) via manage jenkins -> configure system -> advanced -> build record root directory . there not simple way only move build archive data different place. best switch different storage method instead, e.g., use artifactory .

asp.net mvc - 2 gijco grid in a same view -

i have problem gijco grid in case. i have 2 grids in same view (asp.net mvc). if have pager in first grid , not in second, second grid doesn't load tha data... if uncomment pager on second grid (with same condition) data loaded (see code). source $(document).ready(function () { datasourceiniziale = @html.raw(json.encode(model.psa)); dsistruttori = @html.raw(json.encode(model.istruttori)); $("#hdatasource").val(json.stringify(@html.raw(json.encode(model.psa)))); grid = $("#gridpsa").grid({ pager: { enable: true, limit: 10, sizes: [10, 20, 50, 100] }, datasource: datasourceiniziale, selectionmethod: 'checkbox', selectiontype: 'multiple', detailtemplate: '<div class="panel-footer"><div class="alert alert-warning small"><span class="glyphicon glyphicon-info-sign"></span><br /><b...

java - Invoking a default method inside a static method of interface -

i need call default method inside interface's static method (two methods in same interface- 1 default , other 1 static). possible? if so, how can achieve this? look @ code portion better understand question: interface a{ default void callee(){ //do here } static void caller(){ //call callee() method anyhow } } you need instance call non-static method. static void caller() { new a(){}.callee(); } it better avoid static non-static calls. suppose can extract part of callee static method.

rest - How to get the image url from a gallery in sonata media bundle, for use it with FOSRestBundle? -

i'm working on mobile app has show images of houses server. have installed symfony2, fosrestbundle , sonata media bundle backend. in order houses images urls, have configured fosrestbundle entity named property has gallery field. rest controller class propertiescontroller extends fosrestcontroller { public function getpropertiesaction() { $response = $this->getdoctrine()->getrepository('comissionbundle:property')->findall(); if ($response == null){ return "no properties"; } else{ return $response; } } } but this: [ { "id":2, "name":"test", "city":"test", "address":"test", "sector":"test", "area":0, "rooms":112343, "price":0, "gallery":{ "context":"defau...

python 3.x - How to use Boto3 pagination -

background: the aws operation list iam users returns max of 50 default. reading docs (links) below ran following code , returned complete set data setting "maxitems" 1000. paginator = client.get_paginator('list_users') response_iterator = paginator.paginate( paginationconfig={ 'maxitems': 1000, 'pagesize': 123}) page in response_iterator: u = page['users'] user in u: print(user['username']) http://boto3.readthedocs.io/en/latest/guide/paginators.html https://boto3.readthedocs.io/en/latest/reference/services/iam.html#iam.paginator.listusers question: if "maxitems" set 10, example, best method loop through results? the i tested following loops 2 iterations before 'istruncated' == false , results in "keyerror: 'marker'". not sure why happening because know there on 200 results. marker = none while true: paginator = client.get_paginator('list_users...

portability - Is there a portable way to get the current username in Python? -

is there portable way current user's username in python (i.e., 1 works under both linux , windows, @ least). work os.getuid : >>> os.getuid() 42 >>> os.getusername() 'slartibartfast' i googled around , surprised not find definitive answer (although perhaps googling poorly). pwd module provides relatively easy way achieve under, say, linux, not present on windows. of search results suggested getting username under windows can complicated in circumstances (e.g., running windows service), although haven't verified that. look @ getpass module import getpass getpass.getuser() 'kostya' availability: unix, windows p.s. per comment below " this function looks @ values of various environment variables determine user name. therefore, function should not relied on access control purposes (or possibly other purpose, since allows user impersonate other). "

javascript - how to display complete array? -

i getting error: [object object],[object object],[object object]. i want display complete array this: john doe, anna smith, peter jones <!doctype html> <html> <body> <h2>create object json string</h2> <p id="demo"></p> <script> var text = '{"employees":[' + '{"firstname":"john","lastname":"doe" },' + '{"firstname":"anna","lastname":"smith" },' + '{"firstname":"peter","lastname":"jones" }]}'; obj = json.parse(text); document.getelementbyid("demo").innerhtml = obj.employees; </script> </body> </html> you coud use array#map , build new array , join later. var text = '{"employees":[' + '{"firstname":"john","lastname":"doe...

Android 6 Samsung Touchwiz launcher icons are bigger than of non samsung apps -

Image
anbdroid stock samsung icons displayed bigger non samsung icons. took screenshot of custom icon 144x144 px next stock samsung browser icon, displayed @ least 6 pixel larger. the reason must .qmg decoded icon samsung propietary. have looked .qmg encoder there no official way. tried samsung theme designer older bada devices able create qmg files (i have replaced background desired icon , exported whole theme, replaced ending .zip , exported background) samsung theme designer . unfortunately android not able decode created icon. is there way stretch normal app icon same oversize stock samsung icon or there way encode .qmg icon? have found decoder tool on xda-developers: [tool] converter qmg/astc->png , uses decoder on device create png files. update i did research , noticed strange thing. if create empty icon thin single boarder, icon stretched same size samsung icons. if fill icon content, shrinked. is samsung touchwiz behaviour or general android 6 issue? don...

javascript - "Cross origin requests are only supported for HTTP." with Node.js -

the following code in client app: const socket = io('${location.protocol}//${location.hostname}:8090'); is giving me following error in browser: xmlhttprequest cannot load http://${location.protocol}/socket.io/?eio=3&transport=polling&t=lrlutss. cross origin requests supported http. my client code run using node.js via npm start " http://localhost:3000 " automatically refreshed in browser update code. it appears ${location.protocol} not being substituted in string , it's still in url when socket.io tries use url. because browser not support specific es6 feature. you can work around constructing url string old fashioned way string addition. const socket = io(location.protocol + '//' + location.hostname + ':8090'); and, should using backticks string delimiters if expect substitution work reliably supported.

Python, HTTPS GET with basic authentication -

im trying https basic authentication using python. im new python , guides seem use diffrent librarys things. (http.client, httplib , urllib). can show me how done? how can tell standard library use? in python 3 following work. using lower level http.client standard library. check out section 2 of rfc2617 details of basic authorization. code won't check certificate valid, set https connection. see http.client docs on how that. from http.client import httpsconnection base64 import b64encode #this sets https connection c = httpsconnection("www.google.com") #we need base 64 encode #and decode acsii python 3 stores byte string userandpass = b64encode(b"username:password").decode("ascii") headers = { 'authorization' : 'basic %s' % userandpass } #then connect c.request('get', '/', headers=headers) #get response res = c.getresponse() # @ point check status etc # gets page text data = res.read()

What is Android's google app theme? -

i building android app , need make android's stock google app (the 1 "g" icon) or google maps app. theme these google apps using? the tripadvisor app, instance, has similar , feel default google app. possible achieve same , feel stock google apps? would please let me know? thanks! you're referring "material design". its design language google rolled out on android in 2015. it aims streamline ui , provide consistent experience across user experiences on device, apps fee native. more details at: https://material.io/guidelines https://design.google.com/resources/

duplicates - Duplication/export jsreport server -

i working jsreport server on own environment. deploy on real server. there function export/ or duplicate make new server has config mine? you should able copy whole application directory if production server has same os. however copy these assets , run npm install dev|prod.config.json data server.js package.json

ruby on rails - Converting an ActiveRecord:Relation to java array -

i running 'where' query running on table mytable in rails application. want convert results of specific column query(activerecord::relation) java array of string type. this doing : employeesjavaarray=mytable.where("salary = ?",100).pluck(:columnname).to_java(java.lang.string) however receiving error in logs :- typeerror (could not coerce fixnum class java.lang.string): can please me out wrong statement have written. i ensure array includes string (by calling to_s ) first: employeesjavaarray = mytable.where("salary = ?",100) .pluck(:columnname) .map(&:to_s) .to_java(java.lang.string)

How to use Intent putExtra JSON data on android -

recently, in web server, json text, i'm using asynctask string strdata = ""; @override protected void onpostexecute(string result) { super.onpostexecute(result); final arrayadapter<string> adapter = new arrayadapter<string>(mainactivity.this, android.r.layout.simple_list_item_1); try { jsonarray arr =new jsonarray(result); jsonobject ob = arr.getjsonobject(0); strdata += ob.getstring("name") + "\n" + " - " + ob.getstring("school") + "\n" + " - " + ob.getstring("job") + "\n\n"; adapter.add(strdata); } catch (jsonexception e) { log.d(tag,"dd"); } listview listview = (listview) findviewbyid(r.id.listview); listview.setadapter(adapter); } result aaa - seoul university - teacher and want json parser value use intent.putextra activity. i don't know intent intent = new intent(this, a...

dockerfile - Can't change repo in discourse docker -

i want make modification appearance of discourse plugin. due plugin architecture have fork repos. first changed repo in discourse_docker @ forked discourse_docker then forked discourse itself, add change test. went in instance , checked dockerfile - had link repo, installed instruction, build app, enter app , check git remote show origin - didn't change: fetch url: https://github.com/discourse/discourse.git i've tried remove images , rebuild them, same result what missing here? it seems doesn't build image docker, how force build one? something worthful useful have found. hopes works you. https://github.com/discourse/discourse_docker click

automation - Python automate key press of a QtGUI -

i have python script section below: for index in range(1,10): os.system('./test') os.system('xdotool key return') what want run executable ./test, brings qtgui. in gui, key press prompt buton comes up. want automate key press of gui executable continues. my python script though runs executable, gui prompt comes , key press not entered until after executable. there way fix this? os.system doesn't return until child process exits. need subprocess.popen . it's idea sleep while before sending keystrokes (it may take time child process ready accept user input): from subprocess import popen time import sleep index in range(1,10): # start child process = popen('./test') # sleep allow child draw buttons sleep(.333) # send keystroke os.system('xdotool key return') # wait till child exits process.wait() i'm not shure need last line. if 9 child processes supposed stay alive -- remove it.

javascript - Js cookies : SyntaxError: missing ) after argument list -

the error thrown when set cookie date : var cookie = { setcookie: function(name, value, expdate) { 'use strict'; var str = encodeuricomponent(name) + '=' + encodeuricomponent(value); str +=';expires=' + expdate.toutcstring(); alert("in"); console.log(expdate.toutcstring()); document.cookie = str; } // end of setcookie() function }; window.onload = function() { 'use strict'; cookie.setcookie('username', 'john', mon 29 aug 2016 11:40:00 utc ); // date }; but doesn't if use number of days : var cookie = { setcookie: function(name, value, numdays) { 'use strict'; var cookiedate = new date(); cookiedate.setdate(cookiedate.getdate() + numdays); var str = encodeuricomponent(name) + '=' + encodeuricomponent(value); str +=';expires=' + cookiedate.togmtstring(); alert("in...

c# - Backend for SQL Server -

i have created sql server , client (c#) directly queries server. problem feel not secure, because every client (say 5 different clients in total) has connection string , believe crucial vulnerability. what best way create back-end sql server running on machine. sql server have accessible on internet various clients. best option c# application running library interpret calls client? it never secure if allow clients crud without login, unsecure if pass connection string client, if not necessary. the better practice implement more secure backend application wrap actions api (let's updateclientinfo() ), database accesses go apis , allow client make use of api. in case connection string not transferred via internet. when existing apis not suitable clients, kindly ask them pull request , implement request, instead of providing connection string them. it necessary require clients provide user + password when access service.

c# - Get all data from code-behind using AJAX -

i know question has been asked tens of times, question bit different. i want send request using ajax code-behind retrieve records attached database, don't have parameters pass want send request , json object contains table data, , here difference in question questions i've seen included passing params. here ajax code in i'm trying send request: var data; $.ajax({ type: "post", url: "register.aspx/getrecords", datatype: "json", success: function (response) { console.log(response.d); data = response; }, error: function(xmlhttprequest, textstatus, errorthrown) { console.log("status: " + textstatus); console.log(" error: " + errorthrown); } }); and here code-behind i'm trying fetch data database: [scriptmethod(responseform...

angularjs - transcluded directive not working in angular js -

Image
i have created directive in angular js transclude: true, , replace: true below .directive('customelement', [function(){ return { restrict: 'e', template: '<table class="table table-striped table-bordered table-hover datalisting"><tbody ng-transclude></tbody></table></div>', replace: true, scope: { tablecaption : "@", colsname : "=", tabledata : "=" }, transclude: true, link: function(scope, elem, attrs) { console.log(scope.colsname); } }; }]); and in html calling <custom-element table-caption="port listing" cols-name="tablecolumns" table-data="portlist.emulationdetails"> <tr> <td>1</td> <td>2</...

node.js - A Case of Socket IO authentication using Passport with Node-Express and MongoDB -

this setup - three different servers running 3 different node js application on 3 different ec2 servers. server 1 - running main application. server 2 - running admin application. server 3 - running service provider application. each server using same mongodb database because have share collections. so have - server 4 - database server - running mongo db. in database there 3 collections representing 3 types of users - 1] main user 2] admin user 3] service provider each type of user logs own nodejs application connecting respective server using different client applications. for example admin user connects server 2 , logs in admin application. for login passport used, , sessions stored in mongo db, using connect-mongo . sessions of types of user stored in same sessions collection in mongo db. the problem - now want implement notification system using socket.io. each type of user has notification sub-document array in model. - main user schema...