Posts

Showing posts from August, 2011

javascript - Sub-menu not showing up after screen resize -

i'm trying build custom responsive navigation changes 100% width pulldown menu mobile. have javascript hides sub menu items may open if window resized new breakpoint (it changes @ 768px). however, if open sub menu @ mobile size (less 768px) , resize window hover effect doesn't work , sub menu items not show on larger screen size. here jsfiddle of stripped down version of navigation https://jsfiddle.net/5h5bhwu4/2/ the part think might causing problem javascript: if (w > 768) { $("#nav > li > ul").hide(); } if click on first menu item @ low screen size, resize window not show same sub menu when hover on parent item. if start @ larger screen size (or if don't open sub menu in low screen size) work fine. think problem in javascript can't see stop sub menu showing. you need hover effect on js, not on css. when see size of window: if (w > 768) { $("#nav > li > ul").hide(); // put hover her

java - How to get all links from google -

i trying of links songs on side of google after search band , album ex: https://www.google.com/search?q=disturbed+asylum&ie=utf-8&oe=utf-8 so have tried quite bit on own. i've used: file input = new file("/tmp/input.html"); document doc = jsoup.parse(input, "utf-8", "http://example.com/"); elements links = doc.select("a[href]"); and printed out of links, didn't links side way. tried html code , search table through there didn't pull table reason. have suggestions? i think question has been asked here : java crawlers is looking for?

Python Django 1.7 Ubuntu 14.04 how do I deploy a django site on azure? -

i'm trying deploy django site azure cloud it's not working. far, i've gone through tutorial here ( https://github.com/azure/azure-content/blob/master/articles/web-sites-python-create-deploy-django-app.md ) no luck. i created webapp. made django application. i'm using ubuntu 14.04, django 1.7, git, , python 2.7.6. my root directory local django site is /home/user/documents/aptana studio 3 workspace/mysite/ i went directory , did following commands. sudo git init sudo git add . sudo git commit -m "comment" sudo git remote add azure https://username@mysite.scm.azurewebsites.net:443/mysite.git sudo git push azure master it goes through deployment , shows copying files says after few copies. remote: omitting next output lines... remote: finished successfully. remote: deployment successful. but doesn't show files being uploaded. in azure portal says website has been deployed, i'm not getting website when go link; instead getting django

date - Perl - Calculate difference between two timestamps -

i trying calculate difference between 2 timestamps in following format: 15:45:30.125 i have tried using date::parse package in perl following: my $s1 = str2time( $timestamp1 ); $s2 = str2time( $timestamp2 ); and subtracting $s1 , $s2 find difference rounding nearest second rather including milliseconds... there alternative or way of including millisecond count when subtracting values? i recommend use time::hires::value module supports arithmetic on objects contain separate second , microsecond values — same value returned time::hires::gettimeofday . provides convenient stringification overload you need write simple parsing subroutine though, this use strict; use warnings; use time::hires::value; $t0 = parse_time('15:45:30.125'); $t1 = parse_time('18:12:46.886'); print $t1 - $t0; sub parse_time { ($h, $m, $s, $ms) = shift =~ /\d+/g; time::hires::value->new(($h * 60 + $m) * 60 + $s, $ms * 1000); } output 8836.761000

Is it possible to run Spring Security from vaading4spring together with Vaadin Spring Boot? -

is possible run spring security vaading4spring vaadin spring boot? when mix both @ build.gradle as // official vaadinspring integration compile("com.vaadin:vaadin-spring:1.0.0.beta2") compile("com.vaadin:vaadin-spring-boot:1.0.0.beta2") compile("com.vaadin:vaadin-spring-boot-starter:1.0.0.beta2") // supporting (unofficial) vaadin4spring compile("org.vaadin.spring:spring-vaadin:0.0.5.release") compile("org.vaadin.spring:spring-boot-vaadin:0.0.5.release") compile("org.vaadin.spring:spring-vaadin-security:0.0.5.release") new annotations (such @springui) not work. when remove compile("org.vaadin.spring:spring-vaadin:0.0.5.release") compile("org.vaadin.spring:spring-boot-vaadin:0.0.5.release") from build.gradle, i got exception says caused by: org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [org.vaadin.spring.http.httpservice] found dependency: ex

android - Graphical Layout Editor instantiating custom view but when ran and adding my own custom view via Java, nothing shows -

