Wednesday, November 2, 2016

Tip and Trick with service Windows


Tip 1 : How do I restart the Remote Desktop Service on a Server 2003 system without rebooting the system? 
The Terminal Services service is an integrated part of the core OS in Windows, that's why it can't be stopped or restarted as most other services (it is grayed out).

Solution 1: 
star and stop Terminal Service not boot server:
The Terminal Services service is run as a SVCHost.exe process. The first step in stopping it requires identifying the correct process. On your Windows 2003 Server, open up a command prompt. At the prompt, type: 
tasklist /svc /fi "imagename eq svchost.exe"

Scroll through the output until you find 
svchost.exe XXXX TermServices 
where XXXX is the process id. 

At the same prompt, type 
taskkill /PID XXXX /F 
where XXXX is the process id you got from the previous command. 

Type: 
services.msc 
and hit enter. Then type Exit and hit enter. The command prompt will close and the services window will open. Scroll through the list of services until you find Terminal Services. Right click on the service and select Start from the popup menu.

Solution 2: 

Start / Stop / Enable / Disable Terminal services from command line


We can start Terminal Services by running the command given below.
net start TermService
If the service is already running you will get the message ‘The requested service has already been started.
Sometimes you may get an error that the service could not be started.
C:\>net start termservice
The Terminal Services service is starting.
The Terminal Services service could not be started.
The service did not report an error.
More help is available by typing NET HELPMSG 3534.
This happens when Terminal Services is disabled through registry hack. You can fix this by running the below registry change command.
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v TSEnabled /t REG_DWORD /d 1 /f
You need to reboot the computer for the changes to take effect. After reboot terminal services starts automatically or you can start the service using net start command as mentioned above.
How to stop Terminal Services?
Terminal Services can’t be stopped like other services.  You get the below error when you attempt the same.
C:\>net stop termservice
The requested pause or stop is not valid for this service.
How to restart Terminal services?
Since Terminal Services can’t be stopped there is no straightforward way we can do this. Microsoft says this is by design. But in some cases restarting terminal services could be possible by killing the svchost process that runs the terminal services.We can use tasklist and taskkill commands for this.
First get the process id of the terminal services process
 tasklist /svc | findstr /C:TermService
Check if Terminal services is the only service running in this svchost. If the svchost is shared with other services then you can stop reading further. Restarting terminal services is not possible on your machine.
On my system I have got the following output.
C:\>tasklist /svc | findstr /C:TermService
svchost.exe                 1708 DcomLaunch, TermService
C:\>
As you can see DcomLaunch and TermServiceboth share the same svchost process. In this case I can't kill the process as it stops the other service also. (Note that DcomLaunch is an essential service on the system and killing it can even shutdown the system)
In the case of svchost not being shared with any other service you can go ahead and kill TermService process by the following command.
taskkill /F /PID  process_id
How to disable Terminal Services?
We can run the below command to disable terminal services.
sc config TermService start= disabled
How to enable Terminal Services?
sc config TermService start= auto
(or)
sc config TermService start= demand

Thursday, June 2, 2016

Project : Giải pháp smart home dựa trên phần mềm mã nguồn mở OPENHAB - HELLO WORLD !

Part 1 : Cài đặt hệ điều hành Raspbian

Hello world ! 

Qua một thời gian tìm hiểu về lĩnh vực smart home mình thấy giải pháp sử dụng mã nguồn mở OPENHAB là ổn định và dễ sử dụng nhất. Để cho các bạn mới làm quen tìm hiểu về smart home đỡ tốn thời gian và công sức, mình đã tổng hợp các thông tin cần thiết để các bạn có thể bắt tay vào xây dựng giải pháp smart home (tự chế) cho riêng mình. Có thời gian rỗi mình sẽ viết tutorial hướng dẫn từng bước cho các bạn. 

Đầu tiên là chúng ta sẽ tìm hiểu về các phần mềm, giao thức đã sử dụng trong smart home project.

SOFTWARE :

1. Raspiban OS for Raspberry Pi

