Posts

Showing posts from March, 2010

php - Why is the upload path not valid? (Codeigniter) -

i have controller method 'do_upload' should upload image /img instead i'm getting following error: http://localhost/img/ the upload path not appear valid. this method of upload class. public function do_upload(){ $config['upload_path']= "http://localhost/img/"; $config['allowed_types']= 'gif|jpg|png'; $config['max_size']='100'; $config['max_width']='1024'; $config['max_height']='768'; $this->load->library('upload',$config); if(!$this->upload->do_upload()){ $errors=array('errors'=>$this->upload->display_errors()); echo $config['upload_path']; $this->load->view('error',$errors); } else{ $data=array('upload_data'=> $this->upload->data()); $this->load->view('admin/...

jquery - How to select a specific option in a dropdown that has multiple instances? -

here basic example of trying achieve : <select name="userid" id="userid"> <option value="1">charles</option> <option value="2">mike</option> <option value="3">jeff</option> <option value="4">kevin</option> </select> <select name="userid" id="userid"> <option value="1">charles</option> <option value="2">mike</option> <option value="3">jeff</option> <option value="4">kevin</option> </select> <select name="userid" id="userid"> <option value="1">charles</option> <option value="2">mike</option> <option value="3">jeff</option> <option value="4">kevin</option> </select> for instance, select third option (jeff) of second "use...

zend validation messages -

consider following part of form $name = new zend_form_element_text('name'); $name->setlabel('name: ') ->setrequired(true) ->addvalidator($empty) ->addvalidator($alpha) ->setdecorators($newdecorators); $this->addelement($name); i defined $empty , $alpha as: $empty = new zend_validate_notempty(); $empty->setmessage('some text', zend_validate_notempty::is_empty); $alpha = new zend_validate_alpha(); $alpha->setmessage('some text',zend_validate_alpha::not_alpha); now question: with code double validation message when input empty. first custom message , then: '' empty string when drop setrequired, empty validator not run. why this? don't want use setrequired, because if add errormessage setrequired, $alpha error message overwritten. thx, j this happens beca...

objective c - HTML to PDF conversion on iOS? -

i aware of taking screenshot of uiwebview , converting pdf need generate proper pdf (text text , not screenshot). save2pdf application creates proper pdf. have idea how it? i created class based on every advice found around. i've been digging lot , hope class offer start trying create multi-page pdf directly out of html source. you'll find whole code here basic sample code : https://github.com/iclems/ios-htmltopdf i had same issue , requirements were: - full pdf (real text, no bitmap) - smart multi-pages (compared cutting full height webview every x pixels...) thus, solution use pretty nice resorts same tools ios uses split pages print. let me explain, setup uiprintpagerenderer based on web view print formatter (first tip) : uiprintpagerenderer *render = [[uiprintpagerenderer alloc] init]; [render addprintformatter:webview.viewprintformatter startingatpageatindex:0]; cgrect printablerect = cgrectmake(self.pagemargins.left, ...

javascript - Windows Phone support in Socket.IO ( nodejs ) -

Image
i have developed mobile chat application using phonegap, jquerymobile, nodejs(socket.io) . working in android , iphone without code modification. client wants same ported windows mobile phone 7.i changed code make work on windows mobile phone. every functionality working except socket.io . , in http://socket.io#browser-support , there no windows mobile in supporting platform list (as in attached) . please me out ... although internet explorer on windows phone 7.5/7.8 based on ie9, doesn't have of features - unfortunately, websockets not supported . to confirm this, ran windows phone 7 , windows phone 8 emulators , directed internet explorer http://html5demos.com/web-socket . wp7 (ie9) showed 'sockets not supported' , windows phone 8 (ie10) showed 'socket open'.

javascript - How to refer to me html5 canvas drawing more than once? -

i've created drawing using canvas intend use multiple times various navigation links, problem when refer more once show 1. duplicate code each instance plan on using quite lot not ideal. please have @ code below , linked jsfiddle. many thanks. http://jsfiddle.net/ltu2h/ //first reference <canvas id="canvasid" width="50" height="50"></canvas> //second reference <canvas id="canvasid" width="50" height="50"></canvas> <script> var context = document.getelementbyid("canvasid").getcontext("2d"); var width = 125; // triangle width var height = 45; // triangle height var padding = 5; // draw path context.beginpath(); context.moveto(padding + width-125, height + padding); // top corner context.lineto(padding + width-90,height-17 + padding); // point context.lineto(padding, height-35 + padding); // bottom left context.closepath(); // fill path context.fil...

java - gettext under Mac OS X Lion for eclipse with maven -

