It would appear our Polish friends are beating us on the Archaic-versions-of-Windows-on-mobile-devices front. This fellow used the Symbian version of DOSbox to get a full Windows 3.1 desktop running on an N95. While this may not be the most useful hack in the world, it does bring back memories of many hours of my childhood spent playing Chips Challenge and SkiFree.
Sometimes a program needs to know something about a date, like what day of the week it occured. Maybe you want to do something like know which months have 31 days in them. All of this can be done with the Calendar class in the java.util package.
First we need to import the package:
Next we have to get an instance of the Calendar class:
Calendar cal = Calendar.getInstance();
Notice that we cannot directly invoke the constructor with
new Calendar();, as it is an abstract class.
Next we have to set the date and time that we want to know stuff about:
For the month parameter, January is 0, February is 1, etc. You can also use the constants
Now we can do some really neat stuff with our calendar. Each calendar has a set of parameters that are automatically updated when the calendar is changed. These can be accessed with the
get() method and a set of constants that define a number of accessible fields.
For instance, to find the week of the year that a day falls on:
int week = cal.get(Calendar.WEEK_OF_YEAR)
Another interesting method is
getActualMaximum(). This allows you to find, for instance, the number of days in a particular month:
int daysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
Some fields that may be useful:
- DAY_OF_WEEK – Returns the day of the week that a day falls on, 1-7
- DAY_OF_YEAR – Returns the number of days into the year that the date occurs
- WEEK_OF_MONTH – Returns the week in the current month where the date occurs
- DAY_OF_MONTH – Returns the current day of the month
More information is available from the Javadoc page on the Calendar class
Next time I will cover some of the time aspects of the Calendar class.
Tilt-shift is a great technique to get neat effects from photographs, but commercial lenses can cost upwards of $1000. The guys over at Digital-Foto-Web built one out of an old lens and a toilet plunger. The results were excellent. This is a great way to get tilt-shift effects on the cheap without using Photoshop.
Ambient orbs can be used to display all sorts of information, such as new email or voicemail, the weather forecast, and a number of other items. This one is based on an ATmega8 and can be controlled via serial communication. Includes a simple python script for controlling the color of the orb.
gmgfarrand posted this Instructable on how to create a VGA to USB charging adapter. It’s great for those whose netbooks only have two or three USB ports, and would like to charge a cell phone or iPod without tying up a port. Only requires a few bucks worth of parts and some soldering skills.
R. Scott from quiet_channel built a midi-controlled analog drum machine inside an old recipe card box. He took the rhythm secion from an old Farfisa organ and built a power supply for it. After adding pots to control the volume, he added a midi decoder kit from Highly Liquid to trigger seven drum sounds and variable decay settings for the high-hat.
Xbox hacker [rdc] has spent many valuable hours converting his Xbox 360 to a slot loading system, similar to that found on the Wii. It uses the slot drive from an iMac G3 with a little bit of hacker magic sprinkled here and there to make everything work the way it should. Hopefully he won’t be needing his now void warranty any time soon.
via Hack a Day
ladyada has released the Fuzebox, an open-source 8-bit game console. Features:
- Full 256 simultaneous output colors, 240×224 pixel resolution
- Tile & sprite support
- Two player ports, either with Super Nintendo or classic Nintendo controllers (although the kit comes with SNES)
- NTSC RCA composite and S-video out (PAL not supported at this time )
- 4 channel PCM output mono audio for music and effects
- SD/MMC card support for future expansion
- Built on an Atmel AVR core, 64KB flash and 4KB of RAM
- Main microcontroller chip is preprogrammed with an STK500-compatible (sometimes referred to as Arduino-compatible) bootloader
- Write game code in C, using fully open source tools on any platform
PCL stands for Printer Command Language. It is built in to most Hewlet-Packard LaserJet Printers. It includes commands for changing various default printer settings, but the one we’re concerned with is the Ready message. The ready message is the text that is displayed on the LCD screen on the printer when the printer is ready to print. That is changeable via PCL. I am not responsible if you jack up your printer.
You Will Need:
- An HP Printer that supports PCL/PJL and has an LCD screen
- Access to the command line
Step 1: Creating a Text File
Open a command prompt. Type “edit” (without the quotes). Hit Control + P, then the Esc key to insert an escape character.
Enter the following text:
%-12345X@PJL RDYMSG DISPLAY=”Your Text Here”, substituting something for Your Text Here
Start a new line, insert another escape character, and put this text:
Save the document as “printer.txt” and close Edit.
Step 2: Mapping a Printer
In the command line, type (without quotes) “net use lpt1 \\yourserver\yourprinter” where Yourserver is the computer where the printer is attached and Yourprinter is the printer’s share name. If you are using a local printer, you can skip this step
Step 3: Copying the Text File
Type “copy /b printer.txt lpt1” at the command prompt. That’s it. Now check your printer. It should say whatever you entered in the text file.
Step 4: Using my Automated Program
This is a simple Python script for JetDirect networked printers. They have a telnet connection available on port 9100 that you can send PCL commands to.
You can get it here.
To use: Unzip the file. From a command line in the same directory as the script run “python printerhax.py”, or you can double-click to run it. Enter the IP of the printer, and then your message. The rest is automatic.
Step 5: Further use of PCL
Some guides to PCL are available here.