Posts

Showing posts from May, 2010

javascript - turn off css sheet on specific page -

i'm new jquery , i'm trying turn off specific css sheet when specific page loads. code i've been using , i'm not sure correct. if(location.pathname=="/mycart") >= 0){ $('link[rel=stylesheet][src~="/media/css/responsive.css"]').remove(); } the problem might path name check... also, instead of removing, try disabling stylesheet: if (location.pathname.indexof('/mycart') >= 0) { $('link[href*="/media/css/responsive.css"]').prop('disable', true); } edit: ~= selector looks space deliminated word, use *= selector instead. update (full code) <script> $(function () { if (location.pathname.indexof('/mycart') >= 0) { $('link[href*="/media/css/responsive.css"]').prop('disable', true); } }); </script>

osx - Sencha Cmd installation on Mac: Java not found -

trying install sencha command 3.1.1 on imac (10.8.3). installer saying: the installer not find valid java(tm) on machine. supported versions: vendor : min. 1.6.0 max. following stack overflow thread, tried linking /usr/bin/java /library/internet plugins/javaappletplugin.plugin/contents/home/bin/java. now, on command line: ~ 🍔 java -version java version "1.7.0_21" java(tm) se runtime environment (build 1.7.0_21-b12) java hotspot(tm) 64-bit server vm (build 23.21-b01, mixed mode) so looks good, installer still complains cannot find java. why can't it? what fixed me, after consulting sencha support, installing full jdk rather jre. don't know why fixed it, or root cause was, command installed , working fine.

Analyze audio input from microphone Javascript -

