Posts

Showing posts from June, 2013

html - CSS percentage values higher than 100% -

layering file input field on button box-shadow, found myself wanting use 110% height on input, covers shadow part. it works well. but: correct, legal , valid css according standards? testing percentages higher 100% in css validator gave me no validation errors, should ok, see yourself: http://jigsaw.w3.org/css-validator sometimes define containers 200% width can animate fluid divs across screen, , have not encountered issues far. i still test in browsers wish support if you, applies has web development of course.

Regression in weka -

i have multiclass problem want predict quantification using weka (svms regression etc). new in regression methods. far did regression of single class in weka because not know how provide continuous outputs multiclass problem. should use individual regression model each class? there method simultaneous regression each class. (my each individual class have same range of of continuous outputs...so can not differentiate if put 4 (say) class simultaneously in .csv file input).. thanks in advance...

html - CSS Background Not Showing -

Image
hey guy's i've been trying out different css backgrounds in order make header line. want have set line made of 5 equally sized portions each portion being different color. here example have code set can't background show have code down below. appreciated, thanks! html: <div id="div-line"> <div class="blockone"></div> <div class="blocktwo"></div> <div class="blockthree"></div> <div class="blockfour"></div> <div class="blockfive"></div> </div> css: #div-line { width:100%; height:5px; } .blockone { width:20%; background-image:url(../images/orangeblock.png); background-repeat:repeat-x; } .blocktwo { width:20%; background-image:url(../images/blueblock.png); background-repeat:repeat-x; } .blockthree { width:20%; background-image:url(../images/darkorangeblock.png); ba

Dynamically change css in php? -

i have little question. can dynamically change (with php) content of css style in way? <?php header("content-type: text/css; charset: utf-8"); $color = "red;"; ?> header { color:<?php print $color; ?> } ?> sure it's possible, why not give try? linking php css in html: <link rel="stylesheet" type="text/css" href="css/name-of-file.css.php"> and in css.php file put code, without <style type="text/css"> so should this <?php header("content-type: text/css; charset: utf-8"); $color = "red;"; ?> header { color:<?php print $color; ?> }

android - How to embed a mobile application in other application? -

i'm building mobile application company , need add in company mobile application button go directly in different application . know solution embed 1 mobile app in other app??? inside code of button, can launch explicit/implicit intent can launch application (authored else). application won't running inside application, user, he/she have illusion other application running part of own. assuming of course second application installed on user's phone. if isn't installed, button can fetch relevant application's installation page google play user install app, , run application once installed. in application, can provide content provider keep data. content provider provider exposes set of public crud interfaces data other applications access. how contacts database shared on android instance between many different applications, non-google applications. basically, first need start @ beginning , educate on fundamentals of android . if start reading intents

Most occurring element in an array using c++? -

i had tried following code occurring element in array. working problem when there 2 or more elements having same number of occurrence , equal occurring element, shows first element scanned. please me through this. #include <iostream> using namespace std; int main() { int i,j,a[5]; int popular = a[0]; int temp=0, tempcount, count=1; cout << "enter elements: " << endl; for(i=0;i<5;i++) cin >> a[i]; (i=0;i<5;i++) { tempcount = 0; temp=a[i]; tempcount++; for(j=i+1;j<5;j++) { if(a[j] == temp) { tempcount++; if(tempcount > count) { popular = temp; count = tempcount; } } } } cout << "most occured element is: " << popular; } repeat solution twice , change 2 line. if (count>max_count) max_co

android - Can someone tell me what I'm doing wrong with this webview? -

