Friday, November 1, 2013

Một ví dụ nhỏ cho - mã hóa mật khẩu bằng giải thuật md5

Chào các bạn trong quá trình thực hiện đồ án java desktop application tôi đã nhận khá nhiều câu hỏi của các bạn về các mã hóa mật khẩu trong hệ thống phần mềm của các bạn. Để các bạn có thể tham khảo tôi viết lại thành 1 ví dụ đơn giản bao gồm thêm dữ liệu (đăng ký) có mã hóa mật khẩu và so sánh dữ liệu đã mã hóa (login) bằng giải thuật md5.

Bảng dữ liệu đơn giản Users(username,password,gender)

Giao diện thêm dữ liệu
register

Giao diện so sánh dữ liệu
login

Code mã hóa chuỗi theo giải thuật md5
[sourcecode language="java"]
public static String md5(String msg) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(msg.getBytes());
byte byteData[] = md.digest();
//convert the byte to hex format method 1
StringBuffer sb = new StringBuffer();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
} catch (Exception ex) {
return "";
}
}
[/sourcecode]

Khi nhấn vào nút add
[sourcecode language="java"]
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn;
conn = DriverManager.getConnection("jdbc:sqlserver://ntdan-lt;user=sa;password=Admin@123;database=Northwind;");
PreparedStatement command = conn.prepareStatement("Insert into Users(username, password,gender) values(?,?,?)");
command.setString(1, txtUser.getText());
command.setString(2, MDI_Java_md5.md5(txtPass.getText()));
command.setInt(3, rdMale.isSelected() == true ? 1 : 0);
command.executeUpdate();

JOptionPane.showMessageDialog(this, "Register OK !");
this.setVisible(false);

} catch (Exception ex) {
Logger.getLogger(FrmAdd.class.getName()).log(Level.SEVERE, null, ex);
}
}
[/sourcecode]
Khi nhấn vào nút login
[sourcecode language="java"]
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn;
conn = DriverManager.getConnection("jdbc:sqlserver://ntdan-lt;user=sa;password=Admin@123;database=Northwind;");
PreparedStatement command = conn.prepareStatement("Select * from Users where username=? and password = ?");
command.setString(1, txtUser.getText());
command.setString(2, MDI_Java_md5.md5(txtPass.getText()));
ResultSet rs = command.executeQuery();

if (rs.next()) {
JOptionPane.showMessageDialog(this, "Login OK !");
this.setVisible(false);
} else {
JOptionPane.showMessageDialog(this, "Login fail !");
}

} catch (Exception ex) {
Logger.getLogger(FrmAdd.class.getName()).log(Level.SEVERE, null, ex);
}
}
[/sourcecode]
chúc các bạn thành công.

Thursday, October 31, 2013

Java server face (JSF) - trang đa ngôn ngữ

OBJECTIVES

  1. -Create jsf web page support multi language interface

  2. -Using Face component Event

  3. -Setting current Locale and Global Locale


Hints:

  1. Create JSF web site

  2. Create 03 jsp page and configure navigation rule for them from properties file support two language Vietnam and English

  3. Setting current Locale and Global Locale at runtime and design time


Create JSF website



  • Create 03 jsp file: index.jsp, add.jsp, list.jsp

  • Open Face-config.xml, design navigation rule as figure 01 and insert new code as code 01


page-flow


[sourcecode language="xml"]
<application>
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<resource-bundle>
<var>bundle</var>
<base-name>code.guiMessage</base-name>
</resource-bundle>
<locale-config>
<default-locale>vi</default-locale>
</locale-config>
</application>
[/sourcecode]

Code 01: Register bundle file


Create properties file



  • Name: guiMessage in side package code

  • Add two Locale vi_VN and en_US

  • Rename file as figure 02


bundle

Right click o guiMessage file select open and insert some key as figure 03

properties

Create manage bean



  • Language in code package

  • Modified code as



[sourcecode language="java"]
package code;

import java.util.Locale;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

public class language {

public String getLang() {
return lang;
}

public void setLang(String lang) {
this.lang = lang;
}
String lang = &amp;amp;quot;vi&amp;amp;quot;;

/**
* Creates a new instance of language
*/
public language() {
}

public void change(ValueChangeEvent event) {
lang = event.getNewValue().toString();
FacesContext.getCurrentInstance().getApplication().setDefaultLocale(new Locale(lang));
FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale(lang));
}
}
[/sourcecode]

This code allow we setting Local and Global Locale of websie

Open index.jsp


Modified as figure 03 (using EL language: after bundle. Using Ctrl+Space bar for virtual code)

index

Index.jsp with two language

index1

Add Add.jsp page

