Posts

Showing posts from March, 2013

asp.net - Disable AJAX loading icon from WebResource.axd -

im using updatepanel timer , when timer fires animated .gif webresource.axd never goes away end multiplying .gif's. how disable animation? you can add custom message updatepanel that: <asp:updateprogress id="updprocess" runat="server" associatedupdatepanelid="yourproblematicpaneld"> <progresstemplate> left emtpy, or type here </progresstemplate> </asp:updateprogress> this updateprogress can outside panel. anyway there no default wait icon update panel, search find how add in page

Lua pattern: how to fetch the required string -

i have string mentioned below, data coming me in excel file. rows proper data , these proper data rows able fetch need using lua pattern. below proper data row 2011/02 arrtc aauumco zzitnwmobile communications center arrtc-aauum-tbt-2011-02 0.00 aauum_arrtc_0211_tbt 18.03 18.03 eur 1.14977 20.73 20.73 and using below pattern , working fine. rpattern = "(%d%d%d%d%/%d%d)%s*(%w%w%w[%w%d][%w%d])%s*(%w%w%w[%w%d][%w%d]).-[%u%d%-%s]-([%d%.%,]+)%s*([%u%d_%-]-)%s*([%d%.%,]+)%s*([%d%.%,]+)%s*(%u%u%u)%s*(%d+%.%d*)%s*(.-)\n" now rows coming html tags, means data inside html tags. trick need fetch required string within html tags. bugged row 2011/02 arrtc aauumco zzitnwmobile communications center arrtc-aauum-tbt-2011-02 0.00 <a href="/cgi-bin/recon_detail?rectent=aauum&benificary=arrtc&period=2011/02&svctype=voice">aauum_arrtc_0211_tbt</a> 18.03 18.03 eur 1.14977 20.73 20.73 now above row wa...

webkit - Prevent scrolling in Android browser -

