Posts

Showing posts from February, 2010

bash - TCropping images with loop in imagemagick -

a pretty basic question i'm new imagemagick (and bash) , i'm having trouble batch cropping images in folder. i've tried using loop: for image in '/home/donald/desktop/new folder'*.jpg; convert "$image" -gravity center -crop 95x95% "${image%.jpg}"-modified.jpg done but returns: convert.im6: unable open image `/home/donald/desktop/new folder/*.jpg': no such file or directory @ error/blob.c/openblob/2638. convert.im6: no images defined `/home/donald/desktop/new folder/*-modified.jpg' @ error/convert.c/convertimagecommand/3044." what proper way of doing this? edit: apparently space in folder name causing problems deleted , things seem working.apparently if want use folder space name in bash need escape space. i believe have no jpg files in /home/donald/desktop/new folder/ directory. shell interpret literal string /home/donald/desktop/new folder/*.jpg if there no files matching wildcard-ed string. see ...

ios - Passing an image from iPhone to Apple Watch not working -

most tutorials on passing image talk existing images. attempting generate images @ runtime on iphone , pass apple watch. i using mmwormhole referenced so question didn't images through. i've tried using + openparentapplication on wkinterfacecontroller directly. error: property list invalid format: 200 (property lists cannot contain null) i , see uiimage cannot serialized. try convert uiimage > nsdata > nsstring , send - (void)awakewithcontext:(id)context { [super awakewithcontext:context]; self.timer = [nstimer scheduledtimerwithtimeinterval:0.1 target:self selector:@selector(loop) userinfo:nil repeats:true]; }; - (void)loop { [wkinterfacecontroller openparentapplication:nil reply:^(nsdictionary *replyinfo, nserror *error) { nsdata *m = replyinfo[@"image"]; uiimage *img = [uiimage imagewithdata:m]; [self.image setimage:img]; }]; // [self.wormhole passmessageobject:@"hello" identifier:@...

matlab - how to rearrange each block into a column vector? -

this question has answer here: efficient implementation of `im2col` , `col2im` 2 answers example: have image,it's size 512x512pixel,then have splited 8x8 blocks.now have 64x64 blocks.now how rearrange each block 8x8 column vector dimension 64x4096pixel without inbuilt function "im2col".please me out. thanks. x=rand(512,512); xi=mat2cell(x,8*ones(1,64),8*ones(1,64)); xii=cellfun(@(x)reshape(x,1,64),xi,'uniformoutput',false); y=cell2mat(xii);

c# - How do I perform a LINQ query to a database? -

through method onnavigatedto () page int , make linq query list, taking items database in localstorage. protected override async void onnavigatedto(navigationeventargs e) { sqliteasyncconnection mussall = new sqliteasyncconnection("databasemusei.db"); var queryall = await mussall.table<musei>().tolistasync(); list<musei> museiall = new list<musei>(); foreach(musei mus in queryall) { museiall.add(mus); } idmusei = (int)e.parameter; musei muss; muss = museiall.where(x => x.id == idmusei).firstordefault(); //my code } but start reading read properties in created object, exception: message = "object reference not set instance of object." if on page directly object museums , do: mus = (museei) e.parameters; program works. problem?

angularjs - How to get directive to apply focus to its wrapped input? -

i've built attribute directive ( focus-on-event ) watches event on $rootscope , when it's triggered sets focus onto attached element. the problem when want add directive custom directive wrapping input ( wrapped-input ). need go element , apply focus input. i tried binding focus event of wrapped-input , never seems triggered. tried broadcasting event doesn't seem work. if can make either approach work, can put focus on wrapped input element right wrapped-input 's link function. how can make work? angular .module('app', []) .directive('wrappedinput', function() { return { template: '<input placeholder="wrapped input">', link: function(scope, element, attrs) { scope.$on('hello', function() { alert('this never gets called'); }); element.bind('focus', function() { alert('this never gets called either'); ...

python - matplotlib discrete data versus continuous function -

i need plot ratio between function introduced thorough discrete data set, imported text file, example: x,y,z=np.loadtxt('example.txt',usecols=(0,1,2),unpack=true) , and continuous function defined using np.arange command, example: w=np.arange(0,0.5,0.01) exfunct=w**4 . clearly, solutions as plt.plot(w,1-(x/w),'k--',color='blue',lw=2) well plt.plot(y,1-(x/w),'k--',color='blue',lw=2) do not work. despite having looked answer in site (and outside it), can not find solution problem. should fit discrete data set, obtain continuous function, , define in same interval "exfunct"? suggestion? thank lot. at end solution has been easier thought. had define continuous variable through discrete data, as, example: w=x/y , then define function said: exfunct=w**4 and plot "continuous-discrete" function: plt.plot(x,x/exfunct),'k-',color='red',lw=2) i hope can useful.

java - NoSuchMethodError when hive.execution.engine value its tez -

i using hive 1.0.0 , apache tez 0.4.1 when configure hive use tez exception. in hive-site.xml when hive.execution.engine value mr works fine. if set tez error: exception in thread "main" java.lang.nosuchmethoderror: org.apache.tez.mapreduce.hadoop.mrhelpers.updateenvbasedonmramenv(lorg/apache/hadoop/conf/configuration;ljava/util/map;)v @ org.apache.hadoop.hive.ql.exec.tez.tezsessionstate.open(tezsessionstate.java:169) @ org.apache.hadoop.hive.ql.exec.tez.tezsessionstate.open(tezsessionstate.java:122) @ org.apache.hadoop.hive.ql.session.sessionstate.start(sessionstate.java:454) @ org.apache.hadoop.hive.cli.clidriver.run(clidriver.java:626) @ org.apache.hadoop.hive.cli.clidriver.main(clidriver.java:570) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ...

c++ - QTreeWidget - disable dropping on top level -

i have qtreewidget , enabled drag , drop. despite users able drag , drop items inside tree don't want them drop dragged item on top level. how can ? let's have predefined categories top level items , don't want extend list. in lower levels user can create number of items , she/he can move items around. thanks help. worked. mytreewidget::mytreewidget( qwidget* aparent /*= nullptr*/ ) : qtreewidget( aparent ) { // ... auto rooitem = invisiblerootitem(); rooitem->setflags( rooitem->flags() ^ qt::itemisdropenabled ); }

html - Full width horizontal navigation and Foundation framework -

i trying make horizontal navigation using css tables. when use plain html , css works correctly doesn't when foundation css included. left aligned , not full width. doing wrong? thank much. plain code - http://codepen.io/anon/pen/yngxpo foundation css included - http://codepen.io/anon/pen/jdejom html <div class="row contain-to-grid"> <nav class="top-bar" data-topbar role="navigation"> <section class="top-bar-section"> <ul> <li><a href="#">asdf</a></li> <li><a href="#">asdasdasdasdasd asdasd</a></li> <li><a href="#">qweqweqwe</a></li> <li><a href="#">qwe</a></li> <li><a href="#">qwe</a>...

go - Golang, csv.writer.write 20k rows into CSV freeze my PC -

i have issue on linux ubuntu 1.4.2, not sure how sort: func main() { dir, _ := filepath.abs(filepath.dir(os.args[0])) outputfile, outputerror := os.openfile(dir+"/out1.csv", os.o_wronly|os.o_create, 0666) if outputerror != nil { fmt.printf("an error occurred file creation\n") return } defer outputfile.close() writer := csv.newwriter(outputfile) results := getresults() _, result := range results { writer.write([]string{result.item, result.price, result.shipping}) } writer.flush() } when results 1000+ records pc freezes seconds , when it's 20k, freezes minutes. how solve such issue in proper way? though flush every n records, , add time.sleep – looks awkward…

Display 2D array using pointers and function in c -

this question has answer here: how pass 2d array through pointer in c [duplicate] 2 answers respected members of stackoverflow, complete armature c program,i want access element of matrix using pointers.like want print elements of matrix using point.i have attached code along incorrect output.please me .thank you ` #include<stdio.h> #include<conio.h> void print(int **arr, int m, int n) { int i, j; (i = 0; < m; i++) { (j = 0; j < n; j++) { printf("%d ",*(arr+i*n+j)); //print elements of matrix //printf("%d ", *((arr+i*n) + j)); } printf("\n"); } } int main() { int arr[20][20],m,n,c,d; clrscr(); printf("row=\n"); scanf("%d",&m); printf("col=\n"); scanf("%d",&n)...