add

[sourcecode language="html"]
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<f:view>
<h:form>
<table>
<tr>
<td align="center" colspan="2">
<h1><h:outputText value="#{bundle.register}"/></h1>
<h4><h:commandLink value="#{bundle.home}" action="home"/></h4>
<h:messages layout="table"/>
</td>
</tr>
<tr>
<td>
<h:outputText>
<f:attribute name="value" value="#{bundle.id}"/>
</h:outputText>
</td>
<td>
<h:inputText value="#{Customer.customerID}">

</h:inputText>
</td>
</tr>
<tr>
<td><h:outputText value="#{bundle.CompanyName}"/></td>
<td><h:inputText value="#{Customer.companyName}"/></td>
</tr>
<tr>
<td><h:outputText value="#{bundle.Address}"/></td>
<td><h:inputText value="#{Customer.address}"/></td>
</tr>
<tr>
<td></td> <td><h:commandButton value="#{bundle.register}" action="list"
actionListener="#{Customer.AddNew}"/></td>
</tr>
</table>
</h:form>
</f:view>
[/sourcecode]

Đổi không khí học winform C# - Sử dụng timer control viết game click to win

Bắt đâu: Giao diện game

Game

Click các số 0 cho đến khi chúng mất hêt

win

Vậy là thắng rồi :D (chỉ để đổi không khí học một tí nhe các bạn)

Source nguồn đây.

Friday, October 11, 2013

Xây dựng và sử dụng WCF đơn giản (WCF basic demo for student)

Objectives

1. Create WCF service (host on web server )

2. Using WCF service from window form application

Hits: Step for create and using service
  • Create WCF service “Student” with two operations “list()” and “detail(id)”
    1. Define service interface (ServiceContract)
    2. Define class describe detail of student (DataContract)
    3. Define Service by implement from server interface
  • Using WCF service from window form application
    1. Find service description of WCF “student”
    2. Reference WCF service
    3. Call operations of student service

Student table

No. Data field Data type
1. S_ID Int
2. S_FullName Text
3. S_Birthdate DateTime
4. S_Address Text

WCF basic demo 2013 (PDF version of this post)

http://www.mediafire.com/?ji9uiz5l70d8n (Source code of this post)

BEGIN

Open visual studio 2008 (or later)

File -> Create Project

clip_image002

Select as figure

Right click on project -> Add new Item

clip_image004

Select as figure

Right click on project -> Add new Item

clip_image006

Select as figure

Modified class as

1 namespace students
2 {
3 [DataContract]
4 public class StudentDetail
5 {
6 [DataMember]
7 public int ID;
8 [DataMember]
9 public string FullName;
10 [DataMember]
11 public DateTime Birthdate;
12 [DataMember]
13 public string Address;
14 }
15 }
16
17 Modified IStudent interface as
18
19 namespace students
20 {
21 [ServiceContract]
22 public interface IStudent
23 {
24 [OperationContract]
25 DataSet List();
26 [OperationContract]
27 StudentDetail Detail(int ID);
28 }
29 }

Edit Student service as


clip_image002[4]



1 namespace students
2 {
3 public class Student : IStudent
4 {
5 public DataSet List()
6 {
7 DataSet dsS = new DataSet();
8 // insert C# code to get data from student table
9 return dsS;
10 }
11 public StudentDetail Detail(int ID)
12 {
13 StudentDetail sDetail = new StudentDetail();
14 return sDetail;
15 }
16 }
17 }
18
Now right click on service and select view in browser


clip_image005


Right click on solution -> add new project


clip_image007


Select as figure


Design form as


clip_image010


GUI of client


Add service reference as


clip_image012


Modify form load event:


1 wcf.StudentClient proxy;
2 private void Form1_Load(object sender, EventArgs e)
3 {
4 proxy = new WCF_Client.wcf.StudentClient();
5 }

Double click on button Find and insert code as


1 private void btnFind_Click(object sender, EventArgs e)
2 {
3 wcf.StudentDetail detail = proxy.Detail(Convert.ToInt32(txtID.Text));
4 MessageBox.Show("Student id: " + detail.ID + "\nStudent fullname: " + detail.FullName);
5 }
6

Double click on button List and insert code as


1 private void btnList_Click(object sender, EventArgs e)
2 {
3 dgrStudent.DataSource = proxy.List();
4 dgrStudent.DataMember = "student";
5 }

Now run client


clip_image014


Client at runtime








Xem hướng dẫn video trên


Mã nguồn:  http://www.mediafire.com/download/f4l6dpz2wla513w/WebApplication1.rar

Wednesday, October 9, 2013

