Decoding the Code

We aren't just developing Software. We're developing the Whole World.

XmlSerializer: remove xsi and xsd namespaces

leave a comment »

Problem/Bug

A Significant annoyance is when the default XmlSerializer adds xmlns attributes such as:

xmlns:xsd=”http://www.w3.org/2001/XMLSchema”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

to each element being serialized (in a collection maybe), so you find an xml file with double size on HD with no particular use!

Solution (remove namespaces’ declarations)

1 //Create our own namespaces for the output

2 XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

3

4 //Add an empty namespace and empty value

5 ns.Add(“”, “”);

6

7 //Create the serializer

8 XmlSerializer slz = new XmlSerializer(someType);

9

10 //Serialize the object with our own namespaces (notice the overload)

11 slz.Serialize(myXmlTextWriter, someObject, ns);


PS
Some people argue that these are necessary for deserializing the object later, for example if the object being serialized is null, one of these namespaces contains a xml:nil refrence, which is used to tell the deserializer to map this xml element to null. I’m not sure if this is correct. So remove them at your own risk. :)


Source
http://stackoverflow.com/questions/760262/xmlserializer-remove-unnecessary-xsi-and-xsd-namespaces
Original: http://www.csharper.net/blog/serializing_without_the_namespace__xmlns__xmlns_xsd__xmlns_xsi_.aspx

Written by Muhammad Saeed

September 14, 2009 at 11:21 pm

Oracle/MySQL Database – WTH?

leave a comment »

LOL. I remember like a year ago, the first (and the last) time I met Oracle Database in my college (FCIS – Egypt), I remember whenever using it (with a background of only MS SQL Server) I officially said: “WTH!”. :D

Buggy, slow, freak-syntax (later found it’s acceptable), and worst of all, the newly-created empty database’s size is 1 GB.

WTH Oracle?

-

News are coming that Oracle is buying Sun, which means that MySQL (my favorite after MS’s SQL Server) will be owned to Oracle, also Java!

-

When I remembered my past days with Oracle, My trivial comment was also: WTH!

Written by Muhammad Saeed

September 12, 2009 at 11:16 pm

Posted in Technical News

Tagged with , , , , , ,

Visual Studio 2010 News

leave a comment »

Visual Studio 2010

Visual Studio 2010

Visual Studio 2010 built on WPF

Yes, today Microsoft has confirmed this to the entire developer’s world: Visual Studio 2010 IDE will be based on the WPF platform!
This is a great news and a sign that WPF is now ready for business applications.
WPF will permit us also to easily customize parts of the UI.

Visual Studio 2010 gets a new WPF interface

Microsoft has announced that Version 2010 of the Visual Studio development environment will have an interface created in Windows Presentation Foundation (WPF). General manager Scott Guthrie made the announcement in his keynote speech on the second day of PDC 2008. Guthrie said that WPF would offer new ease of use and support for multiple monitors.

Guthrie also announced that the expandability of Visual Studio will be improved. A programmer interface will make the editors in Visual Studio 2010 completely customizable. Guthrie showed an example containing 200 lines of program code, which replaces the XML display of comments in a C# code file with a graphic display and shows additional relevant bugs from the Team Foundation Server directly in the code window. Guthrie pointed out that in future, Visual Studio extensions will be easier to distribute, since new components will only have to be copied into a particular directory. Registration will no longer be necessary. However, Microsoft does not plan to offer a customizable compiler until the follow-on version to Visual Studio 2010, according to Guthrie. C# architect Anders Heijlsberghe confirmed the news about the compiler the day before Guthrie’s speech.

For web developers, Guthrie announced that the Visual Web Developer in Visual Studio 2010 would contain additional features that would make JavaScript programming easier, support CSS2, and offer a new assistant for installing web applications which can handle various configurations as well as the distribution of associated SQL server databases.

Latest News

Visual Studio also will fully support IBM DB2, and Oracle.

It will have integrated support for developing Microsoft Silverlight applications

The Visual Studio 2010 code editor now highlights references; whenever a symbol is selected, all other usages of the symbol are highlighted. It also offers a Quick Search feature to incrementally search across all symbols in C++, C# and VB.NET projects. Quick Search supports substring matches and camelCase searches.bThe Call Hierarchy feature allows the developer to see all the methods that are called from a current method as well as the methods that call the current one. IntelliSense in Visual Studio supports a consume-first mode, which can be opted-into by the developer. In this mode, IntelliSense will not auto-complete identifiers; this allows the developer to use undefined identifiers (like variable or method names) and define those later. Visual Studio 2010 can help in this also by automatically defining them, if it can infer their types from usage.

