Posts

Showing posts from March, 2012

version control - A good way to manage cryptographic keys? -

what's canonical way manage cryptographic keys associated particular source code? (e.g. ssh or rsa key pairs associated particular program). i reluctant check version control obvious reasons, don't want them reside on few people's local hard drives either. you put them version control encrypted, , let few people know password. has advantage stored along code , can update them easily, files useless attacker (providing use strong password).

how to read file from the phone memory in android? -

i need read file phone memory.how read file ?can me?? here's how write in file.. fileoutputstream fos = openfileoutput("urls.txt", context.mode_private); fos.write("alex".getbytes()); fos.close(); here's how read file: fileinputstream fis = openfileinput("urls.txt"); int c; while((c=fis.read())!=-1) { k += (char)c; } fis.close(); string k contain "ankit" string. mind you.. file "urls.txt" gets formed in phone memory, cannot access file in project resource. for more information see: http://developer.android.com/guide/topics/data/data-storage.html#filesinternal

java - Jetty 6 always generates debug logs? -

i using jetty 6.1.24 develop web service , code uses slf4j, jetty does, , logging working fine. want though debug logging code but not jetty (it's verbose), cannot stop logging debug info. there system properties set debug mode (-ddebug), not unset debug mode. my logback log level set start script setting system property 'loglevel' , in turn sets in resources/logback.xml: <configuration> <appender name="console" class="ch.qos.logback.core.consoleappender"> <layout class="ch.qos.logback.classic.patternlayout"> <pattern>%d [%thread] %level %logger - %m%n</pattern> </layout> </appender> <root level="${loglevel:-info}"> <appender-ref ref="console"/> </root> </configuration> jetty either generating debug logs, ignored logger if debug not enabled, or else it's using logger.isdebugenabled() set it's debug mode. have ide...

internet explorer - jquery .change not firing in IE but working in FFOX -

i have following html: <form method="post" action="#" name="dialog_head" id="dialog_head" class="jqtransform"> <ul> <li class="pdf"> <a title="this pdf document opens in new window" target="_blank" href="#">save pdf</a> </li> <li class="print"> <a target="_blank" href="#">print price report</a> </li> <li> <label for="dialog_select">select price report:</label> <select name="dialog_select" id="dialog_select"><option value="pricereport/13415939">23 april 2010</option> <option value="pricereport/13415510">16 april 2010</option> <option value="pricereport/13415009">09 april 2010</option> <opt...

winapi - Default button size? -

how create button control (with createwindow of button window class) has standard system-wide size (especially height) that's consistent rest of windows applications? should of course take dpi account , other settings. remark: using use_cw_default width , height results in 0, 0 size button, that's not solution. this msdn has say: design specifications , guidelines - visual design: layout . the default size of button 50x14 dlus, can calculated pixels using examples shown getdialogbaseunits . the mapdialogrect function seems calculation you.

openxml sdk - Open XML SDK: opening a Word template and saving to a different file-name -

this 1 simple thing can't find right technique. want open .dotx template, make changes , save same name .docx extension. can save wordprocessingdocument place it's loaded from. i've tried manually constructing new document using wordprocessingdocument changes made nothing's worked far, tried maindocumentpart.document.writeto(xmlwriter.create(targetpath)); , got empty file. what's right way here? .dotx file special @ or document far sdk concerned - should copy template destination , open that , make changes, , save? did have concerns if app called 2 clients @ once, if can open same .dotx file twice... in case creating copy sensible anyway... own curiosity still want know how "save as". i suggest using file.io copy dotx file docx file , make changes there, if works situation. there's changedocumenttype function you'll have call prevent error in new docx file. file.copy(@"\path\to\template.dotx", @"\path\t...

How to get the EXIF data from a file using C# -

i write small program in c# goes through jpeg photos and, example, sorts them dated folders (using dating conventions, dammit...). does know relatively easy way @ exif data such date , time or exposure programatically? thanks! as suggested, can use 3rd party library, or manually (which not work), simplest , flexible perhaps use built-in functionality in .net. more see: system.drawing.image.propertyitems property system.drawing.imaging.propertyitem class how to: read image metadata i "it’s flexible" because .net not try interpret or coalesce data in way. each exif array of bytes. may or bad depending on how control want. also, should point out property list not in fact directly correspond exif values. exif stored in multiple tables overlapping id’s, .net puts in 1 list , redefines id’s of items. long don’t care precise exif id’s, should fine .net mapping.

jsp - I cannot deploy a basic html file in apache tomcat -

i making small website first project. have finalized use java servlets , jsp server-side scripting. learning o'reilly's headfirst servlets , jsp. decided use apache-tomcat web server , container. downloaded it. have jdk 1.6 update 21. unzipped apache in c: running default tomcat home page when type http://localhost:8080 in browser. in chapter 3 there small project called beer. tried make it. created directory called beer under webapps c:\apache-tomcat-7.0.0\webapps\beer . inside check basics created html file called form.html . when try access via browser http://localhost:8080/beer/form.html following error: http status 404 - /beer/form.html type status report message /beer/form.html description requested resource (/beer/form.html) not available. apache tomcat/7.0.0 i have tried using tomcat 6, no use. thank replying... doubt is..that here trying access .html file not servlet require deployment description???? well, there 1 serv...

sql - How do I do a simple 'Find and Replace" in MsSQL? -

question pretty self explanitory. want simple find , replace, in text editor on data in column of database (which mssql on ms windows server 2003) the following query replace each , every a character b character. update yourtable set column1 = replace(column1,'a','b') column1 '%a%' this not work on sql server 2003.

language agnostic - Are you fluent in Unicode yet? -

almost 5 years ago joel spolsky wrote article, "the absolute minimum every software developer absolutely, positively must know unicode , character sets (no excuses!)" . like many, read carefully, realizing high-time got grips "replacement ascii". unfortunately, 5 years later feel have slipped few bad habits in area. have you? i don't write many international applications, have helped build many asp.net internet facing websites, guess that's not excuse. so benefit (and believe many others) can input people on following: how "get over" ascii once , all fundamental guidance when working unicode. recommended (recent) books , websites on unicode (for developers). current state of unicode (5 years after joels' article) future directions. i must admit have .net background , happy information on unicode in .net framework. of course shouldn't stop differing background commenting though. update: see this related question as...

javascript - How can I draw an image from a pixel-by-pixel color array? -

is there way draw image color array using vml? have array of color codes every pixel in compressed order. want render vml using method putimagedata() in canvas. there's no similar function vml. can load image using <v:image> src attribute, there's no support canvas imagedata functions @ all. explorercanvas doesn't support them (for same reason).

actionscript 3 - How can I tab accross a ButtonBar component in Flex? -

i have button bar inf flex along several other input controls, have set tabindex property each control , goes until tab buttonbar. the buttonbar has 3 buttons tabbing it, first button gets focus, tab again , focus goes top control... how can make tabbing go through buttons in flex button bar? there way or need create individual buttons this? this seems possible bug me... the component written user must press left/right arrow keys when focus within bar traverse buttons--this standard gui behavior (you see in other places radio button groups). if sdk source buttonbar , can see they've explicitly disabled tab focus each child button it's created: override protected function createnavitem( label:string, icon:class = null):iflexdisplayobject { var newbutton:button = button(navitemfactory.newinstance()); // set tabenabled false individual buttons don't focus....

sql - How do I find records added to my database table in the past 24 hours? -

i'm using mysql in particular, i'm hoping cross-vendor solution. i'm using now() function add timestamp column each record. insert messages (typeid, messagetime, stationid, message) values (?, now(), ?, ?) select * messages date_sub(curdate(),interval 1 day) <= messagetime

How do you check what version of SQL Server for a database using TSQL? -

is there system stored procedure version #? try select @@version or sql server 2000 , above following easier parse :) select serverproperty('productversion') , serverproperty('productlevel') , serverproperty('edition') from: http://support.microsoft.com/kb/321185

Silverlight MVVM : How to do Localization in the correct way? -

in normal silverlight projects, localization in xaml view done using: text="{bindingpath=applicationstrings.mynewstring, source={staticresource resourcewrapper}}" my question : how correct localization labels when using mvvm pattern? is done described here ? in xaml view : text="{binding lblusername,fallbackvalue='user name'}" and loginviewmodel.cs class: public string lblusername { { return resources.username; } } any tips here ? and how reusing same string on multiple view/viewmodels ? (just imagine need 'username' on multiple views.) make sense to derive viewmodels basemodel defines resources ? check out article on localization using mvvm. http://cloudringer.wordpress.com/2011/02/18/localization-in-wpf-and-silverlight-with-mvvm/ there many ways solve problem depending on needs , constraints. approach describe has been flexible , blendable enough meet needs in wpf , silverlight on multiple projects. ...

.net - Is it possible to write ActiveX Controls in C# that will run in Excel? -

i have been searching on web example code on how can write custom activex control use in excel using .net far have found old articles suggesting not supported. the application building uses excel report writer add custom controls worksheets provide richer experience. research have done far appears activex controls can hosted in ie , hence need ensure approach taken works excel host. the link http://www.codeproject.com/kb/miscctrl/exposingdotnetcontrols.aspx mentions following: caveat : support has been dropped beta2 of .net, don't blame me if fries pc or toasts cat. can give me indication if possible using .net 1.1 , if pointers on best practices? andrew whitechapel writes managed controls activex controls in office documents. can read article here: using managed controls activex controls

tags - Here are fifteen characters -

i never understand why se network insists every worthless question has exist forever. it's more of browse assist search assist. if see large or bold tag in tag cloud interests lead knowledge discovery wouldn't have otherwise been sought out deliberate search. when browsing del.ico.us or stackoverflow appreciate tags lead me discover related topics. wikipedia has interesting definition : a tag cloud or word cloud (or weighted list in visual design) visual depiction of user-generated tags, or word content of site, used typically describe content of web sites. tags single words , typically listed alphabetically, , importance of tag shown font size or color. 1 both finding tag alphabet , popularity possible. tags hyperlinks lead collection of items associated tag.

linux - Learning kernel hacking and embedded development at home? -

i attracted world of kernel hacking , embedded systems. has got tutorials (+easily available hardware) on starting mess such stuff? kits writing drivers etc, come documentation , affordable? thanks! if new kernel development, suggest not starting hardware development , going "software-only" kernel modules proc file / sysfs or more complex examples filesystem / network development , developing on uml/vmware/virtualbox/... machine crashing machine won't hurt :) embedded development go small arm development kit or small via c3/c4 machine, or old pc can burn homebrew usb / pci / whatever device. a place start kernelnewbies.org - has lots of links , useful information kernel developers, , features list of easy implement tasks tackle beginners. some books read: understanding linux kernel - reference detailing design of kernel subsystems linux device drivers - written more tutorial lot of example code, focusing on getting going , explaining key aspect...

overlay - Google Maps API: Calculate Center/Zoom of Polyline -

i have overlay dynamically generated user data, need know how find center of overlay. currently, using first coordinates overlay, not represent center of overlay. therefore when load map, not centered on overlay. does have method centering map on overlay, calculating center, not hard coding it? var latlng = new google.maps.latlng(38.269239, -122.276010); var myoptions = { zoom: 15,//calculate somehow? center: latlng,// calculate value array of coordinates? maptypeid: google.maps.maptypeid.hybrid }; if have list of coordinates, can loop on them , add them latlngbounds object. here example v3 api, concept in v2 similar: var bounds = new google.maps.latlngbounds(); (var = 0; < coordinates.length; i++) { bounds.extend(coordinates[i]); } after that, can center with: bounds.getcenter(); or alternatively, can call map.fitbounds() directly, center map around center of bounds , adjust zoom, whole bounds fit view port. map.fit...

dom - Jquery fade in / out looping more than once -

i've been using jquery image swapping , fading. i have div, , id of cup-builder-error i use jquery load images divs, on error fade in , out error div $("#imgshell").attr("src","products/components/" + idarray[2] + ".png").error( function(){ $("#cup-builder-error").fadein('fast'); $("#cup-builder-error").fadeout('slow'); }); that code surrounded $("a").click( function(event){ what happens fade in / out routine loops number of time error happens. what did wrong? thanks help! each time "a" clicked, new error event being bound. need once. $('#imgshell').error(function () { $("#cup-builder-error").fadein('fast'); ...

iphone - Are there any graphical depictions of the iOS 4.0 application life cycle? -

i'm trying understand life cycle of iphone application. there graphical representations of life cycle out there? this nice graphical presentation of iphone app life cycle...

Does Django have HTML helpers? -

does django have template tags generate common html markup? example, know can url using {% url mapper.views.foo %} but gives me url , not html code create link. django have similar rails' link_to helper? found django-helpers since common thing thought django have built-in. no doesn't. james bennett answered similar question while back, regarding rails' built-in javascript helpers. it's really unlikely django ever have 'helper' functionality built-in. reason, if understand correctly, has django's core philosophy of keeping things loosely coupled . having kind of helper functionality built-in leads coupling django specific javascript library or (in case) html document type. eg. happens if/when html 5 implemented , django generating html 4 or xhtml markup? having said that, django's template framework flexible, , wouldn't terribly difficult write own tags/filters did wanted. i'm designer myself, , i've been able...

java - AOP with Local Variable Annotations -

i want use local variable annotations better aop. 1 idea implement future<t> concept proxy using annotation. @nonblocking expensiveobject exp = new expensiveobject(); //returns immediately, has threaded out instantiation of expensiveobject. exp.dostuff(); //okay, blocks until it's finished instantiating , executes #dostuff can sick aspectj on somehow , want done local variable annotations? know other threads have indicated java doesn't support them magical. don't want pass around future , break encapsulation. you can not proxy, real aspectj bytecode weaving there if annotate type instead of local variable. (i don't think local variable access supported pointcut). anyway, here's code. an annotation: @retention(retentionpolicy.runtime) @target(elementtype.type) public @interface later {} a class marked annotation: package com.dummy.aspectj; @later public class heavyobject{ public heavyobject(){ system.out.println("bo...

java - Lazy loading property and session.get problem -

in hibernate have 2 classes following classes jpa mapping: package com.example.hibernate import javax.persistence.entity; import javax.persistence.fetchtype; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.manytoone; @entity public class foo { private long id; private bar bar; @id @generatedvalue(strategy = generationtype.auto) public long getid() { return id; } public void setid(long id) { this.id = id; } @manytoone(fetch = fetchtype.lazy) public bar getbar() { return bar; } public void setbar(bar bar) { this.bar = bar; } } package com.example.hibernate import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; public class bar { private long id; private string title; @id @generatedvalue(strategy = generationtype.auto) public long getid() { return id; } public void setid...

c# - How do you bind an Enum to a DropDownList control in ASP.NET? -

let's have following simple enum: enum response { yes = 1, no = 2, maybe = 3 } how can bind enum dropdownlist control descriptions displayed in list retrieve associated numeric value (1,2,3) once option has been selected? i wouldn't bind data it's enum, , won't change after compile time (unless i'm having 1 of stoopid moments). better iterate through enum: dim itemvalues array = system.enum.getvalues(gettype(response)) dim itemnames array = system.enum.getnames(gettype(response)) integer = 0 itemnames.length - 1 dim item new listitem(itemnames(i), itemvalues(i)) dropdownlist.items.add(item) next or same in c# array itemvalues = system.enum.getvalues(typeof(response)); array itemnames = system.enum.getnames(typeof(response)); (int = 0; <= itemnames.length - 1 ; i++) { listitem item = new listitem(itemnames[i], itemvalues[i]); dropdownlist.items.add(item); }

sql - What is a Covered Index? -

i've heard term covered index in database discussion - mean? a covering index index contains of, , possibly more, columns need query. for instance, this: select * tablename criteria will typically use indexes speed resolution of rows retrieve using criteria , go full table retrieve rows. however, if index contained columns column1, column2 , column3 , sql: select column1, column2 tablename criteria and, provided particular index used speed resolution of rows retrieve, index contains values of columns you're interested in, won't have go table retrieve rows, can produce results directly index. this can used if see typical query uses 1-2 columns resolve rows, , typically adds 1-2 columns, beneficial append columns (if they're same over) index, query processor can index itself. here's article: index covering boosts sql server query performance on subject.

php - Agavi exception on otherwise working master template? -

i using agavi doctrine. master template fails load @ times agaviparseexception listing out instance of &nbsp; . i'm using latest stable versions of technologies. use &#160; non-breaking space. need have valid xhtml in template probably. refer this chart reference.

vba - Can't Kill xls files -

i have been using every version of kill routines delete xls files in current directory no success. here code. want delete every xls file except wbcntl. stepping through code shows works exception of kill swb command. (swb public defined string) 'close files except wbcntl swb1 = wbcntl.name each wb in application.workbooks swb = wb.name if swb <> swb1 workbooks(swb).close savechanges:=false on error resume next kill swb err.clear end if next wb can me this i don't think application.workbooks want. the excel 2003 vba help gives following meaning collection: a collection of workbook objects open in microsoft excel application. however, want iterate through excel files in current directory, different thing that. i no means excel vba expert, don't take word without checking, but: imagine cannot delete files @ v...

Microsoft SQL Server 2005 service fails to start -

i’ve been trying install ms sql server 2005 on 2 weeks now, , i’ve gotten point prerequisites seem in place. unfortunately, every time try install sql server itself, following message: “the sql server service failed start. more information, see sql server books online topics, "how to: view sql server 2005 setup log files" , "starting sql server manually."” the installer “rolls back” the install , i’m left 3 uninstalled products in setup list: “sql server database services,” “reporting services,” , “workstation components, books online…”. does have thoughts? can’t check sql server books online topics because don’t install, either; , can’t make sense of log files without them. thanks! i had similar problem while installing sql server 2005 on windows 7 professional , got error sql server failed start . logged in administrator (my user id administrator) in windows. solution go services, control panel -> administrative tools click on propert...

deployment - Visual Studio 2005 ERROR: An error occurred generating a bootstrapper: Invalid syntax -

i'm working on vs 2005 , has gone wrong on machine. suddenly, out of blue, can no longer build deployment files. build message is: error: error occurred generating bootstrapper: invalid syntax. error: general failure building bootstrapper error: unrecoverable build error a quick google search brings last 2 lines, nobody in cyberspace has ever reported first message before. (hooray! i'm first @ on 'net!) other machines in office able build. machine has been able build before. have no idea changed upset delicate balance of things on box. have tried traditional rituals i.e. closing visual studio, blowing away bin , obj folders, rebooting, etc. no avail. for simplicity's sake, created little "hello world" app deployment file. herewith build output: ------ build started: project: helloworld, configuration: debug cpu ------ helloworld -> c:\vault\multi client\tests\helloworld\helloworld\bin\debug\helloworld.exe ------ starting pre-build validati...

css - How can I place HTML in a JavaScript string and have it validate? -

i want show different css files depending on browser user using. want on js , on client side. using code this. <script language="javascript" type="text/javascript"> if ((navigator.useragent.indexof("msie")) >= "0"){ document.write("<link rel=\"stylesheet\" href=\"css/common.ie.css\" type=\"text/css\" } if ((navigator.useragent.indexof("chrom")) >= "0"){ document.write("<link rel=\"stylesheet\" href=\"css/common.chrome.css\" type=\"text/css\" />"); } *the problem code not valid. how can solve problem. if check document w3 checker. show now: line 22, column 90: document type not allow element "link" here***** …nt.write("<link rel='stylesheet' href='css/common.ie.css' type='text/css' />"); line 25, column 35: attribute value must literal unless contains name ch...

winforms - Integration testing with White -

has got experience white framework? www.codeplex.com/white ? i'm thinking using next project basic smoke tests of our windows client. i'd advice on articles or own experiences. thanks. i used white build few (20+) ui tests complex winforms app plenty of usercontrols, dynamically created , 3rd-party controls. here impressions: very easy , intuitive work with. little or no quality issues. it's young project there missing features, they've got basics covered. occasionally, if control didn't have known automationid, forced use keystrokes navigate , manipulate control ("tab, tab, enter" example) kind of bummer, still easy in white. happened 3rd-party or dynamically generated controls. white's recorder helpful (and generate code you) confused complicated or unusual controls. reason i'd recommend you... ...keep uispy nearby can see automationid of controls you're working with. and finally, if you're me, you're ho...

When to use Amazon Cloudfront or S3 -

are there use cases lend better amazon cloudfront on s3 or other way around? i'm trying understand difference between 2 through examples. amazon s3 designed large-capacity, low-cost file storage in 1 specific geographical region.* storage , bandwidth costs quite low. amazon cloudfront content delivery network (cdn) proxies , caches web data @ edge locations close users possible. when end users request object using domain name, automatically routed nearest edge location high performance delivery of content. ( amazon ) the data served cloudfront may or may not come s3. since more optimized delivery speed, bandwidth costs little more. if user base localized , won't see difference working s3 or cloudfront (but have choose right location s3 bucket: us, eu, apac). if user base spread globally , speed important, cloudfront may better option. both s3 , cloudfront allow domain aliases, cloudfront allows multiple aliases d1.mystatics.com , d2.mystatics.com ...

Add New Row to a DataGrid in Silverlight WCF RIA Services -

some guidance silverlight wcf ria services... datagrid , detail view on same page control layout datagrid detail view [add new row (button)] if wanted add new row button pick new row in datagrid how that? i have tried: detailviewtest.web.services.mode1domaincontext ctx = (mode1domaincontext)worddomaindatasource.domaincontext; word word = new word() { word1 = this.word1textbox.text, dateadded = datetime.now }; ctx.words.add(word); ctx.submitchanges(); this adds word database not datagrid though datasource data worddomaindatasource. if restart application shows in datagrid. great! (using silverlight 4 business application starting project ) if you're using mvvm / inotifypropertychanged pattern need fire onpropertychanged event on itemsource.

How to Autogenerate multiple getters/setters or accessors in Visual Studio -

before start, know there post , doesn't answer question: how generate getters , setters in visual studio? in visual studio 2008 there ability auto generate getters , setters (accessors) right clicking on private variable -> refactor -> encapsulate field... this great class has 2 or 3 methods, come on ms! when have ever worked class has few accessors? i looking way generate few clicks (eclipse folks out there know talking - can right click class , select 'generate accessors'. done.). don't spending 20 minutes class clicking through wizards. used have .net 1.0 code generate classes, long gone , feature should standard ide. update: might mention have found linq entities , sqlmetal cool ideas, , way beyond simple request in paragraph above. sorry, need install resharper approximately same amount of refactoring support used in eclipse. however, resharper gives dialog similar 1 used in eclipse: screenshot http://i35.tinypic.com/28a1004.png ...

Is there a way to compile C++ code to Microsoft .Net CIL (bytecode)? -

i.e., web browser client written in c++ !!! there 2 choices. managed c++ (/clr:oldsyntax, no longer maintained) or c++/cli (definitely maintained). you'll want use /clr:safe in-browser software, because wnat browser able verify it.

drupal - Hook called before to delete a node -

i'm writing custom module, , checks before node deleted. there hook gets trigerred before node deleted? , there way somehow prevent deletion? btw, i'm using drupal6 you can use hook_menu_alter point menu callback node/%node/delete own function. function can whatever checks want , present node_delete_confirm form if checks pass.

fontmetrics - Font Metrics in C -

i wanted know if there library in c available calculating font metrics (basically wanted know width of string of particular font). qt has qfontmetrics. there way can similar data in c. i wouldn't use freetype, unless on system uses x graphics display. if on windows, use windows api font metrics information , on mac use whatever cocoa provides. it might if told trying do. edit: since output of library intended consumed particular gui app, want use same gui library font metrics information app using. better have app provide metrics information library, or callback method can provide information. library doesn't have know how font metrics derived, reducing unnecessary dependency. means can use qt (c++) in gui app, still write library in c , not have figure out way call c++ c, difficult, if trying make cross-platform.

c# - Retrieving keys and NewValues within a Formview with manual data binding -

i have formview binded in code file generic list. now, upon editing of record, wish access keys , newvalues out of formviewupdateeventargs parameter of itemupdating event handler method. from i've tried , searched on internet of now, i've come know updated values available if formview set data source control on markup page else they'd null. true? secondly, @ moment casting sender object formview , individually filling each object property using findcontrol method find , retrieve values present in controls. best way task? as example, doing atm: formview currentform = (formview)sender; listobject.id = new guid(((hiddenfield)(currentform.findcontrol("hdnid"))).value); listobject.name = ((textbox)(currentform.findcontrol("txtname"))).text; thanks fellas! based on doing suggest not use formview. formview's brilliant when working datasources, fail, when dealing manual bound data way are, overriding , manually building form, , si...

Better to get value from PHP variable or from cookie? -

assume there php variable: $variable = 'username'; cookie value = 'username' which 1 better access? get_cookie() or use $variable ? i have lot of code using get_cookie('cookie_name') (a codeigniter function) instead of using variables. will increase performance if change access $variable instead of cookie? cookies passed user's browser server every page load, whether use them or not. there's going little performance difference. what may want investigate whether data being stored in cookies (if it's lot) should there or not. many people have cookies turned off, want store nonessential information (and information doesn't have secure) in them.

xmlhttprequest - Coldfusion, using GetHttpRequestData, to Store and Handle Files -

i have jquery file upload plug-in allows users upload files coldfusion server. plugin submits files server in way requires me use gethttprequestdata() files contents. here's have far in terms of handling file data: <cfparam name="url.qqfile" type="string"> <cfset x = gethttprequestdata()> <cffile action="write" output="#x.content#" file="c:\temp\#url.qqfile#"> this works, nice, can't seem take next step. what want happen next is: a. determine file's extension. b. if accepted ext defined app, (jpg,png,pdf, doc, docx, etc...) upload correct directory on server. delete temp file above c. use cfimage make thumbnail if file uploaded image how can take above through steps a-c gethttprequestdata problem? thanks a few tips: have @ result structure of gethttprequestdata() via <cfdump> . pull out necessary headers accessing struct. content-type header contains stuff want know. can us...

iphone - Why doesn't [obj selectorNotDefined] cause a warning? -

i want this: [myobject selectornotdefined]; will cause warning. there option make happen? to more specific, when add code existing project: nsobject *myobject = [[nsobject alloc] init]; [myobject selectornotdefined]; the compiler not invoke warning. if create new project , add these lines invokes warning. what's wrong existing project? if write: nsobject *myobject = [[nsobject alloc] init]; [myobject selectornotdefined]; you warning: myobject might not respond selector selectornotdefined or can check: i f([myobject respondsto:selector(selectornotdefined)]{ [myobject selectornotdefined]; //or [myobject performselector:(selectornotdefined) withobject:nil afterdelay:0]; }

objective c - How to implement the folder tree in the left of finder? -

i implement function : develope app , , have outline view, have folder , file tree finder or app called pathfinder , how implement ? thank much! that's called source list, , there's convenient nsoutlineview subclass available on github here: http://github.com/perspx/pxsourcelist

c# - Storyboards can't find ControlTemplate elements -

i've created simple xaml, , works (at least in kaxml). storyboards run when called within xaml, when try access them outside error: 'buttonglow' name cannot found in name scope of 'system.windows.controls.button'. i loading xaml stream reader, this: button x = (button)xamlreader.load(stream); and trying run storyboard with: storyboard pressedbuttonstoryboard = storyboard)_xamlbutton.template.resources["buttonpressed"]; pressedbuttonstoryboard.begin(_xamlbutton); i think problem fields animating in template , storyboard accessing button. here xaml: <button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:customcontrols="clr-namespace:pk_rodoment.skinningengine;assembly=pk_rodoment" width="150" height="55"> <button.resources> <style targettype="button"...

php - MVC tutorial that doesn't rely on a framework? -

i want learn mvc "architecture pattern" don't want jump framework rails or django yet. want understand concept first , write simple code in familiar environment, happens php/html/css/mysql. don't need tutorial based on php, understand lot of different languages. , don't want have install frameworks or apis or libraries. want learn how think in mvc , apply projects. suggestions? almost every framework mvc differently, might end getting more confused. general principles of mvc simple: "model state; view reacts model; controller reacts view; controller changes model". model, view , controller concepts - whatever feel them be. classes, bunches of classes, instances of classes xml configuration files, name it. i think covers basic principles. without framework, you'd not further. matters how particular framework defines model, view , controller , interactions.

java ee - Difference between database connection through session bean and entity bean -

what difference between writing jdbc (or) hibernate connectivity code in ejb3 session bean , writing same connectivity code through ejb3 entity bean(jpa). please clarify this.. both allow write java gets data in , out of databases, actual coding different. jdbc lets write sql code insert ... or select ... you have write own code transfer data between java objects , jdbc code. end lots of repetive "put field in column" kind of code. have @ examples such link text flavour. in jpa/hibernate annotate java class instructions tables , columns fields correspond to. reduces amount of code need write. it's simple example (taken this jpa example : @entity public class inventory { @id protected long id; ... public void setitem(item item) { this.item = item; this.id = item.getsku(); } ... } i session bean + jpa considerably less effort session bean + jdbc.

java - Create ArrayList from array -

i have array initialized like: element[] array = {new element(1), new element(2), new element(3)}; i convert array object of arraylist class. arraylist<element> arraylist = ???; new arraylist<>(arrays.aslist(array))

javascript - Is it possible to fire up a pop up like windows from a UIWebView? -

how can make uiwebview's html/javascript trigger uimodalview show on page load? you can use 1 of following delegates catch page before loads: - (void)webviewdidstartload:(uiwebview *)webview; - (bool)webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype; you can check url being loaded with: [[[webview request] url] absolutestring]; then create , show uimodalview.

c# - How to get IP of server that initiated redirect -

i hope me following question: a user clicks hyperlink in page. server handles request , redirects client url on server b (more using response.redirect method in .net on server a). i have been asked restrict access server b redirects originating server (by blocking ip's other server a's). @ first thought achieved using http 'referer' header, however, seems browser set url (rather ip), , not guaranteed so. i guess there no way set http 'referer' on server in .net (to server a's ip)? (my intuition security hole). question is, how can restrict access server b redirects originating server a? any appreciated, martijn no cannot way, browsers set referrer in conditions , client can spoof this. the referrer header request header - not response header, server cannot set this. you have server side (a token perhaps) long in control of both servers, pass token parameter in url redirect to.

How to convert XML(attributes) file into a java(classes) file -

i want write java code read input xml file , generate equivalent java code. enter code here <codemarkers classname="codegenerator" access="public"> <methodmarker javadoc="compares 2 strings" name="stringcomparator" access="private" static="no" return="boolean"> <input name="str1" notnull="true"/> <input name="str2" notnull="false"/> <methodvariable name="success" type="boolean" initvalue="false"/> <javacode> <![cdata[ system.out.println("executing comparator"); if (str1.equals(str2)) success = boolean.true; return success; ]]> </javacode> </methodmarker> <methodmarker javadoc="database employee id" name="getemployeeid" access="public" static="yes" return="int"> ...

objective c - how insert data to remote database from ip+phone Application -

i accessing php website in iphone application. i want user read blogs in iphone application , when comments on blog comment stored in website database. any idea how this. or need study talk remote database..... thanks in advance. when user read blogs , when give comment on blog u post comment php page save on server. nsstring *post =[nsstring stringwithformat:@"comment=%@", mydata]; nsdata *postdata = [post datausingencoding:nsutf8stringencoding allowlossyconversion:yes]; ] nsstring *postlength = [nsstring stringwithformat:@"%d", [postdata length]]; nsmutableurlrequest *request = [[[nsmutableurlrequest alloc] init] autorelease]; [request seturl:[nsurl urlwithstring:@" http://server.com/save-comment.php "]]; [request sethttpmethod:@"post"]; [request setvalue:postlength forhttpheaderfield:@"content-length"]; [request setvalue:@"application/x-www-form-urlencoded" forhttpheaderfi...

css - Element doesn't float right -

contact wanneer te bereiken? u kan mij 7 dagen op 7 bereiken. hoe te bereiken? telefoon +32(0)495842704 e-mail ... i want e-mail section float right of telefoon section. how manage this? tried assigning float:left telefoon h3 element, did not work. kind of appreciated! thanks! the float right element should above float left element <div style="float: right;"> </div> <div style="float: left;"> </div>

datetime - VB6 Date data type: precision and formatting -

how precise vb6 date data type (by way of fractions of second)? how format show fractions of second? i'm revisiting vb6 after many years absence, , life of me can't remember things used know. considered putting memory-leak tag on this, because memory leaked (hur hur hur). i found api call afterwards, , seems work: declare sub getsystemtime lib "kernel32.dll" (lpsystemtime systemtime) public type systemtime year integer month integer dayofweek integer day integer hour integer minute integer second integer milliseconds integer end type 1) seconds only, and 2) there's no way.

JQuery - hour spinner -

i need use jquery spinner hours template be: 00:00:00:00 currently spinner set numbers. how can it? the easiest solution have spinner each number. set a demo here . html <div class="demo"> <p> <label for="amount">set time (hh:mm:ss:fr):</label> <input class="time hour" name="hour" value="0" /> <input class="time min" name="min" value="0" /> <input class="time sec" name="sec" value="0" /> <input class="time frames" name="frames" value="0" /> </p> </div> script $(function() { $(".time").spinner({ min: 0, max: 59, step: 1, start: 0, precision: 0, width: '2em' }); $(".hour").spinner('option','max', 23); $(".frames").spinner('option', 'max', 100); });

installation - How do I detect what .NET Framework versions and service packs are installed? -

Image
a similar question asked here , specific .net 3.5. specifically, i'm looking following: what correct way determine .net framework versions , service packs installed? is there list of registry keys can used? are there dependencies between framework versions? the registry the official way detect if specific version of framework installed. which registry keys needed change depending on framework version looking for: framework version registry key ------------------------------------------------------------------------------------------ 1.0 hklm\software\microsoft\.netframework\policy\v1.0\3705 1.1 hklm\software\microsoft\net framework setup\ndp\v1.1.4322\install 2.0 hklm\software\microsoft\net framework setup\ndp\v2.0.50727\install 3.0 hklm\software\microsoft\net framework setup\ndp\v3.0\setup\installsuccess 3.5 hklm\software\microsoft\net framework setup\ndp\v3.5\install 4.0 cl...

AppFabric Cache Error:The AppFabric Caching Service service terminated unexpectedly -

i running cluster machine in virtual box in domain, default service running under network service , service stopped time following error in event log. please find error details error log below. great. log name: system source: service control manager date: 21-07-2010 16:42:07 event id: 7034 task category: none level: error keywords: classic user: n/a computer: description: appfabric caching service service terminated unexpectedly. has done 5 time(s). event xml: <event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <system> <provider name="service control manager" guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" eventsourcename="service control manager" /> <eventid qualifiers="49152">7034</eventid> <version>0</version> <level>2</level> <task>0</task> <opcode>0</opcode> <keywords>0x80000000000000</keywords> ...

user interface - Your choice of cross-browser javascript GUI -

update - comprehensive comparison, updated of february 2015, can found here: alternatives ext js 2008 question : there number of great , not so-great javascript gui frameworks out there. i've looked @ (only superficially). , can't make mind of them scroll end of question see others say ext.js obvious choice many since it's 1 of known frameworks. advantages: looks awesome , large community, lots of extensions/plugins, gpl'ed disadvanatges: inability use third-party extensions commercial license (and of extensions have killer features) backbase relatively less known. curious mix of xml , javascript reminiscent of xul. however, it's cross-browser advantages: looks good , extensible, allows easy incorporation of some neat stuff disadvantages: pricing steep , cpu-bound (though free use on 2 cpus), forums slow respond (though commercial support supposedly fast) qooxdoo popular. advantages: please, fill in disadvantages: code slighly me...

iphone - How do you animate the layout of the UI elements in a custom view of an iOS app? -

i'd build preferences screen in ios app has segmented control @ top and, depending on state, determine sliders , switches visible, they're positioned. when change state of segmented control , layout of screen changes, i'd animate smoothly new layout. example of kind of behavior can seen in the wireless settings of ios device, click around on various segmented controls, can see layout animating. i understand how hide , reposition controls, how animate it? i'm used specifying "yes" "willanimate" parameter, these hide , reposition functions don't include it. in interface builder, how should create multiple layouts of controls in single view? position controls on top of each other? thanks in advance help! 1) this: [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1]; //1 sec duration [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(mytransitiondidstop:f...

security - HTML encode user input when storing or when displaying -

simple question keeps bugging me. should html encode user input right away , store encoded contents in database, or should store raw values , html encode when displaying? storing encoded data reduces risk of developer forgetting encode data when it's being displayed. however, storing encoded data make datamining more cumbersome , take bit more space, though that's non-issue. i'd suggest encoding information on way out. storing raw data in database useful if wish change way it's viewed @ point. flow should similar to: sanitize user input -> protect against sql injection -> db -> encode display think situation might want display information rss feed instead. having redo html specific encoding before re-display seems bit silly. development should follow "don't trust input" meme, whether input user or database.