Scala, Java, Unix, MacOS tutorials (page 384)

I've been thinking about investing in Yahoo for a while now, since they brought on Carol Bartz, but even since her hiring, I still haven't been able to think of a good reason to buy their stock.

Then yesterday it was reported that Carl Icahn sold 12.7 million shares in Yahoo at a huge loss. He paid an average of $25 per share to buy the stock, and sold then for less than $15 each, a 40% loss.

You might think that when the Java instanceof operator is used to test a null reference, such as a null reference to a String, instanceof would realize that even though the reference is currently null, it is a reference to a String, so you might expect instanceof to return true ... but it doesn't.

Java instanceof FAQ: How does the Java instanceof operator work with a Java Interface?

The instanceof operator supports inheritance, which I can demonstrate through a simple "instanceof interface" example.

iptables restart FAQ: How do I make my iptables firewall start/restart after I reboot my Linux system?

I was going to write a tutorial about configuring a firewall on a Linux system using iptables, but then I found this great CentOS iptables tutorial, and I think they really nailed it.

The only thing I think they didn't fully cover is how you get your Linux iptables firewall to start up again properly after your Linux system is rebooted (which is kind of a huge deal). To that end, I thought I'd describe the process of getting your iptables firewall to restart after a system reboot.

And -- as an added bonus -- this same process will help you get any Linux service to automatically start after a reboot.

Over the last year a lot of people at Apple -- and a lot of analysts -- have said that Apple will be fine after Steve Jobs leaves the company. But if this Wall Street Journal article about Apple is correct, and Mr. Jobs freaked everyone on the "tablet" project out when he came back, then don't you think Apple will be hurt when he's gone?

Here is some sample Java source code for a multithreaded JMX test that I created recently. After creating two other JMX example projects -- a simple JMX Hello World tutorial project and then a JMX standalone (Swing) project -- I decided to create this multi-threaded JMX test application to see how JMX would work with an application that had multiple threads running simultaneously.

Here is some sample Java source code for some JMX tests that I created a while ago. I started my first tests with an introductory JMX tutorial, then created this JMX example to see how JMX might work with a standalone application, in this case, a Java Swing GUI application. Let's look at the code.

First, here's the source code for a Java interface (an MBean interface) named HelloMBean:

I ran into this error message today when trying to install PHP 5.2.x on a CentOS Linux server:

unable to install php5 - configure: error: libjpeg.(a|so) not found.

Actually, although I wrote "install" above, I was trying to run the PHP configure script when I got that PHP error message. (configure is the command you run before you run the make or make install commands.)

If you're interested in the really short story, this Drupal-based website is now hosted on a new, dedicated Linux server with much more RAM than the old server. For the longer story -- and the details of Apache tweaks and a script to automatically restart Apache when it got hung up -- read on.

Surprised by the Drupal plus LAMP memory use

I ended up being really surprised, but it turns out that Drupal and the LAMP architecture (Linux, Apache, MySQL, and PHP) take much more memory than the old Java-based blog that I had running the DevDaily site previously.

Java JMX FAQ: Can you share a simple Java JMX example?

Here is some sample Java source code for some JMX tests that I created recently. I got a large percentage of this code from Sun's JMX MBean tutorial when I first started working with JMX, and I think it's some decent "Hello World" starter code. The main thing I've done here is (a) clarify what they've written and (b) added a shell script to start the JMX application. (I'm also about to publish some other JMX source code that I know I wrote myself.)

Two iPhone news stories reported by the Mercury News today. First, France is questioning Apple about "imploding" iPhones. (I don't think "implosion" is the correct word, but hey, they're looking into it. For the record, "implode" means to burst inward, or undergo violent compression.)

Here's a quote from that story:

Wow, it's taking an awful lot of work trying to keep this site running right now. The server we're currently running on is a virtual CentOS machine with 256MB RAM, and the constant traffic from both users and robots (crawlers) causes Apache to lock up from time to time. Right now I'm tweaking all the LAMP (Linux, Apache, MySQL, and PHP) knobs I know how to tweak to keep the site more or less running most of the day.

Here's a quick review of the hacks, er, performance optimizations, I've been working on.

With this site hosted on a virtual server, I'm fighting quite a battle over memory use with the new LAMP architecture in place. As I try to learn more about which applications are using the most memory, I ran into this cool ps command last night that sorts the ps output by memory use, specifically by the rss field:

ps aux --sort:rss

Here's the important output from that command:

AppleInsider is reporting that Snow Leopard will include an "anti-malware" feature. Here's a brief excerpt from their story:

"In a screenshot that has been widely circulated, originating from the intego Mac Security Blog, Snow Leopard is shown to recommend that a .DMG file be moved to the trash. The OS claims that the file includes 'OSX.RSPlug.A' malware."

Apple announced today that the Snow Leopard version of their Mac OS X operating system will go on sale this Friday, August 28, 2009, and that their online store is now accepting pre-orders. This release brings their operating system to Mac OS X 10.6.

The upgrade is $29 for owners of Mac OS X 10.5 systems, and a five-user, single-household license for $49. For older systems the upgrade will cost more.

Here are a few interesting quotes from the press release:

A couple of cool links tonight related to Linux kernel development, specifically who works on the kernel, who supports it, and the amazing stat that 5,547 lines of code are removed from the kernel every day -- while even more are added.

The links start with The Linux Foundation updating a study about who writes and supports Linux kernel development. Their PDF is available for download here.

In this article, "Do You Yahoo?", CNNMoney.com states that Yahoo and Google have roughly the same number of visitors, but Google makes 11 times as much money as Yahoo does. Since the early days of advertising I've known that advertising on search results pages pays a lot more than advertising on content-display pages, but I've never seen it compared at 11 times higher. Here's a deeper look at the numbers.

Two MySQL error messages

Earlier this week I ran into a problem with a website that I tracked down to a MySQL error message that looked like this:

can't create/write to file /var/lib/mysql/foo.bar.baz
Errcode: 23

(The actual file referenced in that error message doesn't matter, as it will be different on most systems, but the "can't create/write to file" is important.) After digging through my log files even more, I also found this error message related to MySQL:

I had a problem with this website last Wednesday, and as part of troubleshooting the problem, I need to look at one of the Drupal database tables, specifically the watchdog table. This table had thousands of records in it, and I couldn't find what I needed with SQL SELECT queries, so I finally dug through the MySQL documentation, and found that I could save the output from a SELECT query to a text file.

In this tutorial I'll show you both (a) how to save the results of a MySQL query to a text file, and also (b) how to log your entire MySQL session to a text file.

According to a report on the New York Times website, a new study conducted by Harris Interactive for CareerBuilder.com showed that "45 percent of employers questioned are using social networks to screen job candidates", and "35 percent of employers decided not to offer a job to a candidate based on the content uncovered on a social networking site".