Posts

Showing posts from February, 2014

In ASP.NET MVC, how do I display a property name as a label splitting on CamelCase -

i know have seen before. can't remember if c4mvc template demo or input builder thing! need know how can use convention of camelcasing view model properties , having "camelcasedproperty" rendered in label "camel cased property". should handled create new view wizard rather programatically handling this. i don't think want possible in vanilla asp.net mvc 2. in asp.net mvc 2 need decorate model displayname attribute text want , auto generated wizard use labelfor output label property. eg: class mymodel() { [displayname("your property name")] public string yourpropertyname { get; set; } } then in view: <%= html.labelfor(m => m.yourpropertyname) %> if saw demo of being done other way have been mvccontrib project inputbuilders . here direct link part of project think referring to: http://www.lostechies.com/blogs/hex/archive/2009/06/09/opinionated-input-builders-for-asp-net-mvc-part-2-html-layout-for-the-la...

Concatenate HTML tables with PHP DOMDocument -

i have whole bunch of large html documents tables of data inside , i'm looking write script can process html file, isolate tags , contents, concatenate rows within tables 1 large data table. loop through rows , columns of new large table. after research i've started trying out php's domdocument class parse html wanted know, best way this? this i've got far... $dom = new domdocument(); $dom->preservewhitespace = false; @$dom->loadhtmlfile('exrate.html'); $tables = $dom->getelementsbytagname('table'); how chop out other tables , contents? i'd remove first table since it's table of contents. loop through table rows , build them 1 large table. anyone got hints on how this? i've been digging through docs domdocument on php.net i'm finding syntax pretty baffling! cheers, b edit: here sample of html file data tables i'd join http://thenetzone.co.uk/exrates/exrate.html ok got sorted phpquery , lots of tria...

how to run vibrate continuously in iphone? -

in application i'm using following coding pattern vibrate iphone device include: audiotoolbox framework header file: #import "audiotoolbox/audioservices.h" code: audioservicesplaysystemsound(ksystemsoundid_vibrate); my problem when run application gets vibrate second want vibrate continuously until stop it. how possible? there numerous examples show how private coretelephony call: _ctserverconnectionsetvibratorstate , it's not sensible course of action since app will rejected abusing vibrate feature that. don't it.

iphone - SIGABRT error when running on iPad -

all. i've been banging head few hours because of problem. have universal project that's mix of iphone , ipad projects. put these codebases universal project and, after lot of " #if __iphone_os_version_min_required >= 30200 " checks, got project run in both iphone (os 3.0 3.1.3) , ipad simulators. after doing more finagling project settings of external libraries load, got app load on iphone (which runs os 3.1.3). however, when run app on ipad, immediate sigabrt error. i've tried running under debug , under release , active architecture of both armv6 , armv7. i've checked , double-checked app has right nib files set (but, again, app runs fine in simulator). i've gone through external libraries i'm using , set them have same base sdk (3.2), same architectures (optimized (armv6 armv7)), same targeted device family (iphone/ipad), , same iphone os deployment target (iphone os 3.0). so, summarize... have universal app works in simulator iphone...

c# - Create custom print port in .NET -

i trying figure out if possible create custom print port in .net. functionality trying achieve intercept data generated printer driver , send remote server instead of device. not really. either creating virtual port driver or network redirector requires native code. however... you capture data installing network print port , implementing server side in .net. example, lpr require create tcp socket server, , that's feasible in c#. i don't know of existing c# implementation, learn lot source code of p910nd .

configuration - CakePHP: What to use for MySQL users & permissions? -

i'm getting ready deploy cakephp site first time. i'm using site mysql database, , i'm still little unclear proper use of users & permissions mysql -- i'm talking "login" , "password" fields appear in app/config/database.php. during development, i've been using 'root' , 'root' -- i'm pretty sure can't idea. question is: best practices assigning mysql user cakephp app, , mysql privileges should assigned it? the least amount of permissions possible, insert, select, update, , delete on database in question, not create/drop privileges. best practice: make password hard guess. you're hardcoding anyways, there's no reason not make terrible monster of password. also, ensure can accessed localhost or ip. grant insert, select, delete, update on mydb.* 'myuser'@'localhost' identified 'monsterpassword'

animation - ActionScript - Screen Wrapping A Gradient Line? -

i have straight, gradient line extends 1 end of screen other. what best (or only) approach screen wrapping line graphic, appears moving? my current " solution " draw horizontal line @ double width of screen , duplicate gradient pattern each half of line. line center-registered , it's moved toward right. once half of line traverses stage, line reset it's starting point. is there better way? well, alternative can think of using drawing api draw gradient stroke, calculating offset in each frame. more costly applying positional transform on display object. tiny bit of arithmetic alone should enough make slower. your proposed solution may not seem elegant , or efficient running in vm highly optimized drawing , transforming occluded vectors , bitmaps (and undependable on every other optimization) think best bet trust vm @ point. :)

PHP uploads file - enctype="multipart/form-data" issue -

