Skip to main content

Posts

Showing posts with the label osx

Easiest way to simulate no free disk space situation?

I need to test my web app in a scenario where there’s no disk space remaining, i.e. I cannot write any more files. But I don’t want to fill my hard drive with junk just to make sure there’s really no space left. What I want is to simulate this situation withing a particular process (actually, a PHP app).

How to obtain MAC address of WiFi network interface?

It seems the java.net.NetworkInterface implementation of android does not have a byte[] getHardwareAddress() method http://developer.android.com/reference/java/net/NetworkInterface.html I've found several forums of people trying to do this with no definitive answer, I need to get a somewhat cross-device UUID, so I can't rely on phone numbers or in ANDROID_ID (which can be overwritten and which I think depends on the user having a google account) http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID In linux you can use ifconfig or read from /proc/net/arp and you can easily get the Hardware address. Is there a file in android that I can read? There has to be a way to get this address since it's shown in the "Settings > About Phone > Status" of the phone.

Key-Value-Observation — Looking for a more elegant solution to respond to value changes

I've run into a frustrating feature of KVO: all notifications are funneled through a single method ( observeValueForKeyPath:.... ), requiring a bunch of IF statements if the object is observing numerous properties. The ideal solution would be to pass a method as an argument to the method that establishes the observing in the first place, but it seems this isn't possible. Does a solution exist to this problem? I initially considered using the keyPath argument ( addObserver:forKeyPath:options:context: ) to call a method via NSSelectorFromString , but then I came across the post KVO Dispatcher pattern with Method as context and the article it linked to which offers a different solution in order to pass arguments along as well (although I haven't gotten that working yet). I know a lot of people have come up against this issue. Has a standard way of handling it emerged?

Java - Get first and last name of user

Here is my situation. I am writing a program that will store a database. Currently, the way of identifying the user is by their computer user name. I am very desperate here, so any ideas will work. I am looking for ANY method (doesn't always need to work) for BOTH OSX and Windows computers that will somehow fetch the user's first and last name. Thank you all in advance!