05.May.2011 by admin warungsate in
Teknologi
no comment
This code on Page_Load events
//------if use update folder date
DirectoryInfo di = new DirectoryInfo(Server.MapPath(""));
loLastModified = di.LastWriteTime;
DateTime d = DateTime.Today;
//-------if use update file date
//System.IO.FileInfo loFile = new System.IO.FileInfo(Server.MapPath("Default.aspx"));
//loLastModified = loFile.LastWriteTime;
Then write this code on *.aspx file
Last Update <%=String.Format("{0:dd-MMMM-yyyy}", loLastModified)%>
to See More date format, please check this out http://www.csharp-examples.net/string-format-datetime/
the TAGS: C# Programming, komputer, microsoft, solusi, Teknologi
12.Apr.2011 by admin warungsate in
Teknologi
no comment
You can either do this steps.
int[] terms = new int[400];
for (int runs = 0; runs < 400; runs++)
{
terms[runs] = value;
}
or, you can use Lists
List<int> list = new List<int>();
for (int runs = 0; runs < 400; runs++)
{
list.Add(value);
}
// You can convert it back to an array if you would like to
int[] terms = list.ToArray();
source : http://stackoverflow.com/
the TAGS: C# Programming, komputer, microsoft, Teknologi
06.Apr.2011 by admin warungsate in
Teknologi
no comment

Jika menemukan error seperti ini pada penggunaan LINQ atau Entity Framework.
System.NotSupportedException: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression
Jalan keluarnya adalah hindari segala macam CONVERT di dalam penggunaan sintaks LINQ.
from ntc in
(from ntc in AST_NTC_HEADERs
where
(new string[] { "N1", "N2", "N3", "N4" }).Contains(ntc.MOVEMENT) &&
ntc.NTCDT.Substring(0, 4) == Convert.ToString(DateTime.Now.Year) &&
ntc.VENDOR.Contains("") &&
ntc.CRTDTUPDATE != null
select new
{
ntc.MOVEMENT,
Dummy = "x"
})
group ntc by new {ntc.Dummy} into g
select new { HitNtc = g.Count() }
Maka lakukan pendeklarasian variable diluar sintaks LINQ. Misal :
string thn = Convert.ToString(Datetime.Now.Year)
Lalu pada sintaks LINQ ubah menjadi sebagai berikut :
from ntc in
(from ntc in AST_NTC_HEADERs
where
(new string[] { "N1", "N2", "N3", "N4" }).Contains(ntc.MOVEMENT) &&
ntc.NTCDT.Substring(0, 4) == thn &&
ntc.VENDOR.Contains("") &&
ntc.CRTDTUPDATE != null
select new
{
ntc.MOVEMENT,
Dummy = "x"
})
group ntc by new {ntc.Dummy} into g
select new { HitNtc = g.Count() }
Selamat mencoba, dan semoga bermanfaat.
the TAGS: C# Programming, komputer, LINQ, microsoft, Teknologi
02.Apr.2011 by admin warungsate in
Teknologi
no comment
When the TextMode property of a TextBox control is set to Password, the value you assign to the Text property (either declaratively or programmatically) isn’t actually displayed at runtime, not even in masked mode (with the * chars). This is of course done for security reasons, because even if the password would be shown in masked mode, the actual clear-text password could still be retrieved from the page’s source HTML code.
However, there are times when you actually want to pre-fill the password field, for example in a “My Profile” page where the user can change his personal data, including his account’s password. If you don’t protect very sensitive information, you may decide that showing the password in masked mode is a good compromise to increase the user’s experience. (The option of not showing the password at all and only update the password if the user types in something is not as intuitive for the user…). It would have been nice to have a direct option to show the password in masked mode but, as said, nothing appears if you set the TextBox’s Text property. The trick is very simple though: you just have to manually add a “value” attribute to the HTML generated by the server-side textbox control, where the value is the password. You do this by accesing the control’s Attributes collection, as shown below:
PasswordField.Attributes.Add("value", "secret")
the TAGS: C# Programming, komputer, Teknologi, Textbox Password
28.Mar.2011 by admin warungsate in
Teknologi
no comment
public string GenerateRoman(int number)
{
if (number <= 0) return "";
int[] Nums = { 1 , 4 , 5 , 9 , 10 , 40 ,
50, 90 , 100, 400, 500, 900, 1000};
string[] RomanNums = {"I", "IV", "V", "IX", "X", "XL",
"L", "XC", "C", "CD", "D", "M", "M"};
string sRtn = ""; int n = number;
for (int i = Nums.Length - 1; i >= 0; --i)
{
while (n >= Nums[i])
{
n -= Nums[i];
sRtn += RomanNums[i];
}
}
return sRtn;
}
the TAGS: Bilangan Romawi, C#, C# Programming, microsoft, Programming