Windows 8 on an EEE PC 1000

Here I'll describe how to install Windows 8 on an EEE PC 1000 and have just about everything work properly. This guide may also be applicable to the 900 series, later models are generally much more simple to install Windows 8 on.

I put all the drivers you'll need here on my server: http://www.cachemiss.com/files/eeepc1000_win8/.

check your RAM

The 1000 is upgradable to a max of 2gb of ram, the default is 1gb, you definitely want to do the 2gb upgrade. The proper chip should still be available and reasonably inexpensive.

check your SSD

Ideally you already have a runcore/kingspec or whatever in your eee pc, if not read on.

The stock 32 gig ssd is very slow, probably too slow to run win8. Unfortunately it's impossible to get a runcore right now, but the 70mm kingspec mini-pcie ssds can still be obtained on ebay from sellers based in china, they should work adequately. The 32gig is the minimum you need, to have windows and some more larger programs installed a 64gig is better, and the 128gig will be a bit faster.

I don't know if windows 8 is usable on the stock 32gb ssd, I do remember it being excruciatingly slow, YMMV.

There are two ssd slots, one that is very easy to get to near the ram underneath the ram cover, and one for which you have to dissassemble the whole netbook and do a bit of a hardware modification to install. The one on the bottom side of the motherboard is the primary and a half length (the 8gb one.) You'll want to gently pry off the metal bracket that holds it with a pair of pliers and secure a full length ssd with some electrical tape (be careful not to use too much to not block the sd card slot.)