jasmine - angularjs loadModules "should have a dummy test" -

running karma unit tests project yields: browser (os) xyz section should have dummy test xyz failed minerr/<@../angular.js:63:12 loadmodules/<@../angular.js:4141:15 foreach@../angular.js:323:11 loadmodules@../angular.js:4099:5 createinjector@../angular.js:4025:11 workfn@../../vendor/angular-mocks/angular-mocks.js:2339:44 xyz.spec: describe('xyz section', function () { beforeeach(module('blah.xyz')); it('should have dummy test xyz', inject(function() { expect(true).tobetruthy(); })); }); i notice states can't found yet others can... the output angular.js (even without minification) impossible debug... therefore angular.js has altered partially decent debug output angular.js function loadmodules(modulestoload) { [...]; try { [...]; } catch (e) { [...]; console.log(e);//<<<<<-------- needed in order have //<<<<<-------- idea going ...

Is there a gcc compiler under ARM? -

i know if want compile program arm device need special version of gcc runs under x86 , compiles arm (cross compiling) there way compile arm under arm? if happy compile source, recent version of gcc can built natively on arm device, targeting arm device. dependencies compile gcc , size of code base might give difficulties, regularly build up-to-date gcc development branch on raspberry pi 2. follow instructions at: https://gcc.gnu.org/install/ prerequisites need, , when configuring compiler use like: --with-cpu=cortex-a15 --with-float=hard --with-fpu=neon --with-mode=thumb modifying --with-cpu , --with-fpu options required system. if looking prebuilt binaries, distributions (and debian , ubuntu) run on arm provide package can install, x86 systems.

