Apr 19, 2008

Batch Commands to Disable Special Shared Resources

By default all your folders are accessible from other computers in your network. If you want to simply disable this feature, you can execute the batch commands below. After the "Server" windows service is restarted these folders are shared again.

net share "C$" /delete
net share "ADMIN$" /delete

Apr 8, 2008

Cannot Generate SSPI Context Error



If you are getting "Cannot generate SSPI context." error while trying to connect to an SQL server in your local area network, you should check your dns settings first. You can set or reset your dns settings using the batch commands in the following link:

http://redmilonga.blogspot.com/2008/03/batch-file-to-change-dns-servers.html

Apr 4, 2008

Hosting Multiple Web Sites On a Single Server

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/596b9108-b1a7-494d-885d-f8941b07554c.mspx

Mar 26, 2008

Essential Programs

Programming:

Tortoise SVN
Nunit
Reflector
Test Driven

Archive Management:

7zip
Daemon Tools

Web Browsers:

Firefox
Explorer

Gaming:

Steam
Hamachi
Hlsw
Teamspeak

Antivirus:

Spybot
Avast

Desktop Management:
Launchy

Password Management:


Keepass

Packages:

Google Pack
Windows Live

File System:

Unlocker

Video:


Vlc Player

Xvid

Word processor:

Notepad++
Adobe Reader

Download:

uTorrent
Orbit

Other:
Silverlight
Flash
Java

Declaring Cursors

DECLARE @UserID int
DECLARE test_cursor CURSOR FOR

SELECT UserID FROM Users

OPEN test_cursor
FETCH NEXT FROM test_cursor INTO @UserID
WHILE @@FETCH_STATUS = 0
BEGIN

INSERT INTO Emails (UserID,Email) VALUES (@UserID, 'test@test.com')

FETCH NEXT FROM test_cursor INTO @UserID
END
CLOSE test_cursor
DEALLOCATE test_cursor

Mar 23, 2008

Batch Commands to Change Dns Servers Authomatically

Setting primary and secondary dns addresses:

netsh interface ip set dns "Local Area Connection" static 208.67.222.222 primary

netsh interface ip add dns name="Local Area Connection" addr=208.67.220.220 index=2

Removing dns settings:

netsh interface ip delete dns "Local Area Connection" all

Mar 21, 2008

Configuring Http Access to Analysis Services

http://www.microsoft.com/technet/prodtechnol/sql/2005/httpasws.mspx

LLBLGen Code Snippets

Deleting multiple rows:

UsersCollection c = new UsersCollection();
SD.LLBLGen.Pro.ORMSupportClasses.IPredicate p;
p = UsersFields.Usernumber == 1234;
c.DeleteMulti(p);

Executing stored procedures:

usersGrid.DataSource = RetrievalProcedures.SelUsers();
usersGrid.DataBind();

Using IDataReader:

TypedListDAO dao = new TypedListDAO();
IDataReader reader = dao.GetAsDataReader(null, RetrievalProcedures.GetSelUsersCallAsQuery(UserID), CommandBehavior.CloseConnection);
while (reader.Read())
{
String s = reader.GetValue(0);
}
reader.Close();

Deleting rows:

UsersEntity e = new UsersEntity(UserID);
e.Delete();

Inserting rows:

UsersEntity e = new UsersEntity();
e.Username = "milonguero";
e.UserNumber = 1234;
e.Save();

Mar 20, 2008

Transforming Dataset to Html with Xslt

public static String Transform(DataSet ds)
{
String xml = ds.GetXml();

String xsl =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><xsl:stylesheet version=\"1.0\"
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:template match=\"/\"><
html><body><table><tr><xsl:for-each select=\"NewDataSet/Table[1]/*\"
><td><xsl:value-of select=\"local-name()\"/></td></xsl:for-each>
</tr><xsl:for-each select=\"NewDataSet/Table\"><tr><xsl:for-each
select=\"./*\"><td><xsl:value-of select=\".\" /></td></xsl:for-each
></tr></xsl:for-each></table></body></html></xsl:template
></xsl:stylesheet>";

System.IO.StringWriter writer = new System.IO.StringWriter();
System.Xml.Xsl.XslCompiledTransform t = new System.Xml.Xsl.XslCompiledTransform();
XmlReaderSettings settings = new XmlReaderSettings();
XmlReader xmlReader = XmlReader.Create(new System.IO.StringReader(xml));
XmlReader xslReader = XmlReader.Create(new System.IO.StringReader(xsl));
t.Load(xslReader);
t.Transform(xmlReader, null, writer);
return writer.ToString();
}

Mar 19, 2008

Xslt to Convert Datasets With Dynamic Columns to Html

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<table>
<tr>
<xsl:for-each select="NewDataSet/Table[1]/*">
<td>
<xsl:value-of select="local-name()"/>
</td>
</xsl:for-each>
</tr>
<xsl:for-each select="NewDataSet/Table">
<tr>
<xsl:for-each select="./*">
<td>
<xsl:value-of select="." />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>