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

While working on a shared hosting server, I found that the company I'm working with has disabled my access to the Unix/Linux ping command. Not to be deterred, I found several different ways to run a ping command with a PHP script.

Use the Net_Ping module

The first thing you can try to do is use the PHP PEAR Net_Ping module to get around this problem. In short, you install it like this:

pear install Net_Ping

Then use it like this:

SQLite FAQ: Can you show me how the SQLite ALTER TABLE syntax works?

At the time of this writing you can use the SQLite ALTER TABLE syntax for two purposes:

  1. Add a column to the end of an existing SQLite database table
  2. Change the name of a database table.

For other changes you'll have to follow some workaround procedures (discussed below).

[toc hidden:1]

SQLite database FAQ: Can you show me an example of the SQLite CREATE TABLE syntax?

Sure, here's a small collection of SQLite CREATE TABLE examples I recently created for my other SQLite tutorials:

Mac BMP image FAQ: How can I convert a BMP image to a JPEG (JPG) format on a Mac? (Or to a PNG, TIFF, GIF, or PDF format.)

If you have just one BMP image you want to convert, you can do this with the Mac OS X Preview application. Just follow these steps:

As I mentioned in my earlier Mac HTML (FrontPage) prototyping and my Mac HTML/CSS Napkin prototying theme articles, I've created my own HTML and CSS "prototyping" theme, which I've now named "Sketch".

As you can see from the screenshots below, my Sketch prototyping theme lets you rapidly create HTML forms and web pages with a theme that intentionally looks like a "back of the envelope" sketch.

As I mentioned in my earlier Mac HTML prototyping article, I've created my own "prototyping" theme, basically an HTML/CSS version of the Java Napkin Look and Feel project, as well as this Flex napkin skin project.

Earlier this week I needed to create some HTML prototypes for a client, and when I looked around for simple Mac OS X HTML form prototyping tools, I was disappointed to see, well, nothing.

Five to ten years ago I used to sit down with clients and create HTML form prototypes using Microsoft FrontPage, and since their 2000 version, it was actually very good. It created very clean code, kept your changes in tact, and was as simple as could be to create HTML forms.

Mac startup/login programs FAQ: How do I set up a Mac application to automatically start up when I log in?

If you have a normal Mac application that you want to setup as a Mac startup program — also called a Mac "startup item" — the process is fairly simple, and I'll demonstrate the approach in this article. For other Mac applications, like a command line program, the approach is different, and I'll cover that in a separate article.

iPhone browser privacy FAQ: How do I manage my iPhone browser privacy and security (my iPhone Safari browser privacy and security)?

Note: This contest has expired, but if you join our mailing list, you'll automatically be eligible to win future prizes.

Background

Founded in 1998, devdaily.com has over 2,000 online tutorials, and receives millions of page views every year.

In 2011 I'm giving away more prizes than ever before. This month I'm giving away two copies of a terrific and extremely popular book, Introducing HTML5.

Linux FAQ: How can I find Linux processor and memory information? (Also written as, How can I find Linux CPU information?, How can I find Linux RAM information?)

To see what type of processor/CPU your computer system has, use this Linux processor command:

cat /proc/cpuinfo

As you can see, all you have to do is use the Linux cat command on a special file on your Linux system. (See below for sample processor output.)

To see your Linux memory information and memory stats use this command:

Summary: A look at Drupal speed, performance, and scalability improvements recently made to the devdaily.com website.

I’ve read before that the secret to great Drupal performance is Cache, cache, cache,” and while I always knew that to be true, I didn’t know how true it was. After several recent tweaks to the devdaily.com website, I can say that is very true. (I documented this in detail in my Drupal Boost module performance article.)

Summary: This post provides a review of the Drupal Boost module, which dramatically improves website speed/performance.

Over the last few weeks I've been spending a little time every weekend trying to improve the performance of the alvinalexander.com website. I didn't think there was much of a performance problem with the website, but the Google Webmasters' site kept reporting that the site was slow compared to most internet websites.

sed command FAQ: How can I use the Unix/Linux sed command to edit (modify) files in place?

The short answer is that you just need to use the -i or --in-place sed arguments, as shown in the sed man page:

-i[SUFFIX], --in-place[=SUFFIX]

edit files in place (makes backup if extension supplied)

Then, if you have a file named 'hello.txt' with contents like this:

jello, world
this is a test

you can then run a sed command like this to modify that file:

Summary: How to schedule a Mac automatic wake up time (or sleep time).

While answering a reader's question about an unrelated Mac issue, I stumbled onto a solution of how to wake up my Mac at a specific time every day. This is very cool for me, because it fits in very well with my Mac AppleScript iTunes alarm clock.

This article is now part of my new eBook, which is only $2.99 on Amazon.com:

You want me to do what? A Survival Guide for New Consultants

I hope you enjoy my book, and more than that, I hope it helps you have a very profitable and rewarding career.

 

Apache Redirect 301 FAQ: How can I redirect many old web pages using the Apache Redirect or RedirectMatch syntax and wildcard patterns (regex patterns)?

I'm currently trying to fix a lot of URLs that I more or less intentionally broke when I deleted the old "directory" portion of this website. In short, after removing the directory, no URL at "/Dir" work any more, so I have thousands of broken URLs (technically "URIs") that look like this:

Summary: Two Java inheritance tests that you might run into during a Java programming job interview.

This is a fun test to give to newbie Java developers. Just read the following code, and assuming that this code is compiled and runs, what do you think it will print?

Summary: A solution for "pear/pecl is using a unsupported protocal (protocol)".

While trying to install the APC Opcode Cache on a server yesterday, when I tried to run this command:

pecl install apc

I kept getting this error message:

pecl.php.net is using a unsupported protocal - 
This should never happen.
install failed

After doing some research, it looks like you can also get a similar error message with PEAR:

Summary: A look at the performance improvements gained on a Drupal 6 website by using the PHP APC Opcode Cache.

Wow, I just installed the PHP APC Opcode Cache module on alvinalexander.com, and the results are really incredible. By any metric the website is performing much, much faster.

I ran two benchmarks on the website using the Apache 'ab' benchmarking tool, one without the APC opcode cache, and one with it.