Archive for Technology

FortiGate 200B-POE API Poll (PHP Preserving Cookies)

I have been helping Ivan with trying to preserve cookies while polling the web service for a json response of the router’s status. As there are not much tutorials or sample codes provided by the vendor, I hope the code below explains how it can be done in PHP.

'timeout' => 25,
'header'=>"Accept-language: en\r\n"
$context = stream_context_create($opts);
$xm = file_get_contents($request, false, $context);

$johncookie = $http_response_header[2];
$john = explode("APSCOOKIE_2464548051=", $johncookie);

$req = "{'vdom':'root','path':'router','name':'ipv4','action':'select','start':'0','count':'1000'}";
$opts = array(
'timeout' => 25,
"Cookie: APSCOOKIE_2464548051=" . $john[1] . "\r\n"
$context = stream_context_create($opts);
$xml = file_get_contents($req, false, $context);

echo htmlspecialchars($xml, ENT_QUOTES);


Hope it helps some of you 🙂

Leave a Comment

Vista and Buffalo Terastation (and Windows 7)

Just a note in case anyone else runs into this problem. If you want to connect to a share on a Buffalo Terastation (which seems to be using Samba) from a Windows Vista/Windows 7/Windows Server 2008 installation, you need to do the following:

Windows 7 / Windows Server 2008
Run the Local Security Policy app
– Go to start -> type run -> type in secpol.msc -> Press Enter

Go to Local Policies | Security Options and choose the “Network Security: LAN Manager Authentican Level” item
Set it to “Send LM & NLTM, use NTMLv2 session if negotiated”
And that should sort you out.

Windows Vista
[Update] For those of us unlucky enough to be running Vista Home (which doesn’t come with secpol), you can do the following (thanks to Patrick in the comments for this)
Run regedit (Windows-R, ‘regedit’) to open the registry editor
Find key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\
Change the value for the option “LMCompatibilityLevel” from 3 to 1.
Now you should be able to access the TeraStation (you may need to reboot)

[Update 25th August 2009]. A couple of commenters have been kind enough to say that this also works in Windows 7 RC and thus in Windows 7 RTM (pretty safe assumption). For what it’s worth, I have a Windows 7 RC virtual machine running and I’ve been able to connect fine without needing to make any changes that I can remember.

Reason: Vista/Windows 7/Windows Server 2008 is trying to force a more secure authentication method for the LAN manager by using NTLMv2 to log on to the remote SMB share. But NTLMv2 isn’t available for the current SMB implementations on all NAS devices using an older version of the Samba server. The connection will be rejected and the user will be asked again and again for user name and password.


Leave a Comment

Windows Live Essential Beta 0x80280007 Error

Solution: Delete this folder,
64-bit Windows – C:\Program Files (x86)\Common Files\Windows Live\
32-bit Windows – C:\Program Files (x86)\Common Files\Windows Live\

It will solve your issue.

And for now, avoid installing the latest Windows Live Essential (Messenger) from the web, get your tools installed offline, i have provided the links here:

Download Windows Live Messenger 14 (full standalone installation)

Comments (20)

Sandisk Cruzer Titanium RMA Complain

Ok finally. went to vector magnetics @ 200 middle road, singapore, to warranty exchange the loose casing of my first thumbdrive, Sandisk Cruzer Titanium 8GB. The drive no longer in production and luckily there were still stocks available. One of the fastest thumbdrive ever, with the most solid casing built with titanium (the new batch as per the image below feels much more steady and sturdier); you can use it as a replacement for hard disk, installation of operating systems, media, storage, etc. I like it alot, over the Contour editions.

Silly Sandisk’s policy is that if the product has ceased production, they will only change for a similar/lower-end range of the product. However definitely not the Contour editions or any editions that are better than this product. They suggested a Sandisk Ultra Backup with a slower writing speed or i have to top up money for Contour editions. I’m complaining cause instead of compensating with the higher capacity for the loss of speed in the new exchange, they are offering similar capacity and lower speed. If any Sandisk employees see this, please revert to the management about this silly issue.

FYI. Hard disk companies warranty exchange’ is offering similar/higher disk capacities for disks that are no longer in productions, or not available anymore. E.g., if you send in a 40GB now, and it’s under warranty, they will swap you a 120GB or next available capacity they have closest to yours. Definitely not slower.

No idea why the drive ceased productions. The contour editions look sexier thou. If you want a thumbdrive that can survive through the tumbler in your washing machine, this is the one you should get.

Leave a Comment

Remove stored Windows XP, Windows Vista, Windows 7 Stored Password

Need to remove cached credentials or saved passwords? Easy enough, just go to,
Start -> Run -> type in rundll32.exe keymgr.dll, KRShowKeyMgr
Then hit the enter key, the stored user names and passwords box will appear.

Windows can store your logon information for network locations and web sites. To add an entry. click add. to edit an existing entry, select it and then click properties. To removed select all items that you wish to remove and click remove.

Leave a Comment

Improving Performance on your 2Wire 2701HGV-E Gateway Home Portal

I signed up SingTel’s MIO Plan (Residential Line, Internet & Mobile phone) almost 2 years ago and was given a 2Wire 2701HGV-E Gateway. I was a very happy user after i finally shook off starhub’s laggy hub, but there are always pros and cons to every story. Never will i go back to starhub, i’ve suffered soo much there.

In this post, i will be exploring some settings i used to improve the performance of the 2Wire device that SingTel provided. However i will not talk about adding more devices to compliment the network.


There are problems existing in this model causing instability and frequent disconnections while getting on the internet. Here are the problems:
1. Local device’s DNS service is faulty
2. Device is not capable of running/supporting WPA/WPA2 encryption modes other than WEP, at stable
3. Device heats up easily
4. Device is incapable of maintaining constant ping of 1ms/<1ms while connecting via LAN RJ-45
5. Device is still frequently disconnecting my pages, Webpages not loading, MSN frequently disconnecting


These are some tweaks i made to improve the performance of the device, since i had to be stuck with it (in view of high electricity cost in Singapore),

1. Local device’s DNS service is faulty.
Solution: Change DNS Settings on your laptop/desktop/iPhone to external DNS servers, either one can be used or concurrently used:
– SingNet’s DNS servers, /
– Google Public DNS, /
* note that, this setting may need to be removed if you face problems connecting to other wireless networks such as, Wireless@SG

2. Device is not capable of running/supporting WPA/WPA2 encryption modes other than WEP, at stable
Solution: Just keep to WEP. or switch to WPA/WPA2-PSK,
However follow the settings according to the picture (Wireless Settings) attached below. You can choose 802.11b if you want longer range.

3. Device heats up easily.
Solution: Ventilate it or ignore it, i actually put my router behind a desktop, although more heat actually results in slower performance. Ironic.

4. Device is incapable of maintaining constant ping of 1ms/<1ms while connecting via LAN RJ-45.
Solution: Similar to Solution #3 & #5. There are hardly any ways around this, but it shouldn’t pose as a large problem.

5. Device is still frequently disconnecting my pages, Webpages not loading, MSN frequently disconnecting
Solution: Disable all Firewall (Advanced Settings), Attack Detection.
Solution #2: Tweak UDP Timeout to 1-5 Minutes, and TCP Timeout to 720 Minutes. It reduces the need for your router to maintain a list of existing connection. After this was set, the router showed significant improvements. See picture below (Configuring Services).
Solution #3: Set your Internet Proxy to port: 8080

There you go. Please spread this information to other users who are facing the same problems.
Thanks! 🙂

Click to enlarge the images

Comments (1)

LogParser v2.2 Output to MySQL

There are multitudes of reasons why you should backup your data to a trustworthy location. Went back to office this afternoon, realised that the files on the server was being deleted; thus causing the script to malfunction, infact the main script was deleted. Anyway, i had to recode from scratch. sigh.

The company is running a standalone MyMailList Deluxe software for years, and they need to merge the datas on the software with the internal application i created for the company. Not everything is automated, the administrator still has to export the CSV file manually to the proper designated folder that propagates the data into database.

Here goes my codes for those who needs it.


@echo off
echo **************************
echo * Author: John Goh,
echo * Date: Oct 06, 2009
echo * Description:
echo * Allows internal application to retrieve latest
echo * company mailinglist information
echo *
echo * Remember to save ExpFile.csv in C:\
echo *
echo * Pre-requisite for server setup,
echo * – install LogParser 2.2, MySQL ODBC 5.1 Driver, MySQL Server 5.0
echo * – Setup ODBC DSN to: mailListDSN under Control Panel (WinXP/2K3)
echo * – Scheduled Tasks this Script Daily
echo * – Put this script in a important directory D:\Applications\
echo * – Remember to do daily backups to this file
echo * – Setup LogParser in the ENVIRONMENTAL PATH VARIABLE
echo *
echo **************************

logparser “SELECT [Acct Start], [Address1], [Address2], [Attn], [Business], [Check Digit], [Company], [Credit], [Custom1], [Custom10], [Custom11], [Custom12], [Custom2], [Custom3], [Custom4], [Custom5], [Custom6], [Custom7], [Custom8], [Custom9], [Special Instructions] AS [SpecialInstructions]  FROM C:\ExpFile.csv TO maillist WHERE NOT Company = ”” -i:CSV -o:SQL -server:localhost -database:courier -username:root -dsn:mailListDSN -driver:”MySQL ODBC 5.1 Driver” -cleartable:ON -createtable:ON


Save it as query.bat and run it off Command Prompt, or Schedule Task it!

Leave a Comment

Older Posts »