Posts

Showing posts from January, 2010

html - Get the checkbox in which div was clicked using javascript? -

if have 2 div s checkboxes in each of them, how can find out checkbox in div clicked? <div id="num-1"> <input type="checkbox" name="check-1" value="check-1">checkbox "check-1" of div "num-1" <br> </div> <div id="num-2"> <input type="checkbox" name="check-1" value="check-1">checkbox "check-2" of div "num-2" <br> </div> i grateful if advise me on method uses js (not jquery) . one way use event delegation , name attribute. once target checkbox can access object including it's value, name or if it's selected or not document.queryselector('.someform').addeventlistener('click', clickhandler); function clickhandler(e) { var input = e.path.filter(function (x) {return x.type === 'checkbox'}); if(input.length) { conso

python 3.x - why do i get network is unreachable error in my smtp program? -

import smtplib fromadd = 'xyz@gmail.com' = fromadd data = 'hello' server = smtplib.smtp('www.gmail.com') server.ehlo() server.starttls() server.set_debuglevel(1) server.login(fromadd,'pwd') server.sendmail(fromadd, to, data) server.quit() in program above, got oserror: [errno 101] network unreachable error message on screen when execute it, why happen , how correct it? in program, tell connect www.gmail.com , domain not email server, , @marcelm noticed. try using gmail.com or mail.google.com .

c# - WPF : control visibility does not render in a command after the first time -

working on mvvm wpf form. i'm using relaycommand to: 1) change control visibility 2) run long process 3) update control's visibility back command code follows: private relaycommand _mycommand; public relaycommand mycommand { { return _mycommand ?? (_mycommand = new relaycommand( () => { //1 update control's visibility gridviewvisibility = false; //deleting reference done via multithreading process quite long (10 sec) task.run(() => { application.current.dispatcher.invoke((new action(() => { //2 looong process here //3 update control's visibility gridviewvisibility = true;

java - connecting to neo4j HA Cluster -

what proper way connecting neo4j ha cluster using neo4j-ogm , allowing high availability , reads scale-out? i have seen few solutions involves haproxy. the first 1 neo4j ogm-manual shows how configure haproxy transfer connections current master. solution allowing high availability, disallowing scale-out reads . the second 1 stefan armbruster blog " neo4j , haproxy: best practices , tricks " configuring haproxy routing reads operations whole cluster , write operations master server. i have few problems stefan solution: i cannot use bolt protocol, must use http driver. i'm going use transactions of queries, , i'm afraid cause issues because according neo4j developer manual: open transactions not shared among members of ha cluster. therefore, if use endpoint in ha cluster, must ensure requests given transaction sent same neo4j instance. at moment, neo4j ogm not distinguish between reads , writes , hence unable decide whether send read req

Use FFMPEG to Merge many frames into one video? -

with project working on, taking 1 video, extracting frames within middle, 00:55:00 00:57:25. after extract these images, modifying them via code , need compile these images video. finish off, merge video original video. ive pulled frames video, modified them, need merge them video. i used question check format, not getting correct output. https://superuser.com/questions/563570/use-ffmpeg-for-video-to-frames-then-frames-to-video-with-original-sound here current input ffmpeg: -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj0.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj1.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj2.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj3.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj4.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj5.bmp" -r 24.97 -i "c:\users\scott\appdata\local\temp\ios91azj6.bmp" -r

point position using Kinect V2 camera -

i knew kinect v2 camera can detect skeleton joint position, need know how can determine (x,y,z) position of point in room using kinect- v2 camera? you can take @ vitruvius libraries has thing u looking joint position , measuring distance. this gets y coordinate of left hand joint example of joint code: body.joints[jointtype.handleft].position.y this gets distance of coordinates kinect v2 sensor example of distance code: length(_bodies[_token.bodyarrindex].joints[jointtype.spinebase].position) vitruvius github link: https://github.com/lightbuzz/vitruvius vitruvius github gesture joints link: https://github.com/lightbuzz/vitruvius/tree/master/kinect%20v2/wpf/lightbuzz.vitruvius/gestures vitruvius website: https://vitruviuskinect.com/ hope helps!

Manage git repo from node.js application -

i need manage git repository node.js application. there git wrapper library or lets me call git functions high level , interpret result without having parse console output? i think looking http://www.nodegit.org/ ? npm install nodegit

c++ - shortest way to check if a positive integer is a power of two -

this question has answer here: how check if number power of 2 22 answers this question job interview... use template write c++ function checks if positive integer power of two. bool p(int n) { return ********; } you have replace 8 '*' symbols other symbols in order make function work correctly. best approach this: bool p(int n) { return !(n&=n-1); } unfortunately wrong, because there 9 symbols here... ideas? why assign n ? remove = , have 1 character less. create temporary instead, logic won't change.

c++ - What's the simpliest way to fetch HTML in a string? -

i looking simplie way fetch html body of remote web site string using default c++ libraries or winapi. there no default c++ libraries this. , i'm not familiar winapi. check out libcurl website here: http://curl.haxx.se/libcurl/ . site has listing of "competitor" libraries may of use.

android - Only get 1st element of TABLE in SQLite -

i have code: public linkedlist<product> getallproduct(string idtask){ linkedlist<product> products = new linkedlist<product>(); cursor localcursor = this.getwritabledatabase().rawquery("select * "+table_product+" "+key_id_product_task+"='"+idtask+"'", null); product product; if (localcursor.movetofirst()) { product = new product(); product.setkey_id_unique_product(localcursor.getstring(0)); product.setkey_id_product_task(localcursor.getstring(1)); product.setkey_id_product(localcursor.getstring(2)); product.setkey_name_product(localcursor.getstring(3)); product.setkey_qty_product(localcursor.getstring(4)); product.setkey_size_product(localcursor.getstring(5)); products.add(product); } while (localcursor.movetonext()); return products; } i 1 row, when particular idtasks, have 2 elemen

Xamarin.Forms Android project breaks when installing Xamarin.Forms.Maps -

i've been working on xamarin application, testing on android device windows pc. working well, came point had add maps integration app. followed steps outlined on xamarin developer website, installing xamarin.forms.maps nuget package, has caused android project refuse build. first took more hour stuck trying build, after decided cancel build, gives me error of 'resource.attribute not contain definition actionbarsize'.

enviornment of child function created by loadstring lua -

why calls f() , g() give different results? both inherit environment parent function, run, f() not change j. mystring = "print('i,j in mystring before setting', i, j);\ = 'fi'; j ='fj'\ print('i,j in mystring after setting', i,j)" j = 1 print('j initial value', j) function run(i) = 'i' print('i initial value', i) f = loadstring(mystring) if not f print('load failed') else print('=== load ok, execute') f() print('=== end of execution') end print('i,j after f()', i,j) g = function() = 'gi'; j = 'gj' end g() print('i,j after g()', i,j) end run(i) results: j initial value 1 initial value === load ok, execute i,j in mystring before setting nil 1 i,j in mystring after setting fi fj === end of execution i,j after f() fj i,j after g() gi gj n

wifi - VM has no Internet access -

i using windows 8.1 in laptop , have created windows server 2012 r2 virtual machine using hyper-v. i have tried give vm internet access. followed this thread, vm still has no internet access. i can see wi-fi bridged , vm got ip-address, , both laptop , vm has same default gateway. this doesn't sound issue hyperv setup. instead sounds aren't aware of enhanced security configuration placed on internet explorer default in server os. check out following blog post on how remove them. https://blogs.technet.microsoft.com/chenley/2011/03/10/how-to-turn-off-internet-explorer-enhanced-security-configuration/

Converting Curl to vb.net -

im trying convert curl vb.net code. access gumroad license api. appreciated. curl https://api.gumroad.com/v2/licenses/verify \ -d "product_permalink=qmgy" \ -d "license_key=your_customers_license_key" \ -x post response { "success": true, "uses": 3, "purchase": { "id": "omyg5dpledsbykghsneudq==", "product_name": "licenses demo product", "created_at": "2014-04-05t00:21:56z", "full_name": "maxwell elliott", "variants": "", "refunded": false, # purchase refunded, non-subscription product "chargebacked": false, # purchase refunded, non-subscription product "subscription_cancelled_at": null, # subscription cancelled, subscription product "subscription_failed_at": null, # unable charge subscriber's card "custom

tfs - Are the controls needed to create Team Explorer extensions available via NuGet? -

Image
as of vs 2015 sdk, seem have switched nuget source of sdk reference assemblies, in order make extension solutions more portable (i.e. developers don't need whole sdk installed work on extensions). however, i'm attempting build team explorer extension, which, according only tutorial find on subject , requires objects microsoft.teamfoundation.controls assembly. there version of available nuget, can continue avoid referencing reference assemblies directly? yes, there one. need run command: install-package microsoft.teamfoundation.referenceassemblies . check this . you can install via package manager, see: however, checked, there 12.0 version, no 14.0 version available.

Why does this Rascal pattern matching code use so much memory and time? -

i'm trying write think of extremely simple piece of code in rascal: testing if list contains list b. starting out basic code create list of strings public list[str] makestringlist(int start, int end) { return [ "some string number <i>" | <- [start..end]]; } public list[str] totest = makestringlist(0, 200000); my first try 'inspired' sorting example in tutor: public void findclone(list[str] in, str s1, str s2, str s3, str s4, str s5, str s6) { switch(in) { case [*str head, str i1, str i2, str i3, str i4, str i5, str i6, *str tail]: { if(s1 == i1 && s2 == i2 && s3 == i3 && s4 == i4 && s5 == i5 && s6 == i6) { println("found duplicate\n\t<i1>\n\t<i2>\n\t<i3>\n\t<i4>\n\t<i5>\n\t<i6>"); } fail; } default: return; } } not pretty, e

html - Need help on navigation sidebar and content CSS -

Image
ok on webpage, have left navigation, position if fixed , when want add content on index page, content appears behind navigation , not start after it. if remove fixed position goes underneath. navigation css #nav { height: 100%; width: 18%; background-color: #1c1c1c; position: fixed; } i tried putting content inside div no luck. content div #padding { height: auto; position: absolute; right: 0; screenshots just put content inside div: <div id="container"> <div id="nav"> <!-- navbar markup --> </div> <div id="content"> <!-- content --> </div> </div> with css can style elements: #container { width: 100%; } #nav { height: 100%; width: 18%; background-color: #1c1c1c; float: left; } #content { width: 82%; float: left; } with float: left 2 divs appears aside. note: if don't want put content in

c# - How to serialize JSON that uses keywords for names? -

i need make json string using json.net: { "description": "the description", "public": true, "files": { "index.html": { "content": "some value" } } } so how can that? i tried creating class it, don't know how create field name "public" because public c# keyword. the property name want, if want value map it, need add jsonproperty attribute indicating name of property. public class myobject { public string description { get; set; } [jsonproperty("public")] public bool ispublic { get; set; } public dictionary<string, jobject> files { get; set; } }

elasticsearch - How to get the oldest entry by <field> -

for events below: { "time": 10, "name": "john", "status": true }, { "time": 20, "name": "john", "status": false }, { "time": 20, "name": "mary", "status": false }, { "time": 10, "name": "mary", "status": true } what correct way of searching oldest ones (field time (1) ) given name ? for example above, means { "time": 20, "name": "john", "status": false }, { "time": 20, "name": "mary", "status": false }, i tried use order in aggregations that, along lines of { "query": { "match_all": { } }, "aggs": { "shortlist": { "terms": { "field": "name", "size&

input - How can I improve this Swift readLine code? -

it works, don't think enough. possible use readline() outside if-let construct??? find scope limiting , not believe can pass arguments using command line using method. can suggest better approach issue? import foundation print("\ntemperature conversion\n") print("what current temperature unit?\n ") print("valid options f or f fahrenheit, c or c celsius: \n") if var temp = readline() { switch temp{ case "c","c": print("and temperature: ") if var degrees = readline() { var fahr = (5 * float(degrees)! * 1.8 + 32) print("\(degrees) degrees equal \(fahr) degrees fahrenheit. \n") } else { print("you entered invalid temperature") } case "f","f": print("fahrenheit") if var degrees = readline() {

Creating elements in Aurelia -

i'm trying create aurelia element inside of element. i'm using docking framework phosphor , when dynamically create panel want add component i've build using aurelia. for example: have simple logging component: logging.html <template> <h1>logging....</h1> </template> logging.ts: export class logging { constructor() { console.log('logging constructor') } } the component works expected when "just put on page". now inside of method creates phosphor widget have this: var widget = new widget(); widget.title = "got logs?"; var contentelement = document.createelement('logging'); widget.node.appendchild(contentelement); panel.insertbottom(widget); this code, given phosphor panel, creates widget, creates element looks like: <logging></logging> , appends widget's inner node. resulting "dom" correct aurelia not render element. i have tried using templatin

performance - Am I using Julia right? -

i started using julia couple of months ago, deciding give try after weeks of hearing people praise various features of it. more learned it, more liked style, merging ease of expressing concepts in high-level language focus on speed , usability. implemented model i'd written in c++ , r in julia, , found julia version ran faster r version, still slower c++. code more legible in julia in both other languages. worth lot, , in particular i've generalized model, amount of work broaden scope of julia code far less comparable amount of worked threatened in other languages. lately, have been focused on getting julia code run faster, because need run model trillions of times. in doing i've been guided @code_warntype , @time , @profile , profileview , track-allocation flag. great. toolkit isn't nice other languages' profiling tooling, still pointed out lot of bottlenecks. what find have in code precisely high-level expressivity in julia, , when rewrite expressivity

javascript - code inside ref once not executing angularjs -

code inside this.verifyusertoken block of not execute . guess has asynchronous calls being data returned not ready seem not know how go it. this.verifyusertoken = function(){ //check if token matches existing token , if verified true ref.orderbychild('token').equalto(this.token).once('value'). then(function(datasnapshot){ //if token matches if(datasnapshot.val()){ alert("token exists",datasnapshot.val().token); $scope.isverified = "yes"; }else{ alert("token not exist",datasnapshot.val()); $scope.isverified = "no"; } }); } this.registeruser = function(){ console.log("entered registeruser()"); this.verifyusertoken(); alert("the value of isverified:&qu

javascript - Function if checkbox checked and a different function if not checked? -

my mesh update position if radio button id m1 checked. i tried reach mesh going it's original position if "#m1" not checked more. do have fire function if checked , different function if not checked? <input id="m1" type="radio" name="radio" value=""> <input id="mx" type="radio" name="radio" value=""> var geometry = new three.boxgeometry( 1, 0.05, 1 ); var mesh = new three.mesh( geometry); mesh.position.set( 0, 0.012, 0 ); mesh.scale.set( 1, 1, 2 ); mesh.add( plane ); $('#m1').change(function() { if(this.checked) { var tween = new tween.tween(mesh.position).to({ x: 0, y: 0.112, z:0 }, 2000).start(); tween.easing(tween.easing.cubic.in); tween.yoyo(true); } }); jquery $('#m1').on("change", function() { if($(this).prop("checked") == true) { var tween = new tween.tween(mesh.position).to({ x: 0, y:

jquery - Display Date with time in JTable -

i'm using jtable(for first time) in mvc application , want display datetime column need display date , time. able display date. here how column looks in jtable definition. assigneddate: { title: 'assigned date', width: '15%', type: 'date', displayformat: 'mm/dd/yy', create: false, edit: false }, how display time? know need change type , displayformat - have no idea change to. the following options: try setting displayformat: 'dd/mm/yy hh:mm:ss' have doubts if works because when read jtable documentation mentioning having no time field. never mind give shot. straightforward (but not best) way in case showing date , no editing required convert date string @ server side , show in column type: 'text'

Mysql Column 'nume' in field list is ambiguous error -

select nume "nume", adresa "adresa",localitate "localitatea" info left join angajati on id_i = id_a localitate "orhei" , year(curdate()) - year(data_nast) >=50 i have 2 tables nume field , i'm getting error, please don't why code didn't work !!! since joining on id_i , id_a columns, 2 nume columns distinct in joined result. specify table's nume column mean: select info.nume "nume" ... or select angajati.nume "nume" ...

node.js - sails.js/waterline validation error handlig -

i'm quite confused on how should manage error validations waterline, need clarification on practices. have chains of promises this: sails.models.user.findone(...) .then(function(){ //... //... return sails.models.user.update(...); }) .then(....) .then(....) .catch(function(err){ }) one problem arises when waterline returns validation error. in case, need know when problem generated wrong input client, or bug in code. what wrap waterline promise in promise handle validation error properly. final code be: ... .then(function(){ //... //... return new promise(function(resolve,reject){ sails.models.user.update(...) .then(resolve) .catch(function(err){ //the error bug, return error object inside waterline wlerror reject(err._e); //the error caused wrong input, return waterline wlerror reject(err); }) }) }) .then(function(){

python - Finding average word length in a string -

def word_count (x: str) -> str: characters = len(x) word = len(x.split()) average = sum(len(x) x in word)/len(word) print('characters: ' + str(char) + '\n' + 'words: ' + str(word) + '\n' + 'avg word length: ' + str(avg) + '\n') this code works fine normal strings, string like: '***the ?! quick brown cat: leaps on sad boy.' how edit code figures "***" , "?!" aren't accounted in code? average word count of sentence above should turn out 3.888889, code giving me number. try this: import re def avrg_count(x): total_chars = len(re.sub(r'[^a-za-z0-9]', '', x)) num_words = len(re.sub(r'[^a-za-z0-9 ]', '', x).split()) print "characters:{0}\nwords:{1}\naverage word length: {2}".format(total_chars, num_words, total_chars/float(num_words)) phrase = '***the ?! quick brown cat: leaps on sad boy.' avrg_count(phrase

F# PostgreSQL connection with SQLprovider failing without error in project but intellisense indicates code is fine and works in interactive -

i connecting local postgresql db using sqlprovider in f#. code works in interactive , intellisense detecting tables in database fine, compiled project breaks when runs sql.getdatacontext() line without error. find strange exact same code runs in interactive, connection must working intellisense on "ctx" below picking tables, , cannot see wrong. new f# , databases , can't see why not work, ideas appreciated! type sql = sqldataprovider<databasevendor=common.databaseprovidertypes.postgresql,connectionstring="server=localhost;database=db1;user id=postgres;password=pw1",resolutionpath=@"path npgsql.dll"> type saver(datatype:string, handle:string) = member __.datatype = datatype member __.handle = handle member __.save() = let ctx = sql.getdatacontext() /// rest of code, not causing issues

ios - Opening and closing time to store app -

i working on objective c store app. not want people buying things in different times each day of week. need thing like,"mon- thu: 11:00 - 11:00 pm fri - sat: 11:00 - 12:00 sun: 11:00 - 10:00 pm". when push uibutton not let buys go past , message "we closed" or "come later". if 1 great. you can current time creating new nsdate object [nsdate date] method. if want know particular information date, recommend using nscalendar 's components:fromdate: method information time. can perform comparison using nsdatecomponent s method. more information here on nshipster

java - Why static variable not behaving the way it should be during finally -

this question has answer here: try , execution flow when return in try block 4 answers as far know, in case of static variables if value changed in 1 place reflected in places. example static int i=0; public static void test1() { system.out.println(i); i=100; } public static int test2() { return i; } sysout of test1()--0 sysyout of test2()=100; again sysout of test1()=0 i clear on point. but not clear on below code public static int test() { try { = 2; system.out.println("before "+i); return i; } { = 12; system.out.println("in finally"); } } then why print 2 though value of static changed 12; below sequence of method calls; test1(); system.out.println(test2()); test1(); system.out.println(test()); outputs 0 100 100 before 2

Edit xml declaration encoding with java -

i editing xml-file original encoding ascii in declaration. in resulting file want encoding utf-8 in order write swedish characters åäö, can't @ moment. an example file equivalent file can found @ archivematica wiki . the resulting sip.xml after running program copy of above example file can reached @ this link . added tag åäö text in end of document. as seen in code below have tried setting encoding on transformer, , tried use outputstreamwriter set encoding. in end edited declaration in original file utf-8 , åäö written out. problem seems encoding of original file. if i'm not mistaken shouldn't cause problem change declaration ascii utf-8, question is, how do within program? can after parsing document object, or need before parsing? package provklasser; import java.io.file; import java.io.ioexception; import java.util.logging.level; import java.util.logging.logger; import javax.swing.joptionpane; import javax.xml.parsers.documentbuilder; import javax.xml.parse

vb.net - Why is this IsNum function wrong? -

private function isnum(textbox textbox, name string) boolean if isnumeric(textbox) = false messagebox.show(name & " not number.", "entry error") textbox.select() return false else return true end if end function after writing function, apparently wrote in way if make number doesn't think it's number. there better way write it's not confusing , incorrect? you need check text inside textbox. not textbox itself. do instead.. if isnumeric(textbox.text) = false

python - Send commands to subprocess.Popen() process -

i need pass commands process on subprocess.popen() when do, works if use stdin.close() afterwards. code below. sprocess.stdin.write('/stop'.encode()) sprocess.stdin.flush() sprocess.stdin.close() sprocess.stdout.close() works, because of stdin.close() , need able without closing pipes. how can pass commands process without closing pipes after? #!/usr/bin/python3 import discord import asyncio subprocess import popen, pipe client = discord.client() @client.event async def on_ready(): print('bot id: '+ client.user.id +'\nready\n') @client.event async def on_message(message): if message.content.startswith('/start'): if message.channel.name == "server-console": await client.send_message(message.channel, '**server starting**') print('server starting') global sprocess global soutput sprocess = popen('java -xmx2048m -xms2048m -jar minecraf

graphics - Drawing a graph using dnorm and polygon function in R -

Image
i have found probability using.. pnorm(176, 135, 10, lower.tail=true) - pnorm(146, 135, 10, lower.tail=true) which resulted in 0.1356, 14%. i have use dnorm , polygon function create graph shows shaded area (based on percentage above) in normal distribution. anyone got idea how so? something this: library(ggplot2) x=seq(80,190,1) dat = data.frame(x, dens=dnorm(x,135,10)) ggplot(dat, aes(x,dens)) + geom_line() + geom_area(data=dat[dat$x >= 146 & dat$x <= 176,], fill="red")

c++ - mpi MPI_Send() works for small data set but not large data set -

i learned mpi_send cannot send long data @ time, decided divide data pieces , send them in loop. below test case. problem here if use small amount of data , divide pieces, program run; however, when data long, no matter how many pieces divide into, program won't run. when run it, heard computer makes big noise. wonder cause , how can make mpi_send send large data set other processors. thank you! #include<iostream> #include<mpi.h> #include<vector> using namespace std; //this set of n , n+parts won't work #define n 1024*1024*5 #define n_parts 1000 //this works #define n 1024*5 #define n_parts 10 #define master 0 int main(int argc, char** argv) { int np, pid; vector<int> arr; for(int i=0; i<n; ++i) arr.push_back(i); int length = n/n_parts; int n_res = n%n_parts; // cout << length << endl; // cout <&

objective c - how to get INFOPLIST_FILE name iOS -

Image
each target in project has has different info.plist. want name programmatically buildsettings> packaging> info.plist file somehow cant retrieve plist list filename. there way can retrieve plist programmatically? nsbundle.mainbundle().objectforinfodictionarykey("cfbundleinfoplisturl") only gives me info.plist -- file:///users/xxxx/library/developer/coresimulator/devices/xxxxxx-9b37-4c3d-88e9-xxxxx62b470/data/containers/bundle/application/7xxxxxxxb-be36-4d3e-9c90-xxxxx/project%20kol.app/ actually nsbundle.mainbundle().objectforinfodictionarykey("cfbundleinfoplisturl") returns nsurl object. extract absolutestring give name of plist file. check code below. sorry giving answer in objective-c don't know swift nsdictionary *infodict = [nsbundle mainbundle].infodictionary; nsstring *plistfilepath = [[infodict objectforkey:@"cfbundleinfoplisturl"] absolutestring]; nsstring *plistfilename = [[plistfilepath componentsseparatedbystri

php - HTML Form send to different address based on text response -

i have form on site coupon codes using paypal. how can make when enter coupon code, brings them different part of site? i.e. enter '10offbook', hit submit brings u books.php if enter '10offmagazine, hit submit brings magazine.php <form action="index.php" method="post"> <input type="text" name="couponcode" placeholder="coupon code"> <input type="submit" name="submitcouponcode" value="apply coupon"> </form> on index.php, @ top, check value of coupon code entered, redirect different pages depending on value of coupon code. if (isset($_post['submitcouponcode'])) { $coupon = $_post['couponcode']; if ($coupon == '10offbook') { header('location: books.php'); exit; } else if ($coupon == '10offmagazine') { header('location: magazine.php'); exit; } }

How to register sequential point clouds gathered from a walk down a hallway -

for our university project captured .oni video while walking down hallway. converted each frame of .oni video .pcd file. think best way stitch these cloud files recreate single point cloud representing entire captured hallway. i'm not sure if iterative closest point or feature based registration fit better. recommendations appreciated! sounds job pcl registration api. example take @ "how incrementally register pairs of clouds" tutorial . uses icp. also take @ other registration related tutorials .

math - Is there any constant time spatial indexing of points on the surface of a sphere with balanced partitioning? -

Image
a simple way index points in sphere use polar coordinates. is, find index of point, convert polar coordinates , apply formula polar_ang * width + azimuthal_ang . problem strategy isn't evenly spaced - indices near center of sphere have bigger areas near top. is there alternative indexing strategy equally simple better partitioning properties? use subdivided icosahedron. there 12 vertices , 20 triangular faces. each of these faces can subdivided grids of smaller triangles arbitrarily small size. not subdivided triangles have equal area, range of possible areas bounded.

sql server - MS SQL - Where are the syntax and scalar errors? -

i've been beating head on brick wall morning. simplified example of error(s) i've been receiving. using ssms. declare @myid nvarchar(10) = '5' declare @sql nvarchar(2048) = 'select id applications a.id=@myid' execute sp_executesql @sql, @myid=@myid errors: msg 102, level 15, state 1, line 1 incorrect syntax near '5'. msg 137, level 15, state 2, line 1 must declare scalar variable "@myid". why getting syntax, , scalar errors? @myid defined, right? sp_executesql needs receive definition of parameters, missing. so, in case, should use: declare @myid nvarchar(10) = '5'; declare @sql nvarchar(2048) = 'select id applications a.id=@myid'; execute sp_executesql @sql, n'@myid nvarchar(10)', @myid=@myid;

mongodb - How to run a .group() with Java -

i have query in mongodb , produces result want. i'm trying use in java. this query in mongodb: var red = function(doc, out) { out.count_order++; out.sum_qty += doc.quantity; out.sum_base_price += doc.extendedprice; out.sum_disc_price += doc.extendedprice * (1 - doc.discount); out.sum_charge += doc.extendedprice * (1 - doc.discount) * (1 + doc.tax); out.avg_disc += doc.discount; }; var avg = function(out) { out.avg_qty = out.sum_qty / out.count_order; out.avg_price = out.sum_base_price / out.count_order; out.avg_disc = out.avg_disc / out.count_order; }; db.lineitems.group( { key : { returnflag : true, linestatus : true}, cond : { "shipdate" : {$lte: 19980801}}, initial: { count_order : 0, sum_qty : 0, sum_base_price : 0, sum_disc_price : 0, sum_charge : 0, avg_disc : 0}, reduce : red, finalize : avg }); and way i'm using in java don't know how use avg function. string avg = "var avg = function(out) {" + "out.avg_qty = o

MySQL - Loop while -

i´ve been asked create report shows how many employees working in different departments during last trailing 12 months (mm-yyyy). i need print out every single month every combination of department, role_name , employee_code. i want print out results this: (assuming employee 234 joined company on sept 15 jr consultant in bsg department, promoted consultant in jan 16 , changed department in apr 16) date department role_name employee_code jun 16 cin consultant 234 mai 16 cin consultant 234 apr 16 cin consultant 234 mrz 16 bsg consultant 234 feb 16 bsg consultant 234 jan 16 bsg consultant 234 dez 15 bsg jr consultant 234 nov 15 bsg jr consultant 234 okt 15 bsg jr consultant 234 sep 15 bsg jr consultant 234 attached code. drop procedure if exists whileloop; procedure whileloop() begin declare date.date char; whileloop : loop if (date.date < date_format(prs.rpr_end_dt,

algorithm - How can I find the intersection of 2 sets of noisy data? -

i'm writing script supposed remove redundant data points graph. data includes overlaps adjacent data sets , want data higher. (imagine 2 gaussians x offset overlap slightly. i'm interested in higher values in overlap region, final graph doesn't noisy when combine data in order make single spectrum.) here problems: 1) x values aren't same between 2 data sets, can't "at x, take max y value". they're close together, not equal. 2) distances between x values aren't equal. 3) data noisy, there can multiple points data sets intersect. , while gaussian higher after intersection gaussian b, noise means gaussian b might still have values higher. meaning can't "always take highest values in x area", because i'd wildly combine noise of both data sets. 4) have n overlaps of type, need efficient algorithm , can come somewhere @ o(n^3), "for each overlap, store data sets 2 arrays , each combination of data points (x0,y0) , (x1

java - Upload encrypted Word document to Google Cloud storage -

i have created java desktop application stores encrypted files on desktop. have been tasked uploading word document encrypted application store on google cloud storage (free personal google cloud storage account). is possible, jar files needed , coding connect google cloud storage achieve this? or there better way of going doing this? you need store blob in google cloudstorage, can view configuration here: https://cloud.google.com/appengine/docs/java/blobstore/ for pourpouse , if have control on google account configuration, can upload documents drive account of app using drive api app engine, conmmunication it´s encripted it´s easier implement. problem have use allowed authentication oauth2

how to make two build triggers to work one after the other -

i have job , job b. job b triggered job a. not want job b start if there no code change in job b. use "poll scm" build trigger. how can make work? refrased question: job must trigger job b, job b must run when there scm changes job b. how configure this? so, job , job b have different code bases, somehow related , thus, dependency between jobs exists. downstream-ext plugin can this: supports "extended configuration triggering downstream builds: trigger build if downstream job has scm changes".

configuration - Typesafe config secure rendeing -

i have following code log(config.render()) however if have passwords in config they'll appear in log. there easy way eliminate this? looking that log(config.map { if ("password" in it.key.tolowercase()) "***" else it.value } .render()) for clear solution this val contenthiddenvalue = configvaluefactory.fromanyref("***", "content hidden") log.info(config.root() .withoutkey("security") .withvalue("security", contenthiddenvalue) .render()) the obvious disadvantage hides exact config subtree

c++ - Why compilers put zeros into arrays while they do not have to? -

i'm trying understand when compilers should value initialize arrays , when should default initialize it. i'm trying 2 options: 1 raw array, array aggregated in struct: const int n = 1000; struct { uint32_t arr[n]; a() = default; }; void print(uint32_t* arr, const std::string& message) { std::cout << message << ": " << (std::count(arr, arr + n, 0) == n ? "all zeros" : "garbage") << std::endl; } int main() { uint32_t arrdefault[n]; print(arrdefault, "automatic array, default initialization"); uint32_t arrvalue[n] = {}; print(arrvalue, "automatic array, value initialization"); uint32_t* parrdefault = new uint32_t[n]; print(parrdefault, " dynamic array, default initialization"); uint32_t* parrvalue = new uint32_t[n](); print(parrvalue, " dynamic array, value initialization"); structdefault; print(structdefault.arr, "automatic

authentication - Laravel 5 User Permissions -

i new laravel (5.2) , followed great series https://www.youtube.com/watch?v=zxmf0n2sc1i&index=34&list=plwakr305cro-q90j---jxvzbod4cdrbvx can point me right direction how setup authentication registered users can edit / delete own posts. e.g: logged in user "a" not allowed edit posts user b. thanks helping me out. you can use apiguard. see more: https://github.com/chrisbjr/api-guard

c++ - error C4146: unary minus operator applied to unsigned type, result still unsigned -

i try build crf++ in visual studio 2013 , error in last line: array_[begin + siblings[i].code].base = value_ ? static_cast<array_type_>(-value_[siblings[i].left]-1) : static_cast<array_type_>(-siblings[i].left-1); error c4146: unary minus operator applied unsigned type, result still unsigned specifically, in darts.h, line 189. i built again in visual studio 2015 there no error. how can fix in visual studio 2013? try this: int tmp = static_cast<int>(siblings[i].left); array_[begin + siblings[i].code].base = value_ ? static_cast<array_type_>(-value_[siblings[i].left]-1) : static_cast<array_type_>(-tmp - 1);

javascript - Lodash: Array without last element, no mutation -

i'm looking way retrieve array without last element, , without being mutated. _.remove mutate array , searches value not index (even if asked there ) _.without searches value, not index i have _.filter(array, function(el, i) { return != array.length -1}); siouf, not explicit , needs array stored somewhere. thanks i looking "butlast", found initial , job: var xs = [1, 2, 3, 4]; var xs2 = _.initial(xs); console.log(xs, xs2); // [1, 2, 3, 4] [1, 2, 3]

angularjs - Update current model value while using bindings -

new angular, hope asking question correctly. (angular 1.5 , using components) parent.html: <names on-refresh-names='$ctrl.reloadnames'></names> parent.js this.reloadnames = function() { ... } names.html <input ng-model="searchnamevalue"> <button ng-click='$ctrl.onrefreshnames()'></button> names.js ... component.bindings = { onrefreshnames: '&' } i want make input search string cleared ( searchnamevalue = ''; ) when onrefreshnames executed. executed in parent , searchnamevalue in child. how can that? you can combine statements 1 expression: <button ng-click="$ctrl.onrefreshnames(); searchnamevalue = '';"></button> but in case makes sense move them both function in component controller: <input ng-model="$ctrl.searchnamevalue"> <button ng-click="$ctrl.onrefresh()"></button> where in controller this.on

Using "NOT" in a jquery nth-child formula -

Image
i'd remove 3rd, 4th, 6th, 7th, 9th, etc th . thought like: summaryhead.find('tr:first th:nth-child(!3n+2)').remove; however doesn't work. tried summaryhead.find('tr:first th:nth-child(3n+3)').remove(); summaryhead.find('tr:first th:nth-child(3n+4)').remove(); this behaves rather weirdly. there way combine 2 finds? for clarity want remove of green , red fields in image, there might more or less rooms, each room have 3 fields, , want give first room's field colspan 3 , hide 2 fields (colored red & green here): i'm not sure if there nicer way can this summaryhead.find('tr:first th').filter(':nth-child(3n+3), :nth-child(3n+4)').remove();

java - TextToSpeech setLanguage not working? -

i setting texttospeech use particular language (english - uk), using locale "en_gb". uses devices default language. there no way set programmatically? have downloaded files required language , when change tts's default language 'english - uk' works when default different programmatic approach not work. have scoured web best unable resolve issue. string ttsengine = "com.google.android.tts"; txt2speech = new texttospeech(this, this, ttsengine); //locale ttslocale = new locale("eng", "gbr"); txt2speech.setlanguage(new locale("en_gb")); tried several methods, none working. can not set tts's language programmatically? thank you edit: in response 'a honey bustard' other code: public class mainactivity extends appcompatactivity implements texttospeech.oninitlistener my oninit() public void oninit(int status) { // todo auto-generated method stub } also i'm calling .setlangu

Why are views not counted if you embed a youtube iframe dynamically using jquery? -

in 1 of sites have thousands of visitors daily after 1 year, view count main video on start page still @ 26 views. i wanted save load times, that's why providing image play icon on page. icon gets clicked, load youtube iframe via: $('#introimg').click( function() { $(this).replacewith('<iframe width="759" height="426" src="https://www.youtube.com/embed/fdub8mivquk?wmode=transparent&amp;rel=0&amp;showinfo=1&amp;iv_load_policy=1&amp;modestbranding=1&amp;controls=2&amp;vq=large&amp;autoplay=1" allowfullscreen></iframe>'); }); i found one note here says: views originate result of clicking on 1 of native player ui elements (either play button in control bar or on static player image) count towards incrementing views video. is reason? because embed iframe autoplay true, there no click event. would workaround replacewidth , trigger('click')? (which not work

Java Generics Clarification( Constraining T to a type, while using Comparable) -

if create class , class intended accept specific type of data. proceed use generics , in class proceed have type constrained upper bound of number class. so class can use types of number class or subclasses of number (integer, double, long, etc). lets have array of these types , wish compare values in array. class contains array of these allowed data types, , wish compare these types only. we can using comparable interface contains compareto method. can use compareto method classes implement comparable interface. number 1 of classes implement interface. so if have class header specifies following: public class somename<t extends number> { this implies constraint of type t accept types of number or subclasses of number. if wanted use compareto method comparable interface, numbers class implements, t constrained to. if have method such as public t somename(t[] somevariable) { why can't method use compareto method?t constrainted number class, implements co