Posts

Showing posts from January, 2011

java - Retaining the data in the view during activity switch? -

in android app user can enter text in editview , click on button takes him other activity can select contact ... , press button brings him first activity... now problem need pass selected contact first activity , display (which have done using bundle) unable retain entered text in editview... should (but text should retained out passing through the bundle , getting back) thanks :) the text in view component automagically saved os, after soft kill (user changed phone orientation), not after hard kill, user hit button while parent activity in focus. so, unless doing non-standard, such calling onsaveinstancestate without calling super.onsaveinstancestate, data in view state should persist. one solution save text in view component non view instance property before launch child activity, , read value when focus returns parent activity in method onactivityresult. jal edit: android docs activity page has been extensively updated. view state not saved if widget not hav...

Encoding differences between tr (ubuntu) and tr (mac) -

echo – | tr ’ x on mac: correctly prints – on ubuntu 10.10: prints xx� why? for reference, first character 'en dash' (u+2013), second 'right single quotation mark' (u+2019) edit: use perl instead. magic incantation use is: perl -csd -p -mutf8 -e 'tr/a-zÁÉÍÓÚÀÈÌÒÙÄËÏÖÜÂÊÎÔÛÇa-zäëïöüáéíóúàèìòùâèìòùñçßœ/ /cs' it means: except letters think of, replace character space, , squeeze spaces. gnu coreutils tr has issues multi-byte characters - considers them sequence of single byte characters instead. taking account, see on linux "expected": $ echo – | od -t x1 0000000 e2 80 93 0a 0000004 $ echo ’ | od -t x1 0000000 e2 80 99 0a 0000004 $ echo – | tr ’ x | od -t x1 0000000 58 58 93 0a 0000004 edit: for set of utf-8 compatible utilities, might want have @ heirloom toolchest . contains tr implementation apparently has utf-8 support, although have not tested it.

algorithm - semi-random set of subsets -

i'm trying generate semi-random subsets restrictions. here variable descriptions example values: objcount - number of objects (12) visiblecount (aka setsize) - number of objects per set (6) setcount - number of sets (12) objappearances - number of set in object appears = setcount * visiblecount / objcount i need produce given number of sets (setcount) follow these rules: each set collection of objects, no object can in single set more once. furthermore, each object should in same number of sets. if doesn't devide evenly, number sets in object appears can off 1 (some objects in 4 sets, , others in 5). i'll try avoid situation, it's not critical. it's turning out far less trivial thought. me code/psuedocode? solution generalized version helpful too. thanks in advance. edit: visiblecount set size. number of times object appears (objappearances) setcount * visiblecount / objcount edit2: should add want sets random. if sets have sequential o...

asp.net mvc - Route to subdomain -

i have made asp.net mvc 3 application area called blog. want route area subdomain blog.mywebsite.com. how can achieve this? how need define route? have configure dns? currently use default area route. can access blog area @ way. mywebsite.com/blog you require cname entry setting redirect website. hosting provider able out here if not familiar this.

javascript - Printing the JSON data? -

i learning how use javascript wrote simple script prints out public facebook statuses particular keyword. reason, not doing expect do. sample url json found be: http://graph.facebook.com/search?q=beatles right now, not printing results. can spot error in this? <input type="text" id="query" /><button>add</button><br /> <div id="results"> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ var url='http://graph.facebook.com/search?q='; var query; $('button').click(function(){ query=$("#query").val(); $.getjson(url+query,function(json){ $.each(json.data,function(i,feed){ if(feed.type=='status') { $("#results").append('<...

android - Widget size different while testing on local and publishing - same phone -

i have created small widget want 80w x 100h in size. on phone works fine when testing un-signed. publish app , test widget on phone 160w x 200h... my widget background 80w x 100h. my widget provider xml file below <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:updateperiodmillis="10000" android:minwidth="80px" android:minheight="100px" android:initiallayout="@layout/widget"/> widget.xml layout <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget_base" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="10dip" android:orientation="vertical" android:background="@drawable/widget_b...

html - css - how to change image source by its id? -

does know how can control image source css? i need able change image src css. have loop printing < img id=.. > tags, , every id different image. want able set source id style css area. does know how this? that not possible css. however, easy javascript: document.getelementbyid("idofimage").src = "sourceofimage";

iphone - Transform Navigation Based to Tab Bar Based app -

i've problem. have add uitabbarcontroller navigation based application. when open mainwindow.xib , add uitabbarcontroller ok. there's problem. when run app table view disoriented , rows not show correctly. happen tab bar controller insert in mainwindow.xib . without shows correctly. can me? you may need adjust frames of other views. in .xib files in interface builder, click root view , go attributes inspector (cmd-1), , in "simulated user interface elements / bottom bar" select "tab bar". views created in code, you'll need reduce height of frames perhaps account smaller viewing area.

