Posts

Showing posts from March, 2010

Calling android native APIs from javascript functions of embedded WebView -

i blackberry developer , don't have experience in android programming. i trying create android application have webview/embedded browser. load web page javascripts in embedded browser. there buttons on page call javascript functions. of these functions require access native apis (eg camera api). possible call native api's javascript functions or access native code of app ? right possible in blackberry platform using javascript extension. i'm expecting similar in android. thank you. anyone looking answer, i've found solution based on @dtanders answer. check out: http://developer.android.com/guide/webapps/webview.html#bindingjavascript use http://developer.android.com/reference/android/webkit/webview.html#addjavascriptinterface(java.lang.object, java.lang.string) expose java interfaces javascript running in webview

bufferedreader - Java Combine multiple images into a single bigger image without overlapping -

i'm trying combine several images larger image using java. images passed in height 127 x width 293. idea number of images passed method , method takes images , builds them larger image. there going layout larger image total of 12 possible images can input larger image, spaced out evenly (2 rows of 6 images, none overlapping). if there fewer 12 images passed in, first many spaces filled, rest of image white because background going white. when run program prints larger image, fill first space showing first image in upper left, regardless of how many images passed in. background pinkish color instead of intended white background. i'm beginner java i'm trying work through of these learning pains. advice on how might able solve problem? (code copied below reference) thanks! public class imagescombine { public string buildimgs (file[] imgs)throws ioexception { int arsize = imgs.length; file path = new file("z:/javafiles/images/"); bufferedimage page ...

java - Problem parsing UTF-8 XML File with SAX Parser -

i trying parse xml file made , pull information out of it. basing off of this tutorial. parsing connecting xml file ok , evaluates first tag crash afterwards seen in output. attached below xml file layout, java parsing code, , console output. any idea why not reading next tag of xml, , if so, should change? xml file: <?xml version='1.0' encoding='utf-8' standalone='yes' ?> <filepath>/mnt/sdcard/audio_recorder/anonymous22242.3gp</filepath> <filename>anonymous22242.3gp</filename> <annotation> <file>anonymous22242.3gp</file> <timestamp>0:06</timestamp> <note>test1</note> </annotation> <annotation> <file>anonymous22242.3gp</file> <timestamp>0:09</timestamp> <note>lol</note> </annotation> <annotation> <file>anonymous22242.3gp</file> <timestamp>0:09</timestamp> <n...

Change Default Try-Catch Variable Name VB.NET 2010 -

i wondering if possible change default variable name shows in auto-complete try-catch block. populates as: try catch ex exception end try i want populates as: try catch excerror exception end try you can using code snippets... http://dotnet.dzone.com/news/code-snippets-visual-studio

How do I run Rails on Windows Server 2003 or 2008? -

i developed rails application on linux , it's launch, client's guys stopped saying want run on windows in-house server. i've never run rails application on windows, have to. questions: they set dedicated windows machine. better, windows server 2003 or 2008? do use iis web server? there better option? i use paperclip plugin imagemagick. what's equivalent on windows? do advice me? running on windows might far ideal, specially if application used components lack working version on windows. if application intranet usage, can deal running thin standalone instead of putting things behind iis. need make app work service. rails 2.3 have mongrel_service. rails 3 there no service solution right now. if require use iis, please ask guy @ helicon zoo there imagemagick windows, , works paperclip.

redirect - PHP continue statement? -

im trying create redirect if user not logged in , havin trouble here method im using <?php if ( is_user_logged_in() ) { ?> /*my content*/ <?php } else { echo '<meta http-equiv="refresh" content="0; url=http://www.*****.com/non-member.php">'; } ?> this working fine delayed , im able see page few seconds before redirects. what this. <?php if ( is_user_logged_in() ) { /*ignore next statement*/ } else { echo '<meta http-equiv="refresh" content="0; url=http://www.****.com/non-member.php">'; } ?> im not sure if possable assume there mehod out there somehow. for type of behavior, you're better off using header: <?php // place @ top, before (including whitespace). if( !is_user_logged_in() ) { header("location: http://www.****.com/non-member.php"); die(); // don't want rest of page showing. } ?> that you're tryi...

how to set a null value to default in oracle sql -

how set empty set or null value default value 1? so far, have statement, in case null values want handle that: select case when count(*)=0 0 else 1 end output testtbl timestamp = to_char(sysdate-1, 'yyyymmdd')||'0000'; select case when exists ( select * testtbl timestamp = to_char(sysdate-1, 'yyyymmdd') || '0000' ) 1 else 0 end output dual edit added from dual oracle not allow select without from clause.

Android add library via eclipse grayed out -

Image
i'm trying add library reference project , when go project > properties > android window , click add, library project grayed out (see below). idea why happening? android sdk being referenced in preferences , build target (version 7) selected. thanks add/import project want reference library eclipse , make sure have open. library's api level may not higher project. if project selected reference, have remove first. i'm not sure if jdk version relevant, recall having problems referenced libraries under version 1.6.

c# - Response.Write print text from database as HTML -

i'm storing text textarea database. text can contain new lines, special characters etc. want make sure when show using response.write, comes out if show in textarea control. reason why want because want give user print view form. solution below not work. using asp.net/c# e.g foreach (datarow row in dview.table.rows) { response.write("<tr>"); response.write(string.format("<td>{0}<br/><br/></td>", row[1].tostring().replace("\n", "<br/>"))); response.write("</tr>"); thanks don't way, you'll run problems, when quotes , symbols involved. store data : httputility.htmlencode("<p>lorem ipsum ...</p>"); //your html encode goes here and retrieve this: myplaceholder.text = httputility.htmldecode(mydata); here's little more information on htmlencode/decode

iphone - Animate a Stick Figure with Cocos2d, images vs. drawing? -

i saw question on cocos2d forum, , see answer, i'm assuming more answered here: i wondering best method go animating stick figure running, walking, etc. need have wide , flexible range of motion, prefer animate multiple lines rather create premade images , flip through them. use rotation or use trigonometry figure coordinates angle of moving extremities? advice, direction or code snippets appreciated! you set own anchor points each sprite animate rotation- way rotate arm end of arm using rotate instead of doing lot of complicated math. setting anchor point allows translate sprite along point instead of center. anchorpoint tutorial . however, think might easier create lot of images of stick figure doing of actions. think n game , character has lot of animations.

sql server 2008 - Beginner's SQL: How do I find a detached database? -

Image
i'm brand new sql , i'm practicing queries db. i've detached database using tasks > detach question 1: when detach file, i'm guessing it's saved mdf file? locate file? question 2: when create new db, related files saved? i'm assuming mdf , ldf set of files created. if helps, here's version info microsoft sql server 2008 (sp1) - 10.0.2531.0 (x64) mar 29 2009 10:11:52 copyright (c) 1988-2008 microsoft corporation developer edition (64-bit) on windows nt 6.1 (build 7601: service pack 1) thanks! you can @ database properties in object explorer in sql server management studio before detaching - file(s) not moved or when detaching.... in properties dialog box, go files section , right, relevant info can found:

google chrome - jQuery slide slicing off the tops of images -

for reason, slide in chrome , safari slicing off tops of images on 1 slider on site , not other. code bit hairy each slider, can have @ problem , code here: http://explorevictoria.dreamhosters.com/ i have used same slider twice on same page, functions have own variables. @ 1 point smaller slider working properly, after changes other parts of page top 20 pixels of images in bottom slider getting left behind. i've tried couple of dozen things padding , margins around part of site, , nothing seems fixing it. i can provide more information problem if unclear, think obvious when viewing site. change margin .slidesmall margin: 20px auto , stop doing it. seems browser issue, because if drag image around or highlight element inside dev tool in chrome after slicing, turn normal. has with browser thinking element above covering top portion of div doesn't redraw pixels correctly.

sql server 2008 - How to fix the error 'input Web Services Description Language (WSDL) file is not valid'? -

i'm facing problem when deploy dtsx file production server. in dtsx file consume webservice through web service task , webservice asks wsdl file has download local path. there no problem in machine, in production server won't ever exists. i think not acceptable ask client me permissions enter in production server , create folder store wsdl file. in addition happen when wsdl changes? have deploy dtsx package again , replace wsdl file in server. think not option. so, question is, is there possible way avoid have physical file wsdl especifcation, or deployed within dtsx deployment package, or save in variable, or how else that? i've been searching lot, still not luck. any appreciated. to achieve this, 1 option make use of script task , of .net namespace system.net.webclient , can access wsdl url path , download contents of wsdl file system's temporary folder path. can system's temporary folder path, value of environment variable temp , usin...

simplecursoradapter - Android Where to call changecursor? -

