Posts

Showing posts from September, 2012

html - Gauge markup ready for dynamic content -

i'm trying create markup gauge display how full messages inbox is, i'm having trouble dynamic part. body { background-color: #000; font-family: "helvetica"; margin: 35px 35px 35px 50px; } #gauge { -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color: #5e767d; border: 2px solid #fff; color: #000; float: right; height: 260px; margin-left: 15px; overflow: hidden; text-align: center; width: 50px; } #gauge div { display: block; overflow: hidden; padding-top: 5px; position: relative; } #gauge #current { font-size: 30px; font-weight: 900; z-index: 2; } #gauge #percentual { background-color: #fff; font-weight: 800; z-index: 1; } <div id="gauge"> <div id="current" style="

sql server - SQL IsNull with SELECT subquery in a query -

i have this: isnull(fpono.[replan ref_ no_],(select distinct po.[replan ref_ no_] nav_vermorel_live.dbo.[sc vermorel srl$production order] po sh.[external document no_] = po.[old prod_ order no_] , po.[source no_] = sl.no_)) this piece of sql part of big wall of text, works without isnull check. isnull outputs error bellow. point me in right direction? have null on specific column, , can right results table. don't know how it. subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. select sl.[document no_], sl.[sell-to customer no_], sl.type, sl.[line no_], isnull(fpono.[replan ref_ no_],(select distinct po.[replan ref_ no_] nav_vermorel_live.dbo.[sc vermorel srl$production order] po sh.[external document no_] = po.[old prod_ order no_] , po.[source no_] = sl.no_)), sl.no_, sl.[location code], sl.[posting group], sl.[shi

winforms - rdlc report not showing latest inserted data c# -

i trying show report on same form when user clicks on button insert record in database. here's situation: below code, data shows when write code on separate form. private void invoice_load(object sender, eventargs e) { con.open(); sqlcommand cmd = new sqlcommand( "select top 1 invoiceid sale order date desc", con); sqldatareader dr = cmd.executereader(); if (dr.read()) { int invoiceid = int.parse(dr[0].tostring()); this.saletableadapter.fill(this.estoredbdataset.sale,invoiceid); } this.reportviewer1.refreshreport(); } however, it's not showing when code in if statement below: { //insert record code this.saletableadapter.fill(this.estoredbdataset.sale,invoiceid); this.reportviewer1.refreshreport(); }

android - why always LocationSettingsStatusCodes.SUCCESS even GPS turn off -

if(!locationmanager.isproviderenabled(locationmanager.gps_provider)) { mgoogleapiclient = new googleapiclient .builder(this) .enableautomanage(this, 34992, this) .addapi(locationservices.api) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build(); mgoogleapiclient.connect(); locationchecker(mgoogleapiclient, this); } i want see gps dialog when android gps turn off. gps turn off, status.getstatuscode() success, think error. why? public static void locationchecker(googleapiclient mgoogleapiclient, final activity activity) { locationrequest locationrequest = locationrequest.create(); locationrequest.setpriority(locationrequest.priority_no_power); //locationrequest.setinterval(864 * 1000); //locationrequest.setfastestinterval(864 * 1000); locationsettingsrequest.builder builder = new locationsettingsrequest.builder() .addlocationrequest(locationrequest); builder.setal

Javascript: moving elements in an array -

var array = ["object1","object2","object3","object4","object5"]; var copy = array.slice(); copy.foreach(function(value) { if(value === "object3"){ value = "newobject3" } }); console.log(copy ); if want move object3 in array first index, after assigned new value. how do it? , whats effective , less time? libraries lodash can used. var array = ["object1", "object2", "object3", "object4", "object5"]; var copy = array.slice(); copy.foreach(function(value, index, thearray) { if (value === "object3") { thearray[index] = thearray[0]; thearray[0] = "newobject3"; } }); console.log(copy);

javascript - Getting status 304 for an endpoint sometimes -

i randomly receiving status code:304 not modified when looking @ network transactions json rest endpoint in chrome devtools. const url = "/my/endpoint" let xhttp = new xmlhttprequest(); xhttp.open("get", url, true); xhttp.setrequestheader("content-type", contenttype); xhttp.send(); when occurs, receive same xhttp.status received previous in code. incorrect since mocked backend toggling status between 200 , 404 subsequent calls on endpoint. it feels kind of caching taking place? how turn off?

android - TextureView Align Parent Right Programmatically -

i have customview extending textureview. want customview align_parent_right. my method inside customview has following code: relativelayout.layoutparams layoutparams = new relativelayout.layoutparams(); layoutparams.addrule(relativelayout.align_parent_right); setlayoutparams(layoutparams); however, customeview still aligned left , not right. how can change align right? add way relativelayout.layoutparams layoutparams = new relativelayout.layoutparams(); layoutparams.addrule(relativelayout.align_parent_right); layoutparams.addrule(relativelayout.left_of, r.id.leftviewidhere); setlayoutparams(layoutparams);

javascript - Merge two string arrays excluding some values -

i have 2 arrays: var = ['a123', 'a321', 'a444', 'b3132', 'a123']; var b = ['b3132', 'a321', 'a444', 'a123', 'a123']; and want merge them condition , value not on array, when character 'b' on string , ignore , proceed merge, result be: var ab = ['a123', 'a321', 'a444']; i have solved on loop checking array values 1 one think there's better solution. an es6 solution - use set() unique items, spread , , filter array remove items include b . if b 1st letter in string use string.prototype.startswith() instead of array.prototype.includes() . const = ['a123', 'a321', 'a444', 'b3132', 'a123']; const b = ['b3132', 'a321', 'a444', 'a123', 'a123']; const result = [...new set(a.concat(b))].filter((item) => !item.includes('b')); console.log(result);

django - Simple RDF mysql backend -

okay have more abstract mysql kind of question , i'm not sure begin not lot of resources online in area. warning not have lot of experience mysql. okay, have built far simple django interface have incorporated ctakes nlp pipeline into. pipeline runs when user submits a block of text associated study name , spits out array of triples automatically generated using semantic role labeler , dependency parser. [(weight_gain, mayleadto, obesity), (cancer, maybe, present), (study, observedchangein, sleep_patterns), ....] what store individual triples in simplest mysql schema possible primary key study name , each row contains subject, object , predicate field corresponding triple structure. so far saving output direct chunk of triple_store: code handling script , storing data: if form.is_valid(): instance = form.save(commit=false) instancevalueslist = [instance.study_abstract,instance.study_methods,instance.study_results] instancevaluesstring = u&qu

ms access - MSAccess - dbSeeChanges error? -

i have database has been working couple years until morning. when attempt copy contents of remote table local backend, presented err: "error 3622 - must use dbseechanges option..." the remote table on server , have autonumber attribute. backend table simple readonly/static snapshot not care auto numbering datatype , defined number - need table (snapshot) local performance concerns. i added dbseechanges variable without success - complains "too few parameters" on db.execute line (below). here details db: dim db database dim strsql string set db = currentdb() strsql = "insert item " & _ "select dbo_item.* " & _ "from dbo_item " & _ "where dbo_item.master_invid= " & tempvars!my_invid db.execute strsql, dbfailonerror + dbseechanges what missing? suggestions avoid/correct. another way make copy of linked table covert local table: localtablename = "item" docmd.

javascript - What is the view port width, height and device pixel ratio for the devices Google Pixel and Google Pixel XL -

i developing web site , want see how works on google pixel , google pixel xl devices. don't have access devices, need know view port width, height , device-pixel-ratio of devices. i have tried searching on google still couldn't find useful. latest chrome doesn't list devices' sizes in developer tools. it helpful if have access these devices can figure required information out. both pixel , pixel xl listed have css pixel resolution of 411×731, device-pixel-ratios of 2.6 , 3.5 respectively. source: https://material.io/devices/ google site. that's odd though, considering phones more effective pixels screen size increases, rather blowing bigger , getting higher dppx (dots per pixel). that jive lord flash's screen capture smaller pixel; doesn't validate pixel xl. if post screen capture pixel xl determine scaling that.

vb.net - How to access into a private repository's .diff of GitHub in vb .net with WebRequest credentials -

i want access .diff file of private repository of github. have following code, doesn't work. dim myreq httpwebrequest = webrequest.create(url) dim netcred networkcredential = new networkcredential("usr", "pass") dim credentials icredentials = netcred.getcredential(url, "basic") myreq.credentials = credentials myreq.preauthenticate = true try dim response httpwebresponse = ctype(myreq.getresponse(), httpwebresponse) catch ex system.net.webexception messagebox.show(ex.message) end try there wrong? message webexception contains "error in remote server. (404) not found"

excel - VBA code to delete range based on variable - running slowly -

i'm using code delete range, cell in last column (aa) of range equal variable specified elsewhere in worksheet (k2). the code uses shift: xlup remove data , shift rest of data upwards. all of done 1 row @ time until condition no longer true. the issue runs quite - 25-30 rows of data being deleted, 1 @ time. can speed up? sub uncommitsession() dim what_to_find string dim ws excel.worksheet dim foundcell excel.range dim ival integer ival = application.worksheetfunction.countif(range("aa5:aa800"), range("k2")) what_to_find = range("k2") = 1 ival set ws = activesheet set foundcell = ws.range("aa:aa").find(what:=what_to_find, lookat:=xlwhole) if not foundcell nothing range("q" & foundcell.row & ":aa" & foundcell.row).delete shift:=xlup else msgbox (what_to_find & " not found in session archive.") end if next end sub i think fastest solution set autofilters, se

C++ add int to int array -

how can add int int array. not want set array size, not want use external loop. int myarray[] = {}; ... if (condition) { myarray.push(value); } as leon suggests you're looking vector , push_back method. you use follows: vector<int> myarray; // size 0 if(condition) { myarray.push_back(value); // resized 1; } edit: you can use ostream_iterator print vector . example: copy(cbegin(myarray), cend(myarray), ostream_iterator<int>(cout, " "))

html - Firefox: Icons are not loading for custom font in firefox while bundled -

none of icons in custom font loading in firefox while bundling enabled. if turn off bundling, displayed. however, in chrome, or without bundling, icons getting displayed. the font loaded relative url in @font-face , using cssrewriteurltransform make paths relative. see font being fetched in network. also, have added mimemap font types in system.webserver. <mimemap fileextension=".eot" mimetype="application/vnd.ms-fontobject" /> <mimemap fileextension=".ttf" mimetype="font/ttf" /> <mimemap fileextension=".otf" mimetype="font/otf" /> <mimemap fileextension=".woff" mimetype="application/font-woff" />

apache - Docker and apache2, remove port from url -

i'm working docker on ubuntu server , , have apache2 container. this container working, if go http://my-server-ip:8080 , can see folders , files in folder /var/www/html of apache2 container. /var/www/html in container linked folder /home/me on machine. work directly in /home/me . now need add virtualhost redirect subdomain specific folder /var/www/html/portfolio . so connect container , add new host : <virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www/html/portfolio servername my.subdomain.com serveralias my.subdomain.com </virtualhost> the result when go my.subdomain.com:8080 it's ok, can read content of /var/www/html/portfolio , question : how can remove :8080 in url ? you have 2 options: publish container on port 8 0, requires docker host have port 80 free port. use nginx on port 80 , reverse prox y apache container runs on port 8080.

php - Finding the closest location based on pre-defined working radius set within the same table -

i trying find closest locations of pre-defined entries within table. far, query using works fine , provides accurate result set. how works is: 1 table contains pre-defined estimations plumbers set estimated cost specific price range. however, each plumber has own working radius can different other plumbers. here example. table: pre-defined quotation id name pricerange estimated-cost working-radius lat long 1 john £500-£800 £560 20 miles 51.50 -0.118 my current query loops on full pre-defined quotations table , order results distance being closest first. $quotes = quote::all()->where('latitude', '!=', null)->where('longitude', '!=', null)->where('estcost', '!=', null); foreach ($quotes $quote) { $tablename = "quotes"; $origlat = 52.5002721395; // customers lat $origlon = -1.98032029216; // customers long

r - create sequence of numbers with leading zeroes -

this question has answer here: adding leading zeros using r 7 answers this question has been addressed using console.writelines function, not available in version of r , can't find package belongs to. i trying create sequence of numbers 0-99 leading zeroes in format "xxx", numbers should 000, 001, 002... 099. when use: seq(000:099) r returns 1, 2, 3 etc. is there simple way this? strikes me should far easier is. this different previous answers need 2 zeroes in front of numbers 0-9 , 1 0 in front of numbers 10-99 whereas previous question asked 1 0 in front of numbers. for example 1:100 leading zeroes 3 digits total: sprintf('%0.3d', 1:100) [1] "001" "002" "003" "004" "005" "006" "007" "008" "009" "010" "011" &qu

php - Set noindex from template - Yoast -

with wordpress plugin's yoast seo it's possible set noindex, nofollow type of template i've create? for example, i've custom template called "section", so, it's possible set noindex,nofollow default template yoast seo plugin, api yoast? find this nothing noindex, nofollow functions. for you, i've solved in way. function set_noindex_nofollow($post_id){ if ( wp_is_post_revision( $post_id ) ) return; if ( strpos(get_page_template_slug($post_id),'section') !== false){ add_action( 'wpseo_saved_postdata', function() use ( $post_id ) { update_post_meta( $post_id, '_yoast_wpseo_meta-robots-noindex', '1' ); update_post_meta( $post_id, '_yoast_wpseo_meta-robots-nofollow', '1' ); }, 999 ); }else{ return; } } add_action( 'save_post', 'set_noindex_nofollow' );

python - How can I plot a pivot table value? -

Image
i have pivot table , want plot values 12 months of each year each town. 2010-01 2010-02 2010-03 city regionname atlanta downtown nan nan nan midtown 194.263702 196.319964 197.946962 alexandria alexandria nan nan nan west landmark- nan nan nan van dom how can select values each region of each town? thought maybe better change column names years , months datetime format , set them index . how can this? the result must be: city regionname 2010-01 atlanta downtown nan midtown 194.263702 alexandria alexandria nan west landmark- nan van dom here's similar dummy data play with: idx = pd.multiindex.from_arrays([['a','a&

c++ - Streaming binary data with FFmpeg -

i using ffmpeg in c++ library live stream video , audio. want stream binary data separate stream. if i'm reading correctly, mp4 container supports "private streams" can contain kind of data. can't find out info on how add such stream ffmpeg. idea have stream of type av_media_type_data uses codec av_codec_id_bin_data . what want closely described here , wasn't answered.

PHP - Multiple scripts at once (AJAX) -

after asking this question , pointed on right direction of not being able execute second script @ if 1 running. i make apps rely on execution of ajax calls php pages , , today found trying write on file fwrite() on php script , trying read same file fread() (to progress feedback) on ajax call ended in the second script being executed when first 1 had finished . even trying echo simple "hello" ( echo "hello"; exit; ) not show nothing on page until first script finished. so, i'm asking: normal configuration? same on every installation of php default? configuration on php.ini that can change ? or has server (in case, microsoft iis 10)? can shed light on how able execute multiple php scripts on different ajax calls at once (or before others finish)? i know i'm not giving information settings of context, don't know neither into. thank time , help! as luis said write-lock on file you're trying modify. possibility if you'r

GIT add production server -

i have production server work without using git, have files on pc , upload updates filezilla. i discovered git , use replacement filezilla. i configured git on pc , did push of project files in repository, not know configure updates on production server. the legacy way define bare repo on server , push bare repo , combined post-receive hook checkout received files in folder of choice/ but git 2.3+, if want, can: initialize repo directly on target folder in server, add , commit everything set: git config receive.denycurrentbranch updateinstead clone repo on local pc. assume can use same ssh access must have set in filezilla: git clone user@server:/path/to/git/repo make new commits, push directly non-bare repo

java - Magnolia - child component, or area that always contains 1 child component of a specific class -

Image
in magnolia/blossom component, possible define , render child component of type (or area defined contain 1 component of specific type, prepopulated , has clean author interface)? e.g. have rich text component. want build component has section within uses rich text component. create area has maximum of 1 child components, , allows component type, require author manually add each time - plus author interface ugly*. fwiw i'm using magnolia 5.4.9, blossom module 3.1.3 , thymeleaf 2.1.4. *i have following i'm trying avoid - contains 2 wrappers single component, plus redundant 'maximum number of components reached' area to avoid having editor create instance of component manually, can use autogeneration . to rid of green bars in ui ... apart writing inside of single component, can try examine element ids see if can custom tweak css hide it, not possible.

python - SqlAchemy: Select coalesce columns -

i trying write equivalent of sql statement in sqlalchemy: select coalesce(table1.column1, table2.column1), table1.column2 ... table1 full outer join table2 on table1.column1 = table2.column1 when do from sqlalchemy.sql.functions import coalesce sa.select([coalesce(...), <other columns>]).select_from(...) i error: typeerror: boolean value of clause not defined

java - Unit testing OdataFeed -

i have java class, takes odatafeed input, processes , pushed rabbitmq. writing junit testing this, input odatafeed json, have sample sample json format, how convert odatafeed. @override public void process(exchange exchange) throws exception { gson gson = new gsonbuilder().serializenulls().create(); list<map<string, object>> list = gson.fromjson(json, list.class); maps = setentriesmap(list, maps); odatafeed feed = (odatafeed) exchange.getin().getbody(); in junit, have string string result = "<json>"; byte[] array = result.getbytes(); camelcontext ctx = new defaultcamelcontext(); exchange ex = new defaultexchange(ctx); ex.getin().setheader("rabbitmq", "rabbitmq"); ex.getin().setbody(array); since required input odatafeed, not able convert string odatafeed. need here, how unit test component. , looking basic tutorials in jmockit, have few oth

design patterns - How does Google's "Search Suggest" (Instant) Work? -

Image
this example of google instant: i understood following question how google instant work? whenever user types ajax call made returns relevant ' suggestions ', but, how work internally? what's architecture feature? using trie data structure approach or else?

DocumentDB resource with specified id already exists when running a pre-trigger on create -

in documentdb i've create pre trigger on create operation. trigger code following function createblock() { var collection = getcontext().getcollection(); var request = getcontext().getrequest(); var doctocreate = request.getbody(); if (doctocreate.documenttype) { var query = "select top 1 a.blocksequence order a.blocksequence desc"; var isaccepted = collection.querydocuments(collection.getselflink(), query, function (err, feed, options) { if (err) throw err; if (!feed) throw new error("failed find document."); if (feed.length) { doctocreate.blockcode += (feed[0].blocksequence + 1); doctocreate.blocksequence = feed[0].blocksequence + 1; } else { doctocreate.blockcode += "1"; doctocreate.blocksequence = 1; }

Enable WebGL Firefox Ubuntu -

how enable webgl support in firefox running headless on ubuntu 16 server. firefox headless , there no gui see going on. i tried installing sudo apt-get install libosmesa6 but think i'm missing step

swift - How to use optional binding in switch statement in prepare(segue:) -

in swift can use cool feature of switch statement in prepare(segue:) create cases based on type of destination view controller: example: override func prepare(for segue: uistoryboardsegue, sender: any?) { switch segue.destination { case let detailviewcontroller detailviewcontroller: detailviewcontroller.title = "detailviewcontroller" } case let otherviewcontroller otherviewcontroller: otherviewcontroller.title = "otherviewcontroller" } } however, if segue triggered split view controller, destination navigation controller, , want switch on class of navigation controller's top view controller? i want this: case let nav uinavigationcontroller, let detailviewcontroller = nav.topviewcontroller as? detailviewcontroller: //case code goes here where have same construct use in multiple part if let optional binding. that doesn't work. instead, have rather painful construct this: case let nav uinavigation

java - In my ArrayList of Arraylists, why are the all the actions on individual elements effecting all other indexes? -

i have nested arraylists compose book: private arraylist<arraylist<pagecontents>> book = new arraylist<>(); //a list of lists private arraylist<pagecontents> page = new arraylist<>(); //a list of objects book.add(page); //add new(first) page in book. pagecontents pagecontents = new pagecontents(); //create new line pagecontents.setline("this line on page"); //edit line book.get(0).add(pagecontents); //add new (first) line first page of book. so, in practice, book.get(0).get(0).getline(); return first line of of first page of book. the problem i thought working fine, since initial part of development involved getting single page right, worry multiple pages. then, when appended page list book arraylist book.new(page); found out same page @ book.get(0) . value of book.get(0).get(0) same book.get(1).get(0) , or book.get(0).get(20) was same book.get(1).get(20) . i thought "no big deal,it must copying data book.get(0) . i

reactjs - React radio input issue -

i trying render following jsx code. when add 'yes' , 'no' text complement radio buttons, following error... <tr> <td>do want questions displayed in random order?</td> <td><input type="radio" name="random">yes</input></td> <td><input type="radio" name="random">no</input></td> </tr> error: input void element tag , must neither have children nor use dangerouslysetinnerhtml . what doing wrong? use label <label for="yes">yes</label> <input type="radio" id="yes" name="random"/>

java - What is wrong with this implementation of bitwise multiplication? -

i attempting implement method bitwise multiplication in galois field 256 sake of building implementation of aes. current multiplication method follows: public static int multiplypolynomials(int n, int m) { int result = 0x00000000; string ns = tobitstring(n); string ms = tobitstring(m); (int = 0; < ns.length(); i++) { if (ns.charat(i) == '1') { /* * if there's 1 @ place i, add value of m left-shifted places result. */ int temp = m; (int j = 0; j < i; j++) { temp = temp << 1; } result += temp; } } return result; } the tobitstring(int n) method purely shortcut integer.tobinarystring(int n) . given input of (0x0000ef00, 2) , output of function 494 (should 478). printing direct call tobitstring(0x0000ef00) confirms output of function expected (in case, 1110111100000000). if first input shifted 1 byte right (0x000000ef) output still 494. with above inputs, value of ns 1110111100000000 , bit

security - How is it impossible to spoof Referer Header during CSRF Attack? -

suppose application's defense against csrf attacks check referer header same origin. suppose, also, browsers sending referer header (although isn't case). i read trivial user spoof own referer header, impossible csrf attacker same. 1.) how spoof referer header? (note, referer headers can't modified programmatically) 2.) why can't csrf attacker that? it true spoofing referrer header on own browser trivial, though can't modify them programmatically. trick intercept request after browser sends it, before reaches server. this can done using intercepting proxy burp suite . tell browser use local intercepting proxy proxy server. browser make request local proxy. local proxy keep request alive , allow change want in http text, including referrer header. when you're ready, release request , local proxy sends away. easy peasy. also worth noting implication of this, if don't use tls website, hops along way potentially evil , modify requ

c++ - OpenMPI: MPI_Send allocates more and more memory -

i'm working on code crashes after time during mpi communication due running out of memory. wondering why code uses more , more memory since tried reduce allocations as possible. college of mine has similar problem code. so found seems caused send , recv routine , therefore wrote example shows similar behavior (in smaller scale): #include <mpi.h> #include <stdio.h> #include <sys/resource.h> #include <iomanip> rusage mem_usage; int mem_proc; int mem_max; int mem_min; int mem_sum; int mem_sum_old; double mem_avg; int world_size; int world_rank; void printmemusage(std::string prefix) { mpi_barrier(mpi_comm_world); getrusage( rusage_self, &mem_usage); mem_proc = mem_usage.ru_maxrss; mpi_allreduce(&mem_proc,&mem_sum,1,mpi_int,mpi_sum,mpi_comm_world); mpi_allreduce(&mem_proc,&mem_min,1,mpi_int,mpi_min,mpi_comm_world); mpi_allreduce(&mem_proc,&mem_max,1,mpi_int,mpi_max,mpi_comm_world); mem_avg

javascript - AngularJS 2 Alternate StyleUrsl/TemplateUrl -

i have component i'm trying inject different styleurl or templateurl based on object initialized when component loads. @component({ moduleid: module.id, selector: 'my-sample', templateurl: './sample.html', styleurls: ['./sample.css'], providers: [userservice] }) export class samplecomponent implements oninit { sampleentity: sampleentity[]; constructor(private userservice: userservice){} getuserentity():void { this.sampleentity = this.userservice.getuserobject(); } ngoninit():void { this.getuserentity(); } } my object initialized (sampleentity) looks this: { id: 1, usertype: 'creative' }, { id: 2, usertype:'boring'} is there way can used angular expressions load specific templateurl or styleurl based on object assigned? for example: @component({ moduleid: module.id, selector: 'my-sample', templateurl: './{{sampleentity[0].usertype}}.html', styleurls: ['./{{samp

javascript - Express doesn't return 304 for static json -

i'm using express.static serve large, static json file. while express.static return 304 when other static resources unchanged, returns 200 static json. because of size of file , nature of application, want avoid clients downloading file unless has changed. how can convince express return 304 json? you can force status code in return: res.status(304).json({ data: 'data' }); // or 200

powershell - DSC, compiling a ps1 file into MOF -

i'm trying configure target node via dsc. i've created .ps1 file dummy configuration; can see below; it's 1 of first examples find in dsc sites. want compile .mof file. i've executed: ps c:\var\dsc\configurations> . .\localhost.ps1 but nothing. mof file doesn't appear , no error messages thrown. missing? configuration fileresourcedemo { node "localhost" { file directorycopy { ensure = "present" # can set ensure "absent" type = "directory" # default "file". recurse = $true # ensure presence of subdirectories, sourcepath = "c:\users\public\documents\dscdemo\demosource" destinationpath = "c:\users\public\documents\dscdemo\demodestination" } log afterdirectorycopy { # message below gets written microsoft-windows-desired state configuration/analytic log message = "finished running file resource id di

angularjs - Remove all validation errors from an Angular Field -

i know can call $setvalidity('errorkey', true) clear specific validation error field. there way clear validation errors single field? i tried $setvalidity(true) obvious didn't work. guess loop through $error field , call $setvalidity. there easier way? please use following line remove validations error formname form name .. $scope.formname.$setuntouched();-- set form untouched $scope.formname.$setpristine();--remove validation error

c# - Main window form showing up blank -

i've gone through number of other questions regarding issue. the form loads, it's missing controls. used work. screwed cannot figure out changed break it. i've checked , uploaderui.cs spelled correctly. code below: namespace uploaderui { static class uploaderui { /// <summary> /// main entry point application. /// </summary> [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new mainform()); } } } my initializecomponent working, , able set break point , step through of it. public mainform() { initializecomponent(); // create instance of listview column sorter , assign // listview control. lvwcolumnsorter = new listviewcolumnsorter(); this.listviewnotcurrent.listviewitemsorter = lvwcolumnsorter; } i'm @ los

Back and forth conversation in Watson conversation -

Image
how can achieve , forth conversation in watson conversation service? in image when true node reached next node traverse based on input provided. if second input provided @ same level watson go root node. let me know how stay on same node , respond differnt user input. thanks. what described how conversation works. move down branches, attempt match node. if not find matching node in branch, return root find answer. to prevent last node in branch has true condition , either message, and/or continue return correct point in branch. i did blog post on while back. https://sodoherty.com/2016/09/10/understanding-how-a-conversation-flows/

c# - removing/detaching duplicate entity from local context -

i detaching every student entity local context . following code works fine , detach every entry of student entity local context. _context.set<students>().local.tolist().foreach(x => { _context.entry(x).state = entitystate.detached; }); what if need remove/detach duplicate entry of student local context? how can that? i using ef 5.0 easier check when adding isn't duplicate. but group, skip first , detach rest? _context.set<students>() .local .tolist() .groupby(x => x.name) .selectmany(g=>g.skip(1)) .foreach(x => { _context.entry(x).state = entitystate.detached; });

javascript - Rounded result, how to make proper operations in Angular? -

i getting kind of rounded result of operation: $scope.pay_holiday_days = (parseint($scope.reached_holiday_days) + pending_holiday_days) * $scope.daily_base_salary; supposing have (333.33)*15 = (the result should be: 4 999.95) but insted of result of (5000), closed. not using tofixed or similar function, , in console apppears same number (5000)

c# - Detect when none of app windows is active/focused -

how detect when user changes focus multi-window application (alt+tab e.g.). i want detect when none of app windows active/focused. first window shown user can work 4 windows(none of these shown dialog). form has containsfocus property indicates whether form, or 1 of child controls has input focus. can check property open forms detect if application contains focus or not: var isactive = application.openforms.cast<form>().any(x=>x.containsfocus); if want notified of state of application in small periods of time, can use in tick event of timer .

compiler errors - Unable to compile a4tech-bloody-linux-driver on Linux Mint 18, nor Ubuntu 16.04 -

since bought a4tech bloody v8 mouse, install driver linux, linux mint 18 (ubuntu 16.04 based). i found driver on github: https://github.com/maxmati/a4tech-bloody-linux-driver since there no documentation how install it, far figured out how prepare compilation: first installed cmake : sudo apt-get install cmake then prepared make follows: cmake . i attach output future reference, don't see error there: -- c compiler identification gnu 5.4.0 -- cxx compiler identification gnu 5.4.0 -- check working c compiler: /usr/bin/cc -- check working c compiler: /usr/bin/cc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- detecting c compile features -- detecting c compile features - done -- check working cxx compiler: /usr/bin/c++ -- check working cxx compiler: /usr/bin/c++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done -- detecting cxx compile features -- detecting cxx compile features - done --

php - how to prevent duplicate outputs when looping through two arrays -

i trying loop through 2 arrays @ once. first array contains headings, second array contains data user has imputed via form. these values set pdf file. problem having output being duplicated twice. current output first name user input first name user input last name user input last name user input output want first name john last name smith var dump array(3) { ["fname"]=> string(5) "dkdkd" ["lname"]=> string(3) "kdk" ["submit"]=> string(6) "submit" } array(3) { ["fname"]=> string(5) "dkdkd" ["lname"]=> string(3) "kdk" ["submit"]=> string(6) "submit" } array(3) { ["fname"]=> string(5) "dkdkd" ["lname"]=> string(3) "kdk" ["submit"]=> string(6) "submit" } array(3) { ["fname"]=> string(5) "dkdkd" ["lname"]=> string(3) "kdk" [

javascript - An efficient way of removing objects from an indexedDB object store that are missing a property -

i thinking how make operation in project of mine more efficient. operation in current implementation loads objects object store, iterates through array , testing whether object missing property or if property undefined, collecting set of such objects in second array, , removing of these objects. i using getall obvious performance benefit on cursor iteration. i concurrently calling individual delete requests, there no speed there the indexeddb api evolving support batch deletes on non-indexed non-keypath props missing values. the issue have no way of checking against property when property not in keypath of object store without loading each object memory. objects rather large in cases. 1 of properties of each object extremely large (essentially string of html document). i cannot use index, because properties not present in objects, or not have value, not appear in index. is there way avoid loading such objects memory? i have thought partitioning, , using 2 object stores,

javascript - change value array angularJS before POST to API -

i have array : [{"idalokasiemiten":154,"idorganization":12,"namaorganization":null,"codeemiten":"antm","nameemiten":"aaneka tambang (persero) tbk"},{"idalokasiemiten":0,"idorganization":null,"namaorganization":null,"codeemiten":"adhi","nameemiten":"adhi karya (persero) tbk"}] how change values before post api? i want post api into: [{"idalokasiemiten":0,"idorganization":12,"namaorganization":null,"codeemiten":"antm","nameemiten":"aaneka tambang (persero) tbk"},{"idalokasiemiten":0,"idorganization":12,"namaorganization":null,"codeemiten":"adhi","nameemiten":"adhi karya (persero) tbk"}] here angularjs: // detail alokasi emiten $scope.emit.detaildaftaremiten = []; $scope.additemalokasi = fu

Powershell Workflow: Using if/else statement? -

i trying use workflow in order make script run faster running ping on several machines in parallel. getting stuck trying use if/else statement within workflow , adding log entries based on results of ping. right now, not writing logs based on ping results. assistance appreciated. open suggestions different methods this, long not involve using module. want stick powershell code (i not have permissions install modules on server running). thank you! here current code: <# .notes =========================================================================== created on: 10/6/2016 8:06 created by: organization: filename: get-mposofflineprinters.ps1 =========================================================================== .description #> $logfile = "d:\logs\mposprinterpinglog.txt" $offlineprinters = "d:\reports\mpos\mposofflineprinters.txt" if (test-path $logfile) {remove-item $logfile} if (test-path $offlineprinters) {remove-item $of

Importing Data from Excel to Create a Powerpoint - VBA -

what trying important image, or couple, , several lines of data excel create powerpoint slide. found line of code: sub createpowerpoint() 'first declare variables using dim newpowerpoint powerpoint.application dim activeslide powerpoint.slide dim cht excel.chartobject 'look existing instance on error resume next set newpowerpoint = getobject(, "powerpoint.application") on error goto 0 'let's create new powerpoint if newpowerpoint nothing set newpowerpoint = new powerpoint.application end if 'make presentation in powerpoint if newpowerpoint.presentations.count = 0 newpowerpoint.presentations.add end if 'show powerpoint newpowerpoint.visible = true 'loop through each chart in excel worksheet , paste them powerpoint each cht in activesheet.chartobjects 'add new slide paste chart newpowerpoint.activepresentation.slides.add newpowerpoint.activepresentation.slide

oracle sql developer subquery capabilities -

Image
wondering if has experience using sql developer , has in sight whether generate subquery, without need type in through the worksheet. somthing similar how access works, great. thanks, you can this, still have type little bit though. drag table on query builder. select columns, including 1 want use in clause/subquery. optionally uncheck 'output' box in column if don't want in output. right-click in criteria panel, select 'insert subquery'. you have new panel top, click on it. drag subquery table(s) draw area. build subquery. run. i go bit more detail pictures here .

linux - Epoll: retrieve current epoll_event structure -

i want change 1 flag of epoll epoll_event data structure without changing other flags, corresponding call epoll_ctl epoll_ctl_mod . that, need retrieve value of current epoll_event given file descriptor. possible? man epoll_ctl didn't me this.

java - Hibernate HQL compare timestamp to null -

i have following hql , know how handles comparing date column null. example happens in case giventime parameter null. checked , got empty results. case? documented? select mo myclassmo mo mo.creationdate not null , mo.creationdate >= (:giventime) and if giventime replaced inner select query returns null? thanks i know asked hql handling such cases prefer using called criteria in hibernate. can mixed easy sql. jpa , hibernate - criteria vs. jpql or hql criteria criteria = session .createcriteria(myclassmo.class) .add(restrictions.isnotnull("creationdate")); if (giventime!=null){ criteria.add(restrictions.ge("creationdate", giventime));//ge - greater equals } list<myclassmo> result = criteria.list();

sql - regexp_replace instead of TRIM -

edit - complete rewrite per user comments. first post here - trying right. i looking use regex_replace instead of trim in following. select 'update '||quote_ident(c.table_name)||' set '||c.column_name||'=trim('||quote_ident(c.column_name)||') '||quote_ident(c.column_name)||' ilike ''% '' ' script ( select table_name,column_name information_schema.columns table_name 'my_%' , (data_type='text' or data_type='character varying') ) c; which generates statement: update my_table set my_field=trim(my_field); the goal generate following statement: update my_table set my_field=regexp_replace(my_field, '\s+$', ''); but attempt: select 'update '||quote_ident(c.table_name)||' set '||c.column_name||'=regexp_replace('||quote_ident(c.column_name)||', '\