Posts

Showing posts from May, 2011

arrays - how to bubble sort through a text file in java -

how bubble sort through text file assigning values array. in code below tried assign values text file string while there still fetch. used loop assign 1 have fetch array. tried use bubble sort sort numbers have fetch highest lowest. 1 output: 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 78 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 29 29 29 29 29 2...

security - What is a good browser level encryption product? -

i'm looking product can provide browser-level encryption of textual data before it's sent backend server. https can secure transport mechanism need packet encrypted on browser first. data packet must end in encrypted form on backend database. use case is: user fills out form on browser, user submits form data, before sending data on wire, browser encrypts data, data ends in backend database in encrypted form, @ point in time, of data collected backend database, moved disconnected computer , decrypted @ point. that's https (ssl/tls) for. should plenty secure enough. but state in answer query, want form data stored in database in encrypted form. quick google search brings jquery.gibberish-aes . it's jquery plugin aes encryption , can utilise rsa public key. using generate public/private key pair, keep private key on super-secret disconnected computer, , publish public key form. can encrypt data, store in database, , if got root access database server...

jquery - How do I add \Huge to an image source in jQue -

http://jsbin.com/owepu3/edit i'm using mimetex generate latex images using cgi script, , want add dynamic size. however, when source file gets generated, drops "\" "\huge". any ideas? \ used escape characters in javascript. try using \\huge instead.

wix - How can I add the installation of .NET 3.5 to Installer on Windows 2008 Server R2 -

i have homemade bootstrapper (call setup.exe) checks whether .net 3.5 installed on target machine, and, if not, launches installation running dotnetfx35.exe. fine. works cases need except windows 2008 server r2. on os, .net installer not install/enable .net 3.5. instead pops dialog indicating 1 must manually enable it. prefer doing automatically within bootstrapper exe or within main msi wix based. the .net framework installation changed windows server 2008 r2 - cannot run dotnetfx35.exe (as tried), need enable server feature. usually add server role via server manager > add features > .net framework 3.5.1 features, said need install via wix installation. the way know of use powershell. in powershell (started administrator!) need run following commands: import-module servermanager add-windowsfeature as-net-framework this of course scripted calling powershell.exe so: powershell.exe -importsystemmodules add-windowsfeature net-framework the importsyst...

sql - How I can use a function which returns a table in a select statement with an inner join? -

i need use function returns table, in inner join sentence passing parameter. when executed, sentence not working. select t0.code,t0.data1,t0,data2 [dbo].[fnget_data] (t1.code,'2010-01','usd') t0 inner join codes t1 on t1.code=t0.code when executed sentence using constant parameter works ok select t0.code,t0.data1,t0,data2 [dbo].[fnget_data] ('5200','2010-01','usd') t0 inner join codes t1 on t1.code=t0.code is possible call function fnget_data using parameter value of table? have @ using apply

android - Display icons along with the strings in alertdialogbox -

hi displaying alert dialog box using below code final charsequence[] items = {"email", "phone"}; alertdialog.builder builder = new alertdialog.builder(this); but want display icons names.for x in above code taking email , phone.emailicon comes email name. can give me suggestions.thanks in advance it possible add custom adapter , custom view strings, @ link example: http://mgmblog.com/2010/06/10/arrayadapter-and-alertdialog-for-single-choice-items/

c# - Setting format of date time picker dynamically in windows form -

i want set format of date dd-mm-yyyy control date time picker,i m able create date time picker dynamically can not set format dd-mm-yyyy plz needful.... have tried setting datetimepicker.customformat property? picker.format = datetimepickerformat.custom; picker.customformat = "dd-mm-yyyy"; (note mm months; mm minutes.)

how to use the font color html -

i use font color here. seems don't know put code : <html> <tr> <td style="padding-left: 5px;"> 11.15 - 12.00 </td> <td style="padding-left: 5px; padding-bottom:3px;"> <b> test </b><br/></td> </tr> </html> to set font colour, set color attribute in style: <table> <tr> <td style="padding-left: 5px; padding-bottom:3px; color:#ff0000; font-weight:bold">test</td> </tr> </table> this render word test in red.

internet explorer - How was this website made, what's Frontpage 5.0? -

a friend of mine had " a friend make website " her, person no longer contactable, asked me "why looks different in firefox , links don't work". looking @ source, seems have been made " frontpage 5.0 " has "microsoft office" xml namespace . what find interesting apparently checks browser , if not ie, outputs website made of large, bad looking .gifs on which, not surprisingly, links don't work. here site: http://sprachschule-polyglott.de i'm theoretically interested in how site made, , thought might interesting others, perhaps example presentation of bad old days of internet, relic last decade's browser wars. can tell me how site made ? was made frontpage 98 ? or export-to-website output version of microsoft word ? i used frontpage 98 in 90s don't recall output "an alternative website .gifs" netscape. that's pretty non-compatible day. know how background method of "browser compatibility...

javascript - disable js script with jquery or js -

