System.Threading.Tasks.Task<string> task = System.Threading.Tasks.Task.Factory.StartNew(() => myMethod(myString)); if (task.Status == System.Threading.Tasks.TaskStatus.RanToCompletion) { //is done, do something! //use result task.Result }
Thursday, July 11, 2013
Simple task (thread) implementation in C# .NET 4.0 and 4.5
This code implements a simple way to start a method in a thread and wait for it to end to get the return value of the method.
I Forgot My Administrator Password in Windows XP!
This guide could help you to reset the Administrator password in Windows XP without knowing it. Require a Windows XP boot CD.
How to get image from url i C# .NET
A very simple one liner to fetch an image from an url in C#
System.Drawing.Image.FromStream(new WebClient().OpenRead(imageUrl));
How to compress and decompress files in C# .NET 4.0 (GZip)
.NET 4.0 has a built-in gzip compress and decompress method.
.NET 4.5 has zip support.
This code shows how to use the .NET 4.0 gzip functionality. This also includes .NET 4.0 Client Profile
.NET 4.0 is supported by Windows XP and .NET 4.5 is NOT.
.NET 4.5 has zip support.
This code shows how to use the .NET 4.0 gzip functionality. This also includes .NET 4.0 Client Profile
.NET 4.0 is supported by Windows XP and .NET 4.5 is NOT.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | public static void Decompress(FileInfo file) { using (FileStream inFile = file.OpenRead()) { //original file extension, ex. filename.exe.gz string orgName = file.FullName.Remove(file.FullName.Length - file.Extension.Length); //decompress file using (FileStream outFile = File.Create(orgName)) { using (GZipStream Decompress = new GZipStream(inFile, CompressionMode.Decompress)) { //write decompressed file byte[] buffer = new byte[4096]; int index; while ((index = Decompress.Read(buffer, 0, buffer.Length)) != 0) outFile.Write(buffer, 0, index); } } } } public static void Compress(FileInfo file) { using (FileStream inFile = file.OpenRead()) { //create target file using (FileStream outFile =File.Create(file.FullName + ".gz")) { using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress)) { //write compressed file byte[] buffer = new byte[4096]; int index; while ((index = inFile.Read(buffer, 0, buffer.Length)) != 0) Compress.Write(buffer, 0, index); } } } } |
Thursday, January 6, 2011
Good free screen capture software
This screen capture software is free and easy to use. It has many nice features like:
PicPick can also do a lot of other stuff regarding the screen capture production like:
- dual-monitor support
- auto scroll
- portable setup (no installation)
- sound effects
- various sharing tools
PicPick can also do a lot of other stuff regarding the screen capture production like:
- image editing
- magnifying
- screen cross-hair and ruler
- whiteboard feature
I really like this tool because it has most of the stuff I use when I make screen capturing. I can just save it to my USB stick and have it with me, include all my settings.
http://picpick.wiziple.net
http://picpick.wiziple.net
Wednesday, January 5, 2011
Unlock files in Windows that is used by other processes
If you can't delete a file if some program is locking it, but you don't know which or do you get a message like this:
I use both and they they do the job well.
Both runs on both 32 and 64 bits Windows.
LockHunter:
http://lockhunter.com/
Unlocker:
http://www.filehippo.com/download_unlocker/
- Cannot delete folder: It is being used by another person or program
- Cannot delete file: Access is denied
- There has been a sharing violation.
- The source or destination file may be in use.
- The file is in use by another program or user.
- Make sure the disk is not full or write-protected and that the file is not currently in use.
I use both and they they do the job well.
Both runs on both 32 and 64 bits Windows.
LockHunter:
http://lockhunter.com/
Unlocker:
http://www.filehippo.com/download_unlocker/
Wednesday, December 22, 2010
Proxy setting for each application even if it doesn't support it
ProxyCap is an excellent lightweight application to manage various application on windows, windows mobile or mac computers to a proxy server with SOCKS4/5 or HTTPS access.
It's not that expensive and does the job good. It has options for exe-file, ports, ip-destination, host-name, transport protocol (TCP/UDP), windows authentication and more.
If you have specific application that should use a proxy connection or if all applications should use a proxy connection with some application exceptions this could be a nice tool to solve it.
Of cause you need a proxy server service, or you could use it to route some application away from your mandatory proxy.
http://www.proxycap.com/
It's not that expensive and does the job good. It has options for exe-file, ports, ip-destination, host-name, transport protocol (TCP/UDP), windows authentication and more.
If you have specific application that should use a proxy connection or if all applications should use a proxy connection with some application exceptions this could be a nice tool to solve it.
Of cause you need a proxy server service, or you could use it to route some application away from your mandatory proxy.
http://www.proxycap.com/
Tuesday, December 7, 2010
Export Messages from Windows Live Mail (WLM) to Outlook
Open Windows Live Mail.
Select File.
Go to Export and select Accounts.
Under format select "Microsoft Exchange". Despite the name not saying so, it also works for transfering to Outlook.
Click Next.
Select the folders you want copy to Outlook and click Ok.
Finish the wizard and the mail should be in Outlook.
Select File.
Go to Export and select Accounts.
Under format select "Microsoft Exchange". Despite the name not saying so, it also works for transfering to Outlook.
Click Next.
Select the folders you want copy to Outlook and click Ok.
Finish the wizard and the mail should be in Outlook.
How to get 25 GB on a free network drive in the cloud
http://www.nirmaltv.com/2010/02/02/how-to-map-skydrive-as-network-drive-in-windows/
It's a bit slow and file limit is 50 MB :( but hey it's free and 25GB.
I use the free version of Gladinet to mount several cloud services as disk drives in windows.
http://gladinet.com/
I only use it for pictures and documents because of the file size limit, but its fine when it is set up.
If you like to break the 50MB limit Gladinet has a paid version which can split files larger than 50MB and merge them again automatically.
It's a bit slow and file limit is 50 MB :( but hey it's free and 25GB.
I use the free version of Gladinet to mount several cloud services as disk drives in windows.
http://gladinet.com/
I only use it for pictures and documents because of the file size limit, but its fine when it is set up.
If you like to break the 50MB limit Gladinet has a paid version which can split files larger than 50MB and merge them again automatically.
Listen to Pandora outside US in Chrome Browser
I will take no response ability for breaking any terms of use or any other licensing!
First you need a US Proxy address, this you can buy a subscription for or pick a free web proxy from this list:
http://www.hidemyass.com/proxy-list/search-62
Of cause you can use any proxy you want, it just have to change the IP-address to a US address.
After you have found a proxy server/port you should install a proxy manager. This could be a Chrome Extension like Proxy Switchy!
Other browsers like Firefox does have similar Plug-ins.
Proxy Switchy! can be set up to automatic switch to a specific proxy server on specific URL's like this:
This should be saved along with the proxy profile where the IP-address and port should be.
Now just navigate to www.pandora.com and you should be good to go, but check the terms of use before initiating.
First you need a US Proxy address, this you can buy a subscription for or pick a free web proxy from this list:
http://www.hidemyass.com/proxy-list/search-62
Of cause you can use any proxy you want, it just have to change the IP-address to a US address.
After you have found a proxy server/port you should install a proxy manager. This could be a Chrome Extension like Proxy Switchy!
Other browsers like Firefox does have similar Plug-ins.
Proxy Switchy! can be set up to automatic switch to a specific proxy server on specific URL's like this:
This should be saved along with the proxy profile where the IP-address and port should be.
Now just navigate to www.pandora.com and you should be good to go, but check the terms of use before initiating.
Subscribe to:
Posts (Atom)