Very simple.net web service exception handling


  1. Create header exception

  2. Assign header  for special web method

  3. Exception handling at client: SoapException and SoapHeaderException



Header definition
[sourcecode language="csharp"]
public class WSHeader: SoapHeader
{
public WSHeader()
{

}
private DateTime _CallTime;
public DateTime CallTime
{
get { return _CallTime; }
set { _CallTime = value; }
}
}
[/sourcecode]

Webservice difinition and header assignment
[sourcecode language="csharp"]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class TimingService : System.Web.Services.WebService
{
public WSHeader DiscountHeader;
public TimingService()
{

//Uncomment the following line if using designed components
//InitializeComponent();
}

[WebMethod]
[SoapHeader("DiscountHeader", Direction = SoapHeaderDirection.In)]
public double Discount(DateTime birthdate)
{
if (DiscountHeader == null)
throw new SoapHeaderException("User invalid", SoapException.ClientFaultCode);
else if (birthdate > DateTime.Now)
{
throw new SoapException("Birthdate invalid", SoapException.ClientFaultCode);
}
else
{
if (DateTime.Now.Year - birthdate.Year < 18)
return 0.1;
else
return 0.0;
}
}
}
[/sourcecode]

Call method from client
[sourcecode language="csharp"]
namespace Client
{
class Program
{
static void Main(string[] args)
{
try
{
WS.WSHeader header = new Client.WS.WSHeader();
header.CallTime = DateTime.Now.AddDays(-1);

WS.TimingService client = new Client.WS.TimingService();

client.WSHeaderValue = header;

Console.WriteLine("Discount per: "+ client.Discount(new DateTime(2013, 1, 1))*100 + "%");
}
catch (SoapHeaderException ex)
{
Console.WriteLine("Header error: " + ex.Message);
}
catch(SoapException ex)
{
Console.WriteLine("Call error: " + ex.Message);
}
}
}
}
[/sourcecode]

Friday, October 4, 2013

Lab – JSP - custom tag

Objectives


1. Create custom tag: Basis, Iteration and Complex tag


- Implement Interface
- Extend from Build in class

2. Using custom tag in JSP pages


Hits: Steps to create and call custom tag
1. Describe tag structure (Tag Library Description)
2. Process tag (Tag handler)
3. Register and call custom tag on JSP pages (<%@taglib ......%>

Custom tag 2013 (pdf version)


Source code

Create custom tag


1. Empty tag: header tag, footer tag
2. If – then – else tag
3. Iteration tag: loop tag
4. Employee list tag

HEADER tag (Implement Tag interface)


Create Tag Library Descriptor (customTag.tlb) file and insert xml section below
<tag>
<name>header</name>
<tag-class>MySource.header</tag-class>
<body-content>empty</body-content>
<attribute>
<name>companyname</name>
<required>true</required>
</attribute>
</tag>
Create tag handler
Create java class (header.java) in MySource package implement Tag interface
clip_image002
package MySource;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.Tag;
public class header implements Tag{
String companyname ="";
public void setCompanyname(String companyname) {
this.companyname = companyname;
}

PageContext context;
Tag parrent;
public void setPageContext(PageContext pc) {
context = pc;
}

public void setParent(Tag t) {
parrent = t;
}

public Tag getParent() {
return parrent;
}

public int doStartTag() throws JspException {
try {
context.getOut().print("<h1>"+companyname+"</h1>");
context.getOut().print("<h3>Education Department</h3>");
} catch (IOException ex) {
Logger.getLogger(header.class.getName()).log(Level.SEVERE, null, ex);
}

return SKIP_BODY;
}

public int doEndTag() throws JspException {
return SKIP_BODY;
}

public void release() {
}

}

Call header from jsp page


Create jsp page (home.jsp), using taglib tag register header tag
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@taglib prefix="my" uri="/WEB-INF/MyLib.tld" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Home</title>
</head>
<body>
<my:header companyname="Can Tho University Software Center (CUSC)"/>
</body>
</html>

Now build and run home.jsp page


clip_image004

Home.jsp

FOOTER tag (extend from Simple Tag Support class)


Create Tag Handler (footer.java)
clip_image006
Select Tag Handler from netbean template
clip_image008
Provide tag name as footer and click next
clip_image010
Click Browse to select tld file, click New to add companyname attribute as figure

Modified home.jsp as below


<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@taglib prefix="my" uri="/WEB-INF/MyLib.tld" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Home</title>
</head>
<body>
<my:header companyname="Can Tho University Software Center (CUSC)"/>
<my:footer companyname="Can Tho University Software Center (CUSC)"/>
</body>
</html>

Now build and run home.jsp page


clip_image012
Home.jsp

Loop tag


Create Tag Handler (loop.java) extend from Simple Body Tag Support, with 2 attribute start and end
clip_image014
clip_image016

Modified writeTagBodyContent as below

private void writeTagBodyContent(JspWriter out, BodyContent bodyContent) throws IOException {
if(start < end)
{
out.print("<ol>");
while(start < end)
{
out.print("<li>");
bodyContent.writeOut(out);
out.print("</li>");
start++;
}

out.print("</ol>");
}
bodyContent.clearBody();
}

Modified home.jsp as below
<%@page contentType="text/html" pageEncoding="windows-1252"%>
<%@taglib prefix="my" uri="/WEB-INF/MyLib.tld" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Home</title>
</head>
<body>
<my:header companyname="Can Tho University Software Center (CUSC)"/>
<hr/>
<my:loop start="0" end="10">
<%= new java.util.Date()%>
</my:loop>
<my:footer companyname="Can Tho University Software Center (CUSC)"/>
</body>
</html>

Now build and run home.jsp page


clip_image018

Employee list tag


Create Tag Handler (employee.java) extend from Simple Body Tag Support (same above)
Modified employee.java as:
private void writeTagBodyContent(JspWriter out, BodyContent bodyContent) throws IOException {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn;
conn = DriverManager.getConnection("jdbc:sqlserver://ntdan-lt;user=sa;password=Admin@123;database=NorthWind;");
PreparedStatement command = conn.prepareStatement(bodyContent.getString());
java.sql.ResultSet result = command.executeQuery();
ResultSetMetaData meta = result.getMetaData();
out.print("<table border='1px'>");
out.print("<tr bgcolor='#ACE768'>");
int count = 1;
while(count <= meta.getColumnCount()) {
out.print("<td>"+meta.getColumnName(count)+"</td>");
count++;
}

out.print("</tr>");
while(result.next()) {
count=1;
out.print("<tr>");
while(count <= meta.getColumnCount()) {
out.print("<td>"+result.getString(meta.getColumnName(count))+"</td>");
count++;
}
out.print("</tr>");
}
out.print("</table>");
conn.close();
} catch(Exception ex) {
out.print(ex.toString());
}
bodyContent.clearBody();
}

