Posts

Showing posts from March, 2011

javascript - How to make trigger click event work after turning off event -

i have card click should disabled 3 secs , after 3 secs click event should trigger on card isn't working. $('#card').off('click'); settimeout(function () { $('#card').on('click'); $('#card').trigger('click'); }, 3000); on , off in jquery event delegation different purpose, requirement add disabled property card prevent users clicking , trigger click using settimeout $('#card').prop('disabled','disabled'); settimeout(function () { $('#card').removeprop('disabled'); $('#card').trigger('click'); }, 3000);

javascript - How to add constraints to v-model -

in terms of vuejs : how add constraints(limits) v-model properly? let's want allow numbers between 0 , 5 . <input type="number" v-model="model"/> perhaps can watch input's value. it's bit hacky, isn't it? upd: other option handle onchange , onkeyup , etc , other events: html text input allow numeric input don't abuse watch this. use binding , event method: <input type="number" v-bind:value="model" @input="handleinput"/> js: methods: { handleinput: function(event) { var value = number(event.target.value) if (value > 5) { this.model = 5 } elseif (value < 0 || number.isnan(value)) { this.model = 0 } else this.model = value } } }

html - How to scrape href with Python 3.5 and BeautifulSoup -

this question has answer here: retrieve links web page using python , beautifulsoup 14 answers i want scrape href of every project website https://www.kickstarter.com/discover/advanced?category_id=16&woe_id=23424829&sort=magic&seed=2449064&page=1 python 3.5 , beautifulsoup. that's code #loading libraries import urllib import urllib.request bs4 import beautifulsoup #define url scraping theurl = "https://www.kickstarter.com/discover/advanced?category_id=16&woe_id=23424829&sort=magic&seed=2449064&page=1" thepage = urllib.request.urlopen(theurl) #cooking soup soup = beautifulsoup(thepage,"html.parser") #scraping "link" (href) project_ref = soup.findall('h6', {'class': 'project-title'}) project_href = [project.findchildren('a')[0].href project in p...

python - Custom format ID mapping -

i have 2 databases (txt files). 1 two-column, tab-delimited one, holds names , ids. name1 \t id1 name1 \t id2 name2 \t id9 name2 \t id40 name3 \t id3 the other database has same ids first 1 in first column, while second column lists ids of same kind delimited commas (these children of ones in first one, second database hierarchical). id1 \t id1,id2,id3 id2 \t id2, id9 what third database same format second, in second column i'd swap out children ids names of first database. example: id1 \t name1,name2,name3 id2 \t name1,name2 is there way this? i'm quite beginner, when had map ids before used web services, custom format needed further analysis , i'm not sure start. thanks in advance! import csv # reading first db simple since there's fixed delimiter # use csv module split lines , create dictionary maps id name id_dictionary = {} open('db_1.txt', 'r') infile: reader = csv.reader(infile, delimiter='\t') line in ...

gps - Javascript solution for user being inside or outside a rectangle -

i checking stackoverflow , many other pages find javascript (or jquery) solution tells me if user (with current gps location) inside or outside predefined rectangle on map. there many solutions circles , squares can't find solution rectangles. furthermore rectangle must not parallel f.e. equator. can have possible angle it. parameter of rectangle required make inside/outside calculation? knows javascript solution solve problem? to know if point inside rectangle in 2d plan need: the position of 1 point of rectangle: x0, y0; the angle rectangle making horizontal axis: a; the length of first side: l1; the length of second side: l2. see drawing. a point (x,y) inside rectangle when: 0 >= (x-x0)*cos(a) - (y-y0)*sin(a) >= l1 0 >= (x-x0)*sin(a) + (y-y0)*cos(a) >= l2 or in javascript: function isinrectangle(x, y, x0, y0, a, l1, l2) { var v1 = (x-x0)*math.cos(a) - (y-y0)*math.sin(a); var v2 = (x-x0)*math.sin(a) + (y-y0)*math.cos(a); ...

c# - How to get HttpContext.Current in ASP.NET Core? -

this question has answer here: access current httpcontext in asp.net core 4 answers we rewriting/converting our asp.net webforms application using asp.net core. trying avoid re-engineering as possible. there section use httpcontext in class library check current state. how can access httpcontext.current in .net core 1.0? var current = httpcontext.current; if (current == null) { // here // string connection = configuration.getconnectionstring("mydb"); } i need access in order construct current application host. $"{current.request.url.scheme}://{current.request.url.host}{(current.request.url.port == 80 ? "" : ":" + current.request.url.port)}"; as general rule, converting web forms or mvc5 application asp.net core will require significant amount of refactoring. getting httpcont...

Getting values from XML string in C# -

this question has answer here: how 1 parse xml files? 11 answers using api following xml string <response> <ip>74.125.224.72</ip> <countrycode>us</countrycode> <countryname>united states</countryname> <regioncode>ca</regioncode> <regionname>california</regionname> <city>mountain view</city> <zipcode>94043</zipcode> <timezone>america/los_angeles</timezone> <latitude>37.4192</latitude> <longitude>-122.0574</longitude> <metrocode>807</metrocode> </response> how able values in c# application, , make more professional. for example: ip: 74.125.224.72 country code: country name: united states region code: ca ect.. thanks you have few choices here. if want of values object, can use deserializer. if want run que...

datetime - Copying data with different dates in SQL Server -

Image
i have table 4 columns , 8000 rows of data datetime column 2016-01-05. want copy these 8000 rows of data days of january 1st 31st. meaning, should have 8000 * 31 days of data though same data. how do without using excel document. first, create temporary date table values each day in january 2016. create table #tempdate (datecol datetime) declare @day int = 1 declare @date date = '2016-01-01' while @day <= 31 begin insert #tempdate values (@date) set @day +=1 set @date = dateadd(dd,1,@date) end next, can select desired columns , cross join others have said well. should cartesian product between 2 tables (8000 x 31 rows). select c.column1, c.column2, c.column3, t.datecol #tempdate t cross join yourtablename c

ios - swift insert new static cells tableview -

want add new cells. how can this? please help! try override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { if section == 1 { return 3 + eventdates.count } else { return super.tableview(tableview, numberofrowsinsection: section) } } override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { if (indexpath.section == 0 && indexpath.row == 1) { eventdaysvisible = !eventdaysvisible tableview.reloaddata() tableview.insertrowsatindexpaths([nsindexpath(forrow: eventdates.count + 3, insection: 0)], withrowanimation: .automatic) tableview.reloaddata() } day in eventdates { print("obj: \(day)") } tableview.deselectrowatindexpath(indexpath, animated: true) } i have 3 static cells , new cells needs insert after first if switch button. var eventdates = friday, saturday, sunday hope can me that. ...

qt - QProcess won't emit errorOccurred on VBScript failure -

i have vbscript converts excel files tab delimited text files: format = -4158 set objfso = createobject("scripting.filesystemobject") src_file = objfso.getabsolutepathname(wscript.arguments.item(0)) dest_file = objfso.getabsolutepathname(wscript.arguments.item(1)) dim oexcel set oexcel = createobject("excel.application") oexcel.displayalerts = false oexcel.protectedviewwindows.open(src_file) oexcel.activeprotectedviewwindow.edit dim obook set obook = oexcel.workbooks.open(src_file) obook.worksheets(5).activate obook.saveas dest_file, format obook.close false oexcel.displayalerts = true oexcel.quit in qt use wscript run code , have connected signal qprocess::erroroccurred lambda: qobject::connect(&wscript, &qprocess::erroroccurred, [=](qprocess::processerror error) { qdebug() << "error has occured"; }); in vb script, protected view removed. however, modified script not disable protected view. results in script not being...

Spring-boot how to use autowired class properties in called method -

i have following class in spring-boot application public class classa { @autowired propertiesclass propertiesclass; public integer getmesomevalue(integer someparameter) { // uses methods of propertiesclass } } here, propertiesclass contains methods reads property values application.properties file. want unit test getmesomevalue method. unit test class given below @runwith(springjunit4classrunner.class) @springapplicationconfiguration(myapplication.class) @webintegrationtest public class classatest { @test public void testgetmesomevalue() { classa classa = new classa(); assert.assertsame("received expected response", classa.getmesomevalue(6025), 2345); } } when run unit test, null pointer exception @ point methods of propertiesclass invoked inside getmesomevalue method. there way in spring-boot make @autowired work? instead of classa classa = new classa(); do this... @autowired classa classa; ...

c# - How to convert byte array to xml? -

i have byte stream this: byte[] response = { 69, 90, 69, 45, 88, 77, 76, 45, 77, 115, 103, 48, 50, 60, 77, 101, 115, 115, 97, 103, 101, 62, 13, 10, 32, 32, 60, 72, 101, 97, 100, 101, 114, 62, 13, 10, 32, 32, 32, 32, 60, 77, 101, 115, 115, 97, 103, 101, 68, 97, 116, 101, 62, 50, 48, 49, 48, 48, 51, 50, 52, 60, 47, 77, 101, 115, 115, 97, 103, 101, 68, 97, 116, 101, 62, 13, 10, 32, 32, 32, 32, 60, 77, 101, 115, 115, 97, 103, 101, 84, 105, 109, 101, 62, 49, 57, 50, 56, 48, 54, 60, 47, 77, 101, 115, 115, 97, 103, 101, 84, 105, 109, 101, 62, 13, 10, 32, 32, 60, 47, 72, 101, 97, 100, 101, 114, 62, 13, 10, 32, 32, 60, 66, 111, 100, 121, 62, 13, 10, 32, 32, 32, 32, 60, 84, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 73, 68, 62, 51, 51, 50, 53, 50, 55, 60, 47, 84, 114, 97, 110, 115, 97, 99, 116, 105, 111, 110, 73, 68, 62, 13, 10, 32, 32, 32, 32, 60, 84, 114, 97, 110, 115, 97, ...

bash to remove path in second select -

in bash below user selects file used in first select , digits in file used automatically 'select the second file. problem when second file selected path appears in name the bash` errors. can not seem fix , need help. apologize long post, trying make sure files needed here. thank :). bash filesdir=/home/cmccabe/desktop/ngs/api/5-14-2016/bedtools annovardir=/home/cmccabe/desktop/ngs/api/5-14-2016/vcf/overall/annovar ps3="please select file analyze panel: " # specify file select file in $(cd ${filesdir};ls);do break;done file1=`basename ${filesdir}/${file}` printf "file 1 is: ${file1} , used filter reads, identify target bases , genes less 20 , 30 reads, create low coverage bed vizulization, calculate 20x , 30x coverage, , filter vcf 98 gene epilepsy panel" file in /home/cmccabe/desktop/ngs/api/5-14-2016/bedtools/$file; bname=$(basename $file) pref=${bname%%.txt} grep -wff /home/cmccabe/desktop/ngs/panels/epilepsy_unix_trim.bed $file ...

AngularJS: How to not lose focus on element if other elements are clicked (using ng-focus/ng-blur)? -

i've got elements inside ng-repeat loop have these attributes: <div ng-repeat="h in myobjectarray"> <div> <input ng-class="{ clicked: clickedflag1 }" ng-focus="clickedflag1 = true" ng-blur="clickedflag1 = false" type="button" id="1" value="1" ng-click="btnselected(1)" /> </div> <div> <input ng-class="{ clicked: clickedflag2 }" ng-focus="clickedflag2 = true" ng-blur="clickedflag2 = false" type="button" id="2" value="2" ng-click="btnselected(2)" /> </div> </div> what happens when 1 of elements clicked, add class clicked clicked element, , removes clicked class other button inputs. the problem is, if click on other element on rest of page, element clicked no longer has focus , gets it's clicked class removed. is there anyway still use ng-f...

amazon web services - can't connect to ec2 anymore - Permission denied (publickey) - but was working yesterday -

i've tried previous answers previous similar questions here. none worked. until yesterday login ec2 instance, today can't, using same key. server did not restart, , using same dns. i've tried using ip or server address. have tried on http://docs.aws.amazon.com/awsec2/latest/userguide/troubleshootinginstancesconnecting.html it started mysql going down. logged in fixed, created backup , trying copy backup thru scp. started getting permission denied, ssh started receiving permission denied. blog still , running, can't log in server nor copy backup file. using command: ssh -vvv -i "key.pem" ec2-user@ec2-52-67-93-144.sa-east-1.compute.amazonaws.com i get: openssh_6.2p2, osslshim 0.9.8r 8 dec 2011 debug1: reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: applying options * debug2: ssh_connect: needpriv 0 debug1: connecting ec2-52-67-93-144.sa-east-1.compute.amazonaws.com [52.67.93.144] port 22. debug1: connection establish...

jquery - Set a JavaScript ondblclick event to a class inside tinyMCE editor -

some words in tinymce textarea editor in span tag specific class called "myclass". instance, word hello visible in tinymce textarea editor in source code following html code: <span class="myclass" id="hello">hello</span> i try launch function on double click on word hello . the usual jquery code not work words inside tinymce editor: $(document).ready(function() { $('.myclass').dblclick(function() { alert('class found'); }); }); the function not fire when double click on word hello in editor. how can bind function tinymce editor? tinymce uses iframe element, cannot use $('.myclass') on "main" scope in order elements inside iframe (the content of iframe different scope). instead - need run $('.myclass').dblclick in scope of iframe. to can use setup callback , editor.on("init" event tinymce gives you: tinymce.init({ selector:'textarea...

c# - Linq Table Group By Get Perecentage in each column -

i have datatable 2 columns: guitarbrand | status --------------------- fender | sold fender | in stock gibson | in stock gibson | in stock i want write linq query output guitarbrand | percentsold | sold/total --------------------------------------- fender | 50% | 1/2 gibson | 100% | 2/2 here's have far: var groupedtable = b in table.asenumerable() group b b.field<"guitarbrand"> g select new ( guitarbrand = g.key, perecent = (float)g.count()/(float)g.key) which got post isn't close working, cannot convert string float. i've tried looking @ other posts can't find anything. thanks! you can use following (hopefully self explanatory) query: var groupedtable = b in table.asenumerable() group b b.field<string>("guitarbrand") g let total = g.count() let sold = g.count(e => e.field<string>("status") == "sold") l...

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 the same problem occurs when delay in running function caused using event listeners: var buttons = document.getelementsbytagname("button"); (var = 0; < buttons.length; i++) { // let's create 3 functions buttons[i].addeventlistener("click", function() { // event listeners console.log("my value: " + i); // each should log value. }); } <button>0</button><br> <button>1</button><br> <button>2</button>...

linux - compiling R 3.3.1 -

i trying install r-3.3.1 on rhel6 box on not have su permissions. unfortunately machine has older versions of zlib , bzip2 , readline, xz , pcre , curl . not have access yum repo nor admins this. so, have compiled libraries , installed them in <my home dir>/libs bzip2-1.0.6 curl-7.48.0 pcre-8.38 readline-6.3 xz-5.2.2 zlib-1.2.8 when run ldd on .so files, not missing libraries. minor issue lib> ldd libcurl.so.4.4.0 linux-vdso.so.1 => (0x00007ffec49ff000) libidn.so.11 => /lib64/libidn.so.11 (0x00007f2371b4b000) libz.so.1 => /lib64/libz.so.1 (0x00007f2371934000) <== not point version have compiled librt.so.1 => /lib64/librt.so.1 (0x00007f237172c000) libc.so.6 => /lib64/libc.so.6 (0x00007f2371398000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f237117a000) /lib64/ld-linux-x86-64.so.2 (0x0000003e79000000) although have set cppflags , ldflags , libs , , c...

types - C# code merging with enums with slight differences -

i have merge c# codes 2 similar solutions have issue enums. projects use .net2.0 , have use well . projects have common class contains enum same name difference: using system; using system.collections.generic; using system.text; using system.net; namespace myproject { public enum letters { non = 0, = 1, b = 2, c = 3 } public class myclass { public int v = 0; . . . public letters lt = 0; // enum } } there many other uses of "enum" like: tmpchild.type == typeof(letters); this._data.ltr = (letters)valuelistupdown_lts.value; adddata(new sfunc(0,typeof(letters), letters.a)); letters letters = letters.a; the second project identical enum looks this: public enum letters { = 0, b = 1, c = 2 } there many various uses of these enums in code , code has many projects use assembly refference. know best way merge solutions. think method returns enum...

Google cloud datalab deployment unsuccessful - sort of -

this different scenario other question on topic. deployment succeeded , can see following lines @ end of log [datalab].../#015updating module [datalab]...done. jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: deployed module [datalab] [ https://main-dot-datalab-dot- .appspot.com] jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: step deploy datalab module succeeded. jul 25 16:22:36 datalab-deploy-main-20160725-16-19-55 startupscript: deleting vm instance... the landing page keeps showing wait bar indicating deployment still in progress. have tried deploying several times in last couple of days. about additions described on landing page - an app engine "datalab" module added. - when click on pop-out url " https://datalab-dot- .appspot.com/" throws error page "404 page not found" a "datalab" compute engine network added. - under "compute engine > operations" can see create...

windows - Event Log Forwarding does not display event message on collector -

yet microsoft issue or bug. can't seem forwarded event logs show message of event. following in details section: the description event id xxx source ad fs auditing cannot found. either component raises event not installed on local computer or installation corrupted. can install or repair component on local computer. if event originated on computer, display information had saved event. this happens on "non standard" events application (adfs in case). some of action items have done: made sure subscription in rendered text: wecutil ss "subscription name" /cf:renderedtext copied dlls source servers application (adfs) , placed in collector server in same path created registry key in hkey_local_machine\system\currentcontrolset\services\eventlog\forwarded events (note cannot create new event log accepted destination in creating subscription, windows limitation). added registry keys each source/providers , registry values eventmessagefile pointing dlls ...

shapefile - gpclib 'non zero-exit' error despite installing R tools, rgeos, maptools -

this know common error gpclib feel i've tried lot of options , going around in circles. come against issue when using 'fortify' create data frame uk local authority shapefile, can create choropleth using ggplot2. after trying install gpclib package in usual way tried install source: install.packages("gpclib", type = "source") which says unsuccessfully unpacked 'error: compilation failed package 'gpclib'. read somewhere need have r tools installed tried no avail, same error. tried changing order in attach rgeos , maptools because apparently matters , didn't work. my code dead simple , yet i'm @ brick wall in project. are there other things try gpclib installed? many in anticipation, code below. henry install.packages("rgdal") library(rgdal) install.packages("maptools") library(maptools) install.packages("rgeos") library(rgeos) myshape <- readshapespatial("infuse_ward_lyr_2011.shp...

java - SetDataAndType method -

as documented in android developers page setdataandtype method can called in way: auto setdataandtypefunctionid = env->getmethodid(intentclassid, "setdataandtype", "(landroid/net/uri;ljava/lang/string;)v"); jstring jmime = env->newstringutf("video/*"); env->callvoidmethod(context, setdataandtypefunctionid, intentobject, uriobject, jmime); but when run app error show on output: java.lang.nosuchmethoderror: no method name='setdataandtype' signature='(landroid/net/uri;ljava/lang/string;)v' in class landroid/content/intent; the problem return type, not void. setdataandtype method returns object of type intent . use following signature: env->getmethodid(intentclassid, "setdataandtype", "(landroid/net/uri;ljava/lang/string;)landroid/content/intent;"); also, should use callobjectmethod instead of callvoidmethod, although doesn't matter because you're not using return value.

java - Mockito InvocationImpl retained across TestSuite tests -

i have junit test suite ~800 tests. of these wired spring , large number use mockito mock/spy behavior. started running out of memory errors. while analyzing hprof dump noticed > 30% of heap consumed mockito invocationimpls retained between tests. is there way clear these after test class completes? not want use mockito.reset( mock ) mocks initialization varies each test. if not, appears need split tests accommodate leak. from this link appears mockito team recognizes these retained trade-off of verification after execution approach. i'm wondering if has found means clear these large number of unit tests can strung in suite. i found partial work around. in case vast majority of invocationimpl instances being created during single test case used spy() create real partial mock 1 method overridden. using mockito 1.10.19, switched partial mock construction spy() mock( <class>, withsettings().spiedinstance( realinstance ).defaultanswer( calls_read_mathods )...

php - Why does the form_open not posting anything? -

i new codeigniter , php , trying make change password script. change password function in controller called scrips.can't quite understand why it's not posting @ all. this controller : public function change_password() { $this->page_handler->member_page(); $this->load->database(); $this->form_validation->set_rules('old_pass','old password','required'); $this->form_validation->set_rules('new_pw','new password','required'); $this->form_validation->set_rules('conf_pw','confirm password','required|matches[new_pw]'); if($this->form_validation->run() !=true) { $sql=$this->db->select("*")->from("members")->where("username", $this->session->userdata("username"))->get(); foreach ($sql->result() $my_info) { $db_password=$my_info->password; $...

machine learning - Vowpal Wabbit not predicting binary values, maybe overtraining? -

i trying use vowpal wabbit binary classification, i.e. given feature values vw classify either 1 or 0. how have training data formatted. 1 'name | feature1:0 feature2:1 feature3:48 feature4:4881 ... -1 'name2 | feature1:1 feature2:0 feature3:5 feature4:2565 ... etc i have 30,000 1 data points, , 3,000 0 data points. have 100 1 , 100 0 data points i'm using test on, after create model. these test data points classified default 1. here how format prediction set: 1 'name | feature1:0 feature2:1 feature3:48 feature4:4881 ... from understanding of vw documentation, need use either logistic or hinge loss_function binary classifications. how i've been creating model: vw -d ../training_set.txt --loss_function logistic/hinge -f model and how try predictions: vw -d ../test_set.txt --loss_function logistic/hinge -i model -t -p /dev/stdout however, i'm running problems. if use hinge loss function, predictions -1. when use logistic loss function, arbitrar...

append - Capacity of slices in Go -

i have question below code package main import "fmt" func main() { var []int printslice("a", a) // append works on nil slices. = append(a, 0) printslice("a", a) // slice grows needed. = append(a, 1) printslice("a", a) // can add more 1 element @ time. = append(a, 2, 3, 4) printslice("a", a) } func printslice(s string, x []int) { fmt.printf("%s len=%d cap=%d %v\n", s, len(x), cap(x), x) } i guess result of running piece of code run code , check if guess correct. code resulted little bit different guess: result: on local go tour server: a len=0 cap=0 [] len=1 cap=1 [0] len=2 cap=2 [0 1] len=5 cap=6 [0 1 2 3 4] everything ok until last line don't cap=6 why not cap=5 my opinion did not create slice explicit capacity therefore system gave value of 6 . 2 ) when tried same code on golang tour server lit...

java - trouble in overriding JFrame.setBackground() -

i have class called mainui extends jframe, has code : //constructor public mainui(){ // components/panels defined , initialized here. setbackground(color.decode("#eff4e4")); } @override public void setbackground(color colorbg){ //a method set same background color components ave getcontentpane().setbackground(colorbg); decisionpanel.setbackground(colorbg); adbradio.setbackground(colorbg); fastbootradio.setbackground(colorbg); commandradio.setbackground(colorbg); pushpanel.setbackground(colorbg); uninstallpanel.setbackground(colorbg); pcpanel.setbackground(colorbg); phonepanel.setbackground(colorbg); } however, when compile, gives nullpointerexception @ line [ decisionpanel.setbackground(colorbg); ] i tried not overriding setbackground method , renamed , code worked fine, don't know why overriding setbackground method causes problem? i'm sure panels/components initialized before call method, it's obvious since code did work ater i've renamed ...

javascript - How can I disable an ng-click after a click inside a ng-if ng-switch statement? -

i have flag button when user clicks on, flags discussion, , afterwards flag button replaced text 'successfully flagged'. having trouble disabling ng-click after clicking flag button. ng-click still exists text 'successfully flagged' , want block clicks on text prevent errors on flagging same discussion. html: <div ng-if="canflag(discussion)"> <div ng-switch="isflagging" ng-disabled="button_clicked" ng-click="do_something()" id="flag{{discussion.id}}" title="{{'flag inappropriate'}}" robo-confirm="{'are sure want flag this?'}" class="feedactionbtn"> <i ng-switch-when="false" class="icon-flag"></i> <div ng-switch-when="true" translate translate-comment="success message"> flagged</div> ...

javascript - Get an list of datas and store in array in jquery -

i have struture of html below,this there list of option <div class='col-sm-4'> <div id='selectiondata' class="panel panel-default"> <div class="panel-body"> <h2 class='headertext'>selections</h2> <p style="font-size: 14px;">select apply you.</p> <ul> <li id="item1" data-cat="fruits">banana</li> <li id="item2" data-cat="fruits">pineapple</li> <li id="item3" data-cat="fruits">oragne</li> <li id="item4" data-cat="fruits">mango</li> <li id="item5" data-cat="vegetables">beans</li> <li id="item6" data-cat="fruits">j...

javascript - jQuery's click() inside "for" loop firing once -

this html code: <!doctype html> <head> <title>chemist</title> <link href="stylesheet.css" rel="stylesheet"> </head> <body> <h2 id="money"></h2> <table border="1px" id="inventory_t"></table> <script src="jquery.js"></script> <script src="app.js"></script> </body> </html> this app.js code: var money = 10; var inventorynames = ["carbon", "hydrogen"]; var inventoryamounts = [5, 5]; var inventorylength = 2; updatemoney(); populateinventory(); checkaddtomixclick(); function updatemoney(){ $("#money").text(money + "$"); } function populateinventory(){ $("#inventory_t").empty(); $("#inventory_t").append("<tr><td colspan='3'>inventory</td></tr>") for(let = 0; < inventoryl...

VB6 Bitwise And w/ 8-Byte Data Type -

i'm running problem vb6 gives me overflow. i'm using bitwise operations find state of individual bit, statement in particular final line of: dim double dim b double dim c double = 2 ^ 31 b = 0 c = b , a and error occurs on last line, overflow. i'm under impression , operator limited 4 bytes (long in vb6) , therefore overflows with a = 2 ^ 31 which greater upper limit of long. can confirm/clarify/solve problem? again, need find state of individual bit. (this occurs if make a, b, , c currency, 8 bytes stored integer types. need 44 bits, defaulted 8-byte data types) (i'm new bit manipulation , vb in general, , stackoverflow forgive mistakes may have made)

python - What does this daemonize method do? -

i looking around on github, when stumbled across method called daemonize() in reverse shell example. source what don't quite understand in context, wouldn't running code command line such: python example.py & not achieve same thing? deamonize method source: def daemonize(): pid = os.fork() if pid > 0: sys.exit(0) # exit first parent pid = os.fork() if pid > 0: sys.exit(0) # exit second parent a background process - running python2.7 <file>.py & signal - not same thing true daemon process. a true daemon process: runs in background. happens if use & , , similarity ends. is not in same process group terminal. when terminal closes, daemon not die either. not happen & - process remains same, moved background. properly closes inherited file descriptors (including input, output, etc.) nothing ties parent. again, not happen & - still write terminal. should ideally killed sigkill, not si...

android - Mystery error: "Failed to open database phenotype.db, database is locked." Can't find any info online -

i trying test app , wouldn't launch, instead kept getting error: failed open database '/data/data/com.google.android.gms/databases/phenotype.db'. android.database.sqlite.sqlitedatabaselockedexception: database locked (code 5): , while compiling: pragma journal_mode i can't find information error online, , no information on phenotype.db does. not doing related databases @ time when tested this; changes made layout-related. weirdly enough happened on app testing few weeks ago. different app, being tested on different device, different computer, , exact same error came up. in case switched different device , error went away. device switched having error. is kind of glitch google? can resolve can test app? you have forgotten close database, or thread writing database when trying write it. sqlite locks database when writing avoid corruption if entity tries write same database @ same time. android, show error in logcat, , query supplied forgotten. recom...

c# - Azure Resource Manager Deployment Name -

Image
i want start azure vm attached resource group programmatically. however, computemanagementclient.virtualmachines.restart requires "deploymentname" parameter, cannot find in new portal. have clue deploymentname can found? as know, have 2 types of libraries management our azure vm, have install these 2 libraries in console application following screenshoot: where deploymentname can found? in second library (microsoft. windowsazure .management.compute), can control azure vm(classic). , deployment name cloud service deployment name. can find in azure portal. cloud service (classic) -> specific cloud service (the same name azure vm) -> settings -> deployment name if create vm under resource group, please use first library (microsoft. azure .management.computer). in library, need provide resource group name , azure vm name, see detailed here:

java - Spring Boot controller with custom status codes? -

in spring boot 1.3.5 (java 8) i'd controller return custom status code , status msg. "custom" mean, status code not in org.springframework.http.httpstatus. i know, should stick standard codes (but can't). currently controller httpservletresponse response . . response.setstatus(255) i expected java.lang.illegalargumentexception: no matching constant [255] @ org.springframework.http.httpstatus.valueof(httpstatus.java:488) @ org.springframework.test.web.servlet.result.statusresultmatchers.gethttpstatusseries(statusresultmatchers.java:139) note, operation may successful, in case want return custom 2xx code response object (i.e. senderror doesn't help). google says may available in springframework 4.3, have thoughts implementing (with springframework 4.2.6)? custom http codes work on 4.2. matcher in junit fails assert response code. should work on browser.

python - sleep while querying VirusTotal? -

i use virustotal api check hash values against virustotal database, virustotal public api limits requests 4 per minute. section of code compares list of hash values (hash_list) against database follows: url = "https://www.virustotal.com/vtapi/v2/file/report" parameters = {"resource": hash_list, "apikey": "<api key here>"} data = urllib.urlencode(parameters) req = urllib2.request(url, data) response = urllib2.urlopen(req) json_out = response.read() i need figure out how add wait or sleep function code checks 1 hash hash_list, waits 15 seconds, checks hash, until list complete. keep queries 4 per minute, can't figure out how add wait work properly. import time /code/ time.sleep(15) should work. add time.sleep() snippet block cause delay.

Date difference calcuation in R -

i have weird formatting date , time data, , need calculate difference in r. appreciated. thanks. timestart timeend may 1 2016 1:00am may 1 2016 1:28am may 1 2016 1:01am may 1 2016 1:21am may 1 2016 1:00pm may 1 2016 1:13pm may 1 2016 1:00pm may 4 2016 5:42pm may 1 2016 1:02pm may 1 2016 1:37pm may 1 2016 1:02pm may 1 2016 1:14pm may 1 2016 1:02pm may 1 2016 1:39pm may 1 2016 1:02pm may 1 2016 1:18pm take @ ?strptime see how format date/time objects. library(data.table) dat <- read.table(text = "may 1 2016 1:00am may 1 2016 1:28am may 1 2016 1:01am may 1 2016 1:21am may 1 2016 1:00pm may 1 2016 1:13pm may 1 2016 1:00pm may 4 2016 5:42pm may 1 2016 1:02pm may 1 2016 1:37pm may 1 2016 1:02pm may 1 2016 1:14pm may 1 2016 1:02pm may 1 2016 1:39pm may 1 2016 1:02p...

python - Suppress hyperlinks from matplotlib sphinx extension -

i using matplotlib.sphinxext.plot_directive extension sphinx create plots dynamically in documentation. in 1 of .rst files have following command .. plot:: plots/normal_plots.py this runs matplotlib code, e.g. plt.plot(x, y) plt.show() this creates , embeds plot, right above adds following 4 hyperlinks (source code, png, hires.png, pdf) if @ examples on matplotlib examples have these 4 links right beside of plots. is there anyway suppress hyperlinks? want plots, don't want clutter document these links every time insert plot. there 2 configuration options this: plot_html_show_source_link plot_html_show_formats set both options false in conf.py suppress hyperlinks. reference: http://matplotlib.org/devel/documenting_mpl.html#configuration-options .

Swift animation with constraint -

is possible make uiview animation changing constraints? basically, want animate myv (uiview) has x, y, height , width constraints, using: uiview.animatewithduration(1.5) {} changing old constraints. yes possible. can this: func animateheight() { uiview.animatewithduration(1.5, animations: { self.heightcons.constant = 250 // value self.view.layoutifneeded() }) } where self.heightcons iboutlet height constraint on uiview . if don't use storyboards can check out how create layout constraints programmatically . for info on core animation , auto layout: combining autolayout core animation

c# - can a string array go past 111? -

i trying make array gather lines in files in directory, thought had finally, when string array gets entry 111 crashes indexoutofrangeexception string[] wordlist = new string[adjectivelistlength]; console.writeline("length .. " + adjectivelistlength); console.writeline("string length .. " + wordlist.length); int o = 0; (int = 0; < fileentries.length; i++) { wordlist = file.readalllines(fileentries[i]); foreach (string s in wordlist) { console.writeline(s + " .. " + + " .. " + o); wordlist[o] = s; //o += 1; } } the exception points int commented out when error, i've been trying few hours , i've gotten far feel i'm 1 inch finish line can't figure out what's going on. the best way task use list<string> used without knowing beforehand length of each file in fileentries array list<string> wordlist = null; (int = 0; < fileentries.length; i++) { wordlist...

entity framework - EF DbMigration Sql update not running from embedded resource -

using entity framework 6 automated migrations, i'm trying execute sql embedded resource file using sqlresource . following script doesn't work correctly - seems update column empty string. work correctly if run script directly in ssms. update [emailtemplates] set html = 'xyz' [type] = 'confirmemail' if simple works: alter table emailtemplates add somecolumn nvarchar null the "html" column of type nvarchar(max) null . ideas?

java - Integrate JUnit 5 tests results with Intellij test report -

Image
my build.gradle configure this: apply plugin: 'java' compiletestjava { sourcecompatibility = 1.8 targetcompatibility = 1.8 } repositories { mavencentral() } dependencies { testcompile("org.junit.jupiter:junit-jupiter-api:5.0.0-m1") testruntime("org.junit.vintage:junit-vintage-engine:5.0.0-m1") } and simple test this: public class junit5test { @test void test() { } } when execute test, see in console: test run finished after 76 ms [ 1 tests found ] [ 0 tests skipped ] [ 1 tests started ] [ 0 tests aborted ] [ 1 tests successful] [ 0 tests failed ] build successful but there's nothing in test report: what do wrong? how can integrate junit 5 results test report windows ? i'm using intellij 2016.2 when execute tests gradle results printed console shown above. if want see results in idea's test report window can execute test...

Bug on wordpress TwentyFifteen theme? Sidebar won't scroll -

having problems sidebar on site. it won't scroll. (in mac chrome , mac firefox -- , maybe in other browsers) i've had fixed couple of times. keeps breaking. the last time, developer said wordpress version , plugins need date. i've updated them. still same problem. i've had quite few customisations, don't want change theme unless necessary. this site: http://richardclunan.com is bug in twentyfifteen theme? is there fix it?

Android SeekBar strange behaviour -

Image
i have default seekbar in android 3 possible values: 0,1,2 (left, middle, right). but takes value when finger on point(corresponding value) or right of it. if finger 1 pixel left of point, seekbar takes previous value. i want take value when finger near point. explanation skill poor, see picture: if using 3 points isn't enough, why not add more points , map 3? e.g. private static final double ratios = new double[]{ .33, 66, 100 } private static final int faked_points = new int[]{ 0, 50, 100 } private void setupseekbar() { // normal setup seekbar.setmax(100); } @override public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { if(!fromuser) // want when user changes values return; for(int = 0; < ratios.length; i++){ if(progress <= ratios[i]){ onrealprogresschanged(i); seekbar.setprogress(faked_points[i]); // way stays on our 3 faked points } } } private void o...