Visual Studio Team System 2010, codenamed Rosario is being positioned for application lifecycle management. It will include new modelling tools, including the Architecture Explorer that graphically displays the projects and classes and the relationships between them. It supports UML activity diagram, component diagram, (logical) class diagram, sequence diagram, and use case diagram. Visual Studio Team System 2010 also includes Test Impact Analysis which provides hints on which test cases are impacted by modifications to the source code, without actually running the test cases. This speeds up testing by avoiding running unneeded test cases.

Visual Studio Team System 2010 also includes a Historical Debugger. Unlike the current debugger, that records only the currently-active stack, the historical debugger records all events like prior function calls, method parameters, events, exceptions etc. This allows the code execution to be rewound in case a breakpoint wasn’t set where the error occurred. The historical debugger will cause the application to run slower than the current debugger, and will use more memory as additional data needs to be recorded. Microsoft allows configuration of how much data should be recorded, in effect allowing developers to balance speed of execution and resource usage. The Lab Management component of Visual Studio Team System 2010 uses virtualization to create a similar execution environment for testers and developers. The virtual machines are tagged with checkpoints which can later be investigated for issues, as well as to reproduce the issue. Visual Studio Team System 2010 also includes the capability to record test runs, that capture the specific state of the operating environment as well as the precise steps used to run the test. These steps can then be played back to reproduce issues.

Download
Visual Studio 2010 Team System Beta 1 (web-installer)
Visual Studio 2010 Professional Beta 1 (web-installer)
Visual Studio 2010 CTP

Written by Muhammad Saeed

July 1, 2009 at 11:12 pm

“Image format is unrecognized” Bug, When Setting WPF Window Icon

leave a comment »

Fix: http://torque.gig8.com/2009/01/image_format_is_unrecognized_w.html

Vista allows embedding 256×256 png images inside of .ico files. This can be generated, for example, by an application such as IcoFX. Unfortunately, at least as of .NET 3.0, the WPF Window Icon cannot accept this. The problem does not lie in the IconBitmapDecoder, but appears to lie in the Window code…

Written by Muhammad Saeed

July 1, 2009 at 10:53 pm

Posted in Bugs, WPF/XAML

Tagged with , , ,

Major PHP 5.3 Update Coming On June 30th

leave a comment »

// Many people prefer using PHP more than ASP.NET or other Microsoft technologies for two reasons: 1- Free/Open Source, 2- Cheap Hosting 3- Tutorialized.

PHP 5.3 could be out as soon as Tuesday, June 30th. The new open source language release is a big deal for a lot of reasons, not the least of which is the fact that by my count this is the first major update to PHP since 2006 and the PHP 5.2 release.

PHP 5.3 is also interesting in that it includes at least one key feature that was originally intended for PHP 6 (whenever — if ever — that release will be out :D).

I spoke with Zeev Suraski, co-founder and CTO at commercial PHP vendor Zend Technologies last month about PHP 5.3. He noted that one key feature backported from PHP 6 into PHP 5.3 is namespaces, which is a way to encapsulate classes and other PHP items more easily.

While the official release is on June 30th, support for PHP 5.3 is already present in development tools from Eclipse released this week.

~Source: http://www.internetnews.com/dev-news/article.php/3827041/First+Major+PHP+Update+in+Years+Coming+Soon.htm

Written by Muhammad Saeed

June 28, 2009 at 1:29 pm

Mozilla Firefox 3.5 Release, Next Week

leave a comment »

Update! Mozilla Firefox 3.5 is released: http://www.mozilla.com/en-US/

// And the war starts between Google and Mozilla, who you think would win? :D

Mozilla is set to release its new Firefox 3.5 browser as early as next week after a year of development.

The new release will include a number of new features, but don’t expect to see many features that were inspired by the new arrival of Google on the Web browser scene with its Chrome browser.

Google introduced Chrome in September 2008 and included numerous new browser features like closer search engine access from the address bar and automatic updates. Firefox 3.5, which is currently at its third release candidate stage does not include those features and isn’t likely too any time soon either.

The difference between the two browsers highlights the different views that Mozilla and Google have on what users want from their browsers.

Awesome Bar versus Omnibox

Firefox 3.5 improves on the “Awesome Bar” address bar design that Mozilla rolled out with Firefox 3.

By default, it does not enable full search engine queries — instead, Firefox (as well as Microsoft Internet Explorer) offers a separate search box in the browser. But, as it turns out, some form of search is accessible through the Awesome Bar.