in 1 page function want disable js script. how make that? i try jquery: hide(), not' work thanks what mean "disable js script"? want no javascript in page? don't write javascript @ all. this "one page" part of site (or site/web app developing) right? jquery hide different purpose.

javascript - find the height of a div and change the current div height to match -

i'm trying make div same height parent (if parent larger) or make parent same height current div (if current div larger) here's i've got far $(this).parents().find('.address').slidetoggle(function() { $(this).parent().height($(this).parent().find('.address').height()) }) it makes parent height of current div (but in current case parent larger current div any ideas? thanks jamie check solution here sample html: <div id="parent" style="height:500px;border:1px solid #000000"> <div id="child" style="height:300px;border:1px solid #000000">child</div> </div> javascript: jquery(document).ready(function() { var $parentdiv = $('#parent'); var $childdiv = $('#child'); if($childdiv.height() > $parentdiv.height()) $childdiv.css('height', $parentdiv.height()); ...

maven 2 - Transitive dependencies in Maven2 -

i've started using maven2 after using ant last 3 years. far i'm seeing i'm still getting grips structure of tool , integration intellij , whats going on in background. one of biggest draws maven ability resolve dependencies transitively part of build process, having problems feature @ moment through lack of understanding believe. consider simple java ee project (simple web services) consisting of following modules: core (persistence entities, , generic dao jpa implementation), ejb-component(ejb3 web service - dependent on core), , webapp (spring web service - dependent on core). i've installed core module , available in repository, , i've added dependency of both ejb module , webapp module scope of compile. however, if dont have javaee api dependency in webapp module won't compile. @ moment source code pojo no metadata. any appreciated! however, if dont have javaee api dependency in webapp module won't compile. @ moment source code po...

.net - How to force AutoCompleteBox control to populate the ItemSource only after n chars are entered? -

