For anyone who was planning to participate today: The monthly C++\C# user group meeting will not take place today!
Question: Why weren't we updated about this? Since the user group website never updates on time, people don't count on it.
I just hope nobody goes all the way there to find out that the meeting was canceled.
Roy Osherove blogs about “Pen and Paper” interviews.
Personally, I don't like paper or whiteboard programming: My handwriting is not very neat, and I find it hard to write in straight lines on a whiteboard. However, it is a good skill to acquire, since it is used very widely in interviews. It is good to practice writing simple/short programs on a piece of paper before attending an interview. You can always ask to do a test in front of a computer (Tip: why not bring your own laptop? This way you could also bring an example of your coding, and guide the interview towards past written code, if necessary)
Although I agree that pen and paper interviews is not the best way to test technical capabilities (I hate programming “tests“ that are not taken not in front of a computer) they can be used for some purposes:
1. To test basic capabilities: Does a person write comments in his code, adherence to naming and other guidelines and best practices.
2. For writing very short programs: (e.g., implement a singleton class)
3. To ask - What's wrong with this code snippet?
4. For a first screening - to make sure the candidate has the minimal requirements. However, I would make sure the test doesn't check stuff a developer doesn't need to memorize and could find in a second using intellisense and an object browser, but check coding skills in general.
Also, sometimes a test is done without a computer for practical reasons: the interview is conducted in a room where there is no development environment, such as a conference room, or a HR office.
So, although I would opt for a computer test if I were interviewing someone else, I would still prepare for whiteboard/paper interviews since they aren't going to disappear.
When I work on a project that is bounded to Visual Source Safe, I sometimes
want to edit a file locally, i.e. without checking out the change. The visual
studio source safe addin monitors which files I can work on according to their
attributes. If a file has the read only attribute, it cannot be worked on
without checking out the file, or removing the attribute.
This can be done manually from outside of the Visual Studio.NET or from
within, but this takes a few extra clicks.
This can be automated as a menu command or toolbar button by following these
steps:
(To create menu command)
1. Click on: Tools -> External Tools...
2. Click on Add button
3. In the Title textbox enter: Remove Read Only
4. In the Command textbox enter: attrib.exe
5. In the Title textbox enter: -R
$(ItemPath)""
No, "" is not a mistake, it seems like a bug in the IDE.
6. Check Close on Exit checkbox , and uncheck Use
Output Window and Prompt for arguments.
7. Click the OK button
Now you can open a file and Click Tools -> Remove Read Only, and you can
start using the file!
(To add command to toolbar:)
8. Click Tools -> Customize
9. Click New button
10. Name new toolbar. (for this example we will call it Custom Utilities)
11. Leaving the customize window open, Click Tools ->Remove Read Only, and
drag it to the Custom Utilities Toolbar.
12. Add Custom Utilities to the other toolbars.
You can also add icons and choose other options by right-clicking the
button while customize window is open.
13. Close customize window.
And that's it.
For those of you who might ask, I added the "" in instruction #5, because
otherwise for some reason the IDE only added an opening " before the filename.
(the final command can be seen by checking the Prompt for arguments button in
the External Tools menu.)
As other bloggers have already mentioned, Microsoft has just unveiled
announced Visual Studio Team Studio 2005.
This tool is used to help define, build, and test software projects, and all
can be done from within Visual Studio.
The things I thought most useful from this product:
Unit Testing integrated into project, including code coverage of tests
and reporting of results.
Binding of source safe with policy and work Items (e.g., assigning a check-in
to a bug)
FxCop integration with visual studio
I know that most of the stuff can be done today, using 3rd party
software. This product may not be a good thing from the perspective of
these companies, but from the perspective of a developer this is very good for
many reasons:
- Better integration with Visual Studio.
- Better integration with other Microsoft products which are used by many
teams such as: Visual Source Safe and Microsoft Project.
- Creates common working standards.
- Costs lest. Not every company has an open budget for buying developer
tools (Even if they are proved to save time and money).
- Will enable better work practices. e.g., running FxCop and Unit Tests with
every build.
To learn more about Visual Studio Team Studio 2005:
FAQ:
http://msdn.microsoft.com/vstudio/teamsystem/burtonfaq.aspx
Demo Video's:
http://www.activewin.com/awin/comments.asp?HeadlineIndex=24465
I am in the middle of a task to write a bridge component between the managed components and application written in C#, and the Algorithms DLL's written in (Unmanaged C++). Since performance is very important, I opted for the IJW option.
According to the literature, this should be very simple, after all “It Just Works”.
However, this turns out to be not simple at all.
First of all, I had to recompile the Algorithm DLL's with Visual Studio .NET 2003.
Since the C++ compiler is more ANSI-standard, the code didn't compile and link without changes. Some of these changes were:
1. ifstream has changed and ios::nocreate is deprecated. So I had to use a hack, opening the file in read mode and then closing it and reopening in write mode.
2. Objects that are const, and are passed into a method by reference had to be casted to the non-const object (e.g. const Model to (Model&)).
3. When a function is overloaded, explicit casting was required.
for example (compile error: )
error C2668: 'floor' : ambiguous call to overloaded function
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\math.h(604): could be 'long double floor(long double)'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\math.h(556): or 'float floor(float)'
d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\math.h(209): or 'double floor(double)'
while trying to match the argument list '(int)'
I'm not saying these thing are bad, they are very good to be forced on new code, however it means that code can't be used so easily without changes, and it is sometimes difficult to change old legacy code without breaking changes. (No the code does not have unit tests).
After getting the code to compile (without the CLR flag) in the unmanaged form, I wanted to compile it with in the managed form and to created a managed wrapper for the interface I wanted to create.
After some more IDE wrestling, I got the $$^$@^(@!# Dll to compile and link and was able to reference it from my C# project.
However, I started getting link warnings such as: '.CRT section exists; there may be unhandled static initializes or teminators'
and runtime errors such as: Assertion Failed! (_CrtIsValidHeapPointer(pUserData)).
It turns out that there is a possible bug when using mixed dll's: (quoting from Microsoft document) Applications using mixed DLL's, a combination of both native and Microsoft Intermediate Language (MSIL) DLLs, created with the Visual C++® .NET and Visual C++ .NET 2003 compiler can encounter deadlock scenarios under some circumstances while being loaded. (links at the end)
Applications using mixed DLL's, a combination of both native and Microsoft Intermediate Language (MSIL) DLLs, created with the Visual C++® .NET and Visual C++ .NET 2003 compiler can encounter deadlock scenarios under some circumstances while being loaded.
It looks like I will have to dive into the C++ code (“So you thought you left me behind, huh? You can't get rid of me so fast. Ha, ha ha“ said the C++ devil in my mind). At least I get to learn how to use C++ with Managed Extensions.
Conclusion: IJW is a marketing term. Things don't just work so easily. While you can probably use unmanaged code from managed code, it's not as easy as it may seem.
Mixed DLL Loading Problem
How Can You Migrate your Existing Applications?
Article about Porting of Quake II game - mentions problems above.
Sql Server 2005: .NET Framework-based Programming in the Database - Hans Verbeek
Hans talked and demonstrated how to use the .NET CLR which is hosted in Yukon and the trade offs between writing code in .NET vs. T-SQL.
Although I'm not a DBA, it was very interesting.
Download Presentation
An overview for Indigo for Developers- Shy Cohen, Indigo Program Manager
Shy gave a peek into Indigo and what it means.
Bottom line: to be best prepared for merging application into Indigo, use .NET Enterprise Services
Architects Panel
The most interesting event I attended. I really hope it was recorded, although it seems it wasn't.
The panel discusses various architectural issues such as: .NET languages, Object Spaces ORM and relational databases, Microsoft and the enterprise market,
Mono, Patterns & Practices and more.
This post was written after the Teched was finished
What's new in .NET 2.0 for The Developer
Generics in the CLR 2.0
- both presented by Juval Lowy. Very interesting peak at the near future. If you don't know what generics are, you better start reading about it, because generics is the feature that will narrow the gap in performance between managed and unmanaged code.
BTW, for those who are asking why the edit and continue feature was not implemented in C#, opposed to VB.NET:
Juval let out a secret. He sits on a board which decides which features to add to the C# language and compiler.
Every attendant gets a number of points, and he can give any number of these points for any feature he believes is important. The features with the most points get implemented. The last time the board took a vote, the edit and continue feature got 0 points, which means it probably won't become implemented in the feature, unless a lot of pressure is applied by developers and clients.
Juval went on to demonstrating the difference between VB.NET and C#:
As opposed to VB.NET where a programmer typically starts coding away, then running and editing on the fly, in C# the developer spends most of the time thinking: maybe we should do it this way ... but then again maybe we should do it that way.
Although this is exaggerated of course, Juval's point was that disabling edit and continue leads to better design.
On the other hand, .NET is all about productivity.
What do you think?
XML with performance in mind
In a very good presentation, Yair Shivak presented the new XML XPath 2.0, which will give the XPath power with the performance of the 1.1 XmlReader
bottom line of presentation was: If you haven't been using XML in your applications yet, it's now the time to learn how, and in CLR 2.0 it will be even easier, and the performance will be much better too.
Scalability
presented by Clemens Vasters, this was an architectural talk about scalability and the different ways to scale an application, with examples from the real world such as how Hotmail, Google, Ebay and Amazon scale.
Here are my impressions of my first day at Teched:
1. The organization is excellent.
2. The food and cocktail party was very tasty.
3. If this was how Steve Balmer talks when he is all jetlagged, I wonder how hw talks after a full night of sleep (monkey dance?)
4. Very funny video of the interview with Bill Gates (mock). Especially the end where BillG receives a linux redhat as a present. (door stopper?
5. Murphy's Teched Law: There are either at least 2 interesting lectures at the same time, or there is no really interesting lecture at all.
The Teched started, and I'm waiting for Steve Balmer's presentation to start.
My original intent was to blog live from my Pocket Pc, however there is a problem with the WI-FI connection for mobile devices. The WIFI was put up by Internet Zahav, and they already acknowledged that there is a problem, but haven't solved it yet. Their tech support wasn't very impressive at all.
I've been to 2 lectures/presentations so far:
What's new in Visual Studio 2005 - Unfortunately, I haven't learned anything new. Maybe I shouldn't participate in the user groups and listen to webcasts :-)
Introductino to programming with the .NET CF- interesting, very nice introductory lecture about programming with the .NET compact framework.
Just got an email from Teched 2004 organizers confirming that there will be a WI-FI connection (hopefully it won't crash like in the PDC).
Therefore, I will be blogging from the Teched from my new Dell Axim x3i Pocket PC!
Hope to see you there!
p.s. Anybody else joining the C# or Architects User Group Lunch?
Nishant S has recently published an article about the new C++/CLI in CodeProject. Until then, I haven't realized that managed C++ was getting a new (cleaner) syntax
As someone who worked with C++ for four years and was first introduced to .NET through managed C++, this new C++/CLI looks really good. no more ugly __gc!!!
In addition to cleaner syntax there is also better performance and CLI compliance.
C++/CLI is part of the Visual studio 2005 Whidbey release, and is not available yet, however when it comes out it will offer better options for interop with unmanaged code, and for core performance-centered featured (will C# ever be faster than C++?)
For more info you can also read: Write Faster Code with the Modern Language Features of Visual C++ 2005 on MSDN Magazine
For the past week I have been studying EIF.
I am in charge of building the Logging, Instrumentation and Exception Managing component for our product.
Of course, this component will be able to do EVERYTHING.
Specifically, we (the company I work in) want to be add the capability to add objects to a binary log by serializing them. For example: void Log(Level level, string Message, object data) . If this will be sent to a regular log, the data can be omitted. However, with a binary log I could create a custom reader who could deserialize the data object and reflect over its state.
I checked out a few Logging frameworks including: EIF, NSpring, log4net, and dotnetlog (theobjectguy).
I eventually picked EIF because of it's support of instrumentation and exception handling, (also a chance to get to better understand the Microsoft Application Blocks). However, the major drawback was that there is no code. Later on, when I started having problems, I had to start using Reflector and read IL.
<Begin Rant>My call Microsoft - Show me the source! This isn't part of your core products, this is needed by the programmers. Why not send it out, just like the application blocks? the dll's aren't even obfuscated anyway! <End Rant>
So I installed the EIF, learned all I could about it from documentation and Internet, and started working. My problems have begun. After fixing the configuration problems (If you mess the settings, it just doesn't work - no log or exception thrown), I tried creating a Custom Event by modifying the TraceMessageEvent:
<BEGIN Code>
[Serializable]
public class TraceMessageEvent : TraceEvent
{
private string message;
private object data;
/// <summary>
/// Gets or sets the data object to be serialized to binary log.
/// </summary>
public object Data
{
get { return data; }
set { data= value; }
}
/// <summary>
/// Gets or sets the message raised.
/// </summary>
public string Message
{
get { return (message == null ? String.Empty : message); }
set { message = value; }
}
/// <summary>
/// Raises a TraceMessageEvent to the EventSource passed as a parameter. The TraceMessageEvent is initialized with the message passed as a parameter.
/// </summary>
/// <param name="eventSource">The EventSource to raise the TraceEvent to.</param>
/// <param name="message">The message to initialize the TraceEvent with.</param>
/// <param name="data">The data object to initialize the TraceEvent with.</param>
public static void Raise(EventSource eventSource, string message, object data)
{
if (eventSource == null)
throw new ArgumentNullException("eventSource");
if (eventSource.IsEnabledForType(typeof(TraceMessageEvent)))
{
TraceMessageEvent e =
new TraceMessageEvent();
e.Message = message;
e.Data = data;
eventSource.Raise(e);
}
}
public
override bool PrepareForSerialization(EventSource eventSource, RequestContext requestContext)
{
if (!base.PrepareForSerialization(eventSource, requestContext))
return false;
return true;
}
}
<END Code>
if I change the data object to string (and all references of course), everything works fine. However, when I keep it as it is now, even when creating a custom sink, The events were not passed through to the sinks. By breakpointing the data getter it seems like an internal class called evaluator fails, probably because it doesn't know how to serialize object.
Does anyone have a lead how to make this work? I would also like to hear any comments about object serialization to a binary log.
Welcome to my Blog!
my name is Shmulik Primes, I work as a C#/.NET Software Engineer for a medical startup company, based in Israel.
This blog is to be about real life programming in C#, for a real life project, and other .NET related subjects.
I hope you enjoy,
Shmulik