“What a lot of people don’t know is that if you type something into the location/Awesome Bar and no [location] matches come up, if you hit Enter, we run a Google search for that,” Mike Beltzner, Mozilla’s Director of Firefox, told InternetNews.com. “The reason why it is architected that way is we don’t think that people expect that when they type something into their location bar that those words are being sent to a search engine.”

Google integrates search into its the address bar, creating a location bar design it calls the Omnibox.

While the Omnibox may behave like the familiar Google.com search box, the features have inspired some worries over privacy, with concerns about Google logging entries from users — even if they never actually hit the Enter key to send a search to Google — have been around since Chrome’s first release.

Google’s privacy policy on Chrome states that, “some Google Chrome features send limited additional information to Google.”

One of those features is the Google Suggest feature that helps users with their search query in Chrome. Google blogged at the time of Chrome’s release that logged data like IP addresses are captured by Google for only 2 percent of requests.

Mozilla’s Beltzner, however, still has concerns.

“What you’re seeing with our competitors is they are sending [address bar entries] off to their search engine and we think that is violating a privacy boundary that some people might not expect,” Beltzner said. “We just want to make sure that it’s clear. So we keep search on the Internet where you are sending things out, in the box on the right and local search in the smart location bar.”

Google spokespeople did not respond to requests for comment by press time.

Privacy and updates

Another key change from the status quo in Google Chrome is that it does not require users to manually update the browsers themselves.

When a user installs Chrome, they also install the GoogleUpdate.exe application that runs in the background of a user’s system to keep Chrome up to date. It’s a feature that enables Chrome users to be updated faster than users of other browsers, according to a recent study in which Google was involved.

The study found that that after 21 days of a Google Chrome release, 97 percent of users were updated to the latest version. Mozilla Firefox had 85 percent of users updated within 21 days.

But Mozilla said it prefers a different approach to rolling out updates.

“Chrome takes the philosophy that software should be like the Web and change and become better over time,” Beltzner said. “I think what they’ll find it is that it pens them in from making radical changes in their user interface. Unless those changes are announced, unless users have some warning that a change will happen, the general response you’ll see is shock and fear.”

Beltzner added that in Mozilla’s view, users want to feel as though they have more control over their own software. With Firefox, users receive an update notification that they must click on in order to install a new version of the browser.

“We want to make security and stability updates painless to install for the user and we keep updating our mechanism to that end,” Beltzner said.

Beltzner added that Firefox’s developers want to inform users that Mozilla has made an update not because they want to pat themselves on the back, but because it feels wrong to change software on a user’s computer without telling them why.

“This machine is a user’s machine, and my right to put software on it, I think, stops at the point where they decide to take the software from me,” Beltzner said. “I want to ship them a security update but I want them to understand why I’ve done it — that’s the philosophical difference.”

~Source: http://www.internetnews.com/dev-news/article.php/3827291/Why+Firefox+Doesnt+Take+Google+Chrome+Features.htm

Written by Muhammad Saeed

June 28, 2009 at 1:17 pm

XML Overview

leave a comment »

XML (EXtensible Markup Language) is a language used to uniform the way we store data. It is used in small data repositories only. It makes it easier for programmers to read/write/edit data. It’s simple, portable, and uniform, that’s why it is a W3C recommendation.

Here is an example that should illustrate basic principles of XML:

<bookstore>
 <book category="COOKING">
  <title lang="en">Everyday Italian</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>30.00</price>
 </book>
  <book category="CHILDREN">
  <title lang="en">Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
 </book>
  <book category="WEB">
  <title lang="en">Learning XML</title>
  <author>Erik T. Ray</author>
  <year>2003</year>
  <price>39.95</price>
 </book>
</bookstore>

‘bookstore’ is a XML Root Element (A XML document must have 1 root element).

‘book’ is an XML Element, and Child to the root element. (Multiple ‘book’ elements are called Siblings)

‘title’, ‘year’, ‘author’, ‘price’ are also XML Elements, and Children to ‘book’ element.

‘category’, ‘lang’ are XML Attributes.

“Everyday Italian”, “Harry Potter”, “Learning XML”,… are XML Texts.

In XML:

  • (New != new), it’s case-sensitive.
  • Attributes values must be quoted: <title lang=“en”>Learning XML</title>
  • Any Element can contain nested/children elements or simple text, and attributes

~Ref: http://www.w3schools.com/xml/

Written by Muhammad Saeed

June 27, 2009 at 4:52 pm

Posted in XML

Tagged with ,

Follow

Get every new post delivered to your Inbox.