How do I add an index to my localstorage using only HTML, CSS and JavaScript? -

this html page used add student <!doctype html> <head> <link href="style.css" rel="stylesheet" type="text/css"> <script src="function.js"></script> </head> <header> <nav> <img src="logo.jpg"><h1 id="titt">north park clubs</h1> <li><a href="attendance.html">attendance</a></li> </nav> </header> <body> <h1>add student</h1> <input type="text" id="indx"></input> <input type="text" id="sfirstname"></input> <input type="text" id="slastname"></input> <input type="text" id="snumber"></input> <input type="text" id="spoints"></input> <input type="button" onclick="save()" value=...

Bash conditional statement -

i realize simple problem, can't figure out why isn't working. i'm attempting check if folder larger 35gb , if so, remove files older 3 days in it. with code: #!/bin/bash max=35000000000 if [ $(du -sb ~/mega | cut -f1) \> $max ] find ~/mega/* -mtime +3 -exec rm -fr {} \; fi i'm getting following errors: syntax error near unexpected token `fi' you missing semicolon or line jump before then keyword. beware bash uses > compare strings, not numbers. numeric comparison should using either -gt or bash specific (( arithmetic expression evaluator. instance: #!/bin/bash max=35000000000 if (( $(du -sb ~/mega | cut -f1) > $max )) find ~/mega/* -mtime +3 -exec rm -fr {} \; fi reference: bash conditional constructs

node.js - Node/Express, How do I modify static files but still have access to req.params? -

i'm new node/express, there's (hopefully) obvious answer i'm missing. there's middleware transforming static content: https://www.npmjs.com/package/connect-static-transform/ . transformation function looks like: transform: function (path, text, send) { send(text.touppercase(), {'content-type': 'text/plain'}); } so, that's great transforming content before serving, doesn't let me @ query parameters. this answer shows how connect or express middleware modify response.body : function modify(req, res, next){ res.body = res.body + "modified"; next(); } but can't figure out how run static file content. when run res.body undefined. is there way middleware run after express.static ? my use case want serve files disk making small substitution of text based on value of query parameter. easy server-side templating, flask. want user able simple npm-install , start tiny server this. since i'm new node , express...

java - Why can't I read an integer from a text file using a BufferedReader? -

i can't read integer text file using bufferedreader: bufferedreader br = new bufferedreader(new filereader("c:/heapsort.txt")); s = br.readline(); int x = integer.parseint(s); the code above throws following exception: ava.lang.numberformatexception: null @ java.lang.integer.parseint(unknown source) @ java.lang.integer.parseint(unknown source) @ tester.main(tester.java:16) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) @ java.lang.reflect.method.invoke(unknown source) @ edu.rice.cs.drjava.model.compiler.javaccompiler.runcommand(javaccompiler.java:272) make sure value read file not null , integer. otherwise exception. because readline returns whole line file string

linux - Bash, wget remove comma from output filename -

i reading file url's line line pass url wget: file=/home/img-url.txt while read line; url=$line wget -n -p /home/img/ $url done < $file this works, file contains comma in filename. how can save file without comma? example: http://xy.com/0005.jpg -> saved 0005.jpg http://xy.com/0022,22.jpg -> save 002222.jpg not 0022,22 i hope find question interesting. update: we have nice solution, there solution time stamping error? warning: timestamping nothing in combination -o. see manual details. this should work: url="$line" filename="${url##*/}" filename="${filename//,/}" wget -p /home/img/ "$url" -o "$filename" using -n , -o both throw warning message. wget manual says: -n (for timestamp-checking) not supported in combination -o: since file newly created, have new timestamp. so, when use -o option, creates new file new timestamping , -n option becomes dummy (it can...

c - Will this result in a seg fault -

below code : p = (float *) malloc(sizeof(float) * n); p1 = p; // p1 float* p--; // result in seg-fault? i guessing yes because trying access memory outside allocated space. please confirm? edit after seeing hobbs' answer not resist asking too. i believe not result in seg fault printf("%f",p[n]); // because n legally allocated p you're not accessing memory @ all; you're doing pointer arithmetic. using pointer arithmetic obtain pointer isn't inside object or 1 past end of array undefined behavior, happen, including segfault. however, on reasonable systems, nothing happen unless try *p . @ point, happen, receiving garbage values, crash/segfault, global thermonuclear war.

maze - Incorrect results for Prolog project/puzzle -

Image
i working in hard prolog project/puzzle cant find solution. thank help. the practice model , solve logic programming through maze. consists of rooms, doors , keys. when 2 rooms connected connected through door closed 1 or more locks, require opened move 1 room other. keys , locks indistinct , ie key opens lock. after opening door open, key's stuck in lock , can not recovered (lost forever), opening each door take many keys , locks. in each room there can unused keys, can collected further opening new doors. have no keys. the solution program must define predicate camino / 3 (camino road in spanish) such ( a , f , x ) true if x road leading room f based on stay, can go opening door keys corresponding available @ times. road shall calculated list of names of rooms in order in cross (and starting @ a , ending @ f ). the program define predicate e / 2 of form e (e , l ) each room e , l number of keys contained in room. define predicate p / 3 of form p (e1, e2 , c) e...

angularjs - How to upload files using multiple files input element? -

i'm trying upload multiple files multiple input element in 1 form. for exemple : <form id="category-form" method="post" enctype="multipart/form-data" class="form" name="form"> <div class="form-group"> <p>pictures of category</p> <input id="a_pics" accept="image/*" type="file" class="file" multiple="true" my-file-upload="a_pics" required/> </div> <div class="form-group"> <p>pictures of b category</p> <input id="b_pics" accept="image/*" type="file" class="file" multiple="true" my-file-upload="b_pics" required/> </div> </form> i have service file upload. this, can know input e...

java - Combined bar and line chart JfreeChart. Trying to make a 3 point average with the line chart. The values do not line up correctly -

i have dataset barchart lets say:{1,2,3,4,5,6,7,8,9}. have line chart suppose 3 point average, value of barchart @ index, , 2 values before that, divided three. the line chart should nonexistent corresponding barchart values 1 , 2, , begin @ position 3. tried using try , catch block , if statement put values in if possible, when did still started line graph @ position 1 , stretched out fit graph. how can line chart starts @ column 3 , goes on there? heres have right now: public class mocktest extends jframe{ public mocktest() { //mock data defaultcategorydataset dataset = new defaultcategorydataset(); defaultcategorydataset dataset2 = new defaultcategorydataset(); int[] times = new int[]{1,2,3,4,5,6,7,8,9}; ( int = 0; < times.length; i++ ){ dataset.addvalue(times[i], "time", "hour" + string.valueof(i+1));; if(i>2) { dataset2.addvalue((times[i] + times[i-1] + times[i-2])/3, "time",...

Eclipse Android App errors on creation -

i trying use eclipse make android app. however, when finished making files, came bunch of errors don't know how fix. i'm afraid use quick fixes, in past break , code doesn't work. the import android.support cannot resolved myactivity.java /minermadness/src/com/cosmicluck/minermadness line 3 java problem actionbaractivity cannot resolved type myactivity.java /minermadness/src/com/cosmicluck/minermadness line 9 java problem actionbaractivity cannot resolved type myactivity.java /minermadness/src/com/cosmicluck/minermadness line 33 java problem method onoptionsitemselected(menuitem) of type myactivity must override or implement supertype method myactivity.java /minermadness/src/com/cosmicluck/minermadness line 25 java problem r cannot resolved variable myactivity.java /minermadness/src/com/cosmicluck/minermadness line 30 java problem method getmenuinflater() undefined type myactivity myactivity.java /minermadness/src/com/cosmicluck/minermadness ...

c++ - Is std::async guaranteed to be called for functions returning void? -

i've wrote following code test std::async() on functions returning void gcc 4.8.2 on ubuntu. #include <future> #include <iostream> void functiontbc() { std::cerr << "print here\n"; } int main(void) { #ifdef use_async auto = std::async(std::launch::async, functiontbc); #else auto = std::async(std::launch::deferred, functiontbc); #endif //i.get(); return 0; } if i.get(); uncommented, message "print here" exists; however, if i.get(); commented out, "print here" exists if , if use_async defined (that is, std::launch::async leads message printed out while std::launch::deferred never). is guaranteed behavior? what's correct way ensure asynchronous call returning void executed? std::launch::deferred means "do not run until .wait() or .get() ". as never .get() or .wait() ed, never ran. void has nothing this. for std::launch::async , standard states returned future'...

Setting region label color/attributes for jvectormap -

is there way vary region label color based upon value region set region fill color based upon set of values? there onregionlabelshow function? i've seen referenced elsewhere throughout web not in documentation @ http://jvectormap.com/ or setting html of label? i added custom label styles library in pull request: https://github.com/bjornd/jvectormap/pull/409

Open connection difference in Comet and Websockets -

i trying understand difference in websocket , comet model. per understanding, in comet model, connection remains opened until server has push client. once server pushes data client, connection closed , new connection established next request. it not considered approach connection may remain open long time (causing intensive use of server resources) or may timeout. on other hand, websockets start handshake connection , once both client , server agree exchange data, connection remains open. so in both case connection remains open long time (especially websocket). so isnt't drawback of websocket keep connection open. take reference of signalr in asp.net discuss concept. first, let's clarify comet comes in 2 flavors: http streaming , http long polling. referring long polling. (see this other answer terminology). in 3 cases (websocket, http streaming, , http long polling) underlying tcp socket kept open. that's main feature of kind of techniques , not sid...

javascript - Code works with alert but not without -

the problem encountering when add alert command code works, if remove it, not work. strange. how can make work without alert command ? the code below works alert , not without. $(function(){ $('.page-links').click(function() { $('#page').load('page' + $(this).data('target') + '.html'); }); $('[data-target]').on('click', function() { var navigationnumber = $(this).attr('data-target'); // if , if page18 clicked, run diagram18.js if (navigationnumber == 18) { alert(navigationnumber); // run diagram18.js $.getscript("sensortables/diagram" + navigationnumber + ".js", function() { window['diagram' + navigationnumber](); }); }); }); sounds asynchronous operation finishing unti...

routes - How sending parameter in the controller method of Silex - PHP -

i'm using silex , i'm trying pass parameter controllers , not work. my code below: <?php error_reporting(e_all); ini_set('display_errors', 1); require_once __dir__ . '/vendor/autoload.php'; use silex\application; use symfony\component\httpfoundation\request; class testcontroller { public function testaction(request $request, application $app, $value) { var_dump($value); return 'test'; } } $app = new application(); $app['debug'] = true; $app->get('/{value}', 'testcontroller::testaction'); $app->run(); your code correct. that's 404 error apache. need call page http://site/index.php/value . if want remove index.php url follow page .

plsql - Oracle Stored Procedures using temp tables -

i new oracle , need solve following problem. inside stored proc want return 2 cursors this. procedure myproca() begin open refcursora select id, ..... tablea ..... long series of conditions open refcursorb select * table b b.id in (select id tablea ..... long series of conditions) this how have stored proc @ moment don't repetition. clause sql in parentheses in 2nd cursor same first cursor. how can load temp table or associative array or use in both cursors. thanks in advance it seems need ref cursor how declare ? cursor cursor_name ref cursor; how use ? open cursor_name select query loop fetch cursor_name some_variable; exit when cursor_name%notfound; do_something; end loop; close cursor_name; so, same cursor variable point different sql area dynamically. or you can see cursor expression

jquery - Centering a div with a full width/height border -

first off, here's jfiddle: https://jsfiddle.net/nulyq28d/ what trying make white border expand entire height of screen , center content inside box, both horizontally , vertically. background changing 3 images (instead of solid black) changing between each other. leaving white border part of actual images weird. want separate images. <body id="home-page"> <main> <div> <p>lorem ipsum dolor sit amet, duis eros posuere sit, volutpat nec massa sit ac, amet pede eu justo, suspendisse adipiscing viverra. amet quisque, justo elit dui orci aliquam praesent, et condimentum nibh. ultricies cubilia eu fringilla elementum erat, arcu metus dictum id feugiat, ultricies interdum elementum, magna nec urna sit non condimentum a, massa tempus nibh. eros turpis in erat sed, adipiscing molestie, eros arcu. est @ est nec augue</p> </div> </main> body#home-page { background-c...

sql server - SQL: Sum a negative and positive real gives wrong value -

why following query result in value 3.21865081787109e-06 when value should zero? create database test go use test create table nums (number real) go insert nums values (1.67460317460317),(-1.6746) go then run: select sum(number) nums this returns value 3.21865081787109e-06 ? if cast values decimal, or if shorten first number 1.6746 returns correct value of zero? also: summing numbers manually gives correct value, looks if sum() trims zeroes? select (1.67460317460317 + -1.6746) returns: 0.00000317460317 thank you! why should 0? 1.67460317460317 + -1.6746 ------------------- = 0.00000317460317 = 3.17e-06 and difference between 3.21 , "real" math 3.17 floating point inaccuracy.

java - Error showing images in applet in browser -

i'm new java applets , have little problem. need load , display images in applet loaded in browser.this part of code i'm using display image: panel first=new jpanel(); url url = null; try { url = new url(new url(path),"dell_laptop.jpg"); } catch (malformedurlexception e1) { e1.printstacktrace(); } image img = getimage(url); imageicon fimg = new imageicon(img); jlabel jlabel1=new jlabel(fimg); first.add(jlabel1); so when it's working in eclipse, it's working flawless.but when i'm trying load same applet in html page, it's not working.applet loaded,but images aren't shown.path correct, checked it.

c# error: is a 'field' but is used as a 'type' when trying to use while loop -

i going through euler project c# learn language , keep coding skills sharp on summer break (i'm college student). new language. tried answers error other similar questions found don't deal while loops. code having issue is: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace eulerproblems { class problem2 { list<int> fib = new list<int>(); bool notatlimit = true; while(notatlimit) { //code populate list of fibonacci series } } } you cannot write code directly within class. need write inside method, e.g. private void test() { list<int> fib = new list<int>(); bool notatlimit = true; while (notatlimit) { //code populate list of fibonacci series } }

javascript - How to create an input field and then prepopulate the field with -

please no jquery. i've seen several examples of input field exists on page before update it, i'd dynamically create input field , populate information available page (hence current_value variable defined above code snippet): for (i=0; i<tables.length; i++) { (function(i) { var sp = document.createelement('span'); var act_table = document.createelement('table'); act_table.id = 'act-tests-' + i; act_table.style.display = 'none'; var test_name_input = document.createelement('tr'); test_name_input.innerhtml = '<tr><td width="100px">name</td><td><input type="text" class="widevalue testname input"></td></tr>'; test_name_input.setattribute('value', current_rule); act_table.innerhtml ='<tbody><tr>lots of table rows here</tr></tbody>'; act_table.insertbefore(test_name_input,act_t...

sql - mysql Select from self(own) table -

this query : select uni_num comes (select uni_num limit 0,1) 'a%' but know query doesn't work because there isn't "from" statement. want use limit without comes. insql isn't there query this? select * this.table ~~

regex - How to reproduce MATCHES in NSPredicate to query Realm? -

i have query using nspredicate takes regular expression , matches paths: let predicate = nspredicate(format: "path matches '/test/([^/]*[^/])$'") which matches inside folder test excludes subfolders of folders in test , this: /test/abc -> yes /test/abc/def -> no the problem is, can't use match keyword of nspredicate in realm.io . how can reproduce query works in realm? adding exception completeness: *** terminating app due uncaught exception 'invalid operator type', reason: 'operator type 6 not supported string type' so have solved problem (modifying model, wanted avoid): i store path parent, not full 1 along name. name gets stored in different field (to full path stitch 2 strings together) instead of matching regular expression use nspredicate(format: "path ==[c] %@", "/test/") contents of folder test . why not totally happy solution: i wanted avoid separating field fullpath 2 fi...

c# - How to prioritize Web Api Controllers over IHttpHandler? -

i have legacy project has single ihttphandler implementing class routes requests using huge switch statement etc.. trying introduce attribute routing apicontrollers first 1 has priority. possible configure system (either code or iis) web apicontrollers have priority on single ihttphandler implementing class? in iis, put attributerouting first , there aspx ones still web api controller not getting processed first..no matter (having them under same project). don't want introduce separate project. edit: there ihttpmodule decides based on after api/ route specific ashx file. 1 of them 1 described.. edit 2: more specifically: if uri doesn't have list of filtered things [file,message,property ...] routed resource.aspx so api/file, api/message, api/property handle other .ashx files - otherwise traffic goes resource.ashx... as result requests have api/endpoint1, api/endpoint2, api/endpoint3 go resource.aspx. question how route api/endpoint3 api controller described below...

html5 - How to align(center) row controls? -

i don't know how center row controls whithin contact form, can me out ? here's code: <div class="container"> <hr class="tall" /> <div class="row center" id="form_contact"> <h2 class="short" style="text-align: center">vamos <strong>conversar</strong> ?</h2> <p style="text-align: center">queremos conhêce-lo melhor, descobrir quais são os seus problemas de modo podermos ajudá-lo da melhor maneira possível.</p> <div class="span12" id="form_fields"> <form action="" id="contactform" type="post"> <div class="row controls"> ...

javascript - Bootstrap datepicker changeDate regex error -

i'm using 2 datepickers/html textboxfors dates , set min/max each date picker based on other. issue is, when run on changedate function datepicker, regex error causes stack overflow: uncaught syntaxerror: invalid regular expression: /^date/: stack overflow @ bootstrap-datepicker.js:1328 <script type="text/javascript"> $(document).ready(function() { $(".date").datepicker({ autoclose: true }) .on("changedate", function() { var start = $("#startdate").datepicker("getdate"); var end = $("#enddate").datepicker("getdate"); $("#startdate").datepicker('setenddate', end); $("#enddate").datepicker('setstartdate', start); }); }); </script> has had issue? code error is: for (var key in data) line function opts_from_el(el, prefix){ // derive options element data-attrs var data = $(el).data(), ...

javascript - Remove the tabindex the google maps in my page -

i need remove tabindex map on page. used code below tab passes through markers on map , google logo. var map = new google.maps.map(document.getelementbyid('map'), mapoptions); //remove o tab mapa google.maps.event.addlistener(map, 'tilesloaded', function() { var mapcontent = (document.getelementbyid("map")); mapcontent('a').attr('tabindex',-1); }); building off vasil's answer google.maps.event.addlistener(map, "tilesloaded", function(){ [].slice.apply(document.queryselectorall('#map a')).foreach(function(item) { item.setattribute('tabindex','-1'); }); }) here in action.

r - Group data under conditions -

i working r on cross-section data , having problem when grouping data under conditions. problem can seen small part of huge database following. calculate average (distance) under conditions of same province, district , commune. province district commune distance 101 15 3 15 101 15 3 5 101 15 3 7 101 15 9 1 101 15 9 7 102 18 19 3 102 18 19 10 103 16 22 5 103 16 22 6 the expected results following (divided each specific commune each district , each province): province district commune distance 101 15 3 average 101 15 9 average 102 18 19 average 103 16 22 average try library(dplyr) df1 %>% group_by(province, district, c...

Generate a function using Template Haskell -

is possible define function using template haskell? example convertstringtovalue :: string -> int convertstringtovalue "three" = 3 convertstringtovalue "four" = 4 i have map [char] int . fromlist [("five",5),("six",6)] how can add functions convertstringtovalue "six" = 6 convertstringtovalue "five" = 5 at compile time using template haskell , map ? appears quite silly use template haskell purpose know nevertheless. you can using 2 files: a "maker" file: maker.hs : module maker {-# language templatehaskell #-} import language.haskell.th maker items = x <- newname "x" lame [varp x] (casee (vare x) (map (\(a,b) -> match (litp $ stringl a) (normalb $ lite $ integerl b) []) items)) and main file: main.hs : {-# language templatehaskell #-} import language.haskell.th import maker function = $(maker [("five",5),("six",6)]) in case function...

javascript - How to get id of text box which is loaded dynamically -jquery -

i dynamically loading 3 text boxes in page, need take id of text boxes when clicked. $.ajax({ url: "../taxclass/gettaxclass", type: "post", contenttype: "application/json", datatype: "json", success: function (data) { var taxclassbos = data.taxclassbos; $.each(taxclassbos, function (key, value) { $("#taxvatid").append('<div><label class="col-sm-3 control-label" for="vatid">' + value.description + '</label></div><div class="col-sm-3"><input type="text" name="vatid" value=""placeholder="' + value.title + '" id="' + value.taxclassid + '" class="form-control" /></div>'); }); } }); i have tried code $('input[type="text"]').click(function () { var id = $(this).attr('id'); alert(i...

Javascript - If and or statements - IE Undefined -

i confused why wont work... in chrome when click button runs script, textbox pops empty, check length > 0..... in ie, populates undefined, thought check value , if != undefined... if (strtemp.length > 0) { if (strtemp.value != "undefined") { printlabels(strcarrier, strtemp); } else { alert('you wont labels until tell why...'); } } else { alert('you wont labels until tell why...'); } anybody have ideas of doing wrong? if value undefined , it's not string. should checking if (strtemp.value != undefined) . see undefined on mdn.

Python pandas time series interpolation and regularization -

Image
i using python pandas first time. have 5-min lag traffic data in csv format: ... 2015-01-04 08:29:05,271238 2015-01-04 08:34:05,329285 2015-01-04 08:39:05,-1 2015-01-04 08:44:05,260260 2015-01-04 08:49:05,263711 ... there several issues: for timestamps there's missing data (-1) missing entries (also 2/3 consecutive hours) the frequency of observations not 5 minutes, loses seconds once in while i obtain regular time series, entries every (exactly) 5 minutes (and no missing valus). have interpolated time series following code approximate -1 values code: ts = pd.timeseries(values, index=timestamps) ts.interpolate(method='cubic', downcast='infer') how can both interpolate , regularize frequency of observations? thank help. change -1 s nans: ts[ts==-1] = np.nan then resample data have 5 minute frequency. ts = ts.resample('5t') note that, default, if 2 measurements fall within same 5 minute period, resample averages values tog...

Azure website does not have web.config file -

i deployed empty web app on azure. @ point hosting basic site, html, css , js files. uploaded , assigned ssl certificate custom domain , force https. official documentation states edit web.config file implement rewrite rule not have web.config file, documentation says should added default. the web.config file not added default totally fine if don't see in web site content folder. you can create new web.config file , put settings there cannot force ssl settings on azure webapp changing settings in web.config because ssl section locked (i believe) @ applicationhost.config level . easiest way here add urlrewrite rule redirects http requests https. check link sample on how achieve - http://blogs.msdn.com/b/benjaminperkins/archive/2014/01/07/https-only-on-windows-azure-web-sites.aspx

regex - ORACLE REGEXP_SUBSTR that match digits between square brackets -

i have varchar column no have specific format. these examples: afdsbfgf, jbhttp://www.iabvdfbdos.com/view.php?p_id=170405, arcm, cocm, fbus, bv[123545] i need match substring between brackets when string 'bv[123545]'. substring numeric. i tried that: regexp_substr (my_column, '[^bv\[]+[[:digit:]]+') but matches 'jbhttp://www.iabvdfbdos.com/view.php?p_id=170405' , returns "_id=170405" thanks in advance assumes brackets appear once in line. grabs first sub-group (the part in parens) of first occurrence of 'bv' followed left square bracket, followed 1 or more digits, followed right square bracket. square brackets escaped define character class in regex engine otherwise. sql> select regexp_substr('afdsbfgf, jbhttp://www.iabvdfbdos.com/view.php?p_id=170405, arcm, cocm, fbus, bv[123545]', 'bv\[(\d+)\]', 1, 1, null, 1 ) dual; regexp ------ 123545 sql>

sql server - how to take some columns from a database in R -

i want database take few columns , use in r. require(rodbc) ch <- odbcconnect("ims") so connected database i have many tables , want take 1 so: ress <- sqlfetch(ch, "fact_gpim") and last have columns , want take few rows, cause there many rows, think use query: y<-sqlquery(ch, paste("select ress[[5]] ress","where ress[[5]]=0549604")) but wrong , don't know what. text appears > y [1] "42000 105 [microsoft][sql server native client 11.0][sql server]unclosed quotation mark after character string '[5] ress ress[[5]=0549604'." [2] "[rodbc] error: not sqlexecdirect 'select ress[[5]] ress ress[[5]]=0549604'" what wrong?

php - insert query inside select query loop -

i've created below function include several mysql queries, seem create issue. cause when run function returns following error: errormessage: commands out of sync; can't run command now i've tried include next_result() , not difference? function retrieveplayertweets(){ global $con; $query = $con->prepare("select players.fullname, players.twitter_user, team.id teamid players, team players.teamid = team.id"); $query->execute(); $query->bind_result($fullname, $twitter_user, $teamid); while ($query->fetch()) { foreach(retrieveusertweets($twitter_user) $twitterdata) { $id = $twitterdata['id_str']; $text = $twitterdata['text']; $name = $twitterdata['user']['name']; $datestring = $twitterdata['created_at']; $favoritecount = $twitterdata['favorite_count']; $date = date('y-m-d h:i:s', strtotim...

css - Alignment of html controls -

suppose have following html: <div class="column col-sm-2 col-xs-2 col-md-3"> <div class="row" style="margin-left: 10px;"> <p><b>test:</b> <select> <option>test1</option> <option>test2</option> <option>test3</option> </select> </p> </div> <div class="row" style="margin-left: 10px;"> <p><b>longlinetest:</b> <select> <option>test1</option> <option>test2</option> <option>test3</option> </select> </p> </div> </div> it produces somthing like: test:select control longlinetest:select c...

winapi - How to bind socket to local addreess with TCPv6 -

i have port existing win api application work tcpv6. can't figure out how bind socket localhost. earlier was: struct sockaddr_in serveraddress; listensocket = wsasocket(af_inet, sock_stream, ipproto_tcp, null, 0, wsa_flag_overlapped); ... serveraddress.sin_family = af_inet; serveraddress.sin_addr.s_addr = inet_addr("127.0.0.1"); serveraddress.sin_port = htons(nportno); now, i'm trying: struct sockaddr_in serveraddress; listensocket = wsasocket(af_inet6, sock_stream, ipproto_tcp, null, 0, wsa_flag_overlapped); ... serveraddress.sin_family = af_inet6; serveraddress.sin_addr.s_addr = inet_addr("::1"); serveraddress.sin_port = htons(nportno); and bind returns socket_error there page ms https://msdn.microsoft.com/en-us/library/windows/desktop/ms737937%28v=vs.85%29.aspx there no bind example i think want this: struct sockaddr_in6 serveraddress; listensocket = wsasocket(af_inet6, sock...

c# - Thousand separator with MaskedEditExtender from the ASP.NET AJAX Control Toolkit -

i need format inputs in textbox , i've tried maskededitextender. don't know mask have use want - maybe knows. the entered values numeric values amounts between 100 , 9999999 euros want show thousand separators cent separators while typing textbox this: input: 100 show: 100,00 input: 345000,50 show: 345.000,50 to more specific want exact same behavior typing numeric values calculator , kind calculator shows entered values on display. here (expensive) example exact behavior need free: https://demos.devexpress.com/aspxeditorsdemos/features/maskedinput.aspx this code: <asp:textbox id="purposeamount" cssclass="textboxcreateitem" ontextchanged="purposeamount_ontextchanged" autopostback="true" runat="server"></asp:textbox> <asp:regularexpressionvalidator id="regularexpressionvalidator1" runat="server" controltovalidate="purposeamount" display="dynamic...