Linux error while loading shared libraries: cannot open shared object file: No such file or directory

UpdateWhile what I write below is true as a general answer about shared libraries, I think the most frequent cause of these sorts of message is because you’ve installed a package, but not installed the -dev version of that package. Well, it’s not lying – there is no libpthread_rt.so.1 in that listing. You probably need to re-configure and re-build … Read more

List files ONLY in the current directory

Just use os.listdir and os.path.isfile instead of os.walk. Example: But be careful while applying this to other directory, like which would not work because f is not a full path but relative to the current dir. Therefore, for filtering on another directory, do os.path.isfile(os.path.join(somedir, f)) (Thanks Causality for the hint)

Can’t use System.Windows.Forms

A console application does not automatically add a reference to System.Windows.Forms.dll. Right-click your project in Solution Explorer and select Add reference… and then find System.Windows.Forms and add it.

Setting up a PHP interpreter in PhpStorm

I am a beginner in web development and am having trouble trying to figure out how to set up a CLI interpreter for PHP. I don’t know what to do to set up an interpreter and the JetBrains tutorials seem to assume that I already have available interpreters. I have previously used AWS to make … Read more

How to view .img files?

If you want to open .img files, you can use 7-zip, which is freeware… http://www.7-zip.org/ Once installed, right click on the relevant img file, hover over “7-zip”, then click “Open Archive”. Bear in mind, you need a seperate program, or Windows 7 to burn the image to disc! Hope this helps! Edit: Proof that it works (not … Read more

Mouseover & Mouseout w/ Javascript

When you call an inline event handler such as you do with onmouseover=”MouseOver(this);” you’re passing a reference to the element itself to your function, and in your function you’re taking that reference and assigning it to the variable elem. You would then normally use elem within your function like elem.style.color = “white”;, not with parenthesis, as you’re not running a function … Read more

What is Java String interning?

http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#intern() Basically doing String.intern() on a series of strings will ensure that all strings having same contents share same memory. So if you have list of names where ‘john’ appears 1000 times, by interning you ensure only one ‘john’ is actually allocated memory. This can be useful to reduce memory requirements of your program. But … Read more

Error handling in Python-MySQL

First point: you have too much code in your try/except block. Better to use distinct try/except blocks when you have two statements (or two groups of statements) that may raise different errors: Now do you really have to catch a TypeError here ? If you read at the traceback, you’ll notice that your error comes … Read more