Sequence Technology Articles

Thursday, August 14, 2008

M$ Blunder

You have GOTTA laugh:

http://www.theregister.co.uk/2008/08/13/olympics_blue_screen_death/

Tuesday, July 15, 2008

Using a USB 3G modem with Ubuntu Linux on the MSI Wind / Advent 4112

After purchasing the Advent 4112 / MSI Wind, the first thing I had to do was get Ubuntu up and running. This was very straight forward using the 8.04.1 iso.

Ubuntu supports the 3 Huawei E220 modem out of the box, so all I had to do was install and configure gnome-ppp to do the dial-up for me.

To install gnome-ppp, open a terminal and type:
sudo apt-get install gnome-ppp

Then run gnome-ppp from the Internet menu.

Here are the settings I use for gnome-ppp:

First Screen:

User: user
Pass: pass
Remember password: yes
Phone number: *99#

Setup Screen:
Device: /dev/ttyUSB0
Type: USB Modem
Speed: 460800
Phone Line: Tone
Volume: off
Dial Prefix:
Dial attempts: 1
Wait for dialtone: yes

Init Strings:
Init2: ATZ
init3: ATQ0 V1 E1 S0=0&C1 &D2 +FCLASS=0

Networking Tab:
Dynamic IP Address
Automatic DNS

Options Tab:
All unchecked except:
Dock in notification area
Abort connecting if no dialtone
Check default route
Ignore terminal strings (stupid mode)
Idle time (0) disabled

Sunday, July 13, 2008

MSI Wind / Advent 4211

I have just driven a three hour round trip to the only store in the south of England which has the Advent 4211 in stock.

The Advent 4211 is the MSI Wind, only re branded and in different colors. The specs and dimensions are exactly the same.

Weighing in at just about .2 of a kilo more than the Eee and only slightly larger its still very much a mobile PC. The keyboard however is much more usable than the Eee. Having an 80gb hard drive does give the advantage of dual-boot possibilities, however you do lose some of that "no moving parts" shock proof factor or the Eee.

The Advent comes pre-installed with Windows XP, and although I'm not a fan, XP does feel snappy enough running on the Atom processor with 1Gb of RAM (and so it should!)

I have taken some pictures of the Advent / Wind along side the Eee PC 701 and a HP pavillion tx 1000 for comparison purposes.



Installing Ubuntu Linux on the Wind was fairly straight forward, however ensure you use at least 8.04.1 (the .1 being the important bit) wireless drivers and install instructions can be found here.

In terms of practicality, the Wind's 80Gb hdd and larger keyboard probably puts it in front of the Eee, however for battery life and "Geek Chique" the Eee still has it.

Thursday, July 03, 2008

Amazon Simple Storage

I have recently been playing with Amazon's Simple Storage Solution or "S3". The service provides users with unlimited, secure and reliable storage for about 10 US dollar cents per gig per month. Which is cheap. The service is aimed at developers and does not provided would be "home" users with any front ends for uploading or downloading files. Only API's. The service supports REST and SOAP and is pretty easy to use, once you have got your head around signing your requests.

I have developed a "home user friendly" Windows and Linux compatible front end for the service which can be used to browse your storage area, upload, download and delete files. It looks similar to Windows Explorer and supports drag and drop. The software (River Drive) can be found over at www.TristanPhillips.com under the projects section. To use the software you will need to sign up to the S3 service, but you only pay for what you use, and there is no minimum charge.

Monday, May 19, 2008

Tether your iPhone and your EeePC

If you own an iPhone in the UK, chances are that you are on an unlimited data contract with a rather large mobile service provider. Why not take advantage of that data connection from your EeePC. Unlike mobile 3G which requires a 3G datacard to use on the Eee, your iPhone and Eee can talk to each other using their built in WiFi connections. You will need to have your iPhone "Jail Broken" so you can install the required proxy software.

Start by installing TinyProxy on your iPhone, this can be found in the network section of the installer app. I think you will need the BSD subsystem too, I have.

Once you have installed TinyProxy, setup a new AdHoc wireless connection on your Eee. To do this choose "Network" from the internet panel, Press "Create", Choose "Local Area Network - Wireless", Press "Next" as the default card is the right one, Choose "Static IP Address" and press "Next". Enter "192.168.1.2", "255.255.255.0", "192.168.1.1". Press "Next". Enter "192.168.1.1", press "Next". Press "Next" again. Enter a SSID such as "EeePC", choose "Ad-hoc" and press "Next". Leave "Any" checked and press next. Tick "Enable encryption" and enter a WEP key. This will stop others stealing your (very limited) internet bandwidth. Then name your connection. I have called mine "iPhone", hit "Next". Then "Finish".