trying load webview in fragment, see blank white screen.... tried using oncreate well, gives me same result. fragment being loaded, not web page. noob android programming appreciated. import android.os.bundle; import android.support.v4.app.fragment; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.webkit.webview; public class articleviewfragment extends fragment { private webview wv; public void onactivitycreated(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { wv = (webview) getview().findviewbyid(r.id.web_frame); wv.getsettings().setjavascriptenabled(true); wv.loadurl("http://www.google.com"); } }

python - twisted reactor.spawnProcess opens an unwanted console when cx_freeze'd -

basically it's in title, when run code console (on windows) child process runs without opening console, when run code cx_freeze'd app console opens. i found old thread suggested use freeconsole(), flash console on screen blink can live it, unfortunately if understood correctly should called child process. http://twistedmatrix.com/pipermail/twisted-python/2007-february/014738.html i found ticket (7yo) on re-factoring of whole spawnprocess on windows apparently never happened: http://twistedmatrix.com/trac/ticket/2415 i have no control on code of child process, doing there unfortunately not option, if did process i'm spawning it's console app , believe freeconsole() not called there or process terminate. this possibly bug in twisted, possibly bug in cx_freeze . what happens when run code gui python, without cx_freeze involved? should able test if have python installed putting code .pyw file , double-clicking on in explorer. if still pops cons

regex - Ruby Regular Expression - prevent overlapping matches -

say have tag <tag> , want match groups of <tag>...<tag> in string. can use regular expression along lines of <tag>.*<tag> . matches <tag>foo<tag> , good, matches <tag>foo<tag>bar<tag> , behavior don't want. want <tag>foo<tag> matched, bar excluded, , tag on end start of next match. how do this? the simplest solution use lazy quantifier ? forces .* match few characters possible (and not many possible, unadorned .* try match): <tag>.*?<tag> a safer, more explicit solution use negative lookahead assertion : <tag>(?:(?!<tag>).)*<tag> while in current case, there no difference in behavior, second 1 extendable handle open/close tags, making sure nested tags aren't incorrectly matched: <tag>(?:(?!</?tag>).)*</tag> when applied <tag>foo<tag>bar</tag>baz</tag> match <tag>bar</tag> , , not <t

c# - How to get page name with webBrowser -

try code wpf. want implement simple webbrowser , , i'm stuck. want name of opened page (every tab has name according opened page), can't find solution. in c# can use code: tabcontrol.selectedtab.text = webbrowser.url.host.tostring(); but wpf doesn't work. solution find page name wpf? please try this, tabcontrol.selectedtab.text = webbrowser1.url.absoluteuri;

php - INSERT INTO logins (ID) VALUES ((SELECT COUNT(ID) FROM logins)) Not Working -

i trying insert data table such id field 1 more previous max id. example, if had 21 users registered , 1 added, users' id 21 (note ids start @ 0). tried this: mysqli_query($con,"insert logins (id,username) values ((select count(id) logins),'$username')"); this error message: #1093 - can't specify target table 'logins' update in clause i tried works: $result=mysqli_query($con,"select id logins id=(select max(id) logins)"); while ($db_field = mysqli_fetch_assoc($result)) { $id=$db_field['id']+1; mysqli_query($con,"insert logins (id, username) values ('$id','$username'"); break; } but looking way 1 command. in advance. i suggest make id primary key of table , enable auto_increment . can remove id column query, , increasing id's added automatically.

objective c - lightweight cocoa control for displaying rich text -

i new in mac development , need lightweight solution display rich text: text different font-styles , formatting pictures (including animations) some controls, buttons picture text background option fast text formatting , rendering i use nstableview datasource , view delegates, ability select , copy text mouse. i can use webview it, i'm not sure if solutions fast enough , easy control. there controls such functionality (or close enough) ? if there no such thing, should able implement it? can make transparent nstextview on nstableview? there way implement text selecting through several cells in nstableview (with of classes nstextlayout etc)? i appreciated , hints. what might missing nsattributedstring , , @ controls methods take/return them - every control supports rich text, button labels scrolling text frames.

clojure - leiningen midje tests not working in Intellij -

consider following (minimal) leiningen project ./project.clj: (defproject repro "0.1.0-snapshot" :dependencies [[org.clojure/clojure "1.5.1"] [midje "1.5.1"]]) ./repro/src/repro/core.clj: (ns repro.core) ./repro/test/repro/core_test.clj: (ns repro.core-test (:require [repro.core :refer :all] [midje.sweet :refer :all])) (facts "about numbers" (fact "trivial" 1 => 1) ) if have leiningen midje plugin installed, runs @ command prompt follows: lein clean lein midje ~~> checks (1) succeeded. however, if import leiningen project intellij 12.1.5 community edition, fat stack trace: exception in thread "main" java.lang.exceptionininitializererror @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:270) ... @ java.lang.reflect.method.invoke(method.java:606) @ com.intellij.rt.execution.application.appmain.main(appm

How to compile/freeze a python 3.3.2 -

this question has answer here: a python exe compiler? [closed] 3 answers what program can use make stand-alone exe of python program? , how use it? you can use py2exe http://www.py2exe.org and there's tutorial on how use on site http://www.py2exe.org/index.cgi/tutorial it converts runnable python scripts exe executables user doesn't have install python run file

c# - trouble about get value from selecteditems -

i want selecteditems values in listview` not work! i have no problem when selecting 1 item want work in extended mode shows of selected items. my code : list<fnamelist> familylist = new list<fnamelist>(); public class fnamelist { public fnamelist(string fname) { this.fname = fname; } private string fname = string.empty; public string fname { { return fname; } set { fname = value; } } } private void button1_click(object sender, routedeventargs e) { messagebox.show(((fnamelist)listview1.selecteditems).fname.tostring()); } private void window_loaded(object sender, routedeventargs e) { familylist.add(new fnamelist("mike")); familylist.add(new fnamelist("john")); familylist.add(new fnamelist("melon")); familylist.add(new fnamelist("bab")); listview1

java - Reversing order of recursive output -

i'm making singly-linked queue cs assignment , 1 supposed implement tostring method displays elements such: in -> [ “data 1” , “data 2” , “data 3” ] -> out. however, first node 1 thats been there latest, method returns oldest element next in , newest out, think reverse order. here's code: public string tostring() { if(value == null){ return ""; } else if(next == null){ return "\"" + value + "\""; } else { return "\"" + value + "\" ; " + next.tostring(); } } is there way can reverse order? thanks

html5 - how to insert images inside a textarea and email them using php? -

peace all, working on newsletter wonder, how able add images textarea contains body of email , send image details user through mail(); php function. how can add image inside textarea? in advance here form:- <form action="" method="post"> subject<font color="red">*</font><br> <input type="text" name="subject"><br><br> body<font color="red">*</font><br> <textarea name="body"></textarea><br> <input type="submit" value="email users"> </form> seems need wysiwyg . nice 1 http://www.tinymce.com/ your url image has absolute http://example.com/img/img.png not /img/img.png

php - Apache rewrite - clean URLs in localhost -

i have been trying past few hours write clean urls in lamp machine. apache's mod_rewrite enabled, , trying use .htaccess file pass url parameters index.php script @ time var_dump of _get. my current .htaccess following (although i've tried quite few variations of found on other answers no success) rewriteengine on #make sure it's not actual file rewritecond %{request_filename} !-f #make sure not directory rewritecond %{request_filename} !-d #rewrite request index.php rewriterule ^(.*)$ index.php?/get=$1 [l] when point browser localhost/my_project/test, 404 error saying: not found the requested url /my_project/test not found on server. apache/2.2.22 (ubuntu) server @ localhost port 80 apparently i'm missing obvious here, help? 2 things for: make sure .htaccess enabled make sure above code in my_project directory. then add rewritebase line well: rewriteengine on rewritebase /my_project/ #make sure it's not actua

asp.net - Could not find a part of the path 'C:\Users\shyful\Desktop\MvcApp\MvcApp\Person\Upload\Jellyfish.jpg' -

when ran project ,it shows "could not find part of path 'c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\jellyfish.jpg'. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.io.directorynotfoundexception: not find part of path 'c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\jellyfish.jpg'. uploadfile.saveas(filepatha); db.image.add(image); db.entry(image).state = entitystate.modified; where's wrong in code the exception message: "could not find part of path ..." message of directorynotfoundexception . in order save file have ensure directory exists first! run before save file: if(!directory.exists(@"c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\")) { directory.createdirectory(@"c:\users\shyful\desktop\mvcapp\mvcapp\person\upload\"); }

java - Play Framework on GAE, outdated? -

i considering using play! framework on google app engine simple medium complexity web application. it looks limited play 1.x. gae module 1.6.0 supporting gae sdk 1.6.0 , when installing says supports play 1.2.4. siena module 2.0.6 says supports play 1.2.3. i feel whole setup thinking outdated , components not active @ all. case? production web application used hundreds of thousands, can't afford integration issues or bugs won't fixed updating framework or modules because there no new releases. feel limited setup. i can't change gae platform can choose other framework better support, reason thinking play because seems flexible, easy learn, fast develop , not bloated. don't have time spent/waste on understanding , configuring frameworks spring or similar. so, right thinking bad choice? , if yes, recommend java developer on gae? if willing consider groovy, how gaelyk ?

cameracapturetask - How to Determine App Capabilities in Windows Phone 8 -

according http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg180730(v=vs.105).aspx#bkmk_wp8apps the windows phone sdk 8.0 not contain tools detect capabilities required apps target windows phone 8. when submit app targets windows phone 8 store, capabilities not analyzed , app manifest file not regenerated or corrected. in application using cameracapturetask , sharemediatask first capture picture , share. default in wmappmanifest file had id_cap_medialib_photo , id_cap_networking , , id_cap_sensors . in fact use medialibrary t gather photo path sharemediatask, have left capability in wmappmanifest. need other 2 if actual image capture , sharing occurs not within application within cameracapturetask , sharemediatask? the sharemediatask not have capability requirements. the cameracapturetask requires specify camera hardware capability. for reference, rules defined in : "c:\program files (x86)\microsoft sdks\windows phone\v8.0\tools\marketplace\rules

ios - What method do I use when wanting to display multiple images and respond to user interaction? -

alright, have 5 custom images want in game. so each variable example have value set it, image 1 = 1, image 2 = 2, etc. want user able press 1 of these images , when do, change image 5 image 4. do need put these images in array/dictionary/etc? have no idea how go dont know search on google. any or advice appreciated. you should use imageviews , add gesture recognizer each imageview, , give each imageview tags in order organize them. can set tags in storyboard pressing imageview , entering tag under shield. each imageview should have distinct tag. i'm giving programatic example below clarity, though. uitapgesturerecognizer * tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(wastapped:)]; tap.delegate = self; imageview.tag = 1; [imageview addgesturerecognizer:tap]; when imageview tapped selector called , can change imageview so. -(void) wastapped:(uigesturerecognizer *) recognizer { uiimageview * imageview = (uiimageview*) reco

xml - How do I turn off findbugs "Redundant nullcheck" in maven? -

i can't find name of detector reports "redundant nullcheck" (rcn_redundant_nullcheck_of_nonnull_value) knows is? googling gives me tons of project reports... i lot of errors on since use jetbrains @notnull annotations tool (it inserts null checks bytecode). <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>findbugs-maven-plugin</artifactid> <version>2.5.2</version> <configuration> <omitvisitors>???whatisthedetectorsname???</omitvisitors> </configuration> </plugin> thanks in advance from findbugs-maven-plugin usage documentation states visitors / omitvisitors options both specify comma-separated list of bug detectors should run/not run. bug detectors specified class names, without package qualification. the class checks redundant null check of non-null value is, far can tell, findnullderef . number of other checks well, turning them off. not sure if possibl

javascript - Countdown for loop counting up -

the alert counting not down! function loop() { (var t = 32; t > 0; t--) { (function (t) { settimeout(function () { i_1(t); }, 200); })(t); } } function i_1(amt) { alert(amt); } you starting timeouts @ once. actual order executed depends on how events implemented internally in each browser. give them different delays start 1 after other: var time = 200; (var t=32;t>0;t--){ (function(t) { settimeout(function() { i_1(t); }, time); time += 200; })(t); }

c# - Attach wpf view dll to existing wpf exe -

i have wpf executable , wish make provisions it, later, outside might modify or add window or page using dll totally separate solution. for short, wish make wpf windows or pages pluggable. how do this? prism's support modular, on-demand-loading of modules , other parts of application, in it's core. you can use mef framework make pluggable modules (windows , pages), it's integrated prism. you can find examples , more information in following resources: http://www.codeproject.com/articles/188054/an-introduction-to-managed-extensibility-framework http://www.codeproject.com/articles/37579/managed-extensibility-framework-part-2 http://www.codeproject.com/articles/432069/simple-mef-application-for-beginners http://www.codeproject.com/articles/232868/mef-features-with-examples

Why doesn't this javascript bind the correct parameters with the event? -

in code supposed bind rollover effect each <area> tag in <map> element. function initlinks(webrt) { var areas = document.queryselectorall("map#streetmap > area"); var links = new array(areas.length); (var i=0; i<links.length; i++) { links[i] = new image(786,272); links[i].src = webrt+"templates/default/sketches/links"+(i+1)+".png"; areas[i].onmouseover=function(){switchlinkimg(webrt+"templates/default/sketches/links"+(i+1)+".png");}; areas[i].onmouseout=function(){switchlinkimg(webrt+"templates/default/sketches/links.png");}; } } strangely, each <area> onmouseover event tries load non-existing image: /templates/default/sketches/links6.png . why keep variable i has incremented 6 global variable rather take string passing function? how fix this? note: no jquery! try using following code: function initlinks(webrt) { var areas = document.queryselectoral

node.js : failed to require socket.io from root -

my english not good, sorry. i have clientfile chat.html. code started with: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <script src="socket.io-client.js"></script> <script type="text/javascript"> //mit dem chatserver verbinden: var socket = io.connect("http://test01.my-wan.de:8080"); at console of browser received "failed require socket.io root". file socket.io-client.js @ same directory of file chat.html. have read lot of posts problem, can't solve problem. can me??? thanks! where did client file? i asked similar question bit ago, socket.io vague on point. question seems duplicate of post here: where socket.io client-side .js file located? the answer question socket.io, server side, automatically places client side file, don't have manually place it. instructions on over

If statement in Ruby using Regex -

everything seems working fine except commented line: #return false if not s[0].upcase =~ /az/ and fourth check. what correct if statement s[0] , /az/ comparison? def starts_with_consonant?(s) return false if s.length == 0 #return false if not s[0].upcase =~ /az/ n = "aeiou" m = s[0] return true if not n.include? m.upcase false end puts starts_with_consonant?("artyom") # false 1 puts starts_with_consonant?("rtyom") # true 2 puts starts_with_consonant?("artyom") # false 3 puts starts_with_consonant?("$rtyom") # false 4 puts starts_with_consonant?("") # false 5 try this... def starts_with_consonant? s /^[^aeiou\d\w]/i =~ s ? true : false end

recursion - Standard ML - Return the index of the occurrences of a given value in a list -

i'm trying figure out how return list of indexes of occurrences of specific value in list. i.e. indexes(1, [1,2,1,1,2,2,1]); val = [1,3,4,7] int list i'm trying figure out how lists work , trying better @ recursion don't want use list.nth (or library functions) , don't want move pattern matching quiet yet. this have far fun index(x, l) = if null l 0 else if x=hd(l) 1 else 1 + index(x,tl l); fun inde(x, l) = if null l [] else if x=hd(l) index(x, tl l) :: inde(x, tl l) else inde(x, tl l); index(4, [4,2,1,3,1,1]); inde(1,[1,2,1,1,2,2,1]); this gives me [2, 1, 3, 0]. guess i'm having hard time incrementing things index. index function works correctly though. instead make 2 passes on list: first add index each element in list, , second grap index of right elements: fun addindex (xs, i) = if null xs [] else (hd xs, i) :: addindex(tl xs, i+1) fun fst (x,y) = x fun snd (x,y) = y fun indexi(n, xs) = if fst(hd xs) = n

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -

in linked list, i'm trying avoid malloc ing node without adding bunch of if statements , such. have following: polynomial create() { polynomial head = null; polynomial temp = null; int numterms, coefficient, exponent; int counter = 0; printf("enter number of terms in polynomial: "); scanf ("%d", &numterms); printf("\n"); if (numterms == 0) { head = malloc(sizeof(term)); head->coef = 0; head->exp = 0; head->next = null; return head; } while (numterms != counter) { // ask input printf("enter coefficient , exponent of term %d: ", (counter + 1)); scanf("%d %d", &coefficient, &exponent); printf("\n"); // create term if (temp == null) temp = malloc(sizeof(term)); temp->coef = coefficient; temp->exp = exponent; temp->next = null; //if((numterms - 1) != counter) tem

android - AudioRecord obtained from microphone can't be played using AudioTrack -

i use following code record data microphone , play back. i've learned buffer sizes must match. problem after record, nothing played. instead got messages on log this: 10-07 00:12:09.187: warn/audiotrack(3719): obtainbuffer() track 0x1df1a8 disabled, restarting 10-07 00:12:10.351: warn/audiotrack(3719): obtainbuffer() track 0x1df1a8 disabled, restarting here code. do wrong? @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); log.w("debug", "audio record"); int frequency = 44100; int channelconfiguration = audioformat.channel_in_stereo; int audioencoding = audioformat.encoding_pcm_16bit; audiorecord audiorecord = null; final int buffersize = audiorecord.getminbuffersize(frequency, channelconfiguration, audioencoding); audioplayer = new audiotrack(audiomanager.stream_music, frequency, audioformat.channel_out_mono,

android taking the screenshot and sharing it -

hey trying add share button app takes screenshot , share ist via facebook etc. had search net stackoverflow there many threads related issue couldnt figure out yet. confusing me .. in every example images filepath hardcoded did not useful , dynamic , trying take screenshot of moment , share it.. when give filepath myself takes picture folder , share that public void clickbutton(view v) { intent shareintent = new intent(android.content.intent.action_send); //set type shareintent.settype("image/png"); //add subject shareintent.putextra(android.content.intent.extra_subject, "car example"); //build body of message shared string sharemessage = "an app..."; //add message shareintent.putextra(android.content.intent.extra_text, sharemessage); //add img shareintent.putextra(intent.extra_stream, uri.parse("/storage/sdcard0/tutorial_screenshot/screenshot0.jpg")); //s

An anchor tag to PHP file is not working in HTML5 header section -

i have created responsive 1 page website in html5 , want place link wordpress blog on main navigation of site (in header section), same link not work @ all. whereas if place same link on other section (otherthan header section)then works great. dont know whats wrong it? can please me out?

c++ - Casting/dereferencing char pointers to a double array -

is there wrong casting double pointer char pointer? goal in following code change 1 element in 3 different ways. double vec1[100]; double *vp = vec1; char *yp = (char*) vp; vp++; vec1[1] = 19.0; *vp = 12.0; *((double*) (yp + (1*sizeof (vec1[0])))) = 34.0; casts of type fall category of "ok if know you're doing dangerous if don't". for example, in case know pointer value of "yp" (it pointing double ) technically safe increase value size of double , re-cast double* . a counter-example: suppose didn't know char* came from...say, given function parameter. now, cast big problem: since char* technically 1-byte-aligned , double 8-byte-aligned, can't sure if given 8-byte-aligned address. if it's aligned, arithmetic produce valid double* ; if not, crash when dereferenced. this 1 example of how casts can go wrong. you're doing (at first glance) looks work in general have pay attention when cast things.

c++ - Apple Mach-O Linker (Id) Error in xcode -

i using xcode work snap package ( http://memetracker.org ). when build, few "apple mach-o linker (id) error" i read may have add right framework not know how can find right framework is. undefined symbols architecture x86_64: "_env", referenced from: _main in cliquesmain.o "exestop(char const*, char const*, char const*, char const*, int const&)", referenced from: tpt<tungraph>::operator->() const in cliquesmain.o tvec<tvec<tint, int>, int>::operator[](int const&) in cliquesmain.o tvec<tint, int>::operator[](int const&) in cliquesmain.o tpt<texcept>::operator->() const in cliquesmain.o trstr::getnullrstr() in cliquesmain.o trstr::~trstr() in cliquesmain.o tvec<tint, int>::operator[](int const&) const in cliquesmain.o ... "wrnotify(char const*, char const*)", referenced from: errnotif

C# application maximized window -

first resize window button doesn't want work ,for reason. private void fullscreenbutton_click(object sender, eventargs e) { if (this.windowstate == formwindowstate.normal) { this.windowstate = formwindowstate.maximized; } if (this.windowstate==formwindowstate.maximized) { this.windowstate = formwindowstate.normal; } } and if make form maximized vs form properties http://postimg.org/image/mmy9r7qu9/ ,the form turns http://postimg.org/image/kzeyrb9fb/ .what going on? click on form go it's properties find option: "windowstate" change "maximized" you can see image option in: https://www.mediafire.com/view/nmnf8wcjsl1zi6z/windowstate.bmp and can try "button_click": private void fullscreenbutton_click(object sender, eventargs e) { if (this.windowstate == formwindowstate.normal) { this.windowstate = formwindowstate.maximized;

kill a system persistent process in android -

is there way in android system stop system persistent process such com.android.phone temporarily, tried (android.os.process.killprocess) in loop without success. thanks in advance, edit: root privileges unable achieve tel= android.os.process.phone_uid; process su = runtime.getruntime().exec( "su" ); process kil = runtime.getruntime().exec("kill -9 tell"); edit: whoops, mark murphy beat me it. :) can't done unless have root access on device. http://developer.android.com/reference/android/os/process.html#killprocess(int) kill process given pid. note that, though api allows request kill process based on pid, kernel still impose standard restrictions on pids able kill. typically means process running caller's packages/application , additional processes created app; packages sharing common uid able kill each other's processes.

Android - push updates/news to user -

if assume user has not started app, how send/push news/updates? for instance, imagine user installed "shops-in-your-area" app , set option inform user when new shops launch... user forgets run app. how auto-launch and/or auto-check news show them inside android? i'd suggest start looking google cloud messaging. might have seen referred before 'gcm'. http://developer.android.com/google/gcm/index.html this should provide functionality require.

c++ - Is there a quick way to check if a string is numeric? -

is possible check if string variable entirely numeric? know can iterate through alphabets check non-numeric character, there other way? the quickest way can think of try cast "strtol" or similar functions , see whether can convert entire string: char* numberstring = "100"; char* endptr; long number = strtol(numberstring, &endptr, 10); if (*endptr) { // cast failed } else { // cast succeeded } this topic discussed in thread: how determine if string number c++? hope helps :)

c# - How to detect plus key in wpf? -

i know can use below code determine enter key in keyboard if (e.key == key.return) { // } but want know code "+" , "-" ? can me please. there 2 sets. 1 in keyboard side , other in keypad side. for keboard use key.oemplus , key.oemminus , keypad 1 use key.add , key.subtract .

jquery - on() to receive param like function instead of event? -

the 1st param of on() might click, mouseenter, etc event, it's possible bind function instead? $(document).on('click','#box', function(e){ $(this).css('padding-bottom', '32px'); }); i want not click apply on #box, can't set 2nd param else because wan't use $(this).. i'm wondering whether 'click' can functions.. yes can add/trigger (non-browser) events in on , see example: $("p").on("mycustomevent", function(event, myname){ $(this).text(myname + ", hi there!"); $("span") .stop() .css("opacity", 1) .text("myname=" + myname ) .fadein(30) .fadeout(1000); }); $("button").click(function () { $("p").trigger("mycustomevent", [ "john" ]); });

Mono + MVC 4 + .NET 4.0 + nginx 404 (also with XSP) -

on testing box: root@ubuntu:/var/www# mono --version mono jit compiler version 3.0.6 (debian 3.0.6+dfsg-1~exp1~pre1) copyright (c) 2002-2012 novell, inc, xamarin inc , contributors. www.mono-project.com tls: __thread sigsegv: altstack notifications: epoll architecture: amd64 disabled: none misc: softdebug llvm: supported, not enabled. gc: included boehm (with typed gc , parallel mark) xsp (compiled github) root@ubuntu:/var/www# xsp4 --version mono.webserver2.dll 0.4.0.0 (c) (c) 2002-2011 novell, inc. classes embedding asp.net server in application .net 4.0. nginx config: root@ubuntu:/var/www# cat /etc/nginx/sites-available/default server { listen 80; access_log /var/log/nginx/mono.log; error_log /var/log/nginx/mono.err.log; location / { root /var/www/; index index.html index.htm default.aspx default.aspx; fastc

java - continuously changing array size -

this question has answer here: how manage continuous changing values in array of strings [closed] 1 answer i have array of strings values in array changing continuously. there other way of managing array except removing items , changing index locations? public string[] deviceid=null; deviceid=new string[devicecount]; in case devicecount changes new device comes. continuously need change array size , add or remove items use arraylist in place of string[] .. , can cast arraylist string[] final output as arraylist<string> mstringlist= new arraylist<string>(); mstringlist.add("ann"); mstringlist.add("john"); string[] mstringarray = new string[mstringlist.size()]; mstringarray = mstringlist.toarray(mstringarray);

eclipse wtp - Tomcat output not appearing in console view -

have upgraded eclipse juno kepler, , when start tomcat 7 server using wtp (by selecting server in 'servers' view , pressing run button in view's button bar) console view pops front before, instead of displaying tomcat's output did in juno displays message reads "no consoles display @ time." i have tried checking server launch configuration (double click on server entry in servers view, click 'open launch configuration' link, switch 'common' tab) checkbox 'allocate console' ticked, control aware of cause problem. any suggestions how console back? go <tomcat folder>/conf/logging.properties , make sure debug level still set "info", go ../logs folder , delete logs. shut eclipse down, check in task manager both eclipse , tomcat totally down , restart eclipse , try again.

objective c - Character from being automatically convert in the Instruments testing -

Image
i'm in test using instruments. i'm trying enter string in text box follows. target.frontmostapp().mainwindow().tableviews()["empty list"].cells()["server"].textfields()[0].tap(); target.frontmostapp().keyboard().typestring("https"); but, "https" end "http a". cause predictive conversion there measures? i solved problem turning off auto-collection. thanks!

sql - How to do select count(*) group by and select * at same time? -

for example, have table: id | value 1 hi 1 yo 2 foo 2 bar 2 hehe 3 ha 6 gaga i want query id, value; meanwhile returned set should in order of frequency count of each id. i tried query below don't know how id , value column @ same time: select count(*) table group id order count(*) desc; the count number doesn't matter me, need data in such order. desire result: id | value 2 foo 2 bar 2 hehe 1 hi 1 yo 3 ha 6 gaga can see because id:2 appears times(3 times), it's first on list, id:1(2 times) etc. select t.id, t.value table t inner join ( select id, count(*) cnt table group id ) x on x.id = t.id order x.cnt desc

shell - Setting the path of properties file along with Java command -

i have created shell script run project in ubuntu. there had give properties file path along java command. i'm using command not working file not loading , giving nullpointerexception i'm trying use it. /usr/lib/jvm/java-7-openjdk-i386/bin/java" -cp $classpath -doligosoft.posconfig.file=/home/mlpc04/paritosh/pos_3.0/resources/posconfig.properties com.floreantpos.main.main in classpath had given location file located don't know going wrong please suggest me command i'm using correct or problem else. edit private static void loadposconfig() { string filename = system.getproperty( "oligosoft.posconfig.file" ); posconfig = new properties(); system.out.println(filename); file file = new file(filename); system.out.println( file.getabsolutepath()); fileinputstream inputstream = null; try { inputstream = new fileinputstream( file ); posconfig.load(inputstream); } catch ( exception e) { logg

android - run time exception in progress bar -

if (commons.havenetworkconnection()) { if ((txt_username.gettext().tostring().trim() != null && txt_username .gettext().tostring().length() != 0)// username // check && (txt_password.gettext().tostring().trim() != null && txt_password .gettext().tostring().length() != 0)) {// password // check pd = progressdialog.show(loginactivity.this.getapplicationcontext(), "","please wait..."); toast.maketext(getcontext(), "data"+txt_username + txt_password, toast.length_long).show(); thread thread = new thread(loginactivity.this); thread.start(); } else { toast.maketext(getbasecontext(), "invalid username or password&qu

jsf - @EJB(lookup) fails with org.omg.CosNaming.NamingContextPackage.NotFound -

i deployed application on websphere 8.5 , gave following exception: [10/6/13 22:30:18:323 pdt] 000000be injectionbind e cwnen0030e: @ejb factory encountered problem getting object instance com.chander.test.web.managebean.registration/staticdataservice binding object. exception message was: context: chander-4ae021bnode01cell/nodes/chander-4ae021bnode01/servers/server1, name: com.chander.test.service.api.staticdataservice: first component in name com.chander.test.service.api.staticdataservice not found. [10/6/13 22:30:18:417 pdt] 000000be annotation e com.ibm.ws.webcontainer.annotation.wasannotationhelper inject srve8060e: unexpected exception occurred during resource injection. com.ibm.wsspi.injectionengine.injectionexception: unable obtain instance com.chander.test.web.managebean.registration/staticdataservice: javax.naming.namenotfoundexception: context: chander-4ae021bnode01cell/nodes/chander-4ae021bnode01/servers/server1, name: com.chande

html - Why won't my nav element go to the center or change style? -

i trying nav element center won't work older versions of internet explorer or chrome. won't change style. how can center , change? here code: the nav: <nav id="nav"> <a href="tmr library.html">library</a> | <a href="tmr contact.html">contact</a> | <a href="tmr about.html">about</a> </nav> the css #nav { margin:0 auto; font-size: 40px; color: #22b14c; font-family: "papyrus"; } there many ways centre elements: margin way: with set width or display: inline-block; can use: margin-left: auto; margin-right: auto; text-align way: with set width or display: inline-block; can add parent: text-align: center; absolute way: position: absolute; left: 50%; margin-left: width/2; or position: absolute; left: 50%; transform: translate(0, -50%); also don't worry ie7 , below the majority of people use higher versions of ie

java - Obtaining IndexReader using CloudSolrServer SolrJ 4.4 -

i want use fastvectorhiglighter.getbestfragments(...) programatically. in order so, need indexreader object specified request. problem cannot obtain request itself. solrquery object provides queryrespose. tried create own solrcore object corecontainer container = new corecontainer(zk_url); coredescriptor cd = new coredescriptor(container, "corename_shard1_replica1", coreinstancedir); solrcore core = new solrcore("corename_shard1_replica1",cd ); localsolrqueryrequest localrequest = new localsolrqueryrequest(core,somesolrquery); indexreader reader = localrequest.getsearcher().getindexreader(); although above(getreader()) results in null. use hints on: how indexreader solrcloud. thank in advance

postgresql - Associates the same model twice through different name -

i trying implement lost , found database. have 2 model, user , item . user can lost an item , found item. , item can have user found , user lost it. want able reference the same model through different name, e.g. user.found_items, user.lost_items, item.founder, item.losser right able do: user.founds , user.losts , user.items return items losts class user < activerecord::base has_many :founds has_many :items, through: :founds has_many :losts has_many :items, through: :losts end class lost < activerecord::base belongs_to :user belongs_to :item end class found < activerecord::base belongs_to :user belongs_to :item end class item < activerecord::base has_one :found has_one :user, through: :found has_one :lost has_one :user, through: :lost end i pretty similar rename them clarity , add methods functions wanted. class user < activerecord::base has_many :found_items has_many :items, through: :found_item has_many :l

javascript - File input : Chrome is not checking if file still exist before submitting form -

i found bug made server crash during file upload. when user clicks on file input, , chooses file upload. if user deletes or renames file before submitting form, chrome still sends empty file. (while firefox , ie handle error correctly) after user has clicked on "submit" button, i've tryed check file size, not null. if (file.size == 0) { notificationfactory.alertmessage({ messagetype: "error", message: "file missing" }); } i've handled error server-side, add validation client-side. using javascript file api can pull size of file through object's size property using element.files[0].size . ensure file exists javascript, can simply: if(typeof el.files[0] !== 'undefined' && el.files[0].size > 0) { /* success! */ } we use typeof ensure file has been selected ( el.files[0] undefined otherwise), , if passes check file size greater 0. here's jsfiddle demo i've

c++ - How to delete a newline using \b -

i want output of following code -|-2-|- (when input value of key 2). know \b move cursor 1 space why isn't able move 1 space after newline used input value of key. possible use escape character \b after newline character has been used. #include<stdio.h> #include<conio.h> int main() { int key; printf("enter value of key: )" printf("-|-"); scanf("%d",&key); printf("\b-|-"); return 0; } the terminal using output device not have concept of lines of text: knows grid of cells, each of can filled character. 1 of cell positions current cell. the terminal interprets bs character instruction move current cell 1 one column left. happens if in first column? terminal doesn't know previous line ended, can't go end of line. go last column of row above, , terminals can configured that, that's not want. this overly simplified, it's why \b won't delete line break.

image - C# - Can I use Libtiff to output Tiff encoded JPEG (In YCbCr) -

hi quite new libtiff , image processing, , have question when try use libtiff.net bitmiracle. i have ojpeg tiff image , want convert them nowadays jpeg tiff. achieved converting source bmp , save tiff (compression: jpeg; photometric: rgb), size of image quite large. thought if can compress them photometric of ycbcr, can reduce size lot. however, when change photometric rgb ycbcr, program don't work: output 8 bytes (the input 400kb). when open image txt, shows: "ii* " the code use is: byte[] raster1 = getimagerasterbytes(inputbmp[0], pixelformat.format24bpprgb); tif1.setfield(tifftag.imagewidth, inputbmp[0].width); tif1.setfield(tifftag.imagelength, inputbmp[0].height); tif1.setfield(tifftag.compression, compression.jpeg); tif1.setfield(tifftag.photometric, photometric.ycbcr); tif1.setfield(tifftag.rowsperstrip, inputbmp[0].height); //tif1.setfield(tifftag.jpegquality, confidence); tif1.setfield(tifftag.xresolution, 200); tif1.setfield(tifftag.yresolution

android - Problems with "ImageView cell width" on tablelayout -

i'm having troubles when tray insert images in tablerow of tablelayout. the first imageview expands width of own cell , next images expands rest of row how can divide de row in 5 cells equal size? this snapshot of app http://i41.tinypic.com/2dv77g6.png this code of xml layout <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/gradient" android:gravity="center" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginright="15dp" android:layout_margintop="5dp" android:layout_weight="1" android:gravity="ce

Highcharts - remove points from series -

is possible remove points series? i'm looking way draw chart fixed period, like: last 1 hour. i know how add points using dynamic update: http://www.highcharts.com/demo/dynamic-update but in case time interval between points not constant, can't use shift option of addpoint . thanks, omer if want have same, can use same logic in addpoint, see: http://jsfiddle.net/jkclx/1/ however, why can't use shift argument in addpoint() ?

javascript - Unexpected beahviour when replacing object properties -

i'm using mocha run tests against newly written class , need build number of event 's make comparison. i've planned use object stubs , replace them actual instances of event class, have async constructor due db connection usage. i'm using recursive calls process stubs in sequence. , here problem: stub objects replaced latest instance , have no idea why. please explain me wrong. event.coffee: class event start = 0 duration = 0 title = "" atype = {} constructor: (_start, _duration, _title, _atype, cb) -> start = _start duration = _duration title = _title evt = @ activitytype.find( {} = where: {} = title: _atype ).success( (res) -> atype = res cb? evt ).error( () -> throw new error "unable assign atype '#{_atype}'" ) # ... event.test.coffee: # ... suite "geteventat"