Tech Sharing

Tech Sharing


Posts Tagged ‘ Microsoft ’

Enabled telnet service in Window 7

By on September 21, 2011

By default, window 7, Window Server 2008 R2, Window Vista and Window Server 2008 come with telnet service disabled. They do that is to hardern the operating system as well as to save the resources as most of the common user will never use this service at all.


To use this features, you must manually enabled it. Just following the following simple step to enabled it:

  • Start
  • Control Panel
  • Programs And Features
  • Turn Windows features on or off
  • Check Telnet Client
  • Hit OK

After that you can start Telnet via Command Prompt.

Today, I found out that the default setting for the Visult studio 2008 is not enable the line number, in order for easy debuging purpose, I have to turn it on.


To turn on the line number for Visual studio 2008 you need to do 2 things:

To turn on the status bar
tools –> Options –> Environment –> General –> Show Status Bar


To turn on the line number for all language
tools –> Options –> Text Editor –> All Language –> Tick the Line Number check box


Our computer are very smart and it will help us to enhance the user experience by creating some temporary file and store it in somewhere in your harddisk. So after sometime the un-used files, old temporary files, temporary Internet files, and any log file may use up a lot of space in your harddisk, in addition, those unwanted file may also slow down your computer performance. Keeping your harddisk clean and tiny is a way to mainteance your computer performance at the top.

This task seem easy but very time consuming as we may need to find out what files are useless for our computer and safe to delete without affecting our computer. Microsoft Window XP/2003 did provide a very user friendly tools for us to done the task call ‘Disk Cleanup Manager’.

You can get the tools at Start –> All Program –> Accessories –> System Tools –> Disk Cleanup.

But to using this tools, it need the human interaction which response to it on the spot in order to accomplish the job. Why not we make it run automatically at the time that the computer is free or idle without any response needed by the user.

To do so just following the following step:

  1. Click Start Menu > Run, then type cleanmgr /sageset:1
  2. Click OK.
Disk Cleanup opens with a list of the possible files to be deleted. Select a file type to display a description. Check the boxes for the files you want removed, and click OK.
Next, you need to schedule Disk Cleanup to run when you want it to.
  1. Open Control Panel, double-click Scheduled Tasks
  2. Double-click Add Scheduled Task
  3. On the Scheduled Task Wizard dialog, click Next.
  4. In the list of applications you want Windows to run, click Disk Cleanup, and then click Next.

  5. Select a frequency for the task (once per week is usually enough) and click Next.

  6. Select a day of the week and time for the task to run.

  7. Enter the name and password of a user.
  8. Check the box to open Advanced Settings when you’re done.
  9. In the Run box, add the following to the end of the path: /sagerun: 1 and then click OK.
  10. Task Scheduler will automatically run Disk Cleanup with the settings you selected at the time you selected.
  11. Done


There are something you need to attention on which is the first command and switch you enter in the command prompt are difference with the extra command and switch you enter on the scheduler. The command enter in command prompt is /sageset but in the scheduler is /sagerun.

/d driveletter: – Select the drive that you want Disk Cleanup to clean.
/sageset:n      – Display the Disk Cleanup Settings dialog box and create a registry key to store the settings you select.
The n value is stored in the registry and allows you to specify different tasks for Disk Cleanup to run.
n can be any integer from 0 to 65535. Specify the %systemroot% drive to see all the available options.
/sagerun:n       – Run task ‘n’
All drives in the computer will be enumerated, and the
selected profile will be run against each drive.
Only one of the 3 options above can be run at a time

We store a lot of important information in Excel file which we don’t want other to grant any access to that information. By using Microsoft Excel 2007 you may do so by protect your whole workbook.


In order to do that, click on File –> Save As.On the file-save pop up window, select the location where you which to store your file and type in the file name, after all, click on the tools at the bottom of the window and select General Options. A small window will pop up to ask you to enter the password to open as well as password to modify.


Pop up saved as window

Select general option from the drop down tools menu

Enter the password for view and modify your excel file

By enter these 2 passwords, Microsoft will protect your entire workbook and prevent anyone else to open and view your contents. Make sure you will remember your password that you enter as if you lost that password, it’s not an easy job to get back your content in your excel file.



The password will be require whenever you try to open the excel file

By  default, window server 2003 only come with the 2 Remote client access, unless you bought the CAL license. (But not many of the company will buy). So only 2 active or disconnected session are allow in the sames time.

So when the 3th user would like to connect into the same server, he/she will get the error message of “The terminal server has exceeded the maximum number of allowed connection”

After googleing, found this solution:

  1. Go to Command Prompt
  2. Type mstsc / /f -console (replace with the remote IP)
  3. Login with the administrator account

This command will log you in with the 3th remote connection to your server, you should use this account to kick out the rest of the 2 account before you continue your job.

To delete the existing connection you may go to task Manager -> users -> select the user and log them off.

The alternative for this solution is you can configure the settings on terminal server to manage the connections in a variety of ways. You do that through Start > Control Panel > Administrative Tools > Terminal Services Configuration. Select the Connections folder from the left panel.