is there way prevent scrolling of rendered html page in android browser? following not appear have impact on page scrolling in android browser: var preventdefault = function(e) { e.preventdefault(); return false; }; document.addeventlistener('touchmove',preventdefault,false); document.body.addeventlistener('touchmove',preventdefault,true); window.addeventlistener('touchmove',preventdefault,true); (i've tried bubbling on , off.) it looks me android webkit makes "window" same length document, scrolling being done on browser itself, not on document body or dom window object. what's weird that's webkit on ios does, code above still works. answering own question. the problem ended being need capture , suppress ontouchstart ontouchmove on document stop browser scrolling. different in ios, still works identically on both platforms. the actual code ended using looks sort of this: var preventdefault = function(e){...

javascript - Should I wrap jQuery document ready in a self executing function? -

i had thought this: (function(window, undefined){ $ = window.jquery; $(function(){ // stuff }); })(this); would consider practice or bad? have implications when jquery(document).ready() fire? only reason i'd if have javascript run before dom ready, , don't want pollute global namespace. (function(window, undefined){ var $ = window.jquery; // create variables and/or functions shouldn't global // ...and work before "ready()" fires var = 'some value'; function b() { // important stuff } var c = b(); // maybe set `.live()` handler, doesn't rely on dom ready. $('.someselector').live( function() { // handler code. // works before dom ready. }); $(function(){ // dom ready code }); })(this);

facebook - Get my wall updates -

i'm trying recent wall entries wall, url dead simple: https://graph.facebook.com/me/feed?limit=30&date_format=u&since=1308733229&access_token=<token> now, i'm putting current time in place of since= , getting recent entries but, problem is, if gets updated (someone comments wall entry) won't show new is there proper way new/recent comments or updated wall entries? (fql may work too) you can use fql little more control on returning feed, check out https://developers.facebook.com/docs/reference/fql/stream/ how define new? in content since last time polled api? on end getting difference between have , result of latest poll. or if prefer pushed updates include differences since last update can subscribe realtime updates api: https://developers.facebook.com/docs/reference/api/realtime/

GWT Propagate Event on views in activties -

how throw view event, such click on button, in view's activty? view doesn't know activity eventbus.. miss something? i'm using 2.3 sdk thanks i think best option keep reference activity in view , forward event activity, can use eventbus in it's own method. there small example on page: http://code.google.com/intl/sv-se/webtoolkit/doc/latest/devguidemvpactivitiesandplaces.html but basically, use @uihandler handle clickevent, , invoke method in activity. in activity perform action uses eventbus, rpc, or so. know people prefer handling event directly in activity me seems nicer separation of concern , keeps view nicely "stupid". an example: button says "select active customer" view handles clickevent button, invokes presenter.customerselected(...) activity has customerselected method , creates activecustomerselectedevent, sends on eventbus.

return - Javascript creating a new line on the html page? -

i have javascript function prints textboxes when user clicks button. however when user clicks buttons multiple times textboxes go along page want on new line every time function called. i tried this x=document.write ('<br/>'); document.getelementbyid('txtara').appendchild(x) but clears page blank white. thanks document.getelementbyid ('txtara').innerhtml += '<br>';

jquery run time calender date picker date changes -

i found problem, can add technology of calender user asked , extending in jquery date picker plugin custom code blocks few date on initializing date 1 plugin effects other calender plugin problem if date 15,16,17 blocked if user selects 14 start date , 18 end overlaps blocked date can see if can done stop overlapping block date , show alert here js fiddle this complex problem asi dint got answers here custom function can achieve this. hope helps others //alert(datetext); var thedate = new date(date.parse($(this).datepicker('getdate'))); var maxdate = $.datepicker.formatdate('d-m-yy', thedate); var themindate = new date(date.parse($("#datepicker_1").datepicker('getdate'))); var mindate = $.datepicker.formatdate('d-m-yy', themindate); alert(mindate + "\n" + maxdate); var stamp1 = str2date(mindate).gettime(); //first date. gettime...

asp.net mvc 3 - Need MVC3 Razor Grid that loads by JSON/AJAX and has frozen columns -

i need grid on mvc3 razor page have load json or ajax call. need grid editable well. also need grid have ability have first 6-8 columns frozen. looked @ example on codeproject.com , couldnt work. scrollbars show couldnt columns freeze. i have been working on using telerik grids, doesnt have ability freeze columns default in razor setting. does have suggestions on how implement or more information? try jquery easyui http://www.jeasyui.com/documentation/datagrid.php i did suggest jqgrid: http://www.trirand.com/blog/ apparently it's faff frozen columns using it.

Open browser in older version of Java -

i trying open uri in browser java application. know in current version of java can done using java.awt.desktop, class not available in earlier versions of java, such 1.5, using. there way open default browser given uri in earlier versions of java? i think should trick import java.lang.reflect.method; import javax.swing.joptionpane; public class barebonesbrowserlaunch { private static final string errmsg = "error attempting launch web browser"; public static void openurl(string url) { string osname = system.getproperty("os.name"); try { if (osname.startswith("mac os")) { class filemgr = class.forname("com.apple.eio.filemanager"); method openurl = filemgr.getdeclaredmethod("openurl", new class[] {string.class}); openurl.invoke(null, new object[] {url}); } else if (osname.startswith("windows")) { runti...

c# - Change configuration file location in AppFabric Cache -

i have two-hosts appfabric cache cluster. configuration file located on 1 of servers (not ideal, know...) want move configuration file other location. how can re-configure 2 hosts config info new location? thanks! you can run appfab config wizard again.

matlab - How to bucket locality-sensitive hashes? -

i have algorithm produce locality-sensitive hashes, how should bucket them take advantage of characteristics(i.e. similar elements have near hashes(with hamming distance))? in matlab code found create distance matrix between hashes of points search , hashes of points in database, simplify code,while referencing called charikar method implementation of search method. i tried search that, i'm not sure how apply case of methods found(like multi-probe method). none of these techniques seems pluggable if have hashes. there simple example code this? or suggestion? this link page matlab code i'm talking about: http://www.eecs.berkeley.edu/~kulis/klsh/klsh.htm based on: search in locality sensitive hashing this, after reading similarity estimation techniques rounding algorithms : this question somehow broad, going give minimal (abstract) example here: we have 6 (= n ) vectors in our dataset, d bits each. let's assume 2 (= n ) random permutation. let 1st r...

Identification of WPF DevExpress Grid cell using Automation Libraries -

my team working on automating ui testing of wpf application uses devexpress wpf grid (dxgrid). use microsoft's ui automation library (system.windows.automation) identification , performing actions on controls. automationelement class , automationpatterns class used purpose. ui grid implementation based on typical mvvm model view model contains business entities bind dropdown columns; string values bind text columns , datetime values bind datetime columns. ui automation library able read actual displayed values of string , datetime columns not dropdown columns underlying binding type complex object. actual values displayed these columns shown using displaymemberpath property. supported pattern grid cell values valuepattern/selectionitempattern , using it. limitation pattern can fetch string values , not concrete object. want read actual displayed value in cell , assertion checks. please provide suggestion this. thanks, hitesh this seems have similar problem statemen...

ejb 3.0 - Load external properties files into EJB 3 app running on WebLogic 11 -

am researching best way load external properties files , ejb 3 app ear file deployed weblogic. was thinking using init servlet read somewhere slow (e.g. message handler might receive message jms queue before init servlet runs). suppose have multiple property files or 1 file here: ~/opt/conf/ so far, feel best possible solution using web logic application lifecycle event code read properties files during pre-start: import weblogic.application.applicationlifecyclelistener; import weblogic.application.applicationlifecycleevent; public class mylistener extends applicationlifecyclelistener { public void prestart(applicationlifecycleevent evt) { // load properties files } } see: http://download.oracle.com/docs/cd/e13222_01/wls/docs90/programming/lifecycle.html what happen if server running, post start viable solution? can think of alternative ways better? it depends on how want properties reloaded. 1 approach have taken have properties file wrapper...

javascript - Facebook Redirect Query -

this followup previous question asked. have url encoded in facebook ad, , want python program end url redirects using javascript. because uses javascript, normal urllib2/mechanize ways of tracking redirects don't work, , i'm little lost next step should in tackling problem i'm new python. the html original url (which redirects when placed in normal browser) follows: <html><body><script type="text/javascript">/* <![cdata[ */document.location.replace("http:\/\/www.facebook.com\/ajax\/emu\/r.php?u=aqip41zwc9sy8ww3nvilfep65wgtqry0hfkopknfo0pmmv8reqe5huwspfxzpc5vousbpsalvkaelk_nkixnbfo3exloljd6e37jqmqtu8_mhtsdyhw1d2tbw9ja5tz8revst2c6ioksvimbta1acavzfsoum2_utze-fqzqy7hujvixgwulgxcbo00myfnchmbk3srxc3flzzwgjh5blxtx0plcagfnwzss1phbsi_aezeuwvrqh2x264wxqlog15qkkyg7zfvyootbynrr686thdx9kyv52erakme3z2pm76syr0njokbxjamquc0qvvuz5of3mhapgw3cjcch9k2j_he7gc-cydtcdmevit0qsh4sxcm9kxqnsrptihbaxedpqysadadyfs3p3q3rgg1atuzgzdkcshyqaodhhfhbreuyj2tuwm7dq7...

xcode4 - Xcode 4: List Methods By Name? -

Image
is there way navigate structure of objective-c file alpha order methods? combobox (in jump bar) shows methods not more helpful looking through file. as per jump bar page : "tip: hold down command key when selecting level in path menu view items alphabetically."

Trigger the event which happens when I click the 'x' button on a TinyMCE modal dialog (like the advimage dialog) -

please see comment , rest of thread: [question]: tinymce image url select thank you! the 'x'-button element element using $(".mceclose") . able assign event handler there (you need assign handler when dialog open/visible) else won't find such element , assignment fail. here is: $(".mceclose").click(function() { alert('handler .click() called.'); });

image processing - Getting pixel coordinates efficiently in Matlab -

i create function in matlab that, given image, allow 1 select pixel clicking on in image , return coordinates of pixel. ideally, 1 able click on several pixels in image in succession, , function store respective coordinates in matrix. there way in matlab? ginput graphical input mouse or cursor syntax [x,y] = ginput(n) [x,y] = ginput [x,y,button] = ginput(...) description [x,y] = ginput(n) enables identify n points current axes , returns x- , y-coordinates in x , y column vectors. press return key terminate input before entering n points.

php - Send email to multiple recipients -

i'm building website people (ie mr. smith) fills out questionaire (not shown) , uses mr. smith's "zip code" , find (3) people/reps (ie.. bob, chuck , sally) 'rep members' , have on previous occasion, opted have questionaire's that's mr. smith's zip code emailed them (bob, chuck , sally) respond to. so below i've pulled mr. smith's zip code "lifezip" , email address "lifeemail" questionaire form previous page , using mr. smith's zip code "lifezip" find (3) people/reps (who happen bob, chuck , sally) stored in separate table "repstable" match mr. smith's zip code can respond mr. smith's questionaire. i'm having trouble placing multiple emails (ie.. bob, chuck , sally) "to:" field. whether script sends same email different people separately or they're listed in "to:" field, i'll take either. in advance! <? session_start(); session_register('l...

c++ - Best simple way to mock static/global function? -

i have simple value-like class person: class person { public: person(thirdpartyclass *object); virtual ~person(void); virtual std::string getfullname() const; virtual int getage() const; virtual int getnumberofdaystillbirthday() const; }; i'm using third party library , thirdpartyclass needs have global/static function called destroy (part of 3rd party library) called on destroy it. destroy function called in person destructor. now i'm trying unit test person class , need way mock/stub destroy method. think write wrapper class around static destroy function , use dependency injection inject wrapper person class, seems overkill call 1 function on simple class. what's simple straightforward way this? or dependency injection best way this? update ultimately decided go creating class wrapped 3rd party library's global functions , using dependency injection pass class constructor of person class. way stub out destroy method. al...

ant javascript failonerror -

i have ant task includes embedded javascript. i'd have target fail or succeed based on logic run in javascript: <target name="analyze"> <script language="javascript"> <![cdata[ importclass(java.io.file); importclass(java.io.filereader) importclass(java.io.bufferedreader) string.prototype.startswith = function(str) { return (this.indexof(str) === 0); } string.prototype.endswith = function(str) { var lastindex = this.lastindexof(str); return (lastindex != -1) && (lastindex + str.length == this.length); } //setup source directory srcdir = project.getproperty("my_home") + "/foo/src"; if(srcdir.startswith("/foo") { //target should pass } else { //target should fail } ]]> ...

linux - How do I write a script to run multiple processes in the background and have additional commands run once each individual command completes? -

i'm trying following in bash script: for x in b c; echo foo $x; sleep 5 & y=$! ; (wait $y && echo bar $x) & done is possible, without adding complexity (the above example of course not work)? edit: of course in reality, echo foo $x; sleep 5 example, copying large file or compiling big, , second operation operations depend on first. maybe missing using () s , putting & on entire sub group command... for in 1 2 3; (echo $i; sleep 5; echo end $i)& done

r - How to improve this code for getting pairwise? -

it question build upon previous question (http://stackoverflow.com/questions/6538448/r-how-to-write-a-loop-to-get-a-matrix). it different previous one, more details provided, , libraries , example file provided according comments dwin. so, submitted new question. mind teach me how modify code further? to load necessary libraries: source("http://bioconductor.org/bioclite.r") bioclite() my protseq.fasta file has following contents: >drugbank_target|1 peptidoglycan synthetase ftsi (db00303) mvkfnssrksgkskktirkltapetvkqnkpqkvfekcfmrgrymlstvlillglcalvaraayvqsinadtlsneadkr slrkdevlsvrgsildrngqllsvsvpmsaivadpktmlkensladkeriaalaeelgmtendlvkkieknsksgylyla rqvelskanyirrlkikgiiletehrrfyprveeaahvvgytdidgngiegieksfnsllvgkdgsrtvrkdkrgnivah isdekkydaqdvtlsideklqsmvyreikkavsennaesgtavlvdvrtgevlamatapsynpnnrvgvkselmrnrait dtfepgstvkpfvvltalqrgvvkrdeiidttsfklsgkeivdvapraqqtldeilmnssnrgvsrlalrmppsalmety qnaglskptdlgligeqvgilnanrkrwadieratvaygygitatplqiarayatlgsfgvyrplsitkvdp...

javascript - How do I get the keys of the sorted values in an array -

if have following array: [5, 1, -7, 3, 6, 8, 0, -1, -3] by sorting [-7, -3, -1, 0, 1, 3, 5, 6, 8] that's fine, want keys array when sorted. this: [2, 8, 7, 6, 1, 3, 0, 4, 5] i tried following using insertion sort, of course wrong. var arr = [5, 1, -7, 3, 6, 8, 0, -1, -3]; keys = new array(arr.length); for(var j = 1; j < arr.length; j++) { key = arr[j]; var = j - 1; while(i >= 0 && arr[i] > key) { keys[i+1] = i; i--; } arr[i+1] = key; keys[i+1] = j; } am on right track? can me out here :) try kind of thing described on page http://www.webdotdev.com/nvd/content/view/878/ . basically, make each item in array object 2 properties (the sort-key , index in array), sort them key.

toolbar - Delphi: TCoolBar + TToolBar+TEdit+TCheckBox -

Image
how can put toolbar on left side of coolbar, edit - center, checkbox - on right? i trying during 2 hours , can not:( controls behind others, or have width coolbar. stupid things :) thanks! i think searching break property of coolband: break property (tcoolband) causes band start on new line. if break true (the default), band starts new line @ left side of tcoolbar control. if break false, band continues on same line predecessor. so steps layout of image: put coolbar on form (default top aligned) , give height, set fixedorder true, add toolbar, edit , checkbox coolbar, open bands collection editor, set of every coolband collection item break property false, drag width of independent coolbands (or set width property of each), set coolbar.autosize true.

PHP GD Library and uploaded files -

i'm working on project upload image (jpg) , manipulate using php gd library. i know can use gd functions edit image resource (created imagecreatefromjpeg()) wondering if there way use file uploaded in $_files array directly gd library. 1 solution thought of saving uploaded file, pushing imagecreatefromjpeg, deleting afterwards. this seems cluinky though, there more efficient solution? i'm still bit new php i'm not sure how files stored in $_files array. hope i'm making sense here. thanks. you can this: $img = imagecreatefromjpeg($_files['image']['tmp_name']); // gd operations on $img imagejpeg($img, '/path/to/target'); you'll have use imagecreatefrom in form or another, , can use directly on uploaded file. save result of manipulations using imagejpeg . uploaded file in tmp_name thrown away automatically. having said that, should save original somewhere. it's have around later use.

resources - PHP Infinite Sleep -

my web page has following sleep line in it: sleep(600); for user, appear if page loading "forever". effect desired. however, create process lasts 10 minutes, eating system resources. there way create same effect user (loading "forever") without having lengthy process? try using jquery script. work, because design reason right? or thinking wrong. body {display: none} then jquery $("body").delay(millisecond_wait).attr("display", "block");

How to modify jQuery Carousel to display vertical instead of horizontal -

i'm trying jquery feature carousel - http://www.bkosborne.com/jquery-feature-carousel display vertical instead of horizontal. tried playing around css altering width , height of #carousel-container , #carouse didn’t work (the effects display in 1 continuous line instead of rotating). think require editing in jquery.featurecarousel.js file i'm not sure edit. hoping can help? thanks in advance. in horizontal carousel menu js there 1 variable direction:"horizontal" so think need change direction:"vertical" just try it...may needful. thanks

re-arrange php array -

i have array array ( [1] => vice president [3] => secretary [5] => treasurer ) i want make change array ( [0] => vice president [1] => secretary [2] => treasurer ) i have try php loop function $ub_new_arr_sort = array(); for($i3 = 0; $i3 < count($ub_new_arr); $i3++){ $ub_new_arr_sort[] = $ub_new_arr[$i3]; } but seem not work @ all, idea? thanks advance. just use array_values . $array = array_values($array);

never stop the service in android -

i want develop service @ system level android can not stopped user. is possible ? how can achieve this? thanks check i hope helpful you. how stop android service when there no other activities in app

Implement Rails Application using single front-end server(Apache) ,back-end server(Passenger) and database-server -

we have requirement deploy rails application using single front-end server(apache),two back-end server(passenger) , 2 database-server.what configuration? effect change in rails application code base? you can use capistrano deploy multiple servers @ same time. if want more specific configuration please ask 1 or more specific questions.

ruby on rails - Facebook 'like' with dynamic page titles -

i'm trying facebook 'likes' (http://developers.facebook.com/docs/reference/plugins/like/#) working on site, page titles dynamic, filled in bits of .erb . in initial testing, upon trying 'send' page, .erb bits coming blank. imagine because rails controller action not firing each time facebook goes in collect page title. how can circumvent dynamic titles work when facebook comes knocking @ door page title?

javascript - How to find bind event to any element -

let, <span onclick="foo()" onfocus="goo()">have event</span> here give example. here span 2 events have bind. is there javascript or jquery way find out events bind html element? you can't dom2-style event handlers (ones added addeventlistener / attachevent ), pretty means don't want doing dom2+ handlers increasingly way shall done (tm) . the ones you've shown in example dom0 event handlers, though, can check for: you can loop through properties on element, looking @ ones starting "on", , see whether have value: var element = document.getelementbyid("thespan"); var name; (name in element) { if (name.substring(0, 2) === "on" && element[name]) { // has dom0 handler event named `name` } } update : apparently, @ least on chrome, onxyz properties non-enumerable don't show in for..in loops. , on firefox, see ones assigned programmatically, n...

Can't Create lists and Survey in Quick Launch Sharepoint -

i have sharepoint site , made several quick launches going in siteactions -> sitesettings -> in , feel chose quick launch (i'm using sharepoint 2007). after that, wanted add list in 1 of them (lets launch #2). click on launch #2 , create, after created lists. thing list goes under launch #1 , not under launch #2. there i'm doing wrong? when create new link list, have specify in quick link zone link list should appear. the last field on new link form used this.

Struts2 same namespaces in different struts.xml files -

is possible use same namespace in different struts.xml files?. know can use different namespaces. problem is, have many actions in configuration file. want split inorder manage easily. if use different namespace each file, have modify namespace mentioned everywhere(jsps). for ex. i want use namespace="/" in struts.xml files. i hope understand coming say. possible or other relevant easy method achieve this? thanks in advance you can use multiple packages same namespace. remember packages cannot have same names. need include them in main struts.xml like: <include file="path config files"/>

iphone - How to edit UITableView cell contents -

just need confirm 1 thing have searched enough on "how can edit contents of table" findings "custom cells text fields". true have solution every cell need text field edit contents or there other solution exist? if yes let me know , if no confirm above finding (though question not explained guys understand want ask) thanx by default uitableviewcell won't support editing text, because uses uilabel 's display text. so, finding, "custom cells text fields" , correct way it.

python - Get index of recently appended item -

is there straightforward way index of item appended list? need keep track of last added item. i came 2 possible solutions: # workaround 1 # last added 1 @ index len(li) - 1 >> li = ['a', 'b', 'c',] >> li.append('d') >> last_index = len(li) - 1 >> last_item = li[len(li) - 1] # workaround 2 # use of insert @ index 0 know index of last added >> li = ['a', 'b', 'c',] >> li.insert(0, 'd') >> last_item = li[0] is there trick index of appended item? if there's not, of above use , why? different workaround suggest? li[-1] last item in list, , hence 1 appended end: >>> li = [1, 2, 3] >>> li.append(4) >>> li[-1] 4 if need index, not item, len(li) - 1 fine, , efficient (since len(li) computed in constant time - see below) in source of cpython, len lists mapped function list_length in objects/listobject.c : static py_ssize_t l...

sql - Using 'case expression column' in where clause -

select ename , job , case deptno when 10 'accounts' when 20 'sales' else 'unknown' end department emp /* !!! */ department = 'sales' this fails: ora-00904: "%s: invalid identifier" is there way overcome limitation in oracle 10.2 sql ? how use 'case expression column' in clause ? the reason error sql select statements logically * processed in following order: from : selection of 1 table or many joined ones , rows combinations match on conditions. where : conditions evaluated , rows not match removed. group by : rows grouped (and every group collapses 1 row) having : conditions evaluated , rows not match removed. select : list of columns evaluated. distinct : duplicate rows removed (if it's select distinct statement) union , except , intersect : action of operand taken upon rows of sub-select statements. example, if it's union, r...

php - How to execute choice of test cases from multiple test cases -

i want execute few selected test cases class of multiple test cases using php unit ease. as 1-2 test cases failing bunch of test cases , finding difficult execute whole test suite again these two, there method without adding comment others or copying these 2 methods in different suite. thanks in advance you may run single test cases or single test classes suites using --filter cli option : --filter <pattern> filter tests run. --filter runs tests name matches given pattern. pattern can either name of single test or regular expression matches multiple test names. example take following example test class blatest containing test cases testsame , testelse in file blatest.php : // blatest.php <?php class blatest extends phpunit_framework_testcase { public function testsame() { $this->assertsame(1,1); } public function testelse() { $this->assertsame(1,1); } } running test cases within blatest this filter matches test class n...

Android path not getting -

when dealing iphone application, know sandbox of application stored , when save can access document directory of application. but, in android, don't know similar thing it, can let me know file stored , how can can access it? it'll stored in workspace under folder projects name

delphi - Triple equality expression evaluation -

suppose have 3 variables , need assert can either equal -1 or neither can equal -1. wrote following code: x := 1; y := 1; z := 1; assert( (x = -1) = (y = -1) = (z = -1) ); i write kind of check, 2 variables. surprisingly triple comparison compiled too, doesn't work expected. (1, 1, 1) values expect evaluate true. after substitution of variable values , simplification get: assert( false = false = false ); and thought should evaluate true, doesn't. how triple comparison evaluated? first of all, = operator binary operator: works on pair of values. there's no such thing "triple equality". compiler evaluate 1 pair, , use result evaluate other. when compiler sees multiple linked operators, needs group them pairs using what's called "precedence of operators". it's clear if think basic arithmetic operators learned in primary school. there's no doubt what: 3+2*4 evaluates to: it's equivalent 3+(2*4) . when in doubt, add ...

shell - Linux command for physical memory, getting the value only -

in linux cat /proc/meminfo | grep memtotal gets memtotal: 12298824 kb i want numbers here so wrote cat /proc/meminfo | grep memtotal | cut -d':' -f2 gave me 12298824 kb i want numbers here, can me? note: cat /proc/meminfo | grep memtotal | cut -d':' -f2 | cut -d'k' -f1 gives me solution 12298824 , there better way? 1 liner? use awk : cat /proc/meminfo | grep memtotal | awk '{print $2}' from @lars wirzenius's comment(no cat , no grep ): awk '/memtotal/ { print $2 }' /proc/meminfo

localization - EL variable in JSF ResourceBundle -

i read somewhere (don't find anymore) can use el expresions in resource bundle , use without changes in *.xhtml files. some.text=#{somebean.stepsleft} more to switch position of variable in different languages. wont work. can use interpolator class handle parsing or add some.text.before some.text.after , let 1 of them empty. prefer use without interpolator.interpolate() if possible. jsf resourcebundles default not resolve el. default supports messageformat api in combination <h:outputformat> , <f:param> . some.text = {0} more with <h:outputformat value="#{i18n['some.text']}"> <f:param value="#{somebean.stepsleft}" /> </h:outputformat> you can explicitly make number type e.g. 1000 displayed 1,000 or 1.000 depending on view locale. some.text = {0,number} more for more formatting options see messageformat api documentation .

calayer - Getting "Single stepping until exit from function CALayerGetDelegate, which has no line number information." in iphone sdk -

my code follows: if ([dematallocationdict count] > 0) { [demattablev reloaddata]; // debugger stops here demattablev.hidden = false; } when call method , code runs @ first time. when call again getting message in console, i.e. "single stepping until exit function calayergetdelegate, has no line number information." i tried lot not getting solution. when continue run app gives bad access. debugger stops @ : [demattablev reloaddata]; please me... :( thanks in advance.

perl - Trying to use DateTime. What's wrong? -

i trying datetime out todays date in %d/%m-%y' format, undef . what doing wrong? #!/usr/bin/perl use strict; use warnings; use data::dumper; use datetime (); use datetime::format::strptime; $now = datetime->now; $p = datetime::format::strptime->new( pattern => '%d/%m-%y', time_zone => 'utc', ); $dt = $p->parse_datetime($now); print dumper $dt; it written simple as: #!/usr/bin/env perl use strict; use warnings; use datetime (); $now = datetime->now( 'time_zone' => 'utc' ); print $now->strftime('%d/%m-%y');

javascript - Superimpose Images with PHP -

Image
i searching way overlay image on existing image. e.g: + i have found great example on here: png overlay using 1 single image element. have two problems these. first of all, don't want dimensions equal each other. e.g (215*215 on 215*215). because users have ability choose want put image. (top, left, bottom, top-right) 8 directions. the second problem in example, 2 images allowed overlay. users (again) have ability put multiple images on top of it. i have little knowledge of javascript , php, great if guys (and girls) me out. sincerely, you can using gd library. there function "merge" images called imagecopymerge . here simple example how merge images: <?php header('content-type: image/jpeg'); $bg = imagecreatefromjpeg('background.jpg'); $img = imagecreatefromjpeg('image.jpg'); imagecopymerge($bg, $img, 0, 0, 0, 0, imagesx($bg), imagesy($bg), 75); imagejpeg($bg, null, 100); ?>

c++ - What are differences between std::string and std::vector<char>? -

so main differences , of them used in cases? vector<char> gives guarantee &v[0]+n == &v[n] whereas string doesn't (practically, case, there no guarantee)... afaik c++0x gives guarantee already there no implicit conversion const char* vector<char> string not stl container. example, has no pop_back() or back() functions and last, not least, different member functions! string gives functions suitable strings, returnig null-terminated string c_str() bottom line: use string when need operate strings. use vector<char> when need ... well, vector of individual chars... another use of vector<char> way avoid vector<bool> specialization.

string - C++ std::basic_string/char_traits specialization -

this related to: std::basic_string specialization , circumventing template specialization i tried solution std::basic_string specialization , problem customchar typedef wchar_t , have redefinition(conflict specialization std). how may avoid usage of chart_traits when i'm not allowed change customchar typedef? you use boost's/c++0x's disable_if disable if there known previous instantiations, in case of char , wchar_t .

html - css positioning tables next to each other -

using html/css below have 3 tables. table 1 , 2 next each other on "same line" table 3 underneath break between them. however, when use float:left/right on first 2 tables, table 3 directly underneath , "touching" tables1/2? i have tried margin/clear/float , can't seem make things line :( any gratefully received. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>untitled page</title> <style type="text/css"> div.search { width: 80%; margin-right: auto; margin-left: auto; } div.search table { border: 1px solid black; border-collapse: separate; } div.search table.table1 { float: left; width: 45%; ...

css - Vertical alignment of ShareThis icons -

when using sharethis , icons display below baseline position. not good, when adjacent facebook , twitter icons. i added vertical-align rule sharethis spans , solved problem on ie , ff. chrome , safari still have vert align problem. example page . add vertical-align:top second span class stbutton instead first span .

php - Add a month in timestamp in each iteration -

here php code generate selectbox month names + year. have 2 time stamps using in loop start timestamp , end timestamp. now problem example if start-timestamp represent 01.07.2011 , in loop adding 30 days time stamp selectbox july displayed twice. , if add 31 day may month skiped. is there function available can add exact 1 month each iteration? <select name="checkinmonth" class="selectform" id="checkinmonth" > <?php for($month = $checkin_timestamp; $month <= $checkout_timestamp; $month += 30*60*60*24) { $checkin_month = getdate($month); $option_text = strftime("%b %y",$month); $option_value = strftime("%y%m", $month); $selected = ($checkin_selected == $option_value ? "selected='selected'" : ""); echo "<option value='{$option_value}' {$selected}>{$option_text}</option>"; } ?> </select> are looking ...

java - error in pom.xml -

i getting error below: for dependency dependency {groupid=weblogic, artifactid=webservices, version=9.2, type=jar}: system- scoped dependency must specify absolute path system path not sure wrong. have environment variable configured using in pom.xml when using system scope have provide absolute path dependency (as opposed other dependencies, searched in maven repositories). see system dependencies in introduction dependency mechanism . example: <dependency> <groupid>javax.sql</groupid> <artifactid>jdbc-stdext</artifactid> <version>2.0</version> <scope>system</scope> <systempath>${java.home}/lib/rt.jar</systempath> </dependency> why don't install third-party artifact in local/company repository? edit : if have systempath defined suspect environment variable not resolved, following error (note presence of variable in path): the project ... has 1 error 'de...

ruby on rails 3 - Extract just what is needed from params[:form] -

users can send reply feedback received. here form: <%= form_for :feedback, :url => reply_feedback_path |f| %> <%= f.text_area :reply, :size => '66x7' %><br> <%= f.submit "reply" %> <% end %> here controller: @reply = params[:feedback] usermailer.reply2_comments(@to_whom, @from_whom, @reply).deliver if types in 'yo' text box, passed mailer ' {"reply"=>"yo"} ' i'm having trouble syntax extract content typed. thanks. it looks you're passing hash mailer, , want value key "reply". try: @reply = params[:feedback] || {} usermailer.reply2_comments(@to_whom, @from_whom, @reply['reply']).deliver the main thing changed here changing @reply @reply['reply'] in mailer call (i added nil-check first line make sure @reply['reply'] won't cause error if don't submit form normal means)

servlets - How can I add more than 1 filter to persistence manager query in Java Google App Engine? -

i'm using java servlets develop google app engine application. need write query more 1 condition in clause. commented out line below gives me query_parsing error. there way add more 1 condition in clause? string query = "select " + human.class.getname(); query += " name == '" + request.getparameter("name") + "'"; //query += " , lastname == '" + request.getparameter("lastname") + "'"; list<human> humans = (list<human>) pm.newquery(query).execute(); i know possible jdo queries such below. however, version different. i'm using string object write query , execute persistence manager (please see above). query query = pm.newquery(employee.class); query.setfilter("lastname == lastnameparam"); query.setordering("hiredate desc"); query.declareparameters("string lastnameparam"); in first code snippet, believe issue word 'and', should ...

c# - How can I add a .Equals() extension to an enumeration? -

i have following code: public enum fieldtype { int, year, string, datetime } public enum datatype { int, string, datetime } i have extension method each can this: fieldtype ftype = fieldtype.year; datatype dtype = datatype.int; ftype.equals(dtype); //if ftype int/year, , dtype int should return true dtype.equals(ftype); //if dtype int, , ftype int/year should true is there way create .equals extension, work out? as jon said, reusing framework's method name not idea. but : public static class extensions { public static bool isequivalentto(this fieldtype field, datatype data) { return data.tostring() == field.tostring(); } public static bool isequivalentto(this datatype data, fieldtype field) { return data.tostring() == field.tostring(); } } or better : public static class extensions { public static bool isequivalentto(this enum e1, enum e2) { return e1.tostring() == e2....

c++ - I can't seem to add a close button using Qt::WindowFlags -

i have following code called when insert qmdisubwindow qmdiarea: qt::windowflags flags; flags = qt::widget | qt::windowminimizebuttonhint | qt::windowtitlehint; if(closeable) { qdebug("window closeable. %x", qt::windowclosebuttonhint); flags |= qt::windowclosebuttonhint; } for reason, when closeable true, closebutton won't display on widget's titlebar. this call insert widget qmdiarea. mdi->addsubwindow(widget, flags); any suggestions? i found playing around window flags example included sdk lot of when trying flags correct. c:\qtsdk\examples\4.7\widgets\windowflags\

connect to oracle db computer in a LAN in asp.net -

im trying connect oracle 11g db on lan system in asp.net. im getting ora-12541: tns:no listener error. i made following changes in files ..... sqlnet.ora sqlnet.authentication_services= (beq, tcps, nts) names.directory_path= (tnsnames, ezconnect) tnsnames.ora testdb = (description = (address_list = (address = (protocol = tcp)(host = 192.168.1.50)(port = 1521)) ) (connect_data = (server = dedicated) (service_name = testdb) ) ) listener_testdb = (address = (protocol = tcp)(host = localhost)(port = 1521)) listener.ora listener = (description_list = (description = (address = (protocol = ipc)(key = extproc1521)) ) (description = (address = (protocol = tcp)(host = 192.168.1.50)(port = 1521)) ) ) please let me know how can solve issue.... thanks... did start listener? on server: lsnrctl status : should tell if listener up lsnrctl start : should start default listener, assuming there n...

msbuild - Is it possible to add path to .dll in Visual Studio 2010 property sheet? -

i have visual studio 2010 , project uses third-party library. third-party librarys consists of header files, library files , .dll files. so, in order project include header files , link library files created , added following property sheet it: <?xml version="1.0" encoding="utf-8"?> <project defaulttargets="build" toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup> <_projectfileversion>10.0.30319.1</_projectfileversion> </propertygroup> <itemdefinitiongroup> <clcompile> <additionalincludedirectories> c:\sdk\superlib\include; %(additionalincludedirectories) </additionalincludedirectories> </clcompile> <link> <additionallibrarydirectories> c:\sdk\superlib\lib; %(additionallibrarydirectories) </additionallibrarydirectories> ...

deployment - sun.reflect.annotation.TypeNotPresentExceptionProxy error when deploy web-ear -

when try deploy ejd-ear, web-ear on glassfish server. added ejb client dependency in web project. ejb-ear deploys successfully. when try deploy web-ear, throws exception . sun.reflect.annotation.typenotpresentexceptionproxy java.lang.arraystoreexception: sun.reflect.annotation.typenotpresentexceptionproxy @ sun.reflect.annotation.annotationparser.parseclassarray(annotationparser.java:653) @ sun.reflect.annotation.annotationparser.parsearray(annotationparser.java:460) @ sun.reflect.annotation.annotationparser.parsemembervalue(annotationparser.java:286) @ sun.reflect.annotation.annotationparser.parseannotation(annotationparser.java:222) @ sun.reflect.annotation.annotationparser.parseannotations2(annotationparser.java:69) @ sun.reflect.annotation.annotationparser.parseannotations(annotationparser.java:52) @ java.lang.class.initannotationsifnecessary(class.java:3070) @ java.lang.class.getannotations(class.java:3050) @ org.glassfish.apf.impl.annotat...

.net - Does C# generics support type signature constraints? -

one of benefits c++ templates (implicitly) can require type signature (e.g. type t needs have function x takes no parameters , returns int). c# generics support similar? i aware of constraints based on base class or interface not looking for. (as c++ programmer learning c# might mistaken feature want in c#. comments on appriciated well...) nothing except constraints have seen (which do, fair, cover lot of common scenarios). there common workarounds: dynamic , in 4.0 manual duck-typing using either reflection or il generation etc none of these have static type-checking etc, though.

c# - WinForms - Embedding CNN Live Video URL -

i have c# winforms application , client has requested have streaming cnn video player integrated in it. cnn uses flash player located @ http://www.cnn.com/video/live/live.html?stream=stream1 however if embed webbrowser object , point @ url, web site wants fire popup outside of webbrowser control. if disable (using newwindow event handlers), throws javascript alert message. if allow it, opens new ie instance outside of application withe cnn video in it. the thought had recreate html , override javascript settings flash object (http://z.cdn.turner.com/cnn/.element/apps/cnnlive/2.1.6.2/assets/scripts/liveplayersettings.js) in order turn off popup flags. anyone have thoughts on way accomplish showing site while doing inside of application? ended hacking javascript cnn uses, dunno how long it'll last quickest way accomplish wanted without added overhead of other solutions. protected void webbrowser_progresschanged(object sender, webbrowserprogresschangedeventarg...

math - Probability Realization -

if have probabilities of x, y, , z events occurring, how can programatically realize choosing between these 3 events? example: pr(x) = 0.3 pr(y) = 0.2 pr(z) = 0.5 i'd function give me realization of these probabilities should choose y, or maybe z, etc. any pointers or references appreciated, thanks. if have function rand() returns uniform random number in [0,1] , then float r = rand(); if (rand < pr(x)) { return x; } else if (rand < pr(x)+pr(y)) { return y; } else { return z; } similarly, if can generate random integer between, say, 1 , 100, int r = rand(); if (rand < pr(x)*100) { return x; } else if (rand < (pr(x)+pr(y))*100) { return y; } else { return z; }

jquery - How not to Allow Cursor go into Input Automatically? -

i have form input 's. when it's opened (via jquery ui: dialog)... cursor (that think blinks after text type) automatically jumps first input ! ruins placeholder 's text , i'm looking way disallow cursor automatically focus on input or set input default 1 focusing-in. the offending code in open() function of ui dialog: $(self.element.find(':tabbable').get().concat( uidialog.find('.ui-dialog-buttonpane :tabbable').get().concat( uidialog.get()))).eq(0).focus(); it automatically gives focus first tabbable element in dialog. can make input untabbable setting property tabindex="-1" on <input> . hope helps

c++ - How to tell TCL and TK that default `.tcl` language files should be searched locally? -

when compile tcl/tk manually sources or install activestate following structure in tcl/tk installation folder: +- bin +- tcl85.dll +- tk85.dll //... +- lib/ +- tcl8.5/ //all tcl files (.tcl) +- tk8.5/ //all tk files (.tcl) //... so when compile app of yours , link tcl , tk dll's dll's search tcl/tk files in relative tham (to dll's) directory ../lib/tk8.5 , ../lib/tcl8.5. makes quite hard distribute app not having make end users install tcl , tk. i want distribute c++ app. i use cpptk default gui layout. i want make possible end users not have need in installing tcl , tk. want provide them folders tk , tcl .tcl source files located in directory relative app extras/tcl , extras/tk . how tell tk , tcl dlls source file folders are? tk , tcl api function names doing that? there special cpptk functions that? update tried donal fellows answer next folder structure. app/ +- app.exe +- tcl85.dl...