i have upload code. there no problem running individually, when try add other codes, did not $_files parameter. im guessing becoz of enctype="multipart/form-data" in form tag, based on post: why file upload didn't work without enctype? the enctype needed. problem is, how can upload files without concern this? can juz change code structure compatible other codes? if($_post['check']){ $faillampiran=$_post['faillampiran']; $file=$_files['faillampiran']["name"]; $filesize = $_files['faillampiran']['size']; $filetype = $_files['faillampiran']['type']; if ($_files["faillampiran"]["error"] > 0 ) { echo "return code: " . $_files["faillampiran"]["error"] . "<br />"; } else { move_uploaded_file($_files["faillampiran"]["tmp_name"],"upload/" . $_files[...

java - Why invoke Thread.currentThread.interrupt() in a catch InterruptException block? -

why invoke method thread.currentthread.interrupt() in catch block? this done keep state . when catch interruptexception , swallow it, prevent higher level methods/thread groups noticing interrupt. may cause problems. by calling thread.currentthread().interrupt() , set interrupt flag of thread, higher level interrupt handlers notice , can handle appropriately. java concurrency in practice discusses in more detail in chapter 7.1.3: responding interruption . rule is: only code implements thread's interruption policy may swallow interruption request. general-purpose task , library code should never swallow interruption requests.

php - Facebook Login Button Not Clickable -

i tinkering facebook login button , while easy put button on page, when click it, nothing. has had experience? i had code: <div id="fb-root"></div><script src="http://connect.facebook.net/en_us/all.js#appid=myrealid&amp;xfbml=1"> </script><fb:login-button show-faces="false" width="200" max-rows="1"></fb:login-button> did need extra? you can see button being rendered here: http://www.comehike.com but when click it, nothing. :( the javascript console shows me following message: fb.login() called before calling fb.init(). so should call fb.init() after button has been loaded.

iphone - Navigating with a UITableView and a detail view -