is possible force autocompletebox control in silverlight application start obtaining itemsource data after n chars entered (the data filtering mode startswith? thanks, here way bind itemssources (basically there combobox stands stetes. , once state selected set itemssource of autocompletebox control. seems before type 3 chars db call done -checked sql profiler-): this xaml : <input:autocompletebox name="autocompcity" grid.column="1" grid.row="2" horizontalalignment="left" verticalalignment="bottom" width="180" minimumpopulatedelay="10" minimumprefixlength="3" filtermode="startswith" maxdropdownheight="150" valuememberpath="cityname" text="enter city" istextcompletionenabled="true"></input:autocompletebox> and code-behind: private void combostate_selectionchanged(object sender , selectionchangedeventargs e) { if (s...

javascript - How can I determine whether a given string represents a date? -

is there isdate function in jquery? it should return true if input date, , false otherwise. depending on how you're trying implement this, may able use the "validate" jquery plugin the date option set.

java - Installed Application Details on BlackBerry -

i want develop application gets details of installed application time of installation, name of application ... on blackberry. possible? read article codemodulegroupmanager in blackberry

vb6 - SYSBASE CONNECTIONSTRING -

i want connect sybase 12.5 using vb 6.0, should provider can use connect sybase 12.5. i 'm not familiar sybase. would, however, suggest following site: http://www.connectionstrings.com/sybase-adaptive

How to show wml pages on android phone -

i want show wml page on android. have designed small wml page. using apache server deploy pages. page not displaying. displaying xml page. have added line mime.types given in following site http://e-articles.info/e/a/title/how-to-configure-apache-or-iis-web-server-to-work-with-wml-~-openwave-sdk/ still not working on android emulator... idea?? afaik, android's edition of webkit not support wml. possible can find third-party wml app.

getting started with speech recognition and speech synthesis -

i want started speech recognition , speech synthesis in prototype based on speech recognition told me use microsoft speech server (sdk , on) when have this, how programm application, , programming language (development enviroment?)? has experience asterisk or svox? i need do: speech recognition speech synthesis i doesn't have speech recognition - think 30 -50 words should enough beginning. i'm working windows. thanks in advance if choose use microsoft speech engine, there .net framework apis. mentioned in other post, there 2 namespaces (system.speech desktop use , microsoft.speech server use). can program in .net language , can use visual studio. there article published few years ago @ http://msdn.microsoft.com/en-us/magazine/cc163663.aspx . best introductory article i’ve found far. however, based on prerelease version of winfx api , system.speech classes changed when vista released. samples in article not compile because of these breaking api change...

linux - Handling crash dumps from Firefox and Google Chrome -

i'm developing cross-platform npapi+xpcom extension firefox , google chrome (windows, linux , mac). wondering if enlighten me on best practices of handling component crashes. as understand it, mozilla's crash reporter submits mini-dumps , crash reports created mozilla dev. experimented blocking sigsev firefox , creating own core in plugin code. although works fine, i'm sure i'm not supposed that. and google chrome doesn't seem create core dumps! suggestions? the firefox crash report database publicly searchable, don't have own handling. if ask nicely (i.e. prove you're plugin author) i'm sure they'll give minidumps plugin's crashes.

Working with invalid HTML tags -

i have set of html codes , wondering how can wrap code such interpreted correct browser , independent of others. i think should give example: x = <a href="stackoverflow.com">something y = <b>else</b> i print x, y , browser consider y part of link defined in x. how can force browser interpret x independent of y; that's is, how can wrap x , y? i don't know if relevant, work in python. thanks! you must find tags in html snippets , make sure closed properly. a simple solution use regexp: r <[^>]+> , pseudocode: find next match: if match ends `/>`: continue if match starts '</': pop element stack , make sure name matches element match else: push element name on stack each element on stack: print '</%s>' % element.name

sql - How to create a trigger to record changes for Insert,Update,Delete for multiple tables -

i have 2 tables in database.this can increase later on.i want add table audit track changes existing 2 tables.i want track change done of these table audit table structure id table_name field_name old_value new_value modified_by date_of_modification so want have 1 trigger both tables can fired on insert,update or delete either of tables. when trigger fired want insert values in audit.when i'm updating want old value , new value.when inserting want old value nothing , new value inserted.when deleting want old value old existing value , new value deleted. i'm not quite sure question is. triggers can use :old , :new keywords this: create trigger table1_trg after insert or update or delete on table1 each row begin if :old.col1 null , :new.col1 not null or :old.col1 not null , :new.col1 null or :old.col1 != :new.col1 insert audit_table ... end if; -- ditto col2, col3, ... end; there no generic way this, have have code each column....

bash - svn update of directory with muliply repositories checkouts -

Image
i have development directory contains checkouts svn repositories stays in non svn directories. update of dirs being in svns. dir structure similar 1 below: how solve issue? i came "brute force" solution, not intelligent: for in `find . -mindepth 1 -maxdepth 3 -type d | grep -v .svn`; svn $i; done it nice have sth have: svn --recursive update development_dir. unfortunately, svn not support feature. can do, however, optimize command eliminating loop , piping grep. command should this: find . -mindepth 1 -maxdepth 3 -name "*.svn" -type d -exec svn {}/.. \; to make life easier, can set bash alias, example: alias svn_up_recursive='find . -mindepth 1 \ -maxdepth 3 -name "*.svn" -type d -exec svn {}/.. \;' ... , invoke whole script svn_up_recursive command. or create shell script , put bin directory. prefer shell scripts easier support, extend them, process command line arguments etcetera.

mercurial - Can hg log show only the ancestors of a given revision? -

one thing miss moving svn mercurial mercurial's hg log command insists on showing history rather history of current working revision. for example, i'm working on repo lot of check-ins head within branch, , first 20 log entries have nothing line of development. there bunch of options hg log, but... --rev shows revision asked not ancestors --branch doesn't work because active head in same branch mine --prune removes ancestors of other head, if they're ancestors --user doesn't work because i'm not user in line of development i guess hg strip, seems overkill... thoughts? ryan if you've got mercurial 1.6 or later, can use revsets this: hg log --rev "ancestors(.)" hg log --rev "reverse(ancestors(.))" # output in same order vanilla hg log

debugging - Dump file analysis of Java process? -

if take dump, using windbg, of java process running on windows can analyze (easly?) java heap, objects, , threads? just sos .net process? otherwise - how can offline debug problem happening on production systems? thanks! there's java heap analysis tool

wpf - Visual Studio 2010 Property Help -

in visual studios 2005 , 2008 1 can see short sentence or 2 describing each property in forms designer. doesn't seem there visual studio 2010. option have yet turn on? or there don't understand system? quick access information properties i'm work with, in wpf different i'm used working winforms. thanks in advance. visual studio 2010 not provide same convenient property descriptions visual studio 2008. i'm sure there reason this, though annoying. property descriptions helpful.

"Debug"(get information) on a running stored procedure in MS Sql Server -

i aked myself if possible in ms sql-server 2005 information of running stored procedure. because meanwhile executing more 8 hours, know on step or if running @ all. ms ssms says still executing query. thanks in advance, tim sql profiler can you: http://www.databasejournal.com/features/mssql/article.php/3750161/introduction-to-sql-2005-profiler-part-1.htm

c++ - For locale-sensitive functions, is it more common to pass the std::locale or the needed facet object(s)? -

recently wrote family of functions trimming leading , trailing whitespace off of input string. concept of "whitespace" locale-dependent, realized need either pass in const std::ctype<char_t> reference or const std::locale reference , call std::use_facet<std::ctype<char_t> > on const std::locale object. in library, decided upon passing const std::locale reference because figured std::locale object encapsulated entirety of locale information, , std::use_facet library-specific mechanism of access. however, started wondering whether might better choice (perhaps more common?) pass in const std::ctype<char_t> reference direct use functions. which more common in locale-sensitive libraries: passing const std::locale reference or const-references needed facets? seeing how standard library's isspace() std::isspace(chart, const std::locale&) , think follow principle of least surprise if trim whitespace functions took const loca...

ruby on rails - RubyOnRails: url_for application root -

i know doing url_for(:only_path => false, :controller => 'home') i get, example, http://localhost/home but how handle genereate http://localhost depending on goals are, there few ways use server name or base url. general case of, "i need reliable base url can use anywhere," use config method. # via routes.rb map.root :controller => "foo", :action => "bar" # view/controller: root_url # inflexible. root_url ever 1 url # via request object url_for("http://"+request.host) # not available in models # via config file (see railscast 85) # environment.rb app_config = yaml.load_file("#{rails_root}/config/config.yml")[rails_env] # config/config.yml development: server_name: localhost:3000 production: server_name: foo.com # view/controller: url_for(app_config('server_name'))

Any dhcp python library? -

is there library me instantiate dhcp server in python? there in development , alpha verity : http://ostatic.com/pydhcpd/ other servers: http://code.google.com/p/staticdhcpd/ and library working on dhcp too http://nixbit.com/cat/programming/libraries/pydhcplib/ dhcp command line query , testing tool http://code.google.com/p/dhquery/

installing Sqlite3-ruby error -

when tried install: gem install sqlite3-ruby shows: building native extensions. take while... error: error installing sqlite3-ruby: error: failed build gem native extension. /usr/bin/ruby1.8 extconf.rb extconf.rb:3:in `require': no such file load -- mkmf (loaderror) extconf.rb:3 gem files remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1 inspection. results logged /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.1/ext/sqlite3/gem_make.out my environment: sqlite: 2.8.17 rails: 3.0.0 ruby: 1.9.2 ubuntu: 10.04 gem: 1.3.7 i have looking similiar question in webs , so, nothing help, should do? :( i had same problem. solved by sudo apt-get install sqlite3 libsqlite3-dev then following command worked. sudo gem install sqlite3-ruby

How does Perl variable scope work in while loop under strict mode? -

i'm new perl , i'm confused how variable scope works. i'm trying create array of hashes result of mysql query. the following code works, intended, without use strict %hash = (); while (my %hash = %{$qhand->fetchrow_hashref()} ) { push(@results, {%hash}); } but when strict enabled produces following error: can't use undefined value hash reference @ [filename] line xx (the line of while statement). could tell me i'm doing wrong , corresponding rule in strict i'm flaunting? you're violating refs portion of strict . when try use non-reference value reference, perl wants create "symbolic reference", not want although silently continues program (probably not "working", continuing). enabling strictures, catch cases. in example , jonathan's answer, looks doing lot of acrobatics undo hash references make them hash references again. there reason don't leave hash reference? while( $href = $qhand-...

iphone - Differentiate iPhone4 vs. iPodTouch4 in Code -

i want programmatically differentiate between iphone4 , itouch4. here have tried : +(bool) isiphone4 { if ( ![imagepicker isipodtouch4] ) { return no; } if ([uiimagepickercontroller respondstoselector:@selector(isflashavailableforcameradevice:)]) { if ([uiimagepickercontroller isflashavailableforcameradevice:uiimagepickercontrollercameradevicerear]) { return yes; } } return no; } +(bool) isipodtouch4 { if ([uiimagepickercontroller respondstoselector:@selector(iscameradeviceavailable:)] ) { if ([uiimagepickercontroller iscameradeviceavailable:uiimagepickercontrollercameradevicefront]) { return yes; } } return no; } however, seems ipod touch 4 passing test iphone4. have ideas? thanks. this similar: determine device (iphone, ipod touch) iphone sdk the code example included allows tell exact device.

How to save a copy of an inactive worksheet - Excel 2003 vba -

we have piece of software allows user run report. template report excel workbook exists on network drive. steps are: the user clicks "generate report" software opens template, populates data, , closes template, saving in specific directory. done "silently", is, sheet never visible user. my goal have vba module execute while sheet open, save additional copy of workbook in separate directory. successful 1 line of code doesn't seem want run: thisworkbook.saveas (filename) (where "filename" string containing correct directory. reason not save copy of workbook expect. if open copy made program , run code works fine, during initial copy when sheet not active saveas doesn't anything. code in module called beforesave event. any thoughts why isn't being run? do know if beforesave event being triggered? write temp file c drive or sure event firing. open "c:\eventcheck.txt" append #1 print #1, "event fired...

android - Googlemaps API: problems getting my key -

i doing debug key , can't. im stuck here: "once have located keystore, use keytool command md5 fingerprint of debug certificate: $ keytool -list -alias androiddebugkey \ -keystore .keystore \ -storepass android -keypass android" i located keystore, dont know how put order.... think order linux, , using windows xp professional can me plz? get rid of backslashes. those, in linux , os x, denote line continuations. so, in windows, if in directory containing debug keystore, should able run: keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android

android - why won't apk file update -

i'm developing android app using eclipse. export app using export android app function. sign , align resulting apk file. copy apk webserver , try install on phone. goes though installation steps, , when test app not contain latest changes. seems install 1 of previous builds. is problem in: - way create apk? - cache on phone has not been cleared? how eclispe make current apk, , how phone install it? how can verify version of code in particular apk file? thanks, gerry it eclipse isn't building new .apk properly, though sounds you're exporting correctly. giving new .apk different name old one? if not, downloading or installing old 1 accident. you should able go settings -> applications -> manage applications on phone, find app , open info page. version string should listed near top, can verify latest version installed.

Closing all jquery dialog windows in JavaScript -

how 1 close jquery ui dialog windows in javascript? situation: the page has multiple things can opened using dialog boxes. need way close previous windows before opening new one. they have .ui-dialog-content class, select , close them, this: $(".ui-dialog-content").dialog("close");

2d - What is the best pratice to render sprites in DirectX 11? -

i trying used directx api , wondering usual approach render sprite in directx 11 (e.g. tetris clone). is there simmilar interface id3dx10sprite , , if not, usual method draw sprites in directx 11? edit: here hlsl code worked me (the computation of projection coordinate done better): struct spritedata { float2 position; float2 size; float4 color; }; struct vsout { float4 position : sv_position; float4 color : color; }; cbuffer screensize : register(b0) { float2 screensize; float2 padding; // cbuffer must have @ least 16 bytes } structuredbuffer<spritedata> spritedata : register(t0); float2 getvertexposition(uint vid) { [branch] switch(vid) { case 0: return float2(0, 0); case 1: return float2(1, 0); case 2: return float2(0, 1); default: return float2(1, 1); } } float4 computeposition(float2 positioninscreenspace, float2 size, float2 vertexpositio...

php - Using memcache as a session store? -

i have huge problem. 2 days ago site running on 1 server much, purchased 2 more , had them clustered (rsync , load balanced). i start noticing user hit server-1 , on next request hit server3 session still on server1 instead of server3 , no longer logged in. i recommended use memcache session stores. my script uses $_session . can memcache installed , enable session handler support , set session.save_handler = "memcache" force php use memcache? is there application programming needs done use memcache? will solve session between server issue? are session stores stored on servers when created or 1 master memcache server? i'm using codeiginiter framework you need set memcache run on 1 of servers , have of servers use same memcache instance sessions. otherwise, if each run own memcache instance, you'll have same problem before. other configuring memcache accordingly , telling php use session handler, shouldn't have make changes code. ~ ...

jquery - Triggering the return key on event unexpectedly refreshes page and gives undefined error - JavaScript -

when click in field, type text, , press return on keyboard triggers initializetable function refreshes page , gives error form[0] undefined. however, when use change event change dropdown selection, doesn't cause unexpected behavior. i'm not sure why pressing return key in text field causing this. response. <script> (function($){ var listview = $('#listview'); var lists = (function(){ var criteria = { dropfilter: { insert: function(value){ if(value) return {"filter" : value}; }, msg: "filtering..." }, searchfilter: { insert: function(value){ if(value) return {"search" : value} }, msg: "searching..." } } return { create: function(component){ var component = component.href.substring(component.href.lastindexof...

iis - ASP.NET/IIS6 - Disable chunked encoding when using dynamically compressed content? -

i'm running asp.net on iis6 server. right server set compress dynamically generated content, reduce page size of aspx files being retrieved. once of aspx files has following bit of code, used fetch file database , send user: response.clear(); response.buffer = true; response.contenttype = document.mimetype; response.addheader("content-disposition", "attachment;filename=\"" + document.filename + document.extension + "\""); response.addheader("content-length", document.filesizebytes.tostring()); byte[] docbinary = document.getbinary(); response.binarywrite(docbinary); the download works perfectly. however, person downloading file doesn't progress bar, incredibly annoying. from research i've been doing, seems when iis sets transfer-encoding chunked when compressing dynamic content, removes content-length header violates http1.1 standard when doing that. what's best way around without turning dynamic compre...

python - More efficient ways of doing this -

for in vr_world.getnodenames(): if != "_error_": world[i] = vr_world.getchild(i) vr_world.getnodenames() returns me gigantic list, vr_world.getchild(i) returns specific type of object. this taking long time run, there anyway make more efficient? have seen one-liners loops before supposed faster. ideas? kaloyan suggests using generator. here's why may help. if getnodenames() builds list, loop going on list twice: once build it, , once when iterate on list. if getnodenames() generator, loop doesn't ever build list; instead of creating item , adding list, creates item , yields caller. whether or not helps contingent on couple of things. first, has possible implement getnodenames() generator. don't know implementation details of function, it's not possible if that's case. next, number of items you're iterating on needs pretty big. of course, none of have effect @ if turns out time-consuming operation in of vr...

google cloud datastore - GWT RPC and persistent Java objects -

first of all, many craig excellent answer below found useful when searching original issue... ref: gwt simple rpc use case problem : code included building on solution, how 1 overcome (seemingly gwt limitation) if leave persistable object in /shared folder craig suggests... , annotate gwt tutorials suggest... @persistencecapable public class employee { @primarykey @persistent(valuestrategy = idgeneratorstrategy.identity) private key key; gwt seemingly unable deal / import com.google.appengine.datastore.key on client side? i have seen few ugly hacks...but nothing elegant. any suggestions welcome, thanks unfortunately, app engine's key class (and others) not gwt-compatible. means have retrieve object datastore, translate gwt-compatible pojo send on gwt-rpc client. i suggest looking using objectify framework app engine. not simpler interface datastore, persistent objects uses are gwt-compatible, can send them on gwt-rpc client.

String comparison and String interning in Java -

when should 1 compare string s objects , when should 1 use equals method? make sure, use equals , doesn't seem efficient. in situations can string1 == string2 safe use? thanks! you should always use equals . can string1 == string2 work if: you've made sure you've got distinct values in other way (e.g. you're using string values fetched set, comparing them other reason) you know you're dealing compile-time string constants you've manually interned strings yourself it doesn't happen often, in experience.

jquery - Need to set the class of a parent div to that of a contained li element -

i'm working on side navigation element needs change color based on menu selected. i'm trying set class of parent div match of li part of menu. here's code: <div class="cols" id="leftmenuwrapper"> <div id="leftmenu"> <ul id="navsub_657930_721861"> <li class="lmenu_item2"><a href="#">benefits</a></li> </ul> </div> </div> in example, need set class of "leftmenu" "lmenu_item2". tried jquery didn't work. $('#leftmenu').addclass($('#leftmenu ul li').class()); i'm assuming issue .class in code above. not sure how grab class li. thanks in advance help! you use .attr() value of attribute want: $('#leftmenu ul li').attr('classname'); or if part of click handler on <li> element, can reference 1 clicked this . $(this).attr('classname...

ruby on rails - "Wrong number of arguments (1 for 0)" in the "create" action -

so getting message this, basic answer the, "why getting error?" question somewhere you're specifying wrong number of arguments method, no matter how obscure or wrong think - it's typo in code somewhere. below 1 case ran into. i've got functional test errors on following method, saying first "quality.create!(..." statement has many arguments, doesn't make sense me @ all. running ruby 1.8, rails 2.3.5 def reset_quality_lut quality.delete_all quality.create!(:value => 1, :name => "scrap", :extended_name => " (only parts)" ) quality.create!(:value => 2, :name => "heavy use", :extended_name => " (needs work)" ) quality.create!(:value => 3, :name => "medium use", :extended_name => " (some functional damage)") quality.create!(:value => 4, :name => "light use", :extended_name => " (c...

ruby on rails - Undefined method has_attached_file after Paperclip installation? -

not sure if i've done right here. added paperclip gem gemfile , did bundle install. followed along readme instructions on paperclips github page. i wasn't sure if needed install imagemagick. but, found script on github installation on snow leopard, ran: rails plugin install http://github.com/masterkain/imagemagick-sl.git but, i'm getting undefined method has_attached_file i'm new rails , programming. of pretty advanced me, far i've managed figure stuff out. have restarted rails server?

vb.net - How do you return an object as the return value through a RealProxy transparent proxy? -

i'm working system plan on using realproxy objects enable intercepting method calls against set of objects, handling call, , returning appropriate results. this works find simple return types strings or ints, can't seem return objects realproxy.invoke method. everything works. no errors, returned value nothing, instead of object. i've worked smallest sample code could, , have included below. essentially, call rptest , single step through. code creates simple object, rptesta, string field , object valued field retrieves string dim x = c.name works fine , attempts retrieve object dim r = c.subobj which returns nothing. however, in fieldgetter routine, code: '---- field object type field dim mc = new methodcallmessagewrapper(msg) '---- create object dim o = activator.createinstance(t) '---- , construct return message object dim r = new returnmessage(o, mc.args, mc.args.length, mc.logicalcallcontext, mc) return r appears...

c# - TransactionScope causing blocking? -

i'm writing unit tests against database, , we're using transactions make sure our test data gets removed @ end. i'm running problem methods i'm testing using own transactionscope objects, , seems blocking when hitting database. this inside test's base class: basescope = new committabletransaction(new transactionoptions() { isolationlevel = isolationlevel.readuncommitted, timeout = new system.timespan(0, 5, 0) }); and inside method i'm testing, does: using (transactionscope scope = new transactionscope()) the first time code inside 2nd scope touches database, hangs. have way around problem? if using database not doing unit testing, , problems experiencing 1 of reason why true unit testing uses mocks , stubs. now tests doing valuable, , in cases them instead of unit testing. label integration testing (eit). key point here find whole new class of bugs when working real thing not unit test mocks. , key here real thing. fake environment art...

How to return entire mysql table with php? -

$result = mysql_query("select * users"); $values = array(); while($row = mysql_fetch_array($result)) { $values[] = array($row['tried']); } return $values; that returns word array when being called webservice. missing or doing wrong? it's not returning word 'array', it's telling being returned array. to see in array, use either var_dump($values); or print_r($values); . difference format of display. in addition, don't believe need declare array in assignment $values . $values[] = $row['tried']; should work. $values still array.

c# - Substring error though not using substring -

i have following code: public static long createvendorsemailjob(list<recipient> recipients, string subject, string body) { long emailjobid; using (var connection = new mysqlconnection(configurationmanager.connectionstrings["myconnection"].connectionstring)) { connection.open(); // create email job using (var command = new mysqlcommand()) { command.connection = connection; command.commandtype = commandtype.text; command.commandtext = string.format( "insert email_job (parent_id, job_type_lookup_id, from_email, from_name, subject, body_type_lookup_id, body, status_lookup_id, total_emails, persist_addresses) values ({0}, {1}, '{2}', '{3}', '{4}', {5}, '{6}', {7}, {8}, {9})", 5000, ...

php - Display form values in a to pdf document -

i created system using php.. on system..there form...in form has submit button , view in pdf button .. question how transform php form pdf form..user can view form in pdf format did not submit form yet , details enter appear in pdf format form..please me.. you'll need create form in acrobat pro, pdfpen pro, foxit reader (with appropriate add-ons), etc. in doing that, can include form control button submits form values url post. write php script receive post similar html form post, , you're go. from there, post pdf site , let visitor's pdf tools rest. note form validation handled in-pdf. tool use create form include bunch of ready-to-go validations can use (e.g., phone number or social security number), , if something's missing, can incorporate javascript. note js runs in pdf reader, not browser, it'll work if user has js turned off.

c# - How do i convert from one collection to another -

i have: ienumerable<foo> foolist and want convert to: ienumerable<bar> barlist is there linq / lambda solution move 1 other both objects (foo , bar) have simple properties going convert. example: bar.myyear = foo.year they each have 6 properties you can do: ienumerable<bar> barlist = foolist.select( foo => new bar(foo.year)); // add other construction requirements here... enumerable.select projection function, perfect type conversions. help: projects each element of sequence new form. edit: since bar doesn't have constructor (from comments), can use object initializers instead: ienumerable<bar> barlist = foolist.select( foo => new bar() { year = foo.year, month = foo.month // add other properties needed here... });

sql server - index seek while calling the UDF itself, index scan while wrapping the UDF in sp -

i have udf of joins , when run it, read 100-150 pages (from sql profiler) if wrap udf in sp sp read 243287 pages. furthermore, udf performs index seek sp performs index scan on 1 of searched columns. can please advise? based on comments (custid = @param1 or @param1 null) vs. (custid = @param1) , think gail shaw's blog posting on catch-all queries provide insight you're seeing here. basically, think you're getting execution plan cached @param1 null case performs poorly when pass in real @param1 .

sql server ce - Microsoft Sync Framework error deleting foreign key linked tables -

i using microsoft sync framework 2.1 sqlserverce. have main table child table linked foriegn key. when delete main table entry, fails since there items in child table (which have been deleted.) how tell sync order delete rows tables in? the order in syncing tables matters. when dealing parent/child relationships must make sure specify child elements first , parents. project implemented sync framework, had child , parent table each in own syncscope, , had child scope done before parent scope since having 2 tables in ordered correctly in same scope did not seem guarantee order.

javascript - How to return and use an array of strings from a jQuery ajax call? -

i'm using google app engine (python) along jquery ajax calls server. have page want load list of strings in javascript ajax call server. the server method want invoke: class browseobjects(webapp.requesthandler): def get(self): ids_to_return = get_ids_to_return() // todo: how return these ids invoking ajax call? self.response.out.write(ids_to_return) the html page want able access returned ids: var strings_from_server = new array(); $.ajax({ type: "get", url: "/get_ids.html", success: function(responsetext){ // todo: how read these ids in here? strings_from_server = responsetext }, error: function (xhr, ajaxoptions, thrownerror){ alert(xhr.responsetext); } }); my experience ajax limited-- i've used them store data server (a-la post commands) , have no idea how data server. in advance help edit: fin...

jquery - Select element by and classname in javascript -

i have onchange event needs dynamically select id , add preset classname pass function. onchange = "show(document.getelementbyid(this.value). {select class here? } );" the equivalent in jquery $('#'+this.value+'.myclassname').function(); so how select id+classname in javascript? know i'm being dense. you need use classname? ids should unique. var element = document.getelementbyid('myid'); or element parent , want child class var elements = element.getelementsbytagname('*'); var newelements = []; (var = 0, length = elements.length; < length; i++) { if ((' ' + elements[i].classname + ' ').indexof(' yourclassname ') > -1) { newelements.push(elements[i]); } } this code walks through children, , uses indexof() test presence of class. if finds it, pushes onto new array.

email - Zend Framework: How to add a custom validation rule in Zend Form? -

i have created zend form, works fine along validations. is there anyway can add custom validation within form email address, example want set validation check if email address supplied user hotmail, want accept hotmail email addresses. <?php class application_form_registrationform extends zend_form{ public function init(){ $firstname = $this->createelement('text', 'firstname'); $firstname->setlabel('firstname: ') ->setrequired(true); $lastname = $this->createelement('text', 'lastname'); $lastname->setlabel('lastname: ') ->setrequired(true); $email = $this->createelement('text', 'email_address'); $email->setlabel('email address: ') ->setrequired(true); $register = $this->createelement('submit', 'register'); $register->setlabel('create...

Memory allocation for member functions in C++ -

#include<iostream> using namespace std; class { }; class b { public: void disp() { cout<<" not virtual function."; } }; class c { public: virtual void disp() { cout<<"this virtual function."; } }; int main() { cout<<"class a"<<sizeof(a)<<endl; cout<<"class b"<<sizeof(b)<<endl; cout<<"class c"<<sizeof(c)<<endl; return 0; } sizeof class , class b both 1 byte only.what memory allocation member function disp in b. for each instance of class, memory allocated member variables i.e. each instance of class doesn't it's own copy of member function. instances share same member function code. can imagine compiler passing hidden this pointer each member function o...

c - moving of disc in tower of hanoi -

please explain me recursion process step step using f7. i can't correlate return flow of control. #include<stdio.h> #include<conio.h> void t_of_h(char, char, char, int); void main() { int n; clrscr(); printf("enter no of disc in tower of hanoi : "); scanf("%d",&n); printf("\ntower of hanoi using %d discs\n",n); t_of_h('x', 'y', 'z', n); getch(); } void t_of_h(char p1, char p2, char p3, int n) { if(n==0) printf("unsuccessful move\n"); if(n==1) printf("move disc %c %c\n",p1,p3); else { t_of_h(p1,p3,p2,n-1); t_of_h(p1,p2,p3,1); t_of_h(p2,p1,p3,n-1); } } how move n disks tower tower b? move n-1 disks tower tower c. move bottom disk tower tower b. move n-1 disks tower c tower b. the code pretty direct implementation of that. if assume can move arbitrary number of disks 1 tower another, works. how...

Add directory to path globally on ubuntu server -

how can add own directory path without editing local profile's .bash_profile or .bashrc? i need make scripts in directory universally accessible user logged in. you add following in /etc/bashrc export path="$path:/your/directory"

android - startService() from the service class itself -

i try start android service service's class. reason achieve platform independence. doing nullpointerexception @ android.content.contextwrapper.startservice(contextwrapper.java:326). platform target 2.1-update1, suggestions? see code below (i left imports out save space) /* gui: helloandroid.java */ package com.example.helloandroid; public class helloandroid extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // works! startservice(new intent("com.example.helloandroid.unusualservice")); // stop service works of course, stopservice(new intent("com.example.helloandroid.unusualservice")); // unusual start not work: unusualservice myservice = new unusualservice(); myservice.startservice(); } } /* service: unusualservice.java */ package com.example.helloandroid; public class un...

How to set title of TOC in Latex hyperref package -

the latex hyperref package makes nice, linked table of contents, named according section name. however, top level category default, file name. seems should able change actual title, i'm not finding information on how. are sure not 'feature' of pdf reader? might try use pdfs title (unset default), can set this: \hypersetup{ pdftitle = {the title}, pdfauthor = {you} } you might want check out tex stackexchange .

windows 7 - VBscript - SQL Connection fails SQL Server does not exist or access denied -

this pretty strange. i've got string connect sqlserver in same domain computers running , compares username employeeid. takes row , dumps lokal computers registry. working in windows xp, not windows 7 seems. i exact error message: line:39 char:1 error: [dbnetlib][connectionopen (connect()).]sql server not exist or access denied. code: 80004005 source: microsoft ole db provider sql server. this script itself. i've removed actual servernames. reckon nobody needs those. set oconn = createobject("adodb.connection") oconn.open "provider=sqloledb;data source=mysqlserver04\mysqlserver04;initial catalog=orginfo;integrated security=sspi" ssql = "select top 1 * dbo.mal_personinfo empid = '" & eid & "'" 'wscript.echo ssql set rs = oconn.execute(ssql) set osystem = createobject("wscript.shell") iteller = 0 rs.fields.count - 1 text = text & rs.fields(iteller).name & "=" & rs.field...

Gotta Catch'm All! - UIView over UITableView not receiving taps -

the problem app tapcatchingcontroller not receive taps on section headers or between sections. i'd learn how should that. have tried keep sample program small possible, it's still rather long, sorry that. code self contained. if copy , paste in appdelegate, should go! :) thanks in advance, --nick #import <uikit/uikit.h> //----------------------------------------------------------------------------------------------- //class infiniteviewcontroller: says when view tapped, view invisible user @interface tapcatchingviewcontroller : uiviewcontroller {} @end @implementation tapcatchingviewcontroller - (void) loadview { self.view = [[uiview alloc] init]; self.view.alpha = 1.0; } - (void) touchesended:(nsset *)touches withevent:(uievent *)event { nslog(@"you tapped this! tuhm-dudu-dum"); } - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { return yes; } - (void) viewwilldisappear:(bool)animated { [super viewwi...