so when add custom view, layer (look below class), relative layout doesn't show up i have method change layer public void setcurrentlayer(int currentlayer) { this.currentlayer = currentlayer; this.removeallviews(); addview(getlayer(currentlayer)); } layer class: public layer(context context, attributeset atrbset) { super(context, atrbset); setbackgroundcolor(color.cyan); this.atrbset = atrbset; leveltiles = new tile[width][height]; } public void generatelayer(int layernumber) { if (layernumber == 0) { (int y = 0; y < height; y++) (int x = 0; x < width; x++) { leveltiles[x][y] = new grass(this.getcontext(), atrbset); addtiletolayer(new grass(this.getcontext(), atrbset)); } } else { (int y = 0; y < height; y++) (int x = 0; x < width; x++) { leveltiles[x][y] = new stone(this.getcontext(), atrbset); addtiletola

silverlight - Exception - "Value does not fall within the expected range.inPage.xaml" -

i create app on windows phone 8 use mvvmcross , async sqlite.net. when go page exception: system.argumentexception: value not fall within expected range.inpage.xaml'. @ system.windows.navigation.pageresourcecontentloader.endload(iasyncresult asyncresult) @ system.windows.navigation.navigationservice.contentloader_beginload_callback(iasyncresult result) @ system.windows.navigation.pageresourcecontentloader.beginload_onuithread(asynccallback usercallback, pageresourcecontentloaderasyncresult result) @ system.windows.navigation.pageresourcecontentloader.<>c__displayclass4.<beginload>b__0(object args) how determine source of problem? had errors too. visualstate value not converted. copied example my answer here <discreteobjectkeyframe keytime="0:0:0" value="true"/> versus <discreteobjectkeyframe keytime="0:0:0"> <discreteobjectkeyframe.value> <system:boolean>true</system:boolean>

php - Creating a Wordpress Child Theme -

i having issue , hoping might have suggestion me. trying create child theme can make changes styles , page functions in wordpress v 4.1.1 my issue when activate child theme site goes blank (white) , visible wordpress admin panel toolbar @ top of screen. followed instructions here https://codex.wordpress.org/child_themes my parent theme called qk_theme located @ wp-contents/themes/qk_element so created new folder wp-contents/themes/qk_element-child in new folder have style.css file contains /* theme name: qk_element child theme uri: example.com description: child theme based on qk_elemen author: jay author uri: none template: qk_element version: 1.0 tags: light, gray, white, custom background, custom menu, editor style, featured images, flexible header, full width template, microformats, post formats, rtl language support, sticky post, theme options, translation ready text domain: qk_element-child */ then have functio

c# - WebApi Attribute Routing for URLs with *.js -

ok it's not that funny ending... i trying emulate ror-based service in .net webapi. ruby implementation of service supposed return json document url of: http://myserver/api/assessments/{id}.js note .js @ end. i made routeattribute decoration on api controller so: [route("~/api/assessments/{id}.js")] public async task<httpresponsemessage> getassessment(int id) { . . . } ...but i'm getting 404 error. suspected might because request ended in "js", after bit of research found should set routecollection.routeexistingfiles true ... did not seem have effect. still getting 404. am right? .js ending causing 404? how can around this? pure webapi project, it's not i'm using javascript in anyway. do have following in web.config? setup routing project work , line caused me sorts of hell because not present: <configuration> ... <system.webserver> <modules runallmanagedmodulesforallrequests=&q

Complex data types in java -

i have designed data type called bingocard create random bingo card. i'm trying make bingocard array keep getting error on line: system.out.println(currentcard[i].tostring()); i'm wondering if i've created array correctly or doing wrong? in advance. public class bingogame { private int[] counter; private boolean done = false; private int numofcards; private int fastestcard; public bingogame(int num){ numofcards = num; counter = new int[numofcards]; } public int play(){ for(int a=0;a<numofcards;a++){ counter[a] = 0; } bingocard[] currentcard = new bingocard[numofcards]; while(!done){ for(int i=0;i<numofcards;i++){ system.out.println("this current card:"); system.out.println(currentcard[i].tostring()); int currentnum = (int)(math.random() * 75) + 1; counter[i]++; currentcard[i].currentnumber(currentnum); currentcard[i].bingo(); if(currentcard[i].bingo()){ done = true;

security - Secure dynamic images. PHP -

i made php script create 1 of several dynamic images used backgrounds elements on webpage. question not coding question , code works great, far. my question implementation , possible security issues using pass data bg.php . right scr of image looks ../bg.php?t=1&w=200&h=200 where $t type of shape. (array of polygon coordinates) $w width of image $h height of image is using safe functionality, or there better/safer way of passing variables bg.php? bg.php called several times per page , used in <img src="bg.php"> <style>bg.php</style> , <script>bg.php</script> someone malicious render image of size, assuming don't check this, use memory/storage on server.

