Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

Programous Programous
  • Shadow Copy works in Vista home Premium :)

    Google “Price Decimation” Its an economic term that means Microsoft gets more money when each person pays the maximum they are willing to pay for a given product.   

  • Which one is faster? RegEx vs .Replace

    Given two ways of doing something, regex is almost always slower.

  • Disk encryption 'no silver bullet'

    The tools to do this were released at HOPE a few weeks ago, very interesting and very scary. They also mentioned something interesting about the Apple OS’s, whenever you are logged in, the OS keeps a copy of your username and password in cleartext in the RAM. According to them, this was reported to Apple a little over 10 years ago, and they refuse to change it (something about how the UN/PW combo is used for silent elevation, scary on its own…). But when paired with a cold boot attack it is very dangerous.

  • zero-length string == nothing ??

    Sven Groot said:
    ZippyV said:
    *snip*
    Option Strict has no bearing on the problem.

    And yes, VB considers Nothing and "" to be equivalent in string comparisons. It has done so since the first version of VB.NET (can't remember how VB6 behaved). I find it a very useful behaviour as writing foo = "" is easier than String.IsNullOrEmpty(foo), which has the same effect.

    If you must make the distinction, use String.Compare as Littleguru suggested.

    Note that  String.IsNullOrEmpty is much faster then == "". If your in a loop (for example, when parsing a file) you can defiantly see the difference.

    See: http://msdn.microsoft.com/en-us/ms182279.aspx

  • Alternative to MSN File Transfers?

    whats wrong with FTP or SFTP? It's easy to setup, the only trick is you would have to port foward if you were behind a firewall/NAT, but thats not to bad.

    Am I missing something?

  • What is going on with the Justice Sytem in NC?

    dahat wrote:
    
    ScanIAm wrote:
    He'd better make a lot of money from that book deal...I smell lots of time in civil court in his future.


    Which is probably better than some called for alternatives... such as execution.


    I would have to say, I agree with many of the points made in the link. It’s probable that execution goes too far, but what he is getting is defiantly too light. I feel at minimum, he should receive the same sentence that he tried to impose on the men in this trial.

  • Internet tax battle revisited

    ScanIAm wrote:
    
    phreaks wrote:


    This is where you and I have differing opinions. I believe the money I earn is mine, you believe it's the governments'.


    I believe that most of it is yours, and some of it is ours (societies).  You are welcome to buy/invade your own uninhabited land somewhere, and build your own society where all money earned goes to you   



    Would be nice if that’s where most of the money went.
    For the US, more than half of the federal budget goes to “entitlement spending.” That’s welfare, social security, Medicare and Medicate. Not to mention the billions handed out in farm subsidies to pay famers not to farm.  Nor the billions of dollars to house, feed, and secure the millions in prison on drug-possession charges. Nor the billions spent going after the gang crime created by said drug laws.
    And let’s not forget that the federal government isn’t even supposed to be able levy a direct tax on individuals (It was done with a constitutional amendment and a law that was *supposed* to be temporary during World War II, wonder who forgot to repeal it?).
    </rant>
    Well, anyway, the point is the government has way more money than it needs. What it needs to do is cut spending, not raise taxes. 

  • Just watched the BSG Series 3 finale

    I would say that’s arguably one of the best season finales of any TV shows I’ve ever seen.

  • convert dataset to excel for download in asp.net

    Here is some code I used to output a CSV file for my db. It’s not commented and you’ll obviously have to alter it for your database. Please reply / email with any questions.

     

     

    using System;

    using System.Data;

    using System.Configuration;

    using System.Collections;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Web.UI.HtmlControls;

    public partial class Stat_GetCDF : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    Response.ContentType = "text/csv";

    System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString);

    System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("SELECT [Name], [Question], [Choices] FROM [STAT_Fields] WHERE ([SID] = '" + Request.QueryString["SID"] + "') ORDER BY [SortOrder]", con);

    System.Data.SqlClient.SqlDataReader read;

    con.Open();

    read = cmd.ExecuteReader();

    System.Collections.Generic.Dictionary<string, string> ColChoices = new System.Collections.Generic.Dictionary<string, string>();

    System.Collections.Generic.Dictionary<Int32, System.Collections.Generic.Dictionary<Int32, string>> LookupValues = new System.Collections.Generic.Dictionary<int, System.Collections.Generic.Dictionary<int, string>>();

    while (read.Read())

    {

    ColChoices.Add( "C" + read.GetString(0), read.GetString(2));

    }

    read.Close();

    cmd = new System.Data.SqlClient.SqlCommand("SELECT * FROM [STAT_tbls_" + Request.QueryString["SID"] + "]", con);

    read = cmd.ExecuteReader();

    read.Read();

    for (int i = 0; i < read.FieldCount; i++)

    {

    if (read.GetName(i) != "CID")

    {

    string choicesText = ColChoices[read.GetName(i)];

    string[] choices = choicesText.Split(';');

    System.Collections.Generic.Dictionary<Int32, string> ChoiceValues = new System.Collections.Generic.Dictionary<int, string>();

    int c = 0;

    foreach (string choice in choices)

    {

    ChoiceValues.Add(c, choice);

    c++;

    }

    LookupValues.Add(i, ChoiceValues);

    }

    }

    System.Text.StringBuilder sb = new System.Text.StringBuilder();

    for (int i = 0; i < read.FieldCount; i++)

    {

    if (read.GetName(i) != "CID")

    {

    int val = read.GetInt32(i);

    if (val != -1)

    {

    sb.Append(read.GetName(i).Substring(1));

    }

    if (i < (read.FieldCount - 1))

    {

    sb.Append(",");

    }

    }

    }

    sb.AppendLine();

    while (read.Read())

    {

    for (int i=0; i < read.FieldCount;i++)

    {

    if (read.GetName(i) != "CID")

    {

    int val = read.GetInt32(i);

    if (val != -1)

    {

    sb.Append(LookupValues[i][val]);

    }

    if (i < (read.FieldCount - 1))

    {

    sb.Append(",");

    }

    }

    }

    sb.AppendLine();

    }

    Response.Write(sb.ToString());

    con.Close();

    Response.End();

    }

    }

     

  • Math or CS?

    I'm don't know how it works in the UK, but in the states many colleges now offer a program called "math and computer science" as a single degree.