mysql - Can you use sql like() functions for table joins? -

assume have 2 tables, each single string column (name). i'd left outer join t1 t2 t1.name %t2.name% or t2.name %t1.name% is possible? pretty goes in where clause can go in on clause, like: select * t1 left join t2 on t1.name '%' + t2.name + '%' or t2.name '%' + t1.name + '%'

search - What fields are available in the GetString method of the SharePoint 2007 ResultTable object? -

i writing custom search results page , want use of metadata available within resultstable object categorize , mark results. aware, example, if have resulttable rt , run rt.getstring(5), path item matched search, , if run rt.getstring(13) can string (containing numeric value) indicating if url points binary file. know other parameters method possible , return. in particular hoping 1 of parameters cause method indicate if search result subweb vs folder. using getname method on same object discovered there 15 values. names shed light on are: 0: workid //eg "867" 1: rank //eg "861" 2: title //eg "untitled document" 3: author //eg "system account" 4: size //eg "5366" 5: path //eg "http://myserver:42801/pages/test.html" 6: description //blank me 7: write //eg "03/17/2010 10:28:29" 8: sitename //eg "http://myserver:14286" 9: collapsingstatus //eg "0" no idea means 10: hithighlightedsummary...

java - Velocity templates seem to fail with UTF-8 -

i have been trying use velocity template following content: sübjäct $item everything works fine except translation of 2 unicode characters. result string printed on command line looks like: sübjäct foo i searched velocity website , web issue, , came different font encoding options, added code. these don't help. actual code: velocity.setproperty("file.resource.loader.path", abspath); velocity.setproperty("input.encoding", "utf-8"); velocity.setproperty("output.encoding", "utf-8"); template t = velocity.gettemplate("subject.vm"); t.setencoding("utf-8"); stringwriter sw = new stringwriter(); t.merge(null, sw); system.out.println(sw.getbuffer()); how fix issue? have tried using: template template = velocity.gettemplate("subject.vm", "utf-8"); ? looks should right thing.

anchor - passing href attributes to another php page -

.a little guys.. i have index.php page contains tags when clicked opens picture.php. .my picture.php page retrieves images database depending on idno. .what want add "idno" attribute on anchor tag when user clicks tag index.php sends idno picture.php picture.php knows image fetch database. pls! so anchor tag, this? <?php $url = "pictures.php?idno=" . idno; echo "<a href=\"" . $url . "\">click me</a>"; ?> now in pictures.php file, can read id this: $idno = $_get['idno']; the thing watch out make sure sanitize input, before pass off database query aren't vulnerable sql injection attack.

arrays - Calculating Fibonacci Numbers in C++ code -

my question is: have matrix. need calculate corresponding fibonacci number each entry in matrix, , return values matrix. keep getting c2109 "subscript requires array or pointer type", , know it's coming from, , know means, don't know how fix make code work. right now, doesn't anything. i'm not sure if i'm returning value fibonacci function, or calling correctly in main function. i've modified was. here's new code: const int row1 = 3; const int col1row2 = 3; const int col2 = 3; int fibonacci (int [][col2]); void main() { int p[row1][col2], f [row1][col2]; int sum; input (a,b); cout<<"the fibonacci matrix is: "; cout<<fibonacci(p); ( int = 0; < row1; i++) { ( int j = 0; j < col2; j++) { sum = f[i][j]; f[i][j] = fibonacci(p); } } cout<<endl; } ...

passing parameter to access query from c# -

i have design access query seem this: select replace(names,'lion','kiss') expr1 table1; the 2 values lion , kiss , temporary, want these 2 variables, can pass value c#. how call query c#, , pass 2 values. i using access 2007. thanks :) try (i found this on subject): public void replacecolumna(string oldvalue, string newvalue) { using(oledbconnection connection1 = (oledbconnection)databaseconnection.instance.getconnection()) { connection1.open(); using(oledbcommand sqlcmd2 = new oledbcommand("queryname", connection1)) { sqlcmd2.parameters.addwithvalue("param1", newvalue); sqlcmd2.parameters.addwithvalue("param2", oldvalue); sqlcmd2.executenonquery(); } } } the access query this: update [t] set [a] = ? [a] = ? the names of parameters pass on don't matter, it's order pass them as. by using "using" statement en...

php - extra /// when pulling info from database -