python - matplotlib 3d surface plots not showing -

Image
i trying make simple 3d surface plot matplotlib plot not show @ end. empty 3d axes. here did from mpl_toolkits.mplot3d import axes3d x= np.arange(1, 100, 1) y= np.arange(1, 100, 1) z= np.arange(1, 100, 1) fig= figure() ax= fig.add_subplot(111, projection ='3d') ax.plot_surface(x, y, z, rstride= 5, cstride= 5) show() so this any suggestions? you not plotting surface: x , y , z needs 2d arrays. @ example: http://matplotlib.org/examples/mplot3d/surface3d_demo.html .

javascript - Node.js return main loop from inside callback -

this question has answer here: how return response asynchronous call? 24 answers i have function creates object based on db data, , web_based json. function makeobject(dbdata){ var obj = {}; obj.id = dbdata.id; obj.url = dbdata.url; request(dbdata.url,function(err,res,body){ obj.inventory = json.parse(body).inventory; }); return obj } this doesn't fill in inventory property (async, etc...) nor work return inside request. know answer pretty basic, can't see it. help,please! you can either pass in callback argument or return promise. request has return promise or have promisify in way. callback solution easier going stands. function makeobject(dbdata, cb) { /* codes */ request(args, function (err, res, body) { obj.inventory = json.parse(body).inventory; cb(err, obj); }); } then use so

Get dates for a given week number in Android -

i dates given week number. instance, if have week number 15, need dates: 05-04-2015, 06-04-2015, 07-04-2015, 08-04-2015, 09-04-2015, 10-04-2015, 11-04-2015 . is possible? if so, how? let me know, thanks! here solution: calendar c = new gregoriancalendar(locale.getdefault()); c.set(calendar.week_of_year, 15); c.set(calendar.year, 2015); string result = ""; int firstdayofweek = c.getfirstdayofweek(); (int = firstdayofweek; < firstdayofweek + 7; i++) { c.set(calendar.day_of_week, i); result += new simpledateformat("yyyy.mm.dd").format(c.gettime()) + "\n"; } as input, except week, need have year. pay attention first day of week depends on locale.

swift - Expression resolves to an unused function -

first of let me new programming. i'm trying add button when pressed plays music, , when pressed again music stops. ideally when button pressed third time music have reset. whilst trying achieve i'm getting error message "expression resolves unused function", new find online doesn't make sense me. import uikit import avfoundation class viewcontroller: uiviewcontroller { @iboutlet weak var janitor: uiimageview! var pianosound = nsurl(fileurlwithpath: nsbundle.mainbundle().pathforresource("c", oftype: "m4a")!) var audioplayer = avaudioplayer() override func viewdidload() { super.viewdidload() audioplayer = avaudioplayer(contentsofurl: pianosound, error: nil) audioplayer.preparetoplay() } override func didreceivememorywarning() { super.didreceivememorywarning() } @ibaction func pianoc(sender: anyobject) { audioplayer.play() if audioplayer.playing {

AngularJS use constant in directive -