The easiest way to go would be to replace the ssd under the ram cover and use the stock 8gb primary which is reasonably fast for readyboost and the page file (http://superuser.com/questions/93538/how-can-i-use-my-ssd-as-a-readyboost-cache-disk).

install windows 8

The first part is simple, just install windows 8 using the installer, boot it either from a usb stick or usb dvd drive. It should install without any issues.

enable 1024x768 virtual resolution so that metro apps work

The 1024x600 resolution of the 1000 panel is below the minimum required for metro apps, we can solve this problem easily enough by following this guide:

http://mobileoffice.about.com/od/netbooks/a/How-To-Change-Your-Netbooks-Screen-Resolution.htm.

After doing this registry change and rebooting and selecting the 1024x768 resolution, I suggest going into the "make text and other items bigger or smaller" under the resolution tab and choosing 125% scaling to offset some of the squashing from the increased virtual resolution.

Now metro apps should work perfectly on your 1000.

install the ACPI hotkey driver

When you go to device manager, you will see one "unknown device", next we will install the driver for it.

This happens because the 1000 like many Asus laptops does not map the Fn keys to normal keyboard key codes, but instead they are a separate physical device. The ribbon connector in the upper left corner under the keyboard is this ACPI hotkey device.

Grab the XP ACPI hotkey drivers here: http://www.cachemiss.com/files/eeepc1000_win8/ACPI_XP_080827.zip.

Unzip the file, then right click on AsusSetup.exe, go to compatibility and select "windows XP sp 3 mode" and "run as administrator".

Run the installer, check "this program ran correctly" after it finishes, it doesn't matter if it looks like it exited early, we don't need those programs anyway.

Reboot, then go into programs and features in control panel and uninstall the ACPI package. Reboot again, the driver should still be installed, and you should not see an "unknown device" in device manager (the asus ACPI device will be somewhere under the system devices or acpi devices list.)

install the Dell Elantech touchpad driver

I recommend the Dell Elantech driver, which you can get here: http://www.cachemiss.com/files/eeepc1000_win8/Touchpad_Elantech_W8_X02_A00_Setup-MG9H2_ZPE.exe. You might try the latest Asus one as well, but I like how the Dell one works better.

I was not able to get tap to click to work with either of them, unfortunately, I will try to resolve this problem somehow in the future (perhaps by adding Elantech support to the TwoFingerScroll open source driver.)

For all the other features, right click on the touchpad icons in the systray and configure all the features you want, such as two finger scrolling.

But other than having to use the physical touchpad buttons, everything else works pretty well with the Dell elantech driver, like two finger scrolling.

Note that you need to do a horizontal scroll movement in the start screen, rather than a vertical one like on most touchpads with windows 8.

install the windows 8 hotkey service

Install this driver http://www.cachemiss.com/files/eeepc1000_win8/HotkeyService-1_15.zip and reboot.

After doing this, your Fn keys should work (by using the ACPI device driver you installed earlier in conjunction with this service) but you'll notice that that the volume up and down keys are reversed, and that it complains on startup about a missing touchpad driver.

To fix this problem, copy this file http://www.cachemiss.com/files/eeepc1000_win8/HotkeyService_fixed.exe which I made by hacking the Asus .exe with IDA and OllyDbg and stripping the certificate with delcert to C:\Program Files\EeePC\HotkeyService as HotkeyService.exe.

Reboot again, now there should not be a message about the touchpad and the volume keys should work correctly!

all done

That's all, you now have a reasonably well performing, fully functional windows 8 netbook.

The only downside is lack of tap to click for the touchpad (although that may work for you) and I will try to solve this problem in the future.

If you have any additions/corrections/comments or questions about this guide, feel free to email me at rkitover at gmail.

Good luck!

Read more...


Building XS Modules for 64bit ActivePerl on Windows

Here I'll discuss how to build extensions for 64bit ActivePerl for Windows using freely available tools.

First let's discuss which perl for Windows you need if you haven't decided that yet.

For most general use and development you want a 32bit ActivePerl or Strawberry Perl. ActivePerl has the advantage of some difficult to build modules available as easy to install PPM packages in the ActiveState repositories or some of the third-party repositories. In other ways the two are similar, ActivePerl will now automatically install the MinGW toolchain and dmake when you need it to compile an extension, the tools Strawberry Perl comes with, or you can just type ppm install MinGW.

The reason you would generally prefer a 32bit perl on Windows is that many modules, especially some Win32:: modules are not compatible with 64bit perls yet; and in the case of ActivePerl, there are far more PPMs available for the 32bit builds.

Your choice of whether to use a 32bit or 64bit perl may be dictated by factors other than convenience and compatibility however, you may need to link the interpreter into a native process of a certain bitness, or link a .dll library of a certain bitness into the perl interpreter. Or you may need to use either a 32bit or 64bit ODBC driver which will only work with that respective bitness of perl. And so on.

Once you've decided that you need to use a 64bit perl, you have a choice between Strawberry Perl and ActivePerl. Strawberry Perl comes with MinGW-w64 and dmake bundled in the distribution and pre-setup for you, so you can skip the setup I describe here for ActivePerl. If you choose to use ActivePerl, for the availability of (some) PPMs or other reasons, read on.

For 64bit ActivePerl you have the choice of two freely available tools to build extensions, the Windows SDK and the MinGW-w64 suite, setup for both is described below.

The Windows SDK

The freely available Windows SDK (current version) contains everything you need including a set of compilers. If however you are getting the Windows 8 SDK you will also need to get Visual Studio Express 11 for the compilers, as the Windows 8 SDK no longer includes a set of compilers.

Now you need to modify your environment to make the SDK tools available to perl (CPAN installations, etc..) I recommend using Rapid Environment Editor, or you can make .cmd file and modify your cmd.exe shortcut to add the /K option and the path to your .cmd file with your settings. I attempted, with some measure of success, to make a system of switching between different perls in a single cmd.exe session in this article.

The settings you need for the Windows 7 SDK are as follows (modify to taste:)

set PATH=C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64;C:\Windows\system32;C:\Windows
set INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE;C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\gl
set LIB=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\X64
set LIBPATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Lib\amd64

Now launch cpan in cmd.exe and try to install an XS module such as Class::XSAccessor to test everything out.

If you get link errors about not being able to find bufferoverflowU.lib, edit C:\Perl64\lib\Config_heavy.pl and remove all instances of bufferoverflowU.lib. This shouldn't happen with the newer ActivePerl builds however.

The settings for the Windows 8 SDK with the Visual Studio Express 11 compilers should be similar, but I have not tried that yet, so don't know the details.

MinGW-w64

The ActivePerl MinGW mode mostly works with MinGW-w64, although it is meant for the 32bit builds with older mingw.org suites so some tweaks are necessary.

First download the WIN64 native compiler suite from the MinGW-w64 download page in the WIN64 Downloads -> Personal Builds -> rubenvb -> release section. The file will be named something like x86_64-w64-mingw32-gcc-4.7.0-release-win64_rubenvb.7z. Unpack with 7-zip or WinRAR everything below the top level directory in the archive to C:\MinGW_w64 .

Modify your PATH to add C:\MinGW_w64\bin . See the part about environment settings in the previous section, I recommend Rapid Environment Editor.

Set the LIBRARY_PATH environment variable as follows:

set LIBRARY_PATH=C:\MinGW_w64\x86_64-w64-mingw32\lib

Now install dmake. We'll use a 32bit binary from CPAN so make sure that WOW64 is enabled in your OS if you are using an older server OS. Download the dmake dist from CPAN, open the archive, go into the dmake folder, and extract dmake.exe and the startup subfolder into C:\Perl64\site\bin . Then run:

icacls c:\perl64\site\bin\dmake.exe /grant your_user_name:(rx)

Next edit C:\Perl64\lib\Config_heavy.pl and remove all instances of bufferoverflowU.lib.

That's all there is to it. Now with gcc.exe in your PATH ActivePerl will go into mingw mode when it needs to build an extension, try it now by running cpan Class::XSAccessor or some such extension.

Note that if you will package Perl applications with built extensions, you will need to include the libgcc and libstdc++ (if there were any C++ extensions) DLLs with your package, to be run from the same directory as the perl interpreter or somewhere in PATH. This is also true for the new versions of the 32bit mingw.org toolchain. The alternative is to include

-static-libgcc -static-libstdc++

in your LDDLFLAGS along with the default $Config{lddlflags}. I'm going to submit a bug report to ActiveState to make these options default for newer gccs.

Read more...

Last modified: 2012-5-28 (月) at 10:51 am

Linux Backup with Back In Time

Here I will describe how to do scheduled automatic backups to an external hard drive on a Debian/Ubuntu Linux computer with the Back In Time system.

First install the package:

sudo aptitude install backintime-gnome

Preparing the Hard Drive

Plug in your USB/ESATA/FireWire hard drive into your linux computer, then do a:

dmesg | tail

to note the block device, such as /dev/sdd.

Next you will want to partition it. Use cfdisk or gparted.

Make one primary partition of type Linux (83) that is the size of the drive.

Next format it with your favorite file system.

Use a command such as:

sudo mkfs.ext4 /dev/sdd1

Now let's mount it. We are going to mount it under /media so that the updatedb cron job does not index it and clutter your locate db with your backup files. We are also going to mount it by UUID so that the order you plug in your devices, the presence of hubs, etc. does not affect mounting.

First make the mount point:

sudo mkdir /media/backup

Then get the UUID of the new partition:

sudo blkid /dev/sdd1

Now add the mount point to /etc/fstab using the UUID from the previous step:

UUID=e3b623e7-2049-46cf-89aa-1152c38e08e8 /media/backup ext4 defaults,nofail

Now mount it!

sudo mount /media/backup

Remember to mount it when you plug your hard drive in.

If you know of a way to automount an fstab entry, please email me so I can add it here...

We are going to make the backup directory one level below the mount point so that having the drive disconnected tells Back In Time to not run the backup job, otherwise it would run the backup job on the root file system!

sudo mkdir /media/backup/snapshots

Setting up Back In Time

Now you're ready to run the Back In Time configuration program. Run:

ssh -X root@localhost backintime-gnome

Click the Settings button.

For "Where to save snapshots" select /media/backup/snapshots.

For "Schedule" I use "Every Day" at 03:00. Choose a time your machine is likely to be idle and the hard drive is likely to be plugged in.

Click the Include tab. Add folders such as /home and /etc and any others you want to back up.

Press "Ok" and close the program.

Press Ctrl-C to close the ssh session.

And you're done!

I also highly recommend installing anacron:

sudo aptitude install anacron

especially on a laptop, because Back In Time runs from cron. This way if your laptop is off or asleep when the job is supposed to run, your backup will still run at some future time.

Final Thoughts

Backups can seriously save your arse. Hard drives and SSDs fail. Alot.

Now Mac OS X and Windows have attractive built-in backup options, Time Machine and Windows Backup, respectively. Time Machine is unmatched in power and simplicity. Windows Backup is not as shiny, but still does the job admirably.

With Back In Time, we now have a nice backup solution for Linux as well.

Enjoy the comfort of knowing that your data is safe.

Read more...

Last modified: 2012-1-31 (火) at 11:30 pm

Using SQL Anywhere on Mac OS X

Here I will go through the steps necessary to set up and use SQL Anywhere on Mac OS X.

Download and Install SQL Anywhere

It is available here: http://www.sybase.com/detail?id=1016644.

Open the package and double click the Install SQL Anywhere icon, select all components.

At the end click the Check for Updates button, it will take you to the EBF download. You will need to create a MySybase account to download the EBF package. Download the package, doubleclick the Install SQL Anywhere icon and select the update product option.

Set up Your User Environment

Add the following to your ~/.bashrc:

export SQLANYWHERE_HOME=/Applications/SQLAnywhere12/System
export DYLD_LIBRARY_PATH=$SQLANYWHERE_HOME/lib64:$SQLANYWHERE_HOME/lib32:$DYLD_LIBRARY_PATH
export DYLD_BIND_AT_LAUNCH=1
export PATH=$PATH:$SQLANYWHERE_HOME/bin64:$SQLANYWHERE_HOME/bin32

For the next step, open a new terminal session for the environment changes to take effect.

Create a Database

Execute the following to create a new database:

cd
mkdir sqlanywhere
cd sqlanywhere
mkdir logs
dbinit -t ./logs/hlaghdb.log -p 4096 -dba DBA,SQL hlaghdb.db

Set up the Database Server

Create a file called ~/Library/LaunchAgents/com.ianywhere.sqlanywhere.plist, put the following in that file, changing /Users/rkitover to your actual home directory and the database file name to your actual database file:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version='1.0'>
<dict>
<key>Label</key><string>com.ianywhere.sqlanywhere</string>
<key>WorkingDirectory</key><string>/Users/rkitover/sqlanywhere</string>
<key>EnvironmentVariables</key>
    <dict>
        <key>DYLD_LIBRARY_PATH</key>
        <string>/Applications/SQLAnywhere12/System/lib64:/Applications/SQLAnywhere12/System/lib32</string>
        <key>DYLD_BIND_AT_LAUNCH</key>
        <string>1</string>
    </dict>
<key>ProgramArguments</key>
<array>
        <string>/Applications/SQLAnywhere12/System/bin32/dbsrv12</string>
        <string>-ud</string>
        <string>/Users/rkitover/sqlanywhere/hlaghdb.db</string>
</array>
<key>Debug</key><false/>
<key>Disabled</key><true/>
<key>KeepAlive</key><true/>
</dict>
</plist>

NOTE: we do not give the database server a name in this example. This is because for some reason when I tried to use -n option to dbsrv12 it responded with Communication error. Try running dbsrv12 from the command line with the -n option to see if it works for you, if it does add it to the ProgramArguments in the .plist file. E.g.:

dbsrv12 -ud -n SQLANYWHERE hlaghdb.db

If this works, add the following to the .plist file after dbsrv12:

<string>-n</string>
<string>SQLANYWHERE</string>

The following examples will all assume the database server has no name.

Now execute the following to load the service and start the database server:

launchctl load -w ~/Library/LaunchAgents/com.ianywhere.sqlanywhere.plist
launchctl start com.ianywhere.sqlanywhere

You should see the database server in ps:

$ ps aux | grep dbsrv
rkitover       51654   0.3  0.2  1627072  14000   ??  Ss    1:02PM   0:03.07 /Applications/SQLAnywhere12/System/bin32/dbsrv12 -ud /Users/rkitover/sqlanywhere/hlaghdb.db

It will be started across reboots.

launchctl stop doesn't work with this plist, so if you need to restart the server, just kill the process and do a launchctl stop followed by a launchctl start.

The SQL Anywhere Applications

Open the SQLAnywhere12 folder under Applications in Finder.

The applications we're interested in are Sybase Central and Interactive SQL.

The Sybase Central application will allow you to configure all aspects of your database. To use it, open the application, double click on the SQL Anywhere 12 plugin, right click inside the blank window and choose Connect, choose Connect to a running database on this computer, enter the username and password you used with the dbinit command, which in this example is DBA and SQL respectively.

The Interactive SQL application is a handy GUI for testing SQL statements on your database. To login, open the application, choose Database authentication, choose Connect to a running database on this computer, enter your username and password and press Connect. Inside the application, enter your SQL statements in the SQL statements window and press F5 to execute them; you will see your results in the results window.

Using sqsh

If you would prefer a commandline utility to Interactive SQL for testing SQL statements, you can use the sqsh utility from MacPorts (http://www.macports.org/.)

The sqsh utility is an interactive SQL utility for databases using the TDS protocol, such as Sybase ASE and Microsoft SQL Server. SQL Anywhere also uses the TDS protocol, so the utility works for these databases as well.

If you do not yet have an interfaces file, follow these steps to set one up.

In your .bashrc add the following:

export SYBASE=~/sybase

In this directory create a file called interfaces with the following:

SQLANYWHERE
  master tcp ether localhost 2638
  query tcp ether localhost 2638

Now you can launch sqsh like so:

sqsh -S SQLANYWHERE -U DBA -P SQL

To use it, type in a SQL statement, it can span multiple lines, then type go on a line by itself to execute it. This may take some getting used to if you're used to tools such as sqlplus or dbish, where SQL statements are terminated by a semicolon. You can use dbish with SQL Anywhere as well, I will describe how to do so further down.

Setting up ODBC

If you have UnixODBC from MacPorts (http://www.macports.org/,) you can set up the included ODBC drivers with it.

In /opt/local/etc/odbcinst.ini add the following:

[SQLAnywhere]
Description = SQL Anywhere
Driver = /Applications/SQLAnywhere12/System/lib64/libdbodbc12.dylib
Setup = /Applications/SQLAnywhere12/System/lib64/libdbodbc12.dylib
FileUsage = 1

Now lets test it out (take out the -S flag to cpanm if you use local::lib):

curl -L http://cpanmin.us | perl - -S App::cpanminus
cpanm -n -S DBI
cpanm -n -S DBD::ODBC
perl -MDBI -le 'my $dbh = DBI->connect("dbi:ODBC:driver=SQLAnywhere", "DBA", "SQL"); print for $dbh->selectrow_array("select 42")'

Installing the Perl Driver

First install DBI:

curl -L http://cpanmin.us | perl - -S App::cpanminus
cpanm -n -S DBI

Then build and install the Perl library:

cp -a /Applications/SQLAnywhere12/sdk/perl /tmp/sqlany
cd /tmp/sqlany
perl Makefile.PL
make
sudo make install
cd
rm -rf /tmp/sqlany

Test it out:

perl -MDBI -le 'my $dbh = DBI->connect("dbi:SQLAnywhere:", "DBA", "SQL"); print for $dbh->selectrow_array("select 42")'

Using DBI::Shell (dbish)

If you don't like Interactive SQL or sqsh, you can try the Perl module DBI::Shell for a commandline SQL utility.

First install it:

curl -L http://cpanmin.us | perl - -S App::cpanminus
cpanm -n -S DBI::Shell

Then launch it. I would recommend using the ODBC driver, especially if you use UUID columns:

dbish dbi:ODBC:driver=SQLAnywhere DBA SQL

To use the Perl binding:

dbish dbi:SQLAnywhere: DBA SQL

SQL statements are terminated by semicolons, type /quit to exit the shell and /help to see what commands are available.

If you would like to save the readline history of your sessions and use it for completion, you can wrap it with rlwrap. To do so add this alias to your ~/.bashrc:

alias sqlany="rlwrap -a -N -t dumb -i -f ~/.sqlanywhere_dbish_history -H ~/.sqlanywhere_dbish_history -s 30000 dbish dbi:ODBC:driver=SQLAnywhere DBA SQL"

and initialize the history file:

touch ~/.sqlanywhere_dbish_history

then you can type sqlany to launch the shell.

DBIx::Class ORM Support

There is complete support for SQL Anywhere in DBIx::Class and DBIx::Class::Schema::Loader (the Catalyst create=static helper.)

That's All

Hope you found this guide helpful. Feel free to leave comments on the blog or email me if you have questions.

Read more...


Using readline with Oracle SQL*Plus

By default, Oracle's SQL*Plus has no support for history, command line editing, etc.

This problem can be solved with the rlwrap utility. There is a Debian package, or you can easily compile it for any system.

Source is here: http://utopia.knoware.nl/~hlub/rlwrap/.

Once installed, add this alias to your .bashrc:

alias sqlplus="rlwrap -i -f ~/.sqlplus_history -H ~/.sqlplus_history -s 30000 sqlplus"

This defines a history file and uses it as your completion wordlist, and sets the history size to 30000 entries.

Before running it for the first time, do a:

touch ~/.sqlplus_history

That's all there is to it, and now you have readline support in your SQL*Plus!

Also check out another Oracle utility called yasql. You can find more information on it here: http://www.orafaq.com/wiki/YaSQL.

Read more...