Dec 23, 2012

Claim more SSD drive space on Windows

Ok when we talk about SSD, we all knew the sweet juicy lovely speed of it, but we hate the pricey pricetag, its tiny size and the performance degradation.
But worry not, price is lowering everyday. I just got my 240GB Kingston SSD 3K for less than $1/GB. Kingston claims it can last for more than 8 years with daily IO of 10GB. That’s about 29.2TB IO !!! I bet personally I’ll never exceed that limit.
But 240GB is a bit tiny for my OS, Virtual Machines + all the dev tool (FYI I have VS2008,VS2010,V2012, MSSQL 2008-2012 with 50GB db in total.
So, I only worry about its “tiny” size. What I do ? I go cleanup hard disk. How?
1. Manually I go disable the page file, disable hibernatation (powercfg –h off) and move my System Restore folder to the other 3TB drive. I don’t need any of these on my SSD. Love it, +14GB at least.
2. http://www.iishacks.com/2011/06/23/reduce-windows-7-winsxs-folder-size/ : in short, run this command:
dism /online /cleanup-image /spsuperseded
Reduce huge WinSXS folder. Love it too, +4GB.
3. Run CCleaner – useful and easy. Just a click, +3GB and all thrash cleanup.
Results: on my workstation with 240GB SSD
Before: Free space = 121GB
After: Free space= 142GB (+21GB ! Yay)

Dec 9, 2012

How to download Steam update faster ?

Recently I ran into this kind of frustration, whenever I login Steam to play my favorite Dota 2, I’ll be force to install some updates. The update download take forever to finish, it keeps stuck at some certain percent. Poofff Valve, wth ?!!!

So it take a while and I figure out that somehow my TCP connection to Valve update server got stuck.

Tada, that’s an easy fix ! I downloaded Sysinternal TCPView, and whenever the connection got stuck, I close it and wait for a while: the update connection will auto-reconnect back to the server, and zap!! My update finished much faster than before.

image

Try it for yourself if you have my problems

DOWNLOAD: HERE

http://download.sysinternals.com/files/TCPView.zip

Nov 21, 2012

Personal Hotspot on iPhone is not working ?

If you have turn on the Personal Hotspot and still not seeing the connection, here is the first and easiest fix: plug in and plug out your USB cable.

It did work for me – it could be USB connection reset.

Aug 31, 2012

How to improve Visual Studio performance

 

In this series, I’ll discuss how to the steps that I did to improve VS 2008/2012/2012 performance. Following these guidelines, I managed to reduce build time from +10sec to 3-5sec , and solution opening time from 20+ sec to just mere 5sec.

For some may think “a few sec ain’t a big deal”, I would like to stress: it’s really make a different when you test & debug. Anyway, what else will you do when VS is compiling ? Thinking of what to do with your life ? Smile. Life’s better when you can cut down build time and spent that on other hobby (for me it’s building performance workstation-  I just upgrade mine to 16GB DDR3-2000Mhz with RAID10 SSD ^^ )

OK enough chit chat, now back to the main point.

1.Requirements:

Before proceed with the guide, ensure that your machine meet these minimum requirements:

  • At least 2Gb free memory.
  • Core2Duo 1.8Ghz (dual-core) or equivalent AMD multicore.
  • At least 5Gb free HDD space.

2.Steps:

a. First, if you have lots of RAM (4GB+ ), you can use Ramdisk to create a separate partition, then map your output folder to it.

I downloaded Ramdisk , then install it. Using the tool, I created the symbolic link from the VS output folder via mklink :

C:\mklink /D "F:/RamdiskTemp/Src/bin" "C:/Work/Web/Src/bin"
symbolic link created for "F:/RamdiskTemp/Src/bin" <<===>> "C:/Work/Web/Src/bin"

b. Use the same mklink tool, create symbolic link for your ASP.NET temp folder, point tothe newly created Ramdisk.

The ASP.NET temp folder (for .NET 4.0) is at :

C:\windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files (64bit)

C:\windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files(32bit)

c. Use eBoostr to implement cache at OS-level for your VS. I used 512MB of memory to cache.

Detail of how to use eBoostr, please refer to their website.

<<to be continue>>

Aug 30, 2012

How to detect what JavaScript function is hooked up to an element

 

Recently I worked a lot with front-end development, and most of the time I want to know what JavaScript function is fired when I clicked on some buttons or images.

Luckily with Chrome, it is so easy.

How?

In Chrome, press F12 – it will open developer tool. Now right click on the element and select Inspect element. In the developer tool, look for the right hand side and expand Event Listeners. Tada, there you go – all the events that hook up to that element are shown. See the image below:

image

Aug 27, 2012

How to remove deleted songs from iTunes Library

 

Here are the instruction:

  1. Create a smart playlist with the criterion “Artist” is not “xxxyyyzzz” (or some other random string that does not occur as artist in your mp3 collection). Then name this smart playlist “all entries”. This way, we get a smart playlist with all database entries, working and broken.
  2. Create a static playlist called “working entries”.
  3. Open the “all entries” playlist, select all (ctrl-a/option-a) and drag the selection to the “working entries” playlist. iTunes will not copy dead entries, so now we have a list with everything and another with only the working ones. We need to substract them from each other. This is how:
  4. Create a smart playlist with the following criteria: “Playlist” is “all entries”, “Playlist” is not “working entries”. Check that all rules apply, not any rule. And dang! We just created a playlist of broken database entries. In this playlist, select all (ctrl-a/cmd-a) and hit shift-delete (alt-backspace on macs). iTunes will ask you if you want to remove the selected items from the iTunes library. Of course you want to!

from this blog.

Jul 27, 2012

Use Fiddler to compost form POST / GET

Fiddler 2 is a great tool for debugging web development. It serves well when you want to simulate a form POST / GET with various parameter.

But note when you want to do a form POST, remember to add this line to the header :

Content-type: application/x-www-form-urlencoded

Otherwise, the form POST parameters will not be understood.

Jun 27, 2012

Stream media from your PC to Xbox 360 with Windows Media Center or Windows Media Player

There are many guides out there on how to stream media from your PC to Xbox 360, so I just paste the link here:

Just some key points to note:

  • Ensure in your router, UPnP (Universal Plug and Play) is enabled.
    Configure your router at
    http://192.168.0.1 , or if your IP is x.x.x.x then usually it is http://x.x.0.1  or http://x.x.x.1
  • Ensure your PC and Xbox are on the same subnet (preferably both should be on the same type of network : wired or wireless )
  • Ensure your firewall does not block port 88 and 3704 (both UDP and TCP).
  • Turn off DMZ Hosting (which expose one IP in your router to the whole Internet).
    Turn off port forwarding as well.

May 7, 2012

ASP.NET MVC - Including hidden fields in Form Submit (POST)

We can include some hidden fields in the form as the parameters. Most of the time, it is to avoid using query string (which can results in too long URL).

However, do not forget the attributes “name” for those hidden fields, otherwise they will not be include in form submission.

For e.g:

<form id=”frm1” action=”/actionHandler” method=”post”>
    <input type=”hidden” id=”hdnValue1” name=”hdnValue1” >
</form>

I encountered it and spend almost an hour to find out why. Just to share it.

Apr 17, 2012

How to redirect to different URL

From StackOverFlow

jQuery is not necessary, and window.location.replace(...) will best simulate an HTTP redirect.

It is better than using window.location.href =, because replace() does not put the originating page in the session history, meaning the user won't get stuck in a never-ending back-button fiasco. If you want to simulate someone clicking on a link, use location.href. If you want to simulate an HTTP redirect, use location.replace.

For example:

// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";

Apr 13, 2012

“GodMode” folder on Windows

Create a folder named :

GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}

Double click it – you’ll see all the tasks in Control Panel !!! Quite neat.

Apr 9, 2012

To find out how long the system has been running

For Windows:

  • go to Command (Windows  + R, type “cmd”)
  • type: net statistics server

windows-uptime

For Linux/Mac:

  • In Terminal, type : uptime
  • The result would be like this
    $ uptime [RET]
    3:34pm up 4:31, 4 users, load average: 0.01, 0.05, 0.07
    $

Mar 21, 2012

Show/Hide hidden files and folder with a shortcut

From HowToGeek

Download Here

We’ve written a very long time ago about how to toggle hidden files in Ubuntu with a simple shortcut key. But what about keyboard ninjas using Windows instead? After doing some research, I’ve got a simple downloadable solution for you.

What I’ve done is throw together a very simple application that runs in the background and assigns the hotkey Win+H to toggle hidden files. There’s no user interface to keep it from wasting memory, but you can always customize it using the AutoHotkey script provided below instead.

Note: This application was based on an AutoHotkey script created by Lifehackercommenter turnersd, fully credited below.

Toggle Hidden Files

Once you’ve downloaded and run the application, all you have to do is hit the Win+H shortcut key while you have any folder open:

image

And presto! You’ll immediately see any hidden files in that folder, or any folders that are open.

Hit the same hotkey sequence again, and the hidden folders will disappear again. Very useful!

Installing the Hotkey

In order to install this and set it up to run at startup, you’ll need to save and extract the downloadable file, and then create a shortcut in your startup group, which you can easily access by typing the following into the location bar:

shell:startup

You could even just copy the executable in… but either way, once you’ve done that, you can double-click on it to start it.

Note that there’s no UI for this application, it runs completely in the background to limit memory usage as much as possible.

Killing the Process

Because there’s no UI, if you want to stop the application from running, you’ll need to either reboot… or use the much simpler method of opening Task Manager, finding the ToggleHiddenFiles.exe process and killing it.

Using the AutoHotkey Script Instead

The method for creating the hotkey isn’t something that I can take credit for… the credit should be fully given to Lifehacker commenter turnersd in this article about toggling hidden files with a shortcut.

Here’s the source code, which you can copy into an AutoHotkey script file:

; WINDOWS KEY + H TOGGLES HIDDEN FILES
#h::
RegRead, HiddenFiles_Status, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden
If HiddenFiles_Status = 2
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 1
Else
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced, Hidden, 2
WinGetClass, eh_Class,A
If (eh_Class = "#32770" OR A_OSVersion = "WIN_VISTA")
send, {F5}
Else PostMessage, 0x111, 28931,,, A
Return

If you have problems with this source, you can also grab it from the textsnip site.

Mar 14, 2012

CSS tips on improving server performance


CSS Sprite for images: http://css-tricks.com/css-sprites/

To improve on CSS loading, instead of creating multiple images and loading separately (which incur multiple HTTP GET), we can combine those images together into 1 picture, then use the CSS to slice them up to use later on.

This technique reduce the number of HTTP GET for the images, but its has its own penalty when you want to update/change certain part in the layout of the page: you’ll have to spend more time to tweak the whole sprites instead of editing just one image.

That’s it: pros & cons, performance vs. maintainability. Anyway, most likely for production server, CSS Sprite is in favor as it offer better performance while costing a little bit on maintaining the CSS & images

Jan 13, 2012

IE CSS/JS caching issue and how to fix

This is interesting hack:

Problem:
On IE (and IE-compatible browser: Avant Browser / Maxthon…etc), JS and CSS can be cached and not loaded when you want.

For e.g: you have 2 different global.css files to use before and after user login (don’t ask me why) . In your index.htm you may load your CSS:


<link href="/Styles/global.css" rel="stylesheet" type="text/css"/> //issue goes here

global.css <<before login>>
#header { color: #ccc; }

global.css <<after login>>
#header { color: #fff}

Now if you login, the #header color is still #ccc !

Root cause: IE cached files and do not refresh the global.css. On Chrome/FF, the browser is able to detect changes and reload your new global.css

Solution: add in a dynamic query string to let browser know there is a change in the path (URL specific). Browser will reload the CSS for you

<link href="/Styles/global.css?v=<%= DateTime.Now();%>" rel="stylesheet" type="text/css"/> //issue go away

That’s it ! The dynamic link will force browser to reload CSS /JS every time.

Notes: Only use it for files that are frequently changed, otherwise you’ll reduce performance.