All posts tagged 'tech'

Wipe the phone clean!

But maybe wiping the phone clean and starting over is the best overall option sometimes.

Hey, it’s a phone! Why should I need to worry about memory management, background tasks and hung processes? Oh, it’s an Android phone, yes, you have to take care of that on your own. Because it is “open”. Uhm.

I personally love my closed iPhone, which just works.

Recommended reading for Android users, via John Gruber.

kmem russian roulette

Aquillar> hey, you guys ever play kmem russian roulette?
Agnostos> I don’t believe I have. care to explain the details?
Aquillar> dd if=/dev/urandom of=/dev/kmem bs=1 count=1 seek=$RANDOM
Aquillar> keep executing until system crashes
Aquillar> person that crashes system has to buy beer
Agnostos> lol
Agnostos> I wonder if I can sneak that into a server startup script here.

(from bash.org)

iPad Version 0

So fangen gute Artikel an:

Ein Auditorium in Kalifornien. Der Redner trägt Brille, Jeans und einen schwarzen Rollkragenpulli. Er hat sein neues Spielzeug mitgebracht. Mit beiden Händen fuchtelt er auf dem Bildschirm herum, sortiert Fotos, vergrößert sie mit zwei Fingern und staucht sie wieder zusammen. „Es gibt keine Bedienungsanleitung. Es passiert genau, was man erwartet.“ Er dreht einen virtuellen Globus, zoomt heran, alles in einer einzigen, flüssigen Bewegung. Die anwesenden Fachleute sind verwirrt, als schauten sie einem Magier zu. Langsam dämmert ihnen, dass sie dem Beginn einer neuen Ära beiwohnen. „Wo ist Dein Labor?“, ruft einer. „Ich bin Forscher an der New York University“, antwortet der Redner. Sein Name: Jeff Han. (Source: heise.de)

Aber: Jeff wer? Nicht Steve Jobs?

Interessant ist dass der beschriebene Vortrag schon im Februar 2006 gehalten wurde, weit bevor das iPad überhaupt angekündigt wurde… iPad Version 0 quasi – und viele der Gestures auf dem großen Screen sind heute in der iPad Photo app zu finden. Das Video ist sehr zu empfehlen, nicht nur für Apple Fanboys!

I’m going to delete all mail

A great tip:

When you go on vacation, set up an autoreply that says, “I’m on vacation until x/x/2010. When I get back, I’m going to delete all the email that arrived while I was gone, so if this note is important, please send it to me again after that date.”

Something I’ll try next time I’ll go on vacation…

Read the full story called 8 things I wish everyone knew about email.

My opinion on the iPad

On Wednesday the mysterious Apple iPad has been announced. Phase 2. And because a lot of people know that I’m an Apple fanboy and feel the urge to discuss “what does not work on the iPad and why it is crap” with me I’d like to finally outline a few thoughts about this device….

What the iPad is and what it is not

  • The iPad is not a computer replacement. It is not meant to be your only computer in a household. Yes, it might work out for some special cases (my mum, my dad) but the average geek will still need a separate computer for development, hacking etc.
  • The iPad does support multi-tasking. You can listen to music while browsing the Web. All well-coded applications will remember the application state, so going to a link while reading a mail will open up the very same mail once you open up the mail application again. IM has proven to work very well using Push notifications and I bet there will be better support for Push in the next release of the iPad OS (list all notifications etc.).
  • The iPad cannot make phone calls and therefore is also no cell phone replacement. Well, you can make calls using i.e. Skype and a Bluetooth headset. Who wants such a large cell phone anyway? I never really understood that kind of comment…. it’s no phone at all! The iPad is a iPod Touch on steroids and targets unusable, slow Netbooks with Windows on it. So it is also no cell phone replacement.
  • The iPad has three (3!) different keyboards. You can use the onscreen keyboard, which (according to my experience with the iPhone) will work very well in most cases. As alternatives you can use a Bluetooth keyboard or use the keyboard-dock. Plenty of options for faster typing.
  • The pricing is quite ok – yes, you can get laptops for the same price, but take into account the quality of these low-end devices. Apple stuff is always a bit more expensive (no need to complain!), but on the other hand you get a device that just works. No fiddling with Firewalls, no RegEdit, all stuff that you don’t really need.

What I miss on the iPad
These features would make the iPad of real use to me and I think they are missing in the current version of the device:

  • Wireless sync. I don’t see any reason for plugging the iPad to my computer to sync music and videos. Why can’t it sync over the air (when it is plugged to a power source)?
  • Multi-User support. No need for two iPads in our household, but two separated user accounts would be great.
  • Airtunes support to stream music directly to the speakers, instead of just remote-controlling the MacBook.
  • A front-mounted camera would be great for Skype or iChat video conferencing. Eventually also to detect who is using the iPad (see multi-user support above).
  • Cheaper e-Books. I don’t understand why I should pay the same price for an e-Book as for a paper book. The publisher saves money on printing, I have to buy a reader… so get cheaper!
  • Tethering through an iPhone. I have an iPhone, so why do I need an additional 3G contract? Let me tether through the iPhone, because contract in Austria allow me to use my 3GB monthly volume how I want to use it. Could also use the iPhone GPS location…

Will I buy it?
Let me quote someone here:

To hell with it! It’s not something I need. It doesn’t solve any problems I have. I can resist. I am strong. I may be “Mr. Mac,” but I am also “Mr. Practical.”
Which is exactly what I said when the iPhone came out. 3 days later I was in the Apple Store eagerly holding out my credit card to anyone who would take it. (source)

So: I don’t know yet. Most probably I’ll skip the first generation and wait for an upgrade. It is also depending on the iPhone 4 which is to be released this summer (yes, my contract is finally over!) and what features it offers. And of course what features Apple will add to the iPad over time…

Unit-tests are way cool!

Unit-tests are what saves a developers ass – and each app should have them, if it makes sense. So it depends :)

But for the project I’m working on right now it made sense, the perfect subject for unit testing. Or do you remember almost 100 different cases and conditions which might break if you change code? In my case I rewrote about 30% of the servlet code to be better structured and being capable of implementing a new requirement. Large parts where Spaghetti code without class inheritance or good usage of objects… subject to be thrown away or rewritten.
After trying the code for the first time after the rewrite the simple, LWP based unit tests immediately showed me where I had to “tweak” the code – and now that they again show a green PASSED I’m confident that it really works in production as well.

That’s how it should be – being confident that changes did not break any other part of the code.
Unit tests are way cool!

Logwatch for PHP errors, the Apache error log and MySQL

Logwatch is a very flexible and customizable log watching system for lazy system administrators. It checks the logfiles regularly and sends custom mail reports – very useful and way better than daily manual checking of the logs.

Unfortunately the configuration for MySQL, PHP and the Apache error_log is missing; so let me share the configuration scripts:

Logwatch configuration for PHP
Interestingly there is no logwatch configuration for PHP error_log files – and all a search revealed are some outdated files which don’t work anymore. Here are the adopted files that allow you to get notified about PHP errors:

  • logfiles_php.conf – place this file in /etc/logwatch/conf/logfiles/php.conf and adopt the path to the php error_log file (or just use the Apache error_log)
  • services_php.conf – place this file in /etc/logwatch/conf/services/php.conf
  • scripts_php – place this file in /etc/logwatch/scripts/php and make it executable

Logwatch configuration for MySQL
Also a configuration for MySQL is missing in the default configuration; here are the configuration files:

  • logfiles_mysql.conf – place this file in /etc/logwatch/conf/logfiles/mysql.conf and adopt the path to the MySQL logfile
  • services_mysql.conf – place this file in /etc/logwatch/conf/services/mysql.conf
  • scripts_mysql – place this file in /etc/logwatch/scripts/mysql and make it executable

Logwatch configuration for Apache’s error_log
Now hat really made me wonder is the at the httpd access_log is monitored but the error_log is left out, so no details about errors are included in the logs. This configuration ignores PHP errors and includes all httd errors in the logwatch output:

  • logfiles_http-error.conf – place this file in /etc/logwatch/conf/logfiles/http-error.conf and adopt the path to the httpd error_log file accordingly
  • services_http-error.conf – place this file in /etc/logwatch/conf/services/http-error.conf
  • scripts_http-error – place this file in /etc/logwatch/scripts/http-error and make it executable

