Posts

Showing posts from March, 2010

javascript - How to select div whith jquery from inside another div -

so have html: <div> <div> <a class="member-img" href="#" > <img src="image.jpg" alt="member"> </a> </div> <div class="member-bar"> </div> </div> and try select "member-bar" when user hovers "member-img" $('.member-img').hover(function(){ $(this).closest(".member-bar").slidedown() }); but doesn't seem work, code ? member-bar need parent of member-img in order work. need first find parent, find member-bar sibling: $(".member-img").hover(function() { $(this).parent().next(".member-bar").slidedown(); }); here's fiddle above code

c - Hash-based logger for embedded application -

currently sending uart strings want log , reading on host terminal. in order reduce logging time , image size (my flash tiny), figured out strings unused in embedded system, why storing them on flash? i want implement server, whom can send hashed-key of string (for example - it's rom address) , string output file or screen. my questions are: how create key2string converter out of image file (the os cmx, can answered generally) is there recomended way generate image, know strings addresses exclude them rom? is there known generic (open-source or other) implemented similar logger? thanks rather holding hard-coded strings, trying hash answers , sent via uart, somehow remove strings resulting image, suggest following. just send index error code. pc side can index , determine string condition. if want device code more clear, index can enumeration. for example: enum errorstrings { es_valueoutoflimits = 1, es_wowitsgettingwarm = 2, es_randomerro

Batch code to write System turn on time in txt file -

i need batch code write system turn on time in txt file. means need write time @ windows turned on txt file. try this: @echo off >"c:\path\to\startup.txt" (for /f "tokens=3,4" %%a in ( 'net statistics workstation ^| find "since"' ) ( echo %%a %%b ))

directx - (Closed) C++ & Direct3D 9 - How to draw formatted text? (Like printf etc) -

i've started programming in c++ using directx. i'm not new c++ i've used allegro & sdl before. far, can draw text screen. however, have slight problem, cannot draw variable screen. ideally, want draw string + int value. have no idea how that. snippet of code far: font->drawtexta(sprite, "score: ", -1, scorer, dt_calcrect, 0xffffffff); font->drawtexta(sprite, "score: ", -1, scorer, 0, 0xffffffff); as might expect, write "score: " screen. need write 'score' variable after that. any appreciated. you may use sprintf format string memory string, , print using drawtext example: (not tested) char formatted_string[100]; sprintf(formatted_string, "score: %d", score); font->drawtexta(sprite, formatted_string, -1, scorer, dt_calcrect, 0xffffffff); obviously illustrative, more polished.

javascript - How to tween an integer variable using TweenMax? -

how tween integer variable using greensock:tweenmax,tweenlite in javascript? var counter = { var: 0 }; tweenmax.to(counter, 5, { var: 100, onupdate: function () { console.log(math.ceil(counter.var)); }, ease:circ.easeout }); it starts 0 100 in 5 seconds. sample code

How can TCP/IP identify the correct socket when we bind for 2 different protocols on the same port -

researching , asking of course here found out did not know/realize before. process can bind specific port 2 different protocols. e.g. same port x tcp , udp . (any other well-known examples?) how possible? mean if new datagramsocket(6789); , new serversocket(6789); assume can accept both tcp , udp in program , delegate different classes. right? how work? java understand if client using tcp or udp , passes socket appropriate class? ports exist within namespace of protocol. isn't same port, same port number. java has nothing todo either.

vb.net - System.InvalidOperationException: Collection was modified; enumeration operation may not execute when form closes -

i fixed issue removing line shapes form. original post when form closes following error: system.invalidoperationexception: collection modified; enumeration operation may not execute this appears when program deployed on machine not during debug. if hide form doesn't occur when form closed. any appreciated becoming annoying now. in advance, craig p.s. below formclosed event 'disconnect database cn.close() cn.dispose() stack trace ************** exception text ************** system.invalidoperationexception: collection modified; enumeration operation may not execute. @ system.throwhelper.throwinvalidoperationexception(exceptionresource resource) @ system.collections.generic.list`1.enumerator.movenextrare() @ system.collections.generic.list`1.enumerator.movenext() @ microsoft.visualbasic.powerpacks.shapecollection.dispose(boolean disposing) @ microsoft.visualbasic.powerpacks.shapecontainer.dispose(boolean disposin

spring - Regarding Dependency Injection -

interface car { public void tyres(); } class bmw implements car { public void tyres() { system.out.println("bmw"); } } class hmw implements car { public void tyres() { system.out.println("hmw"); } } public class dependencyinjection { private car car; public void draw() { this.car.tyres(); } public void setcar(car car) { this.car = car; } public static void tyres1(car c) { c.tyres(); } public static void main(string[] args) { car car = new bmw(); tyres1(car);//point 1 dependencyinjection dep=new dependencyinjection(); dep.setcar(car);//point2 dep.draw(); } } i want clarification advantage have creating dependency injection @ point 1 , point2.please explain me in detail new spring??? this not spring specific design principle, , it's hard grasp in snippet you've provided not have notable separated pieces, be

node.js - Express.js app frequently doesn't load new route without hard refresh? -

i'm experiencing strange issue. when navigate page page in express.js app (currently have 3 pages: home, about, contact), page appears blank. when hard refresh on mac (shift command r) of assets load in. when @ networks tab in chrome dev tools, appears if assets loading in -- don't see 404's. here screenshot of app directory see i'm working with: http://d.pr/i/lqlv also, here app.js file: var express = require('express') , partials = require('express-partials') , app = express(); app.configure(function() { app.set('title', ' | todo app'); app.set('view engine', 'ejs'); app.use(express.static(__dirname + '/public')); app.set('views', __dirname + '/views'); app.use(partials()); }); app.get('/', function(request, response, next) { response.render('index', { title: "home" + app.get('title') }); }); app.get('/home', fu

Javascript loop, counter equals 0 two times in a loop -

so working on little slideshow script. problem i equals 0 2 times in loop. in following code piece of code: for (var = 0; children.length > i; i++ ) { (function(children, i, time){ settimeout (function(){ // fade out current slide settimeout(function(){ fadeitout(children[i]); },2000); // wait execution of if statement var nextslide = window.setinterval(function(){ // if current slide not first slide // , if slide before current slide has faded out if(children[i-1] && children[i-1].style.opacity === "") { // show next slide children[i].style.display = 'block'; nextslide = window.clearinterval(nextslide); } // if current slide first slide

mysql - Deleting row involving joining of tables -

how delete userid 00002 product ordered when provided "tim" (where username = 'tim'). not userid, i'm aware of it. user info ------------------ userid | username 00001 | jim 00002 | tim 00003 | steve 00004 | boo product ordered ------------------ userid | productcode 00002 | p0001 00002 | p0003 00001 | p0002 00003 | p0001 delete po.* `product ordered` po inner join `user info` ui on ui.userid = po.userid ui.username = 'tim' that should it.

php - Codeigniter: Ajax Login Redirect issue with Ion Auth -

i trying use ion auth framework codeigniter application. when user clicks link request goes controller method , checks if user logged in or not. if not redirects auth\login method. html of login page in success(msg):alert(msg); ajax request $('img').click(function() { $.ajax({ url: "<?php echo site_url('gallery/openproductdetail');?>", type: 'post', success: function(msg) { alert(msg); } }); }); controller function openproductdetail() { if (!$this->ion_auth->logged_in()) { redirect('auth/login'); } else { $this->load->view('modal/productdetail'); } } login page login.pho original ion auth <h1><?php echo lang('login_heading');?></h1> <p><?php echo lang('login_subheading');?></p> &l

javascript - How to align tabs of tabpanel on center on Extjs 4? -

Image
it's possible align tabs of tabpanel on center? want align tabs on center without using margins. have property this? can see in image understand need. when defining tabpanel, use this: { xtype: 'tabpanel', tabbar: { layout: { pack: 'center' } } }

python - Tornado request handler mapping to international characters -

i want able match url requests internationalized characters, /comisión . setup: class application(tornado.web.application): def __init__(self): handlers = [ '''some handlers, , this: ''' (r"/([\w\:\,]+)", internationalizedhandler) ] tornado.web.application.__init__(self, handlers, **settings) but setting locales in tornado doesn't seem right solution. how possible set regex catch characters such é,å,µ etc.? changing re mode in python do? tl;dr: it's impossible tornado's built-in router. tornado buries regexp compiling handler patterns pretty deep, @stema's suggestion use re.unicode flag difficult, because it's not clear pass in flag. there 2 ways tackle particular problem: subclass urlspec , override __init__ function, or put flag prefix in pattern. the first option lot of work. second option takes advantage of feature in python's re module

jquery - Fix scrollTo page flicker in wordpress child theme? -

when click menu items, page flickers before animated scrolling. seems need prevent default href action of menu items, can't find that. http://teratomic.org/ i can't find 'scrollto' anywhere in theme code. heres's i've found in theme's header.php @ least... still can't find put preventdefault <ul class="navigation"> <?php if (has_nav_menu( 'header-menu' )) { ?> <?php $the_menu = array( 'theme_location' => 'header-menu', 'container' => 'ul', 'menu_class' => 'menu', 'echo' => true, 'fallback_cb' => 'wp_page_menu',

neo4j - how to avoid java.nio.channels.OverlappingFileLockException -

i have java web app , trying use neo4j 2.0. wrote servlet allow me observe of action in database. uses same singleton database connection used other servlets in application, when try access debug servlet, 'overlappingfilelockexception' error. is there can around this?

corona - Needing advice about my game logic -

i creating game given few letters (they images, each letter image) , you have empty slots (an image of black box). when user touches image of letter, clones letter, , starts moving clone user touching, , if put 1 of slots (one of black boxes) drops there, if didn't move black box resets (the clone disappears, dropped). now using storyboard here, , have level1.lua file ready, scene background , all. what logic should use here? tried googling tutorials drag , drop in corona couldn't find any. can recommend logic within storyboard messed file? you can use methods in logic physics collision the letters , slots have physics bodies, can drag letter , when letter collides on slot body can collision data , can able drop letter. rectangle approach this straight forward. have of slots' x, y, width , height , compare letter's x , y when dragged it. letter's x , y must between slot's (x x+width) , (y y+height) can drop letter specified slot

php 5 create global variable within function -

i'm trying create global variable within function isn't passed when try echo outside function. function check_input($data) { if ( preg_match("/http/i", $data)) {$globals['spam'] = 'yes'; } check_input($data); echo $spam; echo $globals['spam']; the correct course of action return value out of function, instead of relying on global variables. function check_input($data) { //note use of true instead of "yes". //you can more stuff true/false. if ( preg_match("/http/i", $data)) { return true; } else { return false; } } $is_spam = check_input($data); echo $is_spam; //1 or 0, because that's how true , false display in echo. also see: why global state evil?

c# - Lazy<> Ninject Injection -

i use ninject framework. in code have lazy object. can create instance, when call value property got exception. private lazy<ipsoriasisreportusercontrol> psoriasisreportusercontrol; [inject] public lazy<ipsoriasisreportusercontrol> psoriasisreportusercontrol { { return psoriasisreportusercontrol; } set { psoriasisreportusercontrol = value; } } i got the lazily-initialized type not have public, parameterless constructor exception because injection not inject method constructor. think have write method bind creates new instance. use factory extension ninject https://github.com/ninject/ninject.extensions.factory

c# - System.AggregateException on Socket.EndAccept with TaskFactory.FromAsync -

i working async operations sockets (.net 4 - vs 2010 sp1) , seems working okay. however, after write , run automated test, pass green displays exception message: ---- unhandled exception ---- thread name: <no name> system.aggregateexception: task's exception(s) not observed either waiting on task or accessing exception property. result, unobserved exception rethrown finalizer thread. ---> system.objectdisposedexception: cannot access disposed object. object name: 'system.net.sockets.socket'. @ system.net.sockets.socket.endaccept(iasyncresult asyncresult) @ p2pnet.listener.<listenforconnections>b__0(iasyncresult r) in c:\users\lucas.ontivero\documents\visual studio 2010\projects\p2pnet\p2pnet\listener.cs:line 76 @ system.threading.tasks.taskfactory`1.fromasynccorelogic(iasyncresult iar, func`2 endmethod, taskcompletionsource`1 tcs) --- end of inner exception stack trace --- @ system.threading.tasks.taskexceptionholder.finali

algorithm - Avoid stepping in Lava Circles -

Image
i trying figure out how write ai avoidance algorithm game not step on lava areas. safe distance center of lava object static 25 range. if 1 lava object calculate distance between player , object, calculate angle , move backwards x range until 25 range away. but because there can more 1 lava object each 25 range safe radius. 3 need taken consideration otherwise might move away 1 , step onto another. any appreciated. if 1 lava object calculate distance between player , object, calculate angle , move backwards x range until 25 range away. that's right idea, have scale it. create vector each lava circle. angle should represent "away" circle, , magnitude represents how far away is. can add these represent steering vector. it's not perfect , can tweak suit particular needs well. that's bare basics, principle can applied kinds of steering, pursuit, avoidance, wall following, etc. the best reference know of send steering behaviors autonom

c# - Error "cascade delete on" -

i have problem. need add "cascade delete on" in constraint [fk_sumaroute_suma] : create table [dbo].[sumaroute] ( [id] int identity (1, 1) not null, [sumaid] int not null, [routeid] int not null, constraint [pk_sumaroute] primary key clustered ([id] asc), constraint [fk_sumaroute_suma] foreign key ([sumaid]) references [dbo].[suma] ([id]) ***** here !!! *****, constraint [fk_sumaroute_route] foreign key ([routeid]) references [dbo].[route] ([id]) on delete cascade ); but sql server return errors: creating fk_part_suma1... (104,1): sql72014: .net sqlclient data provider: msg 1785, level 16, state 0, line 1 introducing foreign key constraint 'fk_part_suma1' on table 'part' may cause cycles or multiple cascade paths. specify on delete no action or on update no action, or modify other foreign key constraints. (104,1): sql72014: .net sqlclient data provider: msg 1750, level 16, state 0, line 1 not create

sublimetext2 - Boundary sensitive Cmd+D in Sublime Text -

Image
i'm using sublime text 3 on osx. using cmd + d , want select next instance of es not if it's part of word given code i select first instance of es , see this perfect! however, when tap cmd + d couple times, end selecting this super annoying! how can make cmd + d select highlighted sections appear in image 2? if select whole word , press cmd + d going select in 3rd image. if put cursor (caret) on word not select , press cmd + d going select in 2nd image. for windows change cmd + d ctrl + d

Unit testing javascript for a memory leak -

is there way unit test javascript memory leaks? mean is, there way access heap directly javascript code check detached dom trees or increased memory usage? i know can chrome dev tools, i'm wondering if there's way directly unit tests, since seems tedious write code, take heap snapshot, perform potentially memory leaking operation, take heap snapshot, , repeat every single potentially memory leaking operation, every time write snippet of code. not mention adding code in 1 place may cause unexpected memory leak in part of application. it's wrote application had huge memory leak, , had start scratch. when develop application time around, want make sure unit tests can detect i've created memory leak, , can eliminate possible. i think i've seen tools c++, not javascript. know of any? thank you! to check memory leaks, need have access memory allocation size or size of variables. there's no possibility in javascript.

hyperlink - php onclick to retrieve dataset -

i have list of values upon hyperlink 'onclick' display associated recordset in array below. through php, have dataset of connected table values working. need link dataset onclick event. through research there few ways can go this: iframes (seems not recommended); json/ajax (languages not know , none of other data uses construct, possible use straight php?); $_get variable related function seems way go though struggling right syntax create response. using filter function? essentially: $row_artistrecordset['artist'] = $row_getartists['artist']. if can base code on match construct versatile enough use in other pages. this code far: <?php mysql_select_db($database_connectmysql, $connectmysql); $query_artistrecordset = "select * artists order artist asc"; $artistrecordset = mysql_query($query_artistrecordset, $connectmysql) or die(mysql_error()); $row_artistrecordset = mysql_fetch_assoc($artistrecordset); $totalrows_artistrecordset = mysq

Status of jQuery automatic completion with Rails 3 and 4 -

i'm new rails. company switching projects rails 3 rails 4, i'd understand packaging of automatic completion in both. from understanding there rails plugin, auto_complete, i'm guessing used prototype. of version 3, rails agnostic of javascript frameworks automatic completion functionality moved gems. jquery version of gem, rails3-jquery-autocomplete, makes use of jquery ui widget, autocomplete. now, in attempting figure of out removed 'jquery-rails' gemfile of rails 4 project, can somehow still require both 'jquery' , 'jquery.ui.autocomplete' in application manifest. since jquery included in rails now, still need gem make rails 4 work jquery's autocomplete? like, rails4-jquery-autocomplete? think so, what's confusing me don't method undefined error when use 'text_field_with_auto_complete'. instead, unmatched route error.

Microsoft Dynamics CRM: find cases that have been close within 2 days -

Image
i'm trying generate list of cases in system has been closed within 2 days, don't know base way it, apart running through cases , comparing created on resolved date. there other ways it? there build in function solve such trivial task? thank you when case/incident resolved new record created: case resolution semi-hidden crm record type. you can use advanced find create view of this: this allow create view. unfortunately can't include view in list of incident views (along active cases, resolved cases, etc)

html - Pure CSS grids do not float next to each other -

i trying build website using pure css layout. pure css the div 's 1/2 width not float next each other when try , use basic 2 column layout. can see width 50%. is expected behavior or should explicitly float div 's i have referenced both of following style sheets. <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.2.1/base-min.css"> <link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.2.1/pure-min.css"> <div class="pure-g"> <div class="pure-u-1"> <div class="pure-u-1-2"> lorem ipsum dolor amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. duis autem vel eum iriure d

Video Conversion in Python on Google App Engine -

i using google app engine host website want users able upload video , want use flowplayer display it, requires mp4 , webm formats support browsers. have working correctly user uploads video , can serve need convert 2 formats can view video. is there python project can import conversion on app engine or resources showing how can google compute engine? need done automatically on server , projects stable in python written done command line on personal computer. i'm not sure google app engine, may want using ffmpeg . hosting site on heroku , have been able use spawning task automatically grab image uploaded video display , convert uploaded file mp4. in order conversion mp4, need compilation using libx264. no expert on this, may want if haven't already. in app on heroku, able convert uploads mp4, has taken time figure out right configuration , still takes longer like. however, new developer , first app ever created, might easier working way want it.

declaring array in javascript object crashes browser -

i'm trying write objects using javascript. have 1 small object appears working object needs multi-dimensional array. when try use snippet of object browser crashes... are there tutorials on how write objects in javascript? function map(sizex, sizey) { var cityarr = new array(); this.sizex = sizex; this.sizey = sizey; this.generatecity = generatecity; var cityxy = new array(); function generatecity(citynum) { alert(citynum); } } when call this, fails when add call generatecity method browser cashes. var objmap = new map(); //objmap.generatecity(2); what doing wrong? first off, javascript best practices: use [] create new array, not new array() , use capital letters constructor functions, function map(...) {...} , not map(...) , don't reference functions before declaring them, put function generatecity(citynum) before this.generatecity = generatecity , use console.log , not alert , if you're building

Make one PDF file of Python documentation -

the python official site offers pdf documentation downloads, separated chapters. downloaded source code , built pdf documentation, separate pdfs also. how can build 1 pdf file makefile in source code ? think more convenient read. if concatenating separate pdfs won't leaves out table of contents (bookmarks), acceptable too. tried convert imagemagick, pdftk , pdfunite poppler-utils , lose bookmarks after concatenation. if have pdfs, there no need re-create them. instead, use pdf split & merge or pdfarchitect . --- edit --- since above mentioned solutions work partially, googled bit , found sejda . can download latest version here . sejda-console merge -f pdffile_1.pdf pdffile_2.pdf -o pdfoutput.pdf i tried , works expected. try sejda-console -h merge other options (i.e. specify dir pdfs instead single files, etc.)

parsing SQL CREATE statement using ANTLR4: no viable alternative at input 'conflict' -

Image
i'm newbie antlr user , trying parse following sql create statement. (i dropped unimportant part of both sql , grammar) create table account (_id integer primary key, conflict integer default 1); and grammar this: (you can compile grammar copy&paste) grammar createtable; tablelist : (createtablestmt)* ; createtablestmt : create table tablename lp columndefs (comma tableconstraints)? rp semicolon ; columndefs : columndef (comma columndef)* ; columndef : columnname typename? columnconstraint* ; typename : sqlitetype (lp signed_number (comma signed_number)? rp)? ; sqlitetype : inttype | texttype | id ; inttype : 'integer'|'long'; texttype : text ; columnconstraint : (constraint name)? primary key conflictclause? | (constraint name)? unique conflictclause? | (constraint name)? default signed_number ; tableconstraints : tableconstraint (comma tableconstraint)* ; tableconstraint : (constra

iphone - iOS background location updates -

i have created app uses location updates in background. have submitted app apple got rejected apple on ground using location updates in background rather using significant location update , shape based region monitoring. app takes location updates , provided user specific updates, works scenarios , have made code better save battery. apple's suggested approach problem i'm getting significant location update , shape based region monitoring location accuracy. significant location update events fired region within cell tower range or 100 m - 3000 m rather when user enters region lat long 100 m radius. i've had many conversations apple , don't seem care developers , new technologies creating. there developer faced same problem of using background location update other navigation , got accepted or has used significant location update shape based monitoring provide precise updates better location accuracy. any much appreciated. varun welcome community. her

objective c - resignFirstResponder does not hide the keyboard -

i trying include uitextfield inside uialertview following code: uialertview *newlabel = [[uialertview alloc]initwithtitle:@"new label" message:@"\n" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil]; uitextfield *newlabelnamefield = [[uitextfield alloc]initwithframe:cgrectmake(12.0, 45.0, 260.5, 25.0)]; newlabelnamefield.placeholder = @"label name"; [newlabelnamefield setbackgroundcolor:[uicolor whitecolor]]; [newlabelnamefield resignfirstresponder]; [newlabel addsubview:newlabelnamefield]; [newlabel show]; the main problem facing resignfirstresponder not working, keyboard not hiding when return key pressed. secondly there way can write method has executed when ok button pressed, adding label name received using text field database. method has executed if press ok button, not cancel button. 1) second question, first set tag uialertview newlabel.tag = 5 ; 2) write following delegate method

pyqt - Python encoding error(it works at one point and then it doesn't...) -

so, i'm using python (with pyqt) , have strange problem. in this: self.listwithnames = ["Α.Μ.","Μονομελές-Τριμελές", "Ονοματεπώνυμο","Όνομα Πατρός","Όνομα Μητρός","Ημερομηνία Γέννησης", "Τόπος Γέννησης","Φύλο","Εθνικότητα","Διεύθυνση Κατοικίας","Αστυνομικό Τμήμα", "Τηλέφωνο","Επάγγελμα-Ιδιότητα","Ημερομηνία Δικασίμου","Αριθμός Πινακίου", "Πράξη","Ημερομηνία Τέλεσης","Τόπος Τέλεσης","Ύπαρξη Συνενόχων", "Παραδοχή","Περιγραφή Πράξης","Εμφάνιση","Αναβολή","Απόφαση","Αριθμός Απόφασης", "Ημερομηνία Απόφασης","Παρουσία","Προηγούμενες Αποφάσεις","Υπεύθυνος

linux - Psych error on Capistrano deployment -

i have capistrano deployment script have work time, throw such error on deployment: /users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): control characters not allowed @ line 1 column 1 (psych::syntaxerror) /users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' /users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:151:in `parse' /users/lifecoder/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/psych.rb:127:in `load' ... it throws several warnings during deployment: ** [out :: test.domain] warning! path not set up, '/home/lifecoder/.rvm/gems/ruby-1.9.3-p448/bin' not @ first place, ** [out :: test.domain] ** [out :: test.domain] caused shell initialization files - check them 'path=...' entries, ** [out :: test.domain] ** [out :: test.domain] fix run: 'rvm use ruby-1.9.3-p448'. i have found similar problem here , assume warni

python - Upload file with framework Zope -

i users of zope/plone website can upload (big) file (>1gb) on server. i have form in html : <form enctype="multipart/form-data" action="upload.py" method="post"> <p>file: <input type="file" name="file"></p> <p><input type="submit" value="upload"></p> </form> i have external script zope : upload.py def get(self, request): filename = request.file['file'] unfortunately don't know file.. i found tutorial think i'm on wrong way (because these methods can't work zope ?): cgi : http://webpython.codepoint.net/cgi_file_upload ftplib : python script uploading files via ftp thanks advices, it depends on how , want store it. the request.file file object can read, seek, tell etc contents from. you can store blob: from zodb.blob import blob blob = blob() bfile = blob.open('w') bfile.write(request.file) bfile.cl

ios - UISplitView: Dismiss another popover when splitview popover is presented -

Image
i have problem on ipad application using uisplitview. basically, have button toggles popover (different basic splitview popover). image might explain problem better: problem there in portrait mode. there 2 cases possible: first tap on "folders" button, second tap on "settings cogwheel" button, works there: 1 popover shows @ time, because know how register action on settings button. first tap on "settings" button, second 1 on "folders" button. in case don't know how dismiss "settings" popover, because don't know how register touch on default button made available splitview. (that's problem on picture) do know how handle touch event on default "folders" button offered splitview? fixed it! there's delegate method called splitview when popover going present view controller, here is: //------------------------------------------------------------------------------------- // splitviewcontr

java - Why is my RMI server dying after 20 hours -

i have problem rmi application. after 20 hours (+/- few hrs) clients can no longer connect. in first 20 hours of server's lifetime though can make many connections want. suspected problem rmi remote object being garbacge collected there no references pointing it, can rule out 2 reasons: i forced jvm running server gc using jconsole , clients can still connect i hold reference server in main method, not exit , rmi registry , stub members of server class. my server creates rmi registry on port 1099 , gets exported unicastremoteobject on port 5099. when clients can no longer connect after 20 hours java.rmi.connectexception. clear server's java process still running , registry (running within process) still responding , returning remote object. exception thrown when call remote method on client side. if "netstat -tulpn" on server machine can see java process listening on port 5099 initially, once 20 hour bug kicks in server no longer listening on port. think

dependency injection - Laravel 4: how to inject another class in a eloquent model -

i'm trying use built-in laravel's ioc container inject pagemanager class inside page model , i'm little lost. what i'm trying achieve that: class pages extends eloquent { public function __construct(pagesmanagerinterface $manager, array $attributes = array()) { parent::__construct($attributes); $this->manager = new $manager; } public function savetodisk() { $this->manager->writetofile(); } but obtain error: errorexception: argument 1 passed pages::__construct() must instance of pagesmanagerinterface, none given. i tried add in app/start/global.php: app::bind('pages',function(){ return new pages(new pagesmanager); }); but seems ignored framework, , don't know how insert $attribute array declaration. i'm little lost appreciated! i think need is: app::bind('pagesmanagerinterface',function(){ return new pages(new pagesmanager); }); this tells lara

c++ - Comparing QWidgets -

how can compare qwidgets? lets have list , change sizes of widgets qpushbutton : for example, there function or method this? qlist<qlayoutitem *> itemlist; if(itemlist->items->type() == qpushbutton) { item.setgeometry(newrect); } there several ways this, actually. qobject::inherits() one: for (int = 0; < itemlist.size(); ++i) { if (itemlist[i]->inherits("qpushbutton")) { itemlist[i]->setgeometry(newrect); } } another way using qobject_cast , recommend. returns null pointer if object not inherit (directly or not) class cast to: for (int = 0; < itemlist.size(); ++i) { if (qobject_cast<qpushbutton*>(itemlist[i])) { itemlist[i]->setgeometry(newrect); } } note qobject_cast not need rtti support enabled in compiler. and there's of course standard c++ dynamic_cast need rtti support enabled: for (int = 0; < itemlist.size(); ++i) { if (dynamic_cast<qpushbutton*>(itemlist

c# - Change connection string petapoco -

i have 2 separate databases i'm wanting merge shared 1 site. when logs in have check see if user exists in database one, if aren't check database 2, if in database want switch default connection string database 2. petapoco database has auto-generated code says not change. possible? the petapoco database object has 4 constructors: public database(idbconnection connection) public database(string connectionstring, string providername) public database(string connectionstring, dbproviderfactory provider) public database(string connectionstringname) use database(string connectionstring, string providername) if want provide connection string.

security - How to implement authentication for inter module communication in my application? -

we have divided our large application several modules , want implement authentication system when 2 modules communicating each other in client-server fashion. don't want server's services accessible unless client presents kind of certificate or credentials. what's industry standard or popular way achieve this? thanks. kerberos may you, famous , practical authentication service open network systems hope helps!

date - Python Pandas: Group datetime column into hour and minute aggregations -

this seems straight forward after entire day have not found solution. i've loaded dataframe read_csv , parsed, combined , indexed date , time column 1 column want able reshape , perform calculations based on hour , minute groupings similar can in excel pivot. i know how resample hour or minute maintains date portion associated each hour/minute whereas want aggregate data set hour , minute similar grouping in excel pivots , selecting "hour" , "minute" not selecting else. any appreciated. can't do, df dataframe: times = pd.to_datetime(df.timestamp_col) df.groupby([times.hour, times.minute]).value_col.sum()

exception - In Python, how do I print an error message without printing a traceback and close the program when a condition is not met? -

i've seen similar questions 1 none of them address trackback. if have class so class stop_if_no_then(): def __init__(self, value one, operator, value_two, then, line_or_label, line_number): self._firstvalue = value_one self._secondvalue = value_two self._operator = operator self._gohere = line_or_label self._then = self._line_number = line_number def execute(self, otherclass): "code comparing first 2 values , making changes etc" what want execute method able if self._then not equal string "then" (in allcaps) want raise custom error message , terminate whole program while not showing traceback. if error encountered thing should print out (i'm using 3 example, formatting not problem) this. `syntax error (line 3): no -then- present in statement.` i'm not picky being exception class object, there's no issue in aspect. since using in while loop, simple if, elif repeats message

mysql - Login doesn't work when changed to mysqli -

require_once("config.php"); if(isset($_post['go'])) { $np = $_post['nm']; $ps = $_post['pass']; $np = mysqli_real_escape_string($np); $ps = mysqli_real_escape_string($ps); $q = "select * `pilots` `name`='$np' , `pass`='$ps'"; $query = mysqli_query($q); if(mysqli_num_rows($query)) { $_session['login'] = $np; header("location:index.html"); } else echo 'oi'; } this login after switched mysqli , doesn't work, connection if neede in config.php: session_start(); error_reporting(false); $connection[0] = 'localhost'; $connection[1] = 'michael'; $connection[2] = '123123'; $connection[3] = 'aodpanel'; mysqli_real_connect($connection[0],$connection[1],$connection[2],$connection[3]); //mysql_connect($connection[0],$connection[1],$connection[2]) or die; //mysql_select_db($connection[3]); error_reporting(false); - this root of problem. chang

serialization - Can Haskell functions be serialized? -

the best way representation of function (if can recovered somehow). binary serialization preferred efficiency reasons. i think there way in clean, because impossible implement itask, relies on tasks (and functions) can saved , continued when server running again. this must important distributed haskell computations. i'm not looking parsing haskell code @ runtime described here: serialization of functions in haskell . need serialize not deserialize. unfortunately, it's not possible current ghc runtime system. serialization of functions, , other arbitrary data, requires low level runtime support ghc implementors have been reluctant add. serializing functions requires can serialize anything, since arbitrary data (evaluated , unevaluated) can part of function (e.g., partial application).

Breadcrumbs in DocPad -

i'm dealing project has flat hierarchy when comes file , folder structure, means directly subordinated url. e.g. myproject.com/page1 this seems make bit more tricky integrate breadcrumb overview of on page, actual hierarchy of contents not flat. therefore of beginner friendly javascript breadcrumb solutions, more or less seem hierarchy out of file structure tree, won't job here. i thinking use meta information of documents assign/display hierarchy. unfortunately coffescript skills way low think how integrate breadcrumbs @ level. my idea (which might not clever one?!) have values "tier1", "tier2" , "tier3" in meta section, converted breadcrumb link structure coffeescript magic . does have hints how started? hope others getting discussion started - maybe come niftier solution approach? the docpad , bevry website accomplishes it's documentation rendering , corresponding hierarchy. however, code quite specialised. a breadcr

phpmyadmin - MySQL (mariadb) strange VARCHAR WHERE NULL behaviour -

this question has answer here: mysql: selecting rows column null 7 answers i have table like: id name (varchar) -------------------------- 1 test 2 3 null 4 test when query select * table name != 'some'; i result: id name -------------------------- 1 test 4 test why doesn't return rows name == null ? server version: 5.5.31-mariadb-1~squeeze-log - mariadb.org binary distribution (protocol version 10) client version: libmysql - 5.1.66 (mysqli) protokoll-version: 10 because comparing null results in unknown . have use is operator. select * table name != 'some' or name null

javascript - The loading order of Js code and ajax request of Jquery in the Dom -

function f(){ $.post('1.php',{},function(){window.location.href="../../2.php";}); } when click button,excute function f.the code above can run correctly , achieve wanted function.but when code changes follow format: function f(){ $.post('1.php',{},function(){}); window.location.href="../../2.php"; } the ajax request not work.i know has javascript load order,but want make clear in deep level.it nice of me , explain in detail.thank you! when have $.post('1.php',{},function(){}); window.location.href="../../2.php"; the second line executed first 1 has been executed. first statement launches ajax request, doesn't block until browser has sent whole request server. as second line replaces page, stops script , tells browser can stop being doing page, querying server. the solution have in first code : $.post('1.php',{},function(){window.location.href="../../2.php";}); the window.lo

ios - Video streaming between iPhones -

how can stream live video between 2 iphones in app? used opentok (tokbox.com), there can't processing video, example find face or that. there way connect 2 devices via server? thank you using opentok ios, there no way inspect video frames individually. might feature in future.

Setting Yaxis in Matplotlib using Pandas -

using pandas plot in i-python notebook, have several plots , because matplotlib decides y axis setting them differently , need compare data using same range. have tried several variants on: (i assume i'll need apply limits each plot.. since can't 1 working... matplotlib doc seems need set ylim, can't figure syntax so. df2250.plot(); plt.ylim((100000,500000)) <<<< if insert ; int not callable , if leave out invalid syntax. anyhow, neither right... df2260.plot() df5.plot() pandas plot() returns axes, can use set ylim on it. ax1 = df2250.plot() ax2 = df2260.plot() ax3 = df5.plot() ax1.set_ylim(100000,500000) ax2.set_ylim(100000,500000) etc... you can pass axes pandas plot, plotting in same axes can done like: ax1 = df2250.plot() df2260.plot(ax=ax1) etc... if want lot of different plots, defining axes on forehand , within 1 figure might solution gives control: fig, axs = plt.subplots(1,3,figsize=(10,4), subplot_kw={'ylim': (100000,

java - Is the object of an abstract class an anonymous inner class? -

this question has answer here: interview: can instantiate abstract class? 15 answers when create object of abstract class, have interface. abstractclass abstractclass = new abstractclass() { @override public void abstractmethod() { } }; does mean object of abstractclass anonymous inner class object? an object not class object (in context). derived class. in java there difference between classes , objects, compared e.g. prototype based languages (e.g. javascript) difference not exist. in example create anonymous class, create object of anonymous class , assign variable; in 1 step. anonymous classes inner classes: http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5 http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3

java - How to access the leaf or root bean from the ConstraintValidator.isValid method? -

is there way access leaf or root bean constraintvalidator.isvalid method? if not, there workarounds? thank you. marcos no, there isn't, reason being there no bean instance when invoking validator#validatevalue() .

Adding a WinForm control to a Word Document using VSTO -

i'd add labels word document, in margin. i've seen things date pickers , combo boxes can added document, can't see i'm after. i can controlcollection object via: globals.factory.getvstoobject(myapplication.activedocument).controls but there no methods adding labels. are there alternative methods adding labels document using vsto? [edit] so managed insert winform labels, extremely slow, confirmed in post: http://connect.microsoft.com/visualstudio/feedback/details/277090/adding-winform-controls-to-a-vsto-word-document-is-extremely-slow so i'm still looking alternatives. cannot find label-like contentcontrols suggested in thread above. so solution settled on use word shapes. snippet of code below shows how add label shape document. shape shape = doc.shapes.addlabel(office.msotextorientation.msotextorientationhorizontal, left,

css - Google Chrome clears :after-element left, all other browsers not -

Image
the following code render button (a link) background images in :before , :after pseudo-selectors flexible cross-browising result. problem is, chrome doesn't (safari, don't know). html: <div class="btn-container align-right more-info-btn"> <a class="btn" href="#">super button<i class="arrow-after-right"></i> </a> </div> css: .btn-container .btn { display: inline-block; text-decoration: none; height: 24px; background: transparent url('http://img842.imageshack.us/img842/5052/kdti.png'); padding: 0 6px; font-size: 11px; line-height: 21px; font-weight: bold; color: red; font-family: helvetica, arial, freesans, verdana, tahoma, 'lucida sans', 'lucida sans unicode', 'luxi sans', sans-serif; } .btn-container .btn:before { content:''; display: inline-block; background: transparent url('http:/

mysql - SQL - "merge" 3 tables with JOIN -

i want select users table depending 2 relation tables the structure: [user] uid | firstname | lastname | ... --------------------------------- 482 | usera | usera | ... 885 | userb | userb | ... 405 | userc | userc | ... 385 | userd | userd | ... [news_info] uid_local | uid_foreign -------------------------------- 125 | 482 100 | 405 [news_add] uid_local | uid_foreign -------------------------------- 125 | 885 105 | 385 now want select usera , userb via uid_local -> 125, [news_info] , [news_add] select nnfo.uid_local, user.* user join news_info nnfo on nnfo.uid_foreign = user.uid nnfo.uid_local = 125 result = usera // works select nadd.uid_local, user.* user join news_add nadd on nadd.uid_foreign = user.uid nadd.uid_local = 125 result = userb // works now "merge" sql statement one...to usera , userb select nnfo.uid_local, nadd.uid_l

python - BeautifulSoup replaces single quotes with double quotes -

in beautifulsoup4 python if exectue following commands: soup = beautifulsoup("<a href='http://somelink'>link</a>") print soup the output is: <a href="http://somelink">link</a> beaurifulsoup replaces single quotes double quotes , don't want that. how can cancel/overwrite behaviour? clarification: i use urllib2 html of following page: http://www.download3000.com/ , use beautifulsoup4 extract part of html. i have made function takes document (not html) , samples of needs catch , returns regular expression. feed function follwoing samples: samples = [ '/showarticles-1-0-date.html', '/showarticles-2-0-date.html', '/showarticles-3-0-date.html' ] given html code of http://www.download3000.com/ page , samples above, function returns following regular expressions: \w\w><li><a href="(.*?)">\w\w\w\w\w if apply regex html code of download3000, won't fi