Raspbian là phiên bản hệ điều hành phổ biến nhất trên Raspberry Pi, nó dễ sử dụng và được sự hỗ trợ của cộng đồng trên toàn thế giới. Raspbian là phiên bản dựa trên Debian Wheezy – một  phiên bản Linux ưa thích của cộng đồng mã nguồn mở. 

Raspbian là nền tảng rất tốt cho những người mới bắt đầu làm quen với Raspberry Pi và hệ điều hành Linux. Raspbian cũng bao gồm các ứng dụng multimedia và đồ họa, soạn thảo văn bản, trình duyệt internet ... Nếu cần thêm ứng dụng gì bạn chỉ việc down nó về, cài đặt và sử dụng. Thật tuyệt phải không nào :D

Chi tiết các bạn tìm hiểu site  https://www.raspberrypi.org/downloads/raspbian/

Tuesday, April 12, 2016

Tutorial - Lập trình nhấp nháp đèn LED với ESP8266 module sử dụng Arduino IDE


Có rất nhiều công cụ để chúng ta làm việc với ESP8266 module như ESPlorer, Arduino IDE. Trong bài viết này tôi sẽ trình bày cách sử dụng Adruino IDE để lập trình cho ESP8266 module.

Chuẩn bị :

Hardware :
- NodeMCU devkit - Link http://hshop.vn/products/kit-rf-thu-phat-wifi-esp8266-nodemcu (Sử dụng bộ Kit này rất tiện lợi, nó đã tích hợp sẵn giao tiếp USB-UART với chip điều khiển CH340G để chúng ta kết nối dễ dàng với PC qua cổng USB mà không cần mạch nạp USB to UART).
- Board test mạch, dây cắm, 01 đèn led, 01 điện trở

Software:
Bài viết này tôi sử dụng Windows để cài đặt, các bạn có thể tìm hiểu thêm cách cài đặt trên Linux tại đây  http://playground.arduino.cc/Learning/Linux 

Friday, April 1, 2016

Tutorial Learn Linux The Hard Way (β version) - Exercise 4. Bash: working with files, pwd, ls, cp, mv, rm, touch


In Linux everything is a file. But what is a file? For now it will suffice to say that it is an object which contains some information. It is usually defined like this:
A computer file is a block of arbitrary information, or resource for storing information, which is available to a computer program and is usually based on some kind of durable storage. A file is durable in the sense that it remains available for programs to use after the current program has finished. Computer files can be considered as the modern counterpart of paper documents which traditionally are kept in offices' and libraries' files, and this is the source of the term.
But this definition is too general, so let us be more specific. man stat tells us that file is an object which has the following properties additionally to information it contains:

Thursday, March 31, 2016

Tutorial Learn Linux The Hard Way (β version) - Exercise 3. Bash: The shell, .profile, .bashrc, .bash_history


When working with Linux using CLI (command line interface), you are interacting with a program called a shell. All you type is passed to the shell, which interprets what you have typed, does parameters expansion (which is somewhat similar to brace expansion in algebra) and executes programs for you. Shell which we will be using is calledBash, which stands for Bourne Again Shell, which is in turn a pun. Now I will show you general overview of how the bash works in plain English:

Wednesday, March 30, 2016

Tutorial Learn Linux The Hard Way (β version) - Exercise 2. Text Viewer, The: less is More


Now you can edit text files, that is nice. But what if you want just to view a text file? Of course, you could use vim for that, but very often it is overkill. And two more thing to consider:
  • If you want to view really large file, you will want to view it in a program which is as fast as possible.
  • Often you would not want to accidentally change something in a file.

Tuesday, March 29, 2016

Tutorial Learn Linux The Hard Way (β version) - Exercise 1: Text Editor, The: vim


In Linux, as in any Unix-like OS, everything is just a file. And Unix philosophy states that configuration files must be human readable and editable. In almost all cases, they are just plain text. So, first things first, you must learn how to edit a text file.
For this I strongly advise you to learn basics of vim, which is one of most powerful tools to work with texts in Linux. Vim is reimplementation of vi, the editor written in 1976 by Bill Joy. Vi implemented a concept so successful that even Microsoft Visual Studio 2012 has a plugin, which provides a mode compatible with this more than 35 year old editor. You may play with right here (this is real Linux running in your browser). After you are done go and get get my virtual appliance at last.