Posts

Showing posts from March, 2013

Bash IFS ('\n'): Problems with file name detection through find command and for loop -

#!/bin/bash ifs='\n' declare -i count=0 ax=$(find *.iso -maxdepth 1 -type f) # rather use ax="$(find *.iso -maxdepth 1 -type f"? # a="${ax%x}" < use when applying "" $() in ax? should include newlines way. edit: don't need trailing newlines fix. iso in "$ax" echo "use "$iso"? [y/n]?" # outputs files, ifs has no force somehow read choiceoffile shopt -s nocasematch case $choiceoffile in y ) echo "using selected file.";; * ) continue;; esac # sort of processing done is command substitution done right? variable not work ifs \n in loop, don't why occurs. for loop supposed process filenames blank space processing output of find line line (thats why use ifs \n). the variable not work ifs \n in loop, don't why occurs. ifs='\n' doesn't set ifs newline, sets ifs literal string \n . if want set ifs newline, use: ifs=$'\n'

php - MongoDB+Doctrine ODM How to remove a embedded document in a document collection? -

im using mongodb doctrine orm , want remove embedded document "avatar" (or set null) in document collection. my json-object looks this: { "_id" : objectid("55965d090203ff700f000032"), "name" : "test", "stores" : [ { "_id" : objectid("559d166f0203ff081300002f"), "storename" : "test", "openingtimes" : "", "address" : { ... }, "contactperson" : { "firstname" : "", "lastname" : "", ... "avatar" : { "source" : "/uploads/images/company/55965d0980585/contactperson/", "name" : "contactperson.jpg" } } }, ... ] }...

c# - Which data type the enumerations are stored by the compiler? -

in data type enumerations stored compiler? enum default uses int datatype storing value you can set type enum , override default datatype, datatype must of integral numeric type example : enum months : byte { jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec };

gwt validation - GWT replace-with code -

related previous un-answered question of myself: how can find code executed when use <replace-with class="xxxxxx.xxxxxx.beanvalidatorfactory"> <when-type-is class="javax.validation.validatorfactory" /> </replace-with> i suspect may causing unexpected behaviour when validatorfactory used somewhere else client , wonder if having eye on code can point me workaround/solution. thx!

php - Symfony2.7.1 fresh installation. Failed to load resource -

symfony2 developers: recently, planning familiar symfony2, using api project. current version v2.7.1. i have apache installed local environment. installation root directory is: //localhost/symfony so followed official guide install it. looks fine after installation. when view page in development environment (app_dev.php). //localhost/symfony/web/app_dev.php page content display expected, not styled. open console , find 404 response follows: failed load resource //localhost/symfony/web/bundles/framework/css/structure.css //localhost/symfony/web/bundles/framework/css/body.css //localhost/symfony/web/bundles/framework/css/exception.css //localhost/symfony/web/app_dev.php //localhost/symfony/web/bundles/framework/css/structure.css //localhost/symfony/web/bundles/framework/css/body.css //localhost/symfony/web/bundles/framework/css/exception.css i looked project/web/bundles directory, found nothing inside 2 empty file. frame...

php - Twig Template Import External WordPress Posts -

i'm trying load in few wordpress posts website built using twig. i've tried inserting code page gets commented out. i'm guessing there's special way i'm supposed rewrite work in twig. can me? <?php define('wp_use_themes', false); require('../wordpress/wp-blog-header.php'); query_posts('showposts=3'); ?> <?php while (have_posts()): the_post(); ?> <div class="wordpress-post"> <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_post_thumbnail(); ?> <h2><?php the_title(); ?></h2> <?php the_excerpt(); ?> <p><a class="read-more" href="<?php the_permalink(); ?>" class="red">read more</a></p> </div> <?php endwhile; ?> thanks in advance! you cannot mix php , twig code in given twig template...

windows - Script to update domain computer LastLogonDate? -

so i've poked around looking while now, can't seem find anywhere. in our environment have script disables computers after last seen ad property on computer beyond 15 days. since laptop environment , people not connected network when login, computers once lock/unlock when connected domain gets trust relationship issue because computer disabled in ad. has seen script can run on local computer updates lastlogondate property in ad of computer while user logged in? thinking of pushing out scheduled task computers every 15 minutes if possible. thanks!

postgresql - postgres database replication on windows 8 -

Image
i using postgres 9.4 on 2 different windows machines. both machines having windows-8 operating system. i want create replicate environment i.e. make 1 master , other slave db. i have followed steps mentioned on link below : https://wiki.postgresql.org/wiki/binary_replication_tutorial after copying file data folder of master machine slave machine (excluding pg_xlog folder , postgresql.conf file), when tried start slave db, prompt me error below - "the postgresql-9.4 service on local computer started , stopped. services stop automatically if not in use....." even not able open log file there in pg_log folder on slave (access denied), copied slave. can me out of issue?

javascript - onserverclick event not working using html builder in C# -