i using funstion insert data database so here inserts i inserting <div class="widget" id="recentcomments"><h2>blog</h2></div> update_option("head-text", mysql_real_escape_string($head_text)); so inserts database , when save , pull out below. <input type="text" name="head-text" id="head-text" class="regular-text" value="<?php echo htmlentities($head_text, ent_quotes); ?>"/> i following. <div class=\\\"widget\\\" id=\\\"recentcomments\\\"><h2>blog</h2></div> loads off \\\\ sorry vag question before. according manual mysql_real_escape_string if magic_quotes_gpc enabled, first apply stripslashes() data. using function on data has been escaped escape data twice. you can go function (in case don't want use prepared statements) function safe($input) { if (get_magic_quotes_gpc())...

What blocks Ruby, Python to get Javascript V8 speed? -

are there ruby / python features blocking implementation of optimizations (e.g. inline caching ) v8 engine has? python co-developed google guys shouldn't blocked software patents. or rather matter of resources put v8 project google. what blocks ruby, python javascript v8 speed? nothing. well, okay: money. (and time, people, resources, if have money, can buy those.) v8 has team of brilliant, highly-specialized, highly-experienced (and highly-paid) engineers working on it, have decades of experience (i'm talking individually – collectively it's more centuries) in creating high-performance execution engines dynamic oo languages. same people created sun hotspot jvm (among many others). lars bak, lead developer, has been literally working on vms 25 years (and of vms have lead v8), entire (professional) life. of people writing ruby vms aren't 25 years old. are there ruby / python features blocking implementation of optimizations (e.g. inline ...

jsp - Captcha code incompatible with firefox -

i using this captcha code in jsp. call jsp following code using iframe: <iframe id="captchaframe" align="center" name="captchaframe" src="captcha.jsp" width="120" height="40" scrolling="no" frameborder="0" marginheight="-10" marginwidth="-10"/></iframe> with explorer works pretty in picture: http://i53.tinypic.com/2n04glz.jpg but in firefox characters become else entirely in picture: http://i55.tinypic.com/9tpmw8.jpg how can fix this? i guess firefox doesn't recognise output of jsp file image. did set mime content-type image? http://www.w3.org/protocols/rfc1341/4_content-type.html

language agnostic - How to name this function -

given function: function foo() { if (!dostep1) { return false; } if(!dostep2()) { return false; } ... // @ point, rest can fail, // overall outcome should considered success dostep15(); dostep16(); ... return true; } i'd wrap between 2 ... inside function. any idea name function performs mandatory steps outcome don't care about? function mandatorysteps() { return dostep1() && dostep2() && ...; } function optionalsteps() { dostep15(); dostep16(); ... }

jquery - Return a List<E> from a view in view model -

this situation: i have view model: public class viewmodel { public datetime somedate { get; set; } public string somestring { get; set; } public list<e> somelist { get; set; } } what have in view set date, write text , select list of e number of e. viewmodel returned in action must have date, text , contain list of selected items. what need know how handle said list. how can add each selected item models' list. thinking on adding property public bool selected e , send items , filter selected ones on server, rather not send , forth data since list can quite large. i using mvc3 razor , jquery ajax form posts. if not making myself clear, please let me know. thank you. here's 1 technique use achieve this. let's start view model: public class viewmodel { public datetime somedate { get; set; } public string somestring { get; set; } public list<e> somelist { get; set; } } public class e { public bool selected { ...

ruby - Rails: Expected.. To Define Account_number -

i have rails project , keep getting following error when trying load new.html.erb page: expected /usr/local/www/apache22/data/update_pi_names/app/models/account_number.rb define account_number heres def new in controller: def new @pi_name = piname.new @account_numbers = account_number.find_all respond_to |format| format.html # new.html.erb format.xml { render :xml => @pi_name } end end and model/account_number.rb: class accountnumber < activerecord::base has_and_belongs_to_many :pi_names end let me know if need more info! reference model via accountnumber not account_number , hence: @account_numbers = accountnumber.all also, can use all instead of find_all

php - Normal time loading of page -

i have blog , know normal time loading of page. time of loading 0.104528188705 sec. time without time internet connection. 0.105 seconds 105 milliseconds ; seems quite no bad, actually, if have several dynamic informations on blog -- means several sql queries. of course, suppose when there virtually no load on webserver ? if so, , plan on having lot of visits on website, might want think bit caching mecanisms. hint : test more (virtual) users , simulate higher load, might want take @ tools such : apache bench siege jmeter sidenote : remember time takes generate page on server small portion of time users have wait -- don't forget can optimize loading time, grouping css/js, using optimized images, leveraging http caching, ... for more informations on subject, take @ : web performance best practices (google) exceptional performance (yahoo)

Long Division in Java not working as expected -

class longdiv{ public static void main(string [] args){ final long x = 24*60*60*1000*1000; final long y = 24*60*60*1000; system.out.println(x/y); } } although expected answer 1000, javac gives 5. reason? the long x creating isn't value expected. in integer range. create longs, use: final long x = 24l*60l*60l*1000l*1000l; final long y = 24l*60l*60l*1000l; system.out.println(x/y); the x computed, in integer range, 500654080 . divided y ( = 86400000 ), results in 5.794607407407407... . java truncates decimal part causes 5. by adding l after number literal, tell compiler compile long instead of int . value x expected 86400000000 . compiled int. we can reproduce wrong value x ( 500654080 ) truncating int: // first correct long x = 24l*60l*60l*1000l*1000l; /* x = `86400000000`; */ // truncate x &= 0xffffffffl; // again: don't forget l suffix /* x = `500654080` */

iphone - How to best approach two threads needing one set of data? -

i need able write data chart while simultaneously gathering data. data cannot modified while chart reading it. however, need able new data while chart reading data. data rendered in chart doesn't need 100% date. here thought: data read write array locked, data copied read array locked, both unlocked. chart locks copied array whenever needs read it. data gatherer reads more data read array. every once while data gatherer locks both arrays , copies write array read array. are there better ways this?

javascript css without frameworks -

i want build left sidebar opens content in right div when click on link without using framework such jquery. can point me resource this. haven't been able find decent resource in dynamic drive or google. also, need resources build other javascript , css tools without using frameworks. thanks in advance help. for left opening content in right, can set left links change css of right containers can opened, like: <a rel="leftlink" onclick="opencontent('content-2')>link 2</a> <div id="content-2" class="visibility: hidden">i second right content</div> and js function should be: function opencontent(el_id) { document.getelementbyid(el_id).style.visibility = "visible"; } once again, spend less time (and consequently less money) using framework such jquery...

WCF C# - Getting Specific Configuration Values From App.config -

i have wcf service xyz deployed on number of hosts. each such service may have connection xyz service deployed on 1 of other hosts. it's distributed system states differ between services. in order communicate doesn't make sense me "add service reference" in visual studio because add redundancy (the service knows it's going communicating with). so idea specify other service endpoints in app.config files of each service. example: <client> <endpoint name="bel" address="tcp://us.test.com:7650/ordermanagementservice" binding="tcpbinding" contract="iordermanagementservice"/> <endpoint name="bel2" address="tcp://us.test2.com:7650/ordermanagementservice" binding="tcpbinding" contract="iordermanagementservice"/> </client> now, want way read these settings , create channelfactories , channels in code. ...

javascript - Getting selected text position -

currently i'm getting selected text in browser doing this: window.getselection(); now need show tooltip above text when pressing custom key(note mouse not on text anymore), in order need absolute position of selected text. is there way that, maybe wrapping text inside tag , getting offsets? any idea? ps: have work chrome, not browsers. ps2: sorry crappy english. the easiest way insert temporary marker element @ start or end of selection , position. i've demonstrated how before on stack overflow: how can position element next user text selection?

listview - Overriding Android ArrayAdapter -

i want simple thing. have listview in application dynamically add text to. but, after point, change color of text inside listview. so, made xml defining custom list item, , subclassed arrayadapter. but, whenever call add() method on custom arrayadapter, item added listview, text not placed it. here's xml: ` <textview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/list_content" android:textsize="8pt" android:gravity="center" android:layout_margin="4dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textcolor="#ff00ff00"/> and arrayadapter subclass: private class customadapter extends arrayadapter<string> { public view v; public customadapter(context context){ super(context, r.layout.gamelistitem); } @override public view getview(int pos, view convertview, viewgroup parent){ ...

visual studio 2010 - Use of "@this" in Moles delegates -

when set property of moled type, looks require, first parameter, object of original moled type. noticed of examples in moles reference guide assign parameter @this , trying figure out why. for instance, original class looks this: public class productdao { internal void insert(product product, string id) { ... } } when go mole method, property expecting delegate first parameter type of moled object, in case, productdao object. in case, property expecting delegate of: action<productdao, product, string> so have provide moled object first parameter of lambda expression? if so, what's difference in using regular variable name versus @this ? @this mean/do? mproductdao.allinstances.insertproductstring = (dao, product, id) => { }; versus mproductdao.allinstances.insertproductstring = (@this, product, id) => { };

logging - iPhone: How to read application logs from device -

is there way read application logs iphone device? similar logcat of android? as zoul said, obtain them in organizer. prior that, should tell application store logs in documents folder, example. way when in organizer,extract application data , find logs there. now, in order tell app redirect nslog() outputs file, should this: nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory,nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *filename =[nsstring stringwithformat:@"%@.log",[nsdate date]]; nsstring *logfilepath = [documentsdirectory stringbyappendingpathcomponent:filename]; freopen([logfilepath cstringusingencoding:nsasciistringencoding],"a+",stderr); the last sentence 1 redirects output. so once have done that, app logs stored in application's documents folder. don't know how extract application data? here shall find out. i hope helps out.

php - Recommended SQL Types and Lengths -

i'm new sql , i'm working on table stores account information multiplayer game. i'm wondering efficient way store lot of data. for these 3 columns, think, i've figured out: username: varchar(20) password: varbinary(16) md5-hashes email: varchar(70) what think this? besides that, there lot of more flexible data (savegame data), can't predict. smart save data xml data in field of type text? or there better way save (using php)? thanks. rob a couple of advices : as possible, use smallest possible type (like tinyint instead of int) if have fixen-length string, use char, , not varchar (for md5, instance) a note more related specific case : 70 characters seems bit short e-mail address savegame data > use text or blob field.

mono 2.10 under windows vista sp1 HttpWebRequest always throws time out exception -

httpwebrequest throws time out exception run in mono 2.10 under windows vista sp1 32bit. same request completes run under microsoft .net in same machine. here follows code: string url = "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+amphitheatre+parkway,+mountain+view,+ca&sensor=false"; try { httpwebrequest request = (httpwebrequest)webrequest.create(url); console.writeline(request.getresponse()); } catch (exception ex) { console.writeline(ex.message); } update: version of mono: c:\program files\mono-2.10\bin>mono -v mono jit compiler version 2.10 (tarball) copyright (c) 2002-2011 novell, inc , contributors. www.mono-project.com tls: normal sigsegv: normal notification: thread + polling architecture: x86 disabled: none misc: softdebug llvm: supported, not enabled. gc: included boehm (with typed gc , parallel mark) i cannot reproduce mon...

mysql - Performance based on searching a integer or a long string (unique) in database? -

i have 5 columns in table in database , 2 unique (one integer , string). integer like 1,5,6,7,9,0 , string http://exmaple.com/book-on-the-self-no-2 . now column should used searching rows??? how impact performance? database sql or mysql? thank.. generally speaking, less comparisons , manipulation of data (like reading disk) mysql has make, faster it'll go. which means searching on integers (a couple of bytes) faster searching on (possibly long) strings. in case, sidenote : don't forget adding index on field searching on -- depending on kind of query you're doing, it'll speed things lot.

javascript - Using Node as REST server alongside PHP -

i've got functional site running right in php on apache; php , apache serving needs of serving site content quite nicely. i'm looking convert existing php api server code restful interface; of design issues worked out on front. php doesn't seem fit restful interface, though; enter node.js. i'd run rest api node.js server, while still serving site content php. reasonable approach, , there potential troubles waiting in wings? i'm planning on using express simplify process of rest api development. php apache enough serve proper restful interface. being able divide operations proper resources , verbs rest needs. rest way of designing interface , actual implementation, there multiple ways of implementing in php/apache itself. have used zend framework big apis. super simple, .htaccess php file should good. :) that said, believe node.js give api nice performance advantage after installing it. actual numbers depend upon how backend works. imo, if hav...

How do i change the column names in a result set and create a new result set in PHP with modified column names -

example: my current result set: array(7) {[0]=>array(2) { ["class_id"]=>string(1) "1"["class"]=>string(3)"1st"} { ["class_id"]=>string(1) "2"["class"]=>string(3)"2nd"} { ["class_id"]=>string(1) "3"["class"]=>string(3)"3rd"} i want new result set : array(7) {[0]=>array(2) { ["new_id"]=>string(1) "1"["new_class"]=>string(3)"1st"} { ["new_id"]=>string(1) "2"["new_class"]=>string(3)"2nd"} { ["new_id"]=>string(1) "3"["new_class"]=>string(3)"3rd"} i dont want affect column names in database. result set. try this function rename_key(&$array, $oldkey, $newkey) { // remember here send value reference using `&` if(array_key_exists($oldkey,$array)) { $array[$newkey]...

linq - C# : Checking if an object (who has a min and max property) falls between any existing objects? Explained inside -

i wonder if can help? i have list collection of objects, each object has min , max property. so imagine have id : 1 min : 10 max : 49 id : 2 min : 50 max : 69 id : 3 min : 70 max : 89 i should not allowed create new object so. id : 4 min : 88 max : 91 as falls within range of have already. (it overlaps id 3) hence no overlapping ranges. i did try solve so, isn't working var test = myobjects.findall( o => myminval.value >= o.min && mymaxval.value <= o.max).tolist(); so if test not null, means have overlap. i have tried reversing greater , less signs.... any ideas how work? thanks in advance edit also take example object, should fail although doesn't clash specific 1 object! clashes when @ 3 original. id : 4 min : 5 max : 91 i hope makes sense you're not checking enough things. basically need see if either min in range, or if max in range of objects. here's un...

xml - how to change the value of the param name in xslt? -

this xslt template part:here want change scope in index value.how it? <xsl:template match="//w:body/w:sdt/w:sdtcontent/w:p/child::* "> <xsl:param name = "scope"/> <xsl:variable name="index" select="count(preceding-sibling::*)"/> <xsl:if test = "$index &lt;= $scope"> <paragraph> <xsl:attribute name="index"> <xsl:value-of select="$index"/> </xsl:attribute> <xsl:attribute name="toc">true</xsl:attribute> <xsl:apply-templates select=".//w:t"/> </paragraph> </xsl:if> </xsl:template> plz guide me this... you can't re-assign parameter. want this? there way round it.

tortoisesvn - Manage config file differences between development and production servers with SVN -

i have few files of .net app different in production server development server. example: web.config masterpage.master account/account.aspx blog/web.config and few more... what best way manage these differences svn? i've heard maintaining config folder in trunk creating branch "different" files, merging them release tag. i use svn trunk main development (stable) , tag trunk when it's ready released. trunk deploys development server , release tag deploys production server via ftp. one possibility leave build/deploy process. so, web.config have following in svn: web.config (this can development version) web.config.qa (if have qa environment) web.config.prod at build/deploy time, deployment process "knows" environment deploying (based on control - environment variables, script parameters, etc), , substitutes correct config file in place. i prefer method because leaves directory , file structure intact (vs. having config folder), av...

java - JMS strange problem -

i have problem in system ~500 servers communicating central server through jms on ~1000 topics. it's 10 year old system , worked until few months ago. in last 3 months had these types of errors: central server can't deserialize integer because integer in message has wrong serialversionid deserialize message failed. - cause: java.io.invalidclassexception: java.lang.integer; local class incompatible: stream classdesc serialversionuid = 1360651450463909473, local class serialversionuid = 1360826667806852920 central server can't deserialize unknown class deserialize message failed. - cause: java.lang.classnotfoundexception: no classloaders found for: javnteger.integer jms tries instantiate number class abstract caught jvm error: java.lang.instantiationerror: java.lang.number for errors problem localized in 1 random topic. if messages topic deleted , sent again servers went ok. i'm suspecting jms hardware. hdd ok. need test memory , don'...

java - hibernate cached query not updated when new record inserted -

we have ehcache cluster, hibernate , mysql. everything working fine. criteria searches being cached , when records modified on other members of clusters cached queries updated instantly on other servers. however, problem when new records inserted. cached queries on table not know until cached query expired. i have missed on ehcache.xml configuration, have no idea be. any ideas? ehcache.xml follows: ` <!--<diskstore path="java.io.tmpdir"/>--> <!-- means cache replication --> <cachemanagerpeerproviderfactory class="net.sf.ehcache.distribution.jgroups.jgroupscachemanagerpeerproviderfactory" properties="connect= tcp(bind_port=10700): s3_ping(...): merge2(max_interval=30000;min_interval=10000): fd_sock(start_port=0): fd(timeout=3000;max_tries=3): verify_suspect(timeout=1500): barrier(): pbcast.nakack(use_mcast_xmit=false;gc_lag=0;retransmit_timeout=300,60...

android - How to only retrieve a URL once per instance? -

i load images using httpget request gallery view... problem each time gallery swiped images fetched on again. i catch images using code below... how this? public void getimages() throws ioexception{ defaulthttpclient httpclient = new defaulthttpclient(); httpget httppost = new httpget("https://sites.google.com/site/theitrangers/images/webimages.txt"); httpresponse response; response = httpclient.execute(httppost); httpentity ht = response.getentity(); bufferedhttpentity buf = new bufferedhttpentity(ht); inputstream = buf.getcontent(); bufferedreader r = new bufferedreader(new inputstreamreader(is)); stringbuilder total = new stringbuilder(); string line; while ((line = r.readline()) != null) { total.append(line + "\n"); imageurl = total.tostring(); log.v("getimage1", "retreived image...

javascript - jQuery Toggle div class on load depending on the content height -

i have dynamic content loaded on template. default div background-color yellow, when teh content longer 300px div toggles or appends class wil change background-color red. below code. <!doctype html> <head> <title>untitled document</title> <style type="text/css" media="all"> .short {background-color:yellow;padding:30px; width:200px;} .long {background-color:red;padding:30px;width:200px;} </style> </head> <body> <div class="short">div content</div> </body> </html> try this $(document).ready(function(){ $(".short").each(function(){ if($(this).height() > 300){ $(this).removeclass("short").addclass("long"); } }); });

Android tabs vs. landscape orientation -

i have tab-based android app. currently, not support landscape mode - 1 , activity swallows orientation changes. now, user asks support landscape sake of hardware keyboard convenience. on 1 hand, makes sense. on other, default behavior of tab host rotating tab strip; when does, takes 1 third of precious screen space tabs alone. lose lot of real estate. are there common ways out of conundrum? far as can see, vertical tab strip not option. i suggest following technique discussed in timores's answer android:orientation="vertical" not work tabwidget , describes how set tabhost display tabs on left of screen, tabs vertically stacked.

android - mediaPlayer and back button -

i have activity implements mediacontroller.mediaplayercontrol . the audio player plays file fine, can not out of activity pressing button. when button pressed, these 2 messages in log. current activity appears continue work fine. warn/keycharactermap(522): no keyboard id 0 warn/keycharactermap(522): using default keymap: /system/usr/keychars/qwerty.kcm.bin if take implementation of mediacontroller.mediaplayercontrol out of activity, button works expected. any ideas on how resolve this? here class. took irrelevant parts out didn't screw copy up. public class contentactivity extends activity implements onpreparedlistener, mediacontroller.mediaplayercontrol { private static final string tag = "audioplayer"; private mediaplayer mediaplayer; private mediacontroller mediacontroller; private string audiofile; private handler handler = new handler(); /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { sup...

Eclipse/FDT closes imports when typing in a new import -

for example type following: import shared. and on dot, closes imports forcing me reopen imports , continue typing. there way disable this? point of this? this cannot disabled without disabling autocomplete. with autocomplete, when selection made, fdt use , return editor can enter keyword. you shouldn't ever need type import fdt. can: 1) use autocomplete on class / type , have fdt auto import class 2) use organize imports 3) use quick fix import class. see more here: http://fdt.powerflasher.com/docs/main_page

apache - Htaccess: Trigger php or write to log -

i want redirect fast possible. decided use htaccess redirect , because responses before php interpreter initialized. want log redirects , write database. i tried redirect , call rewritemap trigger php file but, throws 500 error. i ok, if can create log file, if log processing delayed. important only: fast redirect, track / log redirect. have got ideas or recommendations on this? thank in upfront all best, emre you use rewritelog log rewriting actions file -- done apache, without invoking php. => quite fast ; logs file, not database ; still, said, log processing can delayed, , done script run crontab. see rewriteloglevel , configure how verbose log should be.

SQL - Join Two Tables About The Same Entities -

i have created 2 tables, each table contains entries same entity. how can write query join entries , create unified entry in table? sorry confusion guys. should provide simple example. my 2 tables similar below, table 1: name, id, email, city, state, phone table 2: lastname, firstname, email, gender, id i assume id primary key links 2 tables. query takes selected columns each table , inserts them table @u3. declare @u3 table(id int, firstname varchar(50), lastname varchar(50), city varchar(50), [state] varchar(50), phone varchar(50), email varchar(50), gender varchar(50)) insert @u3 select u1.id, u2.firstname, u2.lastname, u1.email, u1.city, u1.state,u1.phone, u2.gender table1 u1 join table2 u2 on u2.id=u1.id select * @u3

CodeIgniter - Which function to use for URL's -

im building first application using codeigniter, need bit of advice. there 2 functions same thing , wondering best use. ok, when im building site, link homepage simple / if building on directory, take root public_html directory, codeigniter have found both site_url() and base_url() but, both seem same thing .. wondering if theres difference, 1 better use, etc etc. cheers, if using index.php site_url() will include index.php , and base_url() will not include it. if creating url pass, use site_url('images/img.png') otherwise... base_url().'images/img.png'

aix - Invoke a Web Application via a shell script (or Tivoli Workload Scheduler - TWS) -

i have web application performs file download web site. this needs performed @ regular intervals (once week). want make http request web application performs job. i can use cron , shell script. this on ibm aix machine. not have ones wget, curl etc availble in linuxes make web request shell scripts directly. the team here uses tivoli workload scheduler. have minimal skills in tws don't know if there options make http request part of tws job appreciate if highlight options achieving on aix box. these machines os hardened not allow me download , compile utilities wget. forced work typically installed on aix box. thanks manglu ibm host number of linux utilities compiled aix. can use wget. aix linux toolbox don't worry saying aix 5.1, it's binary compatible later releases. if can't use (and encourage them let you, have installed on plenty of production boxes, it's official ibm aix binary), you'll need write in perl or similar, if wan...

css - Can I position an element fixed relative to parent? -

this question has answer here: fixed position relative container 19 answers css position element “fixed” inside scrolling container 3 answers i find when position element fixed, doesn't matter if parent positioned relative or not, position fixed, relative window? css #wrapper { width: 300px; background: orange; margin: 0 auto; position: relative; } #feedback { position: fixed; right: 0; top: 120px; } html <div id="wrapper"> ... <a id="feedback" href="#">feedback</a> </div> http://jsbin.com/ibesa3 let me provide answers both possible questions. note existing title (and original post) ask question different seek in edit , subsequent comment. to position element "fixed" relative pare...

javascript - Toggle ExpandAll/CollapseAll -

i using jquery toggle toggle between show , hide. works fine individual elements. when try expand , collapse works fine condition except one. if individual element expanded or collapsed toggle them not expected. is, when click on expand expands elements except individual element expanded collapsed , vice-versa. how take care of condition? <script type="text/javascript"> $(".toggle_container").hide(); $("div.description-content-title").toggle(function () { $(this).addclass("collarrow"); }, function () { $(this).removeclass("collarrow"); }); $("div.description-content-title").click(function () { $(this).next(".toggle_container").slidetoggle("slow"); }); $(".close-all").toggle(function () { $(".close-all a").text("[expand all]"); }, function () { $(".close-all a").text("[close all]...

visual c++ - Using relative values in array sorting ( asm ) -

i need sort through array , sort each individual row in array in ascending order. doesn't seem going (surprise!) keep getting hit 2 errors: a2101: cannot add 2 relocatable labels , a2026: constant expected here's sort, makes sense me, think i'm still trying implement high-lvl language techniqes assembly. there way around not being able use relative values? (the array 7 rows 9 columns, btw). mov cx, 7; cx = number of rows outer: ; outer loop walk through rows push cx mov cx, 9 mov row, cx ;rows middle: ; middle-loop walk through columns push cx sub cx, 1 ;cx = cx-1 mov column, cx ;columns inner: ;inner loop - compare , exchange column values cmp marray[row*9 + column], marray[row*9 + column+1] xchg marray[row*9 + column+1], marray[row*9 + column] ; compare , exchange values marray table inc column loop inner pop cx loop mid...

ios - How to upload Video on Twitter using Twitvid in iPhone application programmatically -

how upload video on twitter using twitvid in iphone application through programming? i don't have code can give you, , don't know of library easily, i'd suggest on twitvid documentation: http://twitvid.pbworks.com/w/page/22556295/frontpage to accomplish doing required oauth requests, suggest use asiformdatarequest class: http://allseeing-i.com/asihttprequest/

uiview - how to disable the button glow when clicked android -

i trying implement disabling of button glow when clicked in android. hope not lost cause. there way of implementing this? appreciate helping hand. first create normal_button.xml in res/drawable folder. in normal_button.xml write code given below. set normal_button.xml background button properties. ` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <color android:color="@android:color/white" /> </item> <item > <color android:color="@android:color/white" /> </item> </selector> `

entity framework - Repositories and getting new values for an aggregate entities / value objects -

i'm starting out ddd , have built repository pattern using ef code first far working well. have aggregate root call animal has entity called status . now if need populate drop down list status objects, or need replace status object in animal new one. how should access status collection. in case status not aggregate root , has meaning association animal , have identity though. should either create new repository status making aggregate root (it 1 of many such things might out of hand), or allow access status collection via animalrepository getstatusbyid or getallstatuses ? this same question equally apply value objects such color, breed, sex etc. this sort of stuff i'd treat lookup/reference data; i've found answer useful in past: loading value object in list or dropdownlist, ddd but i'd have separate repository.

sd card - How should I refer to "external storage" in the UI on Android? -

apparently external storage on android (referred environment.getexternalstoragedirectory) doesn't have sd card. in fact, doesn't have external! how can refer storage in ui? example, if not accessible, want surface error user. if "external storage" or "sd card", may confuse users of devices. there way appropriately identify it? a @ docs environment.getexternalstoragedirectory() : note: don't confused word "external" here. directory can better thought media/shared storage. filesystem can hold relatively large amount of data , shared across applications (does not enforce permissions). traditionally sd card, may implemented built-in storage in device distinct protected internal storage , can mounted filesystem on computer. sounds shared storage term.

r - Non-continuous variable supplied to scale_x_continuous in ggplot2 geom_point graph -

i have table has 2 columns both of them continuous data. checked csv file make sure there numeric values in columns. however, when plot them 1 of them seems taken non-continuous data, , get: error: non-continuous variable supplied scale_x_continuous. small version of table budget gross 1 234 4234 2 42342 2323 3 22165 346 4 290 452 ... i trying create scatter plot gross numbers in y axis , budget in x axis. tried fore-mentioned error. p <- ggplot(test, aes(budget, gross))+geom_point(alpha=i(1/5), aes(colour=budget))+ opts(titles="movies per year", panel.grid.major = theme_blank(), panel.grid.minor = theme_blank())+scale_x_continuous() thank try class(test$budget) . odds r believes column factor. if that's so, can around problem using stringsasfactors option, either inside of read.csv() : test <- read.csv(file = "yourdata.csv", stringsasfactors = false) or set entire session: options(stringsasfact...