i have custom simplecursoradapter getview this: public view getview(int position, view convertview, viewgroup parent) { //this.changecursor(c); tried didn't work. this.c.movetoposition(position); int urlcol = c.getcolumnindex("url"); final string url = c.getstring(urlcol); //other code stuff. imagedownloader.download(url, thumbnail, rowid, db,pb); the imagedownloader calls update on dbadapter c.getstring(urlcol) still gives me previous value. tried putting changecursor @ position above still got same value. should calling this? thanks! i don't want listview redraw want latest data cursor. i'm passing in imageview , url imagedownloader class download image, set bitmap imageview , update database. noticed cursor not updated getview method returns me same data. this custom simplecursoradapter declaration. getview mentioned above. public class messagescursoradapter extends simplecursoradapter { private final imagedownloader imag...

linker error - Avoiding linking against static libraries when using libtool -

i trying cross compile imagemagick on linux machine. libstdc++.a comes toolchain not compiled fpic. use file instead. libtool keeps linking libstdc++.a (as whole-archive) , relocation errors. have seen same issue other libraries well. ideas? deleting la files toolchain folder helped. guess without la files, libtool search , finds dynamic libraries.

iphone - Core plot. Lables overlapped -

Image
hi have core plot graphic. default looks fine, if resize it, lables on x axis overlapped. have dates on x axis, how can change days weeks? please see screenshot. event heppen on resize? the default axis labeling policy puts ticks constant distance apart. might try cptaxislabelingpolicyautomatic labeling policy. policy automatically adjust tick spacing plot range changes.

html5 - javascript library for free form drawing -

is there javascript library lets me draw on web page , save state of drawing? i want draw 2d image using mouse , how store , load drawing you should @ processingjs .

java - Amazon's Knowledge of Submitted apk's -

how amazon know things android app? for example, able determine blocked ui , declined reason. how did ascertain blocking , there software available me check this? ask because have large app , want pinpoint occurring, thought careful when invoking ui changes. amazon says... application attempts call android activity lifecycle method on background thread. amazon drm not allow developers invoke android activity lifecycle methods on background threads. more information on processes , threads, please visit: http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html . additionally, android ui toolkit not thread-safe. so, must not manipulate ui worker thread — must manipulation user interface ui thread. there 2 rules android's single thread model: * not block ui thread. * not access android ui toolkit outside ui thread. update: i speculate (as request :)) use miriad of tools , scripts execute submitted app in lots of permutations of api lev...

android - Why are parentheses used when declaring a textview -

i'm new android. i've got experience c# , java can't figure out. i know how use it. i've written couple apps already. it's simple don't understand this. why (textview) in parentheses. i've searched sdk documentation , afaik doesn't mention this. textview example = (textview) findviewbyid(r.id.example); this explict cast, findviewbyid() returns more generic type view. the convention c, , used in c++, , in case, java. vb.net , other basic variants have ctype(), or cast(). stongly typed languages have similar mechanism explicitly convert between types in compatible way. note that, in example, not returned findviewbyid() can safely cast textview type.

ruby - Creating a nested model by hand in Rails 3 -

i have recipe form has_many ingredients. through (beside point) out of pattern choices, end parameters being passed 'create' action on 'recipes' controller: { "commit" =>"create recipe", "authenticity_token" =>"qieydcyoetcmu2bba3bm9x7hsxxtift7cuyuk7yvtpc=", "utf8" =>"✓", "recipe" => { "title" =>"", "url" =>"", "site" =>"", "instructions" =>"", "ingredients_attributes" => { "0" => { "quantity" =>"5", "name" => "flour" } } } } i trying hammer model save @ once, out benefit of form builder. i've tried various ways saved model when call @recipe.save , seems igno...

How to include a .sh (script) file in Mysql stored procedure? -

is possible include script file (.sh file) inside stored procedure in mysql? if yes, how? , if no, why? like @mu short said: you need install these udf's from: http://www.mysqludf.org/lib_mysqludf_sys/index.php here's download link: http://www.mysqludf.org/lib_mysqludf_sys/lib_mysqludf_sys_0.0.3.tar.gz note shell commands run privileges of mysql user, not privileges of user that's connecting mysql. security point of view bad idea. note warning in link: a note of caution careful in deciding whether need function. udfs available database users - cannot grant execute privileges them. commandstring passed sys_exec can pretty everything, exposing function poses real security hazard. even benign user, possible accidentally lot of damage it. call executed privileges of os user runs mysql, entirely feasible delete mysql's data directory, or worse. the function intended specialized mysql applications 1 needs extended control on operati...

linux - Small install script in sh -

i programmed small installation program in sh. code: #!/bin/sh echo $ 1 if [ "$1" ! = "install"]; echo "why not install? else echo "installing ..." fi and throws error: install [: 10: missing ] installing ... edit : rolled incoperation of answers question. if [$1 != "install"]; should be if [ "$1" != "install" ];

objective c - iPad Split View Development -

i have begun app development ipad. need develop app similar bbc news app - ui wise. looking uisplitviewcontroller examples , tuts. seems width of both sub views cannot changed. know bbc news app has accomplished this, in portait mode description view takes whole screen , there single row of news articles on top, know how can made possible. thanks i think have build own split view.

In C/C++, is there a directive similar to #ifndef for typedefs? -

if want define value if not defined, : #ifndef thing #define thing other_thing #endif what if thing typedef 'd identifier, , not defined? this: #ifntypedef thing_type typedef uint32_t thing_type #endif the issue arose because wanted check see if external library has defined boolean type, i'd open hearing more general solution. no there no such facility in c++ @ preprocessing stage. @ max can is #ifndef thing_type #define thing_type uint32_t #endif though not coding practice , don't suggest it.

Excel VBA: Range to String Array in 1 step -

i know can take range of cells , slap them variant array want work string array (because it's single-dimensional , takes less memory variant array). is there way automatically convert range string array? right using function take range , save values in variant array, convert variant array string array. works nice , i'm looking way go directly range string array. appreciated. function rangetoarray(byval my_range range) string() dim varray variant dim sarray() string dim long varray = my_range.value redim sarray(1 ubound(varray)) = 1 ubound(varray) sarray(i) = varray(i, 1) next rangetoarray = sarray() end function update: it's looking there no way skip step of throwing data variable array first before converting single-dimensional string array. shame if it's true (even if doesn't take effort, ultra-optimize hoping there way skip step). i'll close question in few days if no solution presents itself. helpful comments, guys! update2: answer go...

.net - template field issue in the gridview -

q: i have following problem , , don't know how fix really. i have grid view 1 of columns template field (text box). grid view consists of 8 rows . every time user enter data in text box,i put total in last text box(which set enabled = false).i sum data entry in text boxes through method , call in event text changed . every time enter number in text box , click tab in keyboard or use mouse cursor move next box lose focus , , have put mouse cursor again in intended textbox. i try following methods fix problem in vain . foreach (gridviewrow r in gv_evaluation.rows) { ((radtextbox)r.cells[3].findcontrol("txt_evaluateweights")).attributes.add("blur", "calc()"); } in page load , doesn't work @ all. protected void txt_evaluateweights_textchanged(object sender, eventargs e) { calc(); ((textbox)sender).focus(); } this way return focus previous textbox (i mean 1 have done) not text box...

How to implement "check for updates" concept in iphone app -

i have pickerview showing times in minuts (5,10,20). if user select of time updates after selected time. , application run usual after 5 minutes message show updates occured. how implement concept? coding should do? as per guess should go threading? you have nstimer starts when choose time pickerview. timer = [nstimer scheduledtimerwithtimeinterval:pickervalueinseconds target:self selector:@selector(updatemethod) userinfo:nil repeats:no]; you choose no repeat, in updatemethod make request: -(void)updatemethod { nsstring *url = @"url..."; nsurlrequest *therequest=[nsurlrequest requestwithurl:[nsurl urlwithstring:someurl] cachepolicy:nsurlrequestuseprotocolcachepolicy timeoutinterval:20.0]; // timeout interval. // create connection request // , start loading data nsurlconnection *theconnection=[[nsurlconnection alloc] initwithrequest:therequest delegate:...

c++ - Is it sane to use the Factory Pattern to instantiate all widgets? -

i looking using implement style , rendering in little gui toolkit of mine using factory pattern, , crazy idea struck me. why not use factory pattern widgets? right i'm thinking in style of: widget label = widget::create("label", "hello, world"); widget byebtn = widget::create("button", "good bye!"); byebtn.onevent("click", &goodbyehandler); new widget types registered function widget::register(std::string ref, factfunc(*fact)) what pros , cons of method? i bet on there no performance issues using std::map<std::string> used when setting things up. and yes, forgive me being damaged javascript , possible syntax errors in c++ quite while since used language. summary of pros , cons pros it easy load new widgets dynamically file widgets replaced on run-time (it assist unit testing) appeal dynamic people cons (and possible solutions) not compile-time checked (could write own build-time check. js...

c++ - How to get a 2d int array from a char*? -

i want pass 2d int array main function. since main function signature int main(int argc, char*argv[] how can 2d array int[][] in code? command line: myprogram {{2,3},{5,6},{4,5},{6,8},{2,5}} this: {{2,3},{5,6},{4,5},{6,8},{2,5}} end string in program. need break pieces turn array of arrays.

objective c - Format text from "HELLO, WORLD. HOW ARE YOU?" to "Hello, world. How are you?" in ObjC(iOS)? -

as title said, need format string of text in format like: "hello, world. how you?" "hello, world. how you?", there standard method doing in ios? or there sample code ? thanks! there no direct way capitalize first characters of sentences in paragraph. nsstring has method capitalizedstring capitalizes each , every word. have create own logic achieve this. can try following code. - (nsstring *)captilizeparagraph:(nsstring *)paragraph { if ([paragraph length] == 0) return paragraph; nsarray *sentences = [paragraph componentsseparatedbystring:@". "]; nsmutablearray *capitalizedsentences = [nsmutablearray array]; (nsstring *sentence in sentences) { sentence = [sentence lowercasestring]; sentence = [sentence stringbyreplacingcharactersinrange:nsmakerange(0,1) withstring:[[sentence substringtoindex:1] uppercasestring]]; [capitalizedsentences addobject:sentence]; } nsstring *capitalizedparagr...

Building a dynamically generated configuration UI using reflection on .NET Config Datatypes -

has got experience / attempted this? we have reasonably complex xml config our .net application , thinking nice if use our config object hierarchy dynamically build ui, using reflection , attributes/meta-data properties on these objects present options user produce configuration. it nice make quite generic, can provide .net xml config object (within reason) , reflect on , allow populated. you need think config files in .net for. place defining differences between different deployments of application. when talk dynamically altering config based on coded logic, think might have wrong way round. code should taking direction settings injected via configuration. it seems looking build kind of config editor? why when visual studio has 2 built in? edit window , various configuration editors, asp.net configuration editor, microsoft service configuration editor etc. in experience, differences between web or app.config in dev environment vs test environment vs production en...

Magento error “Front controller reached 100 router match iterations” -

i have annoying problem. googled error. , haven't found solution website. used debugging code provided andrey tserkus . i can see more 1 iteration (till 100) "default" router. have four: admin, standard, cms, default. if there 1 iteration router "standard". examples: 2011-07-19t21:59:05+00:00 debug (7): total 4: admin, standard, cms, default 2011-07-19t21:59:05+00:00 debug (7): - iteration 1 2011-07-19t21:59:05+00:00 debug (7): request: [path_info=/computer/tas.html][module=][action=][controller=][controller_module=][route=] 2011-07-19t21:59:05+00:00 debug (7): matched "standard" router, class mage_core_controller_varien_router_standard 2011-07-19t19:09:48+00:00 debug (7): total 3: admin, standard, default 2011-07-19t19:09:48+00:00 debug (7): - iteration 100 2011-07-19t19:09:48+00:00 debug (7): request: [path_info=/audio/radio/radio.html][module=cms][action=noroute][controller=index][controller_module=][route=] 2011-07-19t19:09:48+00:00 debug ...

android - Send SMS from CDMA(htc evo) throws NullPointer Exception -

i doing 1 app in have send sms cdma phones throws null pointer exception. using smsmanager.senddatamessage(phonenumber, null, (short)1001, msgstr.getbytes(), sentpi, deliveredpi); it throws error below:- 07-21 14:53:26.875: error/androidruntime(8645): fatal exception: main 07-21 14:53:26.875: error/androidruntime(8645): java.lang.nullpointerexception 07-21 14:53:26.875: error/androidruntime(8645): @ android.os.parcel.readexception(parcel.java:1253) 07-21 14:53:26.875: error/androidruntime(8645): @ android.os.parcel.readexception(parcel.java:1235) 07-21 14:53:26.875: error/androidruntime(8645): @ com.android.internal.telephony.isms$stub$proxy.senddata(isms.java:558) 07-21 14:53:26.875: error/androidruntime(8645): @ android.telephony.smsmanager.senddatamessage(smsmanager.java:524) 07-21 14:53:26.875: error/androidruntime(8645): @ prototype.smsonport.smsonportactivity.sendsms(smsonportactivity.java:139) 07-21 14:53:26.875: error/androidruntime(8645): @ pr...

.net - ObjectDataSource Paging -> no data displayed in GridView -

i have objectdatasource , gridview configured shown below (using vs2008 w/ .net3.5): <asp:objectdatasource id="odsmaindata" runat="server" enablepaging="true" oldvaluesparameterformatstring="original_{0}" selectmethod="getmaindata" typename="errorviewer.model.errorviewmodel" selectcountmethod="countmaindata"> <selectparameters> <asp:parameter name="maximumrows" type="int32" /> <asp:parameter name="startrowindex" type="int32" /> </selectparameters> </asp:objectdatasource> <asp:gridview id="grdmaindata" runat="server" allowpaging="true" datasourceid="odsmaindata" pagesize="15" allowsorting="true"> </asp:gridview> there no eventhandlers or other code in code behind gridview or dataso...

php - How large must be a file to prevent you use DOM or SimpleXML and use a pull parser instead? -

i going build script , handle big xml file. question when have move pull parser instead of using dom or simplexml? when xml file loaded memory, loaded every time each user requests data it, simultaneously or single time period ? should follow "chunk method" or avoid , use sax/xmlreader ? thank you. tree-based representations of xml, such dom, use 5-to-10 times source document size. becomes pain above 200mb or (or less if you're trying handle high concurrency , throughput, of course). if want avoid repeatedly loading same document memory, application should maintain cache.

sim card - How to get your own phone number in Android -

i trying develop application needs phone number of sim card every time new sim card inserted in phone....then use phone number user subscribed online server.i have read many forums , found this telephonymanager tmgr =(telephonymanager)mappcontext.getsystemservice(context.telephony_service); mphonenumber = tmgr.getline1number(); but said not efficient method.if not efficient method efficient method , cannot use other property sim id or subscriber id etc.i need phone number. appreciated. as far know, method not return right sim number; depends on sim card itself. if want sim number, can send sms specific phone, it.

c++ - LNK2019 unresolved external symbol NtOpenFile -

i facing linker error code. trying compile visual studio command prompt (2010) in win-7 x64 bit m/c. error see below. dust2.obj dust2.obj : error lnk2019: unresolved external symbol _ntopenfile @24 referenced in function _main dust2.obj : error lnk2019: unresolved external symbol _rtlansistringtounicodestr ing@12 referenced in function _main dust2.obj : error lnk2019: unresolved external symbol _rtlinitansistring @8 refer enced in function _main dust2.exe : fatal error lnk1120: 3 unresolved externals the simplified version of code this: #include <windows.h> #include <iostream> #include <winternl.h> using namespace std; int main() { ntstatus status; object_attributes obja; handle sourcefile; punicode_string pathname=0; pansi_string p_path=0; const char* ccp_path = "d:\\txt.txt"; rtlinitansistring( p_path,ccp_path ); rtlansistringtou...

XNA/C#: Entity Factories and typeof(T) performance -

in our game (targeted @ mobile) have few different entity types , i'm writing factory/repository handle instantiation of new entities. each concrete entity type has own factory implementation , these factories managed entityrepository. i'd implement repository such: repository { private dictionary <system.type, ientityfactory<ientity>> factorydict; public t createentity<t> (params) t : ientity { return factorydict[typeof(t)].createentity() t; } } usage example var enemy = repo.createentity<enemy>(); but concerned performance, related typeof(t) operation in above. understanding compiler not able determine t's type , have determined @ runtime via reflection, correct? 1 alternative is: repository { private dictionary <system.type, ientityfactory> factorydict; public ientity createentity (system.type type, params) { return factorydict[type].createentity(); } } which used as var enemy = (enemy)repo.createe...

c# - "Invalid attempt to call Read when reader is closed" error (for lengthy operations only) -

we have operation in more 100.000 records read csv file , inserted in database. when using file 10 records, operation completed in less 1 minute. when use 100.000 records, getting following error “invalid attempt call read when reader closed.” after 10 minutes. there timeout can configure avoid error? note: commandtimeout set zero. dbcommand cmd = db.getstoredproccommand("aspinsertzipcode"); cmd.commandtimeout = 0; datastringtoprocess.remove(datastringtoprocess.length - 1, 1); db.addinparameter(cmd, "@datarows", dbtype.string, datastringtoprocess.tostring()); db.addinparameter(cmd, "currdate", dbtype.datetime, datetime.now); db.addinparameter(cmd, "userid", dbtype.int32, userid); db.addoutparameter(cmd, "countofunchangedzipcode", dbtype.string, 1000); dbdatareader rdr = null; try { rdr = (dbdatareader)db.executereader(cmd); if (rdr.read()) { if (!string.isnullorempty(utility.getstring(rdr, "newzi...

image - PNG custom shape with PHP imagemagik or GD2 -

is possible make transparent png image php has custom shape? example, i've got jpg image @ server. using php imagemagik or gd2 save transparent png , transparency custom shape. hope it's clear. if it's not send example. regards, dave umm possible make transparent, can set color transparent, , library make each matching pixel transparent. i'm not sure mean shape though. http://php.net/manual/en/function.imagecolortransparent.php

android - Custom font in WebView using CSS intermittently disappearing on Galaxy Tab -

i got problem similar one in case, i'm using css declare font in css file: @font-face { font-family: myriadpro; font-weight: bold; src: url('../resources/myriadpro-bold.otf'); } use in style: .ueberschrift { font-family: myriadpro, sans-serif; font-size: 2.4em; font-weight: bold; line-height: 100% !important; margin: 0 0 0.4em 0; } which displays fine on samsung smartphone, acer- or motorola tablet. however, on samsumg galaxy tab, font disappears lot of time. space font allocated, nothing rendered. make matters worse, bug appear 3 out of 4 times, 1 in 4 times font rendered. check following screenshots: font rendered font not rendered any ideas? try declaring full path of url. had issue similar when using webink, managed resolve when used full path.

key - ant send yes or no -

i stuck @ thing scenario, i have batch file upon running ask confirmation " press y/n ". automate batch file using ant. so, code looks this <exec executable="cmd.exe" dir="${base.dir}" > <arg line="/c run.bat" /> </exec> but have no idea how pass keyboard value 'y' in run time please me out use input task?

c# - Logging into a website and retrieving data -

i'm building c# application using .net 3.5 require logging in website select options , proceed page contains links excel file. want know how can proceed these steps. 1) load web page (either hidden or visible in window in application, preferred hidden). 2) type in username/password combination , submit them website. 3) choose appropriate options depending on account provided (just need know how can go through check boxes , lists). 4) proceed next page , load file in link (maybe download temp location, read delete). update: i have application use @ work following ... when run application logs server authenticate session. application has button when clicked shows/hides current activity on page using webpage itself. the application loads page, types username password , submits. authenticates session on server. but application different somehow, application load webpage (home page) logs in chooses options (i`ll set options depending on page) on next page, there li...

java - Background job running without affecting the rest of the gui -

i'm asking assistance concerning general approach. i have written java code check mailbox unread mails on buttonclick. now want code permanently run in background , check mailbox every 2 minutes. bad idea: while(true) { checkmails(); thread.sleep(120000); } the rest of graphical interface freezes, there has happen magic threads, suppose. how realized? either use javax.swing.timer , or swingworker , although latter bit overkill in scenario. if task not modify swing components, why not spawn separate thread, such thread t = new thread(new runnable(){ @override public void run(){ while(!thread.currentthread().isinterrupted()){ //do stuff try{ thread.sleep(120000); }catch(interruptedexception e){ thread.currentthread().interrupt(); } } } }); t.start(); it's important note you'll want use boolean ensure thread created once, since there...

file upload - How to make a fileupload interface in ASP.NET -

i trying make file upload interface in asp.net webforms , looking advice on how proceed. the file upload interface part of website making on users can post adverts. interface part of "create new advert" , enable user upload 6 images. using asp.net fileupload server control trying make control work when users have javascript disabled. that's background. the upload 6 files occurs on button click. stores files in temp folder (/useruploads/temp) until user submits form in case files moved /useruploads folder , references in database or until user hits cancel button or navigates away in case files deleted. first question is: storing files in temp directory right way go this? or there better way of keeping temp files on server until parent form submitted? alternative can think saving files session, seems recipe killing server... second question: unclear when user closes browser window. want avoid ending mess of orphaned files in temp directory. there way make sure f...

java me - Blackberry Multiple OS version compatibility issue -

i have developed chat application on blackberry os 5.0 client wants me make portable platforms 4.5 5.0 , above. have tried using preprocessor directives compile os compatible classes @ run time, haven't succeeded in yet. doubt way i'm using preprocessors. i'm putting example here: //#ifdef jde_4_6_0_and_above /* //#endif //some code //#ifdef jde_4_6_0_and_above */ //#endif //#ifndef jde_4_6_0_and_above /* //#endif //alternative of code used above //#ifndef jde_4_6_0_and_above */ //#endif this way i'm doing particular part of code. logic here use first code if os version 4.6 , above...and use second code if os version below 4.6.... but code under preprocessors doesn't seem compile in either of case. note: have put "//#preprocess" @ start of code , defined preprocessors in application descriptor xml file, still no luck. there other solution handling compatibility between bbos versions? you placing code outside statements. ifdef , ...

c# - GeometryDrawing serialization/deserialization -

there need provide sort of interface(save/edit/load) dynamically generated styles formed geometrydrawings. problem distinction between them in situation lack name property. i've tried : // dummy predefined style, has more drawings keep first 1 const string templatexaml = @"<drawingbrush xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" stretch=""uniform""> <drawingbrush.drawing> <drawinggroup> <drawinggroup.children> <geometrydrawing geometry=""f1 m 77,92l 704,92l 704,517l 77,517l 77,92 z "" x:name=""test_name""> <geometrydrawing.pen> <pen thickness=""4"" linejoin=""round"...

android - What's the best way to add support for multiple languages in an app? -

i'm looking way include multilingual support in app i'm working on android honeycomb - what's best practise of doing this? i've been looking @ .mo files , such, haven't been able find concrete answer yet. thanks. try localozation tutorial here http://developer.android.com/guide/topics/resources/localization.html

asp.net mvc - mvc Unit Test Provider did not return ProviderManifestToken String -

currently using nunit test , i'm getting "provider did not return providermanifesttoken string" error whenever execute test. figured it's not able access web.config situated in separate project. wondering how go passing connection string unit test project? or have store connection string in unit test project itself? resx file? no? appreciated. thanks! if have unit-test assembly named school.student.tests.dll, need make sure school.student.tests.dll.config there proper connection string. or need copy connection string web.config app.config in unit test project

api - connect to facebook chat server, no response -

i writing php code let app connect facebook chat server xmpp client. i have managed authentication part, , received "success" msg facebook. i have managed several more message exchange between app , facebook server. reached point have received response contains clients jid session. however, after send <iq id="_xmpp_session1" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq> i got no response facebook chat server. anyone knows went wrong? request xml msg correct? thanks! from section 3 of rfc 3921 , correct example is: <iq to='example.com' type='set' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> </iq> make sure you've got to attribute.

ASP.NET Javascript: window.open won't work twice -

i have aspx page button. when user clicks button, following javascript opens new browser window (in case, 'reasons.aspx'). works great. here's function part: function showpanel(url) { var width = 750; var height = 600; var left = (screen.width - width) / 2; var top = (screen.height - height) / 2; var params = 'width=' + width + ', height=' + height; params += ', top=' + top + ', left=' + left; params += ', toolbar=no'; params += ', menubar=no'; params += ', resizable=yes'; params += ', directories=no'; params += ', scrollbars=no'; params += ', status=no'; params += ', location=no'; newwin = window.open(url + '?letternumber=1&reasontype=3', 'd', params); //<--- change (letternumber) when copying! if (window.focus) { newwin.focus() } return false; } now here's gets funky. when window pops up, there controls. 1 of button, triggers identical c...

iphone - XCODE 4 IOS 4.3.3 glClear(GL_COLOR_BUFFER_BIT) EXC_BAD_ACCESS -

i working on game multiple levels. initial level runs fine not matter if start level 1 or level 2. within code next level loaded based off user's score. using game state manager dealloc initial level , load next level. in ios 4.2 code runs without error. however, in ios 4.3.3 exc_bad_access error when glclear(gl_color_buffer_bit) line called in rendder method of next level. i not have zombies analyze not return changes i not see memory leaks in instruments other posts suggested put glbindbuffer(gl_array_buffer, 0) , glbindbuffer(gl_element_array_buffer, 0) @ end of render method, same exc_bad_access error. sure access bad memory, opengl calls need made load new level w/o error? render method same both levels: //clear left on last frame, , set background color. glclearcolor(0xff/256.0f, 0x66/256.0f, 0x00/256.0f, 1.0f); glclear(gl_color_buffer_bit); [tileworld draw]; [super renderendgame]; //you nice boring white screen if forget swap buffers. [self swapbuffe...