Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
Z

zlezj

@zlezj
About
Posts
17
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Parallelizing code the easy (er) way
    Z zlezj

    Can you share these more complete versions, or do we really have to wait for you to wrie an article?

    Clever Code csharp tutorial

  • Update silverlight xap file
    Z zlezj

    OK, here's an extended version. This code appends the file date/time to the XAP file name. This way you'll keep the caching of already loaded XAP files and you don't have to remember to change the number...

    <%@ Page Language="C#" AutoEventWireup="true" %>
    <script runat="server">
    protected override void OnLoad(EventArgs e)
    {
    base.OnLoad(e);

        const string XAP = "ClientBin/XapFile.xap";
        System.IO.FileInfo fi = new System.IO.FileInfo(Request.MapPath("./" + XAP));
        string timeStampXAP = fi.LastWriteTime.ToString("yyyyMMdd\_HHmmss");
        source.Text = String.Format("<param name=\\"source\\" value=\\"{0}?{1}\\" />", XAP, timeStampXAP);
    }
    

    </script>
    <%@ OutputCache Duration="1" VaryByParam="None" Location="None" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Test</title>
    <style type="text/css">
    html, body {
    height: 100%;
    overflow: auto;
    }
    body {
    padding: 0;
    margin: 0;
    }
    form {
    height: 100%;
    }
    #host {
    height: 100%;
    text-align:center;
    }
    </style>
    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript">
    window.onload = function()
    {
    document.getElementById('host').focus();
    }

        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
                appSource = sender.getHost().Source;
            }
    
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
    
            if (errorType == "ImageError" || errorType == "MediaError") {
                return;
            }
    
            var errMsg = "Unhandled Error in Silverlight Application " + appSource + "\\n";
    
            errMsg += "Code: " + iErrorCode + "    \\n";
            errMsg += "Category: " + errorType + "       \\n";
            errMsg += "Message: " + args.ErrorMessage + "     \\n";
    
            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \\n";
                errMsg += "Line: " + args.lineNumber + "     \\n";
                errMsg += "Position: " + args.charPosition + "     \\n";
            }
    
    WPF help announcement

  • Update silverlight xap file
    Z zlezj

    The old XAP file probably lingers on somewhere in a cache. You could try to rename the XAP file, or add a random number in the source parameter of the object tag like <param name="source" value="XapFile.xap?12345"/>

    WPF help announcement

  • Try to find something dumber if you can...
    Z zlezj

    Do you mean the SQL injection vulnerability, the fact that data is stored in the session object or that you don't like this kind of validation?

    The Weird and The Wonderful database

  • I don't want to know the code behind this...
    Z zlezj

    From the Visual SourceSafe documentation[^]: Visual SourceSafe defines a label as a string of up to 31 characters. Any of the following is a valid label: "1.0", "2.01b", "Final Beta", and "Approved for QA". Label names cannot start with a capital "L" or "#s". At least it's documented...

    The Weird and The Wonderful beta-testing visual-studio com

  • Beware of macros!
    Z zlezj

    Thatswhy I always use braces when using if/while/for statements. On the other hand: all multi-line macros could be defined inside a do { ... } while (0) block. This prevents problems like the one mentioned and works correctly with semicolons

    Clever Code c++ help

  • Retrieve the PK after an add into an in memory DataTable
    Z zlezj

    Not possible.

    C# question csharp database performance help

  • Debugging SQL
    Z zlezj

    Yep, that was causing the problems

    Clever Code database sql-server sysadmin

  • Debugging SQL
    Z zlezj

    I usually don't use the like operator and I always trim my strings before storing them in a database, so I never ran into this. If this scenario was in a developers-quiz, I wonder: how many developers would answers this question correct?

    Clever Code database sql-server sysadmin

  • Debugging SQL
    Z zlezj

    I found this subtlety while debugging some SQL Server code. The first SELECT statement yields 2 rows, the second only 1, the third 2. Frankly: I expected the first two resultsets to be the same...

    CREATE TABLE test (
    value NVARCHAR(10)
    )
    GO

    INSERT INTO test(value) VALUES('0000001');
    INSERT INTO test(value) VALUES('0000001 ');
    GO

    SELECT * FROM test WHERE value='0000001'
    SELECT * FROM test WHERE value LIKE '%1'
    SELECT * FROM test WHERE value LIKE '%1%'
    GO

    DROP TABLE test
    GO

    Clever Code database sql-server sysadmin

  • Silverlight & Windows
    Z zlezj

    Use WPF

    WPF winforms question

  • I have no name, I don't exist
    Z zlezj

    There was, but it has been renamed to Wicked Code. See http://www.codeproject.com/Feature/WickedCode.aspx?msg=3041439#xx3041439xx[^]

    The Weird and The Wonderful c++ com algorithms debugging performance

  • I have no name, I don't exist
    Z zlezj

    Why do you classify this as a coding horror? I would say this is more like a subtle bug...

    The Weird and The Wonderful c++ com algorithms debugging performance

  • Who is teaching these people?
    Z zlezj

    It's a pity that this scheme for line-numbering does not work

    The Weird and The Wonderful csharp question com help

  • Dynamically ENUM
    Z zlezj

    Try using T4 Look here[^] to get you started.

    C# database question

  • Code reuse
    Z zlezj

    I guess the programmer of the snippet below found a function to fill a DropDownList and adjusted it just enough to fill a TextBox...

    Private Sub ShowName(ByVal id As String)

    Dim daNames As New SqlDataAdapter("SELECT ID, NAME FROM TBL\_NAMES", ConnectionString)
    
    Dim dsNames As New DataSet("NAMES")
    daNames.Fill(dsNames, "NAMES")
    
    Dim drNames As DataRow = dsNames.Tables(0).NewRow
    drNames("ID") = -1
    drNames("NAME") = ""
    
    dsNames.Tables(0).Rows.InsertAt(drNames, 0)
    
    If dsNames.Tables("NAMES").Rows.Count > 0 Then
    	Try
    		Dim drs() As DataRow = dsNames.Tables(0).Select("ID = " & id)
    		txtName.Text = drs(0).Item("NAME").ToString
    	Catch e As Exception
    		'
    	End Try
    Else
    	txtName.Text = ""
    End If
    

    End Sub

    The Weird and The Wonderful

  • There are errors and errors...
    Z zlezj

    From one of the articles on this very website a description of a function named Open: Opens an existing WAV file. Returns a String, which will be blank upon success, and upon error, will contain the reason it failed. This method will throw an exception for a more serious error.

    The Weird and The Wonderful help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups