Jun 20, 2011

pass value between aspx page(Updating)

Pass value between aspx page
  • Pass by HttpContent

webpage1.aspx

String[] arraylist={"1","2","3"}; 
HttpContent.Current.Items["ArrayString"] = arraylist;
 
webpage1.aspx
String[] array= HttpContent.Current.Items["ArrayString"]
 
Note: 
HttpContent can not pass value with Response.Redirect
 
  • Pass by Session 

webpage1.aspx

String strName="Agrond"; 
HttpContent.Current.Items["String"] = strName;
 
webpage2.aspx

String strNamePassed=HttpContent.Current.Session["String"].ToString();
  

Note: Item and Session  can pass the object

May 22, 2011

Mưa

                Đã bao lần bạn được đi dưới những cơn mưa để rồi thả tâm hồn mình cùng những mối suy tư theo những giọt mưa. Tôi nhớ da diết nhớ cái cảm giác khi mà những giọt mưa cứ thế tuôn chảy trên khuôn mặt mình.Có một người bạn đã từng nói với tôi: “khi đi dưới mưa,không một ai biết mình đang khóc vì những giọt nước mắt đã hòa cùng với nhưng giọt mưa”.Đó là khi bạn đang khóc, mưa bao trùm lấy những nỗi buồn để rồi mưa cuốn nó đi hay chỉ đơn giản làm nhạt đi cái vị mặn của những giọt nước mắt còn đọng lại trên đôi mặt.
               Còn với tôi,đã lâu lâu lắm rùi tôi đã không được đi dưới mưa.Tôi thèm cái cảm giác đó không phải vì mưa có thể giúp tôi che dấu được những giọt nước mắt mà vì mưa giúp cho tôi có cảm giác mình đang được vỡ ào cùng khóc với những suy nghĩ của mình.Tôi không biết mình nên bước tiếp hay dừng lại để sống trong những kỉ niệm bởi lẽ tôi sợ.Tôi sợ mình lại có những sai lầm để rồi nhận lấy nỗi đau giống như một đứa trẻ phạm lỗi sợ bị phạt.Cái hình phạt không phải đau về thể xác mà âm thầm tận sâu trong suy nghĩ và nơi gọi là trái tim.Bời lẽ mỗi một lần tôi tự cho mình cái quyền được thoát ra khỏi kí ức là mỗi một lần tôi làm tổn thương một người khác. Mỗi một lần tôi đi tìm kiếm một chốn bình yên là mỗi một lần tôi để cho những kí ức sống dậy.Liệu ai đó hiểu được rằng, tôi đang cố gắng để thoát ra cái ký ức của mình thế nhưng rồi mọi thứ với tôi lại vỡ òa khi tôi để cho kí ức một lần nữa sống dậy.Có ai đó biết rằng tôi thèm một vòng tay nâng tôi đứng dậy và thoát ra khỏi kí ức của mình thế những vòng tay đó chẳng thể đến với tôi. Người duy nhất là Mưa, những cơ mưa giữa cái nắng hè oi bức bỗng xóa đi cái nóng, làm cho tâm hồn một con người bỗng chống đứng lại, suy nghĩ và òa khóc cùng Mưa.Và cứ thế Mưa với tôi hòa vào nhau cùng bản nhạc muôn thủa của Mưa để quên đi một tâm hồn còn đang cháy âm ỉ với nhưng nỗi đau. Mưa không thể dập tắn được những ngọn lửa bất tử đó,nhưng Mưa làm cho tâm hồn một con người bỗng chốc trở nên cứng cỏi hơn, để rồi tâm hồn đó tiếp tục bước đi trên suốt con đường dài có lẽ sẽ thiếu vắng Mưa.Và rồi mưa đi, cuối chân trời không còn là phải ánh mình minh mà chỉ còn thoi thóp những tia nắng của ngày tàn. Đêm dần buông, tâm hồn bỗng chống lại muốn đi tìm một chốn bình yên để nương nhờ.Tìm kiếm,tìm kiếm,nhưng trong cái bóng tối mịt mù đã buông xuống,tâm hồn tìm đâu một chốn bình yên?

May 8, 2011

Bố mẹ

23 tuổi con mới hiểu hết được tiếng gọi “Mẹ” “Bố”.23 tuổi con mới biết mình thèm được gọi hai tiếng gần gũi đó đến thế nào.Sống ở một phương trời khác, nơi con luôn mong ước đặt chân đến, con mới nhận ra được những điều con tuởng mình đã biết rõ bỗ chốc trở thành những điều mà con chính con phải đi tìm để rồi con thực sự thấm hết ý nghĩa của những câu thơ
“Đi khắp thế gian không ai tốt bằng Mẹ
Gánh nặng cuộc đời không ai khổ bằng Cha
Nước biển mênh mông không đong đầy tình Mẹ
Mây trời lồng lộng không phủ kín công Cha

Tần tảo sớm hôm Mẹ nuôi con khôn lớn
Mang cả tấm thân gầy Cha che chở đời con
Ai còn Mẹ xin đừng làm Mẹ khóc
Đừng để buồn lên mắt Mẹ nghen con”.

Từ bé, con đã sống trong vòng tay của mẹ.được mẹ nâng niu từng bữa ăn từng giấc ngủ,chăm sóc từ cái ăn đến cách mặc.Thế mà con lại nghĩ là con có thể xa rời những điều như thế.Đã có những lúc con muốn rời xa cái vòng tay bảo bọc đó của mẹ.Chỉ để kiếm tìm cho minh một không gian riêng.Đã có những lúc con để những giọt nước mắt lăn dài trên khuôn mặt của mẹ.Mà không biết rằng sau những giọi nước mắt đó lòng mẹ lại quặn đau thế nào.Con đã vô tâm đi mà không biết, không biết rằng mẹ đã buồn về con như thế nào.Và rồi khi thực sự bước đi ra xa khỏi tầm tay của mẹ con mới biết rằng con còn non nớt đên đến ngần nào.Con mới hiểu thêm được rằng có một thứ luôn quan trọng hơn tất cả trong con đó là tình cảm mẹ.Con bước giữa thế giới đông đúc người mà vẫn luôn cảm thấy mình cô đơn và hiu quanh.Có những khi com thèm một tiếng hỏi han một cái quan tâm của mẹ,một cai động viên khích lệ,hay chỉ đơn giản là một ly nước mẹ mang cho con. Có những khi con thèm được gọi tiếng mẹ thật gần gũi.Một tiếng thôi nhưng sao lại mang đầy ma lực tình cảm đến thế.

Con lớn lên, cứ lớn lên để rồi vô tình hững hơ với tình cảm của bố.Đã bao nhiêu lần con oán trách tại sao bố lại hờ hững với con.Bố để con tự lao vào cuộc sống, tự học những bài học cho chính mình.Con biết rằng mỗi bước chân của con đi bố đều theo dõi nhưng sao bố không đưa vòng tay to lớn của mình đỡ con dậy mỗi lần con vấp ngã. Con từng ghét mình là con của bố vì con có người bố quá giỏi đến mức con không thể nào theo kịp, hay ánh hòa quang của bố quá bao chùm lấy con.Đến lúc cất bước đi con bố sắp xếp từng món hành lý cho con.căn giặn co đủ điều và con biết con dù lớn thế nào vẫn là con của bố. Nhưng giờ khi thực sự con phải đứng trên đôi chân của mình con hiểu là ra rằng mọi thứ con làm trước đây chỉ vì con biết bố sẽ luôn đỡ con dậy.Con bây giờ con phải tự đứng thực sự nơi con không được phép vấp ngã.Thèm một tiếng gọi bố ơi giữa phố xá ngươi không quen người này.Con giờ mới biết mình quá nhỏ bé thực sự nhỏ bé trong vòng tay của bố.

Mar 31, 2011

How to user subversion in visual studio with Googlecode

Request:
  • ·         Google account (Create)
  • ·         A project in Google Code (Create)
  • ·         Ankhs (download)
  • ·         Visual studio
Step 1: Create the account Google code

Figure1: Form to register a project code in Google code
Completing the form registers account project Google code. You have two version control system. I recommend choosing the “subversion” version control system.
You can chose any Source code license with is suitable with you software and remember your project will be opening source now.
Finish by click to create project.

Figure2: main controller of Google code host
Step2:   Add your partners to Google code host
         You need add your partners to you Google code host. It will be useless if you do your project alone (never do that)
         Remember your partner need to have Google account. It is Google mail account
        You will have 3 the kind of developer
  • ·         Owner: who can change this project
  • ·         Committer: who can add more but cannot edit your project(I’m not sure)
  • ·         Contributor: as non-members

Figure3: Adding partners
Step 3: Get Link SVN
Click in the tab Source/Checkout. It will show you the link svn of your Google code project

Figure 4: Link SVN of your Google code host with username is your account
Step 4: Get password your account


Figure 5: Password to use in Google code svn
Step 5: create project in visual studio (installed Ankhs)
Create new project in Visual studio (VS)

Figure 6: creating project in visual studio
Step 6: add Project to SVN Google Code
Click right in your project and choice “Add solution to subversion” if you want add all solution to Google code (first time, I recommend that) or “Add selected solution subversion” if you want to add only selected project to Google code host


Figure 7: add svn to your project
Repository URL you get the link Google give you but you need some small edit this link
EX:

You have to remove “svn checkout” at the top and remove anything after “truck/”
Your link will be:
https://demo-googlecode-svn.googlecode.com/svn/trunk/

Figure8: insert information of Google code host (svn host)
Click ok and wait configuration box. Click ok again. It will ask you to login to your svn. This time you use the
·         Username is username of the Google account.
·         Password is pass Google code gave you(remember it is NOT the password of your Google account)

Your project will be ready to use svn

Figure 9: after add svn to project
Step 7: Commit editing in project
First time, you have to commit all you project (Solution) at the first time. After the first time after you finish you work and need to upload you code to svn host you do it again.
To commit:
Click right on your project and chose “commit solution Changes”

Figure 10:

Step 8: Update editing in project
You can get new code from you partner by click to you project and choice “Update Solution to Latest Version”

(Other functions of Google code host I will update later)


Agrond                

Mar 27, 2011

Enhance Entities Relationship (EER)

What is it?
       Enhance or External Entities Relationship like as its name. It is extended from Entities Relationship Diagram (ERD) which is a diagram show the relationship between entities.
What is difference with (Entities Relationship Diagram) ERD?
      There are three differences between EER and ERD. EER introduce three new concept. They are extension which are added to ERD
  1. Total mapping constraints
  2. Aggregation at the type level
  3. Generalizations and classifications
Firstly, this article will focus to Generalization and Classification (super/sub type)
What is super and sub type?
         Subtype entity is a special case of another entity called its supertype.
         Let’s exanimate some example of super/sub type
         
         Ex: A Company has many employees. They are in 3 groups: Engineer, Secretary and Programmer
         
         In this case, we will have Employee group is common group of Engineer, Secretary and Programmer groups. Employee group will keep common attribute(generalization) between Engineer, Secretary and Programmer such as EmployeeID, Employee_Name, Employee_Address, Employee_Phone
         Three groups Engineer, Secretary and Programmer have some difference attributes (specialization).For instance, Engineer has “Degree” attribute, Secretary has “Type_speed” attribute and Programmer has “Programming_language”.
How to show super/sub type in EER
          There is several ways to show super/sub type in EER. It is dependence what kind of ERD you used. This article introduce 2 kind which are popular in drawing ER
1.       UML language

2.       Information Engineering

How to covert super/sub type to physical database?
          It doesn’t have any rule to show super/sub type entity in database. But the accepted solution is creation each sub and super entity a table. Sub type entity tables will get foreign key from super type entity table and make them become primary key of them

In your example, we have 4 tables:




Physical diagram

View super and subtypes
          When you create each table for super and subtype, you can create view for sub by JOIN and use UNION to show the view of super entity
         Example query


JOIN
select * from Employee join Engineer on Employee.Employee_ID = Engineer.Employee_ID

UNION

select * from Employee join Engineer on Employee.Employee_ID = Engineer.Employee_ID
Union
select * from Employee join Secrectary on Employee.Employee_ID = Secrectary.Employee_ID
Union
select * from Employee join Programmer on Employee.Employee_ID = Programmer.Employee_ID

Continue……

Mar 19, 2011

Thêm font tiếng việt vào android(rooted)

Giới thiệu

  • Quả thật là một sai sót khi để bài viết về font tiếng việt mà quên đi không dịch sang tiếng việt thì thật là tệ.
  • Chắc hẳn các bạn cũng biết android hỗ trợ ngôn ngữ tiếng việt 100% thì việc gì cần phải thêm font tiếng việt vào android.
  • Lý do: là một số bản  cooking android được phát triển thiếu đi ngôn ngữ "hiếm" như tiếng việt (không hiểu sao đến giờ tôi yêu tiếng việt vô cùng)
  • Nguyên tắc: Android có một thư mục chứa font chữ ở /system/fonts.Trong thư mục này có file DroidSansFallback.ttf.File này dùng như một font chữ hỗ trợ cho font DroidSans.tff(Font chữ chính của android).Nếu gặp trường hợp không hiện thị được font chữ nào đó android sẽ tiến hành sử dụng font DroidSansFallback.tff.Nên việc thay thế nó sẽ không ảnh hưởng gì đến font chữ của hệ thống
Sau đây là những thứ bạn cần chuẩn bị
1.Font hỗ trợ tiếng việt.(ở đây đề nghị bộ font DejaVu font)download
2.Một chương trình root explorer ( root explorer) có thể tài về từ market của android
3.Android đã root(nhưng chắc chắn khi nào bạn cần thêm font tiếng việt thì android của bạn đã root rùi :D)

Bước 1:
  • Tải về và giải nén Deja Vu font bạn vừa download về.
  • Đổi tên DejaVuSans.ttf sang DroidSansFallback.ttf.
Bước 2:
  • Copy font vào thẻ nhớ(Bất kì chỗ nào nhưng bạn cần nhớ vị trí để tí nữa sẽ copy nó vào bộ nhớ máy).
        NB:Tôi để nghị là để ở vị trí ngoài cùng trên thẻ nhớ của bạn
Bước 3:
  •  Mở Root explorer vào thư mục trên thẻ nhớ nơi để font file lúc nãy bạn vừa copy vào.Và copy font chữ đó
           Chú ý: khi dùng root explorer đường dẫn để vào thẻ nhớ se là /sdcard
Bước 4:
  • Dùng Root exployrer vào thư mục /system/fonts.
  • Trong thư mục này bạn sẽ thấy có file DroidSansFallback.ttf, backup nó lại bằng cách đổi tên thành DroidSansFallback.ttf.bak
  • Mount thư mục sang chế độ R/W bằng cách ấn vào nút mount R/W ở góc trên bên phải.
          NB: Với thao tác này bạn có thể tiến hành chỉnh sửa thư mục trên máy.nhưng cũng đồng nghĩa bạn có thể gây hư hại cho hệ điều hành.
  • Paste font file vào thư mục này.
Bước 5:
  • Cuối cùng khởi động lại máy bạn sẽ thấy khác biệt ôi tiếng việt thân yêu đã xuất hiện
Tài liệu tham khảo

Agrond

Hướng dẫn cài đặt Mysql và php on IIS

1.     Giới thiệu

Chắc hản luôn có khó khăn cho bạn khi muốn thiết lập một php và mysql trên windown với IIS.Sau đây là tutorial  hướng dẫn cài đặt php+mysql trên IIS bằng tay

2.     Chuẩn bị cần thiết:

·         PHP(bản mới)
·         Mysql

Bước 1 Install MYSQL

Bước này tôi lướt qua nếu có thắc mắc về việc cài đặt MYSQL  vui long thao khảo link sau
Thiết lập MYSQL

Bước 2: Copy php vào máy tính

Bạn có thể đặt thư mục chứa php ở bất kì đâu trong ổ cứng của bạn nhưng tôi khuyên nên để ở vị trí
C:\php cho thuận tiện

Bước 3: thiết lập config

Đổi tên c:\php\php.ini-recommened thành c:\php\php.ini
Mở file ph.ini ra rồi tìm đến dòng
extension_dir =
gán giá trị vị trí lưu trữ phần mở rộng của php.Vì tôi đặt php ở ổ C:\ nên kết quả như sau
extension_dir = "c:\php\ext"
mở những external cần thiết ra.Ở đây tôi mở mysql,mysqlli,mssql .Việc mở đơn giản bằng cách bỏ dấu “;” ở đầu mỗi dòng sau
extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll

Thêm vào đó di chuyển file php.ini từ thư mục c:\php\ vào trong c:\windows\  .bởi vì theo mặc định php sẽ tìm file config  php trong c:\windows\

Bước 4: thiết lập IIS

·         Mở IIS bằng cách mở Run và gõ “inetmgr”
·         Mở Handler mapping/add script map

Request path: *.php
Executable: C:\PHP\php5isapi.dll
Name:php


·         Mở ISAPI và CGI restriction/Add

ISAPI or CGI path: C:\PHP\php5isapi.dll
Description:php5


Bước 5 kiểm tra công việc

·         Mở trình xoạn thảo văn bản xoạn 1 file text với nội dung lưu dưới tên mở rộng là .php

<?php phpinfo();?>
·         Move file vào wwwroot của IIS
·         Mở IE và gõ localhost\{tenfile}.php


Vậy là chúng ta đã hoàn thành việc cài đặt php cùng với mysql external


Feb 19, 2011

Tip for window,linux and android

For windown
  1. Delele service
Code: sc delete [service name]
Exam: sc delete MySQL


For Linux

For Android

Add font of Vietnamese to Android


Android-based smartphone is getting more and more popular everywhere worldwide, however, the font support for more international languages have been lacking. The Droid font family of Droid Sans, Droid Sans Mono and Droid Serif typeface include extensive character set for Western European, Eastern/Central European, Baltic, Cyrillic, Greek and Turkish languages, with Simplified and Traditional Chinese, Japanese and Korean regular font support on Droid Sans typeface, but not many other languages else.

For example, Hebrew, Arabic, Thai, Vietnamese, Myanmar (Burmese), RTL (Right to Left) languages and more non-mainstream languages, although the locale may be supported by the Android system, but the Android built-in default fonts does not have the typeface to display them correctly. As the result, whenever users receive and open a SMS text message, MMS message, email, document, file, or browse web pages encoded in these unsupported language and uses characters or scripts which is not of Roman or Latin alphabets, the word will be displayed as square white boxes or some other unreadable symbols.

For Android mobile device users who need to read languages that currently not supported by built-in Droid fonts, here’s a workaround to install another font which supports a larger group of characters and typefaces.

Tip: The font that been used by many Android users is DejaVu fonts, which is a free font family based on the Vera Fonts to provide a wider range of characters while maintaining the original look and feel. It may be possible that the DejaVu fonts does not support the characters for your native language, or you may dislike the DejaVu fonts. So it’s possible to basically just use another font in the guide below.

Note: The Android device must be rooted before installing the font.

   1. Download DejaVu fonts from sourceforge.net.

      Note: Windows and Mac OS X users should download either dejavu-fonts-ttf-2.31.zip or dejavu-sans-ttf-2.31.zip, while Linux, BSD, Solaris and other OS users should download either dejavu-fonts-ttf-2.31.tar.bz2.
   2. Unpack the package to retrieve DejaVuSans.ttf font file, inside the ttf folder.
   3. Rename the DejaVuSans.ttf to exactly DroidSansFallback.ttf.
   4. Copy the DroidSansFallback.ttf to the root directory of the SD card on the phone, either through memory card access by connecting the phone to computer, or by inserting the SD card to a memory card reader.

      Tip: It’s also possible to copy DejaVuSans.ttf to SD card first and then perform the rename operation.
   5. Run Terminal Emulator.

      Tip: Terminal Emulator is available free from the Android Market.
   6. Go into super user mode by entering the following command, then tap Enter:

      su

      Note: If the Terminal Emulator is not in the Superuser Whitelist yet, a dialog will be displayed asking for permission to run the app in superuser mode. Answer Yes or Always.
   7. Then run the following commands one by one:

      Note: Backup or rename the /system/fonts/DroidSansFallback.ttf if you don’t want to overwrite it.

      mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
      chmod 4755 /system/fonts/DroidSansFallback.ttf
      dd if=/sdcard/DroidSansFallback.ttf of=/system/fonts/DroidSansFallback.ttf
      reboot

      Note: Some other device may have different device node for the system partition, for which the mount command will have to be changed accordingly.

      Tip: It’s possible to replace the entire line of dd command with the following copy command: cp -rf /sdcard/fonts/DroidSansFallback.ttf /system/fonts/DroidSansFallback.ttf
   8. The phone will reboot.
   9. Once restarted, the Android device will use the DroidSansFallback.ttf font for any characters that it cannot display. This ensures that the default display fonts are not been messed up or changed

Collect from: http://www.mydigitallife.info