To test that the individual scripts work use this command:

/usr/sbin/logwatch –detail high –print –service $SERVICE –range today –debug 0

Replace $SERVICE with either php, mysql or http-error and set debug to 5 if you want to see more (but not too much) debugging information.

All the logwatch configuration scripts for MySQL, PHP and the Apache error_log can be found here.

Update: There was an error in the scripts_mysql file, fixed now.

Debugging using Apache as proxy

While the follow up article of “Must-have tools for HTML, JavaScript and AJAX development and debugging” (which has also been translated to Chinese, Japanese and Korean) is not written yet I want to share a useful trick that helps debugging live Web applications by injecting custom files into them.

The problem is how to test a new version of a JavaScript library on a production system without even touching the system itself in any way. Testing with local copies of the HTML pages work fine for a few files but does not scale very well, and staging systems might not be properly configured or really tell you if something works on the production system (bugs always just happen in production, right?).
Another problem with debugging JavaScript on production system is that the files might be compressed, which makes debugging in Firebug almost impossible – variable names are shortenend and line numbers don’t make sense any more – would be great to have the uncompressed version instead…

The solution is using a local proxy and replacing certain requests with local files. That way custom files can be injected based on regular expressions and tests can be performed on the production site or even on sites without access to the system itself.
While Fiddler works great on Windows and Charles Proxy does the same on OSX I want to present the poor man’s solution which makes use of any local Apache installation (i.e. MAMP).

The required changes in the httpd.conf are:

# Enable proxy requests
ProxyRequests On
ProxyVia On
<Proxy *>
# Secure the proxy to allow localhost requests only
Order deny,allow
Deny from all
Allow from 127.0.0.1
Allow from ::1

# replace some files with local copies
RewriteEngine On
RewriteRule myfile.js http://localhost:8888/test/myfile.source.js [P]

# Disable caching
ExpiresActive On
ExpiresDefault “now”
</Proxy>

Lets go through the changes line by line:
The first two lines enable the Apache Proxy support (ProxyRequests On); the <Proxy *> block then configures the proxy further. As stated in the documentation multiple times it is a good thing to secure the server, that’s why only access from localhost is permitted. The important part are now the RewriteRules – they proxy certain requests to the local server instead of the remote server, in the sample above all requests that contain myfile.js will be replaced by the version served from the local server. This could as well be any other remote machine serving the file, as the request is proxied again ([P] flag). Finally caching is avoided by setting all files to expire right now (while this adds more load to the proxy it is not that bad to do during testing).

Now the proxy has to be used in the browser or application of choice; once the proxy settings are changed within the networks settings the access log of Apache should become quite busy when browsing around and, depending on your mod_rewrite settings above, some requests should be replaced with the local copy of a file, making debugging way easier.

Of course the drawbacks of the poor man’s solution are that Apache has to be reloaded in case the RewriteRules change and changing the configuration is not as comfortable as with the dedicated proxy solutions mentioned above. Nevertheless this solution works, is fast and very reliable… and free :)

The worlds coolest data center

Until today I did not know that data centers can be that cool – but check out this article about the server location in Stockholm. Looks like directly out of a James Bond movie:

  • A nuclear bunker below Stockholm.
  • Submarine engines as backup power source.
  • Simulated daylight and greenhouses.

In my opinion the provider Bahnhof built one of the coolest data centers ever – let’s see what Google builds up in Austria.

Original articlemore pictures.

“Could not find symbol” made me crazy today

My EAR package worked fine, until tonight during the deployment to another server infrastructure. How hard can a simple EAR update be? “Could not find symbol” somewhere next to a simple line initializing log4j. It complained about missing the Logger class.
A check in the EAR file revealed that the required jar files are all there. Still this error. But why?

Finally I figured out that the manifest file included all of the required libraries in the classpath but missed the “.” to include the current directory as well, after adding it everything worked out:

Class-Path: log4j.jar lib.jar .

Took some time to perform a simple upgrade of an existing EAR file… because of such a simple error – so ensure your MANIFEST.MF file contains the dot!

Older posts