|
-
You know it's true
Date: 02/03/06
Keywords: no keywords
There is no use fighting it. Waterfall is back!
http://www.waterfall2006.com/
Source: http://community.livejournal.com/csharp/48885.html
-
Code analysis tool
Date: 02/01/06
Keywords: no keywords
Hello guys,
I am looking for code analysis tool for C#, something like Compuware DevPartner provides, but hopefully better. Can somebody recommend anything?
Source: http://community.livejournal.com/csharp/48575.html
-
So yeah... stuff is hard
Date: 01/26/06
Keywords: no keywords
The method:
protected unsafe bool getBinaryAt(int x, int y, BitmapInfo img)
{
fixed (byte* scan0 = &img.pixelData[0])
{
byte pval = 0;
byte* pos = scan0 + y * img.Stride + x * getByteSize(img.Format);
pval = (byte)((*pos + *(pos + 1) + *(pos + 3)) / 3);
return (pval > THRESH);
}
}
The problem:
"AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
You know what I hate more than anything right now? AccessViolationExceptions. I apparently don't know what I'm doing when it comes to working with images.
Edit: Now with a question!!
Is accessing an array element via pointer arithmetic faster than accessing it using [] syntax in C#? I ask because I'm trying this about 3 million times per second.
Source: http://community.livejournal.com/csharp/48101.html
-
some marshalling questions
Date: 01/25/06
Keywords: no keywords
Okay, this sort of crosses between C# and Managed C++, but it's valid either way. Here goes.
I'm working on the application side of a project (the other side is the hardware stuff). The hardware is used to interface with stuff across a connection. It uses a struct something like this to move info to and from the app:
struct COMMAND_MSG { int msgID; int msgLength; char *opCodes; short range; };
Pretty simple. So, on the app side, I define a matching .NET type:
__value __gc public struct M_COMMAND_MSG { System::Int32 msgID; System::Int32 msgLength; System::Byte opCodes[]; System::Int16 range; };
Here's where the problem comes in. I can't figure out how to marshal this type so that an unmanaged function could map it into the unmanaged struct type. Marshaling the type into a buffer I can pass as a void* is pretty simple, normally, involving something of this ilk:
IntPtr buffer = Marshal::AllocHGlobal(64); Marshal::StructureToPtr(__box(testStruct), buffer, true);
That gives me a buffer that I can shoot to an unmanaged function (as buffer.ToPointer()). But with that array, something isn't happening properly. When the buffer gets to the unmanaged function, the unmanaged type isn't mapped correctly.
What am I doing wrong?
DC
Source: http://community.livejournal.com/csharp/47782.html
-
Drawing a line on a form.
Date: 01/17/06
Keywords: no keywords
This is probably an incredibly dumb question, but for the life of me I can't find it in the help. I'm probably using the wrong search terms.
I'm using C# 2005 Express Edition. Putting together a Windows form that has three separate sections. I'd like to draw a simple horizontal line, like a separator, between each section, but I can't for the life of me figure out how.
Anyone?
Thanks.
Source: http://www.livejournal.com/community/csharp/47596.html
-
Drawing a line on a form.
Date: 01/17/06
Keywords: no keywords
This is probably an incredibly dumb question, but for the life of me I can't find it in the help. I'm probably using the wrong search terms.
I'm using C# 2005 Express Edition. Putting together a Windows form that has three separate sections. I'd like to draw a simple horizontal line, like a separator, between each section, but I can't for the life of me figure out how.
Anyone?
Thanks.
Source: http://community.livejournal.com/csharp/47596.html
-
synchronization attribute
Date: 01/11/06
Keywords: no keywords
Let's say we have method like this:
void DoIt()
{
lock (this) { DoItSafe(); }
} Is there an attribute/keyword that, when applied to method DoIt, make it lock the instance without using lock inside? Like this:
[MagicAttributeOrKeyword]
void DoIt() // works the same as the first snippet
{
DoItSafe();
}
Source: http://www.livejournal.com/community/csharp/47258.html
-
synchronization attribute
Date: 01/11/06
Keywords: no keywords
Let's say we have method like this:
void DoIt()
{
lock (this) { DoItSafe(); }
} Is there an attribute/keyword that, when applied to method DoIt, make it lock the instance without using lock inside? Like this:
[MagicAttributeOrKeyword]
void DoIt() // works the same as the first snippet
{
DoItSafe();
}
Source: http://community.livejournal.com/csharp/47258.html
-
LIB oddity
Date: 01/09/06
Keywords: microsoft
Whenever I try to compile a C# file from Visual Studio Express 2005, I get a warning:
"Invalid search path 'C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\' specified in 'LIB environment variable' -- 'The system cannot find the path specified. '"
Well, not surprising, as VS2005 is supposed to be using v2.x, I would have thought. But where do I change the library path? The projects don't have any library path specified, so it must be a global setting somewhere, but where?
TIA,
Tim
Source: http://www.livejournal.com/community/csharp/47014.html
-
LIB oddity
Date: 01/09/06
Keywords: microsoft
Whenever I try to compile a C# file from Visual Studio Express 2005, I get a warning:
"Invalid search path 'C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Lib\' specified in 'LIB environment variable' -- 'The system cannot find the path specified. '"
Well, not surprising, as VS2005 is supposed to be using v2.x, I would have thought. But where do I change the library path? The projects don't have any library path specified, so it must be a global setting somewhere, but where?
TIA,
Tim
Source: http://community.livejournal.com/csharp/47014.html
-
№6 журнала Алгоритм
Date: 01/09/06
Keywords: no keywords
Вышел №6 журнала "Алгоритм", посвященного платформе .Net. Ссылки для скачивания в моём журнале.
Source: http://www.livejournal.com/community/csharp/46598.html
-
№6 журнала Алгоритм
Date: 01/09/06
Keywords: no keywords
Вышел №6 журнала "Алгоритм", посвященного платформе .Net. Ссылки для скачивания в моём журнале.
Source: http://community.livejournal.com/csharp/46598.html
-
Database insert parameters.
Date: 01/09/06
Keywords: database, sql
Okay, I'm stumped.
I'm using Intersystems Cache, for which there seem to be no peer help fora anywhere on the net, though theoretically it shouldn't matter, should it? ODBC is ODBC, I hope. In any case, here's a quick code snippet:
private void btnSave_Click(object sender, EventArgs e)
{
try
{
string InsertString = "INSERT INTO Erasmus.Publisher(Name, PublisherURL) VALUES(@Name,@URL)";
ErasmusTransaction = ErasmusConnection.BeginTransaction(IsolationLevel.ReadCommitted);
ErasmusInsertCommand = new OdbcCommand(InsertString, ErasmusConnection, ErasmusTransaction);
OdbcParameter prmName = new OdbcParameter();
prmName.Direction = ParameterDirection.Input;
prmName.OdbcType = OdbcType.VarChar;
prmName.Value = txtName.Text;
prmName.ParameterName = "@Name";
ErasmusInsertCommand.Parameters.Add(prmName);
I've also tried it with:
private void btnSave_Click(object sender, EventArgs e)
{
try
{
string InsertString = "INSERT INTO Erasmus.Publisher(Name, PublisherURL) VALUES(@Name,@URL)";
ErasmusTransaction = ErasmusConnection.BeginTransaction(IsolationLevel.ReadCommitted);
ErasmusInsertCommand = new OdbcCommand(InsertString, ErasmusConnection, ErasmusTransaction);
ErasmusInsertCommand.Parameters.Add("@Name", OdbcType.VarChar, 100).Value = txtName.Text;
(hope that formats right.)
Just before we get to the actual query, I've got a messagebox showing ErasmusInsertCommand.CommandText. "@Name" and "@URL" are not switched with the contents of the text boxes on the form (though in all honesty I'm not sure if they should be; perhaps I should be checking the parameter values?). The transaction is rolled back, because the insert command fails. The beginning of the error message (I don't get the whole thing in the message box) is:
ERROR [42000][Cache ODBC][State:37000][Native Code 12] [C:\Documents and Settings\[etc.]] [SQLCODE: -12: A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHALP, %EXACT, %SQLSTRING, %SQLUPPER, %STRING, or %UPPER] [Cache Error: SYNTAXerrdone+1^%qaqqt] [Details: Prepare]
I've left out some greater-than and less-than symbols in order not to confuse LJ.
Despite what I see in the error message, I am hoping against hope this is a generic error message, and someone's gotten it on another database (or that someone here works with Cache). All I get from the Intersystems docs about is is an error reference that gives me the same message, and not what I can do about it. If anyone has any ideas, I'm at my wits' end with this...
oh, yeah: C# 2005 Express Edition, .Net 2.0.
Thanks.
Source: http://www.livejournal.com/community/csharp/46500.html
-
Database insert parameters.
Date: 01/09/06
Keywords: database, sql
Okay, I'm stumped.
I'm using Intersystems Cache, for which there seem to be no peer help fora anywhere on the net, though theoretically it shouldn't matter, should it? ODBC is ODBC, I hope. In any case, here's a quick code snippet:
private void btnSave_Click(object sender, EventArgs e)
{
try
{
string InsertString = "INSERT INTO Erasmus.Publisher(Name, PublisherURL) VALUES(@Name,@URL)";
ErasmusTransaction = ErasmusConnection.BeginTransaction(IsolationLevel.ReadCommitted);
ErasmusInsertCommand = new OdbcCommand(InsertString, ErasmusConnection, ErasmusTransaction);
OdbcParameter prmName = new OdbcParameter();
prmName.Direction = ParameterDirection.Input;
prmName.OdbcType = OdbcType.VarChar;
prmName.Value = txtName.Text;
prmName.ParameterName = "@Name";
ErasmusInsertCommand.Parameters.Add(prmName);
I've also tried it with:
private void btnSave_Click(object sender, EventArgs e)
{
try
{
string InsertString = "INSERT INTO Erasmus.Publisher(Name, PublisherURL) VALUES(@Name,@URL)";
ErasmusTransaction = ErasmusConnection.BeginTransaction(IsolationLevel.ReadCommitted);
ErasmusInsertCommand = new OdbcCommand(InsertString, ErasmusConnection, ErasmusTransaction);
ErasmusInsertCommand.Parameters.Add("@Name", OdbcType.VarChar, 100).Value = txtName.Text;
(hope that formats right.)
Just before we get to the actual query, I've got a messagebox showing ErasmusInsertCommand.CommandText. "@Name" and "@URL" are not switched with the contents of the text boxes on the form (though in all honesty I'm not sure if they should be; perhaps I should be checking the parameter values?). The transaction is rolled back, because the insert command fails. The beginning of the error message (I don't get the whole thing in the message box) is:
ERROR [42000][Cache ODBC][State:37000][Native Code 12] [C:\Documents and Settings\[etc.]] [SQLCODE: -12: A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHALP, %EXACT, %SQLSTRING, %SQLUPPER, %STRING, or %UPPER] [Cache Error: SYNTAXerrdone+1^%qaqqt] [Details: Prepare]
I've left out some greater-than and less-than symbols in order not to confuse LJ.
Despite what I see in the error message, I am hoping against hope this is a generic error message, and someone's gotten it on another database (or that someone here works with Cache). All I get from the Intersystems docs about is is an error reference that gives me the same message, and not what I can do about it. If anyone has any ideas, I'm at my wits' end with this...
oh, yeah: C# 2005 Express Edition, .Net 2.0.
Thanks.
Source: http://community.livejournal.com/csharp/46500.html
-
.NET framework 2.0 with VS2003
Date: 01/06/06
Keywords: no keywords
hi, I'm using VS2003 at the moment and would like to use .NET 2.0. Is there anything special I need to do on VS after installing the redistributable and the SDK?
Source: http://www.livejournal.com/community/csharp/45953.html
-
.NET framework 2.0 with VS2003
Date: 01/06/06
Keywords: no keywords
hi, I'm using VS2003 at the moment and would like to use .NET 2.0. Is there anything special I need to do on VS after installing the redistributable and the SDK?
Source: http://community.livejournal.com/csharp/45953.html
-
File upload control issues with ASP.NET (playing with fire)
Date: 01/03/06
Keywords: html, asp, security, web
Heya all,
I'm working on a web-based application (using ASP.NET and C# on .NET 1.1.4322, supporting only IE6 for Windows) that allows for file uploads. It seems to be a universally agreed that the file upload control is as ugly as they come, so I want to set its style to "display: none;" and interact only with the standard file upload dialog (which can be summoned by firing the click() method of the control, which is exposed under IE6 but not recent versions of Mozilla).
Attempting programmatic access of a file upload control is generally playing with fire, and this time is apparently no exception. Once I call the click() method, it seems, the page is no longer able to post back. When I attempt to submit the form, the value of the file upload control is cleared and the page just sits there. However, if I make the file upload control visible and manually click its "Browse..." button, the page posts back correctly.
For those of you familiar with Gmail's attachment upload interface, this is very close to the effect I am trying to achieve, but something about ASP.NET is apparently interfering (perhaps for my own protection) with the process. Has anybody experienced similar behavior under the same platform, and if so, explain the behavior or point to a KB article or security documentation that might be enlightening ?
Thanks greatly for your time. Toy code can be found after the cut.
Codeahead:
<%@ Page language="c#" Codebehind="Foo.aspx.cs" AutoEventWireup="false" Inherits="FooApp.Foo" %>
Codebehind:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace FooApp
{
public class Foo : System.Web.UI.Page
{
protected HtmlInputFile f;
protected HtmlGenericControl s;
private void Page_Load(object sender, System.EventArgs e)
{
if (this.IsPostBack)
{
s.InnerText = String.Format("{0} file(s) posted", Request.Files.Count);
if (1 == Request.Files.Count) { s.InnerText += String.Format(", content length: {0}", Request.Files[0].ContentLength); }
}
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
}
Source: http://www.livejournal.com/community/csharp/45787.html
-
File upload control issues with ASP.NET (playing with fire)
Date: 01/03/06
Keywords: html, asp, security, web
Heya all,
I'm working on a web-based application (using ASP.NET and C# on .NET 1.1.4322, supporting only IE6 for Windows) that allows for file uploads. It seems to be a universally agreed that the file upload control is as ugly as they come, so I want to set its style to "display: none;" and interact only with the standard file upload dialog (which can be summoned by firing the click() method of the control, which is exposed under IE6 but not recent versions of Mozilla).
Attempting programmatic access of a file upload control is generally playing with fire, and this time is apparently no exception. Once I call the click() method, it seems, the page is no longer able to post back. When I attempt to submit the form, the value of the file upload control is cleared and the page just sits there. However, if I make the file upload control visible and manually click its "Browse..." button, the page posts back correctly.
For those of you familiar with Gmail's attachment upload interface, this is very close to the effect I am trying to achieve, but something about ASP.NET is apparently interfering (perhaps for my own protection) with the process. Has anybody experienced similar behavior under the same platform, and if so, explain the behavior or point to a KB article or security documentation that might be enlightening ?
Thanks greatly for your time. Toy code can be found after the cut.
Codeahead:
<%@ Page language="c#" Codebehind="Foo.aspx.cs" AutoEventWireup="false" Inherits="FooApp.Foo" %>
Codebehind:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace FooApp
{
public class Foo : System.Web.UI.Page
{
protected HtmlInputFile f;
protected HtmlGenericControl s;
private void Page_Load(object sender, System.EventArgs e)
{
if (this.IsPostBack)
{
s.InnerText = String.Format("{0} file(s) posted", Request.Files.Count);
if (1 == Request.Files.Count) { s.InnerText += String.Format(", content length: {0}", Request.Files[0].ContentLength); }
}
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
}
}
Source: http://community.livejournal.com/csharp/45787.html
-
C# Windows Mobile help
Date: 01/01/06
Keywords: no keywords
I’m creating a windows mobile app in C# with Visual Studio 2005. I’ve made myself a button on the main form and need that button to open a new form how do I do that?
Also what are some good starter tutorials?
Source: http://www.livejournal.com/community/csharp/45456.html
-
C# Windows Mobile help
Date: 01/01/06
Keywords: no keywords
I’m creating a windows mobile app in C# with Visual Studio 2005. I’ve made myself a button on the main form and need that button to open a new form how do I do that?
Also what are some good starter tutorials?
Source: http://community.livejournal.com/csharp/45456.html
|