Open home.jsp, insert code as

<body>
<my:header companyname="Can Tho University Software Center (CUSC)"/>
<hr/>
<my:loop start="0" end="2">
<%= new java.util.Date()%>
</my:loop>
<my:employee>Select Top 5 EmployeeID, FirstName, LastName From Employees</my:employee>
<my:footer companyname="Can Tho University Software Center (CUSC)"/>
</body>

Now build and run home.jsp page


clip_image020

Friday, September 6, 2013

Upload hình ảnh trong jsp

Do một số bạn thường hỏi vấn đề upload tài nguyên trong jsp (chủ yếu lúc làm đồ án) nên tổi để hướng dẫn ở đây để các bạn theo dõi.

Giao diện chọn ảnh

upload

[sourcecode language="html"]
<form name="uploadForm" action="upload.jsp" enctype="multipart/form-data" method="post">
<input type="file" name="file"/>
<input TYPE=Button name='Upload' Value='Upload' onClick="uploadForm.Upload.value='Uploading...';document.uploadForm.action='upload.jsp';document.uploadForm.submit()">
</form>
[/sourcecode]

Kết quả sau khi upload
upload1

[sourcecode language="html"]
<%
response.setContentType("text/html");
response.setHeader("Cache-control","no-cache");

String err = "";
String fileOutPath = request.getRealPath("/").replace('\\','/');
String lastFileName = "";

String contentType = request.getContentType();
String boundary = "";
final int BOUNDARY_WORD_SIZE = "boundary=".length();
if(contentType == null || !contentType.startsWith("multipart/form-data")) {
err = "Ilegal ENCTYPE : must be multipart/form-data\n";
err += "ENCTYPE set = " + contentType;
}else{
boundary = contentType.substring(contentType.indexOf("boundary=") + BOUNDARY_WORD_SIZE);
boundary = "--" + boundary;
try {
javax.servlet.ServletInputStream sis = request.getInputStream();
byte[] b = new byte[1024];
int x=0;
int state=0;
String name=null,fileName=null,contentType2=null;
java.io.FileOutputStream buffer = null;
while((x=sis.readLine(b,0,1024))>-1) {
String s = new String(b,0,x);
if(s.startsWith(boundary)) {
state = 0;
//out.println("name="+name+"<br>");
//out.println(fileName+"<br>");

name = null;
contentType2 = null;
fileName = null;


}else if(s.startsWith("Content-Disposition") && state==0) {
state = 1;
if(s.indexOf("filename=") == -1)
name = s.substring(s.indexOf("name=") + "name=".length(),s.length()-2);
else {
name = s.substring(s.indexOf("name=") + "name=".length(),s.lastIndexOf(";"));
fileName = s.substring(s.indexOf("filename=") + "filename=".length(),s.length()-2);
if(fileName.equals("\"\"")) {
fileName = null;
}else {
String userAgent = request.getHeader("User-Agent");
String userSeparator="/"; // default
if (userAgent.indexOf("Windows")!=-1)
userSeparator="\\";
if (userAgent.indexOf("Linux")!=-1)
userSeparator="/";
fileName = fileName.substring(fileName.lastIndexOf(userSeparator)+1,fileName.length()-1);
if(fileName.startsWith( "\""))
fileName = fileName.substring( 1);
}
}
name = name.substring(1,name.length()-1);
if (name.equals("file")) {
if (buffer!=null)
buffer.close();
lastFileName = fileName;
buffer = new java.io.FileOutputStream(fileOutPath+fileName);
}
}else if(s.startsWith("Content-Type") && state==1) {
state = 2;
contentType2 = s.substring(s.indexOf(":")+2,s.length()-2);
}else if(s.equals("\r\n") && state != 3) {
state = 3;
}else {
if (name.equals("file"))
buffer.write(b,0,x);
}
}
sis.close();
buffer.close();
}catch(java.io.IOException e) {
err = e.toString();
}
}
boolean ok = err.equals("");
if(!ok) {
out.println(err);
}else{
%>
<SCRIPT language="javascript">
//history.back(1)
alert('Uploaded <%=lastFileName%>');
//window.location.reload(false)
</SCRIPT>
<%
}
%>
<img src="<% out.print(request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/"+lastFileName);%>
" width="200px" alt="imgeas"/>
[/sourcecode]

Đây chỉ là ví dự đơn giản nhất để các bạn nghiên cứu thêm.

Thursday, August 29, 2013

Kỹ thuật SEO hiệu quả nhất

Những kỹ thuật SEO tối ưu nhất năm 2012


Bài này tôi chủ yếu dành tặng cho các cá nhân và những doanh nghiệp đang tìm hiểu về SEO năm 2012. Riêng các Công ty SEO chuyên nghiệp ắt hẳn cũng đã nắm được phần nào các kỹ thuật này, tuy nhiên có khá nhiều điều mới mẻ ở đây nên các bạn cũng nên theo dõi.


Các bạn có thể dễ dàng tìm thấy các trang nói về kỹ thuật SEO, kiến thức SEO bằng cách search Google, nhưng đa số chúng đều là những tài liệu cũ và lỗi thời. Ở đây tôi sẽ đề cập đến 10 thủ thuật SEO giúp bạn thoát khỏi thuật toán Panda và Penguin.



Viết nội dung chất lượng và duy nhất
Nội dung chất lượng và duy nhất là vấn đề mấu chốt cơ bản trong SEO. Không có nội dung hay và độc nhất thì website cũng như là tiếng sáo trong cơn gió. Bạn hãy viết sao cho người đọc muốn chia sẻ nội dung của bạn với mọi người.


Thường xuyên publish nội dung mới

Một website không hề thay đổi về nội dung cả tháng trời thì cũng như một website chết đối với Google và cả khách hàng. Nếu website của bạn thường có nội dung mới bạn sẽ tạo thói quen cho khách hàng thường xuyên ghé thăm trang web của bạn và chắn chắn rằng các bộ máy tìm kiếm cũng tham quan website của bạn một cách đều đặn.


Mỗi trang trên website nên có 1 cụm từ khóa riêng biệt

Ở mỗi trang con trên website bạn nên tập trung vào 1 cụm từ khóa gồm 5 từ, nó có thể là 1 sản phẩm hay 1 dịch vụ liên quan đến từ khóa chính của website.

Ví dụ từ khóa chính của website bạn là “Nước hoa” thì bạn sẽ có những cụm từ cần quan tâm như “Nước hoa dành cho nữ”, “Nước hoa dành cho nam”, “Nước hoa hàng hiệu”,…

Chú ý: Phải xác định cụm từ mục tiêu của mình trước khi viết nội dung cho nó. Khi viết nội dung bạn hãy chèn các cụm từ khóa này thật tự nhiên và khéo léo, tuyệt đối không nhồi nhét gây cảm giác khó chịu cho người đọc lẫn bộ máy tìm kiếm. Bạn có thể tham khảo bài viết Nghệ thuật nghiên cứu từ khóa ở đây.


Làm cho website của bạn thật hữu ích, dễ sử dụng với khách hàng

Bạn phải bảo đảm rằng những nội dung trên website thật dễ hiểu và hữu ích với khách hàng. Ngôn ngữ lập trình website phải đúng tiêu chuẩn trên tất cả trình duyệt. Hãy làm mọi thứ để bộ máy tìm kiếm dễ dàng tìm thấy và index nội dung trên trang web của bạn.


Viết tiêu đề và mô tả trang lôi cuốn

Mỗi trang trên website phải có tiêu đề và mô tả riêng biệt. Khi bạn viết hay sẽ làm gia tăng tỉ lệ click chuột vào trang web của bạn, từ đó thu hút thêm nhiều khách hàng tiềm năng.


Chèn cụm từ khóa vào URL

Tập trung vào một từ khóa hay một cụm từ khóa là điều cần thiết, nó làm công cụ tìm kiếm biết đâu là chủ đề chính của website. Ngoài tiêu đề trang và nội dung, bạn cũng nên đặt cụm từ khóa mục tiêu vào địa chỉ URL, nó giúp bộ máy tìm kiếm hiểu website của bạn đang nói về vấn gì.


Sử dụng microformat cho những vùng liên quan.

Định dạng microformat là một phương pháp giúp xác định một loại thông tin cụ thể, như địa chỉ doanh nghiệp, bài viết, sự kiện, hoặc thông tin cá nhân. Microformat chỉ có vài định dạng trọng yếu, và một trong những định dạng Bing và Google thường sử dụng chính là Schema.org (http://schema.org/), bạn có thể kiểm tra xem Goole trông thấy định dạng nào bạn áp dụng cho trang web bằng cách sử dụng công cụ thử nghiệm rich snippet (http://www.google.com/webmasters/tools/richsnippets).


Xây dựng liên kết

Bình luận blog và tham gia diễn đàn là cách tuyệt vời để có được liên kết và thu hút traffic (lưu lượng truy cập website). Nhưng điều hữu ích nhất nó mang đến là giúp xây dựng Thương hiệu và website của bạn như là 1 phần của cộng đồng. Đừng cô lập mình bằng cách không tìm kiếm và trao đổi kinh nghiệm cũng như liên kết với các website khác. Tạo được danh tiếng nghĩa là bạn sẽ có được sự tin tưởng từ người dùng lẫn bộ máy tìm kiếm. Hãy gia nhập cộng đồng và để lại những comment có tính xây dựng.


Tham gia mạng xã hội

Tham gia bằng cách sử dụng các phương tiện truyền thông xã hội có thể tốn thời gian nhưng nó thật sự rất có giá trị. Mạng xã hội không chỉ thu hút traffic mà nó còn tạo cho bạn danh tiếng trên bảng xếp hạng tìm kiếm và là bộ mặt của công ty bạn trước Khách hàng. Hãy nhớ tham gia mạng xã hội không phải là một sự lãng phí thời gian.


Đam mê

Hãy xây dựng trang web với niềm đam mê và không một công ty hay Dịch vụ SEO nào có thể truyền đạt niềm đam mê đó của bạn. Vì vậy, hãy tự viết nội dung cho trang web của mình. Hãy cho Khách hàng thấy niềm đam mê của bạn và làm họ yêu thích nó như chính bạn bằng sự trung thực của mình.


(Nguồn tham khảo internet)

Tuesday, August 27, 2013

Hello World, Basic Server/Client Example of WCF (Tham khảo cho các bạn LTV môn WCF)

Các bạn học lập trình viên Aptech có thể tham khảo thêm vài viết này (nguồn từ codeproject)

Hello World, Basic Server/Client Example of WCF

[caption width="400" align="aligncenter"]Hello World, Basic Server/Client Example of WCF Hello World, Basic Server/Client Example of WCF[/caption]

Và bài viết này Creating and Consuming a Simple WCF Service without using configuration files

Goodluck !

Friday, August 2, 2013

Subversion -hệ thống quản lý phiên bản SVN

Subversion(viết tắt là SVN) là một hệ thống quản lí version (version control system(VCS)) được giới thiệu vào năm 2000 bởi công ty CollabNet.



Kiến trúc cở bản của SVN.
Hệ thống SVN là một hệ thống quản lý tài nguyên của một dự án. Hệ thống có khả năng tự cập nhật, so sánh và kết hợp tài nguyên mới vào tài nguyên cũ.

  1. Hổ trợ nhóm làm việc trên cùng một project, việc nhiều người cùng chỉnh sửa nội dung của một file là điều không thể tránh khỏi. SVN cung cấp các chức năng để có thể thực hiện việc này một cách đơn giản và an toàn.

  2. Subversion là hệ thống quản lý source code tập trung (Centralized).

  3. Subversion quản lý tập tin và thư mục theo thời gian.

  4. Việc ghi log cụ thể chi tiết giúp ta quản lý quá trình phát triển dự án tốt hơn

  5. Điểm đặt biệt của SVN là nó lưu lại tất cả những gì thay đổi trên hệ thống file: file nào đã bị thay đổi lúc nào, thay đổi như thế nào, và ai đã thay đổi nó.

  6. —SVN cũng cho phép recover lại những version cũ một  cách chính xác.

  7. —Subversion hỗ trợ khá nhiều giao thức để kết nối giữa client và server.


Đối với các bạn làm eProject SVN là công cụ rất hữu ích để các bạn quản lsy mã nguồn của nhóm.

1. Sử dung server SVN google cung cấp để quản lý mã nguồn của nhóm: mỗi nhóm tạo một project trên http://code.google.com để quản lý mã nguồn dự án. Chọn subversion là SVN.

2. Sử dung plugin SVN (VisualSVN-3.5.1) và TortoiseSVN-1.8.1.24570-x64-svn-1.8.1 tích hợp mã nguồn vào Visual Studio, Netbean để tiến  hành phát triển.

Thời gian tới tôi sẽ hướng dẫn các bạn lớp lập trình viên tôi giữ laij và up hướng dẫn lên để các bạn tham khảo.

[youtube=http://youtu.be/e27yJJPWZFo]

Lay ve website

[youtube=http://youtu.be/5u1mFWWspy4]

Wednesday, July 3, 2013

Mô phỏng ngập do mưa ở TP Cần Thơ - Simulating flooding situation in Can Tho city by the influence of rainfall

Một vài ảnh demo mô phỏng ngập do mưa tại cần thơ


Mô hình hóa


Modelling



Phương pháp tìm hướng lan truyền

FlowReDetected



Hình chụp từ chương tình mô phỏng - GAMA Platform

Rain_2013103123



[youtube=http://youtu.be/669RzHY1QhQ]


*****************************

Just my study.

Monday, July 1, 2013

Caching Images in ASP.NET - Một bài viết rất hữu ích từ CodeProject các bạn tham khảo nhe

There are a lot of ways to improve performance in web applications. One of the simplest but most effective methods is to cache images on the client. In this article I would like to show how we implemented image caching for our website.

The Problem

When she was building the website http://www.software-architects.com she used a lot of images in the css style sheets to display background images for menu items. After transfering the files to our web server she tested how much traffic a request to our start page would produce with Microsoft Network Monitor. This is a Tool to allow capturing and protocol analysis of network traffic. You can download it from the Microsoft Download Center.

With Microsoft Network Monitor 3.1 she recorded a call to http://www.software-architects.com. As a result she got 20 requests to 20 different files to display one single page. Microsoft Network Monitor shows that appoximatly half of the requests are required for the menu images.

View detail on codeproject
http://www.codeproject.com/Articles/22888/Caching-Images-in-ASP-NET?display=Print

Wednesday, June 19, 2013

Wednesday, May 22, 2013

Web based: Draw tool + storage cloud => smart draw

Hi,

Today we discuss about http://draw.io to draw many skind of diagram and stored it to google drive

Open http://draw.io in Chrome
[caption id="attachment_1017" align="aligncenter" width="300"]Home page Home page[/caption]

Click on Connect to google drive at top-right
[caption id="attachment_1018" align="aligncenter" width="298"]Choice an user Choice an user[/caption]

You can draw new char/diagram or open an existing diagram in Google drive

Select File -> open
[caption id="attachment_1019" align="aligncenter" width="300"]Open file Open file[/caption]

Select and clich open
Diagram1

Export to different format: select file -> export
export

From google view
Drive

Ok, i think it enough for all simple used.

Monday, April 22, 2013

Một bài hướng dẫn khá hay về asp.net authentication

Các bạn tham khảo một bài hướng dẫn từ trang codeproject rất bổ ích cho các bạn lập trình viên asp.net.



ASP_Authentications

Tuesday, April 16, 2013

Cafe sáng

Ảnh

 

Cafe một mình sáng chủ nhật hàng tuần, tìm hướng đi mới, một lối tư duy mới !

Open my mind.

Monday, April 8, 2013

Công cụ vẽ lưu đồ trên nền web

Các bạn tham khảo trang nay nhé.

https://www.draw.io/

Tôi thấy khá hay hi vọng có ích cho các bạn

 

Friday, March 1, 2013

Nội dung một số buổi thực hành môn JSP chương trình lập trình viên

Các bạn tham khảo nhe

Buổi Lab 06 JSTL

Nội dung hướng dẫn sử dụng thư viện JSTL để truy vấn dữ liệu

Buổi 07: Internationalization
Các bạn download ở đây

Buổi 10: Create Dynamic custom tag and tag file in JSP


JSP Internationalization – Video hướng dẫn tạo trang web đa ngôn ngữc cơ bản bằng JSP

JSP Aptech All demo – Bài tập tổng hợp JSP i10

STL – set:datasource, sql:query, sql:update, sql:param, sql:transaction

Bài tập xây dựng một ứng dụng bán điện thoại đơn giản bằng jsp

Tạo và sử dụng Custom Tag trong JSP thông qua Tag interface


--------------------------------
Hi vọng có ích cho các bạn

Nội dung thực hành WFC# II - 02 lớp cao đẳng

Các bạn tham khảo nhé.

Link download CD lý thuyết Sử dụng phần mềm DAEMON Tools Lite để đọc nhe

Buổi 01: Transaction đơn giản và sử dụng transaction để đảm bảo dữ liệu câp nhật vao 03 bảng
Download here

[youtube=http://youtu.be/NhByTMv3cnc]

Buổi 02: Mail and netwwork
Link download ở đây

Email - screen capture with custom dialog
Download

[youtube=http://youtu.be/0K0FR5BkvMU]
Next demo

[youtube=http://youtu.be/l3kjBR-pHAY&w=380&h=200]

Buổi 03: Remoting
Link download ở đây

Buổi 04:ManipulatingData and AdvancedDataAccess

ManipulatingData

AdvancedDataAccess

Tham khảo sử dụng luồng cập nhật các control trên form ở đây

Buổi 05:

Download tài liệu tham khảo ve demo

[youtube=http://youtu.be/WHJYlxEQtAc&w=380&h=200]


Một số câu hỏi ôn lý thuyết các bạn nên tìm hiểu thêm
Adv .et & Security in .Net complete
-----------------------------------------------------------
Hi vọng có ích cho các bạn

Các bài hướng dẫn bằng video tôi sẽ tranh thủ đưa lên youtube.com để các bạn tiện theo dõi.

Wednesday, January 30, 2013

Nội dung thực hành môn window form with c# - demo phần mềm theo dõi quá học của sinh viên

Dưới đây loạt bài thực hành môn học gồm hướng dẫn (video có tiếng) và source nguồn.

 


Buổi 01
Demo Lab01

Buổi 02
1. Hướng dẫn xây dựng form Subject
2. Hướng dẫn xây dựng form About
3. sử dụng listview treeview picture box

Treeview

Buổi 03
Su dung cac hop thoai cua he thong
Hướng dẫn sử dụng datetimepicker, timer

Buổi 04
Tại ứng dựng MDI với menu
Tạo và sử dụng toolbar, status bar
Hướng dẫn xây dựng trang chứng thực với tài khoản tĩnh
Hướng dẫn xây dựng trang chứng thực với tài khoản lấy về từ database

Buổi 05
Thuc hanh buoi thu 5

Buổi 06
Buoi thuc hanh thu 06 database

Buổi 07
Binding source default and custom command
lab07

Buổi 08: GDI+ and Custom control
Picture réize
Một ứng dụng nhỏ thu nhỏ kích thước một tấm hình

Download

Buoi 09: Thiet ke bao cao voi CrystalReport
Video huong dan

Buoi 10: Phan quyen nguoi dung (user authentication - winform)
Demo dong goi va huong dan chuc nang phan quyen

Buổi 11:Window Presentation Foundation
Tai liệu tham khảo
---------------------------------------------

Tất cả source từng buổi ở đây

Simple demo product buying FaceFramework

[youtube=http://youtu.be/OiVH6A_rILM&w=380&h=200]

Simple demo product buying FaceFramework netbean 7.1

Ma nguon

Tuesday, January 29, 2013

Wednesday, January 9, 2013

Tuesday, January 8, 2013

Đưa liên kết hỗ trợ trực tuyến Yahoo và skype lên web

SKYPE

<a href="skype:ngo.tuong.dan?chat"><img src="http://download.skype.com/share/skypebuttons/buttons/chat_green_white_164x52.png" style="border: none;" width="164" height="52" alt="ask me" /></a>

YAHOO

<a href="ymsgr:sendIM?ntdan1980"><img border="0" src="http://opi.yahoo.com/online?u=ntdan1980&m=g&t=2&l=us"></a>

Giá trị của tham số t có thể là 0,1,2

Chú ý cả hai trường hợp đều phải cấu hình tài khoản cho nhìn thấy online khi đăng nhập

Skype_yahoo

Translate