"The name 'xxx' does not exist in the current context"This problem typically occurs when a XAML file i copied from one project to another, which might change the Build Action to "ApplicationDefinition".
TigerShark on .NET and everything else
23 August 2012
The name 'xxx' does not exist in the current context
If you encounter the following error message when building a Silverlight project, check the Build Action for your XAML files is set to "Page".
08 November 2011
Attributes in C# (a rant)
Why is it that attributes are proclaimed as first class citizens in .NET, when they are not really treated that way.
You have no way of querying attributes, without having to resort to reflection. They can't be generic (yeah, there are reasons, but come on!), and you can't use them as generic constraints.
There might be a lot of other downsides to attributes, but the most annoying must be, that you can't easily query them. Of course, you can just create an extension method and you're done, but it just seems like they've gotten the cold treatment in .NET.
If they was real first class citizens, you'd have better language integration ie.
if(SomeClass hasattribute MyAttribute) { ... } or if a type has an attribute, it should be directly accessible as in SomeClass.MyAttribute.AttributeProperty.
I know there are a lot of issues regarding the implementation of attributes, that make the above impossible (at least for the current version of C#), but attributes are incredibly useful and deserve a lot more attention, outside the reflection box.
You have no way of querying attributes, without having to resort to reflection. They can't be generic (yeah, there are reasons, but come on!), and you can't use them as generic constraints.
There might be a lot of other downsides to attributes, but the most annoying must be, that you can't easily query them. Of course, you can just create an extension method and you're done, but it just seems like they've gotten the cold treatment in .NET.
If they was real first class citizens, you'd have better language integration ie.
if(SomeClass hasattribute MyAttribute) { ... } or if a type has an attribute, it should be directly accessible as in SomeClass.MyAttribute.AttributeProperty.
I know there are a lot of issues regarding the implementation of attributes, that make the above impossible (at least for the current version of C#), but attributes are incredibly useful and deserve a lot more attention, outside the reflection box.
19 July 2007
IcoFX - The Free Icon Editor
I've been unable to find a good freeware icon editor for some time, but now my search is over.
IcoFX is the absolute best icon editor I've ever seen. It has a beautiful and proffesional looking UI, a complete set of features you normally only find in commercial products, and the ability to convert standard images into .ico-files (a feature I just love). Furthermore it's able to create icons in Vista format in 96x96 px.
It's just amazing how much you get for free in this product.
I highly recommend this and give it 5 out of 5!
IcoFX - The Free Icon Editor
IcoFX is the absolute best icon editor I've ever seen. It has a beautiful and proffesional looking UI, a complete set of features you normally only find in commercial products, and the ability to convert standard images into .ico-files (a feature I just love). Furthermore it's able to create icons in Vista format in 96x96 px.
It's just amazing how much you get for free in this product.
I highly recommend this and give it 5 out of 5!
IcoFX - The Free Icon Editor
31 May 2007
Using ASP.NET Session State in a Web Service
Stubled across the following page regarding sessions using WebServices.
Quite interesting reading.
Using ASP.NET Session State in a Web Service
Quite interesting reading.
Using ASP.NET Session State in a Web Service
28 April 2007
Using RadioButtons in ASP.NET AJAX
For a while I had a problem when using radio buttons with partial page updates.
The issue was the automatic postback event did not fire if the radio button attribute Checked was set to true. Apparently ASP.NET does not add the onclick client side script to radio buttons, if they are allready checked when the page is rendered.
This is actually not a problem when you are using normal page postbacks, since the radio button is re-rendered and the attribute is added to the control (it's state is no longer checked).
In AJAX however, this poses as a problem, since the control in some cases isn't re-rendered, hence not adding the attribute, which in turn makes the radio button useless as it doesn't fire any postback.
I scoured the web for a solution, but the only one which seemed to do the trick was adding custom javascript to the controls attrubute collection (onclick).
Even though it "seemed" to solve the problem and the page did a postback, the control wasn't registered in the page events, which made it virtually impossible to do anything resonable with it.
But now to the solution.
Each webcontrol contains an InputAttributes collection, which contains the attributes for the input tag on the page.
This collection can be manipulated at runtime, making it possible to set the needed attribute "checked".
All that needs to be done is the following:
RadioButton rbtnName = new RadioButton();
rbtnName.InputAttributes.Add("checked", "checked");
The ASP.NET renders the control as it is not checked, but setting the above attribute, actually does the magic, avoiding the problem all together.
The issue was the automatic postback event did not fire if the radio button attribute Checked was set to true. Apparently ASP.NET does not add the onclick client side script to radio buttons, if they are allready checked when the page is rendered.
This is actually not a problem when you are using normal page postbacks, since the radio button is re-rendered and the attribute is added to the control (it's state is no longer checked).
In AJAX however, this poses as a problem, since the control in some cases isn't re-rendered, hence not adding the attribute, which in turn makes the radio button useless as it doesn't fire any postback.
I scoured the web for a solution, but the only one which seemed to do the trick was adding custom javascript to the controls attrubute collection (onclick).
Even though it "seemed" to solve the problem and the page did a postback, the control wasn't registered in the page events, which made it virtually impossible to do anything resonable with it.
But now to the solution.
Each webcontrol contains an InputAttributes collection, which contains the attributes for the input tag on the page.
This collection can be manipulated at runtime, making it possible to set the needed attribute "checked".
All that needs to be done is the following:
RadioButton rbtnName = new RadioButton();
rbtnName.InputAttributes.Add("checked", "checked");
The ASP.NET renders the control as it is not checked, but setting the above attribute, actually does the magic, avoiding the problem all together.
13 January 2007
Convert DRM WMA to MP3
Okay, I have for some time tried to find an easy way to convert DRM protected WMA-files to MP3, but without any luck. Sure a lot of programs claim to do it, but I don't want to pay for this, I wan't it for free!
So, I thought long and hard and came up with this solution. Please note that it requires the license to allow you to burn your downloaded WMA's.
Prerequisites (what I used):
- Nero Burning Rom
- Daemon Tools v4.0
- CDex
Here we go:
- Get the protected files from some paysite
- I believe you download the licenses onto your machine the first time you play it, so I guess you sould try that first (I did, and it worked)
- Get Nero Burning Rom. I have come free-of-charge with every CD-writer I have ever purchased, so I guess it souldn't be that hard to obtain. Alternatives may exists - the important part of this is that you have an image-recorder (writes an image to disk).
- Open Nero up and create a new CD-audio compilation.
- In the "Recorder"-menu, select "Choose recorder" (or press CTRL-R)
- Select the "Image Recorder" in the list and press OK
- Drag your DRM-protected files into your compilation
- Burn! When a dialog box pops up, select the location to put your image
- Nero now burns an image with the protected songs converted into CD-audio (rippable)
- Mount your new image as a virtual drive using Daemon Tools. You can try playing a track using your favorite media player. If it plays, your good to go.
- Start up CDex and select the image drive in the top-center drop-down menu. It should afterwards display the tracks on the image - the tracks you burned with Nero :)
- Rip the files into the format you have configured in CDex.
- That's it! You now have the MP3's of the digitally protected WMA's... It's THAT "easy" :)
Please note that the above not necessarily works in every situation. I just thought that it might be a way to help out some of you guys out there having a real hard time with DRM (including myself).
Good luck!
Enable MP3 File Transfer in Windows Live Messenger
Are you also annoyed by the fact that Windows Live Messenger constantly blocks files sent to you by your family and friends.
Messenger are apparently "helping" you - the stupid and imbecile computer user - by friendly deleting the file.
One of the things about security is that it pisses me off. Why should all the users, rookie as pro, be annoyed by such a "security feature"?
Well, I managed to find a link that unblocks all these files... FINALLY!!!
Enable MP3 File Transfer in Windows Live Messenger
Messenger are apparently "helping" you - the stupid and imbecile computer user - by friendly deleting the file.
One of the things about security is that it pisses me off. Why should all the users, rookie as pro, be annoyed by such a "security feature"?
Well, I managed to find a link that unblocks all these files... FINALLY!!!
Enable MP3 File Transfer in Windows Live Messenger
Subscribe to:
Comments (Atom)