i sure straight forward application, not sure best way (and new). have navigation controller uitableviewcontroller (all running in uitabviewcontroller). when user taps row app goes detailed view. trying link left , right swipe gestures navigating previous , next record. right way within detailed view, easiest link tableviewcontroller? a related question how link 'pull down' same action 'back' button of navigation controller. i hope above makes sense. million in advance! i have working kind-of in way like, clumsy. when calling detailview pass parameter pointer 'self' , current 'selectedrow'. when swipe made call function 'movetonextrecord' on tabelviewcontroller (with pointer provided) , have selectedrow parameter. in tableviewcontroller call selectrowatindexpath , didselectrowatindexpath. -(void)movetonextrecord:(nsindexpath*) selectedrow{ //[self.navigationcontroller popviewcontrolleranimated:yes]; //nsindexpath *selected...

Bind DropDownList with Hierarchy from SQL Server Table with ASP.NET -

i have following sql table contains menu (website menu) data. table name: menuitems columns: id, menuid, parentmenuitemid, text. my goal bind ddl according following hierarchy (example): id: 1, menuid: 1, parentmenuitemid: -1, text: 'one' id: 2, menuid: 1, parentmenuitemid: 1, text: 'two' id: 3, menuid: 1, parentmenuitemid: 1, text: 'three' id: 4, menuid: 1, parentmenuitemid: 2, text: 'four' id: 5, menuid: 1, parentmenuitemid: 4, text: 'five' requested result in ddl: one -- 2 ---- 4 ------ 5 -- 3 i think should contain with sql command. note: i'm using c#. i didn't issue. facing problem in traversing hierarchy using sql command or issue show hierarchy in dropdown??? if first case there many stored procedures available traverse hierarchies , if second case: i don't think normal dropdown can show multilevel hierarchy in it.. can support 2 level hierarchy(called grouping).. better ...

c - Understanding Reverse Polish Notation, for homework assignment? -

i have been asked write simple reverse polish notation calculator in c part of homework assignment. i'm having difficulty understanding rpn. can please me understand reverse polish notation? also, tips on how approach problem appreciated. reverse polish notation specific way of writing expressions first write values, operation want perform. instance, add numbers 3 , 4 you'd write 3 4 + . so write rpn calculator you'll need a means of accepting input, such console a means of tokenizing input (for you're doing, breaking on whitespace sufficient) a stack storing values (operands) (such 3 , 4 in above) a dictionary of operations then loop becomes, in essence: while (there's token available) { token = get_the_token if (token known operator) { number of values stack operation requires (usually two); fail if stack doesn't have enough perform operation on values push result on stack } else if (token ...

ajax - session timeout weirdness -

i have main site people log-in. iis , standard session time out of 20 minutes. there live chat facility appears in popup window in same domain. there's no https involved. despite fact chat window makes ajax calls server every few seconds (and @ least 1 piece of data back) sends data server via ajax whenever logged-in user posts message timed out after 20 minutes if nothing happening. any ideas why should happen , how stop it's irrational logged out f site while actively communicating server. what i've decided use cookie rather site's session variable check if they're logged in. chat app, hour when first open chat page. , every time post message gets reset hour later. that way posters stay logged in , lurkers bumped off. on load: response.cookies("chatuser")=nickname response.cookies("chatuser").expires=now()+0.5 on post message: response.cookies("chatuser").expires=now()+0.5

c# - Conditional image path using Eval -

i have 2 images progress.png , completed.png. depending on status in db table (in progress of complete), want display appropriate image. correct syntax iif() statement within asp.net? help. pseudocode: <asp:image imageurl='<%# iif(eval("status").equals("in progress") display - 'images/progress.png') else if status equals "complete" display - 'images/complete.png' %>' /> i know not answer question regarding iif syntax, solve problem regarding displaying image. i rather use this: <asp:image imageurl='<%# getstatusimage(eval("status").tostring()) %>' /> and write following method in code-behind. public string getstatusimage(string status) { switch(status) case "in progress": return "images/progress.png"; break; case "complete": return "images/complete.png"; break; ...

iphone - UITextField event handling -

is possible detect @ text position user tabs uitextfield (just tabbing not editing, text field read-only)? e.g. capturing touches began event , processing tabbed position? yes, set delegate uitextfield , can tell user doing in text field. see uitextfield class reference details. edit: ok, since it's readonly text field, should subclass uitextfield , override begintrackingwithtouch:withevent: , endtrackingwithtouch:withevent: can see touch down , touch occurred withing uicontrol (uitextfield uicontrol). methods called uitouch object tells touch occurred within uicontrol (uitextfield). i don't know why want this. anyway there you'll have figure out in text touch occurred given touch x,y offset in control. that'll fun task solve.

shuffle - Shuffling words in a sentence in javascript (coding horror - How to improve?) -

i'm trying simple, code looks terrible , there better way things in javascript. new javascript, , trying improve coding. feels messy. all want randomly change order words on web page. in python, code this: s = 'this sentence' shuffledsentence = random.shuffle(s.split(' ')).join(' ') however, monstrosity i've managed produce in javascript //need custom sorting function because javascript doesn't have shuffle? function mysort(a,b) { return a.sortvalue - b.sortvalue; } function scramblewords() { var content = $.trim($(this).contents().text()); splitcontent = content.split(' '); //need create temporary array of objects make sorting easier var temparray = new array(splitcontent.length); (var = 0; < splitcontent.length; i++) { //create object can assigned random number sorting var tmpobj = new object(); tmpobj.sortvalue = math.random(); tmpobj.string = splitcontent[i]; ...

java - how to define the Path of an audio file -

hi new java programmer. trying create media player of own, have written coding dont know define path of file played. pls me in defining path of audio file played in java program configured in eclipse string path = "c:\\somefolder\\song.mp3"; if looking more please clarify question.

solr - Exception in adding document in SolrJ -

i building java application using solrj. when add document single record, program runs fine. when use collection, @ server.add(docs) following exception: " exception in thread "main" org.apache.solr.common.solrexception: bad request bad request request: http://localhost:8080/solr/update?wt=javabin&version=1 " when debug program, see documents added collection docs object. let me know clarify something. regards, ankit agarwal check schema xml , ensure dont add field not declared in schema file. check whether "id" field available every document , declared in schema.

Biztalk - how do I set up MSMQ load balancing and high availability? -

from understand, in order achieve msmq load-balancing, 1 must use technology such nlb. and in order achieve msmq high-availability, 1 must cluster related biztalk host (and hence underlying servers have in cluster themselves). yet, according microsoft documentation, nlb , failover clustering technologies not compatible. see link reference: http://support.microsoft.com/kb/235305 can please explain me how msmq load-balancing , high-availability can achieved? thank in advance, m i've edited original answer because on reflection, think talking nonsense. i don't believe possible achieve both load balancing , high availability in biztalk transactional scenario. have @ section "migration considerations moving msmq/t msmq adapter in biztalk 2006" on following site http://blogs.msdn.com/eldarm/ to summarise post, there couple of scenarios: high availability (non-transactional) you have msmq on more 1 biztalk server behind nlb high availability...

java - How to see if an object is an array without using reflection? -

how can see in java if object array without using reflection? , how can iterate through items without using reflection? i use google gwt not allowed use reflection :( i love implement following methods without using refelection: private boolean isarray(final object obj) { //??.. } private string tostring(final object arrayobject) { //??.. } btw: neither want use javascript such can use in non-gwt environments. you can use class.isarray() public static boolean isarray(object obj) { return obj!=null && obj.getclass().isarray(); } this works both object , primitive type arrays. for tostring take @ arrays.tostring . you'll have check array type , call appropriate tostring method.

Database size reports differently than the sum of all the tables in SQL Server -

i trying determine if sql server database healthy. i ran couple of commands check size , shocked @ differences reported between sum of table sizes , database size. i wondering why there large size difference. exec sp_spaceused @updateusage = n'true'; database_name | database_size | unallocated space fleetequip |1357.00 mb |0.20 mb and exec sp_msforeachtable @command1="exec sp_spaceused '?'" (way formatting include tables - html table nice) name | rows | reserved(kb) | data(kb) | index_size(kb) | unused(kb) equipmentstate | 131921 | 40648 | 40608 | 8 | 32 the sum of tables comes 45768 kb you can @ definition of sp_spaceused exec sp_helptext 'sp_spaceused' though prefer result format returned following actually: select object_definition(object_id('sp_spaceused')) [processing-instruction(x)] xml path can try below (based on aggregate query contains) , see discrepancy...

sorting - How do I display a Wicket Datatable, sorted by a specific column by default? -

i have question regarding wicket's datatable. using datatable display few columns of data. my table set follows: datatable<column> datatable = new datatable<column>("columnstable", columns, provider, maxrowsperpage) { @override protected item<column> newrowitem(string id, int index, imodel<column> model) { return new oddevenitem<column>(id, index, model); } }; the columns so: columns[0] = new propertycolumn<column>(new model<string>("description"), "description", "description"); columns[1] = new propertycolumn<column>(new model<string>("logic"), "columnlogic"); columns[2] = new propertycolumn<column>(new model<string>("type"), "datatype", "datatype"); here column data provider: public class columnsortabledataprovider extends sortabledataprovider<c...

sqlite - Can I add data from different tables of the same database into each row of a ListView in Android? -

can add data different tables of same database each row of listview in android? i have vendor app , want add data 1 standard items list table , 1 daily table list view. if both tables have same row format (or @ least you're selecting same type of rows both tables), can combine them single query union. see sqlite select query documentation more info on unions.

perl - How do I install Encode::HanExtra for ActivePerl? -

i want enable encode::hanextra on windows xp environment. can't find name hanextra or encode-hanextra in ppm gui. there alias name it? encode-hanextra exist according this page there no windows build. options: encode::cnmap can convert between many different chinese encodings (gb2312, big5, utf8, gbk). activeperl name encode-cnmap. there activeperl version of encode::cn::utility can convert characters between hanzi, gbk , unicode/utf-8. activeperl name encode-cn-utility. you install strawberry perl instead of activeperl. community distribution of perl windows uses cpan, module on cpan can installed (except platform-dependent modules). after installing run cpan encode::hanextra . you build own ppm version of encode::hanextra (not recommended)

python - Creating a pygtk text field that only accepts number -

does know how create text field using pygtk accepts number. using glade build ui. cheers, i wouldn't know way simple switching settings, guess need handle via signals, 1 way connect changed signal , filter out that's not number. simple approach(untested should work): class numberentry(gtk.entry): def __init__(self): gtk.entry.__init__(self) self.connect('changed', self.on_changed) def on_changed(self, *args): text = self.get_text().strip() self.set_text(''.join([i in text if in '0123456789'])) if want formatted numbers of course go more fancy regex or else, determine characters should stay inside entry. edit since may not want create entry in python i'm going show simple way "numbify" existing one. def numbify(widget): def filter_numbers(entry, *args): text = entry.get_text().strip() entry.set_text(''.join([i in text if in '01...

Connect Linqpad to Entity Framework without using Odata -

i'm weak on fundamentals here, feel free let me know if i'm making bizarre/false assumptions: i'm working on project wcf data services , due limitations of odata querying language (e.g. no select distinct, joins difficult, etc.), we're going expose service operations common & non-trivial queries. so, using linqpad linq code correct, , i'd use linqpad target entity framework directly (this important: not through odata). there way can target ef directly? have on same machine? process? thanks!!! you can target ef directly if can point linqpad assembly containing typed objectcontext created in visual studio. click add connection , choose entity framework in bottom listbox.

html - Images not rendering in Chrome/Webkit -

Image
i'm building webpage bunch of images coming rackspace cloudfiles on limelight cdn. page finish loading, including images, , chrome/webkit fail render images @ all. chrome doesn't render "broken image" in place, , if check resources tab in inspector, listed , data loaded up. non-rendered images show same info rendered ones. this occurs when go forward page , go (via history). persists if reload page, unless hard refresh (⌘⇧r in chrome), show normal again. i'm not loading images in javascript or strange that, nor have css hides images. happens in chrome, , doesn't happen in incognito mode can tell. any ideas what's causing this? if it's bug, how go reporting chrome team? update i checked headers in network tab of inspector , turns out images rendered, chrome showing it's header metadata, this: and images don't render properly, metadata shown along full request , response headers 304 not modified status. this still happen...

haskell - How do you install GHC into Cygwin or point Cygwin to GHC? -

i attempted point cygwin installer http://haskell.org/ghc/cygwin , installer unable find setup.ini.sig. if possible, how alternatively edit .bashrc reference installation made using setup binaries in c:/ghc/. when installed windows version of ghc, added binaries location path environment variable, able run cygwin's bash fine. i've never attempted install or compile ghc on cygwin itself.

c - Copying one structure to another -

i know can copy structure member member, instead of can memcpy on structures? is advisable so? in structure, have string member have copy structure having same member. how do that? copying plain assignment best, since it's shorter, easier read, , has higher level of abstraction. instead of saying (to human reader of code) "copy these bits here there", , requiring reader think size argument copy, you're doing plain assignment ("copy value here here"). there can no hesitation whether or not size correct. also, if structure heavily padded, assignment might make compiler emit more efficient, since doesn't have copy padding (and knows is), mempcy() doesn't copy exact number of bytes tell copy. if string actual array, i.e.: struct { char string[32]; size_t len; } a, b; strcpy(a.string, "hello"); a.len = strlen(a.string); then can still use plain assignment: b = a; to complete copy. variable-length data modelled...

jQuery UI combobox Ajax options -

i need customize combobox widget build jquery ui autocomplete http://jqueryui.com/demos/autocomplete/#combobox currently drop down options predefined select tag options or json array. //getter var source = $( ".selector" ).autocomplete( "option", "source" ); //setter $( ".selector" ).autocomplete( "option", "source", ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] ); i want populate combobox options ajax url, how can customize widget? there demo on how via ajax , should make sure array json encoded before returned autocomplete component. if you're using php, take @ json_encode function. does answer question?

drupal : content type CCK - add an existing field disappeared? -

i installed drupal scratch , i'm installing additional modules according needs. the biggest problem have if go in admin/content/node-type/nodetypename/fields (the page can edit/add/delete cck fields) can't re-use defined fields option add existing fields disappeared (probably it's module don't know about) have new field , new group ..in other installation have existing field option can reuse defined fields... am missing something? my cck module page looks this: cck activado nombre versión descripción content 6.x-2.8 permitir los administradores definir nuevos tipos de contenidos. requerido por: content copy (desactivado), content permissions (activado), content taxonomy (activado), content taxonomy autocomplete (activado), content taxonomy options (activado), content taxonomy tree (desactivado), date (activado), date tools (desactivado), email (activado), fieldgroup (activado), filefield (activado), cck translation (activado), imagefield (activado)...

Xul's window.blur() doesn't work? Is there an alternative? -

i'm trying use window.blur() open window without focus (or focus , unfocus fast, looks not focused). but looks doesn't work, there alternative? my attempt: blurtest.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window width="400" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script> <![cdata[ function onkeypress(event) { // sample don't matter key pressed open('second.xul','secondwindow','chrome, width=400, height=300'); } addeventlistener("keypress", onkeypress, false); ]]> </script> <label value="main window"/> </window> second.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin...

c# - multicheck combobox with lost focus when select item :/ -

i try use example http://www.codeproject.com/kb/combobox/checkcombobox.aspx create multicheck combobox. right, when user select item in dropdown list close , need time click on , select next item. it possible when fires onclick , dropdown show t don't hide unless mouse lost focus on combobox ? in comments on page linked to, posted (august 2007) exact question - , else responded alternative implementation solution: http://www.codeproject.com/kb/combobox/checkedcombobox.aspx

qt creator - Using OpenCV in QTCreator (linking problem) -

i have problem linking simpliest test program in qtcreator: code: #include <qtcore/qcoreapplication> #include <cv.h> #include <highgui.h> #include <cxcore.hpp> using namespace cv; int _tmain(int argc, _tchar* argv[]) { cv::mat m(7,7,cv_32fc2,scalar(1,3)); return 0; } .pro file: qt -= gui target = testopencv config += console config -= app_bundle includepath += c:/opencv2_1/include/opencv template = app libs += c:/opencv2_1/lib/cxcore210d.lib \ c:/opencv2_1/lib/cv210d.lib \ c:/opencv2_1/lib/highgui210d.lib\ c:/opencv2_1/lib/cvaux210d.lib sources += main.cpp i've tried use -l , -l libs += -lc:/opencv2_1/lib -lcxcored and in .pro file: qmake_libdir += c:/opencv2_1/lib/debug libs += -lcxcore210d \ -lcv210d \ -lhighgui210d the errors like: debug/main.o:c:\griskin\test\app\testopencv/../../../../opencv2_1/include/opencv/cxcore.hpp:97: undefined reference cv::format(char const*, ...)' could me? th...

How to get Date and current time from the Date/Time column in SharePoint Custom list -

i have column called "date submitted" date/time in 1 of custom list in sharepoint 2007. set today's date , 12am time instead of want display today's date current time hh:mm:ss. i tried creating calculated column testdate , formula : =text(([date submitted]),"mm dd yyyy h:mm:ss") result 04 28 2010 0:00:00 wanted 04/28/2010 10:50:34 is possible achive this? thank kanta try put =now() in default value field in column properties

java - KSoap2 + Android + .net Ws = Null -

i'm having issues using ksoap2 in android project while conecting .net webservice. long call ws witouth parameters works fine, when try add parameters, servers never gets them. here's code import java.util.vector; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.propertyinfo; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapprimitive; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.androidhttptransport; import android.app.activity; import android.os.bundle; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class servicioweb extends activity { soapobject response; public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // string namespace = "http://tempuri.org/"; string namespace = "idbn.ws"; string me...

windows - Java process is not terminating after starting an external process -

on windows i've started program "async.cmd" processbuilder this: processbuilder processbuilder = new processbuilder( "async.cmd" ); processbuilder.redirecterrorstream( true ); processbuilder.start(); then read output of process in separate thread this: byte[] buffer = new byte[ 8192 ]; while( !interrupted() ) { int available = m_inputstream.available(); if( available == 0 ) { thread.sleep( 100 ); continue; } int len = math.min( buffer.length, available ); len = m_inputstream.read( buffer, 0, len ); if( len == -1 ) { throw new cx_internalerror(); } string outstring = new string( buffer, 0, len ); m_output.append( outstring ); } now happened content of file "async.cmd" this: rem start command window start cmd /k the process started extenal program terminated ( process.waitfor() returned exit value). sent readerthread.interrupt() reader thread , thread terminated, too. but ...

java - How to encrypt/decrypt multiple strings in AES encryption? -

i know if encrypt 2 or more strings in aes encryption. let's say, want encrypt username, password , nonce_value. can use following code? try { string codeword = username, password, nonceinstring; string encrypteddata = aseencryptdecrypt.encrypt(codeword); string decrypteddata = aseencryptdecrypt.decrypt(encrypteddata); system.out.println("encrypted : " + encrypteddata); system.out.println("decrypted : " + decrypteddata); } catch (throwable e) { e.printstacktrace(); } well work? why not try code , see? in theory can put multiple pieces of data 1 string , encrypt string, though you'd want better way of putting data together. current code, commas between username, password, , nonceinstring won't compile, if can prevent, instance, colon existing in of strings, like: string codeword = username+":"+password+":"+nonceinstring; and when decode split on colon.

javascript - How to Extract/Retrieve source code given URL in Firefox extention -

i'm writing firefox extension analyze / parse linked pages while user still on current page. know there ways retrieve source code page being viewed, linked pages? if i'm able obtain url of linking page, able retrieve source code of url? my extension written in xul , javascript, code or sample add-ons me lot! maybe following javascript snippet you: var req = new xmlhttprequest(); req.open("get", linkedpageurl, false); req.send(null); dosomethingwithgivensource(req.responsetext); this works synchronously. after req.send(null) executed, req.responsetext contains page source code. recommended avoid synchronous network actions better approach use asynchronous request , add callback load event: var req = new xmlhttprequest(); req.open("get", linkedpageurl, true); req.addeventlistener("load", function() { dosomethingwithgivensource(req.responsetext); }, false); req.send(null);

jquery - showing post description fading in on hover -

right have following code set up: $(function() { $('.thumbnail').mouseenter(function() { $('.thumbnail').fadeout(200, function() { $('.description').fadein(200); }); }); $('.description').mouseleave(function() { $('.description').fadeout(200, function() { $('.thumbnail').fadein(200); }); }); }); with html: <div class="thumbnail"> <img src="image.jpg" /> </div> <div class="description"> <p>content here</p> </div> it works i'd thumbnail fade black background thumbnail image still shows slightly. right now, background shows white when hover on it. how can go doing this? also, there better way write code, perhaps using other mouseenter? i'm still beginner jquery it's new me. something ideal: http://www.brandingdirection.co.uk/ -- edited tidy --- final code...

mysql - Modifing select query to delete query -

the following select query works fine: select * jbpm_job job job.action_ in (select id_ jbpm_action actionexpression_ '%#{reminderaction.addasyncprocessreminder%warning%'); however, when try delete rows retrieved here, fails delete jbpm_job job job.action_ in (select id_ jbpm_action actionexpression_ '%#{reminderaction.addasyncprocessreminder%warning%'); what wrong here? the error message is: error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'job job.action_ in (select id_ jbpm_action actionexpression_ li' @ line 1 you need specify deleting alias table, use: delete job jbpm_job job job.action_ in (select id_ jbpm_action actionexpression_ '%#{reminderaction.addasyncprocessreminder%warning%');

c# - Focus is not set in UserControl WPF -

i cannot able set focus on user control item using datagrid in user control want set focus on first row of datagrid i found following code int index = 0; dgaccountinfo.selecteditem = winaccountinfogrid.dgaccountinfo.items[index]; dgaccountinfo.scrollintoview(winaccountinfogrid.dgaccountinfo.items[index]); datagridrow dgrow = (datagridrow)dgaccountinfo.itemcontainergenerator.containerfromindex(index); if (dgrow != null) { dgaccountinfo.movefocus(new traversalrequest(focusnavigationdirection.next)) }; by running above code found containerfromindex method returns null to rid of null problem found following link http://social.msdn.microsoft.com/forums/en-us/wpf/thread/ab95dd62-995f-481a-a765-d5efff1d559c/ i come out of null problem using above link still focus not set on data grid thanks reading question it appears that, in code you're using, data binding else, unnecessary if wanting set focus first item. if intention set focus (selected index) of data...

iphone - Why are my arrays showing up as empty, even after I've added values to them? -

i parsing xml nsxmlparser , have nsmutablearrays (instance variables) in app. when parse xml file, build objects values of xml elements, , set array objects. in moment set array objects can see values of them. once have finished parsing xml want retrieve values , array empty. here part of code: //sthelpviewcontroller.h #import <uikit/uikit.h> @class softokeniphoneappdelegate, faq; @interface sthelpviewcontroller : uiviewcontroller { uiview *viewanswer; uinavigationbar *answertitle; uibutton *answerdescription; nsarray *answersarray; nsmutablearray *faqs; //this array problem nsmutablestring *currentelementvalue; faq *afaq; nsstring* answer1; nsstring* answer2; nsstring* answer3; nsstring* answer4; } @property (nonatomic, retain) iboutlet uiview *viewanswer; @property (nonatomic, retain) iboutlet uinavigationbar *answertitle; @property (nonatomic, retain) iboutlet uibutton *answerdescription; @property (nonatomic...

datadude - Is it possible to run Visual Studio Database Edition schema migrations from the command line? -

visual studio 2008 database edition (data dude) has ability perform schema comparisons between databases , generate script migrates 1 database other. possible perform comparison , generate migration script command line? if so, command line tools, , same tools used in equivalent versions of visual studio 2010? this vsdbcmd tool reference might answer problem.

iphone - App is fast on 3GS but slow on 3G -

i'm new computer coding , have finished coding app , tested on both 3g , 3gs. on 3gs, worked normal on simulator. however, when tried run on 3g, app becomes extremely slow. i'm not sure what's reason , hope shed light on me. generally, app has couple of view controller classes, 1 of them being title page, 1 being main page, 1 setting, etc. used dissolve transition title page main page. simple transition shows un-smooth performance on 3g! other part of app involves zooming in images scaling images, switching images push or dissolve upon receiving touch events, saving photos photo library , storing , retrieving photos in folder , data in sqlite database, each showing un-smooth actions. compared heavy graphic or heavy maths app, think mine pretty simple. totally have no clue why app behave slow , un-smooth barely useful on 3g. help/ direction appreciated. helping out. you might want try profiling application shark find out performance bottlenecks are...

What should I check to know if I can send emails from my webapp? -

i know how can send emails web app have hosted in shared server. first of know if can, question is: should check? i heard should have mail server in hosting, tried telnet smtp.tirengarfio.com 465 , get: telnet: not resolve smtp.tirengarfio.com/465: name or service not known tirengarfio.com domain webapp hosted. what can do? you need review hosting specifications or consult hosting support whether smtp server included in hosting package. if provided, you'll know needed hostname , port. if none provided, you'll need grab 1 or install custom one. can make use of mail server of isp or public mailboxes yahoo/gmail/etc, you're restricted sending mails own account (thus account appears in from header). hostname/port specified in documentation/faq of isp/mailprovider in question. username/password of course same own account name/password on there. if rather want have full control on mail server, you'll need install own mail server, example apache jame...

php - How to do authentication using SOAP? -

how authenticate users soap? will have require user send username , password every soap request , authenticate him against database? doesn't seem cause unnecessary queries? an easier way authenticate on first query, build session record on server side containing remote ip address , token give client authtoken. have client pass authtoken in future queries. authtoken has match internal session data keep client, allow avoid having make round-trips database authentication. that said, @marcus adams has point below regard stateless-ness. there people out there pushing sorts of soap security models . ws-security current state of art, here. work putting authentication information in soap header - after all, that's why soap message contains both header , bodypart.

c++ - Why an unnamed namespace is a "superior" alternative to static? -

this question has answer here: superiority of unnamed namespace on static? 3 answers the section $7.3.1.1/2 c++ standard reads: the use of static keyword deprecated when declaring objects in namespace scope; unnamed-namespace provides a superior alternative. i don't understand why unnamed namespace considered superior alternative? rationale? i've known long time standard says, i've never thought it, when replying question: superiority of unnamed namespace on static? is considered superior because can applied user-defined types well, described in answer ? or there other reason well, i'm unaware of? i'm asking this, particularly because reasoning in answer, while standard might have else in mind. as you've mentioned, namespace works anything, not functions , objects. as greg has pointed out, static means many things a...

How do I connect my OSX Cocoa Application with facebook? -

i know can connect ios app facebook using facebook connect, library provided facebook easy access facebook services. can explain me how can connect osx cocoa application facebook? don't , can find how create apps inside facebook want access facebook show new facebook friends in application. is there library or documented way on how this? thank much twickl i think there isn't library osx apps (at least, not official one). can use graph api grab content facebook. if decide go way, think need script in order get access token , have access content inside friends profiles.

Applying jQuery UI CSS to MVC .input-validation-error -

i writing asp.net mvc app. @ client side validation part. found when ui flashes error, uses class .input-validation-error. what have in order make class same jquery ui uses alert css. if go http://jqueryui.com/themeroller/ , @ lower right you'll see alert box. correct way use styling input validation error class? i new mvc not sure how go this what put line of code in partial view , pass message or view model partial view. <div id="error-effect" class="ui-widget"> <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> <div style="margin-top:12px;"> <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> <strong>error:</strong> "your message goes here" </p> </div> </div> </div> if have imported jquery classes correctly, should d...

java - Problem with linking to other project in Android Eclipse environment -

i developing android application eclipse project uses classes eclipse android project have. when imported ( new project > android project > existing source ), had bunch of errors, when did project > properties > java build path , went projects tab , added other project, errors went away. unfortunately, when ran application, got following error in ddms: java.lang.noclassdeffounderror: [package name].config [stack trace] is there i'm supposed add manifest telling @ other package? if so, added? thanks in advance found answer. turns out if add compiled class files jar file using eclipse's export command , link external jars in java build path, works without having change android manifest @ all.

c++ - The Game vs The Game Engine? -

i wondering if tell me how game , game engine fit game development. mean is, game engine not have game. i'm unclear basically, game developpers build engine, create new class inherits engine becomes game? ex: class shootergame : public engine { }; so i'm unclear on game code fits engine. the distinction between game , actual game engine architectural. game logic specific 1 game whereas game engine can reused. operating system provides utilities applications game engine same game code. game engines typically have different apis for: loading multimedia data audio, textures, 3d models providing game loop , firing off various events caused users input networking graphics rendering , various techniques make game nice using lighting, particle effects or bump mapping audio artificial intelligence an api allow defining game rules, game play, , game logic most game developers not write own game engine. work. instead they'll reuse game engine company ...

html - Performance differences between iframe hiding methods? -

is there major performance difference between following: <iframe style="visibility:hidden" /> <iframe style="width:0px; height:0px; border:0px" /> i'm using hidden iframe pull down , parse information external server. if iframe attempts render page, may suck lot of cpu cycles. of course, i'd ideally want raw markup - example, if prevent iframe loading img tags, perfect. i think either way iframe going load it's contents. can simple test hiding , showing iframe page takes while load. if iframe (when made visible) shows long loading page, you'll know loaded in before show. if you're using firebug can use @ http requests made. show whether there's http request made iframe. as far performance differences, doubt there's between 2 pieces of html posted. if i'd setting visibility hidden more "efficient" since browser doesn't have wory rendering visually, if 0*0px. still, don't think the...

asp.net - JavaScript into Asp Page -

i learning javascript client side scripting language , using js in asp.. dont know when compile code, shows compilation error:compiler error message: cs1061: 'asp.default_aspx' not contain definition 'popup' , no extension method 'popup' accepting first argument of type 'asp.default_aspx' found (are missing using directive or assembly reference?) here code : <%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="web_test_app._default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>shuraat web ki</title> <script type ="text/javascript"> function popup() { alert("popup!!"); } ...

Locking semaphores in C problem sys/sem -

edit: peace of code pretty fine (so take example of semaphores ;). bug in program in place - found friend. i have problem functions. 2 processes enter critical section. can't find problem in after spent 10 hours debugging. on should aim? there possibility have bud in piece of code? // lock semaphore static int p(int sem_id) { struct sembuf sem_b; sem_b.sem_num = 0; sem_b.sem_op = -1; /* p() */ sem_b.sem_flg = 0; if (semop(sem_id, &sem_b, 1) == -1) { // error return(0); } return(1); } // unlock semaphore static int v(int sem_id) { struct sembuf sem_b[1]; sem_b.sem_num = 0; sem_b.sem_op = 1; /* v() */ sem_b.sem_flg = 0; if (semop(sem_id, &sem_b, 1) == -1) { // error return(0); } return(1); } static int set_semval(int sem_id) { // set 1 (opened semaphore) ...

jquery - how to parse a string in javascript and capture all text before the last <br> -

i have text in javascript this: this text<br>this second line of text and want have function return this text so find last <br> in text , give me before it. if text simple, .split() on <br> var str = "this text<br>this second line of text" var result = str.split('<br>')[0]; if more complex, may worthwhile use browser's built in html parser, can operate on them dom nodes. in case, this: var div, result, str = "this text<br>this second line of text"; (div = document.createelement('div')).innerhtml = str; var result = div.firstchild.data; ...or perhaps little simpler jquery: var str = "this text<br>this second line of text" var result = $('<div>',{html:str}).contents().first().text();

Use Javascript to make Image visible when page opens -

i'm looking javascript fire when page opens , sets image1 visibility true. thanks if referencing css visibility property: window.onload = function() { document.getelementbyid( 'image1' ).style.visibility = "visible";` }; or display property: window.onload = function() { document.getelementbyid( 'image1' ).style.display = "block"; };

.net - WCF Proxy Submit Crash - Kills Process -

i have simple wcf service accept data (wshttpbiding) , returns result. on client side dll containing proxy wrapper loaded , used build/submit request service. this works in majority of cases, few users, submit call client proxy results in immediate crash of application (no errors, warnings, etc - process dies instantly) the issue appears related users windows account: different users logged same machine not experience issue. looking thoughts on might start looking culprit. ideas out there? edit : i'm trying version trace statements , error logging in out affected machines @ moment. there no try/catch around .submit call, shouldn't exceptions propogate through call stack (the client/proxy dll being loaded directly primary app domain other exceptions such timeouts handed host application expected) web.config on server side below the users in same domain other users, default credentials being used. in house app, server on same network. service web.config: ...