Saturday, June 8, 2013
Schedule a Windows Task to call an ASP.NET web page - ASP.NET - VB.NET, Windows Task Scheduler
0 comments Posted by Duc Nguyen at 5:56 PMThe following is how you
can schedule a windows task that can call an ASP.NET web page. Usually
we want to schedule task from Windows. I have seen lots of questions
regarding this in the past.
The cool thing about
Windows task is that you can execute custom jobs to be executed in the
server without the need of a user to be logged in.
The following code can
be used to call ASPX web pages to run a specific job that needs to
execute some sort of logic. The script is written in VB.NET, but the web
page can be written with C# as the vbscript only is used to create the
call from the server to the page.
The steps are as follow:
- Write the Script (VB in this case)
- Create an ASP.NET page
- Schedule the task through the VBS Script
On Error Resume Next
To schedule a new task:
- Double-click Add Scheduled Task to start the Scheduled Task Wizard, and then click Next in the first dialog box.
- The next dialog box
displays a list of programs that are installed on your computer, either
as part of the Windows XP operating system, or as a result of software
installation.
Use one of the following procedures:- If the program that you want to run is listed, click the program, and then click Next.
- If you want to run a program, script, or document that is not listed, click Browse, click the folder and file that you want to schedule, and then click Open.
- Type a name for the task, and then choose one of the following options:
- Daily
- Weekly
- Monthly
- One time only
- When my computer starts (before a user logs on)
- When I log on (only after the current user logs on)
- Click Next, specify the information about the day and time to run the task, and then click Next.
Note that the information about the day and time to run the task vary depending on the selection that you made in the previous wizard dialog box. For example, if you chose Weekly, you must indicate the day of the week, the time, and if the task should run every week, every 2 weeks, every 3 weeks, and so on. - Type the name and password of the user who is associated with this task. Make sure that you choose a user with sufficient permissions to run the program. By default, the wizard selects the name of the user who is currently logged on.
- Click Next, and then click Finish after you verify the choices that you have made.
Using Advanced Options in Scheduled Tasks
On the Schedule tab, you can change any of the scheduling options that you chose in the wizard, and you can also change the task configuration so that the task does not run too long, does not run if the computer is running on batteries (for laptops), and to specify whether or not the computer should be idle for the task to run.
NOTE: You can open the Properties dialog box for the task at any time if you open Scheduled Tasks, right-click the task, and then click Properties.
You cannot schedule a task so that it repeats in an interval less than one day; however, you can do this in the Properties dialog box:
- Click the Schedule tab, and then click Advanced.
- Click to select the Repeat task check box, and then specify the number of minutes or hours in which you want the task to be repeated.
I hope you can find this useful.
Friday, May 17, 2013
I decided to write this post because I have not found a simple and
clear description for installing PHP on Windows, and setting this not
very common combination to work with MS SQL 2008.
We are currently working on porting the largest system ever created
in Deep Shift Labs from Windows 2000 and MS SQL 2000 to Windows 2008 and
MS SQL 2008. I want to speak briefly about the history of this system
and why we actually needed to install PHP on Windows. The system is
about 800K lines of PHP code and it has been helping people to solve
their business needs for the last 10 years. This system is designed for
one of our customers. The first few years, the system worked on FreeBSD,
Apache and PostgreSQL. Then the client’s company went public, and they
needed to switch to commercial software. Sometime in 2004, we have been
able, thanks to the fact that we originally used ADODB,
to move, with a little effort, from FreeBSD/Apache to Windows 2000/IIS 5
(PHP runs as an ISAPI module). Finally, in 2006 we moved the then small
database, both in structure and in size, to MS SQL 2000 from
PostgreSQL.
The most difficult part in the distant 2006 was to find a driver
which is bug free with MS SQL. We had tried everything supported by
ADODB back then, and, in the end, we decided in favor of php_dblib.dll
suggested and maintained by Frank Kromann. Frank was maintaining
MS SQL extensions in PHP project and helped us immensely. The
php_mssql.dll driver was using ntwdblib.dll from Microsoft, that does
not work with dates and long texts properly. php_dblib.dll used
dblib.dll from FreeTDS and we have not found any problems in it and
started using it.
And now came the moment when the customer wants to move to the operating
system and database that have Microsoft support (Windows 2000 and MS
SQL 2000 are not supported anymore) and such a move, in general, is a
common requirement in large enterprises.
Naturally, in the ADODB 4.93 we have been using since 2006, there is
no mssqlnative driver support and so the challenge was set as follows:
- Move the database from MS SQL 2000 to MS SQL 2008
- Move the web server from Windows 2000 and IIS 5 (ISAPI) on Windows 2008 and IIS 7 (FastCGI)
- Upgrade PHP 5.1.6 to PHP 5.4.6
- Upgrade ADODB from 4.93 to 5.17 with transition to the new driver ‘mssqlnative’
- To test the system, including the two replications processes to our database from servers running MS SQL 2000 and MS SQL 2005.
This is one of the installation methods (obviously the one we used).
1. Create C:\PHP and C:\tmp folders
2. Load non thread safe PHP version recommended for use here and here.
The file will contain _nts_ in the name, for example –
php-5.4.6-nts-Win32-VC9-x86.zip (latest version available at the time of
writing this post) from the site http://windows.php.net/download/.
3. Unpack it in C:\PHP
4. Load latest drivers from MS SQL Microsoft (file SQLSRV30) and extract it to C:\PHP\ext
5. Download the PHP web installer from Microsoft. They offer two versions and I used the latter one available with PHP 5.3.13. Install it.
You can ask a reasonable question why we install 5.3.13 to switch to
5.4.6. There are two reasons. First – I did not manage to set PHP 5.4.6
and manually configure IIS. Despite my attempts to let PHP see its
php.ini file inside the C:\PHP I failed to do so. According to all the
manuals you need to create a variable PHPRC assigning the path to
php.ini, but in my case, someone has done something wrong.
Since PHP couldn’t see the configuration file, MS SQL driver was not
loaded. Being stuck at this point for a couple of hours I asked for help
in the forum and started looking for alternatives, waiting until
America wakes up and sees my ‘SOS’ message in the forum. It was then
that I accidentally came across a site
where I found the alternative I was looking for. Maybe I would not have
started using the installer if it had not offered to set this magical
and wonderful PHP Manager
I could not resist at the thought of trying. In the end I found that
the PHP Manager allows adding PHP 5.4.6, making its php.ini file
perfectly visible.
It installs all the necessary components as well. It took some 10
years for Microsoft to add some really cool things to run PHP on Windows
– here you have MS SQL driver and the installer which adds a special
PHP Manager inside IIS, and even Windows Cache PHP accelerator for IIS.
After installation, we have PHP 5.3.13 installed in the Program Files and PHP Manager inside IIS.
As you can see from the PHP Manager, you can control the
configuration parameters from php.ini, and the extensions are shown in a
separate page. Also here we see what php.ini file is being used and
where the error logs are written. There is quick access to the FastCGI
handler created by the installer. It is possible to add other versions
of PHP and switch between them. We have not tested if it is possible to
use PHP Manager to set different PHP versions on different virtual
hosts. I think this and much more, such as to use different php.ini
files for different virtual hosts can be done manually using the
excellent article by Ruslan Yakushev from Microsoft. We just needed to add PHP version 5.4.6 to “live happily ever after”.
Now we can add PHP 5.4.6, which we put into in C:\PHP. After adding,
we see that IIS now uses a new version of PHP, and that PHP Manager
created a new handler, which is used (we do not see it here), but we can
check with phpinfo(), which PHP manager can dynamically generate for us
(how-cool-it-is!).
Now it is time to look at PHP extensions (modules). I removed mysql
and added both versions of the MS SQL driver sqlsrv and pdo_sqlsrv. I
forgot to check if IIS sees our changes immediately. I am used to
executing “iisreset” after changing configuration.
PHP Manager offers two pre-defined configuration options for error handling for development and production.
When I changed the path to the error log, PHP Manager did not see my
changes, and I had to restart the IIS. I really got used to the old
fashioned way for a folder for uploaded files, session and logs and
store them in PHP C:\tmp. No wonder our periodic scripts are in C:\etc.
Options ‘Configure error reporting’ and ‘Set runtime limits’ are kept
separately in PHP Manager for convenience only, as they all (except for
the extension modules) are available from the ‘Manage all settings’
panel.
If you need to parse HTML files with PHP – create one more mapping by
looking at parameters of existing PHP mapping you already have.
Now we can try to connect to MS SQL with the driver only and via
ADODB. First you need to make sure the server is configured to allow
TCP/IP as well as port 1433 is open on the Windows firewall.
In my case it was not so. If you cannot connect from PHP, it is
recommended to install SQLCMD and use it for testing. For example, here we will find the required version of SQLCMD.
I want to draw your attention to the fact that the new Microsoft driver returns datetime as PHP DateTime::
object. But we use ADODB, which does this little trick converting this
object into a string on line 794 of adodb-mssqlnative.inc.php file:
$this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z"); |
if(is_array($this->fields)) { foreach($this->fields as $key=>$value) { if (is_object($value) && method_exists($value, 'format')) {//is DateTime object //$this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z"); //DSL DateTime output format fix $this->fields[$key] = $value->format("Y-m-d H:i:s"); } } } |
echo "Direct driver connection
";
$connectionInfo = array(
"UID"=>'aws_user',
"PWD"=>'Q1w2e3r4t5',
"Database"=>"AWS_Database"
);
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect('192.168.3.86, 1433', $connectionInfo);
if( $conn === false )
{
echo "Unable to connect.";
die( print_r( sqlsrv_errors(), true));
}
$tsql = "SELECT GETDATE() AS today";
$stmt = sqlsrv_query( $conn, $tsql);
if( $stmt === false )
{
echo "Error in executing query.";
die( print_r( sqlsrv_errors(), true));
}
$row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
echo "Today is ".$row['today']->format('Y-m-d H:i:s')."";
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
ini_set( "include_path", ini_get( "include_path" ) . ";" . $_SERVER["DOCUMENT_ROOT"] . "/include" );
require_once("adodb5\adodb.inc.php");
$user = "aws_user";
$password = "Q1w2e3r4t5";
$server="192.168.3.86, 1433";
$database = "AWS_Database";
echo "ADODB MSSQL Native connection
";
$adoConnection = ADONewConnection('mssqlnative');
//$adoConnection->debug = true;
$adoConnection->Connect($server, $user, $password, $database);
$rs = $adoConnection->Execute($tsql);
echo "Today is ".$rs->fields['today']."";
$adoConnection->Close();
?>
|
Finally a couple of handy articles on how to configure PHP on IIS:
- Enable Per-Site PHP Configuration on IIS 7 and IIS 6.0
- Using FastCGI to Host PHP Applications on IIS
- Using FastCGI to Host PHP Applications on IIS 6.0
see more here http://www.deepshiftlabs.com/dev_blog/?p=1880&lang=en-us
Labels: php, SQL Server 2008 Express
Tuesday, February 26, 2013
A Basic Example of JQuery's UI.Dialog Dynamically Loading an URL with an IFRAME
0 comments Posted by Duc Nguyen at 6:00 AMsee this link http://clarkupdike.blogspot.com/2009/03/basic-example-of-jquerys-uidialog.html
I have looked at many examples of inserting an iframe into a jQuery UI dialog and have had little success. Then I came across this blog post describing a method that works… function showDialog(){ $("#divId").html('').dialog("open"); $("#modalIframeId").attr("src","http://www.google.com"); return false; } $(document).ready(function() { $("#divId").dialog({ autoOpen: false, modal: true, height: 500, width: 500 }); }); HTML: Show the Dialog
To close a dialog within the iframe use: $(parent.document).find('.ui-dialog'); window.parent.$('#dialogIDname').dialog('close');Saturday, February 23, 2013
Recently I completed a project where I had to show a panel to the left side using JQuery,
on mouse hover it comes out and on mouse leave it goes back. Its seems
to be easy but to maintain the functionality is not that easy.
Here’s a small snippet on how to do it.
HTML
JQuery
jQuery(function($) { $(document).ready(function() { $('#panelHandle').hover(function() { $('#sidePanel').stop(true, false).animate({ 'left': '0px' }, 900); }, function() { jQuery.noConflict(); }); jQuery('#sidePanel').hover(function() { // Do nothing }, function() { jQuery.noConflict(); jQuery('#sidePanel').animate({ left: '-201px' }, 800); }); }); });
demo here http://jsfiddle.net/nirajmchauhan/GPdFk/
Labels: Javascript, jquery
Open command prompts and run these commands one by one on command prompt
- cd /d C:\Windows\Microsoft.NET\Framework\v4.0.30319
- iisreset /stop
- aspnet_regiis -i
- iisreset /start
- %systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'].allowed:True
- %systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'].allowed:True
In this post, I will show you how to get the QueryString variable value using jQuery. I have created a function which returns value of any querystring variable.
//Code Starts function GetQueryStringParams(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (var i = 0; i < sURLVariables.length; i++) { var sParameterName = sURLVariables[i].split('='); if (sParameterName[0] == sParam) { return sParameterName[1]; } } } //Code Ends
And this is how you can use this function assuming the URL is, "http://phattrienweb.com/?technology=jquery&blog=jquerybyexample".
// var tech = GetQueryStringParams('technology'); var blog = GetQueryStringParams('blog'); //
OR....
// Read a page's GET URL variables and return them as an associative array. function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; }
var first = getUrlVars()["qid"];
http://phattrienweb.com/
Monday, March 26, 2012
Installing SMTP Server Feature on Windows 2008 is an easy process requiring only few steps to complete. On this article we will describe a step by step configuration and installation of the SMTP Server feature and how to enable the smtp to relay from local server.
Step 1:
Opening Server Manager Console and under Features select Add Features
Step 2:
Selecting SMTP Server option
Step 3:
Click on Install wait until finish and click close
Step 4:
Waiting for installation to finish and clicking on Close
Step 5:
Opening IIS 6.0 Manager under Administrative Tools -> Internet Information Services 6.0
Step 6:
Under [SMTP Virtual Server] second mouse click and properties
Step 7:
Select Relay under Access Tab
Step 8:
Select Only the list below and click on Add button
Step 9:
Enter IP Address 127.0.0.1 for relay
Step 10:
Sending a manual email through telnet to confirm everything working successfully. Telnet localhost 25 or telnet yourpublicip 25 and make sure you open the specific port on your firewall to be available to public.
http://www.itsolutionskb.com/2008/11/installing-and-configuring-windows-server-2008-smtp-server/
Labels: Server
Wednesday, October 26, 2011
Huong dan lap trinh Android(Tieng Viet) 1. Gioi thieu ve Android SDK
0 comments Posted by Duc Nguyen at 6:14 AMHuong dan lap trinh Android : 1. Gioi thieu ve Android SDK
Huong dan lap trinh Android : 2. Android Helloword
Huong dan lap trinh Android : 3. thiet ke giao dien ung dung android
Huong dan lap trinh Android : 4. Activity trong Android
Huong dan lap trinh Android : 5. BroadcastReceiver
Huong dan lap trinh Android : 6. Service trong Android
Huong dan lap trinh Android : 7. Xu ly bat dong bo trong Android
Giới thiệu về Android SDK
1. Cài đặt Android SDK
- Bạn có thể xem hướng dẫn cài đặt gốc tại đây http://developer.android.com/sdk/installing.html
- Hoặc có thể coi bản rút gọn tiếng Việt ở các slide sau
- Cần có eclipse 3.5 (3.4 cũng được) http://www.eclipse.org/downloads/
- Vào link bên trên, down eclipse classic 3.5 về rồi giải nén, vậy là đã có thể dùng được eclipse rồi.
2. Cài đặt ADT plugin
Mở eclipse lên, bấm vào Help > Install new software.
Ở cái form hiện lên đó, bạn chọn Add…
Ở mục Name, nhập tên gì cũng được, ví dụ như ADT plugin
Ở mục Location, nhập vào link này: http://dl-ssl.google.com/android/eclipse/
Sau đó bấm OK, có cho chọn gì thì cứ chọn hết rồi bấm next hoài cho đến lúc xong.
3. Cài đặt Android SDK
- Tải Android SDK tại link này http://developer.android.com/sdk/index.html (nhớ chú ý là nó chia ra Window, Mac và Linux nhé)
Mở Eclipse -> window -> preferences -> Android -> trong mục SDK location chọn Browse - đưa đường dẫn đến thư mục SDK -> bấm apply.
- Eclipse -> window -> Android SDK and AVD manager -> Available packages -> chọn hết và cài hết (hơi lâu một chút) hoặc bạn có thể chỉ chọn mấy cái liên quan đến Android 1.6 thôi cũng được (API level 4) vì khóa học này sẽ dùng SDK 1.6 đang thông dụng nhất nhé các bạn.
- Sau khi xong thì bấm vào Installed packages sẽ thấy thế này
4. Tạo một điện thoại ảo (AVD)
- Eclipse -> window -> Android SDK and AVD manager -> ở cái cửa sổ mới đó, chọn mục Virtual devices -> bấm nút New…
Mục Name: đặt tên gì cũng được, cốt là dễ nhớ và phân biệt nó đang là 1.6
Mục target: chọn anh nào có API level 4 là ok
Sdcard size: bạn gõ vào 256 (hoặc hơn thì tùy bạn)
Sau đó bấm Create AVD, thế là xong
5. Hello world
Xem link gốc tại đây hoặc đợi slide sau để xem bản tiếng Việt. http://
http://develope...llo-world.html
1. lap trinh mobile lap trinh android lap trinh iphonelap trinh j2me lap trinh symbianlap trinh windows mobileebook mobile - giao trinh lap trinh mobileebook j2me - giao trinh lap trinh j2me - Source code J2ME - Mã nguồn J2MEebook iphone - giao trinh lap trinh iphone - Source Code Iphone- Mã nguồn Iphone
ebook symbian - giao trinh symbian - Source Co Symbian- Mã nguồn Symbian
2. lap trinh mobile lap trinh android lap trinh iphone lap trinh j2me lap trinh symbian lap trinh win mobile
3. lap trinh mobile lap trinh android lap trinh iphonelap trinh j2me lap trinh symbianlap trinh windows mobile
ebook mobile - giao trinh lap trinh mobile
ebook j2me - giao trinh lap trinh j2me - Source code J2ME - Mã nguồn J2ME
ebook iphone - giao trinh lap trinh iphone - Source Code Iphone- Mã nguồn Iphone
ebook symbian - giao trinh symbian - Source Co Symbian- Mã nguồn Symbian
---------- Bài thêm lúc 15:24 ---------- Bài trước là lúc 15:01 ----------
Huong dan lap trinh Android : 1. Gioi thieu ve Android SDK
Huong dan lap trinh Android : 2. Android Helloword
Huong dan lap trinh Android : 3. thiet ke giao dien ung dung android
Huong dan lap trinh Android : 4. Activity trong Android
Huong dan lap trinh Android : 5. BroadcastReceiver
Huong dan lap trinh Android : 6. Service trong Android
Huong dan lap trinh Android : 7. Xu ly bat dong bo trong Android
Bắt đầu với Hello World
1. Tạo một project mới
- Ở màn hình eclipse, bấm File -> New -> Project -> Android -> Android Project -> Next
- Ở màn hình kế nhập liệu vào các ô như sau:
- Project name: HelloWorld (tên project hiển trị trên eclipse cũng sẽ là thư mục chứ ứng dụng trong workspace)
- Application name: Hello World (tên ứng dụng sẽ hiện thị trên điện thoại)
- Package name: org.multiuni.android.hellowrold (tên của package sẽ chứa source code, tương tự trong java http://en.wikipedia.org/wiki/Java_pa...ng_conventions)
- Create activity: HelloWorldActivity (tạo một lớp con của lớp Activity, dùng để hiển thị một màn hình ở đây là màn hình HelloWorld của chúng ta)
- Min SDK version: 4 (tức SDK 1.6, ở đây chúng ta khai báo là ứng dụng này có thể đáp ứng được phiên bản SDK cũ nhất là phiên bản nào)
- Sau khi hoàn tất bấm Finish, project mới đã được tạo.
2. Cấu trúc một project
- Thư mục src chứa source code ứng dụng. Gồm các package và các class.
- Thư mục gen chứa các file tự động phát sinh (mà thường gặp nhất là R.class)
- Thư mục res để chứa các resource dùng trong ứng dụng (thông qua ID)
- Thư mục assets chứa các resource file mà ứng dụng cần dùng (dưới dạng file)
- File Manifest là file khai báo thông tin về ứng với hệ thống (như ứng dụng gồm những màn hình nào, có service nào… xin các quyền gì, phiên bản bao nhiêu, dùng từ SDK phiên bản nào…)
- Ngoài ra còn có file thư viện.
3.Chạy ứng dụng Hello World
- Với ứng dụng vừa tạo nếu có báo lỗi thì bạn sửa lại thông số cho ứng dụng như sau: bấm chuột phải vào project à Properties à Java compiler à Compiler compliance settings: 1.6
- Bấm Ctrl + F11 để chạy ứng dụng, sẽ hiện lên emulator
4. Tạo UI trực tiếp từ code
Code ban đầu của ứng dụng:
HTML Code:
public class HelloWorldActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Sửa lại như bên dưới rồi chạy lại (nếu thấy báo lỗi thiếu thư viện, thử bấm Ctrl + Shift + O)
HTML Code:
public class HelloAndroid extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText("Hello, Android");
setContentView(tv);
}
}
5. Thử xử lý sự kiện
Ở code bên trên, đổi TextView lại thành Button.
Button bt = new Button(this);
Sau đó, implement phương thức xử lý sự kiện khi user click vào nút này
HTML Code:
bt.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(),
"Hello World", Toast.LENGTH_LONG).show();
}
});
6. Một số phím tắt
Để import các thư viện còn thiếu bấm Ctrl + Shift + O
Để xóa một dòng code bấm Ctrl + D
Để hiển thị bảng suggestion bấm Ctrl + Space
Để comment một dòng code Ctrl + /
7. Thử một chút về xoay màn hình
- Các bạn tạo 1 project mới tên là Orientaion.
- Sau đó, bấm phải chuột vào thư mục res -> new -> Folder -> nhập tên folder là layout-land (nhớ nhập chính xác nhé).
- Trong thư mục layout ban đầu có file main.xml, các bạn copy file đó, cho vào thư mục layout-land nhé, vậy là mỗi thư mục đều có một file main.xml
- Ở mỗi file main trong 2 thư mục đó, đều có đoạn này:
HTML Code:
android:layout_height="wrap_content"
android:text=“@string/hello"
/>
- Các bạn sửa cái nội dung android:text trong đoạn xml đó lại, để cho 2 file main đó có 2 nội dung text khác nhau là được.
- Chạy chương trình, sau khi màn hình hiển thị, các bạn bấm Ctrl + F11 (Ctrl bên trái nhé) thử xem kết quả nhé.
Labels: Android
Để lập trình ứng dụng cho Android, bạn cần phải cài đặt các phần mềm cần thiết sau:
Các yêu cầu chuẩn bị cài đặt:
Các yêu cầu hệ thống (máy tính) để lập trình ứng dụng:
+ Hệ điều hành:
– Windows : XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit).
– Mac OS X 10.5.8 hoặc cao hơn (x86 only)
– Linux (đã test trên Linux Ubuntu Hardy Heron), nếu dùng phiên bản 64bit thì phải hỗ trợ ứng dụng chạy 32bit, tham khảo chi tiết tại Ubuntu Linux installation notes.
+ Môi trường lập trình (IDEs)
– Eclipse IDE: có thể sử dụng bản Eclipse 3.4 (Ganymede) or 3.5 (Galileo) download tại http://www.eclipse.org/downloads/.
Android SDK (Software Development Kit) – đây là bộ Kit dùng để phát triển ứng dụng cho Android, bạn có thể download phiên bản mới nhất tại Android SDK, có các phiên bản khác nhau dành cho cac hệ điều hành khác nhau.
ADT Plugin for Eclipse: Đây là plugin cho Eclipse để phát triển ứng dụng android. Download phiên bản mới nhất tại địa chỉ http://developer.android.com/sdk/eclipse-adt.html
Các bước cài đặt:
Sau khi download các phần mềm cần thiết, tiến hành các bước cài đặt như sau:
Cài đặt eclipse: Giải nén file eclipse vừa download về, vào thư mục eclipse->chạy file eclipse.exe (đối với windows và eclipse.dmg đối với mac os) có thể tạo shortcut ngoài desktop để dễ khởi động eclipse lần sau.
Cài đặt ADT Plugin for Eclipse:
+ Cài offline (không có internet): Giải nén file ADT vừa download về, vào thư mục ADT , copy tất cả file trong thư mục plugins rồi paste vào thư mục plugins của eclipse (Eclipse->Plugins).
+ Cài online (có internet): để cập nhật ADT bản mới nhất
– Windows:
—-1. Khởi động eclipse,
—-2. Chọn menu Help->Install New Software…
—-3. Sau khi hiển thị cửa sổ Install, tại trường Work with, nhấn nút Add, hiển thị cửa sổ Add Repository.
—-4. Tại cửa sổ Add Repository, tại Name gõ: ADT; tại Location chọn Archive và Browse đến file ADT.zip vừa download về (không giải nén nhé). Click OK. Nếu không có file ADT.zip thì có thể gõ địa chỉ này tại Location: http://dl-ssl.google.com/android/eclipse/ và chọn OK để cài online.
—-5. Trở lại cửa sổ Install, chọn như hình bên dưới:
-6. Chọn Next để cập nhật ADT, sau khi cập nhật xong là Finish.
- Mac OS: hướng dẫn sau.
Cấu hình android SDK:
Sau khi hoàn tất các bước trên, tiến hành các bước config android SDK.
+ Đối với windows:
—-1. Giải nén file android-sdk-windows.zip.
—-2. Khởi động eclipse, chọn menu Window -> Preferences ->Chọn Android.
—-3. Tại SDK Location, Browse… đến thư mục android-sdk-windows đã giải nén. Chọn Apply, nếu hiển thị list danh sách các target là đã thành công, chọn OK.
Hoàn tất và demo emulator
Sau khi cài đặt xong, bây giờ trên menu toolbar của eclipse xuất hiện thêm 1 icon SDK Manager
+ Tạo AVD để chạy giả lập
—-1. Click vào icon như hình trên để tạo 1 ADV (tức điện thoại android giả lập để chạy ứng dụng).
—-2. Tại cửa sổ SDK Manager, chọn Vitural Device và chọn New
Còn tiếp
Labels: Android