|
Only if the size of the aligned type is less than or equal to the size of a native integer.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
No, lock operates only on reference types. If lock did accept a value type, it will get boxed. Now everytime a value type gets boxed, a new instance is created. Which means locking on it is useless, because every lock statement will lock on a new instance.
Reading and writing of value types is atomic only if the size of the aligned type is less than or equal to the size of a native integer.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Interesting... So, in order to protect a class' properties like doubles or decimals, do I need to use Mutex?
Thanks for your useful info!
|
|
|
|
|
Is it possible to create a ISAPI filter in .NET. I had gone through a couple of articles that did not seem to help me.
My purpose for this filter is, I want to block access to a site if the Request comes from certain set of IP addresses.
Is it possible using C#??
How do I go about creating one. Can some one please help me with it.
Leejo
-- modified at 3:57 Tuesday 15th November, 2005
|
|
|
|
|
Hi Folks,
I've got a bit of an irritating problem. I have a class which is a sublcass of an ArrayList. That class has an public propetry ID, which is a string. When I serialize the class the property does not get serialized. For instance I get something like this
<ArrayListSubclass>
<Item />
<Item />
</ArrayListSubclass>
But what I want is
<ArrayListSubclass ID="foo">
<Item />
<Item />
</ArrayListSubclass>
For some reason the attribute is left out, even though I mark it as an [XmlAttribute].
Any ideas why? Is there a declaration or directive I'm missing?
-- modified at 9:11 Sunday 13th November, 2005
|
|
|
|
|
How do I programmatically switch the phones profile (e.g. to silent), searched all over the web and cant find any good answers.. I’m assuming this cant be don’t via C# and has to be done via C++ unmanaged code ?
Any help would be useful, code samples would be amazing
Cant believe its so hard todo such a simple task..
Nb. Using VS2005 & Windows Mobile 5 SmartPhone SDK..
|
|
|
|
|
I'm writing an application in C# that needs to sniff
all IP packets coming into a certain server. I've
tried to create a socket, bind, listening for
connections, but I'm getting an exception when i try
to listen on the created socket. It says "the operation
is not supported on the type of object".
I tried changing how I defined the IPEndPoint, and the
SocketType and ProtocolType enumerations when creating
the socket.
Does anybody know the correct setup of the socket in
order to inspect IP packets? Not at the TCP layer, but
lower in OSI model.
Is
Here's the code.
Thx,
Tom
try
{
// Build local end point
IPAddress localAddr = IPAddress.Parse(Constants.LOCALHOST);
IPEndPoint endpoint = new IPEndPoint(localAddr, Constants.PORT);
// create new IP socket.
server = new Socket(AddressFamily.InterNetwork,SocketType.Raw,ProtocolType.IP);
// SetupSocket(server);
// Bind the socket to the local IP addr and port
server.Bind(endpoint);
// Start listening for connections, allowing for max # to be queued.
server.Listen(Constants.MAX_CONNECTION_QUEUE);
// loop until the service is stopped.
while (ServiceStarted)
{
// Wait asynchronously for connections to be accepted.
server.BeginAccept(new AsyncCallback(this.AcceptCallback), server);
// yield
if (ServiceStarted)
{
Thread.Sleep(new TimeSpan(0, 0, 5));
}
.
.
.
}
}
catch(SocketException e)
{
throw e;
}
|
|
|
|
|
AFAIK, what you are attempting to do can't be done using the .NET API as it provides only application level operations.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello!!
Whats the real difference between these two timers? I read the MSDN but didnt understand very well.
Which one is better for main UI updating (labels... etc)?
Many THANKS!!!!!
PD: all of these is refered to Compact Framework 1.1
|
|
|
|
|
The Forms timer fires on the UI thread, which means you don't have to do Invoke/BeginInvoke when updating UI controls. But because it fires on the UI, it is not very accurate and is dependent on your application not holding up the message pump.
The Thread timer runs on a threadpool thread and will therefore fire more accurately. However, you'll need to do Invoke/BeginInvoke if you're updating UI elements.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for your invaluable info!
|
|
|
|
|
I am writing a managed C++ app that must retrieve all shared public contacts from outlook. I have a list of 484 contacts - but my code retrieves always exactly 250 of them and then exceptions start occurring when converting the enumerated MAPIFolder items into ContactClass's in order to print out the details of the contacts.
Here is some of my code :
<code>
//----------------------------------
// Get Contacts
Outlook::NameSpaceClass* outlookNS = dynamic_cast<Outlook::NameSpaceClass*>(outLookApp->GetNamespace("MAPI"));
Outlook::MAPIFolder* publicFolder = outlookNS->GetDefaultFolder(Outlook::OlDefaultFolders::olPublicFoldersAllPublicFolders);
//Print out some basic info.
String* s = String::Format("You have access to {0} public Outlook folders.", __box(publicFolder->Folders->Count));
Log(s);
IEnumerator* en = publicFolder->Folders->GetEnumerator();
while(en->MoveNext())
{
Outlook::MAPIFolder* item = dynamic_cast<Outlook::MAPIFolder*>(en->Current);
if (item)
{
String* st = String::Format("-> Public Folder: {0}", item->Name);
Log(st);
if (item->Name->Equals("My Shared Contacts"))
{
//Print out contact info.
String* s = String::Format("You have access to {0} public contacts.", __box(item->Items->Count));
Log(s);
IEnumerator* i = item->Items->GetEnumerator();
int count = 0;
while (i->MoveNext())
{
if (i->Current)
{
try
{
if (count == 248)
{
Log("BANG! - from now on exceptions occur when performing conversion below");
}
Outlook::ContactItemClass* contact = dynamic_cast<Outlook::ContactItemClass*>(i->Current);
if (contact)
{
Log(String::Format("Item {0}",__box(count)));
Log(contact->ToString());
Log(contact->FileAs);
//Log(contact->LastName);
//Log(contact->Email1Address);
Log("--------------------------------");
}
}
catch(InvalidCastException* e)
{
//I end up here from item 250 onwards. why does this happen?
Log(e->Message);
}
}
count++;
}
break;
}
}
}
</code>
|
|
|
|
|
Hi,
I am working on Microsoft Visual Studio .NET 2003 VC++. I have created a solution & i am trying too build it & i am facing the following error:
LINK : warning LNK4001: no object files specified; libraries used
libcmtd.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup
Debug/MP1G.exe : fatal error LNK1120: 1 unresolved externals
When this error came i went to the properties in linker\system i changed the subsytem from Console (/SUBSYSTEM:CONSOLE) to Windows (/SUBSYSTEM:WINDOWS)
& in the advanced tab changed the entry point from mainCRTStartup to wWinMainCRTStartup.
But then the following error is coming:
LINK : warning LNK4001: no object files specified; libraries used
ibcmtd.lib(wwincrt0.obj) : error LNK2019: unresolved external symbol _wWinMain@16 referenced in function _wWinMainCRTStartup
Debug/MP1G.exe : fatal error LNK1120: 1 unresolved externals
How to solve this problem as fast as possible.
Thanks in advance
|
|
|
|
|
Is your application a console app or a GUI app? In case it's a console app, you need to define a main function which acts as the entry point for the program. For GUI apps, it depends on whether you're using MFC or not.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I just made a BIG, STUPID mistake. I deleted all the .resx and .aspx.vb files on my machine through Dreamwaver Test Server view! It will kill me to re-write all the code .
I have recently re-built the project into .DLL file before deleting those files. Is there anybody know how to decompile .DLL file to get source code back????
I also find there is a tempporary folder "_vti_cnf" under my wwwroot/project folder. In this folder, there are .aspx.vb and .RESX files. However, .aspx.vb file only contains the information like :
vti_encoding:SR|utf8-nl
vti_timelastmodified:TR| 17 Oct 2005 16:58:30 -0000
vti_extenderversion:SR| 4.0.2.8912
Could anybody help me out???
Thank you in advance!!!!!
|
|
|
|
|
I don't know exacly about ASP.
You can't decompile a DLL. You can only deassemble with a debuger in asm.
|
|
|
|
|
Luckly, I have all .aspx files. Now I am using Reflector to decompile the project .DLL file to get readable source code to reconstruct my source code....
|
|
|
|
|
1) First set up a backup system.
2) Run Reflector[^]
3) Verify your back up is running
If you skip step 1 or 3, you can as well save yourself the trouble of 2) as it is just a question of time before you loose it all again.
Notice this won't restore variable names etc.
|
|
|
|
|
I am trying to create a deployment project for a C# application that I have. In the deployment project I have added a dialog box with two checkboxes to allow the user to select if they want add a shortcut to the application on the Desktop or the Startup folder or both. So I have created shortcuts and placed them in the Desktop folder and Startup folder of the deployment project. However, according the to the Help in Visual Studio .Net I must put the value from the CheckboxProperty property in the Condition property of the file. The shortcuts that I created in Visual Studio does not have a Condition property, it has an Arguments property and a few other properties. Does anyone know how I can allow users to select where they want to place a short during installation? Thanks.
|
|
|
|
|
Well, the short answer is you cannot do this using the VS.IDE.
If you really want to do it, and I would suggest that it is not worth the trouble, you will have to manually edit the msi using Orca.
VS.IDE will put both the shortcuts - desktop and start menu - in a single component.
You can only apply a condition at the component level, not at the resource (i.e. file or shortcut) level. So you will have to create a new component to split the two shortcuts up, and then apply the checkbox condition to each separate shortcut component.
This is not a trivial task unless you have at least a reasonable knowledge of msi architecture.
|
|
|
|
|
I Have a few questions about .Net 2.0 and C# 2.0. I’m using Visual Studio 2003 and I can’t figure out how to upgrade to the new specifications. I’ve downloaded and installed “.NET Framework Version 2.0 Redistributable Package (x86)” and the “.NET Framework 2.0 Software Development Kit (SDK)(x86)” but I still don’t have access to the new classes. For exsample System.Windows.Forms.WebBrowser will not compile, nor will “partial class”. Do I have to have VS 2005 for the new specifications to work?
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
|
|
|
|
|
And what is this ClickOnce sh*t... Can't you just make an EXE anymore... Does MS realize that their way may not be the best way... Gerrr
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Well after an afternoon of fighting I figured out how to get just the exe out of c# express. Why there isn’t an option under the build menu for such a thing I’ll never know. Why it won’t run off a shared network drive I don’t know. And while more choice is always good, taking away the option to simply compile to a exe easily is very limiting.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
|
|
|
|
|
HahnTech wrote: Well after an afternoon of fighting I figured out how to get just the exe out of c# express.
I've never used the Express editions, but every time you Build the solution/project on all the other versions, you get the .EXE(s) in the bin folder of your project.
HahnTech wrote: Why it won’t run off a shared network drive I don’t know.
Because network sources are not trusted sources of executable code. Just like in Internet Explorer, if the network source is not trusted, the code is forced to run in a restricted sandbox and doesn't get access to all machines resources. This is configurable if you go into Administrative Tools and configure the permissions/trusts for either the network source or the specific application you want to run.
Try reading Code Access Security[^] on MSDN before you start bashing stuff you don't understand yet.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok so I was having a bad day with MS.. I could find the exe in the bin (on a network share) but when i would run it there was nothing said about security, only that the application has encountered a problem and needs to close. Well that’s great. In 2003 you would get a warning and have the ability to allow or disallow. At least that way you hade a change to know what was going on. I’ll worry about security when I’m working on an app that might be reassessed someday.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
|
|
|
|