Profile

Click to view full profile
Hi, I'm Veerapat Sriarunrungrueang, an expert in technology field, especially full stack web development and performance testing.This is my coding diary. I usually develop and keep code snippets or some tricks, and update to this diary when I have time. Nowadays, I've been giving counsel to many well-known firms in Thailand.
view more...

Wednesday, July 9, 2014

Run a set of Visual Studio load tests at once using Command Line

Normally, if you have only one load test environment and have a bunch of load tests that need to run, you need to wait for each test finished then start to run the next test manually.

In order to run them all at one time, we can use Visual Studio Command Prompt to run load tests. But we need to prepare .loadtest files for each load test run separately. It means that if you want to run 15 load tests, you need 15 of .loadtest files.

A command to execute load test has shown as follows:
mstest /TestContainer:[Load Test Name].loadtest /resultsfile:[Load Test Result Location].trx
Then, to run a next load test after another finished, create a command prompt script to run them automatically.

For example - create a loadtest.cmd then add the following lines into the script:
mstest /TestContainer:TestA.loadtest /resultsfile:C:\TestA.trx
mstest /TestContainer:TestB.loadtest /resultsfile:C:\TestB.trx
In case run a distributed load test using test controller and agents from the command-line, it need to add "/testsettings:[Test Setting Name].Testsettings" after specify result file in a command.

For more information about load test, you can take a look at http://msdn.microsoft.com/en-us/library/ms182588(v=vs.110).aspx.

Wednesday, July 2, 2014

Full restore using Windows Server Backup - Network path not found

To full restore from Network drive 1. A user that used to retrieve backup must gain full control all files and folders within that drive. 2. To gain full control, it is not only just gain full control from security tab. It must be included from Advanced menu in security tab then adding / changing an owner, full control permission for all childs, Auditing, and Effective Access to that user. 3. After completed, now, restored machine can full restore from Network drive if everything is done correctly. More information: 1. How to use Windows Server backup http://blogs.technet.com/b/dpm/archive/2011/11/01/data-protection-manager-2010-and-bare-metal-restore.aspx. 2. Resolve Network Path was not found http://blogs.technet.com/b/dpm/archive/2011/11/01/data-protection-manager-2010-and-bare-metal-restore.aspx 3. How to set IP in Command Prompt (during boot) http://www.howtogeek.com/103190/change-your-ip-address-from-the-command-prompt/http://technet.microsoft.com/en-us/library/ee441257(v=ws.10).aspx

Saturday, May 31, 2014

How to setup DLNA media server on Windows 8

You can share media stream over network using Windows Media Player. But it is not available by default. So, in order to enabling this feature, you need to open Windows Media Player and select Stream menu. Then, it will open Media streaming options. So select Turn on media streaming button. You can list which DLNA devices are available on the same network. Select the one you want to share with and then press OK. Note that you also can select specific devices can access only specific folders from your Libraries.

Rename Network in Windows 8

Take a look on:http://superuser.com/questions/550178/how-can-i-rename-a-network-in-windows-8.

Open regedit and edit the following of these registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Nla\Cache\Intranet
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged

Wednesday, May 7, 2014

Get video thumbnail using MediaPlayer class

Normally, in order to get a thumbnail from a video file we may use well-known software like FFMPEG. But now we can do it natively in C# using MediaPlayer class in WPF (which need to import PresentationCore.dll). We can use the following solution for both web and windows form application as described: Getting Thumbnail from Video using MediaPlayer Class in WPF.

Saturday, March 8, 2014

Access denied when starting a Windows service (error 5)

When installing a Windows service, sometimes we can install it but cannot run it. One of the problem I found access denied. It may be caused by the folder that used to install the service does not have a permission to access the folder. Then, we need to check that NETWORK SERVICE account is allowed to access that folder because the Windows service using this account to execute services.

Friday, February 28, 2014

Access shared network from Windows Command Prompt

To access network shared folder from Command Prompt, it cannot use cd command. In order to access shared folders, we need to mount it as a new drive by run the following command:
// Method 1
net use [drive letter]\\[machine]\[folder]
// Method 2
pushd \\[machine]\[folder]

// Example 1
net use z: \\machine_name\shared_folder_name
// List folders on shared drive
dir net use z:

// Example 2
pushd \\machine_name\shared_folder_name
Both methods can do the same things, but the different is the second method will allocate and change current directory to the new drive automatically by the allocated drive is started from unused reversed alphabetical order.
To remove mounted drive, we can use the following command to delete it.
net use [drive letter] /delete

// Example
net use z: /delete

Monday, January 27, 2014

Static method behavior in multiple threads (Java / C#)

Static method behaviors in multiple threads is the same to normal method that used from a class instance. The difference is that we can call it from class directly. Static method will create its own copies for its local variables because each thread has its own stack. The only things concerned in multiple threads are static fields, static objects. If the objects can be accessed from multiple threads, it need lock or synchronize.

References:

Tuesday, January 21, 2014

Python Tools for Visual Studio

Recently, I have tied to get back to Python. One problem when I get back into it is IDE. I did not mean that Python IDEs are not good but I am really get familiar to Visual Studio. Now, there is a good new for Visual Studio user that now it has an extension on Visual Studio support for Python. Link: http://pytools.codeplex.com/.

Friday, January 10, 2014

Calculate Indexes size in SQL Azure

Why need to calculate size for indexes? It's simply because in Azure management portal show only the size of raw data not for indexes which indexes size is also included to count them as total storage used. I faced this problem during spamming data on 1GB size of SQL Azure. In my management portal show around 600MB is used but when updating the indexes, it show message like 'The database has reached its size quota' and receive an error code 40544. This problem may occurred depends on your indexes size growth rate. So, in order to track the size of our indexes use the following command to check:
SELECT (SUM(reserved_page_count) * 8192) / 1024 / 1024 AS DbSizeInMB
FROM    sys.dm_db_partition_stats
To track the size for each indexes, use the command below instead:
DECLARE @SizeInBytes bigint
SELECT @SizeInBytes =
(SUM(reserved_page_count) * 8192)
    FROM sys.dm_db_partition_stats

SELECT idx.name, SUM(reserved_page_count) * 8192 'bytes'
FROM sys.dm_db_partition_stats AS ps
    INNER JOIN sys.indexes AS idx ON idx.object_id = ps.object_id AND idx.index_id = ps.index_id
WHERE type_desc = 'NONCLUSTERED'
GROUP BY idx.name
ORDER BY 2 DESC
References: