Posts

Showing posts from September, 2011

debugging - Is there a way to limit the memory, ghci can have? -

i'm used debug code using ghci. often, happens (not obvious, of course): ghci> let f@(_:x) = 0:1:zipwith(+)f x ghci> length f then, nothing happens time, , if don't react fast enough, ghci has eaten maybe 2 gb of ram, causing system freeze. if it's late, way solve problem [alt] + [print] + [k]. my question: there easy way limit memory, can consumed ghci to, let's 1 gb? if limit exceed, calculation should ve aborted or ghci should killed. a platform independant way accomplish supply -m option on option haskell runtime this ghci +rts -m1m see the ghc documentation’s page on how control rts (runtime system) details. the ghci output looks like: >ghci +rts -m10m ghci, version 6.12.3: http://www.haskell.org/ghc/ :? loading package ghc-prim ... linking ... done. loading package integer-gmp ... linking ... done. loading package base ... linking ... done. loading package ffi-1.0 ... linking ... done. prelude> let f@(_:x) = 0:1:zipwith(+...

How to use NetCat for Windows to send a binary file to a TCP connection? -

if want transfer binary file "binary.bin" (located in same directory netcat) ip address 127.0.0.1 port 1200 using tcp, how specify using netcat windows? i found solution. its nc 127.0.0.1 1200 < binary.bin in addition, if response needs saved nc 127.0.0.1 1200 < binary.bin > response.bin

How to get the stream of a public Facebook fanpage in php? -

i want display public fanpage feed onto website via facebook api without requiring login. i'm doing this require_once('../includes/classes/facebook-platform/php/facebook.php'); $fb = new facebook($api_key, $secret); $fb->api_client->stream_get('',$app_id,'0','0','','','','','')); but error fatal error: uncaught exception 'facebookrestclientexception' message 'user id parameter or session key required' in includes/classes/facebook-platform/php/facebookapi_php5_restlib.php:3065 stack trace: #0 includes/classes/facebook-platform/php/facebookapi_php5_restlib.php(1915): facebookrestclient->call_method('facebook.stream...', array) #1 facebook/api.php(12): facebookrestclient->stream_get('', 13156929019, '0', '0', 30, '', '', '', '') #2 {main} thrown in includes/classes/facebook-platform/php/facebookapi_php5_r...

java - How does Spring 3 expression language interact with property placeholders? -

spring 3 has introduced new expression language (spel) can used in bean definitions. syntax specified. what isn't clear how, if @ all, spel interacts property placeholder syntax present in prior versions. spel have support property placeholders, or have combine syntax of both mechanisms , hope combine? let me give concrete example. want use property syntax ${x.y.z} , addition of "default value" syntax provided elvis operator handle cases ${x.y.z} undefined. i've tried following syntaxes without success: #{x.y.z?:'defaultvalue'} #{${x.y.z}?:'defaultvalue'} the first 1 gives me field or property 'x' cannot found on object of type 'org.springframework.beans.factory.config.beanexpressioncontext' which suggests spel doesn't recognise property placeholder. the second syntax throws exception saying placeholder not recognised, placeholder resolver is being invoked, failing expected, since property not defi...

android - Sending Activity to background without finishing -

how can make activity go background without calling finish() method , return parent activity started this? tried not find solution. if guys thankful. the following work if activity running in different task parent. achieve this, see http://developer.android.com/guide/topics/manifest/activity-element.html#lmode . public void onbackpressed () { movetasktoback (true); } the current task hidden, state remain untouched, , when reactivated appear when left it.

ipad - Received memory warning. Level=2 -