i have defined constant this: app.constant('ngsettings', { apibaseurl: 'https://url/' }); how can reference constant in directive? where directive this: angular.module('my.directive', []).directive(................... you can inject constant anywhere injectable including directive definition itself, controller of directive, link function, et. al. angular.module('my.directive', []).directive('name', ['ngsettings', function (ngsettings) { // things ngsettings return {}; }]); by way wouldn't name define ng -- should preserved things in ng module or angular created.

dojo - dojox.form.Uploader 403 error from django server -

i have simple form i've added uploader to. when invoke uploader, django returns {"detail":"csrf failed: csrf token missing or incorrect."} uploader: var ul = new uploader( { label:"programmed uploader", multiple:false, uploadonselect:true, url:environment.apiroot + "upload/", headers:{ "accept" : "application/json", "x-csrftoken" : dojo.cookie("csrftoken") } }).placeat(form); i created simple "test" button invokes function performs same post. new button({ name:"cancel2", //id:"cancel", label:"cancel" , placement:"secondary", onclick:lang.hitch(this,function(event){

c++ - Problems cross-compiling boost 1.57 from Linux to Windows -

i'm trying cross-compile boost 1.57 64-bit debian testing 32-bit windows. boost has cross-compile page , doesn't much. example, had google around , figure out need explicitly disable bzip2 -sno_bzip2=1 , zlib nothing -- auto-disable (previously had specify -sno_zlib=1 , has broke now). so, after trials , errors, have come to: $ i686-w64-mingw32-g++ -v using built-in specs. collect_gcc=i686-w64-mingw32-g++ collect_lto_wrapper=/usr/lib/gcc/i686-w64-mingw32/4.9-win32/lto-wrapper target: i686-w64-mingw32 configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib

ios - 'Binding' is not convertible to UILabel using SQLite in Swift -

my first time around here swift related question sqlite.swift library. i have loop db.prepare statement, stuck when trying assign array value uilabel. // prepare query retrieve message var _phrasemessage:string = "" let _stmt = _db.prepare("select id, message messages language = 'en' , category = 1 , username = 'user' limit 1") row in _stmt { println("id: \(row[0]), message: \(row[1])") self._phrasemessagelabel = row[1] --> error here **"'binding' not convertible uilabel"** } how can assign value in row[1] uilabel? or better string variable if possible. thanks in advance! disclaimer: first attempt swift + third party library you're trying set uilabel property value - want set text property on label value: self._phrasemessagelabel.text = row[1] as! string if want assign value variable: var message = row[1] as! string

sql server - Spilt Name field in SQL into First Name and Last Name -

i have column called name stores entire name. want split first name , last name in select statement. problem name might stored like: mike joe or mike & sarah smith. if 2 names (first , last) can use code: , substring(name, charindex(' ', name)+1, len(name)-(charindex(' ', name)-1)) [lastname] , left(name, charindex(' ', name)) [firstname] but if name "mike & sarah smith" want like: first name: mike & sarah last name: smith how modify code above handle both situations? if last part last name can use reverse function right , left functions: select left('mike & sarah smith', len('mike & sarah smith')-charindex(' ',reverse('mike & sarah smith'))) firstname, right('mike & sarah smith',charindex(' ',reverse('mike & sarah smith'))) lastname output: firstname lastname mike & sarah smith just put name of field instead of

android - how to change Background for all activities but does not change it in ActionBar? -

Image
i need such actionbar : but wish have such background in <style> use every activity automaticaly : what should change can use background in <style> , not apply background every activity , don t have problems title of actionbar ? when comment @color/bg_activity` in styles.xml gets correct bar (pic 1) i use in androidmanifest.xml : <uses-sdk android:maxsdkversion="22" android:minsdkversion="13" android:targetsdkversion="22" /> <application android:allowbackup="true" android:hardwareaccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/theme.abnactionbarholo" > my /res/values/styles.xml : <resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- base application theme. --> <!-- // abnactionbarholo // --> <style nam

javascript - Jquery .load causing button click issues -

i'm trying use .load load separate .php file single page. after page loads, want button have added class (change in background-color). if put code buttons directly in div tag on main page. $('button').click changes bg color on first click. if use .load , click. code executed , loads data in button doesn't class i'm trying add it. work after 2 clicks. jquery //loads .php file main window $('#utlist').load('content/usertypes.php #other'); //adds class button clicked. //removes class other buttons 1 has darker background $('button').click(function(){ $('button').removeclass('actsite') $(this).addclass('actsite'); }); css: .actsite { background-color: #444; } html: <button id="adc" href="#usertype" class="button scrolly" onclick="fillusertypes('adc');" >adc</button> the button usertypes.php , follow href anchor, won't add

tfs - Visual Studio REST API Iteration and Area ID's -

i working vso rest api , have question on how iteration , area id's assigned. specifically, why when assign work item root iteration or area id returned wit not returned when query classification nodes? for example, imagine have hierarchy when query /defaultcollection/my project/_apis/wit/classificationnodes?$depth=2 my project: id=1234 area 1: id=5678 area 2: id= 9012 and query work item using /defaultcollection/_apis/wit/workitems/1?$expand=all if work item in area 1 or area 2, system.areaid field expected (5678 , 9012, respectively). however, if assign work item project, system.areaid value not included when query classification nodes. there appears kind of relationship between id's serial (e.g. id returned classification node query 1232 area , 1233 iteration), can't seem find way query actual id returned work item query. in fact, not id returned work item not present when query classification nodes, if assign work item both root iteration , area, i

netbeans - How to implement user authentication in a jsp web application, using a glassfish JDBC Realm? -

Image
we have been attempting create user logins on our jsp web app using jdbc realms, following this tutorial . have followed tutorial like, won't work! basically, login form doesn't accept credentials, don't know if it's due communication issue, or there no communication! here of our code, enough show went wrong! our relevant database tables: our web.xml file: <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <session-config> <session-timeout> 30 </session-timeout> </session-config> <jsp-config> <jsp-property-group> <description>jsp configuration bandy</description> <url-pattern>/index.jsp</url-pattern> <url-pattern>/web

pdf generation - How can I put data in specific cells in a table on a PDF form using iTextSharp? -

i want create table in pdf , assign values (phrases) specific cells in table. i assume this: pdfptable table = new pdfptable(5); // arg number of columns // row 1 pdfpcell cell = new pdfpcell(doctitle); cell.colspan = 3; cell.borderwidth = 0; cell.horizontalalignment = 0; //0=left, 1=centre, 2=right table.addcell(0, 0, cell); // <= col 0, row 0. expect able ...but example code i've found adds cells table, 1 after other, without specifying cell of table cell data should associated with. such as: pdfptable table = new pdfptable(5); // arg number of columns // row 1 pdfpcell cell = new pdfpcell(doctitle); cell.colspan = 3; cell.borderwidth = 0; cell.horizontalalignment = 0; //0=left, 1=centre, 2=right table.addcell(cell); // row 2 pdfpcell cellcaveat = new pdfpcell(subtitle); cellcaveat.colspan = 2; cellcaveat.borderwidth = 0; table.addcell(cellcaveat); // row 3 pdfpcell cellimportantnote = new pdfpcell(importantnotice); cellimportantnote.colspan = 5; cellimportantn

AngularJS Response does not match configured parameter -

i've got problem service configuration. want display 1 user function: $scope.findone = function() { $scope.user = users.get({ userid: $stateparams.userid }); }; but in trouble user service :( don't know, how should change code avoid angular error: error in resource configuration action object . expected response contain array got {2} here code of actual working service (without function findone working of course:)) 'use strict'; angular.module('users').factory('users', ['$resource', function($resource) { return $resource('users', {}, { update: { method: 'put' }, remove: { method: 'delete', url: 'users/:id', params: {id: '@_id'} } }); } ]); at guess, i'd users api endpoint expecting /users/:userid requests. code @ moment r

Display unicode triangles (arrows) in Android -

i've seen following question ( javascript encoding question ) unicode triangles (arrows) displayed. in android 4.4.4 i've tried use \u25b2 , \u25bc in alert dialog's radio group list, these arrow characters aren't displayed. \u25b4 , \u25be arrows work these arrows big. need use \u25b2 , \u25bc. i've downloaded app "unicode map" google play , these characters not shown well. limitation in android version? i've tested in android 5.0.2 , works. thank you.

What would cause "python.exe" to work while "python" fails in Windows command prompt? -

i using python 2.7.2 on windows 7 machine, , have been setting path variable in command prompt each time want access python. today, noticed behavior changes if append directory front of of path variable. on opening command prompt, recognizes neither python or python.exe : microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\z1083743>python system cannot find path specified. c:\users\z1083743>python.exe 'python.exe' not recognized internal or external command, operable program or batch file. when add python binary directory onto of path, recognizes 1 not other: c:\users\z1083743>set path=%path%;c:\fuel\std-1.4.10.1\windows-x64-vs10.0\python-2.7.2\bin c:\users\z1083743>python system cannot find path specified. c:\users\z1083743>python.exe python 2.7.2 (default, jun 12 2011, 14:24:46) [msc v.1500 64 bit (amd64)] on win32 type "help", "copyright", "credits" or "

database - Passing values into CASE statement -

and thank in advance help. i'm trying take results 2 separate queries , include them in third query has case statement. i've had success i'm not able present results of third query in proper order. purpose of show employee count each department under different managers. far can load separately manager names , departments , employee department count totals department. can't figure out how manager names in , employee department count in each manager row. below 2 source queries i've used far , query case statement. i've looked @ unpivot function no success yet. a) simple query lists each primary manager name. there sub managers returned using hierarchy query later. select name employees "boss" employeeid in (‘1’,'5','25','84','85'); b) query returns department id count each main manager (‘1’,'5','25','84','85') sub-managers. select departmentid, count(departmentid) count emplo

c# - Returning "429 Too Many Requests" from action attribute -

i'm writing class can use attribute on asp.net web api actions rate limit users based on ip address. the logic of class works fine, , basic structure looks like: public class throttleattribute : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { // various logic determine if should respond 429 base.onactionexecuting(actioncontext); } } and i'm using on controller actions adding [throttle] annotation above method definition. somewhere in onactionexecuting method want return response 429 http code. looking @ other posts ( this one example) seems can following: actioncontext.response = actioncontext.request.createresponse( httpstatuscode.conflict, message.replace("{n}", seconds.tostring()) ); when try use code following error: 'system.net.http.httprequestmessage' not contain definition 'createresponse' , no extension metho

c++ - Does C++11 require allocators to be default constructible, libstdc++ and libc++ disagree? -

using modified version of howard hinnants's c++11 stack allocator documented here , here , std::basic_string , compiling gcc using libstdc++ , following example ( see live ): const unsigned int n = 200; arena<n> a; short_alloc<char, n> ac(a) ; std::basic_string<char,std::char_traits<char>,short_alloc<char, n>> empty(ac); gives following error( amongst others ): error: no matching function call 'short_alloc<char, 200ul>::short_alloc()' if (__n == 0 && __a == _alloc()) ^ however works without error when compiling clang , using libc++ ( see live ). the stdlibc++ implementation of std::basic_string expects allocator have default constructor. does c++11 require allocators default constructible? implementation correct? no, c++11 not require allocator have default constructor, if @ draft c++11 standard section 17.6.3.5 [allocator.requirements] contains table 28 allocator req

sql - Proper syntax for create view with a subquery? -

i want create view using code: select t1.firstname, t1.lastname, t2.sum customer t1,(select customerid,sum(total) sum invoice group by(customerid)) t2 t1.customerid=t2.customerid the way makes sense me do create view t2 select customerid,sum(total) sum invoice group by(customerid) create view customerinvoices select t1.firstname, t1.lastname, t2.sum customer t1, t2 t1.customerid=t2.customerid but gives me syntax error, i'm not sure how call first view in main view as you've noticed, syntax not allowed in mysql (although allowed in other databases): select t1.firstname, t1.lastname, t2.sum customer t1 join (select customerid,sum(total) sum invoice group by(customerid) ) t2 on t1.customerid = t2.customerid; you can rephrase as: select c.firstname, c.lastname, sum(total) sum customer c join invoice on c.customerid = i.customerid group c.firstname, c.lastname; this work in view.

python - Flask upload cannot find directory in server -

i have problem flask upload in local machine code working when upload code server using apache show error ioerror: [errno 2] no such file or directory: u'app/static/avatars/khuon.s.png' code : allowed_extensions = set(['png', 'jpg', 'jpeg', 'gif']) app.config['upload_folder'] = 'app/static/avatars' app.config['max_content_length'] = 1 * 600 * 600 def allowed_file(filename): return '.' in filename , filename.rsplit('.', 1)[1] in allowed_extensions @app.route('/user/profile', methods=['get', 'post']) def upload_profile(): if request.method == 'post': file = request.files['file'] if file , allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['upload_folder'], filename)) else: flash("f

Flot charts: markings z-index? -

Image
is there way access , manually set z-index (for lack of better word) of markings lines in flot chart? right creating markings on line chart use thresholds (basic horizontal lines set specific value) , it's working great except when markings happen lined chart's grid lines. when happens grid line overlaps marking line it's hard see marking line. manually set marking line on top of grid lines, can't figure out set option (or if it's possible). here markings array creating (dynamically): markings: [ { y2axis: {from: -20, to: -20}, color: "#848484", linewidth: 2.5 },{ y2axis: {from: -12, to: -12}, color: "#848484", linewidth: 2.5 } ] here image of result (you can see threshold @ -12 buried under chart's gridline , appears 2 thinner lines): thanks or advice can offer! when drawing on canvas there no z-order. drawn later drawn on older stuff. , when @ flot code (in drawgrid() function) see markings drawn first. there few dif

Jquery Ui dialog on form submit -

i'm trying stop jquery ui dialogs popping after 1 condition met on form submit. 1 dialog per event i'm looking for. kind of break if condition met. dialogs come after 1 closed. tried stoppropagation , stopimmediatepropagation no effect. code follows: $('#myform').on('submit',function(e){ if ($("#trama").is(':checked') && !$('.tramachecked:checked').length) { $( "#trama-message" ).dialog({ modal: true, draggable: false, resizable: false, buttons: { ok: function() { $( ).dialog( "close" ); } } }); e.preventdefault(); } if ($("#tramb").is(':checked') && !$('.trambchecked:checked').length) { $( "#tramb-message" ).dialog({ modal: true, draggable: false, resizable: false, buttons: { ok: function() { $( )

c++ - Why doesn't unordered_set provide an array access operator -

i'm curious why stl container unordered_set , has constant time complexity random access on average, not provide method accessing elements distance first element in container. example: t& unordered_set::operator[](size_t index) { return *(begin() + index); } accessing element "by distance" implies there meaningful way measure distance. trouble std::unordered_set is is, well, unordered . hence, there no meaningful way of explaining "some distance beginning" in non-arbitrary way. if want access distance, copy data vector: std::vector tmp(unordered.begin(), unordered.end());

javascript - Chartist always has left spacing? -

Image
with chartist.js no matter do, hide labels via css or showlabel: false there space left , bottom. i trying absolutely position chart fit in div, chart begins on left , draws way other end without space or padding. i have tried many different ways of hiding grid , labels, hidden space still there. i don't want hack css , left:-100px width:104% . here examples. on project blue chart should have no white space left or bottom. chartist wrapper looks this. .minimal-chart.ct-chart { background-color: transparent; position: absolute; width: 100%; left: 0; top: 0; height: 100%; padding: 0; z-index: 2; } even on site can see no near flush box below you can add these options when initialize it: chartpadding: { left: -40 }

Website repeatedly reloads, then crashes on iPhone 4: iOS 8.0.2 & iOS 8.1.2 -

an example of happens when loading website can seen here theverge.com. no such problems occur on latest browser , os versions for: windows 8.1 - chrome, firefox, opera, ie. osx yosemite - chrome, safari. android 4.4 - chrome, firefox, opera, safari. ios 7.1.2(ipad) - safari. ios 8.3 (iphone 5) - safari. however, on 2 separate iphone 4s devices (ios 8.0.2 & ios 8.1.2), safari continue refresh page, each time reading "problem occurred webpage reloaded" until crashing , reading "a problem repeatedly occurred on [website url]". have made sure javascript/jquery syntactically correct (as loading webpage javascript turned off in safari settings - same problem), cleared cache, restarted iphones , can not imagine else causing problem. web page small total file size of around 300kb , simple dom manipulation. from can tell of own testing , have read, problem isolated ios 8.0.2 , 8.1.2 obviously, website in minority of sites crash on os , know causes probl

geode - GemFire value change without refreshing all values -

i m using (string, arraylist of string) key value pair in gemfire caching.is there method add or delete particular value value list without getting entire list , add/delete , publishing list again?! you can create wrapper object keep list. wrapper object can implement delta interface . using can add/delete field list. see if helps.

Is there a way to increase/decrease the value of CSS line-height with jQuery each time an element is clicked? -

adding either of operators += or -= doesn't work. figure must have line-height property itself. thought post here see whether a) being stupid or b) able me sort of workaround (ideally, text field still responsive). here's have code-wise: https://jsfiddle.net/448ftbz6/ <head> <script> $(document).ready(function() { $("#up").click(function(){ $("#paragraph p").css({"line-height":"75%"}); }); $("#down").click(function(){ $("#paragraph p").css("line-height":"150%") }); }); </script> </head> <body> <div id="paragraph"> <div id="arrows"> <div id="up">less</div><br> <div id="down">more</div> </div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. in sed felis semper, sodales mi sed, bibendum ero

node.js - Access to mountpath variable from inside a template using express -

is there clean, recomended way access mountpath inside template, express app can run both standalone , part of app (by means of app.use), paths pointing correct destination either way? something like: {{mountpath}}route/to/file so in case app running standalone, mountpath / , , in case running submodule, mountpath /foo/ note: i'm using handlebars. express.static middleware responsible serving static assets of express application. how works: serve static content app "public" directory in application directory // /style.css etc app.use(express.static(__dirname + '/public')); mount middleware @ "/static" serve static content when request path prefixed "/static" // /static/style.css etc. app.use('/static', express.static(__dirname + '/public')); serve static files multiple directories, give precedence "./public" on others app.use(express.static(__dirname + '/public')); app.use

Reading a file into a list on python. How to take out words -

i reading file list , spliting every word in list. not want specific words brought in list, skip them. called trash list filterlist written below. this code: with open('usconstitution.txt') f: lines = f.read().split() #read list filterlist = ["a","an","the","as","if","and","not"] #define filterlist word in lines: if word.lower() not in filterlist: word.append(alist) #place them in new list called alist not contain in filterlist print(alist) #print new list i getting error: attributeerror: 'str' object has no attribute 'append' can ? thanks you need give, alist.append(word) list object has attribute append . , need declare list first. append items list. ie, with open('usconstitution.txt') f: lines = f.read().split() #read list filterlist = ["a","an","the","as"

javascript - Node.js return a JS file locally -

inside html file, using this: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> however, not allowed connect internet during running. how can use node js return file locally. download file "jquery.min.js" in local machine. i trying use code, not work. function callback(data) { res.writehead(200, {"content-type": "text/html"}); var str = data+""; res.write(str); res.end(); } htmltemplate.load("jquery.min.js", callback); you can't serve both web page , jquery in simple node server looks this: var http = require('http'); var server = http.createserver(function (request, response) { response.writehead(200, {"content-type": "text/plain"}); response.end("hello world\n"); }); server.listen(8000); i think going need router or framework serve multiple http endpoints , static assets. many people u

html - Select all child elements with all attributes of child elements in a table. -

suppose have following xml: <parent> <child1 attr1="value" attr2="value" attr3="value"/> <child1 attr1="value" attr2="value" attr3="value"/> <child1 attr1="value" attr2="value" attr3="value"/> </parent> i want put elements of type child1 rows table consisting of column each attribute - simple enough. problem, however, type of child element , number/types of child elements attributes vary between instances of parent . here's example of instances of parent might contain <parent> <child2 attr1="value" attr2="value" attr3="value" attr4="value"/> <child2 attr1="value" attr2="value" attr3="value" attr4="value"/> <child2 attr1="value" attr2="value" attr3="value" attr4="value"/> </parent>

python regular Expression splitting a string -

i want split sting c='[ 6638.392700] entered command e0, 00, 01' in to ['6638.392700','entered command e0, 00, 01' ]. i want split number in [data] string. how can achive that? tried below: re.split(r'([\d*])',c,re.i) but giving me output .. ['[ ', '6', '', '6', '', '3', '', '8', '.', '3', '', '9', '', '2', '', '7', '', '0', '', '0', '] entered text e', '0', ', ', '0', '', '0', ', ', '0', '', '1', ''] how can achieve desired output? define string: >>> c = '[ 6638.392700] entered command e0, 00, 01' split it: >>> c.replace('[','').split(']') [' 6638.392700', ' entered command e0, 00, 01']

c++ - boost vs std atomic sequential consistency semantics -

i'd write c++ lock-free object there many logger threads logging large global (non-atomic) ring buffer, occasional reader thread wants read data in buffer possible. ended having global atomic counter loggers locations write to, , each logger increments counter atomically before writing. reader tries read buffer , per-logger local (atomic) variable know whether particular buffer entries busy being written logger, avoid using them. so have synchronization between pure reader thread , many writer threads. sense problem can solved without using locks, , can rely on "happens after" relation determine whether program correct. i've tried relaxed atomic operation, won't work: atomic variable stores releases , loads acquires, , guarantee acquire (and subsequent work) "happen after" release (and preceding work). means there no way reader thread (doing no store @ all) guarantee "happens after" time reads buffer, means don't know whether lo

how to create ad user with some requirements in powershell? -

i have create aduser's. password should first 6 characters of id card , last name. should divide full name first name , last name. this script, did not work: $userslist = import-csv "c:\teacherslist.csv" foreach ($user in $userslist){ $name = $user.fullname -split '\s+' $firstname = $name[0] $lastname = $name[1] $pass = $user.idcard.substring(0,6)+$lastname new-aduser -name $user.staffid -givenname $firstname -surname $lastname -displayname $user.fullname -accountpassword (convertto-securestring $pass -asplaintext -force) -path 'ou=teacher,dc=school,dc=com' -homedrive 'f:' -changepasswordatlogon $true } ok, getting parsing issues arguments on different lines that. understand makes easier read, powershell doesn't know next line contains parameter new-aduser cmdlet unless put backtick @ end of each line ( must last character of line ). if wan

Amazon S3 as a mount on Heroku -

i new heroku , wanted understand if there way have amazon s3 bucket mount on heroku liferay application use. have liferay app deployed on heroku connected postgres. my aim keep static configuration files on s3 , write log files on s3.

Firebase Java Query.equalTo() does not work -

i trying understand how method works. have set , pushed strings root of firebase. made reference firebase , trying make query object way query refq = ref.orderbyvalue().equalto(word); where word same string pushed firebase. i want print value console. weird thing happens console hangs in infinite loop , need force terminate. put print statement after above line of code , never gets reached. so question is, doing wrong? edit: forgot mention word static , 1 of words pushed firebase. doing test functionality. i created minimal sample , ran in jdk 1.8.0_31: public static void main(string[] args) throws exception { firebase ref = new firebase("https://stackoverflow.firebaseio.com/29553461"); /* map<string,object> map = new hashmap<string, object>(); map.put("puf", "frank van puffelen"); map.put("frank", "frank van puffelen"); map.put("david", "david east");