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.
Pages
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... |
Saturday, March 8, 2014
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_nameBoth 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:
References:
Labels:
C#,
Java,
Programming,
Threading
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/.
Labels:
IDE,
Programming,
Python,
Windows
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_statsTo 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:
Labels:
Programming,
SQL,
Windows,
Windows Azure
Friday, November 22, 2013
Debugging a Published Cloud Service with IntelliTrace and Visual Studio
Take a look at this link: http://msdn.microsoft.com/en-us/library/windowsazure/ff683671.aspx. It contains the steps to enable and download IntelliTrace files back to diagnosis log files in Cloud Service on Windows Azure.
Labels:
Cloud Computing,
Windows,
Windows Azure
Wednesday, November 13, 2013
Saving and Restoring State in a Windows Store App (C#/XAML)
Walk to this link: http://blogs.msdn.com/b/robertgreen/archive/2013/01/30/saving-and-restoring-state-in-a-windows-8-xaml-app.aspx.
He already show how to drive down step by step and make me clear where to configure the code for how to save and restore state in Windows Store App.
He already show how to drive down step by step and make me clear where to configure the code for how to save and restore state in Windows Store App.
Labels:
C#,
Programming,
Windows,
Windows Store App
Thursday, October 24, 2013
Web Test Recorder on Internet Explorer 11
Recently, I have got a problem about using Web Test Recorder after upgrading to Windows 8.1. It has come with the new version of internet explorer i.e. version 11. That doesn't compatible with current Web Test Recorder version (we have to wait until new release to support IE11). However, there is a workaround for this problem. Try to disable Enhanced Protected Mode, then it should work. If not, follow this link: http://blogs.msdn.com/b/visualstudioalm/archive/2013/09/16/using-internet-explorer-11-and-not-able-to-record-a-web-performance-test-successfully.aspx. It contains information to disable something new which doesn't support on Web Test Recorder.
Tuesday, August 27, 2013
Convert a color image to a greyscale image using Python Imaging Library
Recently, I have a chance to do some image processing tasks because of my lacking in term of using application like GIMP. I just want to do very easy task to convert a color image to a greyscale image because my printer cannot do color printing and set for black and white. I know it is very easy task with we can use some programs to do it instead of Image Processing program like GIMP or Photoshop. For me, I can do some Python programming then decide to write a small program to convert a color image to grey scale image within 5 minutes (from start writing a code and done processing).
In Python, we can use a lightweight library but easy and powerful to use to do Image Processing tasks that is Python Imaging Library. Before do converting task, we need to know some basis about Image Processing first.
The first thing that we should know is the color mode. In Image Processing there are many color modes which each mode is appropriate for some kind of tasks such as binary image (just black or white like a picture in Game Boy), 8-bit black and white (greyscale image), RGB (3x8-bit), etc. for more details can look at http://effbot.org/imagingbook/concepts.htm.
Okay, we have just known the image color system in Python Imaging Library. To convert a color image (usually RGB image) to greyscale image, it is not difficult because Python Imaging Library already provide the function to convert image mode. The code to convert has shown below:
from PIL import Image
input_filename = 'input.png'
output_filename = 'output.png'
image_file = Image.open(input_filename)
# L refers to 8-bit pixels, black and white in Python Imaging Library
image_file = image_file.convert('L')
image_file.save(output_filename)
The step is load an image to the buffer then convert an image mode and save to another image file.
It's not hard but quite fun if we can play more interesting features in Python Imaging Library. With this code, we can convert an image within a sec :)
Example (Asuna from SAO):
Reference: The Python Imaging Library Handbook
Example (Asuna from SAO):
![]() |
| Before |
![]() |
| After |
Labels:
Image Processing,
Programming,
Python
Tuesday, July 30, 2013
JavaScript control attributes for Windows Store Apps (data-win-* attributes)
Lately, I have done something mostly related to Windows Store App and I'm also interested in JavaScript. This language is very powerful in so many ways. It's easy to entry, you just have a browser and a text editor then your can start develop something. However, JavaScript is easy to start, but it is not easy to be mastered. I'm not a JavaScript professional, not even a web developer. But when compared the learning curve between JavaScript and Strong-Typed Languages (such as Java, C#). By the way, this post is not about language technologies.
The next one is "data-win-options". It can receive a JavaScript object to set that control properties.
It can also do binding data as XAML does using "data-win-bind" (with some code in JavaScript side).
To make elements can't be selected, use "data-win-selectable" property. It is just a true / false value. By default, all input elements and elements with the contentEditable attribute set to true are selectable.
The controls can be binded with external resources for localization or other purposes using "data-win-res".
For the "data-win-fragmentLoad" property, the document said that this will be removed from the next version of Windows Library for JavaScript. So, I think we should not use it.
Reference: Windows Library for JavaScript control attributes
JavaScript is powerful enough to make it be a one of native languages of Windows Store App. In this post would like to give introduction about added-on attributes to make html elements transformed into Windows Store controls.
The first one is "data-win-control". It is a very important attribute to create WinJS controls by giving them a control name then call process UI to apply controls on the startup. This attribute can't not be used on iframe element.
The first one is "data-win-control". It is a very important attribute to create WinJS controls by giving them a control name then call process UI to apply controls on the startup. This attribute can't not be used on iframe element.
<div data-win-control="controlName" />
(function( ) { document.addEventListener("DOMContentLoaded", function(e) { WinJS.UI.processAll(); }); })();
The next one is "data-win-options". It can receive a JavaScript object to set that control properties.
<div data-win-control="control" data-win-options="{ property1 : value1, property2 : value2}"> </div>
It can also do binding data as XAML does using "data-win-bind" (with some code in JavaScript side).
<element data-win-bind="elementProperty1 : dataSourceProperty1; elementProperty2: dataSourceProperty2" />
To make elements can't be selected, use "data-win-selectable" property. It is just a true / false value. By default, all input elements and elements with the contentEditable attribute set to true are selectable.
<div data-win-selectable="true" ...
The controls can be binded with external resources for localization or other purposes using "data-win-res".
<p data-win-res="{textContent: 'String1'}"></p>
For the "data-win-fragmentLoad" property, the document said that this will be removed from the next version of Windows Library for JavaScript. So, I think we should not use it.
Reference: Windows Library for JavaScript control attributes
Labels:
HTML5,
JavaScript,
Windows,
Windows Store App
Subscribe to:
Posts (Atom)