Cool, now start that wireless network by going into "Network" (you may already be there) choosing iPhone, press "Connection" > "Connect". After a dialog box, you should now be hosting a new wireless network.

On your iPhone, choose "Settings", "Wifi" > Select the "iPhone" network and press the ">". Press the "Static" tab and enter "192.168.1.1", "255.255.255.0". Press "Wireless Settings" to save your setup.

Back on your Eee, press Ctrl+alt+T and in the console enter "ping 192.168.1.1", hit return and you should see the ping replying. If not, check your settings.

Now to use the iPhone connection you need to tell Firefox to use the iPhone as its proxy server. Hit "Edit" > "Preferences" > Network tab > "Settings", choose "Manual proxy configuration" and enter "192.168.1.1" port "8080", tick "Use this proxy server for all protocols". press "OK", "Close".

Now, try google! If it does not work, make sure your ping is working, and if still no luck, reboot your iPhone, I had to a couple of times. I leave the ping pinging as a visual confirmation of the link between my toys.

You may need to leave your iPhone "awake" to use the connection, so modify the "auto lock" setting to suit you. The connection really is quite slow, but OK for emergency stuff.

I'm writing this on the train using my Eee and iPhone. Bloomin' marvelous!

Monday, April 21, 2008

Ubuntu 8.04

Ubuntu is a community developed, Linux-based operating system that is perfect for laptops, desktops and servers. It contains all the applications you need - a web browser, presentation, document and spreadsheet software, instant messaging and much more. www.ubuntu.com

The Ubuntu developers are constantly bringing you the absolute latest and most stable software that the open source and free software communities have to offer. This is their latest result: the Ubuntu 8.04 LTS release candidate, which brings a host of excellent new features.

Friday, April 11, 2008

Disable memory trimming in VMWare Server to reduce IO queues

I was suffering from an ab-normally high %wa figure in top. Disabling memory page trimming in my VMWare guest seems to have solved the issue.

You can disable memory trimming for a guest in the virtual machine settings editor (VM > Settings > Options > Advanced). In the Settings section of the Advanced panel, select Disable memory page trimming.

Tuesday, February 12, 2008

Router Monitoring Script

If you have a Netgear DG* router and wish to automatically reconnect / reboot when your connection drops, try adding this script to your cron.hourly:

#!/bin/sh

# CheckRouterStatus
# Tristan Phillips
# Checks the status of a netgear DG* router and reconnects / reboots if not connected.
# Licensed under the terms of the GNU.

# Arguments:
# $1 = Ping target, use www.google.co.uk
# $2 = Router IP, normally 192.168.0.1 or 192.168.1.1
# $3 = The router username (admin)?
# $4 = Router password (password)?

# Check arguments are present
if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ]; then
echo usage: CheckRouterStatus.sh PingTarget RouterIP RouterUser RouterPassword
exit
fi

# Try the ping
echo Attempting to ping $1
ping -W 10 -c 8 $1 >/dev/null 2> /dev/null

# Check result
if [ $? -ne 0 ]; then

# The ping failed! Get Stats and disconnect the router
echo Ping failed, dumping stats and disconnecting router . . .
echo `date` Ping failed, here are the router stats: >> /var/log/RouterReboots
wget --user $3 --password $4 "http://$2/setup.cgi?next_file=stattbl.htm"
# Execute the first router command twice as authorization tends to fail...
wget --user $3 --password $4 "http://$2/setup.cgi?next_file=stattbl.htm"
grep ttext setup.cgi?next_file=stattbl.htm >> /var/log/RouterReboots
echo `date` Disconnecting router >> /var/log/RouterReboots
wget -q --user $3 --password $4 "http://$2/setup.cgi?todo=disconnect" > /dev/null 2> /dev/null

echo Waiting . . .
sleep 10

echo Connecting router . . .
echo `date` Connecting router >> /var/log/RouterReboots
# Async call to connect incase of timeout
wget -q --user $3 --password $4 "http://$2/setup.cgi?todo=connect" > /dev/null 2> /dev/null &
echo Waiting . . .
sleep 20

# Try again
echo Attempting to ping $1
ping -W 10 -c 8 $1 > /dev/null 2> /dev/null
# Check results
if [ $? -ne 0 ]; then
echo Ping failed . . .
echo `date` Disconnect / Connect cycle did not correct the issue! Trying a reboot . . . >> /var/log/RouterReboots
wget -q --user $3 --password $4 "http://$2/setup.cgi?todo=reboot" > /dev/null 2> /dev/null
else
echo Ping OK, Connection issue solved!
echo `date` connection issue solved. >> /var/log/RouterReboots
fi

# Be nice and logout
wget -q --user $3 --password $4 "http://$2/setup.cgi?todo=logout" > /dev/null 2> /dev/null

else
echo Ping OK
fi

#clean up
rm setup.cgi*

exit 0

Tuesday, December 18, 2007

Skype 2 Beta on the eee supports video calling

I'm not the first to post this, but hey, the more the merrier....

If you want to try video calling on the eee, download the Xebian skype 2 package from skype.com. Install it with:

sudo dpkg -i [PackagePath]

Activate the on board camera with:

echo 1 > /proc/acpi/asus/camera

Then configure Skype to use the detected camera and you should be good to go.

Ultramobilegeek and JKOnTheRun seemed to have a few stability issues, but I have used this for hours on end with no problem at all!

Saturday, November 17, 2007

3G on the Eee PC

I just nipped down to the 3 shop and picked up a Huawei USB 3G modem. I literally popped it into the Eee and setup a new connection in "Network". No extra drivers, no complicated configuration. It even found all the "3" setting for me.

This could not have been any easier, and will work with any provider using the Huawei E220 USB modem (Most).

Can you imagine things being so easy on Windows!? I think not!

Asus Eee PC

Its arrived!

Finally the wait is over for me... I got my new white Asus Eee PC delivered this morning. If you are reading this; you will have read loads of shining reviews about this little wonder, so I won't bore you with another one. Suffice to say I LOVE it. However, while I was waiting for this unit to arrive; I was quite frustrated at the lack of images out there showing the actual scale of this machine. So here you go:



I'm writing this on the Eee and am already used to the scale of the keyboard. Linux really does boot in about 15-20 seconds and the interface is really easy to use, so as well as geeks like myself who will no doubt have the thing in bits (metaphorically) within five minutes; this would make a great homework PC for the kids.

I think 2008 is going to be a truly great year for Linux!

Labels: ,

Friday, September 21, 2007

www.TristanPhillips.com

I have finally put up a page where I can post links to some of the utilities I have put together.

www.tristanphillips.com

Includes a number of useful command line applications developed by myself:

Tools for password testing, printer hacking, account enumeration, port sniffing, photo organization, event log monitoring, command line email, file expiration, hashing, SQL data exporting, automated FTP and port forwarding.

The tools are intended as proof of concept / testing utilities and should not be used for illegal / questionable purposes.

C# TCP Checksum

Recently I have been developing some code that needed to calculate the checksum for a TCP packet before transmission.

The TCP checksum is the 16 bit one's complement of the one's complement sum of all 16 bit words in the TCP header and text. A 96 bit pseudo header is also taken into account when calculating the checksum. This pseudo header is constructed from the IP src address, dst address, protocol and TCP header length. For the purposes of calculating the checksum, the checksum word in the TCP buffer is set to 0's.

There seems to be very little information in regarding this floating about, and certainly no C# examples; so here is the working code, should you need it:

// Calculates the TCP checksum using the IP Header and TCP Header.
// Ensure the TCPHeader contains an even number of bytes before passing to this method.
// If an odd number, pad with a 0 byte just for checksumming purposes.
static ushort GetTCPChecksum(byte[] IPHeader, byte[] TCPHeader)
{
uint sum = 0;
// TCP Header
for (int x = 0; x < TCPHeader.Length; x += 2)
{
sum += ntoh(BitConverter.ToUInt16(TCPHeader, x));
}
// Pseudo header - Source Address
sum += ntoh(BitConverter.ToUInt16(IPHeader, 12));
sum += ntoh(BitConverter.ToUInt16(IPHeader, 14));
// Pseudo header - Dest Address
sum += ntoh(BitConverter.ToUInt16(IPHeader, 16));
sum += ntoh(BitConverter.ToUInt16(IPHeader, 18));
// Pseudo header - Protocol
sum += ntoh(BitConverter.ToUInt16(new byte[] { 0, IPHeader[9] }, 0));
// Pseudo header - TCP Header length
sum += (UInt16)TCPHeader.Length;
// 16 bit 1's compliment
while ((sum >> 16) != 0) { sum = ((sum & 0xFFFF) + (sum >> 16)); }
sum = ~sum;
return (ushort)ntoh((UInt16)sum);
}

private static ushort ntoh(UInt16 In)
{
int x = IPAddress.NetworkToHostOrder(In);
return (ushort) (x >> 16);
}

Tuesday, June 19, 2007

Ubuntu says no to M$

After the recent deals made by a number of Linux vendors with M$ regarding patent threats, I am extremely glad to hear that Ubuntu (Canonical) has told M$ to shove it.

Mark Shuttleworth of Canonical blogs:

Allegations of "infringement of unspecified patents" carry no weight whatsoever. We don't think they have any legal merit, and they are no incentive for us to work with Microsoft on any of the wonderful things we could do together. A promise by Microsoft not to sue for infringement of unspecified patents has no value at all and is not worth paying for. It does not protect users from the real risk of a patent suit from a pure-IP-holder (Microsoft itself is regularly found to violate such patents and regularly settles such suits). People who pay protection money for that promise are likely living in a false sense of security.

Thursday, May 31, 2007

Novell losing money after getting into bed with M$

Novell's decision to do business with Microsoft is costing them lolly:
http://www.theregister.co.uk/2007/05/31/novell_quarter_micosoft/

Tuesday, May 22, 2007

Microsoft takes on the Free world

Its no secret amongst my friends, family and collogues that I am a fanatical Free software supporter and Linux user. Until now I have refrained from using this Blog as a political ranting ground. However after I saw this, I couldn't help myself.

Microsoft is trying to claim that Free software, such as Linux infringes on 235 of its "patents". (Yes those quotations are meant to be there.)

Read about it here

Perhaps if they invested as much time and money in their products (Vista anyone?) as they do trying to cream off profit from other honest peoples hard work, they may have an operating system worth using?

I have just got a new laptop, dual AMD 64's, 2Gb of RAM and it takes about 10 minutes to restart to a "usable" Vista UI. Is it any wonder that the first thing I did was to install the FANTASTIC Ubuntu 7.04?

Its time people realised what a monopolising bully M$ really is and made a bid for Freedom.

Friday, March 23, 2007

WebJam

WebJam, a new Web 2.0 site looks pretty cool.... You can create your own page, add pre-built "modules" and allow others in your community to edit it. Question is, do I move my blog over, or link it in? ;)

They are listed in "25 UK Web 2.0 startups to watch in 2007" which is here

Sunday, December 10, 2006

SDL Games Programing

I have recently been working on a remake of the Nintendo classic "Mario". The remake is written in C++ using the SDL library. SDL stands for Simple DirectMedia Layer. Although I am writing and testing the code on Linux at the moment, I hope the game to be cross-platform if ever completed. ;)
In my search for documentation for SDL, as well as the excellent documentation found at www.libsdl.org I found a site called Lazy Foo' Productions. This site hosts an excellent games tutorial for people who may not have very much experience in game writing. Highly recommended: http://lazyfooproductions.com/SDL_tutorials/index.php

Tuesday, September 12, 2006

Homesight Remote V0.31

Homesight Remote version 0.31 has been released. This release includes the previously omitted "Hasher" application for changing the servers login credentials.

Enumerating user accounts with LookupAccountSid() and LookupAccountName()

Recently I was wondering about enumerating account names on a remote machine. This can be done with the 2 windows API functions LookupAccountSid() and LookupAccountName().
LookupAccountSID finds the SID for a named account and LookupAccountName finds the named account for a SID. Using the method described by Evgenii Borisovich Rudnyi (writer of user2sid and sid2user) in 1998 it is possible to find the name of the administrator account on a remote machine.

First, find the SID for any account on the machine using LookupAccountSID(). Guest is a good bet. The SID will look something like this: S-1-5-21-1482476501-963894560-682003330-123
Once you have found any old SID, take the last section of the SID (Called the RID) and replace it with 500. 500 will ALWAYS be the administrator account.
Then call LookupAccountName() passing in the new SID. That will return the name of the administrator account.
You can enumerate all the accounts on the machine by looping through RIDs 500 to say 4000.

This is functionality provided by the Win API for use by anyone. No hacking here.

I have recently written an implementation of the methods described in above .NET. Here is the output from this tool:

SidTool v0.1 - Tristan Phillips

SidTool -? for help

Querying machine: Local
Starting Account: Guest
Filtering Results: False
From RID: 400
To RID: 3000

Looking for Guest Sid . . .
Found Guest Sid: S-1-5-21-1482476501-963894560-682003330-501
Using Guest Sid as reference to find Administrator Sid . . .

Found administrator account called: XXXXXX\Administrator (SidTypeUser)
@ S-1-5-21-1482476501-963894560-682003330-500

Enumerating RID's from 400 to 3000 . . .

500 XXXXXX\Administrator (SidTypeUser)
501 XXXXXX\Guest (SidTypeUser)
513 XXXXXX\None (SidTypeGroup)
1000 XXXXXX\HelpAssistant (SidTypeUser)
1001 XXXXXX\HelpServicesGroup (SidTypeAlias)
1002 XXXXXX\SUPPORT_388945a0 (SidTypeUser)
1004 XXXXXX\IUSR_PCL001424 (SidTypeUser)
1005 XXXXXX\IWAM_PCL001424 (SidTypeUser)
1006 XXXXXX\Debugger Users (SidTypeAlias)
.
.
.

You get the Idea.
Also, if you start out with a domain account, you will find the name of the domain administrator. To query a remote machine you can try creating a null connection the the IPC$ share first.

Ill post the utility here soon.

The moral?: Although it is good practice to change the name of the Administrator account on a machine, you should not rely on this obscurity as a means of security. Anyone familiar with the methods above can easily find your new "secret" name.

Monday, August 07, 2006

Rules to Better ...

SSW's rules and standards seem to be pretty good . . .
http://www.ssw.com.au/SSW/Standards/Default.aspx

Monday, June 12, 2006

Xgl Rocks

Recently I undertook the geek mission of getting Xgl working on my desktop at home. Xgl is the 3D accelerated xserver built on top of OpenGL.

Check it out at: Xgl on Wikipedia

I achieved my goal by upgrading my Suse installation from 10 to 10.1 (which was very smooth). To get Xgl working you need to choose Xgl and Compiz in Yast. Compiz is the 3d enabled window manager.

Getting Xgl working on my nvidia card was not as easy as I had hoped, however, after getting the drivers from nvidia and telling Sax to enable 3d acceleration, I got it working.

Later I installed Suse 10.1 on my Laptop which uses an Intel graphics card. Xgl and compiz worked out of the box!

Friday, April 21, 2006

Homesight Remote v0.2

Homesight Remote v0.2 has been released to Sourceforge. This release adds full support for camera captured images. You can get the software at http://homesightremote.sourceforge.net

Saturday, April 15, 2006

Homesight Remote v0.1

Following my last post I have release version 0.1 of Homesight Remote. The software allows you to view the last 20 events in your Homesight event log via any web browser. You can read about / download the software here: http://sourceforge.net/projects/homesightremote/

Wednesday, March 29, 2006

Motorola Homesight

The first thing I wanted to do after buying and installing my Motorola Homesight system was to gain remote access to the captured images and event logs. It would of course be possible to gain access to the system remotely using something like Terminal Services or VNC, but I wanted a solution that would allow me to access the information using any web browser.

After a little poking about I discovered that the Homesight system uses the Mckoi Database, an open source Java SQL database system published under the terms of the GNU license (although Motorola do not redistribute this license for some reason?). It is relatively easy to find the database username and password by looking at the database files in the data directory. The default on my system was:
user: Xanboo password: 115West30th

I decided to write a small Java app to query the structure of the Homesight database. Here is what I found:

archives
--------
Archive Time
Archive Date
Archive Type
Archive Device Type
Archive Device Name
Archive File Type
Archive File Name
Archive Timestamp
Archive Note

profiles
-------
NotificationType
Address


txtprofiles
----------
NotificationType
Address

The interesting data was stored in the archives table. A simple select on this table produces the following information (example)

13:04:28, 28 Mar 2006, 5, 6, Door-Window Sensor 2B, 1, , 2006-03-28 13:04:28.403, closed
13:04:26, 28 Mar 2006, 2, 12, Camera - Day 2D, 2, c:/progra~1/motoro~1/./data/archive/image32923.jpg, 2006-03-28 13:04:26.684, Triggered by schedule 'Camera - Day 2D660 S34734'
13:04:24, 28 Mar 2006, 2, 12, Camera - Day 2D, 2, c:/progra~1/motoro~1/./data/archive/image32922.jpg, 2006-03-28 13:04:24.793, Triggered by schedule 'Front Door Alert'

As you can see, included in the logs is also a link to any images or videos captured by the system.

Once I gained access to this information, it was a straight-forward task to write a web application allowing access from any browser.

If you would like to learn more, feel free to leave me questions.

Friday, March 17, 2006

Mini-ITX Rundfunker

I have just seen this project on mini-itx.com. Well worth a mention:
Mini-ITX.com is a fantastic site for the geeky minded!

Thursday, March 16, 2006

Hasher

Using the "hasher" utility you can:

  • Create MD5 / SHA1 / Base 64 hashes for strings and files.
  • Ensure files you have downloaded have not been modified or corrupted.
  • Reverse engineer a hash using a word list & Apply common password modification guesses to the word list.

This utility demonstrates intelligent dictionary cracking and highlights the need for a strong password.

Important: I have developed this utility for demonstrational / educational purposes only. I cant be held responsible if you use it to do something stupid.

Sample output:

C:\>hasher -m MD5 -h -f "C:\HasherV0.2.zip"

Hasher V0.2 - ^&*%$@

C:\HasherV0.2.zip is 144118 byte(s)
MD5 Hash = 368f17ee1588c7c04de83b7fe3ce59d8

C:\>

C:\>hasher -m SHA1 -h -v "Please hash this string"

Hasher V0.2 - ^&*%$@

SHA1 Hash = 1fd49c1b5dd1011d6596cded625b1ca95762e0

C:\>

C:\>hasher -D -v "htskz8kp9UdGhWSyAv9Eccc9Bx8=" -l dict.txt -a "JBloggs"

Hasher V0.2 - ^&*%$@

Attempting to reverse hash htskz8kp9UdGhWSyAv9Eccc9Bx8=
Using: SHA1 with wordlist dict.txt
Input is in: Base64
Appending: JBloggs to the guess

62.99%

Found: orange03

C:\>

C:\>hasher -?

Hasher V0.2 - ^&*%$@

Usage: hasher [-D -v <value> -p <text> -a <text> -l <path> -m
<method>
-h -s -?]

Valid arguments are:

-D - Attempt reverse hash using word list
-v - <value> Value for hashing or reversing
-p - <value> Prepend value to value for hashing
-a - <value> Append value to value for hashing
-l - <value> Path to wordlist file
-m - <SHA1/MD5/B64> hash method (default SHA1)
-h - Produce hex output rather than base 64
-s - Do not try common password modification methods
-? - Show this message

C:\>

Hasher is Mono compatible!

Download Hasher from www.TristanPhillips.com

Wednesday, March 15, 2006

acpi=off

I recently got myself a nice new Philips x60 laptop. Being a huge fan of the penguin, the first thing I did was to shrink the windows partition right down and install Suse Linux 10.0.

People often complain about the lack of device support in Linux, however Suse supported every device this laptop had, right out of the box. Display, Modem, Wireless LAN, Sound everything. Apart from, it would seem, the laptops cooling system.

After a few hours gazing lovingly at my new toy, I noticed that my thighs were starting to get a tad warm. I also noticed the lack of any fan noise. After booting into Windows the fan started up as expected. Oh Dear :(

Panic not! Linux is extremely flexible, and with the help of a few newsgroups / handy blog postings, most problems can be ironed out fairly easily.

ACPI is an interface that allows the operating system to control power management on computers. This includes cooling. Evidently acpi did not support my laptops cooling systems and needed to be disabled. Disabling acpi allows the hardware (BIOS) to manage the cooling. There is an argument that says all power management should be left to the hardware anyway...

To disable acpi in Linux add acpi=off to your kernel arguments. This can be achieved in the configuration of your boot loader (probably GRUB, so grub.conf). In Suse you can use Yast.

Visual Studio 2005

I recently made the mistake of completing a project in the all new Visual Studio 2005. I was drawn in by the new controls and language features... Now I find myself in a "World of Pain"!

You need to avoid it until they have released some service patches / hot fixes. Its TERRIBLE! In my experience it crashes all the time, especially when working on forms which use visual inheritance. I now find myself forced to do all form editing in code. Its just lucky the project is practically finished.

I would be interested in hearing from anyone who has had the same issues / managed to find a fix. Bill?

Tuesday, October 11, 2005

Add a Cygwin command as a Windows service

If you want a Cygwin app (Apache or Webmin for example) to start when windows does, there is a useful tool that you should know about. "cygrunsrv" comes as standard with Cygwin and can be used to create Windows services.

For example, to have Apache run when Windows boots:

cygrunsrv -I service_name-p /usr/local/apache/bin/httpd.exe [-a arguments] \ [-e VAR=VALUE] [-t auto manual] [-u user] [-w passwd]

Show The Progress of an SQL Database Restore

Add the STATS option below, the numeric being a percentage value. The following restore command will display a progress after each 1% of the database restored.
Brilliant!

RESTORE DATABASE Bla
FROM DISK='D:\DB Backup\BLA'
WITH
MOVE 'Bla' TO 'D:\Data\Bla.mdf',
MOVE 'Bla_Log' TO 'D:\Data\Bla.ldf',
STATS = 1

Thursday, October 06, 2005

The Send To Menu

Here is a cool tip;

Opening unknown file types can sometimes be really annoying, especially if you just want to take a look at the contents in notepad.

Add a shortcut to notepad/wordpad in the SendTo directory in C:\Documents and Settings\username\SendTo.
When you have done that, you can right click on any file, choose send to, then notepad to see the contents of the file.

You can of course add any useful applications to your send to menu. Easy!

Tuesday, July 27, 2004

Mono

If you have ever wished that writing applications for Linux was a little easier, then your dreams just came true.
Recently Novell have released version 1 of their .NET framework titled "Mono". Which means "Monkey" in Spanish.

Mono V1 includes a C# compiler, an ECMA compatible runtime engine and a whole host of class libraries. These libraries include ADO.NET, ASP.NET and Gtk#. Gtk# is a set of .NET bindings for the gtk+ toolkit allowing you to build fully native Gnome applications, and also includes support for UIs built with the Glade toolkit.
The release also includes an IDE, debugger and help library.

I downloaded and installed the Mono v1 packages with no problems at all using Fedora core 2. 

A nice point to note is that Mono includes support for Windows.Forms via Wine, so if you want to write applications in windows and compile them in Linux you can do this without any issues.
However lets face it, with support for Gnome you'd have to be mad to stick with Windows!

www.Mono-Project.com


What's coming in ASP.NET 2?

ASP.NET 2 or "Whidbey" will be released with the next version of the Microsoft .NET framework. It will be a major release including a number of significant changes providing a large increase in the level of functionality. For developers who do not plan to upgrade all their application to the latest version of .NET, the good news is that this release is 100% backward compatible with the current version.

Some of the new features include:

Master Pages
Themes
New Data Controls
Better Data Binding, including Business Objects
Login Controls
Membership and Role Management Services
Site Navigation Controls
Personalization Services
Web Part Controls
Integrated Mobile Support
Pre-Compilation of Applications
New MMC Snap-In
Configuration APIs
Richer Application Tracing
Heath Monitoring
Auditing

For more information on the new features available, and for beta information, check out the Whidbey home page at: http://msdn.microsoft.com/asp.net/whidbey/default.aspx.

Tuesday, May 18, 2004

Shaped forms in .NET

Shaped forms are often used nowadays to increase the visual appeal of an application, when done correctly and combined with some good graphics they can look extremely good. A common example is Windows Media Player.
Using some very simple code, it is possible to implement form shaping in .NET, the following examples are in C#.

The basic idea behind form shaping in .NET is as follows:
1. Create a new "GraphicsPath" object.
2. Add a shape to the new GraphicsPath object.
3. Set your forms "Region" property to be a new "Region" object using your new GraphicsPath object as the constructor argument.
Its as simple as that.

The GraphicsPath object has a number of methods to aid in adding shapes, for example:
AddArc
AddBezier
AddClosedCurve
AddCurve
AddEllipse
AddLine
AddPie
AddPolygon
AddRectangle

The "AddPolygon" method is especially useful as this allows you to create any shape you like, by adding an array of points to the GraphicsPath.

I have created an example application that will allow you to create any shaped form you like, by clicking or "drawing" out the regions of your desired form. To download the example click here (coming soon, I promise!).

Here is a simple example that will provide a circular shaped form, place it in your forms Load event:

GraphicsPath p = new GraphicsPath();
p.AddEllipse(0,0,200,200);
newForm.Region= new Region(p);


Monday, May 17, 2004

Stop Kudzu hanging your system at boot time

A small number of laptop Linux users may find that their system hangs at boot-up during the "Checking for new hardware" stage.
This is caused by Kudzu, the hardware probing tool.
This issue affects HP and Compaq machines in particular.

To stop this:
1. Boot from your Linux installation CD.
2. Type "linux rescue" at the first prompt.
3. Choose your language and region.
4. Select "no" when asked if you wish to start networking.
5. Select "Continue".
6. You will be told where your system has been mounted, probably
"/mnt/sysimage", change to this directory "cd /mnt/sysimage".
7. Type "cd etc/init.d"
8. Type "rm kudzu"
9. Reboot your machine and the problem should be solved.

Tuesday, May 11, 2004

Automate FTP Uploading and Downloading

A feature of the windows console ftp client that not a lot of people know of is the ability to run a script.
This can be really useful for automating web site content release. Just write a script to upload all your regularly changing files to your server, and you can release with a double click!
Not only can you automate file transfers, but also the login / logout process.

Here is an example script:

open [your server address]
[username]
[password]
put default.asp
put links.asp
get trace.xml
bye

To use this script, simply enter

ftp -s:[scriptfilename]

You could write a bat file with the above line, to enable a double click release.

SQL Server Collation Settings

To ensure the collation order of a new SQL server install is "Latin1_General_Ci_AS"
You must follow these steps;
1. Set your regional settings to be "English (United States)"
2. Choose custom in SQL server setup.
3. Choose "Dictionary Order, Case Insensitive for use with 1252 Character Set"

Monday, April 26, 2004

.NET Forms Authentication

When creating a website which needs security for certain areas (or all areas) developers have always had a number of choices. One is to use the built in IIS standard of Windows authentication, however this can be a little difficult if you don't have full access to the sever your application is running on. This leaves most developers having to design and implement their own security methods, often for every site they create.
Forms-based authentication is an ASP.NET authentication service that enables applications to provide their own logon UI and do their own credential verification. ASP.NET authenticates users, redirecting unauthenticated users to the logon page, and performing all the necessary cookie management.

Forms authentication also allows:
  • Management of users and their passwords in the web.config file, thus eliminating the need for database based credential storage.

  • Encryption for users passwords

  • Cookie data protection

  • Cookie expiration timeout specification

  • Page or directory based security attributes. i.e allow all users to see Default.aspx but only signed in users to participate in the chat forum.


  • To use Forms Based Authentication:

    Modify your Web.config file to include the following (please excuse the br's):

    <authentication mode="Forms">
    <forms name="FBAuth" loginUrl="logon.aspx" path="/" protection="All" timeout="1">
    <credentials passwordFormat="SHA1">
    <user name="Tris" password="AC2B12B76A945DD9FDD7E58FBDD010D5AFA10F33"/>
    </credentials>
    </forms>
    </authentication>

    <authorization>
    <deny users="?" />
    </authorization>
    This tells ASP.NET to use Forms authentication, and that it should deny access to all users that are not signed in. As a result all users will be directed to the specified login page "login.aspx" for authentication.

    By including the following code in your login buttons on click event, ASP will attempt authenticate the user details specified against the credentials specified in the Web.config file, and if successful, create a cookie and redirect the user to the page they originally requested:

    private void cmdLogin_Click(object sender, System.EventArgs e)
    {
    if (FormsAuthentication.Authenticate(txtUser.Text, txtPass.Text))
    {
    FormsAuthentication.RedirectFromLoginPage(txtUser.Text,true);
    }
    else
    {
    lblBadLogin.Text = "Invalid Username or Password! Try again:";
    }
    }
    When a user whishes to sign out, you can just call
    FormsAuthentication.SignOut();ASP.NET will then manage the removal of the clients cookie.

    It is also possible to specify access permissions for particular files and folders if required, ensure the following config settings are added after the existing
    </system.web>in your Web.config

    <location path="default1.aspx">
    <system.web>
    <authorization>
    <allow users ="*" />
    </authorization>
    </system.web>
    </location>
    This will allow all users to access "default1.aspx" even if they are not signed in. You can specify files or folders in the path parameter and can use allow or deny in conjuntion with *, or ?.
    ? meaning not signed in and * meaning everyone.

    ASP.NET Forms Authentication is extremely easy to implement and use, and should put and end to the authentication hell of previous web development.

    Friday, April 23, 2004

    Pocket PC Printing

    Ever wanted to print your documents from your Pocket PC via IR or Bluetooth?
    All you need is the HP PocketPC printing utility found at www.hp.com/go/pocketpcprint
    This clever little app allows you to print via IR, Bluetooth or your network connection to a variety of different printers. Simple!

    nDOC

    nDoc generates class library documentation from .NET assemblies and the XML documentation files generated by the C# compiler.
    Documentation in the past has been a truly grueling task, especially if you want it to look any good. Who needs documentation when you have good code comments?
    With the introduction of XML comments in C# and nDOC, you can ensure your code comments are complete, and create great looking documentation files all in one foul swoop.
    nDoc works with the XML comment file produced by the C# compiler and can output your documentation in many different formats, including MSDN style and javaDoc style. These files can be routed to compiled help files, or straight HTML.
    A truly brilliant addition to any .NET programmers toolbox.
    Find out more at http://ndoc.sourceforge.net/wiki

    Http -> Https Redirection

    Had LOADS of trouble getting this to work on our site. We took the customer error page approach, creating a new page called redirect.htm and pointing the 403.4 error to the new file. However no matter what permissions we set on the file, we ALWAYS got an access denied error.
    We managed to hack out way out of this by editing the real 403.4 error file and putting our redirect script block at the bottom.

    If anyone has any cunning plans or advice, please post a reply!