i have java project in eclipse builds apache maven. the problem project doesn´t compile correcly because of gettext function missing. so did search , installed gettext follows: download gettext : http://www.gnu.org/software/gettext/ run these commands tar -zxf gettext-0.18.1.1.tar.gz cd gettext-0.18.1.1 then in gettext-0.18.1.1 run these commands ./configure make sudo make install unfortunately doesn´t solves problem. i found patching gettext on lion here: https://gist.github.com/1014218 don´t understand here , not sure if fix problem. if try compile project in terminal command: § maven compile i warning: [info] [gettext:dist {execution: convert-po-class}] [info] processing de/de.po [warning] msgfmt --java2 -d /.../workspace/target/classes -r **.**.**.**.translation -l de /.../workspace/po/de/de.po (... , ** privacy reasons) (in eclipse changed builder java builder maven. , if try run project in eclipse , not in terminal error: noclassdeffounder...

ajax - How can a JSF/ICEfaces component's parameters be updated immediately? -

i have icefaces web app contains component property linked backing bean variable. in theory, variable value programmatically modified, , component sees change , updates appearance/properties accordingly. however, seems change in variable isn't "noticed" component until end of jsf cycle (which, basic understanding, render response phase ). the problem is, have long file-copy operation perform, , the inputtext component show periodic status update. however, since component updated @ render response phase, doesn't show any output until java methods have finished executing, , shows changes accumulated @ once. i have tried using facescontext.getcurrentinstance().renderresponse() , other functions, such pushrenderer.render(string id) force xmlhttprequest initialize early, no matter what, appearance of component not change until java code finishes executing. one possible solution comes mind have invisible button somewhere automatically "pressed" bean...

c# - detecting type of generics within generics -

i have method accepts many different types of objects storage: public void store<t>(t item) { // works fine if (item foo) { // ... } // works fine else if (item observation<imagesignal>) { // ... } // isn't detected else if (item observation<signal<ispectrum>>) { // ... } else { // observation<signal<ispectrum>> hits this. throw new notsupportedexception(); } } can tell me how can detect this? edit: passing in object wraps object. eric right. problem solved. quick responses, however. in case wouldn't better overload store function? easier follow logic. public void store(foo item) { } public void store(observation<imagesignal> item) { } public void store(observation<signal<ispectrum>> item) { }

How to handle rounding errors in Java's BigDecimal -

i'm working open source project (axil) implements scripting engine inside of java applications , i've hit major stumbling block while trying utilize bigdecimal's rounding. seems bigdecimal converting input scientific notation , applying passed in precision coefficient of sn representation of number, rather non-sn representation. example: new bigdecimal("-232454.5324").round(new mathcontext(2, roundingmode.half_up)).tostring() produces result of -2.3e+5 . presents 2 problems me. first, expecting result of -232454.5 ( -2.324545e+5 ), getting -230000 throws off math involves result. , second, not expecting, nor can find way around, getting results in sn (though expect there formatting method out there haven't yet stumbled across). now due nature of project, can make few expectations size/type of numbers getting passed round() method, solution needs highly modular. have suggestions? if helpful here's link google code issue report bug in proje...

sql server - Can i user a where statement by first column? -

possible duplicate: is possible select sql server data using column ordinal position not sure if title help, i'm trying create general function , wondering if use column position in statements instead of column name. example select * table myid=1 would become this select * table [0]=1 does make sense? doable? guys. btw - using mssql 2005-2008 i think must column name of column position , generate execute query column name. below code column name of column position , execute query: declare @tablename varchar(100) declare @columnposition int set @tablename = 'table1' set @columnposition = 1 declare @columnname varchar(250) select @columnname = column_name information_schema.columns table_name = @tablename , ordinal_positio = @columnposition declare @query varchar(250) set @query = 'select * ' + @tablename + ' '+ @columnname + ' = 1' exec (@query)

android - Cannot find the file -

