Posts

Showing posts from February, 2014

javascript - AngularJS - Array in other JS file -

i trying make website. main (angularjs) controller requests json data, filters , pushes array. use said array in different javascript file , can't wrap head around how it. i read option create service multiple times believe passing variables between 2 controllers. moreover, other options did not work out me well. what best approach this? lot. you can create global javascript variable accessible both controller other js file. update value controller change @ global level. then in next file retrieve it.

ajax - How to submit manual entered date in primefaces calendar? -

i've got form 2 primefaces calendar input elements , datatable on it. calendar items used filter result displayed in table values. therefore use p:ajax ‘dateselect’ event working fine when doing manipulation mouse on popup. when change date manually in input field keybord no change event fired. when use second p:ajax event blur or change i'm not able new value. <p:calendar id="startdate" value="#{filterstart}" required="true" showon="button" maxdate="#{filterend}" > <p:ajax event="dateselect" listener="#{listcontroller.onfilterstartchanged}" update="filtertbl, enddate" /> <p:ajax event="change" listener="#{listcontroller.onfilterstartblured}" update="filtertbl, enddate"

ios - how can i keep image size in tableview? -

Image
this when launch app after click on cell images bigger my code this override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("mycell", forindexpath: indexpath) // configure cell... cell.imageview?.sd_setimagewithurl(nsurl(string: imagearray[indexpath.row]), placeholderimage:uiimage(named: "pin.png")) cell.imageview?.frame = cgrectmake(0, 0, 50, 50) return cell } imagearray string of image urls. please help thanks in advance you can try use contant mode property: imageviewobject.contentmode = uiviewcontentmode.scaletofill or imageviewobject.contentmode = uiviewcontentmode.scaleaspectfit or imageviewobject.contentmode = uiviewcontentmode.scaleaspectfill

node.js - AngularJs/Nodejs updating view and animating it -

i'm writing angularjs/nodejs i useed $http service load data database , ngrepeat directive display view. can't when add new item database, update view 1 item, , animation.i know need use nganiamte , set class on ng enter how push single item data array without reloading whole view? data load , insert vm.loaddata = function () { $http.get('/data') .success(function (data) { vm.data = data; }) .error(function (data) { console.log('error: ' + data); }); } http.post('/data', data).success(function (data) { }) i assume vm.data array? should not reassign complete array rather add new items it, delete old items and/or update items in it. can add new items vm.data.push() ,

wordpress - Remove product thumbnail from specific product page in WooCommerce -

let's have 2 different products & b. both products have image, want remove image product b how can this? i trying use hook on product page not know how use correctly is_product function. i found solution using css you can put product id below .postid-5065 div.images { display:none; }

Android debugging return to same place -

