Posts

Showing posts from July, 2011

.net - Seralizing data to and from string with soap message style -

i have web service proxy. on proxy there method takes 2 custom types. when call web service, soap message generated. in scenario, capture soap message manually (using fiddler). able de-serialize string containing soap message (that read manually created file) instances of 2 original types. i know easy enough xml dom, xpath, , xml serialization 2 types. i'm doing this, though 2 separate files. i'd combine them, , avoid manual formatting of captured soap message. is there more automatic way leverage existing soap infrastructure deserialization? i'd write serialization code once , expect work. it appears .net framework doesn't expose in easy use manner. custom code writes/reads data (in soaphttpclientprotocol , soapserverprotocol ) not directly exposed user. you can use code @ least guts of request map correctly: xmltypemapping xmltypemapping = new soapreflectionimporter() .importtypemapping(typeof(t)); var xmlserializer = new xmlserializ

Checksum of SELECT results in MySQL -

trying check sum of results of select statement, tried this select sum(crc32(column_one)) database.table; which worked, did not work: select concat(sum(crc32(column_one)),sum(crc32(column_two))) database.table; open suggestions, main idea valid checksum sum of results of rows , columns select statement. the problem concat , sum not compatible in format. concat designed run once per row in result set on arguments defined row. sum aggregate function, designed run on full result set. crc32 of same class of functions concat . so, you've got functions nested in way don't play nicely together. you try: select concat( (select sum(crc32(column_one)) database.table), (select sum(crc32(column_two)) database.table) ); or select sum(crc32(column_one)), sum(crc32(column_two)) database.table; and concatenate them client language.

javascript - how do i stop a form submit with jQuery -

i have form here , dont want them go next page without selections <form method="post" action="step2/" id="form1"> .... .... .... <input type="submit" class="submit notext" value="next" /> and here jquery $('.submit').click(function(e) { var business = $(".business_type_select").find('.container strong').text(); alert(business); if(business == "select business type"){ alert("businessbusinessbusiness"); e.preventdefault; return false; } }); any ideas missing stop submitting try using submit event: $("#formid").submit(function(e) { var business = $(".business_type_select").find('.container strong').text(); alert(business); if(business == "select business type"){ alert("businessbusinessbusiness"); return false; } }); also, e.prev

Do we have to create an application for iPhone and iPad separately? -

ok, got application development world driving me crazy mobile stuff. when creating application have create/code iphone , ipad version of application separately , wrap them or like? dont want use 2x button on ipad , want different even. there ton of questions on related this, , without knowing particular situation difficult point single 1 address needs. however, blog post , though on year old now, should out bit. the recommendation apple if you're starting scratch create universal application in xcode , create 2 versions of ui (one iphone , 1 ipad).

networking - How do you send a User defined class object over a tcp/ip network connection in java? -

this example of user defined class i'd send client application server application: class datastruct implements serializable{ byte data; int messagenum; public void setdata(byte datum, int messagenumber){ data=datum; messagenum=messagenumber; } } how send user defined class on tcp/ip connection in java? what types of streams can use accomplish (if i'm sending more text)? can pass full object via socket stream, or have cast after has been passed via stream? i'm writing server/client application, , i've been able find tutorials examples of primitive types or strings being passed on network connection - not user defined types. your , direction appreciated. use objectoutputstream on sending side , objectinputstream on receiving side. to bit more clear, here example (without exception handling). sending side: datastruct ds = ...; objectoutputstream oos = new objectoutputstream(socket.getoutputstream()); oos.writeo

c# - How to clean up COM references in .NET when app will be left running? -

i working on .net program starts new instance of excel, work, ends, must leave excel running. later, when program runs again, attempt hook previous instance. what best way handle releasing of com objects in situation? if not "releasecomobject" on app object first time, on second run active object, release com object, have memory leak? the following simplified code illustrates trying do: private microsoft.office.interop.excel.application xlsapp; private microsoft.office.interop.excel.workbook xlswb; public void runmefirst() { //start new instance system.type osetype = type.gettypefromprogid("excel.application"); xlsapp = activator.createinstance(osetype); xlswb = xlsapp.workbooks.open("c:\\test1.xls"); //do stuff xlswb.close(false); cleanup(ref xlswb); //do not quit excel here //no cleanup of xlsapp here? ok? system.environment.exit(0); } public void runmesecond() { //hook existing instance

Is there an easy way to use ASP.NET caching with Entity Framework 4.1 Code First? -

we using ef code first app fabric cache on windows azure (although, think question more generic since using asp.net caching provider). there easy way enable caching of dbset objects? our db small , not updated frequently, ideally cache entire database in memory, , use ttl expiry refresh object sets. advise experience caching using ef code first great. don't that . if want cache data, extract them separate lists , cache them separately. caching dbset means caching dbcontext promote anity-pattern in entity framework. problems identity map , unit of work described in linked answer. problem there no real refresh. if want refresh data must dispose context , create new one. context not thread safe sharing among multiple requests can cause unexpected results.

How does Google App Engine data store scale with Polls -

if have poll application on gae being simultaneously updated across several continents, given app has been replicated across google infrastructure, data store keep accurate count? need design consideration such application? applications aren't replicated across google's infrastructure worldwide. if you're using master-slave datastore (the default until recently), consistent, , reads served single datacenter (with data replicated datacenter backup, not serve requests ordinarily). hr datastore, eventual consistency outside of transactions, believe of data in north america , latency isn't anywhere near might expect if data being stored on different continents (and, in case, can use transactions).

cgi - Hidden Field Manipulation in Perl -

i'm trying write multi question survey in perl displays 1 question @ time "previous" , "next" button. need read questions file, haven't gotten far yet hard coding them in now. part of assignment requirements must use cgi, cannot print html directly. currently have script printing out first question, along 2 submit buttons, 1 labeled 'next' , other 'previous'. print $form->submit(-name=>'question', -value=>'next'); print $form->submit(-name=>'question', -value=>'previous'); i have hidden field: print $form->hidden(-name=>'hidden', -value=> $currentq); my idea once next clicked, increment (or decrement, if previous clicked) $currentq script knows question on. the problem i'm having manipulating hidden field once button pushed. have: my $direction = $form->param( 'question' ) || ''; if ($direction eq 'next'){ $currentq++; }

android - set default zoom level on mapView -

i have made seekbar zoom controler map view follows myzoombar = (seekbar)findviewbyid(r.id.zoombar); setzoomlevel(); myzoombar.setonseekbarchangelistener(myzoombaronseekbarchangelistener); and private seekbar.onseekbarchangelistener myzoombaronseekbarchangelistener = new seekbar.onseekbarchangelistener(){ public void onprogresschanged(seekbar seekbar, int progress, boolean fromuser) { // todo auto-generated method stub setzoomlevel(); } public void onstarttrackingtouch(seekbar seekbar) { // todo auto-generated method stub } public void onstoptrackingtouch(seekbar seekbar) { // todo auto-generated method stub } }; private void setzoomlevel() { int myzoomlevel = myzoombar.getprogress()+1; mc.setzoom(myzoomlevel); toast.maketext(this, "zoo

c# - why store internationalization "words" in separate (xml) files? -

i've been reading bit on how people internationalization. seems common consensus save strings in separate file (usually xml) , load when necessary. i'm wondering why not store strings in database instead? isn't better way? btw nature of app website app. the important thing store string tables outside of compilation units incorporating updated translations not require rebuild. allows new or updated translations incorporated @ later point without hassle. of course, string tables stored anywhere. if want put them in database, knock out. long application can reach them , translation staff know how deliver them right place, doesn't make difference.

linux - Shell scripts for Meld Nautilus context menu -

beyond compare provides "select compare" , "compare selected" using 2 nautilus scripts (stored in /home/user/.gnome2/nautilus-scripts ). script 1: select compare #!/bin/sh quoted=$(echo "$nautilus_script_selected_file_paths" | awk 'begin { fs = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##) echo "$quoted" > $home/.beyondcompare/nautilus script 2: compare selected #!/bin/sh arg2=$(cat $home/.beyondcompare/nautilus) arg1=$(echo "$nautilus_script_selected_file_paths" | awk 'begin { fs = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##) bcompare $arg1 $arg2 i trying similar scripts meld , not working. i not familiar shell scripts. can me understand this: quoted=$(echo "$nautilus_script_selected_file_paths" | awk 'begin { fs = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\

ruby - Nginx Setup on Ubuntu -

i'm trying setup nginx passenger work on ubuntu rvm. should apps home page when go localhost, instead recieve default nginx home page. user antarr; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { passenger_root /home/antarr/.rvm/gems/ruby-1.9.2-p180@myapplication/gems/passenger-3.0.7; passenger_ruby /home/antarr/.rvm/wrappers/ruby-1.9.2-p180@myapplication/ruby; include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_tim

ruby on rails - What is causing these errors in my Heroku app? -

i getting following errors when heroku worker runs delayed_job , cannot work out why. first error seems related evernote gem , though don't have code @ uses yet in entire project. have is gem 'evernote', "~> 0.9.0" in gemfile. the second 1 seems related newrelic heroku addon, application monitoring service. monitor application have no idea causing error. what causing these errors? 1st 2011-05-11t03:31:22+00:00 heroku[worker.3]: stopping process sigterm 2011-05-11t03:31:22+00:00 app[worker.3]: rake aborted! 2011-05-11t03:31:22+00:00 app[worker.3]: sigterm 2011-05-11t03:31:22+00:00 app[worker.3]: /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require' 2011-05-11t03:31:22+00:00 app[worker.3]: /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `block in require' 2011-05-11t03:31:22+00:00 app[worker.3]: /app/.bundle/gems/ruby/1.9.1/gems/activesuppo

osx - How do you "echo" the last configure/make build --options within a source directory? -

when doing a gnu-style " ./configure, make, , install " - specific options, flags, etc... know, can black art.. , works 1 piece of software may not other... now, imagine you had built package xyz.app options like... % ./configure --with-1=2 usflag="-3 four" obscure_lib=l/lib/doihave and gone ahead , used it. great. @ later point, you realize need omitted compile-time option, or maybe you've resolved dependency issue, etc... whatever reason, want recompile binary. now... how can "recall" of options passed ./configure, verbatim, use same options, while possibly adding or subtracting some, time around? i'm sure stuff buried somewhere in config.xxxx or aclocal or makefile.xx files, life of me, haven'e been able google 1 straight answer. % file /usr/bin/$1 --> mach-o 64-bit executable x86_64 % ld /usr/bin/$1 --> -macosx_version_min not specificed, assuming 10.6 % make -d --> * 20 pages of makefile non

python - Django: saving data from user input and display -

i have form jwysiwyg editor. looking @ it, can use basic-formatting html tags using formatting buttons so's. upon submitting form, notice saved database as-is, whereas if enter stuff <iframe> ... </iframe> editor notice html-encoded inside table. now, when need output whatever user has submitted, can safely use {{ output|safe }} display formatted text? is reasonably secure enough or how should rectify? use safe filter if html-escape data first. otherwise should use escape . if want users able input data html tags try sanitize input prevent users using <iframe> , <script> , etc, allow other tags white-listed, , mark safe .

cocoa touch - How to reuse CALayer -

i want use cagradientlayer each of cell backgrounds in custom table scroll view. if allocate cagradientlayer each cell, scrolling slow, somehow reuse gradient each cell, sort of how can reuse uiimage in uiimageview . such thing possible? gradient = [cagradientlayer new]; gradient.frame = innerview.bounds; gradient.colors = [nsarray arraywithobjects:(id)topcolor.cgcolor, (id)bottomcolor.cgcolor, nil]; //gradient.shouldrasterize = yes; [innerview.layer insertsublayer:gradient atindex:0]; i realized render gradient ( renderincontext: ) context using uigraphicsbeginimagecontext() , reuse image obtained it.

css - Wordpress - Custom fields & Class Identifiers -

in wordpress - how assign class custom fields? attempting target multiple custom fields custom css, seem unable give them separate classes. this not best solution, worth shot, i'd loop per field get_posts this: $args = array( 'meta_key' => 'custom_attribute', 'meta_value' => 'value1', ); $value1 = get_posts($args); $args = array( 'meta_key' => 'custom_attribute', 'meta_value' => 'value2', ); $value2 = get_posts($args); so give 2 arrays, each 1 pulling different posts, can foreach going through each array (value1 , value2) , adding classes needed.

multithreading - change the thread pool size of JVM -

i need change thread pool size of jvm . there possibility this. running high threaded jar on jvm. thats why threads goes under sleep or block stages. the jvm doesn't have global thread pool per se. if using 1 of java.util.concurrent.executor-implementations, read on javadoc class/method. adjusted in java-code per pool have created (from code) , not related jvm. that said, please consider each thread (typically) consumes 512k of virtual memory it's stack, limits number of maximum available threds 32-bit jvm (but doesn't sound problem @ all). when threads block lot have kind of contention, meaning have common resource waiting for. perhaps you using "synchronized" lot? more threads won't solve problem, rather consume more resources in os , jvm. please bit more details of code doing , how, , perhaps can bit more.

c# - WCF service throw Exception for some types -

i created wcf service.in data contract have 2 attributes lets say: [datamember] private user objuser; and [datamember] private tempclass objtemp; i have , set property both attributes. in implementation class, have object of datacontract class... lets say. objdata . when assign objdata.objtemp=(function return objtemp); the service work fine. but, when assign. objdata.objuser=(function return objuser) it throws following error: the underlying connection closed: connection closed unexpectedly. when comment objdata.objuser=(function return objuser) it works fine again. when inspect code inside user class, found 1 property creating problem. when change property property works fine too; not know why property creating problem. the property this: public ipaddress ip { get; set; } now ipadress class contains constructor, , , set ip variable. in get, returns ip variable. in set checks condition , assign value ip variable. if condition fails, throws

c++ - DLL and Name Mangling -

i have third-party lib has symbols exported plain c/cdecl, example dumpbin.exe /symbols reports both __imp_nvmlinit , nvmlinit exported. however in visual studio 2010 when try import them, header file have extern "c" nvmlreturn_t nvmlinit(...); but when try compile, following error: main.obj : error lnk2019: unresolved external symbol _nvmlinit referenced in function _main how can stop visual studio looking symbol leading underscore? __declspect(dllimport) doesn't work because decorates __imp__nvmlinit (one underscore many). thanks. that linker error. need link .lib file associated dll, give linker promise function available @ run-time when dll loaded.

javascript - jQuery UI Tabs with two shades of "not selected" -

i've been given design build uses tabbed navigation structure, i've built far using jquery ui's tabs plugin. so far, good. alas, i'm trying style tabbed element such selected tab (li.ui-tabs-selected) has white background , 2 other tabs have green background -- but, , here's sticky part, each has different shade of green. put way: i have 3 list elements, class .ui-state-default. selected 1 given class .ui-tabs-selected , white; unselected ones 2 shades of green, lighter shade further left, , no 2 tabs same colour (i.e., 1 each of white, dark green , light green), regardless of selected. how make non-selected tabs 2 different colours when both have same classes? thanks! so, need this: $('#tabs').bind('tabsselect', function(event, ui) { $('#tabs ul li').each(function(count) { $(this) .removeclass('tab0 tab1 tab2 tab3 tab4') .addclass('tab' + abs(ui.index - count)); }

java - JNI what types can I use instead of given (unsigned int, const char*, const wchar_t*, .... ) -

stackoverflow users ! i trying covert functions had written in c++ java. have .so library witch have written in c++ , must call functions android application. functions this: unsignd int uninitialize(); --------------------------------------- unsignd int deviceopen( const wchar_t* deviceid, unsigned long* phdevice); --------------------------------------- typedef struct blobdata_s { unsigned long length; unsigned char data[1]; } dsmblobdata_t; unsignd int enroll( unsigned long hdevice, const char* userid, blobdata_s* pinputinfo, void* puserdata); now how can see have functions , typedefs want write in java style, problem there no unsigned int java type ( link ). knew instead of int can use jint , instead of char* can use jchar* must with const wchar_t* unsigned long unsigned char what can use instead of types. i try in way jint java_com_example_testapp_testapp_deviceopen( jchar* de

php - zend module specific ini with phpSettings.display_errors -

been trying override phpsettings.display_errors application/modules/module5/config/module.ini. my module5/bootstrap.php has protected function _initmoduleconfig() { $inioptions = new zend_config_ini(dirname(__file__) . '/configs/module.ini'); $this->getapplication()->setoptions($inioptions->toarray()); } so file parsing the phpsettings given in application.ini getting loaded while given in module.ini getting ignored. while on application/bootstrap can $this->getapplication() properly. php settings take effect. while im on application/modules/module5/bootstrap.php loose application object, getapplication() returns bootstrap while nothing, php settings don't activated. looking @ filesystem , shouldn't module.ini file in config folder in module , called application.ini instead?

c# - Color harmonies:triada, complement, analogous, monochromatic -

i need in color math. have 1 main color , need other colors of chosen harmony. need such color harmonies: triada, complement, analogous, monochromatic. need them in c#. appreciated. thanks, dima. ok, revolves around color wheel described in link . suggest hardcoding colors in array. i'm assuming main color 1 of 12. one helper method we're going need 1 wrap values around array, such color -1 becomes color 12 (index 11 in array): int wrapcolor(int colorindex, int numwheelcolors) { while(colorindex < 0) { colorindex += numwheelcolors; } colorindex = colorindex % numwheelcolors; } we need helper method index of color on color wheel: int getcolorwheelindex(color color) { if (colorwheelarray.contains(color)) return colorwheelarray.indexof(color); else throw new invalidargumentexception("color"); } now everything's in place (assuming you've got array called colorwheelarray, containing colors i

workflow foundation 4 - Abandoned instances that will not continue execution (zombie instances) -

i have lot of wf instances hosted in iis/was in running (idle) state not though don't have such long delay or active bookmark. tracking enabled (healthmonitoringprofile). as tracking data deleted, end without tracked instance or events. the way make them work again suspend , resume them, failing , pain. has had issue? help? thanks in advance in case triggering error , abort leaving state. there no trigger them start executing sit there , nothing. default option abandonandsuspend can resume them. need figure out causing them fault , can see in traced information.

import - Lua: Include file in the same directory -

i'm using imapfilter , , i'd keep global configuration in public repository , while keeping local (and secret) configuration in separate file. i'm running imapfilter directory, includes ~/.imapfilter/config.lua, , that should include ./config_local.lua, "." directory of config.lua , not shell $pwd or location of imapfilter . here's i've tried far: require "config_local" require "./config_local" edit: absolute path works: dofile(os.getenv("home") .. "/.imapfilter/config_local.lua") not elegant, @ least it's compatible cron . add path package.path . something (not tested): package.path = package.path .. ";" .. os.getenv("home") .. "/.imapfilter/?.lua"

javascript - Page zoomed on iPad with Google maps -

i working on webb app ipad uses google maps v3.5 api , have run across problem. suspect bug in api i'm hoping confirmed here before drop it. loading page in landscape or portrait mode works out hitch if change potrait landscape buttons in top right cornor gets pushed outside of screen. looks me if resolution of screen isn't changed. sort of page self zoomed in. i'm unfortunately not allowed share webadress has else come across beavior before? , there soloution? know it's hard snippets but... header stop user funny buisness: <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> and body map reside. <div id="map_canvas" style="width: 100%; height: 100%"></div> and javscript displays map: var mylatlng = new google.maps.latlng(56.668142,16.341105); // start settings map var myoptions = { zoom: 13, center: mylatlng, maptypeid: google.maps.maptypeid.roadmap }; // creating , displ

Passing structure over TCP socket in C -

i'm writing small client server application in c. at client side have 1 structure like, #pragma pack(1) // helps avoid serialization while sending on network. typedef struct _viewboxclient_info { unsigned long viewboxid; int brt_flag; int nframenum; char framedata[1000]; }viewboxclient_info_send ; #pragma pack(0) // turn packing off and filling variable as, struct _viewboxclient_info client_info; client_info.brt_flag= 10;/*0 false, 1 true*/ client_info.viewboxid=10000; memcpy(client_info.framedata,buf,sizeof(client_info.framedata)); //char buf[] data "is 1st line" client_info.nframenum=1; and sending server using following function, send(sock, (char *)&client_info, bytesread, 0); at server side,i have 1 structure (same client side structure), #pragma pack(1) // helps avoid serialization while sending on network. typedef struct _lclviewboxclient_info { unsigned long viewboxid; int brt_flag; int nframenum; char framedata[1000]

optimization - Couchdb views and many (thousands) document types -

i'm studing couchdb , i'm picturing worst case scenario: for each document type need 3 view , application can generate 10 thousands of document types. with "document type" mean structure of document. after insertion of new document, couchdb make 3*10k calls view functions searching right document type. is true? there smart solution make database each doc type? document example (assume none documents have same structure, in example data under different keys): [ { "_id":"1251888780.0", "_rev":"1-582726400f3c9437259adef7888cbac0" "type":'sensorx', "value":{"valuea":"123"} }, { "_id":"1251888780.0", "_rev":"1-37259adef7888cbac06400f3c9458272" "type":'sensory', "value":{"valueb":"456"} }, { "_

html5 - Convert Image to Binary Data or String in Javascript -

i working on uploading image file twitpic using xmlhttp request on chrome extension . need send image payload. there way ? found link convert image binary data in javascript works on image tags. need way specify image file path , upload image twitpic. i came know filereader api html 5. there way work using that??. should work on local file. does chrome extension support filereader api without running localhost server ?? i found answer myself. chrome extensions support filereader api of html 5. code below works simple. var reader = new filereader(); reader.readasdataurl(f);

sql server - insert issues in an auto increment column -

how can insert data column has been defined auto increment column using identity insert?please explain example. if have "auto-increment" column - shouldn't inserted specific values column - after all, that's why it's auto-increment column.... if must after - need do: set identity_insert (your table name here) on insert (your table name here) (identitycol, othercol1, .....) values( (new id value), .......) set identity_insert (your table name here) off

Getting file size in Silverlight 4 -

i'm downloading (from server client) file using webclient object: webclient wc = new webclient(); wc.openreadcompleted += load_transfercompleted; wc.openreadasync(uriaddress, filename); i know file size before starting download operation. there way in sl4? thanks help. gilad. here air code play (i haven't tested myself) webrequest req = webrequestcreator.clienthttp.create(youruri); req.method = "head"; req.begingetresponse(ar => { webresponse resp = req.endgetresponse(ar); int length = resp.contentlength; // stuff length }, null); by using clienthttp stack can use "head" request return same set of headers "get" not actual entity body. there @ least 1 thing out though, none of existing cookies uri sent in request. if response sensitive cookies (for example because needs session id) things whole lot more complicated.

seo - Do 502 errors have any impact on website rankings? -

502 = bad gateway (php-fpm problems, etc.) does googlebot consider them 503? (503 = server overloaded & try again later) google supports http 502 http://www.google.com/support/webmasters/bin/answer.py?answer=40132 and treats them as 502 (bad gateway) server acting gateway or proxy , received invalid response upstream server. in experience google treats 502 downtime , stops hammering server (short) time.

javascript - why **(Object.__proto__ instanceof Function)** === false? -

why object._ proto _ instanceof function gives me false? alert(object.__proto__ ); // object.__proto__ function right? alert(typeof object.__proto__); // object.__proto__ function right? alert(object.__proto__ instanceof function); // ! not functions created via function constructor. instanceof checks see if given item created that specific function . you similar effect in browser environments when dealing multiple windows. mean, if have function foo in window a: function foo(arg) { if (arg instanceof array) { // it's array, } } ...and have code in another window b calls it: opener.foo([]); ...then you'd expect foo realize arg array, right? doesn't, because although arg is array, wasn't created array constructor in window foo in. more figuring out things here: say what? if you're fascinated stuff (as seem be), there's nothing quite reading the specification . yes, prose is...dry...and terminology is....den

How to split and convert videos using PHP & FFMPEG -

i want users only upload video, write code splits video user-defined segments, convert segments .flv , .mp4 videos. there way can that? i don't think there way directly within php. if there was, wouldn't sensible thing do. your best bet hook web application command line program, such ffmpeg , , call system commands php script. i'd approach building job queue web application adding jobs queue , dedicated worker processes pulling queue, performing task , recording completion of task somewhere else. this means users won't have wait video re-encoded in real time.

c# - Calling a method on Object exposed by Word Add-in throws RemotingException -

i writing (shared) word add-in in c# , want communicate exposing object through object property of comaddin class. because want code executed on ui thread derive add-in , exposed object standardolemarshalobject class. should take care of marshaling described here , here . but doing different behavior when compile against .net 2.0 or.net 4.0. when compiling against .net 4.0 exposed object of type __comobject , lets cast publicly comvisible defined interface. in turn lets me call methods on object , works perfectly. when compiling against .net 2.0 exposed object of type __transparentproxy. can cast interface when try call method wil throw system.runtime.remoting.remotingexception message: this remoting proxy has no channel sink means either server has no registered server channels listening, or application has no suitable client channel talk server. when not inherit standardolemarshalobject seem work code execute on arbitrary rpc thread not i'm looking for. i hav

validation - Validating multiple sections of the page, but only having one submit button -

i writing page has 1 form tag , 1 submit button, has multiple spots input.... <form> ... </table class="t1"> <tr> <td><input name="name1" /></td> <td><input name="stdate" /></td> <td><input name="enddate" /></td> <td><input name="description1" /></td> </tr> </table> <table class="t2"> <tr> <td><input name="name2" /></td> <td><input name="date2" /></td> <td><input name="description2" /></td> <td><input name="email2" /></td> <td><input name="id2" /></td> </tr> </table> <table class="t3"> <tr> <td><input name="name3" /></td> <td><input name="date3

javascript - jQuery plugin vertical align images setTimeout -

i have created quick , simple plugin vertical aligns images have used in number of websites although working new cms automatically resizes images creates delay in loading resized images causing plugin return null height. happens on first load of page. i thought fix timeout although causes parent.height return null. //vertically allign images jquery.fn.valign = function() { return this.each(function(){ settimeout(function(){ var $strip = jquery(this); var ah = $strip.height(); var ph = $strip.parent().height(); alert('height = '+ah+' parent = '+ph); //height = 429 parent = null var mh = math.ceil((ph-ah) / 2); $strip.css('margin-top', mh); },1000); }); }; inside settimeout function, this window object (the settimeout function runs in global scope), , $(this).parent() empty jquery object (because window has no parent). it best if can

extjs4 - ExtJS How to add a click event to Pie Chart pieces -

Image
i have created pie chart using pie chart example in sencha extjs website , wanted add click event each pie slice handle contextual data on slice. able add click listener pie not sure how data on slice. below extjs code. ext.onready(function(){ var store = ext.create('ext.data.jsonstore', { fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'], data: [{ 'name': 'january', 'data1': 10 }, { 'name': 'february', 'data1': 7 }, { 'name': 'march', 'data1': 5 }, { 'name': 'april', 'data1': 2 }, { 'name': 'may', 'data1': 27 }] }); ext.create('ext.chart.chart', { renderto: ext.getbody(), width: 800, height: 600, animate: true, store: store, theme: 'base:gradients

python - Memory error in np.hstack() -

i trying execute code: for in fil: k in datarr: = np.zeros(0) j in bui: = np.hstack([a,datdifcor[k][i,j]]) datdifplt[k].update({i:a}) but gives me error: traceback (most recent call last): file "<ipython console>", line 5, in <module> file "c:\python26\lib\site-packages\numpy\core\shape_base.py", line 258, in hstack return _nx.concatenate(map(atleast_1d,tup),1) memoryerror i thought due lack of ram memory in first place, tried in on pc 48 gb of ram , gave same error. have reached maximum size numpy.array? a memoryerror means attempt allocate memory failed. trying create array bigger maximum array size results in valueerror : >>> = numpy.arange(500000000) >>> numpy.hstack((a, a)) traceback (most recent call last): file "<stdin>", line 1, in <module> file "/usr/lib/pymodules/python2.6/numpy/core/shape_base.py",

ruby on rails - perform not being called for Delayed Jobs -

i'm using delayed_job 2.1.4 collectiveidea, , seems perform method never called though jobs processed , removed queue. missing something? i'm using rails 3.0.5 on heroku in controller: delayed::job.enqueue facebookjob.new in job class: class facebookjob def initialize end def perform fb_auths = authentication.where(:provider => 'facebook') fb_auths.each |auth| checkins = fbgraph::user.new('me', :access_token => uri.encode(auth.token)).checkins if checkins != nil checkins.each |checkin| [...] end end end end end (the whole code: https://gist.github.com/966509 ) i had same problem, answer helped me: delayed_job not executing perform method emptying job queue

r - Merge unequal dataframes and replace missing rows with 0 -

i have 2 data.frames, 1 characters , other 1 characters , values. df1 = data.frame(x=c('a', 'b', 'c', 'd', 'e')) df2 = data.frame(x=c('a', 'b', 'c'),y = c(0,1,0)) merge(df1, df2) x y 1 0 2 b 1 3 c 0 i want merge df1 , df2. characters a, b , c merged , have 0, 1, 0 d , e has nothing. want d , e in merge table, 0 0 condition. every missing row @ df2 data.frame, 0 must placed in df1 table, like: x y 1 0 2 b 1 3 c 0 4 d 0 5 e 0 take @ page merge. all parameter lets specify different types of merges. here want set all = true . make merge return na values don't match, can update 0 is.na() : zz <- merge(df1, df2, = true) zz[is.na(zz)] <- 0 > zz x y 1 0 2 b 1 3 c 0 4 d 0 5 e 0

jsp - How to evaluate a scriptlet variable in EL? -

i wondering if there anyway of using jsp in <c:if> statement. e.g. <c:if test="${ param.variable1 == 'add' <% jsp variable clause %>}"> so want jsp variable checked against well. any suggestions? have tried ignorantly sticking in clause, did not work. thanks so want evaluate scriptlet variable in el? store request attribute. <% string var = "some"; request.setattribute("var", var); %> <c:if test="${param.variable1 == 'add' && var == 'some'}"> however, makes no sense. should avoid scriptlets altogether , use jstl/el prepare variable. if make functional requirement more clear, e.g. "how do (insert scriptlet code snippet) using jstl/el?", we'll able suggest right approach. for example, use <c:set> set variable in el scope. <c:set var="var" value="some" scope="request" /> see also: ou

javascript - Pass an array from .jsp file to .js file -

possible duplicate: how transfer java array javascript array using jsp? after googling still not able pass array .jsp file js file. can me out? in .jsp file have array , wan call function in .js file accepts array. how call function? by passing array .jsp js file guess mean javascript script needs "call" script return jsp file. , script contains function returns array? if have looked @ returning json jsp?

dwscript - Delphi Web Script: How to call a Script Function from Delphi Code within an Execution Context? -

imaging scripting code: procedure a; begin calltodelphi; end; procedure b; begin // end; i have exposed procedure "calltodelphi" script. when called, i'm script in delphi code. want call script procedure "b" delphi code. think must hidden in idwsprogramexecution-context. didn't found yet. i'm looking that: procedure calltodelphi; begin exec.invoke('b', []); // exec idwsprogramexecution end; is somehow possible? what you're looking iinfo interface can used as exec.info.func['b'].call([]) there more samples in http://code.google.com/p/dwscript/wiki/firststeps (scroll down functions), , usage code in unit tests (udwsunittests notably, see callfunc method). the iinfo serves delphi-side primary way query rtti, invoke functions, get/set variables directly, instantiate script-side objects, etc. of sample code in unit tests though.

java - How do I extend a class? -

i have class: model , many functions, such draw() , rotate() etc. now have class called cube want able work same way model. i have in cube class constructor: model m3d = new model(); m3d.build(obj); so want able in class call like: mcube.draw(); and m3d perform draw() . ok. in class call: class cube extends model {...} then can do: cube mcube = new cube(); mcube.build(obj); mcube.draw();

model view controller - Which MVC Diagram is Correct? (Web app) -

Image
which mvc diagram correct? each have different arrows... diagram 1 diagram 2 http://blog.stannard.net.au/blog/media/simple-mvc-framework/mvc.gif diagram 3 diagram 4 http://java.sun.com/blueprints/patterns/images/mvc-structure-generic.gif diagram 5 http://www.shopno-dinga.com/dustbin/mvc.png they are. mvc vague pattern. my view on mvc : controller object has collection of models , has methods viewing , editing models. talks models , returns instances of views models applied on them. view has definition of model attached , set of functionality display specific model. model encapsulates data. has methods returning state , changing state. //controller import views class controller private models //view import model class view //model class model a model doesn't need know view / controller. view needs know definition of model. controller needs own models , needs know definitions of views. you can couple them more tightly, opt

wpf - Caliburn Launch without App.xaml, but with bootstrapper -

i have winforms project want open wpf window wpf user control project. when create instance of wpf window , call show(), bootstrapper isn't loaded. in windows application, it's located in app.xaml, user control project doesn't have this. can do? thanks! the thing accomplished having bootstrapper in app.xaml's resources instantiation of bootstrapper , keeping reference isn't garbage-collected. try making instantiate this: public class someclass { static bootstrapper _bs = new bootstrapper(); ... } that make sure it's initialized part of static construction, happens sometime before can create instance of someclass . may have experiment see whether should happen in usercontrol or in window.

html - How to display navigation tabs with the desired border? Table, list, something else? -

Image
see picture above. each navigation tab needs have 2 pixels separation on either side , line header image on edges. now introduce 5th navigation tab (and possibly 6th). possible code in way stick 5th or 6th tab in there , resize appropriately lists or tables or other solution? still keeping 2 pixels separation , lining edges exactly? wasn't sure if possible or have define widths each time each tab based on math involved line correctly flush edges. i think best way emulate table behavior css. can use list, , still table behavior. ul { display:table; } li { display:table-cell; } here demo displaying css , proper markup. here's demo of how looks actual table. i'm not on ie<8 support css, may aware of. update : confirmed: not supported on ie6 or 7 natively. may stuck tables or hard-coded widths if want support browsers. there may javascript fix support these display values i'm not aware of it. edit : realized demos sloppy, made addres

.net - Escaping mid-string percent signs, is a regex the best option? -

i need escape % characters in string entered user - replacing them [%] unless @ start or end of string. for example %foo%foo[%]foo% should become %foo[%]foo[%]foo% . whitespace isn't concern: escaping mid-string percent signs. a regular expression of [^[]%[^\]] match mid-string percentages, adjacent characters (so o%f in example). is there reasonable regular expression match mid-string non-escaped percentage characters? i wondering if non-regex solution preferable, such as iterating through characters in string, , building replacement string percentages escaped const string test = "%foo%foo[%]foo%"; stringbuilder escaped = new stringbuilder(); escaped.append(test[0]); (int = 1; < test.length - 1; i++) { if (test[i] != '%' || (test[i - 1] == '[' && test[i] == '%' && test[i + 1] == ']')) { escaped.append(test[i]); } else { escaped.append("[%]"); } }

Mercurial hg merge default -

i running rebase on set of changes in hg. comes message says local changed somefile.cs remote deleted. use (c)hanged version or (d)elete? i assume when rebasing want follow remote doing, have been deleting. if incorrect, stop me. however, here big thing? i've noticed if press enter seems move on. i have no idea defaulting to . know? the default use (c)hanged version . rebase uses merge logic operation. there no documentation of default choice, decided here : 216 if repo.ui.promptchoice( 217 _(" local changed %s remote deleted\n" 218 "use (c)hanged version or (d)elete?") % f, 219 (_("&changed"), _("&delete")), 0): 220 act("prompt delete", "r", f) 221 else: 222 act("prompt keep", "a", f) there not appear way automatical

Bring JPanel to front of other objects in java (SWING) -

i want make loading when app process, used jpanel on jtree. when user clicks on jpanel jtreewill selected , jpanel go back. after hiding jpanel never shows again(i don't know why! seems never go forward of jtree). i need way bring jpanel forward of anything. how can this? also must mention don't want jdialog. want use jpanel top of element show loading until process finish. so here have @ least 2 solutions. either go @geoff , @sthupahsmaht suggesting. btw possible use joptionpane automatically creates dialog you. the other option use glasspane frame. or yet option use jlayeredpane @jzd suggests. edit: example showing how use glasspane capture user selections. try following steps: 1.left clicking on glass pane visible @ start. see output. 2.right click it. hides glass pane. 3.left clicking on content pane. see output. 4.right click it. go point 1. enjoy. import java.awt.color; import java.awt.dimension; import java.awt.event.mouseadapter; impor

ComboBox column in WPF DataGrid with DataTable as ItemsSource -

i've got datagrid bound datatable, comboboxcolumn. xaml column follows: <datagridcomboboxcolumn header="rep name" sortmemberpath="repname" itemssource="{binding updatesourcetrigger=propertychanged, source={staticresource employeelist}, path=employees}" selectedvaluebinding="{binding mode=twoway, path=empid}" selectedvaluepath="empid" displaymemberpath="repname" /> my employees class: public class employeelist : inotifypropertychanged { private observablecollection<employee> _employees = new observablecollection<employee>(); public employeelist() { ... } public observablecollection<employee> employees { { return _employees; } set { _employees = value; notifypropertychanged("employees"); } } public event proper

ruby - MongoMapper in a custom gem with rspec -

hopefully i'm missing simple. using mongomapper in rails 3 app , works beautifully. needed share app , pushed out gem, works great both rails apps. however, when try add rspec tests gem getting following error: /users/dane/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.5.2/lib/rspec/core/backward_compatibility.rb:20:in `const_missing': uninitialized constant user::mongomapper (nameerror) i adding simple test user model. thanks!

vb.net - Unhandled Exception when executing via RDP (OK when local) -

i have put new development machine , loaded windows 7 64 bit , vs2010. i copied on projects (vb) old machine windows 7 x86 , vs2008. after following conversion wizard in vs2010 , installing third-party component had forgotten about, solutions opened , executed fine on new machine. then tried work on 1 of projects via rdp windows xp machine (something have done many, many times old machine) , project crashes when run. "no source availiable" tab , accessviolationexception splash screen has loaded. going local operation, project runs fine. i've googled 1 death , can't find relates problem @ all. sugggestions gratefully received. thanks. i have multiple monitors have never had problem before rdp. anyways, found other problems when opening other, older, projects in vs2010 uninstalled , reverted vs2008. ok now. help.

Sending a web request with a python script to select a specific radio button on a web page -

i have test internal web page. web page contains text fields, buttons, , radio buttons. based on specific radio button selected sub-form displayed in web page. i'm using urllib2, , of modules, connect web server , perform actions. however, not able select radio button, via post python script, i'm not able proceed test automation. reading of online posts selecting radio buttons read people using "mechanize". i'm not familiar this. there specific module in urllib2 allow me send post request select specific radio button. roland they referring python module: http://wwwsearch.sourceforge.net/mechanize/ . can emulate selected radio button in form posting form urllib2 . discussed in post: urllib2: submitting form , redirecting . imagine have form radio input this: <input type="radio" value="1" name="something" /> the post body be: something=1 .