i'm experiencing trouble open file. i've used absolute path know file still cant open file (file not found) public void readfromfile() throws filenotfoundexception { /** read contents of given file. */ string sourceid = new string(); string logicalid = new string(); file filedir = getfilesdir(); string s = new string(); s+=filedir.getabsolutepath()+"/nodes.txt"; scanner scanner = new scanner(new fileinputstream(s)); try { while (scanner.hasnextline()) { sourceid = scanner.nextline(); logicalid = scanner.nextline(); string ss = new string(); ss+=" ----------------> "+sourceid+" "+logicalid+" "; log.v(tag, ss); listanodesstart.add(new nodestostart(sourceid,logicalid)); } }catch(exception ...

javascript - WebForm_AutoFocus is not being generated -

i have asp.net page not generate expected "webform_autofocus()" javascript, though explicitly calling .focus() on 1 of controls. there known scenarios factor prevent javascript being generated? specifically, when user clicks particular button, i'm creating new controls dynamically: in case text box. in onprerender i'm grabbing newly-created control , calling .focus() on it. idea is, when postback completes, browser gives focus newly-created textbox control. however, generated html (verified via firebug , fiddler) not contain webform_autofocus call @ all. in other scernarios, same page (on postback or on initial hit) calls .focus() on different control - 1 not dynamically created; in cases webform_autofocus() script generated perfectly, , well. unfortunately, i'm working on client system loves frameworks upon frameworks, , abstractions upon abstractions, cannot post meaningful/concise code sample here. however, if of friendly so'ers knows more ge...

c# - processing Xnode with Linq efficiently -

i have xml node following format. node must converted userdefined type each node must convert object of myclass class myclass { public string tag1id {get;set;} public int tag3val {get;set;} public string tag3id {get;set;} public int tag5val {get;set;} public string tag5id {get;set;} public datatime tag7val {get;set;} } <tag1 id="id1"> <tag2> <tag3 id="id3">10</tag3> <tag4> <tag5 id="id5">20</tag5> </tag4> </tag2> <tag6> <tag7>2010-12-31</tag7> </tag6> </tag1> i new linq, can done using linq. requirement xmlseralization should not used :( there other approach scenario can handled easily? no cannot done. there must conversion done somewhere due business logic plumbing go specific properties exacting node ids/locations. what can done code constructor takes in node , populates proper...

Generating XML in bash, need some efficient ideas -

i need generate xml file in bash(i new bash/scripting languages, despite working on c/c++/unix time). right now, generating this, pretty flat st='<' et='>' sl='/' ------------------- stag() { text=$st$1$et echo $text >> output_file } -------------------- etag() { text=$sl$1 stag $text } -------------------- attr() { text=$1 echo $text >> output_file } -------------------- #--function call stag "tag" attr "xml" etag "tag" -------------------- #--output <tag>xml</tag> in this, feel there lots of chance make errors , after coding in c++ long, think there should better structured way code.... thoughts appreciated.... or material think, should learn first, plz post here.... thanks... you looking xmlstarlet . depyx subcommand allows convert pyx markup xml. this may sufficient prototyping purposes. if not, you'll need @ more full-featured xml lib...

sql - Alternative to calling stored procedure in a view? -

i created query looking @ transaction information. time period criteria conditional - on 5th of month, needs @ days 16-last day of previous month. on 20th of month, needs @ days 1-15 of same month. run automatically. fine gentleman or woman on stack overflow gave me following stored procedure use, worked perfectly: declare @today smalldatetime, @start smalldatetime, @end smalldatetime; set @today = dateadd(day, 0, datediff(day, 0, current_timestamp)); set @start = dateadd(day, 1-day(@today), @today); set @end = dateadd(day, 15, @start); if datepart(day, @today) <= 15 begin set @start = dateadd(month, -1, @end); set @end = dateadd(day, 1-day(@today), @today); end select ... h.billed_date >= @start , h.billed_date < @end; now want converted view can access 3rd party data integration tool. google tells me views can't call stored procedures in sql server. dba said whole query converted stored procedure. how convert query sp can acc...

java - Interface with inner implementation - good or bad -

i working on project many someinterface - someinterfaceimpl-pairs. days ago got idea (probably inspired reading objective c code) include default implementations inner class. colleagues (all more java experience me) saw idea - feedback between shocked , surprised ("this working?"). i googled around bit didn't find evidence of usefulness of "pattern" (personal it): pdf-paper , a faq code style what think - in cases "default" implementation tightly coupled interface. update found this: java interface-implementation pair (see accepted answer) the whole point of interfaces separate users implementation (default or not). defeat including implementation inner class. don't save lines of code , clutter api. end having things hide inner class users of interface making private or default scope might better avoid. also, if default implementation needs change have published interface part of api. bad idea in not have lot of benefit , ant...

is there a way to stop all other events in a dojo onBlur event handler? -

maybe i'm on wrong track... the setup: have rather complex full dojofied web application. important part question longish form in central region of dijit.layout.bordercontainer navigation tree , action buttons in other regions. what want do: if user did enter data , did not save, should warning message if going leave form (if navigates away, klicks "new element" button,...). better user experience, wanted give modal dialog options "save", "leave anyway", "cancel". may idea use onblur event of form, stop other events (most onclick on other widget), check changes, if there changes, display dialog, otherwise let other events continue. not want add checkchanges method non-form active elements! for first test tried stop events... this works <div id="formarea" dojotype="dijit.form.form" encoding="multipart/form-data" action="" class="contentpane" region="center"> ...

ruby - Rails 3. How to find an associated model through another model? -

i have these models: expenses, scheduledcourses , scheduledsessions. scheduled_courses has_many scheduled_sessions scheduled_sessions belongs_to scheduled_courses expenses has_many scheduled_sessions scheduled_sessions belongs_to expenses i need find expenses associated particular scheduled_course. expenses have scheduled_session_id not scheduled_course_id. how that? scheduled_course: has_many :expenses, :through => :scheduled_sessions

ios - Split View-based template for iPad in horizontal? -

i´ve been reading different questions in stackoverflow ( what application template should use geolocation application? or main differenece between view-based , window-based application template? , example) in order understand template fit app best. split view-based template feels me choice, since want application user can have view content displayed (let´s say, example, image) set of miniatures of other elements available (the tableview). if, while taking first image 1 becomes available, last 1 appear in the set of miniatures. in way, user access received element, recognizing miniature (snapshot alike). the problem have tableview displayed @ bottom in horizontal, because gives better idea of how elements chronologically displayed , remaining space (in view) fits better have in mind. reading apple documentation without luck. actual question is; there way make template have tableview want be? if there no possibility change that, suggest? started doing coding, i´m open start agai...

matlab - GCC 3.4 vs 4.4 for C++ based MEX files? -

what trade-offs/concerns using gcc 3.4 vs 4.4 compiling modern matlab mex files? i need compile off-the-shelf c++ code ( kdtree ) mex file use matlab (r2012a) under fedora v16. have run symbol problems using latest gcc complier (4.6.x) cluster default. , system administrator resistant making gcc 4.4.x, officially supported compiler matlab available. (not sure why) so, instead proposing using legacy (circa 2006) gcc 3.4.6 compiler. question if trade-offs or issues there using older gcc compiler? performance? 64-bit support? thread safety (or multiple parallel calls)? etc? you're missing out on preliminary implementation of c++11 features (including standardized threads, variadic templates, etc http://wiki.apache.org/stdcxx/c%2b%2b0xcompilersupport ). long both compilers produce binaries abi compatible matlab/octave, there arent version-specific safety concerns. no c compiler can solve shared-state problems you. performance different, not significant. in either compil...

nexus - Why is Maven uploading incorrectly snapshots to release repository? -

i'm trying use maven-deploy-plugin upload releases , snapshots nexus repository. run across error [info] [deploy:deploy {execution: default-deploy}] [info] retrieving previous build number nexus uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.jar 56k uploaded (edr-app-1.0.4-20120605.140242-20.jar) [info] uploading project information edr-app 1.0.4-20120605.140242-20 [info] retrieving previous metadata nexus [info] uploading repository metadata for: 'artifact info.afilias.edr:edr-app' [info] retrieving previous metadata nexus [info] uploading repository metadata for: 'snapshot info.afilias.edr:edr-app:1.0.4-snapshot' [info] retrieving previous build number nexus uploading: http://localhost:8081/nexus/content/repositories/snapshots/info/afilias/edr/edr-app/1.0.4-snapshot/edr-app-1.0.4-20120605.140242-20.tar.gz 4286k uploaded (edr-app-1.0.4-20120605.140242-20.tar.gz) ...

javascript - D3js: how to get Lat/Log geocoordinates from mouse click? -

using d3js code , projected topojson data on map dataviz of any projection , how can geocoordinates ? such: var svg = d3.select("#viz").append("svg:svg") .attr("width", 320) .attr("height", 200) .on("mousedown", mousedown) .on("click", mouselocation); how geocordinates click on d3js map visualisation ? links demos welcome. edit: list of relevant demos : openlayers demo ... d3js. jason davies/rotate/ use of projection.invert(d3.mouse(this)) use d3.mouse pixel coordinates, , use projection ( d3.geo.azimuthal , here) invert x , y longitude , latitude. example: d3.select("svg").on("mousedown.log", function() { console.log(projection.invert(d3.mouse(this))); }); if want support clicking on background of svg, may want invisible rect pointer-events: all. (also note: older versions of d3 used d3.svg.mouse rather d3.mouse.)

dependencies - Vendoring a native tool while retaining maximum portability -

the twelve-factor app manifesto says web applications "... have clean contract underlying operating system, offering maximum portability between execution environments" [emphasis added me] but it says : twelve-factor apps not rely on implicit existence of system tools. examples include shelling out imagemagick or curl . while these tools may exist on many or systems, there no guarantee exist on systems app may run in future, or whether version found on future system compatible app. if app needs shell out system tool, tool should vendored app. and have earlier defined "vendored app" as: scoped directory containing app (known “vendoring” or “bundling”). how should done, when (on linux @ least) native 64-bit executables not run in 32-bit environments, example - let alone on other operating systems? or there better way of handling portability issue? in opinion, it shouldn't done @ all . because: if native executable...

verifytext in Selenium IDE script failing in IE even when it should be passing -

got selenium ide script recorded , being played using selenium server in -htmlsuite mode.it supposed put type user name, password , domain click login. after logging in, @ 1 corner, should show username @ domain. have verifytext this. when ran script in firefox, working correctly, in ie, keeps failing - giving me error message actual value 'username @ domain' did not match 'username @ domain'. tried assert , same thing. bug in selenium or something? you should try using waitfortext , waitforelementpresent or waitfortextpresent commands, depending on specific need. the reason being usually, when text created script on/after page load, selenium doesn't know - can't possibly wait every script finish, because there's lot of scripts never finish , run forever. therefore, need wait specific elements appear before can assert them.

node.js - Backend server software for facebook-like chat with PHP/MySQL/JS? -

Image
i developed facebook-like chat in php , javascript. it's plugin forum software. i'm using (short) polling receive new messages, i'd try better, sockets. what recommend kind of chat (available on every site, private chat, group chat..) : websockets, node.js socket.io, ejabberd... from personal experience there no socket library available php. 1 wants have socket library have fallback mechanisms if native socket support not available. 2 suggestions me : switch node.js + socket.io solution, discard php. have nodejs + socket.io chat system running separate server along php. put haproxy in front of webserver. divert socket request node.js , other request php. in way able use goodies of both node.js , php. i had similar situation , using option 2 :).

Modify __new__ attribute for inmutable types in Python -

im trying modify behaviour of 'int' type in python. it says '__new__' readonly. is there way it? thanks. you can't modify built-in type, can derive it: class myint(int): def __new__(cls, *args): # whatever

php - print readable costs from stored decimal -

is there way php show 2 (or x) decimal places, not show .00 if whole number? i've looked @ number_format , doesn't accommodates exactly.. though commas every 3 non-decimal places 34.00 => 34 34.7 => 34.70 12424.9=> 12,424.90 my numbers stored floats w/ 2 decimal places in database don't need that what check if it's whole number first, rounding using floor() , checking whether that's equal full decimal version. echo (floor($cost) == $cost) ? floor($cost) : number_format($cost, 2, '.', ','); or if (floor($cost) == $cost) { echo floor($cost); } else { echo number_format($cost, 2, '.', ','); } another option use money_format() : echo (floor($cost) == $cost) ? floor($cost) : money_format('%.2n', $cost); or if (floor($cost) == $cost) { echo floor($cost); } else { echo money_format('%.2n', $cost); }

pyscripter - Python 'list' object is not callable -

i tried running following code in pyscripter keeps returning error "'list' object not callable". ran code through python shell , worked fine. i'm not quite understanding why isn't working in pyscripter. also, i'm using python 2.7. import itertools print list(itertools.permutations([1,2,3,4], 2)) even creating simple list in pyscripter return same error. list() thanks in advance! almost you've rebound name list list instance: >>> import itertools >>> print list(itertools.permutations([1,2,3,4], 2)) [(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)] >>> >>> list = [2,3,4] >>> list(itertools.permutations([1,2,3,4], 2)) traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: 'list' object not callable don't call lists list , or strings str , etc..

Stop first jquery ui tab from preloading content with ajax -

i user jquery ui create dialog window hidden on page load. user opens dialog clicking button. once open, dialog has several tabs (created jquery ui tabs), each 1 displaying form user might need access to. actual forms loaded using ajaxoptions. is there way stop jquery preloading first ui tab on page load? instead, want content of first tab loaded when user clicks button open dialog. $( "#pref_tabs" ).tabs({ ajaxoptions: { success: function(xhr, status, index, anchor) { //function handle successful loading }, error: function( xhr, status, index, anchor ) { $( anchor.hash ).html( "couldn't load form. we'll try fix possible. "); }, } }); add additional option tabs options make no tabs selected default. $(sel).tabs({ selected: -1, ajaxoptions: {... });

Amazon Auto Scaling API for Job Servers -

i have read pretty entire documentation beyond on aws api understand stuff. however still wondering (without having used api yet since wanna find out first someone) if scenario viable as. say got bunch of work servers setup within group working on job each , comes time (i dunno say, avg cpu greater or in case less 80%) scale or down. my main worry loss of in progress job. maybe better explained example: i startup 5 job servers 5 jobs on them a job finishes on 1 , fires scale down trigger in amazon api amazon comes scale them down i lose job server running job (90% complete gotta start again) with in mind better me use amazon spot instance/ec2 api , manage own scaling or there missing how amazon api judges server terminations? to honest rather scale sqs waiting amount health figure on servers: for every 100 messages waiting increase cluster capacity 20% but doesn't seem viable either. so aws api not right solution or missing vital info how works? thank...

php - Why does PHP_SAPI not equal 'cli' when called from a cron job? -

here line cron job... */5 * * * * php /home/user/public_html/index.php --uri=minion --task=emailassets when script runs cron job, php constant php_sapi equals 'cgi-fcgi'. why php_sapi not equal 'cli'?

c# - Kinect smoothing mouse movement -

i'm working on project move mouse cursor using fingertip tracked kinect using depth image. i'm albe tracking problem in moving mouse in smooth way. in program, when move mouse doesn't move in smooth way , instead jumps pixel pixel. question , there way use smooth parameters of skeletal tracking inorder smooth cursor's movement ? i believe issue moving mouse when kinect depth event fires (when new information person's finger). there no function in windows, however, can create one. try implementing p (easy), pd (a little harder), or pid (a little harder still) controller using dy/dx of tracked finger. way, between kinect's depth events, mouse moving velocity, , should appear move more smoothly.

android - image gradiente missing degrade -

Image
i have image: but in app looks this: realize how degrading loses, why ocurred? , how repair this? i found solution here and here article on topic indicated sergey glotov

Android paypal integration -

This summary is not available. Please click here to view the post.

.net - MEF [ImportMany] without Lazy<T,TM> -

is possible access export metadata in mef without storing ilist<lazy<t,tm>> parts , ilist<t> parts no, cannot metadata after fact. must import along parts themselves. think of import contract specifying needs of component. if needs access metadata of dependency, shouldn't hide that. see nicholas blumhardt's post the relationship zoo , kind of relationship between components described a needs know x b before using it . point metadata aspect of relationship between components, not should handled separately somehow.

c# - How to get all the rows from a table -

how best way rows in table linq? upfront have generated *.dbml file , created dbcontext. just reference generated enumerable collection in context class: var allrecords = context.sometable;

windows 8 - WinRT Sharing Source Contract both HTML and Files -

it doesn't appear can provide both html content , file content in datarequestedevent handler. if provide html content (via args.request.data.sethtmlformat(xxx)) , file (via args.request.data.setstorageitems(xxx)) share charm says "there's nothing share". anyone got ideas or design? var htmlexample = "<p>here our store logo: <img src='images/logo.png'>.</p>"; var htmlformat = windows.applicationmodel.datatransfer.htmlformathelper.createhtmlformat(htmlexample); request.data.sethtmlformat(htmlformat); full exemple here http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.datatransfer.datapackage.sethtmlformat

ios - crash to perform a popover segue from a ModalView -

i need open popover subview inside modalview. these subviews added on modalview @ viewdidload using [self.storyboard instatiateviewcontrollerwithidentifier:identifier] when click open popover application exit without information crash. the sample project error can downloaded here (https://www.dropbox.com/s/mjpaqk6xwt86dbd/popovertest.zip) i´m using xcode 4.3.1 , ios sdk 5.0 , storybord. thanks andré in viewdidload, you're instantiating bunch of view controllers instantiateviewcontrollerwithidentifier: , aren't retained or referenced anywhere after that. i'm pretty sure arc releasing them @ end of viewdidload, causing crash. if didn't this, leak. one solution store view controllers in array, , release on viewdidunload.

javascript - Function chaining -

i struggling understand how javascript code work. learning js, , not exposed dynamic, functional language before. so, visualize function calls in bit procedural, hierarchical order. d3.js, 1 can draw svg elements explained here var dataset = [ 5, 10, 15, 20, 25 ]; d3.select("body").selectall("p") .data(dataset) .enter() .append("p") .text("new paragraph!"); let’s change last line: .text(function(d) { return d; }); check out new code on demo page. whoa! used our data populate contents of each paragraph, magic of data() method. see, when chaining methods together, anytime after call data(), can create anonymous function accepts d input. magical data() method ensures d set corresponding value in original data set, given current element @ hand. this magic, mentioned above fail understand. "d" not global variable, if change (c) name, still works. so, data method may setting value anonymous fn. but, ty...

sql - AppEngine Entities and management -

i going use app engine app building. i doing this.. app user enters in information class employee(db.model): first_name = db.stringproperty() last_name = db.stringproperty() hire_date = db.dateproperty() location = db.stringproperty(); attended_hr_training = db.booleanproperty() employee = employee(first_name='antonio', last_name='salieri') employee.hire_date = datetime.datetime.now().date() employee.attended_hr_training = true employee.put() once user inserted user receive number identified while in database. i notify pc app new user has been added , pc have ability send app , message goes correct id message intended for. is possible app engine? edit: i have main pc app connects each entity gets notified when new entry made. i not mean "number identified". you can store record key emp_key = employee.put() let access record without doing database query. if mean. as far notifying "pc app...

mysql - Same month two different SUMS -

i'm trying different sums same month on same year, sums different types. tried using code: select a.invoice_type, year( a.date ) year, date_format( a.date, '%m' ) `month` , sum( x.amount * x.price ) sum records x join paper_invoice on x.invoice_id = a.invoice_id year( a.date ) = '2012' group a.invoice_type, year( a.date ) , month( a.date ) limit 0 , 30 but gives results in different rows: http://www.part.lt/img/1505f0f13172922150febede85ddbf0925.png but need like: year | month | sum_grynais | sum_pavedimu 2012 | january | 7597.14997705445 | 58740.2800849304 and etc. try this: select year, month, max(case when invoice_type = 'grynais' sum end) sum_grynais max(case when invoice_type = 'pavedimu' sum end) sum_pavedimu ( select a.invoice_type, year( a.date ) year, date_format( a.date, '%m' ) `month` , sum( x.amount * x.price ) sum records x join paper_invoice on x.invoice_id = a.invoice_...

xml - Perl - Parsing Property Lists? -

which best method parsing mac property lists perl? i'm trying write script parse plists containing various arguments, including nested within layers of containers (arrays in dictionaries, or dictionaries in dictionaries). as far can tell, there 's few options: mac::propertylist module on cpan. however, it's quite low-level , warning gives me pause: you shouldn't use in applications--build interfaces on top of don't have put heinous multi-level object stuff people have @ it. i have option convert plists format, i'm considering using xml parser module, well. i'm not sure best in situation. i've read that plists can converted json in os x 10.7, if there exists perl libraries parsing json, i'm open too, long isn't of headache dealing nested entries. any suggestions? update : @ point i'm highly leaning towards json option, because it's less of headache xml. data::plist mac::propertylist mac::tie::plist...

algorithm - how facebook extract abstract of shared linked (articles) ? -

when sharing article on facebook in status, facebook generates title, abstract , attach image shared article. for instance, putting www.stackoverflow.com in status geenrate stack overflow https://stackoverflow.com/ collaboratively edited question , answer site professional , enthusiast programmers. it's 100% free, no registration required. (which btw: not in source code of stackoverflow.com page) but when trying article in news website, extracted results source code of page (check article in www.goal.com example) .. any idea algorithm facebook uses ? the meta data used facebook display links extracted html source code. as @amit said, description present in source , title taken title tag. can see facebook complaining though if check url in debugger . if click last link on page ( see our scraper sees url ) can see response fb scrapper getting. this source can differ in browser (though not in case) since websites check user agent string , if it's fb s...

arrays - Utility for tile-based map generation -

i started working in 2d tile-based game, , how i'm planning generate maps: have array tiles in maps, every element integer represent tile must rendered in position, instance... int tiles[100] = { 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,1,1,1,1,0,0,0, 0,0,0,1,1,1,1,0,0,0, 0,0,0,1,1,1,1,0,0,0, 0,0,0,1,1,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, }; as can imagine problem comes bigger maps, 100 tiles , i'll need few thousands...i can't hand. so, question is: guys know utility can me this? visual tool can draw map , obtain array? i'm pretty sure have seen in past, sadly i'm unable find now. thanks in advance. use graphics editor gimp or paint, load resulting image , use pixel data (for example library libgd .

sql - How compare two int list, resultset? -

i have 2 list of integer in resultset in query, ex: list_1: 11,16,28... list_2 11,16,19.. how can compare 2 list in condition?? condition if list different, make select. this code: select cosechaanterior.c_fk_idboleta 'boleta_p16', cosechaanteriordestino.c_fk_idboleta 'boleta_p17' clt_cosechaanterior cosechaanterior inner join clt_cosechaanteriordestino cosechaanteriordestino on cosechaanterior.si_fk_iddesglose = cosechaanteriordestino.si_fk_iddesglose inner join blt_boleta boleta on cosechaanterior.c_fk_idboleta = boleta.c_pk_idboleta --boleta.c_pk_idboleta = 44990112--@id_boleta (select si_fk_iddesglose clt_cosechaanteriordestino cosechaanteriordestino substring(cosechaanteriordestino.c_fk_idboleta,5,4) = '0112' , cosechaanteriordestino.c_fk_idboleta = 44990112) (select si_fk_iddesglose clt_cosechaanterior cos...

javascript - How to disable default maxlength of input field? -

i discovered chrome seems have default maxlength setting input fields in html. can insert string length 8649. is there method increase maxlength? according test, chrome has no default value maxlength , , can enter 10,000 characters in input field (on chrome 20 beta, win 7). may have tested actual form submission using method, in case there may browser-dependent , server-dependent restrictions on total length of form data. inspecting dom on chrome, input element has no default maxlength , has maxlength , value 524288.

Android Layout nullpointerException -

i having weird exception!. first reference relative layout, try visibility state, activity crashes , throws nullpointerexception @ getvisibilty() ; have no idea why!, spent lot of time trying figure out problem couldn't!,here activity code: setcontentview(r.layout.main3d_activity); relativelayout optionlayout; optionlayout = (relativelayout) findviewbyid(r.id.main_optionlayout); int vis= optionlayout.getvisibility(); main3d_activity code: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainlayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <include android:id="@+id/include_headerbar" android:layout_width="fill_parent" android:layout_height="60dp" ...

python - Identifying one number between a list of lists -

i have list this: a = [[2, 3], 5, 7, 8, [2, 3], 1, [9, 2]] i want compare values in nested lists ([2, 3], ..., [2, 3], ..., [9, 2]) , extract number appears once, in case 9, if find number appears in 1 list in list. answer block i.e: a = [[2, 3], 5, 7, 8, [2, 3], 1, [9]] messy, hard read list comprehension, other answers so long ! include list member if it's integer, or if it's sublist has members occur more once in combined list of sublists. otherwise, is, if sublist members unique in sublists, include unique members sublist. >>> = [[2, 3], 5, 7, 8, [2, 3], 1, [9, 2]] >>> l = [y x in if type(x) == list y in x] >>>> [x if (type(x) == int) else x if all([l.count(y) > 1 y in x]) \ else [y y in x if l.count(y) == 1] x in a] [[2, 3], 5, 7, 8, [2, 3], 1, [9]]

php - uploading three picures -

i've been struggling code. want upload few pictures @ same time, it's not getting me anywhere. want allow users upload 3 pictures ads listing. appreciate help. <?php if(isset($_post['upload']) && $_files['userfile']['size'] > 0 ) $title = clean($_post['title']); $description = clean($_post['description']); $category = clean($_post['category']); $price = clean($_post['price']); $name = clean($_post['name']); $number = clean($_post['number']); $email = clean($_post['email']); $subcategory = clean($_post['subcategory']); $state = clean($_post['state']); $city = clean($_post['city']); $imagename = basename($_files['userfile']['name']); // picture upload system $imagename = basename($_files['userfile']['name']); if(empty($imagename)) { $error = 1; echo"<h2 class='error'>image not found</h2>".$back...

Deploying multi-dependency .NET Winforms app via cloud/virtualised environments -

we have developed .net winforms app connects central sql server database via webservices. thick client relies on number external dependencies such microsoft office, office web components , .net framework 4.0. what options available deploy such application (just .net winforms thick client part) virtualized app? things trying achieve are: simplify installation process, users have install number of prerequisites each own idiosyncrasies in various windows environments. homogenize user experience , reduce support costs. additionally, allow app run on platforms other windows. the scale looking @ approximately 10,000 desktop users. i have looked @ cloud paging offering numecent http://www.numecent.com/technology/cloudpaging.html , similar required. want know if has had experiences transferring traditional .net winform apps virtualized offering , if has suggestions , ideas. you on right track. numecent addresses delivery of .net application , allows integration of ex...

ios - GDataServiceGoogleDocs -

i incorporating gdata objective-c, trying out google docs api. however, have been running following issue compile: undefined symbols architecture i386: "_objc_class_$_gdataservicegoogledocs", referenced from: objc-class-ref in gdataviewcontroller.o "_objc_class_$_gdataquerydocs", referenced from: objc-class-ref in gdataviewcontroller.o ld: symbol(s) not found architecture i386 i have searched many places, answers sparse. particularly solution seems whether or not compiling in 32/64 bit, post suggests: undefined symbols: "_objc_class_$_gdataservicegoogledocs" . however, not understanding how correct this, since first time running problem, have checked both architectures under project , targets's build settings are standard(armv7) - $(archs_standard_32_bit) thanks lot! p.s compiling ios5.1 , xcode 4.3.2 how incorporate google docs api app? sources or static library? "particularly solution seems whether or...

playframework 2.0 - Play 2.0 How to Post MultipartFormData using WS.url or WS.WSRequest -

in java http request, can make multipart http post. httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(url); filebody bin = new filebody(new file(filename)); stringbody comment = new stringbody("filename: " + filename); multipartentity reqentity = new multipartentity(); reqentity.addpart("bin", bin); reqentity.addpart("comment", comment); httppost.setentity(reqentity); httpresponse response = httpclient.execute(httppost); httpentity resentity = response.getentity(); how achieve same using ws.url or ws.wsrequest? wsrequestholder wsreq = ws.url("http//url"); wsreq.setheader("content-type", "multipart/form-data"); this sloppy, , can cleaned up, here's did working. feel free make better. import java.io.bytearrayinputstream; import java.io.bytearrayoutputstream; import play.libs.ws; import com.ning.http.multipart.filepart; import com.ning.http.multipart.multip...