lets developing/debugging activity in order reach need pass 4 screens. each time run app need start over. i tried using instant run not working. wrote dedicated code automatically skips between screen (instead of making me click manually) not practical.. i cant not open activity because gets information previous activities.. is there way make android studio return same place when build & run, or keep state? (i know instant run when developing big application not work good, @ least me) on previous activity intent.putextra("passed_from_previous_activity", true); startactivity(intent); on new activity oncreate() { //this way you'll know if activity's been reached previous activity or not if(getintent().getbooleanextra("passed_from_previous_activity",false)) { //your state values here //i.e., values receive previous activity } } if have hundred activities (playing devil's advocate) , need start

shell - Python Paramiko Child Process -

i've written script uses paramiko library log on server , executes command. command invokes server execute python script (resulting in child process believe). believe server returns signal indicating command executed successfully, doesn't seem wait new child process complete - original parent process has been completed. there anyway of waiting reference any/all child processes generated result of command , waiting completed before returning control initiating client? many thanks. without code difficult. think should create rest service . post http://0.0.0.0/runcode , kick off process in different thread. end call. thread still running ...when done post http:// 0.0.0.0/afterprocessisdone response thread kicked off. in route can whatever want thay response there. if need rest check out flask. it's pretty easy , straight point small projects.

java - How to create multiple Kafka clusters on same L2 network? -

i have 12 kafka nodes on same l2 network. i want create 4 kafka clusters (each 3 nodes) on same l2 network. is possible , how? if not what's workaround? a kafka cluster defined zookeeper data model members use. so, if want brokers belong given cluster, have make them point same zookeeper namespace. in practical terms, if want have 4 clusters need 4 different chroots in zookeeper ensemble , make each cluster use different one. example, mebers of cluster use zookeeper.connect=127.0.0.1:2181/cluster/a, members of cluster b use zookeeper.connect=127.0.0.1:2181/cluster/b , on. of course alternative use separated zookeeper ensembles each cluster. from zookeeper programmer's guide an optional "chroot" suffix may appended connection string. run client commands while interpreting paths relative root (similar unix chroot command). if used example like: "127.0.0.1:4545/app/a" or "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002/app/a&qu

qt - Python GUI class structure calls -

let's example have 2 classes, a , b . class a 1 called class main , b gui class(lets called class main_gui ). gui class contains method initiates , sets views, buttons , stuff called setupui . class generated qtcreator . what else must class have make sufficient run b or called other classes? know calling __init__ not mandatory idea. must function contain? __main__ mandatory make runnable? what must __main__ contain? must constructor contain? stuck on calling classes , can't find simple enough explanation or simple enough sample code can implement in case. please explain braindead human. i java developer new in python , specifics. if possible provide code samples (even pseudocode do) helpful. in advance! not sure if looking : a simple view : class home(qtwidgets.qframe, ui_home): """home view.""" def __init__(self, parent=none): """initializer.""" super(home, self).__i

nested lists - snake result in Python -

i'm trying obtain snake outcome (left right, top down) of set of characters in python 3. have managed using zip, following sample code: >>> abcd = ['a','b','c','d'] >>> = iter(abcd) >>> t = zip(i,i) >>> x in t: ... print(x) ... ('a', 'b') ('c', 'd') >>> g in zip(abcd,abcd): ... print(g) ... ('a', 'a') ('b', 'b') ('c', 'c') ('d', 'd') but i'd understand why zip(abcd,abcd) not return same result zip(i,i) ? zip make tuples 2 list , make tuple (a,a) (b,b) (c,c) (d,d) iter() iterate through using next() hence when using iter() function make tuple of (a,b) (c,d)

jquery - How to get 3d cube style for my div -

i want 3d style div. don't have idea how it. .cube{ width:100px; height:100px; background:#ff7700; color:#fff; text-align:center; line-height:95px; } <div class="cube">3d cube</div> https://davidwalsh.name/css-cube check out may you body { margin-top: 125px; } @-moz-keyframes spinningh { { -moz-transform: rotatex(0deg) rotatey(0deg); } to{ -moz-transform: rotatex(360deg) rotatey(360deg); } } @-webkit-keyframes spinningh { { -webkit-transform: rotatex(0deg) rotatey(0deg); } to{ -webkit-transform: rotatex(360deg) rotatey(360deg); } } @-o-keyframes spinningh { { -o-transform: rotatex(0deg) rotatey(0deg); } to{ -o-transform: rotatex(360deg) rotatey(360deg); } } @-ms-keyframes spinningh { { -ms-transform: rotatex(0deg) rotatey(0deg); } to{ -ms-transform: rotatex(360deg) rotatey(360deg); } } @keyf

How do I repeat images and textboxes as headers for each report sheet in SSRS -

i have multiple datasets binding individual tablixes in order render them individual excel workbook sheets. however, need header elements visible on first sheet, repeated on of other sheets, in same format , position. how go doing please? containing elements within rectangle element solved issue.

php - Generate multidimensional array out of exploded string -

i'm stuck @ generating multidimensional array out of string , need help. string (json): { "api_overview" : "overview", "api_overview_con1" : "api v1 offers simple rest api retrieve information our markets. api responses json encoded arrays. please aware calls api rate limited 10 requests per second, requests exceeding rate met http 503 response.", "api_reference" : "api reference", "api_market_summary" : "market summary", "api_market_stats" : "market stats", "api_market_trades" : "market trades", "api_market_orders" : "market orders", "api_market_chartdata" : "market chart data", } now need explode key "_" , convert multidimensional array, @ end need set value. output should this: "api" => [ "market" => ["summary" => "market summary&quo

opencv - Attaching multiple image panorama to form complete panorama -

Image
i using opencv stitcher code. in stitcher.cpp, there leavebiggestcomponent function, in largest set having images belonging panorama obtained , other images rejected. have changed code , able obtain fewer smaller sets along largest set. merging these smallers sets largest one, have find relative rotation of each images in smaller sets respect center image of largest set. suppose have 6 images, 2 sets obtained . set1 (1,2,3,4) , set2(5,6) know rotation of 1,2,3,4 wrt 3(center of set1) , know rotation of 6 wrt 5. using gyroscope, have rotation of 5 wrt 3 well so, r of 6 wrt 3, r = r[6 wrt 5] * r[5 wrt 1] is correct? output panorama in center largest set. while 1 left corner small set, used above equation , output wrong so here solution r of 6 wrt 3, r = r[5 wrt 1] * r[6 wrt 5] this give result if gyro data reliable.although results not perfect always, depending on focal length calculated stitching algo , phone sensor data

linux - Replace all content of file with the content of another file -

is there way replace content of file content of file without destroying first file? if have file in current directory called myfile.txt , if following: cp updatedfiles/myfile.txt myfile.txt then old file deleted , replaced new file (with same name). not want delete existing file, want change content of file. how this? cat updatedfiles/myfile.txt > myfile.txt

android - Espresso UI + Spoon run tests in series -

i have complete test suite app, , i've set build & test server i'd hook ci infrastructure, every night ui tests run on number of emulators. using spoon makes testing on multiple devices easy , nice due included reporting, has problem: runs tests on running devices. now build server humble machine , running 5+ emulators @ same time impossible due ram requirements. is there way run test in series, , possibly keep same reporting of them spoon? you may want check spoon gradle plugin documentation . use sequential = true

socket between c++ and java -

i wrote server in c++ , send messages set follow thread: void *send(void* v) { string m=""; while(true) { std::cin >> m; write(socketfd, static_cast<void*>(&m), m.length()+1); } } to read messages wrote follwing code: public void recieve() throws ioexception{ while (true){ if(input.hasnext()){ viewtext.settext(viewtext.gettext() + "\nsever: "+input.nextline()); } } } @override public void run() { try { recieve(); socket.close(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } when write variable m , press enter, nothing happen. when close server, values of m wrote before printed 1 string. i apologize incorrect english. tnks not knowing type of input in java code, method name nextline() suggests read whole line. line sequence of characters terminated newline character. on ot

python - NoReverseMatch - Reverse for 'step-autocomplete' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] -

first of realize question has been asked several times prior, i've looked @ several solutions , have been unable fix issue. furthermore, have tried several things have worked me before when i've had error, including using various 'return redirect/reverse/httpresponse' arguments, , these haven't worked either. i'm following tutorial https://github.com/yourlabs/django-autocomplete-light/blob/master/docs/tutorial.rst#id5 create autocomplete fields, , in second stage go shell , check if url can reversed noreversematch error. view , url below. view: class stepautocomplete(autocomplete.select2querysetview): def get_queryset(self): # don't forget filter out results depending on visitor ! if not self.request.user.is_authenticated(): return step.objects.none() qs = step.objects.all() if self.q: qs = qs.filter(name__istartswith=self.q) return qs url: from dal import autocomplete django.

php - Magento Export product Source model "magdoc/source_option" not found for attribute "magdoc_id" -

Image
i'm exporting product when select product drop down gives me below error: source model "magdoc/source_option" not found attribute "magdoc_id" when select customer dropdown show entity attributes. how can resolve problem. below error screenshot: if are not using attribute delete it , go on. otherwise use magento's default yes/no option model. adminhtml/system_config_source_yesno ... not sure if want use this. decide yourself.

How to append DOM element of type button in JavaScript? -

how append new buttons, modified values using loop? have used createelement attribute create button. var par=document.getelementbyid("numfield"); var ch=document.createelement("input"); ch.setattribute("type","button"); ch.setattribute("value","1"); par.appendchild(ch); try increasing value , id of button every time add new one. note works without adding id, too, allows access buttons more easily. var par=document.getelementbyid("numfield"); for(var i=0; i<10; i++){ var ch=document.createelement("input"); ch.setattribute("type","button"); ch.setattribute("value",i); ch.setattribute("id",i); par.appendchild(ch); } <div id="numfield"> </div>

php - Iterating through the first 30 keys in an array -

i have array stored variable called $data ["data"]=> array(413) { [0]=> object(stdclass)#254 (7) { ["energy"]=> string(7) "44555" ["closing"]=> string(10) "102" } [1]=> object(stdclass)#260 (7) { ["energy"]=> string(7) "2522" ["closing"]=> string(10) "854" } and obtain arithmetic mean closing values this: // initialize sum , total $sum = 0; $total = 0; foreach ($data->data $obj) { if (isset($obj->closing)) { // verify current object has closing $sum += $obj->closing; // add sum $total++; // increment count } } echo $sum / $total; // display average the problem need first 30 key array, don't know how that, can me please? have tried loop doesn't trick. ideas? thank in advance time , help. using second piece

c# - Can I draw a grid of dots within a custom WPF canvas control? -

i've built custom control inherits canvas. uses arrangeoverride method add drag drop functionality child elements, , includes grid snapping 50 pixels , other custom behaviour such persisting element positions. what i'd extend while dragging, shows grid of dots or crosses in background can see snap points are. however, can't modify template of control because it's panel. tried making custom control contains canvas, , passing ienumerable items source through, became tricky pick on collection changing, , collection contained models , not framework elements. so i'm not sure path should taking. feels though there may simple solution i've overlooked, i'm open suggestions! thanks in advance. i've done similar once: drawing grid lines on usercontrol, , adding controls on top of it. simple scheduler app used assign working shift in current month. had have column headers (days) , row headers (people) , scrollable grid inside, add/remove contro

docusignapi - How do I verify the Subject of X509 Certificate using rails-auth? -

i trying secure 1 endpoint have docusign connect api. have checked sign message x509 certificate on docusign connect api configuration. the client certificate common name added docusign account well. i trying validate subject sent using rails-auth gem. following content of acl file(acl.yml) --- - resources: - method: post path: / allow_x509_subject: cn: "the common name" i have added following in config.ru file app = rails.application acl = rails::auth::acl.from_yaml( file.read("path of acl.yml"), matchers: { allow_x509_subject: rails::auth::x509::matcher } ) acl_auth = rails::auth::acl::middleware.new(app, acl: acl) x509_auth = rails::auth::x509::middleware.new( acl_auth, ca_file: "path_to_the_pem_file.crt", cert_filters: { &

Regex for gsub in rails -

i have rails application using kaminari pagination. somehow kaminari using wrong url hyperlinks. right looking easy fix requires regex & gsubbing. i have url kaminari: "/bookings/hotels//pune?arrival_date=....." i want replace part - /hotels//pune? - /hotels? there other string in place of pune (it might change). how should ? capture , replace using match capture gsub(/hotels(\/\/\w+)\?/){|m| m.gsub($1, '')} str = "/bookings/hotels//pune?arrival_date=....." str.gsub(/hotels(\/\/\w+)\?/){|m| m.gsub($1, '')} #=> "/bookings/hotels?arrival_date=....."

html - How To Get Check Box label value in textbox using with jquery -

i want show selected checkbox label name in textbox , select more 1 checkboxes labels separated comma , show in textbox , sorry bad english . $(document).ready(function() { $('.dropdown').click(function() { $('.dropdown-content').fadetoggle(); }); }); .dropdown { width: 250px; height: 30px; } .dropdown-content { width: 253px; height: 100px; overflow-y: auto; border: 1px solid #ff8800; border-top: 0px; display: none; } .dropdown-content ul { padding: 0px; } .dropdown-content li { list-style: none; width: 100%; color: #fff; background: #ff8800; height: 25px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" class="dropdown" placeholder="select values" /> <div class="dropdown-content"> <ul> <li> <input type="checkbox" /><

delphi - How to show and hide a virtual keyboard (android) -

with delphi (berlin) method show , hide virtual keyboard under android ? i put on form native android edit. set setshowsoftinputonfocus(false); , try open manually keyboard like var avirtualkeyboardservice: ifmxvirtualkeyboardservice; tplatformservices.current.supportsplatformservice(ifmxvirtualkeyboardservice, iinterface(avirtualkeyboardservice)); if (avirtualkeyboardservice <> nil) avirtualkeyboardservice.showvirtualkeyboard(self); but it's not work :( sometime keyboard show, sometime not :( take @ ifmxvirtualkeyboardservice . has showvirtualkeyboard , hidevirtualkeyboard methods.

php - Expected response code 220 but got code "500", with message "500 Unknown command Laravel -

hello guys i'm trying send email in laravel bu thing is throwing me error. can please explain why facing error. here code: route::get('testmail', function () { /* \mail::send('emails.test', array(), function ($m) { $m->from('contrivesol@gmail.com', 's2c mobile'); $m->subject('review request '); $m->to("gardezisyedmuhammadali@gmail.com", "gardezi"); }); */ $user=''; \mail::send('emails.test', ['user' => null], function ($m) use ($user) { $m->from('contrivesol@gmail.com', 'your application'); $m->to('ovaiz.mushtaq@gmail.com', 'awais')->subject('your reminder!'); }); }); here screenshot error log error_log [2016-09-07 13:50:18] production.error: exception 'swift_transportexception' message 'expected response code 220 got code "500&q

python - Subnetwork analysis on proteomics data -

background: have proteomics data 7 samples (pvalue/ log-score of fold change), want analyze data network (interactome) analyses. question: create interactome of proteins data, , map proteins network have significant pvalue (compare control), after create subnetwork(s); add pathways enrichments subnetwork(s). request: please suggest online or standalone tools (or algorithm) fits requirements. thanks ! for creating network graphs represent protein-protein interactions, recommend taking @ networkx library. can use pass in nodes (proteins of interest) , edges (interactions) , generate graph. believe can generate subnetworks of these graphs well.

How to replace os disk with attached data disk on azure virtual machine -

i attached new vhd file virtual machine not find way boot machine disk. how can boot virtual machine newly attached data disk? edit: found way of creating of vm captured vm image. preformed on vm images section. problem when transfer captured page blobs 1 azure account account appear on storage account section not on vm images section. hence not able create vm transferred images. how can make blobs appear on vm image or there way transfer vm image disk directly section of vm images of azure account using azure-cli? i create os disk vhd file. in microsoft documents here mentioned there command azure vm image create in azure-cli there no such command. not find way make os disk stored vhd files. solved : using classic portal of azure easy create vm images or os disks , creating vms these images. here link disk , running, check section 'initialize disk' . source : https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-windows-classic-atta

python - Invalid Syntax on MUD Game -

pretty spent whole entire term getting python code typed , ready go although im hitting speedbumps , causing me panic assignment due tomorrow. im not sure how fix if can please fix this, happy! im quite new website here full code python 3.5.1 https://www.dropbox.com/s/zoupk8z1sdqncpb/mud%20file%20%281%29.py?dl=0 i pretty begging please send me fixed version of whatever preventing code working. thanks - tyson your error invalid syntax, comes not correctly opening , closing. looking trough code see huge varation in formating style starting @ rooms = { compared rest of code. i've put quotes inbetween part suspect wrong , runs directly. line 161 - 214: """ rooms = { 1 : { "name" : "engine 1" , "south" : 2, } , 2 : { "name" : "airlock" , "north" : 1 , "south" : 3,

ios - Capturing a picture in Landscape mode with AVCapture -

currently have ios app set in landscape mode when run. camera preview in view in landscape, when take photo taking them in portrait mode. wondering how can capture image in landscape mode only. below code camera preview , takephoto functions. override func viewwillappear(animated: bool) { let devices = avcapturedevice.deviceswithmediatype(avmediatypevideo) device in devices { if device.position == avcapturedeviceposition.back { { let input = try avcapturedeviceinput(device: device as! avcapturedevice) if capturesession.canaddinput(input){ capturesession.addinput(input) sessionoutput.outputsettings = [avvideocodeckey: avvideocodecjpeg] if capturesession.canaddoutput(sessionoutput){ capturesession.addoutput(sessionoutput) capturesession.startrunning() previewlayer = avcapturevideopreviewlay

c# - SQL query with 6 checkboxes -

i have report screen 6 checkboxes tell columns report has show. when check checkboxes , click on button nothing happens. here code: connect = new sqlconnection(@"data source=lp12;initial catalog=smmsdata;integrated security=true"); connect.open(); sqlcommand cmd = new sqlcommand(); cmd.connection = connect; cmd.commandtext = "select druksensor, flowsensor, tempsensor, kwaliteitsensor, toerental, olieverbruik" + " systeemsensorinfo" + " druksensor=@druksensor" + " , flowsensor=@flowsensor" + " , tempsensor=@tempsensor" + " , kwaliteitsensor=@kwaliteitsensor" + " , toerental=@toerental" + " , olieverbruik=@olieverbruik" ; cmd.parameters.add("@druksensor", sqldbtype.bit); cmd.parameters.add("@flowsensor", sqldbtype.bit); cmd.parameters.add("@tempsensor", sqldbtype.bit); cmd.parameters.add("@kwaliteitsensor", sqldbtype.bit); cmd.parameters.add("@toe

Creating tree formed XML from flat XML with Xquery -

i have xml in following format: <data> <row> <id>1</id> <parent_id/> </row> <row> <id>2</id> <parent_id>1</parent_id> </row> <row> <id>3</id> <parent_id>1</parent_id> </row> <row> <id>4</id> <parent_id>5</parent_id> </row> <row> <id>5</id> <parent_id/> </row> <row> <id>6</id> <parent_id>2</parent_id> </row> <row> <id>7</id> <parent_id>4</parent_id> </row> </data> i'm trying turn this: <data> <row> <id>1</id> <children> <row> <id>2</id> <parent_id>1</parent_id> <children> <id&

ms word - Office Add-in show warning - unsupported features by its add-in catalog (SharePoint App Catalog) -

i'm trying deploy word add-in. i've deployed backend on onpremises server iis. , i've checked it's accessible. i've created app catalog in office365 , uploaded manifest file catalog. catalog shows add-in valid i've added office365 app catalog trusted catalog sites i can add app, see shows part of design, gives info text , add-in doesn't work: info text: add-in information this add-in uses features not supported add-in catalog. the manifest: <?xml version="1.0" encoding="utf-8"?> <!--created:ce44715c-8c4e-446b-879c-ea9ebe0f09c8--> <officeapp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:ty

android - I have a MenuItem instance and I get one particular item and set its visibility to false....results in an runtime error -

null object reference android.view.menuitem.setvisible(true); in oncreateoptionsmenu() code is: @override public void oncreateoptionsmenu(final menu menu, final menuinflater inflater) { mmenu = menu; inflater.inflate(r.menu.contact_list_menu, menu); } in function hidemenu() code is: mmenuitem.setvisible(false); contact_list_menu.xml : <menu xmlns:android="schemas.android.com/apk/res/android"> <item android:id="@+id/action_reimport" android:title="@string/reimport" android:icon="@drawable/ic_reimport_contacts" android:showasaction="always"/> </menu>

ruby on rails - No route matches {:action=>"edit", :controller=>"admin/progresses"} missing required keys: [:id] -

while trying create edit link admin dashboard.i have error... no route matches {:action=>"edit", :controller=>"admin/progresses"} missing required keys: [:id] please explain me what's wrong? here rake routes : admin /admin(.:format) admin/dashboard#index admin_progresses /admin/progresses(.:format) admin/progresses#index post /admin/progresses(.:format) admin/progresses#create new_admin_progress /admin/progresses/new(.:format) admin/progresses#new edit_admin_progress /admin/progresses/:id/edit(.:format) admin/progresses#edit admin_progress /admin/progresses/:id(.:format) admin/progresses#show patch /admin/progresses/:id(.:format) admin/progresses#update put /admin/progresses/:id(.:format) admin/progresses#update

java - org.glassfish.jersey.client.ClientResponse cannot be applied to given types -

i have code: version version = commonclient.authorizedrequestbuilder(commonclient.webtarget .path("/apps/blabla/default/" + appname + "/" + appname) .queryparam("object_type", "app")) .accept(mediatype.application_json_type) .get(clientresponse.class) .getentity(new generictype<version>() {}); how can fix solve error? error:(38, 17) java: method getentity in class org.glassfish.jersey.client.clientresponse cannot applied given types; required: no arguments found: <anonymous javax.ws.rs.core.generictype<linqmap.supportool.services.gas.dto.version>> reason: actual , formal argument lists differ in length the getentity() method accepts no parameters can't pass (new generictype() {}) use following instead version version = commonclient.authorizedrequestbuilder(commonclient.webtarget .path("/apps/blabla/default/" + appna

iphone - Gyro data from iOS to PC (windows surface) -

i want make kind of pointer specific windows application using gyro in iphone can't seem find how connect iphone pc , send data through app. can find should possible on ble. can point me in right direction? what have far app reads gyro data phone no connectivity nor way receive on windows end.

bash - conemu macros 'line send delay' method? -

i use securecrt , it's 'line send delay' option. lets inject delay in milliseconds lines sent via mapped keys. helpful because mapped keys send commands fast os. ex: command1\ncommand2\n needs entered as: $command1 $command2 not: $command1 command2 $ from i've learned conemu's macros pretty similar securecrt's mapped keys. but, have not figured out "line send delay" option. else know how this? print("command1\n"); sleep(1000); print("command2\n")

github - Restore remote Git branch -

before go further, let me explain why can't a: git checkout -b <branch> <sha> basically branch (let's call dev1 ) on developer's machine. had done commits , pushed them up. branch branched branch (we can call features ) being renamed development . development created branch of features , features deleted. developer's branch ( dev1 ) deleted other developer both locally , remotely. when using github windows found branches asking pushed, deleted entire folder (which skipped recycle bin) , re-cloned repo. can't a: git reflog because doesn't have history. can't see commits because never pulled locally onto machine. so, in mind, there way of restoring dev1 branch remotely? have been looking command show remote branches deleted, far, have been unable find such command. any avoid weeks of development work! you can use github events api see last 300 events (paginated in 30 events per page) occured during last 90 days user or

IndexedDB function is not working in Intel XDK -

i have made web app calls 2 indexeddb databases , when click button saves value , goes page. it works perfect web app when try use intel xdk shows in console: "uncaught typeerror: cannot set property 'varbusquedapam' of undefined". javascript: var indexeddb = window.indexeddb || window.mozindexeddb || window.webkitindexeddb || window.msindexeddb; var database = null; var bdbusqueda = null; function iniciarbd() { database = indexeddb.open('bdbeta', 4); database.onupgradeneeded = function (e) { var active = database.result; var objetoproductos = active.createobjectstore("productos", {keypath: 'id', autoincrement: true}); objetoproductos.createindex('nombre_producto', 'producto', {unique: true}); }; database.onsuccess = function (e) { varbusqueda(); }; database.

windows - LookupAccountNameW returns SidTypeAlias, but expected SidTypeGroup -

i'm trying define type of entered credentials with: sid_name_use pe; ... resolved=lookupaccountnamew (null,l"builtin\users",&sid,&cbsid,buff,&dd,&pe); no matter if enter "builtin\users" or "users" resolves returns sidtypealias in pe enum. expect sidtypewellknowngroup or sidtypegroup. question: how reliably define if given string windows group name ? the msdn page well-known sids briefly describes meaning of "alias" in context: the following table has examples of domain-relative rids can use form well-known sids local groups (aliases). one of table entries users group, behaviour describing expected. you can continue use lookupaccountname() planned, need modify code recognize of sidtypealias, sidtypewellknowngroup, or sidtypegroup represent groups.

Forecast formula from Excel in Javascript -

i'm trying make forecast function in javascript based on code excel, explained @ https://support.office.com/en-us/article/forecast-function-50ca49c9-7b40-4892-94e4-7ad38bbeda99 but don't understand x trait on top (also y) formula , don't know how translate in javascript. can me please? thank you. x trait on top mean of x (i.e. average of xs). same y. if x values 20,28,31,38,40 x trait on top 31.4 function forecast(x, ky, kx){ var i=0, nr=0, dr=0,ax=0,ay=0,a=0,b=0; function average(ar) { var r=0; (i=0;i<ar.length;i++){ r = r+ar[i]; } return r/ar.length; } ax=average(kx); ay=average(ky); (i=0;i<kx.length;i++){ nr = nr + ((kx[i]-ax) * (ky[i]-ay)); dr = dr + ((kx[i]-ax)*(kx[i]-ax)) } b=nr/dr; a=ay-b*ax; return (a+b*x); } the above script gives forecast without error handling. you can call using below method forecast(30,[6,7,9,15,21],[20,28,31,38,40]);

asynchronous - Calling @Async method from method which is @Schedule -

i have scheduler listens queue (priorityqueue not mq/jms) @ every 1 second, once got message interested in want perform logic. so have scheduler runs every second, calling method annotated @async, assuming once call method scheduler running interval. below sample code, not sure using right pattern or advise. idea once have message should not wait prev processing, , can have multiple threads processing it. i using spring boot. @scheduled(fixeddelaystring = "1000", initialdelay = 10000) public void startscheduler() { message msg = queue.peek(); if(msg!=null){ doprocessing(msg); } } @async public void doprocessing(message msg){ // processing // may take 5 seconds. }

How should I create a Google App Engine service visible only within my project? -

i'd create google app engine service use microservice. i'd api accessible callers within project's network (i.e., google compute engine , gae instances on project). what's easiest way restrict access this? i see how run private modules on google app engine? check x-appengine-inbound-appid works requests gae, doesn't requests gce. to restrict gce service use networking. don't think gae instances can assigned networks though. check if x-appengine-inbound-appid matches app id. https://cloud.google.com/appengine/docs/python/appidentity/ appengine identity api doc contains using x-appengine-inbound-appid asserting identity. import webapp2 class mainpage(webapp2.requesthandler): allowed_app_ids = [ 'other-app-id', 'other-app-id-2' ] def get(self): incoming_app_id = self.request.headers.get( 'x-appengine-inbound-appid', none) if incoming_app_id not in self.al

java - Reading json input on Jersey which can be both nullable and optional -

i have following rest end-point @put @path("/props") public response update(props input) { .. } and input parameter is: @xmlaccessortype(xmlaccesstype.field) class props { public string prop1; public string prop2; } client sends input json string. want both parameter nullable , optional. example: if client wants update prop2 null value without updating prop1 may send: {"prop2":null} but @ point see both input.prop1 = null , input.prop2 = null . how can distinguish if client has sent prop null value or has not sent @ all? isn’t better make empty string if want set null, , null if did not sent @ all?

Ruby Array Sort 2 different ways -

i have array of objects i'm trying sort multiple criteria. of comparisons doing <=> on hashes, using sort_by fast, 1 of them more complex. the array of soccer teams, , it's being sorted this: teams.sort_by { |item| [item.points, item.goal_dif, item.goals] } however, in case @ last 2 teams have identical values on 3 fields, want tiebreaker function made, a_beat_b(teama, teamb) . i tried using array.sort , it's extremely slow compared sort_by first few... implementation this: teams.sort ( |a,b| [a.points, a.goals_dif, a.goals] <=> [b.points, b.goals_dif, b.goals]) slow compared sort_by. functions points, goals_dif , goals require simple queries, gets bogged down if has hundreds. i'm not @ ruby, not sure put a_beats_b in there. (it returns 1, 0 or -1 if beat, drew or lost b, repsectively) i tried using array.sort , it's extremely slow compared sort_by first few this because sort calls given block several times. here'