Posts

Showing posts from May, 2013

gruntjs - Grunt index file not running -

i trying index.html @ root of app (app/index.html) running grunt file inherited. my grunt file follows: module.exports = function(grunt) { // 1. configuration goes here grunt.initconfig({ pkg: grunt.file.readjson('package.json'), sass_directory_import: { your_target: { files: { src: ['css/sass/parts/_all.scss'] }, }, }, connect: { server: { options: { port: 9000, hostname: 'localhost', base: ['./'], keepalive: true, open: { target: 'http://localhost:9000' } } } }, sass: { dist: { options: { loadpath: require('node-bourbon').includepaths, sourcemap: true }, files: { 'css/style.css' : 'css/sass/style.scss', 'css/style-ie.css' : ...

JavaScript img src based on function variable -

i trying src of image based on sky+gatmap()+.jpg src supposed sky#.jpg # value of getmap(). having trouble quotation or something, doing wrong here? <script type="text/javascript"> document.write("<img id='sky' src='sky+mapnum()+.jpg' alt='' />"); </script> this case problem out of javaxcript book. doesn't tell me how this. <script type="text/javascript"> document.write("<img id='sky' src='sky"+mapnum()+".jpg' alt='' />"); </script>

eclipse - android emulator displays 4 screens -

i have problem android emulator, when executed displays 4 screens. tried make a new device many times different settings same problem appears. the problem details http://s31.postimg.org/w9mfc2osb/nav10.jpg i'm using: eclipse 4.4.2 os: linux debian jessie the problem disappeared after using host gpu image link thanks @commonsware

Python: Trying to import a loop -

i new programming python , have difficulties importing loop created in order manipulate data. specifically, in main script have following code: wb=xw.workbook('/census/b05.xls') numbers=range(16,56) multiples8=range(16,56,8) data=list(set(numbers)-set(multiples8)) import loop1 after run command import loop1 , error: file "<ipython-input-15-d5d478cf704f>", line 10, in <module> import loop1 file "loop1.py", line 8, in <module> x in set(data): nameerror: name 'data' not defined. the loop1 script reads: for x in set(data): if x-1 in set(multiples8): xw.range('sql results','l'+str(x-1)+':s'+str(x-1)).value=xw.range('sql results','d'+str(x)+':k'+str(x), atleast_2d=true).value else: if x-2 in set(multiples8): xw.range('sql results','t'+str(x-2)+':aa'+str(x-2)).value=xw.range('sql results','d'...

android - No compilation Error but aplication is terminating at runtime -

i have problem. when emulate print_row(int character, int weight, string code) starting , see this: "aplication has stopped unexpectedly". i don't understand why! there no mistakes @ compilation. look @ comments in code below... public class mainactivity extends activity { private static final string tag = "myactivity"; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); btncoder = (button) findviewbyid(r.id.btncoder); btndecoder = (button) findviewbyid(r.id.btndecoder); incomestr = (edittext) findviewbyid(r.id.incomestr); tvresult = (textview) findviewbyid(r.id.tvresult); .... } public void print_row(int character, int weight, string code) { log.d(tag,(char)character +" "+ weight +" "+ code); // it's work! table = (tablelayout) findviewbyid(r.id.table); //on row terminate... textview lecter = new textview(getapp...

ghostscript - How to convert PDF to Image without generating a file -

based on code how-to-convert-pdf-to-image-using-ghostscript-api i trying figure out how image foreach page without creating files to image foreach page setted outputtomultiplefile = true . then went step step through code wasn't able find part files created. want know need change in code? or else helps achieve this edit here current parameters: args[0] = args[1] =-dnopause args[2] =-dbatch args[3] =-dsafer args[4] =-sdevice=pnggray args[5] =-r130 args[6] =-soutputfile="c:\scannen1.pdf%d.png" args[7] ="c:\scannen1.pdf" you need use device doesn't write file, all image format devices write output file. use display device return bitmap in memory template , write own device, or can modify 1 of existing devices. modifying existing device task developer , while not excessively difficult not trivial either. in event, aren't going want fiddling command line switches. sinatr i'm puzzled can usefully ghostscript doesn...

Task.WaitAny degenerate case behaviour -

i can't find documentation behaviour of task.waitany() under following scenarios: given empty array of tasks. given array of tasks, of 1 has completed. given array of tasks, of have completed. my assumption 2 & 3 return (#3 picking arbitrary index return, first or last 1 depending on implementation detail not guaranteed.) , i'd sorta expect 1 return true? some brief unit tests seem confirm this... following pass. if can find formal documentation of behaviour, i'd glad see it. (even if improve ability locate myself next time!) using system; using system.collections.generic; using system.linq; using system.threading.tasks; using nunit.framework; using system.threading; namespace tantest.threading { [testfixture] public class metatasktests { private const int safetimeoutmillisecs = 1000; [test, timeout(safetimeoutmillisecs)] public void meta_newtaskcompletes() { var task = new task(() => { }); task.start(); ...

Clicking on javascript anchor with htmlunit does not fetch response -

so, i collected anchors of page in list of htmlanchors . list<htmlanchor> downloadlinks = (list) loggedin.getbyxpath("//*[@id='ctl00_contentplaceholder1_rgdproduction_ctl00']//a"); and then, went in loop click on each anchor in list , tried fetch respective web responses. for (int = 1; < downloadlinks.size(); i++) { page p = (page) downloadlinks.get(i).click(); webresponse wr = p.getwebresponse(); system.out.println("page content: " + wr.getcontentasstream()); } *note: anchors collected of format -> href = "javascript:_some_methodname_() the problem after clicking on each anchor in list of anchors, fetches same exact web response whereas should have presented 'n' unique responses 'n' anchors similar question has been asked other users, haven't found solution problem.

mysql - Row to column transform -

after multiple join, have raw results. +----------------------------------------------------------------------+ | results | +----+----------+-------------+----------+-----------+-----------------+ | id | group_id | question_id | question | answer_id | answer | input | +----+----------+-------------+----------+-----------+-----------------+ | 1 | 10001 | 1 | how old | 1 | 25 | null | | 2 | 10001 | 2 | like| 3 | cola | null | | 3 | 10001 | 2 | like| 4 | other | hotdog | | 4 | 10001 | 3 | city | 5 | nyc | null | | 5 | 10001 | 4 | name | 7 | other | alex | | 6 | 10002 | 1 | how old | 1 | 25 | null | | 7 | 10002 | 2 | like| 6 | candy | null | | 8 | 10002 | 3 | city | 8 | la | null | | 9 | 10002 |...

SoundCloud API returns 401 or 403 on some tracks for some client ids -

this sound cloud api call returns 401: https://api.soundcloud.com/tracks/21402225/stream?client_id=619ab3605c6ce729b96c341a2f6e6ef5 this sound cloud api call return 403: api.soundcloud.com/resolve?url=https://soundcloud.com/blondesound/feel-good-extended&client_id=619ab3605c6ce729b96c341a2f6e6ef5 someone said due permission settings. however, created soundcloud track myself , toggled permission settings, still couldn't reproduce same error. i created soundcloud developer account or soundcloud app, , tried access track above, still got error 401 or 403. could me successful api call? users able restrict access tracks not accessible on api. has happened here.

regex - Accessing a specific part of a line with regular expressions -

i'm having trouble figuring out how regular expressions, want this. basically have file , i'm reading line line , each line in file looks this. "hello data relatively useless 237 12375" now want test see if value before last value within range , if print out first word in line. my main issue is there way access word before last word in line? assuming quotes not there , last 2 pieces digits like: (\d+)\s(?:\d+) ie. match number of digits long followed space , other digits try

excel - Why do I need to have the VBA editor window open for my macro to work? -

i have excel file in vba macro loads data userform. the macro never crashes if first open visual basic editor (by clicking developer -> visual basic), crash , close excel if run without editor open. it's though opening vba editor activates macro , enables work properly. i'm trying narrow in on why case , how fix file don't need first open editor. ideas? edit: don't understand why i'm being downvoted. sample code macro: public sub loadbutton_click() 'policy information zonelatitudetextbox.text = sheets("saved policy values").cells(2, 2) zonelongitudetextbox.text = sheets("saved policy values").cells(3, 2) townclasscombobox.text = sheets("saved policy values").cells(4, 2) this thread provided me answer question: http://www.xtremevbtalk.com/excel/229325-excel-crashes-unless-vba-editor.html apparently excel runs memory issues when there userform has many controls. opening vba ed...

android - How to connect pybluez RFCOMM server socket on Debian? -

i have these snippet in python pybluez framework: from bluetooth import * server_sock=bluetoothsocket( rfcomm ) server_sock.bind(("",port_any)) server_sock.listen(1) port = server_sock.getsockname()[1] uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee" advertise_service( server_sock, "sampleserver", service_id = uuid # service_classes = [ uuid, serial_port_class ], # profiles = [ serial_port_profile ], # protocols = [ rfcomm_uuid ] ) print "waiting connection on rfcomm channel %d" % port client_sock, client_info = server_sock.accept() print "accepted connection ", client_info try: while true: data = client_sock.recv(1024) if len(data) == 0: break print "received [%s]" % data except ioerror: pass print "disconnected" client_sock.close() server_sock.close() print "all done"...

openerp - Please how to set fix size of box in form view odoo 8 -

Image
how can fix size of box in form view on 0doo 8 in `xmlù group : <field name="taxe"/> in py file : 'taxe' : fields.selection([('17','17 %'),('12','12 %'),('10','10 %')],'taxe etablissement'), you can use attribute style on xml field definition, example: <field name="field_x" style="width:50%%" /> or <field name="field_y" style="width:100px" /> percentage use space given parent element. if uses 2 columns layout (typical odoo groups) 50% use 25% of full width. don't forget escape '%'.

wpf - Create itemscontrol multiple times with different lists -

Image
i'm trying print 5 albums , every album print its' songs checkbox near every song. (i recommend see image published below) tried itemscontrol don't know how every itemscontrol bind list (with specific album's songs). i made 5 albums within for loop. my problems are: for every album how create itemscontrol its' specific songs' list. every time check checkbox checks checkboxes in its' row (all other albums). here code of single itemscontrol : <itemscontrol grid.column="1" itemssource="{binding}" grid.issharedsizescope="true" margin="12 0 12 0"> <itemscontrol.itemtemplate> <datatemplate datatype="{x:type domain:selectableviewmodel}"> <border x:name="border" padding="8"> <grid> <grid.columndefinitions> ...

php - How to optimize this mySQL query in terms of performance? -

how can optimize follow query ? select hash,page,timestamp, count(*) total behaviour group hash, page having total > 2 , timestamp >= now() - interval 5 minute thank you this query it's not wrong. maybe bigger volume, have problem performance. try use "where conditions" always. (in context, don't know if possible). tip, explain on query! use "explain" before query. (explain select hash, timestamp, count(*)........). in way, can discover how many results query returned.

android - Error having 2 fragments with SupportMapFragment -

so, have activity holds tabs, each tab has fragment assigned it, can navigate through fragments using tabs. in 2 of these tabs have load map (with different information on each of them, different pins, etc) problem loads first one, i'm using code assigning each tab fragment desired (this adapter working fine). @override public fragment getitem(int pos) { switch (pos) { case 0: return new searchfragment(); case 1: return new parkfragment(); case 2: setactivesessionsfragment(); return mactivesessionsfragment; case 3: return new choosepaymentmethodfragment(); default: return new parkfragment(); } } being case 0 , 2 ones loading map, if substitute of these other fragment 1 map works fine, if leave both app crashes. in both fragments i'm loading map in framelayout one: <framelayout android:layout_width="fill_parent" android:layout_he...

c# - Multiple Request Parallel and Observable collection -

how add task observablecollection? anytime loops replaces items in collection. want loop , store 4 items i.e. 8 items in total. loop again , add 4 items instead of replacing first items. supposed return photos if effort because of implicit conversion conflict between int , observable collection. ps. still maintain multiple request in parallel private async task<int> processurl(string url, httpclient client) { httpresponsemessage response = await client.getasync(url); var responsecontent = await response.content.readasstringasync(); htmldocument htmldocument = new htmldocument(); htmldocument.loadhtml(responsecontent); observablecollection<photo> photo = new observablecollection<movie>(); foreach (var div in htmldocument.documentnode.descendants().where(i => i.name == "div" && i.getattributevalue("class", "").startswith("ml-item"))) { stri...

applescript - Sending and receiving "raw" Apple Events from JavaScript on OS X (El Capitan) -

i trying make use of new javascript automation feature in os x (10.11) script application not offer dictionary. have applescript interacts application using raw apple events, so: tell application "bookends" return «event toyssqls» "authors regex 'johnson' " end tell now question is: how translate javascript? cannot find information on javascript osa api send , receive raw apple events. one possible workaround might call piece of applescript through shell , prefer work "real" api. you can @ least faster shell script call using osakit in couple of helper functions: // evalosa :: string -> string -> io string function evalosa(strlang, strcode) { var oscript = ($.osascript || ( objc.import('osakit'), $.osascript)) .alloc.initwithsourcelanguage( strcode, $.osalanguage.languageforname(strlang) ), error = $(), blncompiled = oscript.compileandret...

python 2.7 - Using os.listdir(), see if an object is a file or a directory -

here code wrote: import os item in os.listdir("c:/"): if os.path.isfile(item): print(item + " file") elif os.path.isdir(item): print(item + " dir") else: print("unknown!") response: unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! unknown! process finished exit code 0 what did wrong. think maybe because folder locked or encrypted. please give hand! thanks lot you need pass complete path isfile() , isdir() . import os path = "c:" item in os.listdir(path): item = os.path.join(path, item) if os.path.isfile(item): print(item + " file") elif os.path.isdir(item): print(item + " dir") else: print("unknown!")

javascript - Strange SVG hover behavior -

i'm working on svg map representing different districts of lower austria. problem is, :hover event on group sections of time not reacting. <svg height="401" id="noe" viewbox="4 436 413 401" width="413"> <style> .district path { fill: none; stroke: #6e6e6e; stroke-width:0.5; } .district:hover path { fill: #3498db; } .outline path { fill: none; stroke: #6e6e6e; stroke-width:1; } </style> <g class="district" district:id="ks"> <path d= "m 192.72,581.02 l 191.52,582.46 l 192.48,587.74 l 197.04,589.42 l 197.52,593.26 l 205.2,595.659 l 204.48,597.099 l 199.2,598.059 l 196.32,598.299 l 194.64,596.619 l 190.56,598.059 l 192.24,596.139 l 190.56,595.419 l 191.28,590.38 l 186.96,591.1 l 180,593.74 l 179.76,589.9 l 175.921,589.66 l 174.721,588.22 l 175.681,587.02 l 175.201,583.42 l 182.401,584.14 l 185.041,5...

postgresql - Restarting Primary Key -

here situation: i have table gets truncated once week , new values placed in it. what want do: i want add primary key starts @ 1 , increases 1 each row in table gets inserted. when table gets truncated, want count start @ 1. is possible? use serial column , use option restart identity truncate table foo restart identity http://www.postgresql.org/docs/current/static/sql-truncate.html

Run PHP script from Java and capture the output -

i need run php script java class , output of script in order notify end user of results. use runtime.getruntime.exec("php "); in order execute php script, how capture console output? any suggestions? the output of process can found using getinputstream on returned process exec call.

php - Wordpress - Save values to array upon form submit in admin option page -

i have done successful first time plugin, unfortunately cannot submit updated values array i've created upon register_activation_hook. i need insights in how wordpress can handle dirty work - or $_post better way it? below you'll see admin.php handles admin related stuff. <?php // meaning of abbreviations: // clsc = custom login shortcode // runs when plugin activated register_activation_hook( plugin_main_file, 'clsc_install'); // create new database fields function clsc_install() { $clsc_options = array( 'login_link' => '/log-in/', 'login_string' => __('log in', 'clsc'), 'login_class' => '', // default empty inherit theme styles 'logout_link' => wp_logout_url( home_url()), 'logout_string' => __('log out', 'clsc'), 'logout_class' => '', // default em...