i using anchor tag , want fire event on click anchor tag.but unfortunately not working . here code : html.append("<a id='dlttag' class='ca_quy_e' runat='server' onserverclick='delete_click'>"); html.append("<i class='fa'>"); html.append("</i>"); html.append("</a>"); protected void delete_click(object sender, eventargs e) { //my code } every thing working perfect table forming , onserverclick not working. you have make use of javascript or jquery i.e. clientside scripting calling serverside method client side a. create method wemethod attribute [webmethod] public static string isexists(string value) { //code check uniqe value call database check return "true"; } b. register client call element protected void page_load(object sender, eventargs e) { if (!ispostba...

javascript - If statement is not working inside click/swipe event -

i trying use if statement inside jquery event not worknig. code: $(".carousel").swipeleft(function(){ rightpos += 242; $(this).animate({ "right": rightpos }, swipespeed); var currentrightpos = $(".carousel").css("right"); alert(currentrightpos); if(currentrightpos > 500){ alert("its 500"); }; }); i dont know happening. if statement not working inside click event. swipe event working fine. alert(currentrightpos); working fine if statement not working. have read through 5-6 questions in stackoverflow nothing helpful. if need further information please comment. thank you. $(".carousel").css("right") returns 'npx' . try with: var currentrightpos = parseint($(".carousel").css("right").replace(/px/, ''));

javascript - How to find where form parameters are stored and use them in Request -

Image
i trying scrape https://www.freelance.nl/opdrachten/zoeken data using request , cheerio running issues posting search terms. i cannot see search string , selected category sent during post when using site , how can use them in request automate searches node application. basically want able send different search terms using request can scrape returned html data need. so far have this: request.post('https://www.freelance.nl/opdrachten/zoeken', { form: { key: 'value' } }, function (error, response, body) { if (!error && response.statuscode == 200) { console.log(body) } } ); but cannot see form data stored in dev tools, cannot send correct values in 'form' object. i'm pretty sure it's in request payload, how node application? is there easier way this? wasting time? i've slighly modified code: payload = {'projectfilterform[keywords]':'javascript','projectfilterf...

Swift: how to perform a task n-1 times where n is the length of an array? -

i came this: for x in 1...(myarray.count - 1) { task() } which ugly. there better way? you have little careful, if array empty, crash: let a: [int] = [] let range = 0..<a.count-1 // fatal error: can't form range end < start strides don’t have problem (since strideable things must comparable ) do: for _ in stride(from: 0, to: a.count - 1, by: 1) { // execute if a.count > 2 print("blah") } alternatively, if guard it, can use dropfirst : for _ in (a.isempty ? [] : dropfirst(a)) { print("blah") } i advise against trying make neater creating pseudo-for-loop runs 1 less count times. there’s reason there’s no foreach or repeat functions in swift. these kind of loops seem nice @ first there lots of bugs arise them (for example, return or continue don’t work way might expect, it’s considered bad practice use higher-order function external mutation – whereas regular for loop suggestion mutation/side-effects likely...

nsdateformatter - Swift: Result of dateFromString nil unexpectely -

i went through related questions , tried suggestions didn't worked out me: let dateformatter = nsdateformatter() dateformatter.dateformat = "dd.mm.yyyy hh:mm" dateformatter.locale = nslocale(localeidentifier: "en_us_posix") dateformatter.datestyle = .fullstyle let timestamp = dateformatter.datefromstring("07.07.2015 19:07") timestamp nil.... :-( remove line nsdateformatterstyle: let dateformatter = nsdateformatter() dateformatter.dateformat = "dd.mm.yyyy hh:mm" dateformatter.locale = nslocale(localeidentifier: "en_us_posix") let timestamp = dateformatter.datefromstring("07.07.2015 19:07") this because setting nsdateformatterstyle overrides dateformatter.dateformat , making results nil when using both. the solution not use nsdateformatterstyle if have dateformat .

javascript - Save dialog box creation -

i trying open save dialog box using file -> save option click in menu bar in j2ee web application. trying code opening save dialog box, not working. <html> <head> </head> <body> <div align=center id=sect1> <img src='1.jpg' id=img1> <p> text</p> </div> <center> <a href="\\172.16.2.1\elstest\projects\qts\q0002\pdfviewer_src.zip"> pdfviewer_src.zip </a> </center> </body> </html> how task? please give me code reference

java - DateFormat giving incorrect value -

i wanted convert string date . code: string maturitydate = "20150722"; simpledateformat formatter = new simpledateformat("yyyymmdd"); date date = formatter.parse(maturitydate); system.out.println(date); expected result : input 20150722 output wed jul 22 00:07:00 ist 2015 actual result : input 20150722 output thu jan 22 00:07:00 ist 2015 what cause? what cause? cause m letter means minute in simpledateformat pattern. mean m months. solution change format yyyymmdd yyyymmdd . simpledateformat formatter = new simpledateformat("yyyymmdd"); in api find complete list: m month in year month july; jul; 07 m minute in hour number 30

python - Why does it say this--> TypeError: 'bool' object is not iterable -

content text file tokens = content.split() topics = [e (n, x) in enumerate(tokens) (n2, x2) in enumerate(tokens) (i, e) in enumerate(tokens) if any(x2.isdigit()) if '.' in x if re.findall('\d+', x) if n < < n2] i dont understand how iterating through bool , there more concise , faster way of doing list comprehension? your issue comes - any(x2.isdigit()) , guessing x2 string, x2.isdigit() returns bool , cannot use any() function on it. try using without any() function check if x2 number - if x2.isdigit() if want check whether x2 has digit in or not, can try - if any(i.isdigit() in x2) though not know trying do, cannot check if other logic or not. any() function used on iterable (lists or generator expression, etc) , check if of them true.

xml - create NodeSet in XSLT from PHP function -

i want create xml in php function , return xslt. in xslt create node-set , use it. in php have function returns xml string. function xmlstring() { $string = ''. '<test>'. '<a>1</a>'. '<b>2</b>'. '</test>'. '<test>'. '<a>3</a>'. '</test>'. ''; return $string; } i registered function in php , use in xslt <xsl:variable name="xmlstring"> <xsl:value-of select="php:function('xmlstring')" /> </xsl:variable> to disable output escaping used disable-output-escaping="yes" on value-of i played around exsl:node-set can't work i use <xsl:value-of select="exsl:node-set($xmlstring)/test/b" /> here example tested php 5.5: <html> <head> <title>php extension function re...

asp.net mvc - PushSharp - MismatchSenderID on android -

i trying implement push notifications on android devices. have created google project , generated server api key there.the server app asp.net mvc. client app titanium based , set sender id in config file there. got mismatchsenderid exception. here code: public void notification() { var objpush = new pushbroker(); objpush.onnotificationsent += notificationsent; objpush.onchannelexception += channelexception; objpush.onserviceexception += serviceexception; objpush.onnotificationfailed += notificationfailed; objpush.ondevicesubscriptionexpired += devicesubscriptionexpired; objpush.ondevicesubscriptionchanged += devicesubscriptionchanged; objpush.onchannelcreated += channelcreated; objpush.onchanneldestroyed += channeldestroyed; objpush.registergcmservice(new gcmpushchannelsettings(configurationmanager.appsettings["googleapikey"])); ...

Maximising efficiency of a data structure ordered by a person name using Java Collections -

i need have data structure mapped name of person, implies duplicate keys have stored. have log(n) times (at most) insertions, deletions , searches. ideally, have hashtable mapped unique identifier, generated upon insertion. doing so, have insertions in constant time. auxiliary ordered balanced tree each entry being reference entry in hashtable, able search/delete name in logarithmic time, , print entries in linear time, ordered name. is there way in java reusing available collections? or @ least solution similar complexity... in this question , suggested map solve problem. understanding, no map can deal repeated keys properly. if understand question right, want multimap. there few implementations in guava , commons-lang , or roll own using e.g. hashmap (or treemap if suspect .hashcode() implementation slow or poor, i'd benchmark first) , list or set implementation value types. note if want iterate on values based on name order, you're best off using tree...

php - DOMDocument::load : Failed to open stream: Permission denied -

this error thrown when calling domdocument.load('./the/path/to/the/'.$this->image); when use absolute path instead of instance variable, issue goes away, i.e. domdocument.load('./the/path/to/the/image.png'); . i'm running locally on windows box don't think ownership issue.

javascript - How to select all form elements which are not in a hidden parent in Jquery? -

i need 1 jquery select line/selector (due js plugin limitation) find inputs (hidden type inputs !!! i.e. ' <input type=hidden /> ') not hidden due 1 of parent, tried 1 :parent:not(hidden) input but doesn't work (should return input2 , input3 only). here jsfiddle showing issue: jsfiddle demo when parent hidden, descendants hidden. use :visible pseudo-selector $('input:visible') demo update to find inputs (hidden type inputs !!! $("input:visible, input[type='hidden']") demo

ios - Unable to get tracks of AVAsset using HLS while retrieveing bitrate -

i using hls streaming in application , using avplayer. want bitrate of video track using avasset. although have added observer , other stuff getting tracks array empty always.am on right track or missing anything? hls adaptive, therefore, bitrate can vary across duration of stream based on various conditions. on wrong track, unlike playing file, either local or network url, currentitem.asset.tracks nil. you'll need query avplayer's currentitem's accesslog , inspect appropriate "events". the following documentation should give information need; look @ ; avplayeritemaccesslog and avplayeritemaccesslogevent edit: you might benefit reading apple's live streaming overview give better understanding of .m3u8 index files, media file can encoded various bit rates accommodate different network throughput/congestion. client responsible switching between segments encoded @ different bit rates. the observedminbitrate , observedmaxbitrate pr...

c++ - Visual Studio Compile Source -

i compile source: https://github.com/benjamin-dobell/heimdall i'm have downloaded source launch visual studio , open heimdall/main.cpp when trying f5 nothing happening. please help have @ readmes (e.g. win32 ): appendix b - installing heimdall suite source heimdall , heimdall frontend both utilise cmake managing build process. cmake can generate files various build systems including gnu make , visual studio. however, official packages compiled gnu make , mingw-w64 gcc/g++. note: official builds use mingw-w64 because on-going cross-platform development simpler when using 1 ide (jetbrain's clion) , similar toolchains. 1. setup mingw-w64 build environment utilising msys2: http://msys2.github.io/ 2. after installing msys2 command prompt launch, enter: pacman -syu pacman -s mingw-w64-x86_64 mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-libusb mingw-w64-x86_64-qt5-static make 3. add mingw-w64 binaries path enviro...

Confusion in Scope and Life Time of a local variable in c/c++ -

this question has answer here: is undefined behavior dereference dangling pointer? 4 answers my question when lifetime of local variable @ block level why pointer still printing value of local variable outside block #include<iostream> using namespace std; int main(){ int *p; { int n; n=5; p=&n; } cout<<*p; return 0; } scope refers the availability of identifier. life time refers actual duration object alive , accessible legally during execution of program. distinct things. your code has undefined behaviour because lifetime of object n on @ closing } because access through pointer. a simple example might make clearer: #include<stdio.h> int *func() { static int var = 42; return &r; } int main(void) { int *p = func(); *p = 75; // valid. } here, var has static storag...

listview - c# WPF Automate GridViewColumnHeader Click event -

is there possibility call click-event of listviewcolumnheader programatically? i try write integration test sortable columns in listview gridview , want this: var list = new listview(); var grid = new gridview(); var column = new gridviewcolumn(); var header = new gridviewcolumnheader(); column.header = header; grid.columns.add(column); header.doclick(); // <-- not possible directly - can i tried achieve goal using gridviewcolumnheaderautomationpeer did not succeed. it possible raise click event following line of code. list.raiseevent(new routedeventargs(gridviewcolumnheader.clickevent, header));

python - Flask throwing 500 internal server error -

this routes.py looks like. crawler crawls youtube video links within page. code works fine standalone (not in flask). however, when try make work via flask, throws 500 internal server error. kind of appreciated. from flask import flask, render_template beautifulsoup import beautifulsoup import requests app = flask(__name__) @app.route("/") def main(): url="https://www.youtube.com/user/eminemvevo/videos" source_code=requests.get(url) text_source_code=source_code.text final_code=beautifulsoup(text_source_code) video_url=final_code.findall('a',{'class':'yt-uix-sessionlink yt-uix-tile-link spf-link yt-ui-ellipsis yt-ui-ellipsis-2'}) in video_url: if "/watch?v=" in i.get('href'): j= i.get('href') j=j.replace("/watch?v=","") print "http://youtube.com"+j if __name__ == '__main__': app.run() stack trace ...

matlab - Speed up creation of impoint objects -

Image
i have create draggable points on axes. however, seems slow process, on machine taking bit more second when done so: x = rand(100,1); y = rand(100,1); tic; = 1:100 h(i) = impoint(gca, x(i), y(i)); end toc; any ideas on speed highly appreciated. the idea provide user possibility correct positions in figure have been calculated matlab, here exemplified random numbers. you can use the ginput cursor within while loop mark points want edit. afterwards click outside axes leave loop, move points , accept key. f = figure(1); scatter(x,y); ax = gca; = 1; while 1 [u,v] = ginput(1); if ~inpolygon(u,v,ax.xlim,ax.ylim); break; end; [~, ind] = min(hypot(x-u,y-v)); h(i).handle = impoint(gca, x(ind), y(ind)); h(i).index = ind; = + 1; end depending on how you're updating plot can gain general speedup using functions clf (clear figure) , cla (clear axes) instead of opening new figure window explained in this answ...

hierarchical clustering - Using "ward" method with pvclust in R -

i using pvclust package in r hierarchical clustering dendrograms p-values. i want use "ward" clustering , "euclidean" distance method. both work fine data when using hclust . in pvclust keep getting error message "invalid clustering method". problem apparently results "ward" method, because other methods such "average" work fine, "euclidean" on own. this syntax , resulting error message: result <- pvclust(t(data2007num), method.hclust="ward", method.dist="euclidean", nboot=100) bootstrap (r = 0.5)... error in hclust(distance, method = method.hclust) : invalid clustering method my data matrix has following form (28 countries x 20 policy dimensions): x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 aut 2 3 4 2 1 1 4 3 2 2 2 3 3 4 4 2.0 5 4 0 3 ger 3 5 3 2 1 3 2 4 4 5 4 0 4 5 4 3.0 5 5 3 2 swe 5 5 1 5 4 3 1 4 4 5 3 4 ...

mysql - Counting instances in the table -

i have table millions of records. records this: name group +--------+------+ | aaa | 1 | | bbb | 2 | | ccc | 1 | | aaa | 1 | | aaa | 2 | +--------+------+ each name can repeated multiple times in 1 group. each name can in multiple groups. there lot of groups i need display "report" following information: how many times each name occure in table (sorted highest lowest). how many times these names occure in each group. of course, won't display information names, want display first 100 names (with occurences). example of desired output: name count group1 group2 +------+-------+-------+-------+ | aaa | 3 | 2 | 1 | | bbb | 1 | 0 | 1 | | ccc | 1 | 1 | 0 | +------+-------+-------+-------+ so far, counted names using query: select * (select name, count(name) count names s group name order count desc) r limit 100 i cannot figure out how count names returne...

objective c - iOS force landscape but not all contents are displayed -

Image
i trying work on ios app , 1 viewcontroller portrait , 1 viewcontroller using googlemap landscape orientation follows : when comes implementation , testing, shows : i not sure how when running on iphone 6 ios 8.3 . seems setting device orientation , interface orientation different parameters have set. have appdelegate.m -(nsuinteger)application:(uiapplication *)application supportedinterfaceorientationsforwindow:(uiwindow *)window{ return uiinterfaceorientationmaskallbutupsidedown; } viewcontrollera.m -(void) viewdidappear:(bool)animated { [super viewdidappear:animated]; nsnumber *value = [nsnumber numberwithint:uiinterfaceorientationportrait]; [[uidevice currentdevice] setvalue:value forkey:@"orientation"]; } viewcontrollerb.m -(void) viewdidappear:(bool)animated { [super viewdidappear:animated]; ispresented = yes; nsnumber *value = [nsnumber numberwithint:uiinterfaceorientationlandscaperight]; [[uidevic...

matlab - Chosing correct frequency axes -

i want have amplitude , phase reconstruction of signal. signal having 40khz bandwidth , starting frequency 70khz 110 khz. suppose signal x . nfft = length(x); res = fft(x,nfft)/ nfft; % normalizing fft f = fs/2*linspace(0,1,nfft/2+1); % choosing correct frequency res = res(1:nfft/2+1); % amplitude of fft res2 = fft(res); i want plot frequency versus amplitude using figure plot(f,abs(res2)) where amplitude should lying 70khz 110khz , frequency versus phase figure plot(f,angle(res2)) the phase should spread on 70khz 110khz. how chose correct frequency axes. if plot frequency content of signal x , not frequency content of transformed signal res , should rid of line res2 = fft(res); the plot(f,abs(res)) , plot(f,angle(res)) correctly show signal 0 fs/2 . you can zoom more closely on 70khz-110khz frequency range of interest (assuming fs/2>110000 ) using: axis([70000 110000]);

vb.net - Adding rule lines to lines in a text box (multi line) -

does know of way add rule lines multi-line text box control? i thinking of writers pad style faint blue lines under each line of text, filling entire control. (not underline stuff typed in rich text box.) just blank large text box looks rather bland. thought out there might know of custom control, or way draw line under each text line. cheers. just quick sample threw should started: public class form1 private g graphics private x long private lineheight long private sub button1_click(sender object, e eventargs) handles button1.click end sub private sub form1_load(sender object, e eventargs) handles me.load g = me.creategraphics() lineheight = 20 end sub private sub form1_paint(sender object, e painteventargs) handles me.paint g.dispose() g = textbox1.creategraphics() counter long = lineheight textbox1.height step lineheight g.drawline(pens.lightblue, 0, counter, textbox1.width,...

Oozie coordinator-app: execute job every Nth minute divisible by M -

i have hive script executing using oozie coordinator every 10 minutes. when launched oozie coordinator-app, suppose have started @ 08:03, first workflow starts @ time, next 08:13, , 08:23, , on. what want execute workflow every clock time hh:mm, mm divisible 10. assuming same scenario above, want happen this: first workflow execute @ 08:10, , 08:20, , on. how do in oozie? how when every 5 minutes (the last m of minute either 5 or 0)? input. in order run coordinator job @ frequency, can use following directives <coordinator-app name="app" frequency="10" start="2015-07-10t12:00z" end="2016-01-01t00:00z" timezone="utc" xmlns="uri:oozie:coordinator:0.1"> this run every 10 minutes, starting @ 12:00 utc time today. same goes running every 5 minutes, replace frequency="10" frequency="5" . to have run every nth minute divisible m, have ensure start parameter set correctly. another ...

How to create an editable command line prompt in Java? -

is possible create editable command line prompt in java? at moment command line looks following: scanner scanner = new scanner(system.in); system.out.format("enter new value, press return keeping old value [%s]:", oldvalue); string newvalue = scanner.next(); edit: while should works under normal circumstances, have command line, populate old value , let me edit it , take new value on pressing return; an editable textfield console. i have tried jline2 this: consolereader reader = new consolereader; reader.putstring("2"); string input = reader.readline(); ...but unfortunately, hides value 2 until press key "2" , deletes whole line on backspace... , because of poor documentation of jline2 on github, have no idea if possible? you use external library that, e.g. https://github.com/jline/jline2/wiki/jline-2.x-wiki

deployment - How to deploy an Electron app as a executable or installable in Windows? -

i want generate unique .exe file execute app or .msi install application. how that? you can package program using electron-packager , build single setup exe file using innosetup .

Is it possible to send the google spreadsheet data to another application without using button click event? -

i want send google sheet data application, using trigger onedit. able send data on button click event, want without using button little more automatic. should done on cell edit.i've tried can please help. var ss = spreadsheetapp.openbyid("@@@@@@@@@@@@@@@@@@@@@@@@@"); function createspreadsheetedittrigger() { scriptapp.newtrigger('celltracker') .forspreadsheet(ss) .onopen() .create(); } function celltracker(){ var cell = ss.getactivecell().getcellvalue(); if((ss.getactivecell().getvalue()) > 0 && (ss.getactivecell().getvalue()) == cell){ var link = app.createanchor('xxxxx',"http://###############/noetic_data/adddatatoaras?data="+cell); } } instead of calling spreadsheet id, in case attach script spreadsheet opening tools -> script editor -> blank project. open script editor can use onedit trigger code: function onedit(e){ var myran...

javascript - Parse HTML elements from an Iframe -

i have page few iframes in it. styles of iframes same want extract/parse html elements iframes. eg: images/header/logo/link is there way php or js? the iframe link secure server https not sure if can or not. any appreciated. thanks in advance

openstreetmap - How to convert a set of osm files to shape files using ogr2ogr in python -

i believe question asked can't find answer placing before you. having problem while running script convert osm files shp files. script reading osm files creating 1 shp file of first osm file @ end instead of converting osm files. providing code used below. please kindly me in resolving me this. from xml.dom import minidom import os, sys import xml.etree.elementtree et ### ruta gdal-data c:\program files (x86)\postgresql\9.4\gdal-data path = r"c:\users\administrator\desktop\checking\t2" systemoutput = 'shp' print ("\n#### execute python ny_osm2shapes") print ("#### monitoring cities") print ("#### conversor osm shapes") print ("#### osm path: " + path) print "#### " """ modify win: c:/program files/gdal/gdal-data/osmconfig.ini linux: /usr/share/gdal/1.11/osmconfig.ini report_all_ways=yes #activate lines without tag attributes=landuse, plots #inside [lines] attributes=landuse, plots #insi...

c# - Why does Select(x => ...Cast<x.GetType()>()) not work? -

why following code produce error? var listoflist = new list<list<string>>(); var tmp = listoflist.select(x => x.orderby(y => y).cast<x.gettype()>()); error: operator '<' cannot applied operands of type 'method group' , 'system.type' the code looks silly, because it's extremly simplified real example. wonder why not work exactly. works if replace x.gettype() list<string> , don't type of x @ runtime. clarification: don't necessary solution. want know wrong code. the correct way write code use tolist instead of cast mentioned elsewhere. however answer question "what wrong code?" there 2 specific points start with: using cast<x.gettype()>() : generics used compile time type variables, putting cast<list<string>>() make more sense here - x.gettype() resolved @ run time. guess message you're getting result of compiler getting muddled on point. attempti...

How do i update Seekbar mp3 progress every second with a thread?(code/pics included) Android -

Image
im trying seekbar update , show progress whenever play mp3 mediaplayer. music plays fine everytime, seekbar snap 0 position when mp3 playing. i trying follow answer wont work... seekbar , media player in android i have code in main activity private handler mhandler = new handler(); mainactivity.this.runonuithread(new runnable() { @override public void run() { if (assets.mediaplayer != null) { int mcurrentposition = assets.mediaplayer.getcurrentposition() / 1000; if(onionfragment.seekbar!= null) { onionfragment.seekbar.setprogress(mcurrentposition); } } mhandler.postdelayed(this, 1000); } }); in onionfragment have public static seekbar seekbar; seekbar = (seekbar) rootview.findviewbyid(r.id.seekbar); and in onionfragments onclick (the play button)i have assets.playmusicfile(mainactivity.items.get(mainactivity.selecteditem).getsongid(), ...

html - How can I remove this button?CSS -

i working on following site: link i have put clearer picture understand want remove. http://i57.tinypic.com/344biah.jpg how can remove particular button? i have tried following code button disappears. .products-grid .button-container { display:none; } if use code, button disappears along "add cart" button. want have circled in picture. thanks in advance! this 1 should work: .products-grid .regular .button-container { display:none; }

Regex in python doesn't match anything -

i have piece of code testing regular expressions in python. #!/usr/bin/python import re line = "(400,71.20,73.40) cats smarter dogs" matchobj = re.match( r'(\d{3}),(\d{2}.\d{2}),(\d{2}.\d{2})', line,re.i) if matchobj: print "matchobj.group() : ", matchobj.group() print "matchobj.group(1) : ", matchobj.group(1) print "matchobj.group(2) : ", matchobj.group(2) else: print "no match!!" it's supposed print 3 groups (400)(71.20)(73.40) , instead prints "no match!!" . can me? thanks in advance it's because of function re.match tries match start of string. since there unmatched ( present @ start, regex fails. adding pattern match starting ( symbol in re.match solves problem. re.match( r'\((\d{3}),(\d{2}\.\d{2}),(\d{2}\.\d{2})', line) and re.i unneceassry here since matching chars other alphabets. or i suggest use re.search match substring exists anywhere. re.s...

c# - Setting Binding in code to Text property on TextBox WPF not working -

i have following xaml in usercontrol: <stackpanel orientation="horizontal" name="spcontainer"> <textblock x:name="tblabelbefore" minwidth="50" text="{binding labelbefore}"></textblock> <textbox name="txtkey" minwidth="120"></textbox> <textblock name="tbvalue" minwidth="50"></textblock> </stackpanel> next want set binding dynamically text property on textbox-txtkey from proxy class . i following: mdlookup lok = selectedobject mdlookup; string bnd = "model."+ lok.name +".value"; binding binding = new binding(bnd); binding.updatesourcetrigger = updatesourcetrigger.propertychanged; //binding.validatesondataerrors = true; //binding.notifyonvalidationerror = true; binding.mode = bindingmode.twoway; lok.txtkey.setbinding(textbox.textproperty, binding); here lok instance of user control. , txtkey pro...

sqlite3 - Android 4.4 and above version how to insert record in SQLite database on SD card -

i have read , write sqlite database on sd card (not in internal storage). i'm familiar sqlite pattern: database = sqlitedatabase.opendatabase("mnt/sdcard2/test/temp/abcd.db",null, sqlitedatabase.open_readwrite); and sure "abcd.db" exists on sdcard. but following error: cannot open file @ line 30217 of [00bb9c9ce4] failed open database '/mnt/sdcard2/test/temp/abcd.db' android.database.sqlite.sqlitecantopendatabaseexception: unknown error (code 14): not open database this code working fine android 4.2.* , below. i'm having problem android version 4.4 , above. please me. thanks. since android 4.4 can't freely access sd card outside of apps package directory. follow instructions https://source.android.com/devices/storage/index.html , change path on sd card according example given for example, app package name com.example.foo can freely access android/data/com.example.foo/ on external storage dev...

c++ - parse collection of single integers into floats -

so slurped in file numbers in like: 39.00 vector<std::string> , need convert groups of numbers 3 9 0 0 form 39.00 heres small sample. 3 4 5 0 1 2 5 0 3 4 0 0 3 4 9 0 7 0 0 0 8 0 0 0 9 0 0 0 6 5 0 0 3 9 3 2 1 1 2 0 0 0 2 5 0 0 3 0 9 0 4 0 0 0 5 5 5 0 2 0 0 0 2 5 0 0 3 0 9 0 4 0 0 0 5 5 5 0 2 2 3 0 0 0 2 4 0 0 4 5 0 0 6 7 0 0 6 5 5 0 5 6 9 0 8 7 0 0 4 3 5 0 5 6 9 8 5 5 4 0 3 3 6 2 0 0 3 4 5 0 1 2 5 0 3 4 0 0 3 4 9 0 7 0 0 0 8 0 0 0 9 0 0 0 6 5 0 0 3 9 0 3 2 1 1 2 0 0 0 2 5 0 0 3 0 9 0 4 0 0 0 5 5 5 0 2 0 0 0 2 5 0 0 3 0 9 0 4 0 0 0 5 5 5 0 2 2 3 0 0 0 2 4 0 0 4 5 0 0 6 7 0 0 6 5 5 0 5 6 9 0 8 7 0 0 4 3 5 0 5 6 9 8 5 5 4 0 3 3 6 2 0 0 3 4 5 0 1 2 5 0 3 4 0 0 3 4 9 0 7 0 0 0 8 0 0 0 9 0 0 0 6 5 0 0 3 9 0 0 transformed 34.50 12.50 34.00.... my goal find average of floats. of course if there way slurp file while keeping formatting using standard library cool too. #include <iostream> #include <string> #include <fstream> #include <streambuf> #i...

javascript - installing Hellobar causing 501 method not implemented -

i've installed hellobar( https://www.hellobar.com ) in site after of requests js images css,json outputs , ajax requests etc showing 501 method not implemented error when clear cookie fine, @ particular time ajax etc fine when refreshed again 501 method not implemented error i using codeigniter hellobar installation adding script before </body> tag how solve error?

python - Does gevent has a basic http handler? -

i trying build basic web server using gevent.server, , curious know there basehttphandlers, can use. yes, gevent comes 2 http server implementations can use: gevent.wsgi - fast, libevent-based implementation, providing limited features. gevent.pywsgi - slower, pure gevent implementation, providing more features (streaming, pipelining, ssl). here simple example (extracted gevent documentation): #!/usr/bin/python """wsgi server example""" __future__ import print_function gevent.pywsgi import wsgiserver def application(env, start_response): if env['path_info'] == '/': start_response('200 ok', [('content-type', 'text/html')]) return [b"<b>hello world</b>"] else: start_response('404 not found', [('content-type', 'text/html')]) return [b'<h1>not found</h1>'] if __name__ == '__main__': ...

python - Making NLTK work for UTF8 punctuation? -

i started using nltk , noticed doesn't work non-ascii punctuation. example, “ being tagged noun. also, having non-ascii punctuation messes pos tagging rest of words because nltk interpreting “ word instead of punctuation. is there setting can allow nltk recognize non-ascii punctuation? since having single non-unicode punctuation messes pos tagging entire document, can't replace every “ " . i'm not aware of such setting. but have similar issues pos-tagging non-plain-text (text augmented xml-like tags in between). these xml-tags not pos-tagged correctly. take them out before start pos-tagging, keep track of indices , re-insert them after tagging (and assign them proper tag manually). arguably, presence or absence of punctuation won't change nltk's pos-tagging output much, try same. since guess set of 'problematic' punctuation characters pretty limited?

python - Strange... What does [::5,0] mean -

i found webpage explaining how use set_xticks , . set_xticklabels . and set set_xticks , 'set_xticklabels' following... ax.set_xticks(xx[::5,0]) ax.set_xticklabels(times[::5]) ax.set_yticks(yy[0,::5]) ax.set_yticklabels(dates[::5]) what [::5,0] mean.. i don't have idea..... for numpy array, notation [::5,6] means take 6th column array , in 6th column, every 5th row starting @ first row till last row. example - in [12]: n = np.arange(100000) in [17]: n.shape = (500,200) in [18]: n[::1,2] out[18]: array([ 2, 202, 402, 602, 802, 1002, 1202, 1402, 1602, 1802, 2002, 2202, 2402, 2602, 2802, 3002, 3202, 3402, 3602, 3802, 4002, 4202, 4402, 4602, 4802, .....]) in [19]: n[::5,2] out[19]: array([ 2, 1002, 2002, 3002, 4002, 5002, 6002, ...]) reference on numpy array slicing here , if interested.

r - Plot a histogram of subset of a data -

Image
! the image shows screen shot of .txt file of data. data consists of 2,075,259 rows , 9 columns measurements of electric power consumption in 1 household one-minute sampling rate on period of 4 years. different electrical quantities , sub-metering values available. only data dates 2007-02-01 , 2007-02-02 needed. trying plot histogram of "global_active_power" in above mentioned dates. note in dataset missing values coded "?"] this code trying plot histogram: { data <- read.table("household_power_consumption.txt", header=true) my_data <- data[data$date %in% as.date(c('01/02/2007', '02/02/2007'))] my_data <- gsub(";", " ", my_data) # replace ";" " " my_data <- gsub("?", "na", my_data) # convert "?" "na" my_data <- as.numeric(my_data) # turn numbers hist(my_data["global_active_power"]) } after running code sho...

c# - Clicking a button on a DataGridView Cell Button triggers all the cell button commands in the row -

i have datagridview 9 columns. column index 4 , 8 cell buttons. when click on button index 4 execute command given execute command given button index 8. either way ever button click (4 or 8) execute action 1 action 2 private void dgvitems_cellcontentclick(object sender, datagridviewcelleventargs e) { var sendergrid = (datagridview)sender; if (sendergrid.columns[4] datagridviewbuttoncolumn && sendergrid.rows[e.rowindex] datagridviewrow) { messagebox.show("action 1: column index " + e.columnindex + "; row index " + e.rowindex); } if (sendergrid.columns[8] datagridviewbuttoncolumn && sendergrid.rows[e.rowindex] datagridviewrow) { messagebox.show("action 2: column index " + e.columnindex + "; row index " + e.rowindex); } } just check current column e.columnindex . correct if condition as: if (e.columnindex == 4) messagebox.show("action 1: column index " + ...

django - FB Graph API redirect on login isn't working -

i running facebook app on django server. index page @ localhost:8000/b/ , contents are: <!doctype html> <html lang="en-us"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body ng-app="mainapp" ng-controller="mainctrl"> <div id='fb-root'></div> <button id='login-container' class="btn" ng-click="myfacebooklogin()">login facebook</button> </body> <script type='text/javascript'> var app = angular.module('mainapp', []) app.controller('mainctrl', function($scope) { $scope.myfacebooklogin = function () { fb.getloginstatus(function(response) { console.log(response) if (response.status !== 'connected') { fb.login(function() {}, {s...

c# - Load array of textures into individual Image components into a grid layout in Unity 4.6 (using uGUI) -

Image
i'm having lot of trouble trying develop loader grabs group of textures located in array , populates them grid layout. share code insight or snippet might trick? lets want show images in format below. can merging images 1 big texture2d (but know image size should not exceed 2048x2048) the function below should work: private texture2d concattexture(texture2d[,] textures, int imagewidth, int imageheight) { int rowcount = textures.getlength(0); int columncount = textures.getlength(1); //space allocation final texture texture2d finaltexture = new texture2d(columncount * imagewidth, rowcount * imageheight); (int = 0; < rowcount; i++) for(int j=0 ; j < columncount ; j++) finaltexture.setpixels(j * imagewidth, (rowcount-i-1) * imageheight, imagewidth, imageheight, textures[i, j].getpixels()); return finaltexture; } you can edit code , put spaces between images if looking for.

javascript - Angular http get not working -

i'm doing testing api in apiary.io , wanted call data angular, doesn't seem call correctly. should pretty simple, i'm not sure whats wrong: html: <span><a href="network-updates.html">{{user.text}}</a></span> js: var maincontroller = function($scope, $http){ var usercomplete = function(response){ $scope.user = response.data; }; $http.get("http://private-abc123-.apiary-mock.com/bus") .then(usercomplete); }; json: { "header" : "heading", "text" : "hello" } this works me out of box try: (this solution no longer correct, see update below) var = angular.module('a', []); a.controller('dbctrl', ['$scope', '$http', function ($scope, $http) { $scope.loaddata = function () { $http.get("url") .success(function(data){ $scope.data = data; //return if success on fetch }) .error(fu...

intellisense - VS Code autocompletion base on word in file -

i begin vs code , i'm happy @ moment ! i'm coming notepad++ , didn't found ide @ same "level" of things i'm doing.. until now! vs code doing , how modern integrated technology helping me. but miss 1 thing npp autocomplete base on word in file. can same in vs code ? thanks. add settings.json, , restart vs code: // controls how javascript intellisense works. // include words current document. "javascript.suggest.alwaysallwords": true, // complete functions parameter signature. "javascript.suggest.usecodesnippetsonmethodsuggest": true

javascript - Select query usingTaffyDB not working -

i'm starting play around taffydb , it's acting funny...and don't know if that's because i'm doing wrong or what. <html> <head> <script src="taffydb-master/taffy.js"></script> </head> <body> <script> var people = taffy([{name:"george", address:"foobar st."}, {name:"carl", address: "foo st."}, {name: "kyle", address:"baz st."}]); document.write(people().first()); </script> </body> </html> this returns , don't know why. want return whole thing. [object object] any suggestions?

html - Bootstrap - Vertically Align Button With Well -

i have , trying vertically align button on right of it. guess use traditional css, i'd rather not run risk of breaking bootstrap. <div class='container'> <div class='row top-buffer'> <div class='col-md-10'> <a href='#' id='dl'>v0.0.1 - july 11, 2015 | 20:15:34</a> <p>note: beta available until<br>august 8, 2015 @ 11:59pm pst</p> </div> <div class='col-md-2 vcenter'> <button type="button" class="btn btn-primary btn-lg pull-right">download</button> </div> </div> </div> jsfiddle you have use col-xs class make possible have on js fillde have created : `https://jsfiddle.net/2w4lc5l7/`

Using R to extract specific column in Azure ML -

i have created forecasting causal model in azure ml studio determines organization's hiring needs every month 2015. since causal model, individually forecast parameters 2015 , supply them model. one such factor previous 9 months hire value. means if forecasting hire value jan-2015, previous 9 month hire values considered (dec - april 2014). the following parameter set: year month factor factor b factor c factor d prev. month-1 prev. month-2 prev. month-3 prev. month-4 prev. month-5 prev. month-6 prev. month-7 prev. month-8 prev. month-9 sample input: year month factor factor b factor c factor d prev. month-1 prev. month-2 prev. month-3 prev. month-4 prev. month-5 prev. month-6 prev. month-7 prev. month-8 prev. month-9 2015 1 2 4 6 8 10 11 12 13 14 15 16 17 ...

node.js - I've installed meteor - where is npm? -

i've installed meteor on machine: curl https://install.meteor.com/ | sh my understanding meteor runs off of node.js , automatically installs it. , node automatically installs npm . i'm working through discover meteor tutorial , has me run: npm install -g mup but following output: -bash: npm: command not found do need run different directory? or download / install onto machine. add path? when install meteor, does not automatically install node && npm. when installing meteor, download called dev_bundle has nodejs , npm modules needed meteor. these modules pre-compiled platform not "installed" per-se. check out post if want use node distribubtion included meteor: https://meteorhacks.com/how-meteor-uses-node . suggest install node on own, though.

limitation on FusedLocationProviderApi Android -

my app using android.location.locationmanager network , gps locaitions. due high battery consumption. decided switch fusedlocationproviderapi . i'm worried impact on current users. since api requires google play service. there statistics on percentage of android devices have google play service installed? there other things consider might cause current users unable use app after switch? if user able access play store , google play services installed. below play services description play store 'google play services used update google apps , apps google play. component provides core functionality authentication google services, synchronized contacts, access latest user privacy settings, , higher quality, lower-powered location based services. google play services enhances app experience. speeds offline searches, provides more immersive maps, , improves gaming experiences. apps may not work if uninstall google play services.' https://android.stackexchange....