i planning create music visualizer on website. there objects should change in size, , shape based off of current music playing (a non-classical, multi-line song probably, such don't stop believing). want @ least able know volume of music , if possible, pitches can picked (is fft possible in javascript?). there sound api's out there that let me in javascript, or @ least online? yes, possible web audio api. check out audio input demo on http://webaudiodemos.appspot.com/ . don't need perform fft - web audio api you.

loops - printing output in assembly x86 -

i have code: include irvine32.inc .data arry byte ? prompt1 byte "enter first hex number: ",0 prompt2 byte "enter second hex number: ",0 prompt3 byte "the sum ",0 prompt4 byte "the sum out of range ",0 prompt5 byte "convert again? [y/n]: ",0 prompt6 byte "first number invalid ",0 prompt7 byte "second number invalid ",0 .code main proc readinput: l1: mov edx, offset prompt1 call writestring mov edx, 0 call readhex call crlf mov ecx, eax jmp l3 l2: mov eax, 0 mov edx, offset prompt2 call writestring mov edx, 0 call readhex call crlf mov ebx, eax mov eax, 0 jmp l4 l3: cmp ecx, 0ffffh ja l5 jbe l2 l4: ...

Passing scalar and array data in C++ with pointers -

i have programmed many years in fortran , trying learn c++ , transfer old programs c++. need able create array in function , pass main program variable using pointer opposed having transferred value traditional in c++. including example in question variables *var1 , *varr , *array created , data passed main program , program works fine. however, if turn *array *array[1] or larger dimension array multiple values program not work. can action completed in c++ or forced incorporate function main program data available in main program? appreciated! first example(this 1 works) #include<iostream> using namespace std; void test(int *var1,int *varr, int *array); int main() { int var,var2,array1; test(&var,&var2,&array1); cout << var << "\n"; cout << var2 << "\n"; cout << array1 << "\n"; return 0; } void test(int *var1, int *varr, int *array) { *var1=20; *varr=30...

android - Obtaining facebook cover photos -

how can cover photo of albums of user in application? currently, have json this: "id": "00000", "albums": { "data": [ { "id": "428076573767", "from": { "name": "benjamin", "id": "00000" }, "name": "profile pictures", "link": "https://www.facebook.com/album.php?fbid=00000&id=00000&aid=00000", "cover_photo": "10151465301937683", "privacy": "everyone", "count": 57, "type": "profile", "created_time": "2010-09-05t08:42:19+0000", "updated_time": "2013-04-27t23:53:11+0000", "can_upload": false }, } how can cover_photo url? you can cover photo adding url. no n...

c# - Is there a quick way to set all columns of DataGridView invisible? -

i don't want loop through columns , set each column's visible false. wonder if there quick way so. thank you! datagridview.autosizecolumnsmode = datagridviewautosizecolumnsmode.none; datagridview.autosizerowsmode = datagridviewautosizerowsmode.none; (int = 0; < datagridview.columns.count; i++) { datagridview.columns[i].visible = false; }

sql server - How can I get the data with select query with not writing all columns extenally and date formating is possible -

i have stored procedure fetches data registered users want date of birth change in format mm/dd/yyyy . can convert function how fetch record select query? need write vales separately or can fetch simple select query , @ same time change date format well? create procedure getall begin select * tbl_regis end create procedure getall begin select convert(varchar(20), dob, 103) dob tbl_regissadhak end you should specify columns want , have apply conversion on every column want converted.

java calculate pregnancy algorithm -

this question has answer here: calculating difference between 2 java date instances 43 answers hello trying calculate how many days left in pregnancy term think algorithm incorrect public int getdayspregnantremainder_new() { gregoriancalendar calendar = new gregoriancalendar(); calendar.set(calendar.hour_of_day, 0); calendar.set(calendar.minute, 0); calendar.set(calendar.second, 0); long diffdays = 280 - ((getduedate().gettime() - calendar.gettime() .gettime()) / (24 * 60 * 60 * 1000)); return (int) math.abs((diffdays) % 7); } i basing off of 280 day term, getduedate() date object , gettime() returns millisecond unix time on real world days number reported off one, sometimes, , starting think algorithm wrong, or millisecond time gradually further , further off, or millisecond time not precise enough, or gregorian calendar function rounds...

r - How do I get a 2D spectrograph given a data.frame? -

Image
i have data in file following format: timings measurements 0.12 -32.0 0.15 -5.0 0.18 7.2 (and on, it's tab-deliminited file) as new r, (indeed, downloaded first time today), how display nice spectrograph shown on pages such http://www.qsl.net/d/dl4yhf///////speclab/specdisp.htm i've tried tsa::periodogram, , genecycle::periodogram, while seem compute fft me, , display periodogram, want have proper spectograph, not yet confident statistics , don't know if "raw" periodograms or not. for record, how i've displayed periodogram far: a = read.table("~/myfile.csv", fileencoding="ascii", header=true) tsa::periodogram(a$measurements) however ignores a$timings, reason i'm not satisfied results have. for reference, here type of spectrograph want:

checking file size in a remote server using python, SSH -

someone please help! im writting python script retrieve file size in local pc , remote server. then, is, compare if file's size same. below code : a = "/path/of/the/file/in/my/local/pc" b = "/path/of/the/file/in/remote/pc" statinfo1 = os.stat(a) statinfo2 = os.system ("ssh" " root@192.168.10.1" " stat -c%s "+b) if statinfo1 == statinfo2 : print 'awesome' else : break problem encountered : statinfo1 able return file size in local pc, statinfo2 not able return file size.. please help? want use ssh method why dont use paramiko sshclient . nifty third party library simplifying ssh access. so check file size of remote file code - import paramiko, base64 b = "/path/of/the/file/in/remote/pc" key = paramiko.rsakey(data=base64.decodestring('aaa...')) client = paramiko.sshclient() client.get_host_keys().add('ssh.example.com', 'ssh-rsa', key) client.connect('192...

uilabel - Adding a line break to a string from plist in iOS -

i need add line break string, obtain plist. string passed uilabel presented on screen. example, text "adding line break string plist in ios" need line break after word break. i have added "\n" , hence text became "adding line break \n string plist in ios". ensured numberoflines = 0 uilabel . but can't see line break , text "\n" appears in text itself. need guidance on this.. thanks.. edit: [photo setcaption:[nsstring stringwithformat:@"%@",[[galleryarray objectatindex:index] objectforkey:@"title"]]]; the plist file requires actual newline character in string value. can't enter 2 characters \ , n . treated newline character compiler. bring plist file in xcode , edit string value. enter newline, press option-return on keyboard instead of return . now when load string value nsstring in app, newline part of string value. , when set @ text of label, newline appear (assuming label setup show...

How to get particular level of category in magento 1.7.0.2 -

i using magento 1.7.0.2 want level of category. for example, have categogory tree following allcategory->mobile->samsung allcategory->clothing->men allcategory->laptop->dell here want access second level category means mobile,clothing,laptop so how that please me thank in advance. $categories = mage::getmodel('catalog/category') ->getcollection() ->addattributetoselect('*') ->addisactivefilter() ->addattributetofilter('level',2) basically add ->addattributetofilter('level',2)

regex - Java Camel case apostrophe issue -

can please regarding camel casing strings contain apostrophes, whereby don't want next letter after apostrophe put upper case. my code reads txt file , processes accordingly. for example "matthew smith" converted "matthew smith" "matthew s'mith" converted "matther s'mith" when should "s'mith" public static string tocamelcase(string tmp){ pattern p = pattern.compile(camel_case_reg_exp); matcher m = p.matcher(tmp); stringbuffer result = new stringbuffer(); string word; while (m.find()) { word = m.group(); result.append(word.substring(0,1).touppercase()+word.substring(1).tolowercase()); } return result.tostring(); } public static final string camel_case_reg_exp = "([0-9]+)?([a-za-z]+)(\\')?(\\-)?(\\s)?"; thanks in advance. try regex public static final string camel_case_reg_exp = "\\s*\\s+\\s*"; it produces ...

android - How to access class in another project using eclipse? -

i developing android app using eclipse creating data access layer java project. trying access class android app. have added java project build path of android project. can able access class importing . while running app getting classnotfoundexception. it may seems duplicate new eclipse , java , did not understand trying explain in other questions. need here. please put jar file dataacesslayer project in libs folder of android project

Error 500 with Google AppEngine, and class java.net -

i have problem gae. have application http://www.similarityface.appspot.com/query . trying through program in java communicate application perform query, via post method. problem generating 500 error. code below, me telling i'm doing wrong. public class vetores_facebook { public static void main(string[] args) throws unsupportedencodingexception, ioexception { final string server = "https://www.similarityface.appspot.com/query"; url url = null; try { url = new url(server); } catch (malformedurlexception ex) { logger.getlogger(vetores_facebook.class.getname()).log(level.severe, null, ex); } httpurlconnection urlconn = null; try { // url connection channel. urlconn = (httpurlconnection) url.openconnection(); } catch (ioexception ex) { logger.getlogger(vetores_facebook.class.getname()).log(level.severe, null, ex); } urlconn.setdooutput (true); // no caching, want...

c# - Extracting data templates in user controls -

there known problems setting caliburn binding in datatemplates . in this answer eisenbergeffect suggests extracting data templates user control . how can achieved? in user control have lots of datatemplates , ran problems. conventions not applied , have use "classical" binding . i imagine extract whole control datatemplate , give me lots of smaller controls, see no way extract datatemplate . here example xaml <grid> <grid.resources /> <grid.rowdefinitions> <rowdefinition height="10*" /> <rowdefinition height="2*" /> <rowdefinition height="1*" /> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="1*" /> </grid.columndefinitions> <border horizontalalignment="stretch" borderbrush="transparent" borderthickness="0"> ...

javascript - Fade in & Fade out not working in the below code -

hello not excellent techie , came code redirection of pages correctly.i tried executing it,but not fix fade out , fade in property. could me out working functionally. the code used implementation <head> <script type="text/javascript"> <!-- function delayer(){ window.location = "../safari-index -black/page3.html" } //--> $("#page").fadeout(2000); </script> </head> <body> <body onload="settimeout('delayer()', 36000)"> </body> thanks call fadeout in window.load $(function(){ $("#page").hide().fadein(2000); settimeout(function(){ $("#page").fadeout(2000); }, 30000); }); and add <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> </head> to head tag

python - How to get the id (not pk) from mongoengine models? -

my models class result(document) : id = intfield() turn = intfield() url = stringfield() the id not primary key. as know, mongodb generate key named '_id'. use 'id' means. in django, id or pk means primary key. so, how can field want mongodb through django? thx~ currently id reserved primary key - can't reused non primary key.

android - Prevent code execution in Eclipse Graphic Layout preview -

i want draw custom view, have draw method: @override public void ondraw(canvas canvas) { paint.setstyle(paint.style.fill); canvas.drawcolor(color.white); paint.setcolor(color.red); if(!path.isempty()) canvas.drawpath(path, paint); } in eclipse graphic layout preview nullpointerexception. (because of course graphic layout preview path null). there way (for example using @ or other instructions) prevent graphic layout preview execution of canvas.drawpath(path, paint); try this @override public void ondraw(canvas canvas) { paint.setstyle(paint.style.fill); canvas.drawcolor(color.white); paint.setcolor(color.red); if(path != null && !path.isempty()) canvas.drawpath(path, paint); }

How to handle ListView click in Android -

how listen click event on listview? this have now listview list = (listview)findviewbyid(r.id.listview01); ... list.setadapter(adapter); when following list.setonitemselectedlistener(new adapterview.onitemselectedlistener() { public void onitemselected(adapterview parentview, view childview, int position, long id) { setdetail(position); } public void onnothingselected(adapterview parentview) { } }); that doesn't seem on click. , code live within class extends activity. on list view, use setonitemclicklistener

java - Any JSTL or Spring methods that handles URL like this? -

so have jstl tags following <a href="${urlheader}hfv/${currow.posttitle}"> </a> if currow.posttitle "test test" , when click link, posttitle segment of url becomes "test%20test". want "test_test" instead. does have done before data has been passed view or can available jstl or spring tags? thanks. there jstl tag in "functions" called replace can use this. works string.replace . example shows, can this: ${fn:replace(url, " ", "_")}

iphone - Issues in using custom keyboard in ios -

i have downloaded sample project this link using custom keyboard. it works perfectly. but, when used in project returns error - -[uiview playkeyboardclick]: unrecognized selector sent instance 0x71d6390 what had done - i added new viewcontoller files nerdkeyboard.h , nerdkeyboard.m , uiview files nerdkeyboardview.h , nerdkeyboardview.m . , pasted same coding sample project , same design in xib. but when click button in nerdkeyboard.xib file returns error terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[uiview playkeyboardclick]: unrecognized selector sent instance 0x71d6390' *** first throw call stack: (0x1c92012 0x10cfe7e 0x1d1d4bd 0x1c81bbc 0x1c8194e 0x2769 0x10e3705 0x172c0 0x17258 0xd8021 0xd857f 0xd76e8 0x46cef 0x46f02 0x24d4a 0x16698 0x1beddf9 0x1bedad0 0x1c07bf5 0x1c07962 0x1c38bb6 0x1c37f44 0x1c37e1b 0x1bec7e3 0x1bec668 0x13ffc 0x1ebd 0x1de5) libc++abi.dylib: terminate called throwing exception if want see co...

ruby on rails - XML Class for the partial file used in a Nokogiri class XML -

using rails 3.0.7 , ruby 1.9.2. i using nokogiri build custom xml. calling partial builder file in main view file. class being used in partial xml not nokogiri. can explain why xml class not nokogiri ? index.xml.erb <%= nokogiri::xml::builder.new(:encoding => 'utf-8') { |xml| puts "xml class in main file #{xml.class}" xml.users { @users.each |user| xml << render(:partial=>"users/user", :locals=>{:user=>user, :xml => xml}) end } }.to_xml.html_safe %> _user.builder puts "xml class in builder file #{xml.class}" xml.user { xml.id user.id xml.name user.name xml.email user.email } in application.rb, using : activesupport::xmlmini.backend = 'nokogiri' output : xml class in main file nokogiri::xml::builder xml class in builder file builder::xmlmarkup iiuc activesupport::xmlmini.backend = 'nokogiri' parsing xml params nokogiri instead of rexml, not builder t...

apache - FilterDeclare not allowed here -

i'm trying perform vanilla bonfire installation (as mentioned here ) , keep getting 500 error . however, when opened server logs i'm seeing error message : [tue may 21 09:24:05 2013] [alert] [client 127.0.0.1] /users/drkameleon/sites/bft4u/.htaccess: filterdeclare not allowed here obviously, culprit somewhere in following .htaccess lines, though not know how fixed : # ---------------------------------------------------------------------- # gzip compression # ---------------------------------------------------------------------- <ifmodule mod_deflate.c> # force deflate mangled headers developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping/ <ifmodule mod_setenvif.c> <ifmodule mod_headers.c> setenvifnocase ^(accept-encodxng|x-cept-encoding|x{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[x~-]{4,13}$ have_accept-encoding requestheader append accept-encoding "gzip,deflate" env=have_accept-encoding ...

java - Getting org.hibernate.util.JDBCExceptionReporter: Connection reset by peer: socket write error -

i'm using hibernate, spring, jboss , microsoft sql server 2008 r2. @ seemingly random times error error [http-0.0.0.0-8080-7] org.hibernate.util.jdbcexceptionreporter [jdbcexceptionreporter.java:101] connection reset peer: socket write error 2013-05-20 14:43:51,171 error [http-0.0.0.0-8080-7] org.hibernate.transaction.jdbctransaction [jdbctransaction.java:202] jdbc rollback failed com.microsoft.sqlserver.jdbc.sqlserverexception: connection closed. @ com.microsoft.sqlserver.jdbc.sqlserverexception.makefromdrivererror(sqlserverexception.java:170) ~[sqljdbc4.jar!/:na] @ com.microsoft.sqlserver.jdbc.sqlserverconnection.checkclosed(sqlserverconnection.java:304) ~[sqljdbc4.jar!/:na] @ com.microsoft.sqlserver.jdbc.sqlserverconnection.setautocommit(sqlserverconnection.java:1592) ~[sqljdbc4.jar!/:na] @ org.jboss.resource.adapter.jdbc.basewrappermanagedconnection.checktransaction(basewrappermanagedconnection.java:545) @ org.jboss.resource.adapter.jdbc.wrappedconnection.checktransaction...

php - Selecting file to be edited -

i have application used edit .txt files. application made of 3 parts displays contents of folder files edited(each file link when clicked opens on edit mode). writing in file. saving file. part 2 , 3 have completed using fopen , fwrite functions wasn't hard. part need part 1 open file inputing location , file name in php file have display function , save function: $relpath = 'file_to_edit.txt'; $filehandle = fopen($relpath, 'r') or die("failed open file $relpath ! "); but want file open in edit mode when clicked instead of typing in files name every time. $directory = 'folder_name'; if ($handle = opendir($directory. '/')){ echo 'lookong inside \''.$directory.'\'<br><br>'; while ($file = readdir($handle)) { if($file !='.' && $file!='..'){ echo '<a href="'.$directory.'/'.$file.'">'.$file.'<...

jquery - Autocompletion keeps history on the inputfield and sends multiple requests -

i have following code: $("#city").on('change', function() { $("#keyword").autocomplete('<?php echo base_url();?>index.php/formhandler/autocomplete', { width: 300, matchcontains: true, extraparams: { data: $("#city").val() } }); }); here html: <select id="city" name=""> <option selected value="">--select city--</option> <option value="1">city1</option> <option value="2">city2</option> </select> <input id="keyword" name="" type="text" placeholder="search" style="width:300px;"/> i want autocomplete keywords field according city selected, problem autocompletion sends multiple requests (it sends latest city id along previous data selected). when look...

.htaccess - Redirect dynamic url to static url using htaccess -

i have following type of dynamic urls. http://example.com/interviews/sample1/data.xml http://example.com/interviews/sample1234/data.xml http://example.com/video/video-2/data.xml in here interviews, sample1, sample1234, video, video-2...etc dynamic names. want redirect dynamic urls following static url . http://example.com/data.xml regards try: redirectmatch ^/.+/data.xml$ /data.xml or using mod_rewrite: rewritecond %{request_uri} !^/data.xml$ rewriterule /data.xml$ /data.xml [l,r]

Mysql function to return row count from a procedure call -

this question has answer here: how can number of rows 'returned' result set of stored procedure 2 answers i trying write function return number of rows call stored procedure return. i'm trying minimise repetition of code (for reduced code maintenance/debugging- procedure select long). the stored procedure read-only selects rows matching criteria (vague know details should not material question). i copy procedure function , change select count() long multiple joins hoping write function call procedure , return row count. goal not optimised running efficient code maintenance, boiler plate reduction. i have tried test: delimiter // create procedure if not exists proc_select1() begin select 1; end // create function if not exists select1_count() returns int unsigned begin call proc_select1(); return found_rows(); end // delimiter ; h...

java - Get height of a component in JSF -

i using primefaces in webapplication , wonder if there way height of specific component in xhtml . in example have (from database) generated <p:tieredmenu> , need know height of component layout other components. looked in facescontext haven't found relevant problem. maybe can give me hint how find settings. the height dependent on how browser has rendered this. you can check in javascript $('#myelement').height() see also: css / javascript - how rendered height of element?

video streaming - Decoding mpeg4 frames failure using Media Foundation -

i trying decode mpeg4 frames using media foundation no luck. using mftrace i've found decoder keeps requesting samples produces no decoded image. mftrace log highlights decoder returns need more input. currently sending keyframes decoder. properties have been set correctly. is there wrong mpeg4 decoder on windows 7 machine or doing wrong. any ideas or suggestion helpful have been stuck problem on week now. thanks

Java - Finding frequency and amplitude of audio signal using FFT -

after reading no. of posts here have applied fft algorithm on recorded audio(.wav) file transform time domain frequency domain. as result have got array containing values as magnitude[i] = sqrt(re*re+im*im); now title says have find frequency , amplitude of signal(complex sound i.e voice) using magnitude array, have no idea of how further processing using array.the size of fft 1024 , sample rate 48000hz. please me further processing. if you're looking single largest (sinusoidal) component scan through magnitude array until find maximum value, , convert index of value corresponding frequency, i.e. mag_max = magnitude[0]; i_max = 0; (i = 1; < n; ++i) { if (magnitude[i] > mag_max) { mag_max = magnitude[i]; i_max = i; } } you have value of peak in mag_max , index in i_max . can frequency this: f_max = i_max * fs / n; where fs sample rate (and n fft size of course). of course if you're looking pitch of complex sound...

html5 - Ipad websiteData under settings -

when website data under safari->settings->advance->website data gets populated. facing problem because of that. , there way(progrmatically) can avoid getting populated. i using ipad 4. , have created mobile web site html5 app cache feature thanks. with best regards, sajesh nambiar found issue...html5 app manifest causing problem....safari browser caches page when network slow causing issue.

android - Align base line of textviews in two different layouts -

Image
i want align baselines of tow textviews placed in 2 different relativelayouts . following code using: <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right"> <textview android:id="@+id/tv_city_a" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="city"/> </relativelayout> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:id="@+id/tv_city_b" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignbottom=...

c# - What's wrong in this interface use? -

suppose have interface this: interface myinterface { public string aproperty { get; set;} public void amethod () } this interface used inside interface: interface anotherinterface { public myinterface member1 { get; set; } public int yetanotherproperty {get; set;} } now suppose have 2 classes, 1 implements each of interfaces. class myinterfaceimpl : myinterface { private string aproperty public string aproperty { //... , set inside } public void amethod () { //... } } and @ last: class anotherinterfaceimpl : anotherinterface { private myinterfaceimpl _member1; public myintefaceimpl member1 { //... , set inside } ...other implementation } why compiler complain anotherinterfaceimpl not implement myinterface ? i understand basic question... need serialize xml anotherinterfaceimpl , cannot if member1 of type myinterface. your class anotherinterfaceimpl not implementi...

html - Replace an image wherever it is used - Javascript -

i'm looking way replace image used anywhere on page. so if have example html page this: <html> <head> </head> <body> <img id="1" src="example.com/img/1889.png"> <div style="background: url('example.com/img/1889.png')"> <div> <a> <img id="2" src="example.com/img/1889.png"> </a> </body> </html> where ever - example.com/img/1889.png - appears, must replaced else. edit unfortunately can't use javascript libraries. browser plugin. nor can use browser specific apis there might syntax errors here, try like: <script> var imgs = document.getelementsbytagname("img"); (var = 0; < imgs.length; i++) { if (imgs[i].src == "oldimg") imgs[i].src = "newimg"; } } var divs = document.getelementsbytag...

android - collapse searchview after submit -

i using searchview in application ( without action bar). how can collapse searchview after query text submit ? i have these listeners ; @override public boolean onquerytextsubmit(string query) { inputmethodmanager imm = (inputmethodmanager)thisfr.getsystemservice(context.input_method_service); imm.hidesoftinputfromwindow(globalsearch.getwindowtoken(), 0); return false; } @override public boolean onquerytextchange(string newtext) { // todo auto-generated method stub return false; } i don't use actionbar don't have function collapseactionview() . waiting help thanks you can way in activity, tested actionbarsherlock (it hides keyboard, make sure return false in onquerytextsubmit): private menuitem searchmenuitem; public menuitem getsearchmenuitem() { return searchmenuitem; } @override public boolean oncreateoptionsmenu(menu menu) { // .....

.net - C# Delegate as object -

disclaimer: unit-test related info question not relevant - can skip "the problem" if you're not familiar this, helps set context. i have class need unit-test. looks this: public class numberparser { public static void checkbyterange(string str){...} [...] public static void checkfloatrange(string str){...} [...] } i want use nunit parametrized unit-test test these methods. here's test method: [testcasesource("checkrange_overflow_inputs")] public void checkrange_overflow(string value, action<string> method) { assert.throws<exception>(() => method(value)); } the test uses testcasesourceattribute specify field contains list of sets of arguments test method. now, nunit expects field called checkrange_overflow_inputs , of type object[] , contains object[] elements, each of contains values arguments test method. the problem: ideally, i'd write field this: private static readon...

Recording outgoing call after receiving by the receiver from my Android application? -

i want make call recording application user can record outgoing call. have done it. 1 little problem, call recording when starting dial number. want , call recorded when receiver receive it. otherwise no sound recorded. means, want sound free disgusting dialing tone. sample code of application given below. //service @override public void oncallstatechanged(int state, string phonenumber) { switch (state) { case telephonymanager.call_state_ringing: log.d(tag, "call_state_ringing"); break; case telephonymanager.call_state_offhook: log.d(tag, "call_state_offhook"); isoffhook = true; try { toast.maketext(context, "recording started", 10000).show(); toast.maketext(context, "recording stop when call diconnected", 10000).show(); startrecord(); } catch (...

How to visualize java code using UML notations inside Eclipse? -

is possible visualize java codes using uml notations inside eclipse? there pluggin available java? soyatec euml one. relatively round-trip engineering. it's commercial 'though, relaxed license (i.e. basic edition free commercial projects - check legal text see if comply) . also, note adds additional files projects (gmf files mostly), custom annotations code. reasonably job.

how to search for exact string in Ruby -

what ruby code equivalent following mysql query? i'm trying search exact match of string eg.'main' , 'main' should treat different. select userid sys_users binary userid='main' it's like: sysuser.select('userid').where('binary userid=?', 'main')

url - how to configure connection to the database in clouds services -

i have surfed web 2 days looking better way configure application uploading appfog connects mysql database in cloud. i have created mysql service , did bind application. created tables , put data on them using local console ( using af tunnel mydatabase ) in linux but apps not seem find database. application uses jdbc ... used database username , password , databasename given me console (those funny chars in screen) , did not work. put own credentials, still, no success... i tried using url points application @ port given on console, still... actually, put in details showed on console connect database in cloud after deploying ... app seems not find database , tables.... i not know wrong... please help.. more: this code used try connection: try { string connectionurl = "jdbc:mysql://http://someapp.aws.af.cm:10000 /onlinepassword"; class.forname("com.mysql.jdbc.driver"); conn = drivermanager.getc...

sql server - Update data during insert in a Trigger and then insert -

i have situation where, have 10 columns in table. inserting 5 columns program , 5 columns, want create trigger. possible? , if yes, how do that? col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 create trigger fill_trigger on db after insert begin -- set nocount on added prevent result sets -- interfering select statements. set nocount on; -- insert statements trigger here declare @col6 int declare @col7 int -- , on. set @col6 = (select col1 inserted) * (select col2 inserted) set @col7 = (select col3 inserted) * (select col4 inserted) --is possible following? update inserted set col6 = @col6 update inserted set col7 = @col7 end go you shouldn't use locsal variables in trigger because makes "single row only" also, assume have primary key called keycolumn. , table called "db". create trigger fill_trigger on db after insert begin set nocount on; update db set col6 = i.c...

cryptography - How decrypt keccak algorithm -

i preparing presentation keccak ( http://keccak.noekeon.org/ ). in presentation, encrypt plain-text – brings following questions: what exact role of padding function (how obtain cube of 1600 bits 64 bit)? after encrypting text, how can decrypt again? you cannot "decrypt" output of keccak, since isn't encryption algorithm, 1 way hash function. instead, use verifying hash value indeed hash output of particular text (which must know already), calculating hash of text, , comparing output first hash value.

Python (learn python the hard way exercise 35) -

i'm working on zed shaw's learn python hard way. in exercise 35 , 1 finds program includes these lines: def bear_room(): print "there bear here." print "the bear has bunch of honey." print "the fat bear in front of door." print "how going move bear?" bear_moved = false while true: next = raw_input("> ") if next == "take honey": dead("the bear looks @ slaps face off.") elif next == "taunt bear" , not bear_moved: print "the bear has moved door. can go through now." bear_moved = true elif next == "taunt bear" , bear_moved: dead("the bear gets pissed off , chews leg off.") elif next == "open door" , bear_moved: gold_room() else: print "i got no idea means." all good. i'd give player chance surv...

javascript - How to configure shortcut keys in CK EDITOR 4. Not finding Plugin for Keystrocks -

i want disable key in ck editor. i using ckeditor 4.0 & want disable shortcuts keys in ckeditor. e.g. file opens on alt + 0 in old version config available in source/plugins/keystroks/plugins.js not availble in new version. using config.keystrokes can add , remove keystrokes. from documentation: // disable default ctrl + l keystroke executes link command default. config.keystrokes = [ ... [ ckeditor.ctrl + 76, null ], // ctrl + l ... ];

ios - GCDAsyncSockets, get answer -

i'm trying test server connection gcdasyncsocket. https://github.com/robbiehanson/cocoaasyncsocket i want connect ip + port , message, whether worked, or not. i'm far right now. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. dispatch_queue_t mainqueue = dispatch_get_main_queue(); asyncsocket = [[gcdasyncsocket alloc] initwithdelegate:self delegatequeue:mainqueue]; nsstring *host = @"www.google.de"; uint16_t port = 21; nserror *error = nil; if(![asyncsocket connecttohost:host onport:port error:&error]) { nslog(@"error %@!!!", error); } else{ nslog(@"no error %@!!!", error); } [asyncsocket writedata:@"data" withtimeout:3 tag:0]; return yes; } but how can check whether data written or not? if(![asyncsocket connecttohost:host onport:po...

ibm mobilefirst - Worklight authentication: multiple realms -

want check approach reasonable. @ first sight seems work. scenario have different classes of users, when validating credentials can determine class. plan have "master" realm manages authentication , subsidiary realms use control access particular adapter procedures, example "gold". we can protect procedureordinary() realm master , procedurespecial() realm gold. in master authenticating code (derived doublestepadapter example) can write wl.server.setactiveuser("master", useridentity); if ( criteria met ) wl.server.setactiveuser("gold", useridentity); we never set challenge handler gold realm, authentication realm handled via master realm. any issues idea. technically - work. big assumption here user never try access procedure protected "gold" realm before authenticating. overcome problem i'd recommend following approach - need define login-function , logout-function each realm. make sure of login-functio...

matlab - How to make AT command to automatically return caller ID? -

so, i'm using @ commands matlab return caller id. work, have manually ask it. return caller id automatically whenever ring on phone. here write before ring: >> s = serial('com8'); >> fopen(s) and type when phone rings: >> fwrite(s, [65 84 43 67 82 67 61 49 13]) then ask returned value(the caller phone number): >> s serial port object : serial-com8 communication settings port: com8 baudrate: 9600 terminator: 'lf' communication state status: open recordstatus: off read/write state transferstatus: idle bytesavailable: 47 valuesreceived: 0 valuessent: 18 >> fread(s, 47) and returns me 47 ascii numbers this(note have deleted of returned code): ans = 65 84 43 67 82 67 61 49 13 which translates following(changed number safety reasons): ...

sublimetext2 - Opposite of "wrap selection with tag" in Sublime Text 2 -

is there smarter way of removing tag (let's using html) around selection in sublime text 2? example if have span tag around text , want remove both start , end of tag (and leave text inside untouched)... or alternative - remove current tag , it's corresponding end tag? the emmet plugin (once called zen coding) can want. install , press ctrl+shift+; within tag's contents unwrap tag.

footer is npt displaying in joomla -

i facing problem website, footer of website not displaying in internet explorer except home page, website built in joomla, although displaying fine in other browsers, kindly me website www.gautampolymers.com sandeep kumar the footer visible (and looks good) on firefox 24, internet explorer 9 , 8 (i tested windows 7 32-bit). looked @ 'code', there isn't (like javascript accesses or css properties) hide footer. here's proof works on internet explorer 8: http://i.stack.imgur.com/ijsyo.png

ios - Using EDK with framework -

i trying implement mopub in game. since mopub gives complete source code, i've compile static library. static libraries giving trouble while making extension. , takes me 4-7 days building simple extension ios. thinking if there's way can use custom framework instead of static library? create edk extension , in mkf file put string iphone-link-opts="-framework frameworkname" deploy section. in extension create function work native static library. framework static library must in frameworks path in marmalade or can define framework path iphone-link-opts="-f$marmalade_root/modules/frame/work/path -framework frameworkname" .

Java awt.list ActionListener single click -

i have list of cities. when click on city shows current time, date etc.. city however updates when double click on city how go changing single click thanks @override public void itemstatechanged(itemevent e) { set<string> countries = regionmap.get(listregion.getselecteditem()); listsubregion.removeall(); for(string country : countries) { listsubregion.add(country); } selectedregion = listregion.getselecteditem(); listsubregion.validate(); listsubregion.repaint(); repaint(); } try this: list.addmouselistener(new mouseadapter() { public void mouseclicked(mouseevent e) { if (mouseevent.getclickcount() == 1) { // single click int index = thelist.locationtoindex(mouseevent.getpoint()); if (index >= 0) { object o = thelist.getmodel().getelementat(index); ... ... } } } });

python - Django ListView painfully slow using Haystack -

how speed haystack -search powered (using whoosh backend) paginated django list view? i had simple listview like: class personlistview(listview) template_name = 'person-list.html' paginated_by = 10 def get_queryset(self): return person.objects.all() returning page 3000 results runs in 1 second on localhost. i "plugged in" haystack allow full-text searching on names doing: class personlistview(listview) template_name = 'person-list.html' paginated_by = 10 def get_queryset(self): #return person.objects.all() return searchqueryset().models(models.person) and setup appropriate index , run manage.py rebuild_index : class personindex(indexes.searchindex, indexes.indexable): text = indexes.charfield(document=true, use_template=true) nickname = indexes.charfield() first_name = indexes.charfield() middle_name = indexes.charfield() last_name = indexes.charfield() def get_model(sel...

java - JUnit4 : Test a shutdown hook is called -

i have method adds shutdown hook. need test (via junit) code executed in hook called : public void mymethod(){ runtime.getruntime().addshutdownhook(new thread() { @override public void run() { ... code test ... } }); } how can simulate shutdown in unit test ? i don't think you'll able test that. instead, test code behaves correctly when invoked (by unit testing separately). then, trust java invoke code @ right time. i.e. extract code separate class extends thread , test behaviour executing run() in unit test.

dictionary - Python throws SyntaxError on this code -

while 1: dic = {} #empty dictionary used storing data dic[raw_input("enter value want store: ")] = input("enter access key of value: ") ans = raw_input("exit:e ; store variable : s; acces variable: a") if ans=="e": break; #exit main loop elif ans == "s": continue; elif ans=="a": pass; please help you using input() instead of raw_input() ; interprets input python expression. easy make throw syntaxerror exception: >>> input("enter sentence: ") enter sentence: quick brown fox traceback (most recent call last): file "<stdin>", line 1, in <module> file "<string>", line 1 quick brown fox ^ syntaxerror: invalid syntax use raw_input() throughout instead: dic[raw_input("enter value want store: ")] = raw_input("enter access key of value: ") you want turn these 2 quest...

how to concatenate (part of) variable to String in XSLT -

i see first couple of characters of variable 'vari' concatenated string abc=' here: href="{concat('abc=', substring-before('vari', '='))}" here whole snippet: <xsl:template match="report:subelement"> <tr> <td> <message> <xsl:variable name="vari" select="."></xsl:variable> <xsl:copy-of select="." /> </message> </td> <td> <button type="button" onclick="window.location.href=this.getattribute('href')" href="{concat('abc=', substring-before('vari', '='))}" >kill thread</button> </td> </tr> </xsl:template> that trivial question learning xslt. you quite close, but: access value of variable have use dollar ( $ ) prefix. not put v...