[Solved] setImageBitmap() Throwing nullPointerExceprion [duplicate]

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); imageView.setImageBitmap(imageBitmap); … Read more

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

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 solved Optimizing foreach loop that compares multiple … Read more

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

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]

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? elt) … Read more

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

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; position: … Read more

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

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. solved Compile c/c++ program using gcc … Read more

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

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 users … Read more

[Solved] Objective-C Bug this class is not key value coding-compliant for the key dateAMPM [closed]

Take a look at the storyboard. You still have the dateAMPM and the dateLabel outlets tied to the initial view controller. you actually have to right click on the first icon on the top and manually delete the connection (click on the cross), where the yellow warning sign displays. . solved Objective-C Bug this class … Read more

[Solved] Why is this wrong? C++ Analysing Date and Time

This is probably what you want: if(pos != string::npos) { mystring = mystring.erase(0, 13); int z = 0; for(int i = 0; i < mystring.Length(); i++) { if(isalpha(mystring[i])) z++; } if((int)mystring[0]-‘0’ > 3) z++; //(int)mystring[0]-‘0’ converts it to int. if((int)mystring[3]-‘0’ > 1) z++; if(mystring[6] != ‘2’) z++; //No conversion needed for != if(mystring[7] != ‘0’) … Read more