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
D

DannyAdler

@DannyAdler
About
Posts
26
Topics
9
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C# and TCP
    D DannyAdler

    Hi all, Using C#, is it possible to handshake a certain remote port using only the first two steps (SYN -> SYN-ACK), and then cut-off the connection without the final third step (ACK)? The requirement is NOT to send the ACK, and as far as I understand, the Connect method of the Socket, handles all the 3 steps handshake automaticaly. So is there a way to, somehow, stop after the first two steps? Thanks in advance, Danny

    C# csharp question

  • Insert null to an image-data-typed field
    D DannyAdler

    Hi all, So you have a table "Items" with 2 fields (SQL Server 2000): Column Datatype Length Allow Nulls ------------------------------------------- ItemID int 4 0 ItemPicture image 16 1 Now you want to insert a record with the ItemID=1 and with no picture (i.e. null). So you do this (.NET 2.0): string strSQL = "insert into items (ItemID, ItemPicture) values(@ItemID, @ItemPicture)"; SqlCommand cmd = new SqlCommand(strSQL, GetDBConnection()); cmd.Parameters.AddWithValue("@ItemID", "1"); cmd.Parameters.AddWithValue("@ItemPicture", System.DBNull.Value); if (cmd.Connection.State != ConnectionState.Open) cmd.Connection.Open(); cmd.ExecuteNonQuery(); if (cmd.Connection.State != ConnectionState.Closed) cmd.Connection.Close(); And you get an exception: "Operand type clash: nvarchar is incompatible with image". Question: So how can you insert a null value to an image field? Thanks in advance, Danny

    C# question csharp database sql-server sysadmin

  • Check if a Bitmap has tranparency
    D DannyAdler

    Okay, so maybe my approach is wrong.. Situation: The user opened an image file, and I load it to a Bitmap, but I don't know if the image has some transparent regions. Now, regardless to the original user's image file's format, I want to save the image to disk, Image.Save (String, ImageFormat). So if the original image had some transparent regions, I would want to use an ImageFormat that has support for transparency (png/gif), and if there were no transparent regions, I would use Jpeg. Questions: Does this requirement make sense? How can I handle this kind of situation? Thanks, Danny

    C# question graphics

  • SQL Server pool size
    D DannyAdler

    No code... Just by running your query on the Enterprise Manager and on the Query Analizer apps. Maybe it's a version thing. Danny

    C# csharp database sql-server sysadmin question

  • SQL Server pool size
    D DannyAdler

    Found it on this dude's blog: http://sqljunkies.com/WebLog/sqldude/archive/2004/06/14/3146.aspx[^] Quoting: Now to obtain the current number of connections to the server, you can use: SELECT COUNT(*) AS CONNECTIONS FROM master..sysprocesses And just to get the user connections, omitting the system processes, use: SELECT cntr_value AS User_Connections FROM master..sysperfinfo as p WHERE p.object_name = 'SQLServer:General Statistics' And p.counter_name = 'User Connections' Thanks anyway. Danny

    C# csharp database sql-server sysadmin question

  • SQL Server pool size
    D DannyAdler

    Thanks for the reply man. Here's the query result: Invalid object name 'sys.dm_exec_connections'. Using SQL Server 2000... Any idea? Danny

    C# csharp database sql-server sysadmin question

  • SQL Server pool size
    D DannyAdler

    Hi all, Is there a C# way for retrieving the number of currently opened sql-connections? Thanks in advance, Danny

    C# csharp database sql-server sysadmin question

  • Check if a Bitmap has tranparency
    D DannyAdler

    Hi all, So I have a Bitmap field, now I want to save it to disk, BUT if it has some transparent pixels, I want to save it as a gif, else save as jpg. Sounds reasonable? How can I do that? Thanks in advance, Danny

    C# question graphics

  • C# marquee control needed
    D DannyAdler

    Hi there, Found this the other day: http://www.codeproject.com/KB/miscctrl/csmarquee.aspx?df=100&forumid=14623&exp=0&select=424537[^] Danny

    C# csharp help question

  • Comparing dates
    D DannyAdler

    Thanks man. Good info. Danny

    C# database c++ help tutorial question

  • Comparing dates
    D DannyAdler

    Paul Conrad wrote:

    You should not use string concatenation since it opens you up to sql injection attacks.

    Hi there Paul, Please explain your statement. Thanks in advance. Danny

    C# database c++ help tutorial question

  • TableLayoutPanel and Getting a Cell by Mouse position
    D DannyAdler

    Hi there, What I would do is to create inside each cell a full-docked control, like an empty label, then on the TableLayoutPanel DragDrop event I'd get the cell by the position of the control: private void tableLayoutPanel1_DragDrop(object sender, DragEventArgs e) { Point p = tableLayoutPanel1.PointToClient(new Point(e.X, e.Y)); Control c = tableLayoutPanel1.GetChildAtPoint(p); TableLayoutPanelCellPosition cellPos = tableLayoutPanel1.GetCellPosition(c); } Try it, it's working. The cell that gets the drop is reprisented by cellPos.Row and cellPos.Column Hope that help. Danny

    C# question

  • String data into byte array without hex conversion
    D DannyAdler

    private byte[] StringToByteArray(string str) { char[] chars = str.ToCharArray(); byte[] bytes = Array.ConvertAll<char, byte>(chars, new Converter<char, byte>(CharToByte)); return bytes; }

    C# question data-structures

  • String data into byte array without hex conversion
    D DannyAdler

    Sorry, I guess the pasting went wrong, the function should look like this: private byte[] StringToByteArray(string str) { char[] chars = str.ToCharArray(); byte[] bytes = Array.ConvertAll<char, byte>(chars, new Converter<char, byte>(CharToByte)); return bytes; }

    C# question data-structures

  • String data into byte array without hex conversion
    D DannyAdler

    Hi there, Maybe this will put you in the right track: string StringToConvert = "abc"; //This call will return a byte array with the numeric values of the chars byte[] bytes = StringToByteArray(StringToConvert); private byte[] StringToByteArray(string str) { char[] chars = str.ToCharArray(); byte[] bytes = Array.ConvertAll(chars, new Converter(CharToByte)); return bytes; } private byte CharToByte(char ch) { return (byte)ch; } Hope it helps. Danny

    C# question data-structures

  • DataList item command
    D DannyAdler

    Hi there, There are probably a few ways for doing that. I use a switch: protected void DataGrid1_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName) { case "Edit": //do somthing break; case "Delete": //do somthing break; } } Hope it helps. Danny

    C# question

  • Bitmap file size
    D DannyAdler

    Hey Luc, I figured I can use a memory stream, that was my first try, before posting in this forum, but now I got it to work, I didn't understand the use of the ImageFormat, and now I do. #4 is a great idea, and I've implemented it. Thanks man. Danny

    C# csharp graphics question

  • Bitmap file size
    D DannyAdler

    Vasudevan Deepak K wrote:

    Wouldn't using a Temp File be more cleaner approach?

    Thanks for you quick response. Yes it would, BUT, I'm trying to limit a Bitmap to a certain file size, say 50kb, so my solution was to loop through the bitmap's dimmensions, while each iteration is scaling the bitmap down. Now, inside this loop, using IO-write to the disk would be pretty slow... Any other idea? Danny

    C# csharp graphics question

  • Bitmap file size
    D DannyAdler

    Hi all, Is there a way for checking the file size of a Bitmap without saving it to disk (using C#)? Thanks in advance, Danny

    C# csharp graphics question

  • How to prevent cnt+f4 key,,,?
    D DannyAdler

    Two things I can think of: 1. After setting the KeyPreview property to true, ALL the key-down events will first go through this function. 2. The CTRL-F4 will never work on that window, as long as the key-down is supressed in the if statement. Just to keep in mind. Danny

    C# csharp game-dev tutorial question
  • Login

  • Don't have an account? Register

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