In the right panel you should see the available connection types. Most likely there will be an entry for RDP-Tcp (Microsoft RDP 5.2). Right-click on that entry and select Properties. Select the Sessions tab and you will see a number of options related to sessions. All of my drop downs were set to Never, which explained why they never timed-out. To solve our problem, you may check the ‘Override user settings‘ option and set ‘End a disconnected session’ and ‘Idle session limit’ to 15 minutes. I left the ‘Active session limit’ at Never since as long as you are actively using the connection.

Terminal Server has exceeded maximum number of allowed connection error message

Terminal Server has exceeded maximum number of allowed connection error message

Terminal services configuration window

Terminal services configuration window

SQL Server Do's And Dont's

By on August 29, 2009

dataSo, you are now the leader of a SQL Server based project and this is your first one, perhaps migrating from Access. Or maybe you have performance problems with your SQL Server and don’t know what to do next. Or maybe you simply want to know of some design guidelines for solutions using SQL Server and designing Database Access Layers (DAL): this article is for you.

Even if you are not using SQL Server, most of these design guidelines apply to other DBMS, too: Sybase is a very similar environment for the programmer, and Oracle designs may benefit from this too. I won’t show here how to use specific T-SQL tricks, nor won’t give you miracle solutions for your SQL Server problem. This is by no means a complete, closed issue. What I intend to do is give you some advices for a sound design, with lessons learned through the last years of my life, seeing the same design errors being done again and again.


Do know your tools

Please, don’t underestimate this tip. This is the best of all of those you’ll see in this article. You’d be surprised of how many SQL Server programmers don’t even know all T-SQL commands and all of those effective tools SQL Server has.


“What? I need to spend a month learning all those SQL commands I’ll never use???” you might say. No, you don’t need to. But spend a weekend at MSDN and browse through all T-SQL commands: the mission here is to learn a lot of what can and what can’t be done. And, in the future, when designing a query, you’ll remember “Hey, there’s this command that does exactly what I need”, and then you’ll refer again to MSDN to see its exact syntax.


In this article I’ll assume that you already know the T-SQL syntax or can find about it on MSDN.


Submit your site to

By on June 20, 2009

bing-iconAfter few years of search engine being monopoly by Google, Microsoft has announced their new counter weapons toward Google – called

This is just a begining for the search engine war. Now come to another part of the new search engine where all the webmaster or the blog owner should do – get your site to index by the new search engine and gain the traffic from Bing

Click here to submit your website to Bing and get’s index by Bing, so that your website can be found.

Besides that, Bing also has the webmaster tools like the Google webmaster tools. Click here to create a web master center account to submit your site and get index and explore to the search engine faster

Bing home page

Bing home page

In SQL, basically there are two ways to Insert data into a table; one is insert it one row per time, another way is insert multiple rows at a times.

For the first method (insert one row per time) is the most common way to insert data into database that we will use normally, and the sample sql syntax as below:

Insert into table1 (col1, col2, col3)
values (value1, value2, value3)

The other insert method that we seldom use, but it may be useful if you like to copy and insert more then one row of record into a table at a time. You may include the Select statement to specify the data that you want to insert into the tables.

The SQL syntax as below:

INSERT INTO table1(col1, col2, cols3)

SELECT value1, value2, value3
FROM table2
WHERE value4 = 1998

There is another way of writing the same SQL:

Select value1, value2, value3

Into table1

From table2

WHERE value4 = 1998

Normally to get the number of row for a particular table, where we will do is as the following query:

select count(*) from Table_name

Yes, you may get your result very fast if your table is very small, but if your table is more then 100k rows, then you may face some delay on that. What the above query do is actually it run the full table scan to get the row count. The scaning can be Logically or Physically. Logically mean that the SQL server only scan from the catch memory, whereas physically scan mean that it really scan through your table.

Actually there is anther alternative way to get the total row count for a table. You can ultilize the sysindexes system table for this purpose.

There is ROWS column in the sysindexes table. This column contains the total row count for each table in your database. So, you can use the following select statement instead of above one:

FROM sysindexes
WHERE id = OBJECT_ID(‘table_name’) AND indid < 2

There are physical read and logical read operations. A logical read occurs if the page is currently in the cache. If the page is not currently in the cache, a physical read is performed to read the page into the cache. To see how many logical or physical read operations were made, you can use SET STATISTICS IO ON command.

The example:



SELECT count(*) FROM tbTest


SELECT rows FROM sysindexes WHERE id = OBJECT_ID(‘tbTest’) AND indid < 2







(1 row(s) affected)

Table ‘tbTest’. Scan count 1, logical reads 32, physical reads 0, read-ahead reads 0.




(1 row(s) affected)

Table ‘sysindexes’. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0.

New windows touch on Glass Surface

By on February 17, 2009

microsoft-window-surface-logoWindows touch is a impressive project by the software giant – Microsoft. This is the totally new technology and new way for human and computer interaction. With the multi touch sensor and more human friendly interactive way, now you can do more things and more easy .

Enjoy the video below: