dotnet technology series
Create presentation layer by using WebForm or WinForm. Then create LoginAuthenticationLdapDao class in data access layer. Call the ldapAuthentication method in LoginAuthenticationLdapDao Class to authenticate user.
public class LoginAuthenticationLdapDao
{
private String LDAPPath = null;
private LDAPHandler ldapHandler = null;
public LoginAuthenticationLdapDao()
{
//
// TODO: Add constructor logic here
//
}
public bool ldapAuthenticate(String username, String password, String domain)
{
Boolean status = false;
username = username.ToLower();
domain = domain.ToLower();
if (domain.Equals(”staff”))
{
LDAPPath = “LDAP://staff10/DC=staff,DC=main,DC=xxx,DC=xxx,DC=xxx”;
ldapHandler = new LDAPHandler(LDAPPath);
if (ldapHandler.IsAuthenticated(username, password, domain))
{
status = true;
}
else
{
status = false;
}
}
else if (domain.Equals(”student”))
{
LDAPPath = “LDAP://student11/DC=student,DC=main,DC=xxx,DC=xxx,DC=xxx”;
ldapHandler = new LDAPHandler(LDAPPath);
if (ldapHandler.IsAuthenticated(username, password, domain))
{
status = true;
}
else
{
status = false;
}
}
return status;
}
}
Create LDAPHandler class as shown below:
using System.DirectoryServices;public class LDAPHandler
{
private String _path;
private String _filterAttribute;
public LDAPHandler()
{
}
public LDAPHandler(String path)
{
_path = path;
}
public bool IsAuthenticated(String username, String pwd, String domain)
{
Boolean status = false;
String domainAndUsername = domain + @”\” + username;
DirectoryEntry entry = new DirectoryEntry(_path, domainAndUsername, pwd);
try
{ //Bind to the native AdsObject to force authentication.
Object obj = entry.NativeObject;
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = “(SAMAccountName=” + username + “)”;
search.PropertiesToLoad.Add(”cn”);
SearchResult result = search.FindOne();
if (result == null)
{
status = false;
}
else
{
status = true;
}//Update the new path to the user in the directory.
_path = result.Path;
_filterAttribute = (String)result.Properties[”cn”][0];
}
catch (Exception ex)
{
// throw new Exception(/*”Error authenticating user. ” +*/ ex.Message);
}
return status;
}
}
August 3rd, 2008
Taken from Kiyosaki book: Increase Your Financial IQ, get smarter with your money, page 42.
One of the reason the poor and middle class struggle is that they work for money and a steady paycheck. The problem with working for money is you have to work harder, longer or charge more to make more money. The problem with physically working harder and longer is that we all have a finite amount of time and energy.
One of the reason why the rich get richer is that every year they work to build or acquire more assets. Adding more assets does not require working harder or longer. In fact, the higher a person’s financial IQ, the less he or she work while acquiring more and better-quality assets. Assets work for the rich by producing passive income.
July 23rd, 2008
Taken from one of Kiyosaki rich dad book series.
The difference between financial statement of employee/self employee with financial statement of business owner/investor.
Employee/Self Employee:
- Income - (Income tax taken from percentage of Income) - (Expenses)
Business Owner/Investor
- Income - (Expense) - (Income tax taken from percentage of income - expense)
Those formula above explain the differences of how much we should pay tax. As an employee or self employee, the government will tax our income tax based on the initial value of our income, before we use our income to pay expenses. As business owner/investor, government will tax us after our income been deducted by our expenses.
July 22nd, 2008
One of the task is to retrieve Date data from MS Excel. Initially we use dd/mm/yyyy format on the excel file. The system will treat the dd/mm/yyyy format as a string
The algorithm were:
- Count the length of the date data, 10 for dd/mm/yyyy otherwise return error value
- Substring the dd/mm/yyyy to get date value from dd, month value from mm and year value from yyyy
- Format the DateTime with arguments date, month, year
But, there were always an error in the implementation of algorithm above. Seems like the length of dd/mm/yyyy is not 10, and seem like the excel did auto format for the data with dd/mm/yyyy format. To avoid that problem, we changed the dd/mm/yyyy to yyyymmdd format without any slash (/). And it works….
July 22nd, 2008
Citation database is the repository of indexed publication (citated journal). The good journal has index more than 1. The more we read good journal, the more we know our research target. Narrowing the research activity. We can learn how the study has been conducted in the good journal. How the methodology and the style are used by the good journal. Follow the way the good journal conduct the study as close as possible.
In order to write a publication to be published as a journal, we have to become realistic. Indexed journal with more than 0.5 is good enough for us to publish our research publication.
In the research, time is important. If we want to publish our research as a journal, it will take 6-9 month for editor to review, some journal take a year. Once we submit our publication, we are not be able to submit the same publication to other journal. If our publication is rejected, means we have waste our time. And the research value will be decreasing because our research is beeing outdated. Hence we have to try to find out the information whether our publication will be accepted.
July 22nd, 2008
A research will not be very useful unless it is documented well. A good documentation will reflect the quality of research and the amount of contribution shown. It also provides a basis for publication.
Many researchers concern on the technical details most of the time when writing a research paper. However, they should not forget the importance of effective writing to deliver the research output achieved. General effective writing communication guidelines apply: keep it short and simple. Several important notes on this (based on experience):
- Understanding the general overview on motivation/background, problem definition, approach to the problem, methodology, and results are critical.
- Convincing motivation and results are key points to attract the readers.
- Well-structured format and smooth transitioning between different sections are also important to easier the readers in understanding the paper.
- Grammatical aspect.
- Clarity and consistency, for example: short-form (i.e. CDMA), must be explained clearly and consistently across the paper. Explanation of short-form is provided when the short form is firstly used in the paper.
- Whenever possible, use a short sentence rather than a long sentence to explain something.
- Conclusion should reflect a well-summarized content. Recommendation may be provided to facilitate a further research.
The key is how to deliver a research paper to the readers so that they can acknowledge the research contribution in an easy way.
July 19th, 2008
Di e-paper kompas hari ini (Selasa, 15 Juli 2008), halaman 18 di kolom kilas Ekonomi:
BUMN Peduli Bantu SMA Taruna Nusantara
Sebanyak 14 Badan Usaha Milik Negara atau BUMN memberikan bantuan ke Lembaga Perguruan Taman Taruna Nusantara, pengelola sekolah unggulan SMA Taruna Nusantara, Magelang, Jawa Tengah. BUMN tersebut adalah Bank Mandiri, BNI, BRI, Pertamina, Telkom, PGN, Garuda Indonesia, Antam, PT Timah, Jamsostek, Angkasa Pura I, Angkasa Pura II, Pelindo II, dan PTBA. “Bantuan antara lain beasiswa kepada calon siswa dari keluarga kurang mampu, penambahan ruang kelas, bantuan komputer, laboratorium kepemimpinan dan perbaikan dapur”, kata Menneg BUMN Sofyan A Djalil saat penyerahan bantuan akhir pekan lalu di Magelang. (*/FAJ)
http://epaper. kompas.com/
July 15th, 2008
Good articles taken from The Straits Times, 12 July 08…
“Until you value yourself, you will not value your time. Until you value your time, you will not do anything with it” (M.Scott Peck)
Tips to improve time management.
- Do not say “I don’t have time”
- Do the worst first
- Reward yourself
- Make a list
- Start small
- Set deadline
- Get a life
- Organize your desk
- Do not be affraid to ask for help
- Ride on technology
Time management is very critical task at least for me. Too much things to do drive me not to do. “Under estimate the problem” is my biggest problem, as been said by my Professor at NTU. Did I undervalue myself? Maybe yes, maybe no. Let me do experiment based on the article “Do not let your time fly”. Let me start with extracting each point above as written on the Straits Time CATS recruit (12/07/2008)
Don’t say “I don’t have time”
Just remember that you have exactly the same amount of time as everyone else. What you really trying to say is “I do not want to make time to do that”.
Do the worst first
Start each day by getting rid of your most despised task. Nothing ruins a day like dreading a task you have to do later in the day.
Reward yourself
Find out what motivated you and set rewards for your self if you can achieve all your task.
Make a list
Unless you have the world’s best memory, you should make a list. When someone gives you a responsibility, record it somewhere. It does not matter how, just write it.
Starting small
Some people believe in labelling A, B, C in the order or their importance. But for the author (not me in this case, i can copy from newspaper this article), he prefers to do that he calls “A little thing first”
Set deadline
When setting yourself a task or getting one from someone else, always find out when it needs to be done by. Then plan an appropriate amount of reminders on your diary before the due date.
Get a life
Works-life balance seems to be the buzzword at present, but you really need to put time and energy into this area.
Schedule time to relax, do things with your family or read. If the activity is marked out in your diary and you commit to it, you are less likely to neglect it.
Organize your desk
My desk at work is my haven. My trays work for me.
Don’t be affraid to ask for help
What is worse - asking for help once, or doing a task incorrectly or incompletely five times, or not doing it at all? Don’t be a victim or the “scared to ask” disease
Ride on technology
Your mind is not a computer, so use your computer to help your mind become like one.
July 12th, 2008
The hardest part of conducting research project is… to publish it, whether publish to Journal Publication or Conference Proceeding. Thank to Jayan, research staff of Wee Kim Wee School of Communication and Information for the steps to produce good paper, as follow:
- Elaborate on current available system
- Identify the problem the current system, will come out with the research question
- Propose the solution
- How the solution solve the issue
- How will it benefit users
Elaborate all the points and…. let ’s the professor decide whether the quality of our paper is good and ready to be sent to journal/conference proceeding or…. re-write again.
July 9th, 2008
Another experiment conducted by writer. Nokia E90 Communicator come with build-in QWERTY keyboard. To make E90 as SSH client, please download MidpSSH from http://www.xk72.com/midpssh/download.php and install it on E90 devices. Google it from E90 web browser and download it directly via E90 web browser. Writer has done installation of Latest Development Release (v1.7.3) on E90.
Software Performance
It’s a bit slow in response compared with the open-ssh on N810 Internet Tablet, but it works great as SSH clients.
July 8th, 2008
Previous Posts