Skip to content

Instantly share code, notes, and snippets.

View lamngockhuong's full-sized avatar
🍊
Working

Lâm Ngọc Khương lamngockhuong

🍊
Working
View GitHub Profile
@lamngockhuong
lamngockhuong / note.md
Last active December 30, 2017 16:40
[Password TextBox in ASP.NET] #csharp
@lamngockhuong
lamngockhuong / MD5 Hash Method In C# (using for password))
Last active December 29, 2017 09:49
[MD5 Hash Method In C# (using for password)] #csharp
public static String MD5Hash(String source)
{
MD5 md5 = new MD5CryptoServiceProvider();
// compute hash from the bytes of text
md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(source));
// get hash result after compute it
byte[] result = md5.Hash;
StringBuilder text = new StringBuilder();
for (int i = 0; i < result.Length; i++)
{
@lamngockhuong
lamngockhuong / Using IF ELSE Condition with EVAL function in ASP.Net GridView C#
Last active December 30, 2017 16:12
[Using IF ELSE Condition with EVAL function in ASP.Net GridView C#] #csharp
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" ItemStyle-Width="50" />
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="150" />
<asp:TemplateField HeaderText="Status" ItemStyle-Width="100">
<ItemTemplate>
<asp:Label Text='<%# Eval("Status").ToString() == "A" ? "Absent" : "Present" %>'
runat="server" />
</ItemTemplate>
</asp:TemplateField>
@lamngockhuong
lamngockhuong / Code tự động chèn nguồn trang khi copy bài trên web
Last active December 30, 2017 16:13
[Code tự động chèn nguồn trang khi copy bài trên web] #html #js
<script type="text/javascript">
if(document.location.protocol=='http:'){
var Tynt=Tynt||[];
Tynt.push('d5Y36e5Q8r4l_Yacwqm_6l');
Tynt.i={"ap":"Nguồn :"};
(function(){
var s=document.createElement('script');
s.async="async";
s.type="text/javascript";
@lamngockhuong
lamngockhuong / Code chuyển hướng trang sau một thời gian có đếm ngược
Last active July 2, 2022 07:50
[Code chuyển hướng trang sau một thời gian có đếm ngược] #html #js
<li class="lino">Bạn sẽ chuyển sang trang <a href="http://blog.ngockhuong.com"/>blog.ngockhuong.com</a> sau <span id="time">10</span> giây nữa<br />
<a href="/" onclick="reload();" id="reloadlink" title="Nhấn vào đây để tải lại trang">Tải lại trang<a>
</li>
<script type="text/javascript">
var jgt = 10;
document.getElementById('time').innerHTML = jgt;
function stime(){document.getElementById('time').innerHTML = jgt; jgt = jgt - 1;
if(jgt == 0){clearInterval(timing); location = 'http://blog.ngockhuong.com';}
}
var timing = setInterval("stime();",1000);
@lamngockhuong
lamngockhuong / keyboard_code_enums.js
Last active December 30, 2017 16:14
[Javascript Keycode Enums] #js
var enums = {};
enums.keyboard = {
BACKSPACE: 8,
TAB: 9,
ENTER: 13,
SHIFT: 16,
CTRL: 17,
ALT: 18,
PAUSE: 19,
CAPS_LOCK: 20,
@lamngockhuong
lamngockhuong / Struts 1: Show messages and errors in jsp
Last active December 30, 2017 16:14
[Struts 1: Show messages and errors in jsp] #java #struts
<html:messages property="NameMessages"/>
or
<logic:messagesPresent message="true">
<html:messages id="aMsg" message="true">
<logic:present name="aMsg">
<!-- Messages -->
<div class="action-message info">
<p class="text"><bean:write name="aMsg" filter="false" /></p>
</div>
</logic:present>
@lamngockhuong
lamngockhuong / chmod-xampp.md
Last active December 30, 2017 16:43
[Chmod Xampp for user in linux] #xampp #linux
@lamngockhuong
lamngockhuong / PDO: Sự khác nhau giữa bindValue và bindParam
Last active December 30, 2017 16:15
[PDO: Sự khác nhau giữa bindValue và bindParam (Xem ví dụ để thấy sự khác nhau)] #php
$sex = 'male';
$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');
$s->bindParam(':sex', $sex); // use bindParam to bind the variable
$sex = 'female';
$s->execute(); // executed with WHERE sex = 'female'
or
$sex = 'male';
$s = $dbh->prepare('SELECT name FROM students WHERE sex = :sex');
$s->bindValue(':sex', $sex); // use bindValue to bind the variable's value
@lamngockhuong
lamngockhuong / create-maven-repo-github.md
Last active December 30, 2017 16:43
[How to create your own maven repository on github] #maven

How to create a maven repository for your github project step by step

Clone your project in a separate folder

(note: replace ORGANIZATION and PROJECT)

git clone git clone git@github.com:ORGANIZATION/PROJECT.git my-repository

Cd into it