mustcodemore.com

2.09.2006

What is RFID?

RFID (Radio Frequency Identification) is quickly becoming a popular choice among manufactureres. Find out all about it here:

http://www.rfidjournal.com/article/articleview/1339/1/129/

2.07.2006

Securing an ASP.NET Application with integrated IIS Security

ASP.NET can be used together with Microsoft Internet Information Services (IIS) to authenticate Web users based on their Microsoft Windows 2000 or Windows Server 2003 user account credentials. The ASP.NET execution engine can also be configured to impersonate Web users, or to use its own Windows identity when it accesses resources such as databases or files.

http://www.dnzone.com/ShowDetail.asp?NewsId=504


2.02.2006

SQL Find Duplicates Query

Needed this today. Finds all occurences of a specified field that occurs more than once (or whatever number you want to replace)

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )


also this finds only lines that have a single record


SELECT email
FROM users
GROUP BY email
HAVING ( COUNT(email) = 1 )

2.01.2006

Wake On Lan Packet (C#)

The following code will send out a WOL packet to a server specified by the MAC Address. Please note this only works for boards that have a WOL option in the CMOS.

using System;
using System.Globalization;
using System.Net.Sockets;
using System.Net;

//we derive our class from a standard one

public class WOLClass:UdpClient
{
public WOLClass():base()
{ }
//this is needed to send broadcast packet
public void SetClientToBrodcastMode()
{
if(this.Active)
this.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.Broadcast,0);
}

public static void Main()
{
WakeFunction("00018054D467");
}

public static void WakeFunction(string MAC_ADDRESS)
{
//now use this class
//MAC_ADDRESS should look like '013FA049'

WOLClass client=new WOLClass();

client.Connect(new
IPAddress(0xffffffff), //255.255.255.255 i.e broadcast
0x2fff); // port=12287 let's use this one

client.SetClientToBrodcastMode();

//set sending bytes
int counter=0;
//buffer to be send
byte[] bytes=new byte[1024];
//first 6 bytes should be 0xFF
for(int y=0;y<6;y++) style="color:#33cc00;">
//now repeate MAC 16 times
for(int y=0;y<16;y++) i="0;" z="0;z<6;z++)" style="color:#33cc00;">
//now send wake up packet
int reterned_value=client.Send(bytes,1024);
}
}