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.

Thursday, March 24, 2016

Tutorial Learn Linux The Hard Way (β version) - Introduction


Introduction

This is a simple guide written in “Learn X the hard way” style, author of which is Zed A. Shaw. The purpose of it is to give you some experience in working with Unix-like system. There are many good UNIX-Like systems out there, for example FreeBSD, OpenBSD, OpenSolaris and even MAC OS X, just to name a few. When deciding which system to use in this guide I chose Linux mainly because it is most popular UNIX-like server operating system, which means what you have much bigger chance encountering it in the wild in comparsion to other UNIX derivatives. And Linux-related skills are relatively easy transferable to other UNIX-likes.

Wednesday, March 16, 2016

Totorial - How to setup PI WEB SERVER


Overview :
  • Download the latest Rasbian
  • Prepare a SD / Micro SD card to receive the downloaded Images.
  • Un compress and Transfer the downloaded Raspbian Image to the SD / Micro SD card.
  • Install Raspbian.
  • Configure Raspbian for a static network.
  • Install  Apache Web Server
  • Install PHP and Associated Packages
  • Install MySql
  • Configure your router to access your Webserver and a domain name that points to your webserver.

Hướng dẫn toàn tập cho người mới bắt đầu học điện tử - phần 3


Nguồn : http://techmaster.vn/

Giá trị điện trở chuẩn hoặc thông thường


Monday, March 14, 2016

Bonus 2 : Tip and trick with Raspberry Pi


GETTING THE NETWORK DETAILS

To scan for WiFi networks, use the command
sudo iwlist wlan0 scan | grep 'ESSID\|IE: IEEE'
This will list all available WiFi network names and their encryption methods. Look for yours in the list:
  1. ESSID:"yournetwork". This is the name of the WiFi network, find the one that you want to use.
  2. IE: IEEE 802.11i/WPA2 Version 1.
    1. This is the authentication used; in this case it is WPA2, the newer and more secure wireless standard which replaces WPA1. This guide should work for WPA or WPA2, but may not work for WPA2 enterprise; for WEP hex keys.

ADDING THE NETWORK TO THE RASPBERRY PI

Open the wpa-supplicant configuration file in nano:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Go to the bottom of the file and add the following:
network={
    ssid="The_ESSID_from_earlier"
    psk="Your_wifi_password"
}
In the case of the example network, we would enter:
network={
    ssid="testing"
    psk="testingPassword"
}
Now save the file by pressing ctrl+x then y, then finally press enter.
At this point, wpa-supplicant will normally notice a change has occurred within a few seconds, and it will try and connect to the network. If it does not, either manually restart the interface with
sudo ifdown wlan0
and
sudo ifup wlan0
or reboot your Raspberry Pi with
sudo reboot
You can verify if it has successfully connected using ifconfig wlan0. If the inet addr field has an address beside it, the Pi has connected to the network. If not, check your password and ESSID are correct.
You can also check your DHCP server to see if it gave out a new IP address.

Remove any unneeded packages

There will eventually be packages that are unneeded. Apt-get can get rid of them by issuing this command:

sudo apt-get autoremove

Remote Desktop

Installing this allows you to connect via RDP on Windows.
sudo apt-get install xrdp

Add Chrome/Chromium to Desktop

Adds “Chrome” web browser to the GUI interface.
sudo apt-get install chromium-browser

Check CPU Clock Speed

This will show the current CPU clock speed in hertz
 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

Raspi-config

This is the initial configuration utility. I always forget its name..
sudo raspi-config

Hướng dẫn toàn tập cho người mới bắt đầu học điện tử - phần 1


Nguồn : http://techmaster.vn/

Học điện tử cơ bản đến nâng cao tốt nhất
Mọi khởi đầu trong bất cứ lĩnh vực nào cũng có rất nhiều khó khăn, nhưng nếu bạn có động lực và quyết tâm mạnh mẽ thì chắc chắn bạn sẽ thành công. Hầu hết các sinh viên kỹ thuật điện tử đều muốn tự tay làm ra một sản phẩm gì đó. Trải nghiệm thực tế khi làm một sản phẩm nào đó là một cách học tuyệt vời. Mặc dù nó là rất quan trọng nhưng hầu hết các sinh viên không được hướng dẫn đúng đắn và họ không biết nên bắt đầu từ đâu. Tôi tin rằng loạt bài hướng dẫn này sẽ giúp cho những ai yêu thích điện tử có thể dễ dàng bắt tay vào làm các dự án của họ.

Wednesday, March 9, 2016

CÀI ĐẶT RASPBERRY PI - Bài 9 : SETUP DROPBOX FOR MOTION ON THE RASPBERRY PI