i want 6 mb (html file size)data web service.its run fine on simulator when run application on ipad give me error received memory warning. level=2. you can download pdf computer, shrink size compressing images, , host smaller version yourself. the easiest way shrink pdf file is: in adobe acrobat pro 9, click on "document" tab , choose "reduce file size..." (source: first comment of http://www.ehow.com/how_4937702_reduce-pdf-file-size-easily.html ) also see: http://blog.nitropdf.com/index.php/2008/02/11/5-tricks-to-shrinkreduce-pdf-file-size/

asp.net - How to access an ASP Control in a class file -

i have asp textbox control in .aspx page. have .cs class file , not code behind file. want access textbox control in .cs file. know can pass parameter.but i'm curious know if can through reference way or something. there scenario. if have .cs page basepage.cs inherits system.web.ui.page , , if code-behind class inherits basepage, in basepage.cs can gen reference textbox through findcontrol : textbox txtname = (textbox)this.findcontrol("txtname"); but in totally unrelated class it's suspected, way pass parameter.

php - sort array in DESC order -

how can order array( 4 => 'four', 3 => 'three', 2 => 'two', 1 => 'one', ) from this array( 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', ) if want reverse order, use array_reverse : $reverse = array_reverse($array, true); the second parameter preserving keys.

How do I use FB.Connect.streamPublish in an iframe facebook app? -

i'm making simple iframe-based facebook app. have following code size iframe: fb_requirefeatures(["connect"], function(){ fb.xdcomm.server.init('/xd_receiver.htm'); fb.canvasclient.starttimertosizetocontent(); fb.canvasclient.syncurl(); }); i want add link display popup allow user post app-defined image/link user's wall. things working initially, tried using following code on click event: fb.connect.streampublish(''); however, nothing happens. i've tried adding: fb.init(<?=api_key?>, '/xd_receiver.htm'); both inside fb_requirefeatures function, before it, after it... no luck. nothing happens. no errors thrown. nothing. ideas? check out page complete instructions on setting stream publishing iframe apps using connect: http://thetechnicalexperience.blogspot.com/2010/02/how-to-use-fbconnectstreampublish.html

java - How do I get a list of all HttpSession objects in a web application? -

let's have running java-based web application 0 or more valid httpsession objects associated it. want way access current list of valid httpsession objects. thinking implement httpsessionlistener , use append list of session id values stored in application-scoped attribute, i'm on hook update list sessions invalidated , knows else. before start baking own solution thought should ask question: does servlet api provide means of getting access complete list of non-invalidated session objects? i using tomcat 6.x web application container, , myfaces 1.2.x (jsf) library. solution followed approach similar balusc discussed in these existing questions: how implement "who online" in grails or java application ? jsf: how invalidate user session when logs twice same credentials i modified sessiondata class implement httpsessionbindinglistener . when binding event happens, object either add or remove set of sessiondata objects. @override public void valu...

c# - Cannot find missing reference -

i trying copy code 1 project another. there 1 problem however: the type 'microsoft.practices.enterpriselibrary.data.sql.sqldatabase' defined in assembly not referenced. must add reference assembly 'microsoft.practices.enterpriselibrary.data, version=3.1.0.0, culture=neutral, publickeytoken=null'. the problem can't find microsoft.practices.* anywhere. know can find file? if you're trying copy code working project, code must have reference microsoft.practices.enterpriselibrary.data . find reference in visual studio , @ properties.

mysql - PHP framework or library for DB abstraction, secure login -

i building site requires lot of mysql inserts , lookups different tables in (hopefully) secure part of site. want use abstraction layer whole process. should use php framework (like zend or cakephp) this, or use simple library (like crystal or doctrine)? i make sure db inserts done in relatively secure part of site (though not ssl). currently, using method outlined here (md5 encryption , random challenge string), maybe of frameworks come similar functionality simplify process? what i'm trying implement: table of forms filled out db values. if change value or add new row, pressing "save" update or insert db rows. i'm sure has been done before, wouldn't want reinvent wheel. most php backends have secure access private database. normally, there's little difficulty keeping database secure, not making reachable directly. way security of access depends on inability tamper php code, , not software security scheme.

javascript - Sending credentials with cross-domain posts? -

according requests credentials , firefox send credentials along cross-domain posts if invocation.withcredentials = "true"; is set… doesn't seem jquery's ajax api provides mechanism this. is there i've missed? there other way can it? functionality supposed broken in jquery 1.5. since jquery 1.5.1 should use xhrfields param. $.ajaxsetup({ type: "post", data: {}, datatype: 'json', xhrfields: { withcredentials: true }, crossdomain: true }); docs: http://api.jquery.com/jquery.ajax/ reported bug: http://bugs.jquery.com/ticket/8146

Captcha servlet causes java.lang.IllegalStateException: PWC3999: Cannot create a session after the response has been committed -

i creating captcha input using simplecaptcha, , did validation of captcha input. created captcha input following codes. html code: <form action="submit_proceed.do" method="post"> <img src="captchaimg" /><input type="text" name="captcha" value=""><br /> <input type="submit" value="submit" name="submit" /> </form> javaservlet code : import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import java.util.list; import java.util.iterator; import nl.captcha.captcha; protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/html;charset=utf-8"); printwriter out = response.getwriter(); li...

Entity Framework 4.0; Is there a limit on the number of objects(tables,views,sprocs) it will handle? -

i have database many tables, views , sprocs. if try create data model includes everything, errors out on creation of class file. if try create model views, works fine. there limit or there in config file somewhere needs tweaked? have tried model tables and/or procs? i'm not aware of size limit possible creation of model taking long sql connection timing out? getting specific error message?

python - Find all tags with a specific attribute value -

how can iterate on tags have specific attribute specific value? instance, let's need data1, data2 etc... only. <html> <body> <invalid html here/> <dont care> ... </dont care> <invalid html here too/> <interesting attrib1="naah, not this"> ... </interesting tag> <interesting attrib1="yes, want"> <group> <line> data </line> </group> <group> <line> data1 <line> </group> <group> <line> data2 <line> </group> </interesting> </body> </html> i tried beautifulsoup can't parse file. lxml's parser, though, seems work: broken_html = get...

Alternative for Microsoft.VisualBasic.Information.IsNumeric in C# -

attrval[5] = wrmservice.windowsagent.agentversion; from above if attrval[5] null or not getting value or strings other numeric values want assign attrval[5] value '0.0.0.0' otherwise display numeric value coming.what coding have implement here as per information while doing googling did attrval[5] = (wrmservice.windowsagent.agentversion == null || microsoft.visualbasic.information.isnumeric(wrmservice.windowsagent.agentversion)) ? "0.0.0.0" : wrmservice.windowsagent.agentversion; but microsoft.visualbasic.information.isnumeric making problems. there similar 1 in c#? only 2 outputs required 1 numeric , 1 other, can string or null whatever have set in 0.0.0.0 try if(!int.tryparse(wrmservice.windowsagent.agentversion, out attrval[5])) attrval[5] = 0; in case, if agentversion numeric, place parsed value attrval[5], otherwise set 0. edit ah guess looking for: attrval[5] = string.isnullorempty(wrmservice.windowsagent.agentversion) ? "...

makefile - How does "make" app know default target to build if no target is specified? -

most linux apps compiled with: make make install clean as understood it, make takes names of build targets arguments. install target copies files , after clean target removes temporary files. but target make build if no arguments specified (e.g. first command in example)? by default, begins processing first target not begin '.' aka the default goal ; that, may have process other targets - specifically, ones first target depends on. gnu make manual covers stuff, , surprisingly easy , informative read.

pygtk - Python GTK+: create custom signals? -

is possible create new signals in python gtk+ ? i'd skeleton code example, please. an excerpt: creating own signals the other thing want use when subclassing gobject define custom signals. can create own signals can emitted users of class can connect them. when signal emitted set of closures executed. closure abstraction of callback concept. closure callback (a function pointer), user data (it last parameter callback) , function cleanup issues, not discussed in document. for sake of article don't need know difference between callback , closure both terms used. advised not totally correct. as said before, when signal emitted, set of closures executed. 1 of them same 1 instances of class , hence name: class closure, , other ones custom user callbacks. note not signals need have class closure because optional. from, http://www.pygtk.org/articles/subclassing-gobject/sub-classing-gobj...

java - How do I delete a entries from one properties file after some time interval? -

i have 1 property file contains records need delete records after time interval let's take 2 minute or 3 minutes, how can one? you should create timer task perform action @ future date. take @ timer api . final properties props = new properties(); props.setproperty("key", "value"); props.store(outputstream, "adding key=value"); timertask deletepropertytask = new timertask() { public void run() { props.remove("key"); props.store(outputstream, "removing key"); } }; new timer().schedule(deletepropertytask, 3000l); // fire in 3 seconds i tested equivalent version of in scala repl. here is: import java.util._ import java.io._ val props = new properties props.setproperty("key", "value") props.store(system.out, "message") val task = new timertask() { def run = { props.remove("key") props.storetoxml(system.out, "no comment") } } new time...

android - Question about rotate bitmap with Canvas.rotate -

as know, can rotate bitmap through 2 ways. the 1st way is: matrix mt = new matrix(); mt.postrotate(degree); bitmap bitmap = createbitmap(src, 0, 0, w, h, mt, true); canvs.drawbitmap(bitmap, 0, 0, paint); in way, need create new bitmap every rotation, not way high performance game or app. the 2nd way is: canvas.save(); canvas.rotate(degree); canvas.drawbitmap(bitmap, 0, 0, paint); canvas.restore(); in way, avoid creating new bitmap frequently, rotation bitmap distortion, bitmap quality worse first way. so, there 3rd way rotate bitmap high performance , quality? your comments appreciated! make sure providing paint canvas.drawbitmap(bitmap, 0, 0, paint) . and don't forget use anti-alias , bitmap filtering: paint = new paint(paint.anti_alias_flag | paint.filter_bitmap_flag);

c - How do printf and scanf handle floating point precision formats? -

consider following snippet of code: float val1 = 214.20; double val2 = 214.20; printf("float : %f, %4.6f, %4.2f \n", val1, val1, val1); printf("double: %f, %4.6f, %4.2f \n", val2, val2, val2); which outputs: float : 214.199997, 214.199997, 214.20 | <- correct value wanted double: 214.200000, 214.200000, 214.20 | i understand 214.20 has infinite binary representation. first 2 elements of first line have approximation of intended value, the last 1 seems have no approximation @ all, , led me following question: how scanf , fscanf , printf , fprintf (etc.) functions treat precision formats? with no precision provided, printf printed out approximated value, %4.2f gave correct result. can explain me algorithm used these functions handle precision? the thing is, 214.20 cannot expressed exactly binary representation. few decimal numbers can. approximation stored. when use printf, binary representation turned decimal representation, again...

F# units of measure conversion based on type -

i'm trying write "unit of measure" converter in f#. i have defined 2 units of measure, kwh , mwh , trying write function convert between 2 pattern match on numeric type. have float, decimal, int of kwh convert mwh. [<measure>] type kwh [<measure>] type mwh // want this, can't because x not x:obj, // x:float<kwh> let tomwh x = match x | :? float<kwh> -> x * (1.0<mwh>/1000.0<kwh>) | :? int<kwh> -> // ... // above code not valid f# i'm not able figure out how correctly branch on type when don't have obj type. honestly, i'd low-budget overloading solution: [<measure>] type kwh [<measure>] type mwh type convert = static member tomwh (x:float<kwh>) = x * 1.0<mwh> / 1000.0<kwh> static member tomwh (x:int<kwh>) = x * 1<mwh> / 1000<kwh> printfn "%d" (int(convert.tomwh(5000<kwh>))) print...

iphone - show timer in label -

as in games hv seen timer in format "01:05" i m trying implement timer, , on reset need reset timer "00:00". this timer value should in label. how create timer incrementing? 00:00---00:01---00:02..........somthing dat. suggestions regards a simple way i've used this: //in header int timesec = 0; int timemin = 0; nstimer *timer; //call start timer, tick every second -(void) starttimer { timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(timertick:) userinfo:nil repeats:yes]; [[nsrunloop currentrunloop] addtimer:timer formode:nsdefaultrunloopmode]; } //event called every time nstimer ticks. - (void)timertick:(nstimer *)timer { timesec++; if (timesec == 60) { timesec = 0; timemin++; } //format string 00:00 nsstring* timenow = [nsstring stringwithformat:@"%02d:%02d", timemin, timesec]; //display on label //[timelabel setstringvalue:t...

filesystems - in php - how to access the Folders which are out side the Web root Directory -

how can access folders out side web root directory? we using wampserver 2.0 (apache 2.2.11,php 5.3.0 & sql 5.1.36). usr | - www |- docs |- |- webroot |- index.php just use "normal" file paths. e.g. access a in docs folder index.php , can use relative paths ../docs/a or absolute paths /usr/www/docs/a . the "webroot" directory marks entry point urls . has no effect on php files. normal files in filesystem , can therefore access other files in system via ordinary file paths.

sql - mysql group by confusion -

so have table; mysql> describe player_weapon_stats; +------------+------------------+------+-----+---------+----------------+ | field | type | null | key | default | | +------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | no | pri | null | auto_increment | | players_id | int(10) unsigned | no | | null | | | weapons_id | int(10) unsigned | no | | null | | | matches_id | int(10) unsigned | no | | null | | | hits | int(10) unsigned | no | | null | | | shots | int(10) unsigned | no | | null | | | kills | int(10) unsigned | no | | null | | | acc | decimal(4,2) | no | | null | | +------------+------------------+------+-----+---------+----------------+ 8 rows in set (0.00 sec) with lots of rows (currently...

objective c - Application build on Xcode 2.4 with mac 10.5 sdk is not getting invoked in Mac 10.3.9? -

i have build application xcode 2.4 (universal binary sdk10.5) on mac 10.6, when im invoking application in mac 10.3.9 application not getting invoked. workin in 10.4 , above version? can suggest me on this.. the mac os x 10.5 sdk targets mac os x system version 10.5. it's no surprise it's not working earlier versions. use mac os x 10.3 sdk if want program run on panther. believe still available optional package when install xcode.

javascript - How to toggle element visibility without jQuery? -

i'm writing auction template ebay, hoping ebay allow it. apparently don't because jquery has things string.replace() etc. the code basic. $(document).ready(function(){ function changeimage(){ if($("#coin1").css("display") == "none"){ $("#coin1").fadein("slow"); }else{ $("#coin1").fadeout("slow"); } }; setinterval ( changeimage, 5000 ); }); i need rewrite in plain javascript... if can live without fading effect, should pretty straightforward: function changeimage() { var image = document.getelementbyid('coin1'); image.style.display = (image.style.display == 'none') ? 'block' : 'none'; } setinterval(changeimage, 5000); while fading cool , all, it's makes code lot more complicated, when not allowed use external libraries. basically, need deal additional timers, firing short interv...

jquery - ASP.NET MVC: The best way to return type to a AjaxRequest? -

i have multiple actionresults in controller. of them process either ajaxrequest , normal requests, dependending on request (duh!). point is, if i'm adding database using ajaxrequest, want return ok or error (or 1 or 0, etc..) page instead of view() or parcialview() because handle via ajax on client , need yes or no response (or other basic response). if have normal request (not ajax), it's fine because i'll either redirect controller or return simple view(). so question is: best way return simple value view when processing ajaxrequest()?? // logic insert db (just example) result = person.add(); if(request.isajaxrequest()) { if(result == ok) return true; else return false; } // normal request else { if(result == ok) return redirect("personlist"); else return view("error:); } to return plain text view: return content("ok"); or use json alternatively: return json(new { result = true })...

msbuild - Trigger build when another finished successfully in TFS 2008 -

this feature i'm used teamcity - specify build configuration triggered success of build configuration. i pass results of 1 build - perhaps asking much. i'm looking similar functionality in tfs2008, there way set trigger on build configuration shall start after finished successfully? i use following target in tfsbuild.proj: inject new targets build process. trigger dependent builds if "drop" created: <propertygroup> <dropbuilddependson> $(dropbuilddependson); createdependentbuilditemgroup; triggerdependentbuilds; </dropbuilddependson> </propertygroup> create itemgroup contains list of dependent builds want trigger (the include attribute list name of dependent build appears in build explorer - in case below, dependant build called "integration"). in our build process, want trigger more 1 build, , want point next build @ binaries produced current build (in example, want run integr...

apache - Translating paths in PHP from (*nix) server to (winxp) dev machine -

i'm working on php project has lot of hard coded paths in it. i'm not main developer, working on small part of project. i'd able test changes locally before committing them, directory structure different. example, there's lot of in code: require_once("/home/clientx/htdocs/include.php") which doesn't work on local wamp server because path different. there way tell either wamp or xp "/home/clientx/htdocs/" means "c:/shared/clients/clientx"? if local copy, search , replace on whole directory , please don't forget trailing slash. , when commit code, reverse. solution, if don't want add variables , stuff (because change other developers' code/work/dependencies (if any) search "/home/clientx/htdocs/" , replace this: "c:/shared/clients/clientx/"

.net - Is it good practice to use Entity Framework in unit tests? -

i'm writing nunit tests service. i've decided sending direct sql statements database instead of using entity framework model certain of results, i.e. testing in database , not entity framework tells me in database (e.g. reporting cached result, etc.) the drawback is getting tedious write code using sqlcommand, sqldatareader, etc. , being able use ef model easier . how others doing this? practice use entity framework when writing tests or should direct calls database used ensure accurate results? i bad practice when testing service cause creates dependency on database. what did, roll model classes repository pattern. repository pattern coded interface change implementation of database querying without effecting other parts of code. mocked , used testing. interface constructed. using system; using system.collections; using system.collections.generic; using system.linq; namespace app.core.repositories { public interface irepository<tkey, tmode...

What is xid in facebook comment api? -

i trying put facebook comment in wordpress blog each post. want pass url of post xid doesn't work. want able collect comments each post separately. let me know if there other way collect comments post separately. you're correct use xid unique identifier each post. according documentation, xid can consist of: "alphanumeric characters (aa-zz, 0-9), hyphens (-), percent (%), period (.), , underscores (_)". instead of using url, try passing in unique id of each post if have access wordpress. if isn't option, use php url-encode url.

website - Very very simple, secure database for static site -

i have static website handful of pages bit of self-advertising. i'm wanting put small database online store clients details, preferably same layout current pages. i've tried looking @ php scripts provide static interface sqlite database i'm bit unsure security of pages afterwards. looked @ django app think take me time , going. aware of secure system or cms set relatively quickly? open-source preferable not essential. many thanks. if don't need able dynamically update site (so re-uploading changed files alright), bake dynamic content static html pages with, say, python script (maybe sphinx documentation generator ?).

regex - Python re.sub question -

greetings all, i'm not sure if possible i'd use matched groups in regex substitution call variables. a = 'foo' b = 'bar' text = 'find replacement me [[:a:]] , [[:b:]]' desired_output = 'find replacement me foo , bar' re.sub('\[\[:(.+):\]\]',group(1),text) #is not valid re.sub('\[\[:(.+):\]\]','\1',text) #replaces value 'a' or 'b', not var value thoughts? you can specify callback when using re.sub, has access groups: http://docs.python.org/library/re.html#text-munging a = 'foo' b = 'bar' text = 'find replacement me [[:a:]] , [[:b:]]' desired_output = 'find replacement me foo , bar' def repl(m): contents = m.group(1) if contents == 'a': return if contents == 'b': return b print re.sub('\[\[:(.+?):\]\]', repl, text) also notice ? in regular expression. want non-greedy matching here. i understand ...

java - Servlet 3 issues with @WebFilter and @WebServlet deployment -

i trying migrate existing servlets , filters defined in web.xml file @webservlet , @webfilter annotations on glassfish v3 server. currently web.xml defined 12 servlets , 6 filters . tried removing 1 servlet web.xml file , added @webservlet annotation java servlet file . but having difficulty in accessing servlet when ever jsp trying access servlet glassfish complains "service not available". basically servlet , filter defined using annotations never identified glassfish server 3. is existing bug annotations can not used along web.xml file ? have workaround. i referred following sun documentation migrate web.xml servlet 3 annotations you've got web.xml correct, below beginning of web.xml should use: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" metadata-complete="false" ...

ASP.NET MVC Workshop -

i mvc developer since asp.net mvc preview 1 , company chose me instructor mvc 2 workshop. session last 3 hours , have not yet decided contents of workshop. what tell mvc 2 in 3 hours grab , keep people's attention? thanks. read steven sanderson's book, bit glib demos don't tell real story. some people suggest nerddinner, why not point them @ hansellmann's video on subject? honest, need nerddinner impression of how mvc works, , steven sanderson's book impression of how use mvc. still, don't think valid question, , don't know why stackoverflow police have not jumped on one.

Embed video for play on iPhone? -

does have experience embedding .m4v movie files webpages playback on iphone? i'm trying create site optimized iphone, , includes video, can't video play - grey play arrow line through it. the markup i'm trying use embedding this: <embed width="199" height="159" type="video/x-m4v" href="http://www.samplesite.com/motion/mymovie.m4v" src="http://www.samplesite.com/motion/mymovie.jpg"/> <embed> old school use html5's < video > iphone supports it <video width="199" height="159" src="http://www.example.com/mymovie.m4v" />

sql server 2005 - BCP Function sequence error when running proc with parameters -

i have been trying create stored procedure uses dynamic sql assemble bcp command export data parameterized stored procedure csv file. was getting host data file access issue think filesystem permissions. now consistantly fillowing error when run proc: sqlstate = s1010, nativeerror = 0 error = [microsoft][sql server native client 10.0]function sequence error the proc code follows: alter procedure [dbo].[sp_makemarketinglistexports] @includeinservice varchar(1) = null, @includemlm varchar(1) = null, @includequotenoodle varchar(1) = null, @netective varchar(1) = null, @cyberchex varchar(1) = null, @agentsadvantage varchar(1) = null, @quotenoodle varchar(1) = null, @mlmlistsubscriber varchar(1) = null, @state varchar(10) = null, @mailerid varchar(10) = null, @filepath varchar(250) begin -- set nocount on added prevent result sets -- interfering select statements. s...

php - Is this a good way to structure model on an MVC application? -

this more "am doing right?" question. i using mvc framework ( zend framework ) , wondering if best way structure model. in case have user groups model and, after coding sometime, realized on controllers repeating stuff query return visible groups. $model->fetchall( array( 'enabled = 1', 'visible = 1' ) ); in order reduce code repetition, created method on model returns query visible groups. based on same situation, created many other methods hidden groups, disabled groups etc. is best way avoid code duplication? concern if kept inserting code on controllers have big headache if business rule visible group changes in future. at same time concerned that, if follow new approach, end bloated model full of methods return queries. how deal kind of situation? thanks help! if u writing queries fetch data in controllers model layer of mvc then?. write seperate layer get, add, edit etc. domain models. u can have @ repository...

c# - how can create specific folder when install setup file? -

i want make setup project , have 1 folder "resource" in path ..\bin\debug .now how can make setup file ,that when install setup "resource" folder it's files become created in install folder ? database sqlexpress database file should do?it's folder app_data in ..\bin\debug path.thanks in advance. if going creating more 1 setup recommend looking wix toolkit . xml based toolkit let create msi's amazing amount of customization. placing folders need need them no problem @ all. think might looking for. link included has link great tutorial started.

memory management - Difference between sequential write and random write -

what difference between sequential write , random write in case of :- 1)disk based systems 2)ssd [flash device ] based systems when application writes , information/data needs modified on disk how know whether sequential write or random write.as till point write cannot distinguished "sequential" or "random".the write buffered , applied disk when flush buffer. please correct me if wrong. when people talk sequential vs random writes file, they're drawing distinction between writing without intermediate seeks ("sequential"), vs. pattern of seek-write-seek-write-seek-write, etc. ("random"). the distinction important in traditional disk-based systems, each disk seek take around 10ms. sequentially writing data same disk takes 30ms per mb. if sequentially write 100mb of data disk, take around 3 seconds. if 100 random writes of 1mb each, take total of 4 seconds (3 seconds actual writing, , 10ms*100 == 1 second seeking). as e...

c++ - Will using delete with a base class pointer cause a memory leak? -

given 2 classes have primitive data type , no custom destructor/deallocator. c++ spec guarantee deallocate correct size? struct { int foo; }; struct b: public { int bar[100000]; }; *a = (a*)new b; delete a; i want know need write empty virtual dtor? i have tried g++ , vc++2008 , won't cause leak. know correct in c++ standard. unless base class destructor virtual, it's undefined behaviour. see 5.3.5/4: if static type of operand [of delete operator] different dynamic type, static type shall base class of operand's dynamic type , static type shall have virtual destructor or behaviour undefined.

xslt - what is correct way to test for xs:decimal in XSL? -

i'm trying display different information depending on incoming data. if it's integer, want display number, if it's decimal, want use 0.00# pattern. ya, know, bit mixed up, that's development spec. :> i have following xsl specific section can't see past xsl:when error message of "expected end of expression, found 'castable'. number(savg) -->castable <-- xs:decimal" <xsl:choose> <xsl:when test="number(savg) > 0"> <xsl:choose> <xsl:when test="number(savg) castable xs:decimal"> <xsl:value-of select="format-number(savg, '###,###,##0.00#')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="format-number(savg, '###,###,##0.###')"/> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:when test=...

jsf - Binding attribute causes duplicate component ID found in the view -

here jsf code: <h:inputtext binding="#{bean.input}" /> and here part of backing bean binding support: private htmlinputtext input; public void setinput(htmlinputtext input) { this.input = input; } public htmlinputtext getinput() { return this.input; } when open page @ first time works fine when open @ second time (refresh or open same url in tab or other way) duplicate id error. error message says <h:inputtext> has no unique id. here part of long error message: java.lang.illegalargumentexception: component id formid:inputid has been found in view +id: inputid type: javax.faces.component.html.htmlinputtext@cafebabe the problem occured after added binding attribute. if remove it, work fine again. how use binding attribute? duplicate component id errors may occur when: same id used on different components inside same namingcontainer . physically different components bound same property of same bean. the <f:subview>...

java - POST parameters mysteriously eaten after using spring security & an ntlm filter -

i have custom filter carries out spring security authentication checking in database, , checks ntlm provider. the problem this: enter url http://myapp.com/app/somestuff/stuff get redirected http://myapp.com/login.jsp enter correct login details , authenticate. all forms on both http://myapp.com/app/somestuff/stuff , http://myapp.com/app/somestuff/ don't work... post variables don't make server!!! i checked post variables don't make server putting filter prints them out @ top of web.xml. they're null. this problem has capability of disabling login page. please help, i'm tearing hair out on this!!!

linq - Question about a terminology which implements something like this list.Add(new{a=1, b=2}) -

what terminology usage of "new" in: list.add(new{a=1, b=2}) and type should replace t in list getlist if want use list returned value? don't want replace t "object" because want parse in linq query. thanks. since did not specify type: new {1 ), it's called object initializers anonymous types. ( msdn explaining them ) object initializer part { a=1, b=2} . if want able reference type, have create type , stuff values in. list.add( new mytype() { a=1, b=2 }); if going pairing 2 items using pair class . there triplet class in case might want store 3 items.

ruby on rails - How to redirect user to login page when user is not logged in -

when user logged in store user id in session. session[:user_id] = user.id now on other links in our site, want user redirected if session[:user_id] == nil the way think done done in each of methods of controller. def show_customers if session[:user_id] == nil redirect_to (:controller => "authentication", :action => "login") #code related show_customers goes here end but need done in every method of every controller. is there more sane rails'y way this? use before_filter .

io - Listing files in a directory matching a pattern in Java -

i'm looking way list of files match pattern (pref regex) in given directory. i've found tutorial online uses apache's commons-io package following code: collection getallfilesthatmatchfilenameextension(string directoryname, string extension) { file directory = new file(directoryname); return fileutils.listfiles(directory, new wildcardfilefilter(extension), null); } but returns base collection (according the docs it's collection of java.io.file ). there way returns type safe generic collection? see file#listfiles(filenamefilter) . file dir = new file("."); file [] files = dir.listfiles(new filenamefilter() { @override public boolean accept(file dir, string name) { return name.endswith(".xml"); } }); (file xmlfile : files) { system.out.println(xmlfile); }

Is it possible to print a text from a URL into a image, in real time? -

i want make coupon , have name or email address of user, want generate link image (the coupon) plus name and/or email it's visible coupon. this personalization , being able control coupons. thanks. maybe tutorial help: serving dynamic images python cgi , graphics libraries

rdf - triplestore with revisions -

i need store rdf triples, while keeping track of modifications. there out there service? alternatively, how keep track of revision while using context-aware triplestore ? edit : please note don't need changeset. need see triples @ time in past. i tried address sort of thing storing additional triples describing said what, when. need reification, named graphs, or quads can ruin decidability.

r - Numeric Column in data.frame returning "num" with str() but not is.numeric() -

i have data.frame, d1, has 7 columns, 5th through 7th column supposed numeric: str(d1[5]) 'data.frame': 871 obs. of 1 variable: $ latest.assets..mns.: num 14008 1483 11524 1081 2742 ... is.numeric(d1[5]) [1] false as.numeric(d1[5]) error: (list) object cannot coerced type 'double' how can be? if str identifies numeric, how can not numeric? i'm importing csv. > is.numeric_data.frame=function(x)all(sapply(x,is.numeric)) > is.numeric_data.frame(d1[[5]]) [1] true why d1 list, hence d1[5] list of length 1, , in case contains data.frame . data frame, use d1[[5]] . even if data frame contains numeric data, isn't numeric itself: > x = data.frame(1:5,6:10) > is.numeric(x) [1] false individual columns in data frame either numeric or not numeric. instance: > z <- data.frame(1:5,letters[1:5]) > is.numeric(z[[1]]) [1] true > is.numeric(z[[2]]) [1] false if want know if columns in data frame numeric, can us...

unix - rules for makefile -

let's assume have makefile unix prog:a.o b.o c.o gcc a.o b.o c.o -o prog a.o:a.c a.h b.h gcc -c a.c b.o:b.c b.h gcc -c b.c c.o:c.c c.h b.h gcc -c c.c i read if change *.c file must recompile file, if change *.h file must recompile files depending on *.h file, after both cases anyway i must link files beginning 1) let's assume change b.h, need do? variant make a.o b.o c.o right? 2) let's assume change c.c, need do? variant make c.o right? and if write make c.o example makefile only recompile c.o what linker ? have gcc -c c.c , not -o thanks in advance help what mean 'what need do?'. in every case, run make prog , , let make figure out, that's whole point. edit: if you're curious make in each case, assuming you're running make prog every time, read on: in case 1) b.h has changed, depending on (a.o, b.o , c.o) rebuilt, , prog relinked. in case 2) c.o direct dependency of c.c, c.o built , prog relinked. ...

ide - Joomla development environment, toolchain and workflow -

i have tas setup, design (devlop template), configure (menus, users, plugins etc.), provide acutal content , administer/maintain joomla based website. what tools, ides etc. use in development environment. of course of development work possible offline without web frontend. how work? have comfortable ide javascript, php , html stuff. see results , debug live , immediatetly , later upload changes server. how work? little bit of wysiwyg design work of course great too. if tools not have free , may cost money :) maybe ther tutorial ala "setting development environment joomla" focuses on tools. not installing wamp. for creating template - nvu nvu joomla template builder plugin, or dreamweaver plugin if can afford, configuration , content management joomla itself, phpmyadmin database management might useful. ide, i've used aptana studio, though haven't done development. tool i've used , found them sufficient.

asp.net - jTemplate and MicrosoftAjaxTemplates encode or decoded html (browser not render as html) -

i using jtemplate showing rss item in page. description of each item not render right. my template is: <table> <thead> <tr> <th>date</th> <th>title</th> <th>description</th> </tr> </thead> <tbody> {#foreach $t.items post} <tr> <td>{$t.post.pubdate}</td> <td><a href="{$t.post.link}">{$t.post.title}</a></td> <td>{$t.post.description}</td> </tr> {#/for} </tbody> </table> but when render page, see tag(or encoded tag) instead of render html in description column: &lt ;table border=0 width= valign=top cellpadding=2 cellspacing=7& gt;& lt;tr& gt;& lt;td width=80 align=center valign=top& gt;& lt;font style="font-size:85%;font-family:arial,sans-serif"& gt;.... and when html decode on server side, see: ...

audio - Sound processing reference -

i .net programmer. have project in mind on core sound processing. want in core language assembly or c. need reference web sites or book names can found core format sound or how read sound file or microphone. in advance. i work examples. here reference material also. if need else let me know. audacity open source audio program source code link i recommend - closest thing between c++ , .net visual c++ 2010 express introduction audio processing pdf book on digital signal processing (an electrical engineering view) book on audio signal processing site on introduction sound processing

global variables - Static initialization order issue in C++ -

this variation of old theme: initialization order of static objects in different translation units not defined. below stripped-down example of particular scenario. classes g , f non-pod types. f depends on g sense construct instance of f need number of instances of g. (for example, f message application emits, , instances of g components of such messages.) g.hpp #ifndef g_hpp #define g_hpp struct g { g() {} // ... }; inline g operator+(g, g) { return g(); } #endif gs.hpp #ifndef gs_hpp #define gs_hpp #include "g.hpp" extern const g g1; extern const g g2; extern const g g3; extern const g g4; extern const g g5; extern const g g6; extern const g g7; extern const g g8; extern const g g9; #endif gs.cpp #include "gs.hpp" const g g1; const g g2; const g g3; const g g4; const g g5; const g g6; const g g7; const g g8; const g g9; f.hpp #ifndef f_hpp #define f_hpp #include "g.hpp" struct f { f(g) {} // ... }; #endif fs.hpp ...

wxwidgets - Why is wxTextCtrl so slow at displaying text? -

i have wxtextctrl , need put large string it. (like 15 mb string) problem it's slow. here i'm doing: char * buff = ... wxstring data(buff, wxconvutf8); text->changevalue(data); however, not bottleneck. occurrs function block of code in returns. whole app freezes 30 seconds. tried wxyield right after changevalue , causes first few lines of string displayed in control still freezes after. how can avoid this? i must stress changevalue returns instantaneously. delay happens after this, in wxtextctrl's internal message handlers or something. wxtextctrl wraps standard text control of os only, limits has apparent wxtextctrl well. can use wxstyledtextctrl instead, able load multi-megabyte texts , doesn't take long it. highlight portions of log styling them (for example error messages in read), increase loading time again.

model view controller - I Need Help Understanding Zend Framework (MVC) Header and Footer Best Practices -

i'm new mvc , zend framework , i'm working on project, on front end. i'm trying sense of best practices. currently footer , header setup through several scripts, 1 giant xml file of content on website (i think make website international friendly, things wrapped in i18n tags), 1 stores of links array, 1 loops through of footer/header links, , other files i'm not totally sure they spit out simple ul of footer or header links. it seems convoluted me, why isn't header , footer simple html links in layouts, either part of main layout.phtml or included footer.phtml? simple submit buttons used long views/ helper script, when see no reason couldn't simple html. i know business logic left models, , views supposed lighter front-end scripts layout. zend framework , web development, guidance on belongs simple html , should more complex helper php script/model script appreciated. at least being able understand what's best practices footer , header me starte...