[Solved] find Special word from text and put to array [closed]

[ad_1] Assuming all your text is in a file and that English and persian translations are on different lines. What you need to do is read each line from the file and check if it is ASCII or not. How do you check that? import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; public class StringUtils { static CharsetEncoder asciiEncoder … Read more

[Solved] Null Pointer Except, but why? [closed]

[ad_1] I believe this line is wrong: if(type.equals(null)) strTypeList = “What?What?What?LOLOLOLOLOLnopechucktesta”; it should be: if(type == null) strTypeList = “What?What?What?LOLOLOLOLOLnopechucktesta”; Without seeing the contents of the method calls here: Type = AddyBook.get(x).getContactType(); it’ll be hard to debug but if I were to guess it would be the method “getContactType()” is returning null. EDIT: Try unchaining … Read more

[Solved] Getting time of special timezone in UNIX-time format. Android [duplicate]

[ad_1] I just needed adding an offset of my timezone. Function below was exactly what i wanted! public static long getCurrentTimeInUnixFormat(){ return (System.currentTimeMillis() + TimeZone.getTimeZone(“GMT+3”).getOffset(System.currentTimeMillis())) / 1000; } 1 [ad_2] solved Getting time of special timezone in UNIX-time format. Android [duplicate]

[Solved] vector addition in CUDA using streams

[ad_1] One problem is how you are handling h_A, h_B, and h_C: h_A = (float *) wbImport(wbArg_getInputFile(args, 0), &inputLength); h_B = (float *) wbImport(wbArg_getInputFile(args, 1), &inputLength); The above lines of code are creating an allocation for h_A and h_B and importing some data (presumably). These lines of code: cudaHostAlloc((void **) &h_A, size, cudaHostAllocDefault); cudaHostAlloc((void **) … Read more

[Solved] setImageBitmap() Throwing nullPointerExceprion [duplicate]

[ad_1] This is happening because you are calling below function setContentView(R.layout.activity_main); Views are not being initialized. Replcae your code with below code. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); try { BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); bitmapOptions.inSampleSize = 2; Bitmap imageBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.img, bitmapOptions); //imageView for referencig imageView of layout file ImageView imageView=(ImageView)findViewById(R.id.imageView1); … Read more

[Solved] Optimizing foreach loop that compares multiple things [duplicate]

[ad_1] If you have a IEnumberable of KeyValuePairs then you could do something like this: public bool AreAllSame(IEnumberable<KeyValuePair<Int64, MyObject>> list) { return list.Select(kv => kv.Value).Distinct().Count == 1; } Not sure whether it’s really optimized but, it’s shorter! :-] Of course, whatever you’re comparing will need to be comparable. 2 [ad_2] solved Optimizing foreach loop that … Read more

[Solved] javascript inside an eternal loop php code doesnt work [closed]

[ad_1] Use only Javascript, I haven’t tested it: <html> <head> </head> <body> <div> <object width=”100%” height=”100%” id=”liveTV_api” name=”liveTV_api” data=”http://www.extratv.gr/media/imgs/flowplayer-3.2.15.swf” type=”application/x-shockwave-flash”><param name=”allowfullscreen” value=”true”><param name=”allowscriptaccess” value=”always”><param name=”quality” value=”high”><param name=”bgcolor” value=”#000000″><param name=”flashvars” value=”config={&quot;clip&quot;:{&quot;url&quot;:&quot;mpegts_256.stream&quot;,&quot;provider&quot;:&quot;rtmp&quot;,&quot;live&quot;:true,&quot;scaling&quot;:&quot;fit&quot;},&quot;plugins&quot;:{&quot;rtmp&quot;:{&quot;url&quot;:&quot;http://www.extratv.gr/media/imgs/flowplayer.rtmp-3.2.11.swf&quot;,&quot;netConnectionUrl&quot;:&quot;rtmp://213.16.167.186:1935/live&quot;,&quot;subscribe&quot;:true}},&quot;playerId&quot;:&quot;liveTV&quot;,&quot;playlist&quot;:[{&quot;url&quot;:&quot;mpegts_256.stream&quot;,&quot;provider&quot;:&quot;rtmp&quot;,&quot;live&quot;:true,&quot;scaling&quot;:&quot;fit&quot;}]}”></object> <img id=”adtv” src=”https://stackoverflow.com/questions/26488622/img.png”> </div> <script type=”text/javascript”> function update() { var now = (new Date()).getHours(), start = 12, end = 13; if(now >= start && now … Read more

[Solved] Write scheme LISP Atomic_Count [closed]

[ad_1] Not too hard, the main point is that you need some kind of buffer (called prev in my case) to wait for a possible multiplication: (define (atomic_count lst) (let loop ((lst lst) (prev 0)) (if (null? lst) prev (let ((elt (car lst))) (cond ((list? elt) (+ prev (loop (cdr lst) (loop elt 0)))) ((number? … Read more

[Solved] How do i seperate my menu section form my main area on CSS [closed]

[ad_1] Do you mean something like this: http://jsfiddle.net/byxwr1he/2/ HTML: <div id=”header”> header </div> <div id=”mainContainer”> <div id=”sidePanel”> side panel </div> <div id=”main”> main content <div id=”footer”> footer </div> </div> </div> CSS: div { border: 2px solid blue; } #mainContainer { height: 500px; position: relative; } #sidePanel { float: left; top: 0; bottom: 0; width: 150px; … Read more

[Solved] Compile c/c++ program using gcc [closed]

[ad_1] You should compile with g++, not gcc because it’s C compiler and <vector> is a C++ header file (not mentioning <vecotr> which is a typo) If you have to use C compiler, you have to remove all C++ dependencies from header files which are included from the C sources. [ad_2] solved Compile c/c++ program … Read more

[Solved] Prevent user from copying URL from address bar [closed]

[ad_1] you can use history.pushState() to set the url bar to something that doesn’t give away secrets. for example, run this in the console: history.pushState(null, null, “https://stackoverflow.com/”); After running, it now looks like you’re on the stack home page, even though you are still on /questions/26537657/prevent-user-from-copying-url-from-address-bar/. it won’t stop hackers, but it will prevent naive … Read more