Raspbian, the recommended default operating system of the Raspberry Pi, does not come with a native Dropbox package. The hacks I saw online were all pretty sloppy, with many showing how to bounce files from your raspberry pi to another device like a desktop PC that has dropbox installed, then using that PC to sync files. I wanted Dropbox synchronization for only a single folder, and for one purpose: to collect the photos my webcam takes when using the motion software.

I decided to use Dropbox’s Python API to create a script that could save my security footage. I had a number of uninvited painters scheduled to come to my apartment while I was away at work and needed something that would save to a remote location. The code that follows is tailored to the motion program. Since motion can automatically execute a program or script upon writing a file (ie: saving a photo or video triggered by motion), I decided to take advantage of this and upload each file individually as opposed to running an additional script that continually monitors the filesystem for changes.

Tuesday, March 8, 2016

CÀI ĐẶT RASPBERRY PI - Bài 8 : SETUP Raspberry Pi as low-cost HD surveillance camera

Build a low-cost HD video surveillance cam with worldwide access from any browser

Introduction

This article describes how to build a surveillance cam based on a Raspberry Pi micro-computer which records HD video when something moves in the monitored area. Live picture can be viewed from any web browser, even from your mobile while you're on the road.
What you will get:
  • See live stream in any web browser from anywhere
  • Record any motion into video file
Hardware components
      We need some hardware for this project. This is a list of the major things we need:
  • Raspberry Pi 2 Model B: (Link : http://hshop.vn/products/moy-tonh-raspberry-pi-2-model-b-1gb-made-in-prc)
  • Raspberry Pi Camera Module (Link : http://hshop.vn/products/camera-hong-ngoai-raspberry-pi-noir)

Tuesday, March 1, 2016

CÀI ĐẶT RASPBERRY PI - Bài 7 : Điều khiển Raspberry Pi sử dụng SSH (Windows, Linux)

Mục đích:
  • Cấu hình Raspberry Pi để sử dụng tính năng điều khiển từ xa qua SSH
  • Cấu hính trên Windows, Linux để điều khiển SSH

Chuẩn bị:

  • Raspberry Pi có hệ điều hành (Raspbian Wheezy hoặc Jessie)
  • Máy tính chạy: Windows, Linux hoặc Mac

Tiến hành:

Bước 1. Cấu hình Raspberry Pi

Để có thể điều khiển Raspberry Pi sử dụng SSH thì Raspberry Pi phải được Enable SSH server.
Thông thường thì SSH Server được mở mặc định.

Monday, February 29, 2016

Cơ bản về Arduino - Bài 1

Nguồn : http://kipalog.com/

Giới thiệu về Arduino

Có thể bạn đã quen lập trình trên PC, với những ngôn ngữ như C, C++, C#, Java, Python, Ruby...
Nhưng bạn có biết là phần mềm trên PC chỉ chiếm khoảng 10% sản lượng phần mềm trên thị trường. 90% còn lại là code điều khiển tivi, máy giặt, điều hòa, tủ lạnh... tóm lại là tất cả các thiết bị điện tử xung quanh bạn. Đây cũng là một mảng theo tôi là khá thú vị. Lập trình theo hướng này được gọi là embedded computing, hay physical computing, tức là lập trình để con người tương tác với các thiết bị thực.
Để người thiết kế có thể nhanh chóng đưa ra được mẫu thể hiện ý tưởng của mình, rất cần phải có những platform để dễ dàng prototyping. Và một trong những platform đang được sử dụng rất nhiều trong prototyping là Arduino.

Friday, February 26, 2016

Hướng dẫn thiết lập đóng ngắt mach điện qua esp8266 wifi module

Chuẩn bị:

1.     Module 1 Relay (5VDC) với opto và transitor cách ly. 
2.   Module ESP8266 v12 wifi NodeMCU v3. Giá 200k
3.  Supply Power 5V 2A chẻ 2 nhánh cấp nguồn cho esp và relay
4.  Dây nhảy
(Tất cá linh kiện này bạn có thể mua ở hshop.vn)
(

CÀI ĐẶT RASPBERRY PI - Bài 6 : How To Install Multiple OSes On A Single SD Card For Raspberry Pi

Running multiple projects on your Raspberry Pi usually requires a different operating system or configuration for each, best achieved with multiple SD cards. But is there a way to “dual-boot” the OS?
The Raspberry Pi is a very flexible little PC, but this flexibility can have its downsides. Being able to dual- or multi-boot different operating systems (many OSes are available for the Raspberry Pi) can prove extremely useful, particularly with projects that have similar hardware requirements, such as a media centre and a retro gaming centre.