Archive

Posts Tagged ‘C#’

Parsing XML in C#: A Quick Working Sample

August 9th, 2013 16 comments

Just started to work on hacking the Web application of vCAC and REST APIs in C#. As expected, the XML processing is an indispensable part for that purpose. I have worked on C# on and off in the past, but never as consistently as on Java. To get myself familiar with the related C# APIs for parsing, I coded the following sample code.

b3b2c0756914bbf1ff386fe9e5f09827000

Categories: Software Development Tags: , ,

Encrypt and Decrypt Password in C#?

November 12th, 2012 2 comments

I just spent a little time playing with C# on password encryption. Here is a sample code I wrote to get myself familiar with related APIs. Overall it’s pretty straight forward – it first encrypts a clear text to an encrypted Base64 encoded string, then reverses it.

Why So Many Programming Languages?

January 10th, 2012 No comments

While checking out the search engine terms to my blog, I found an interesting one there: “why so many programming languages?” A great question indeed. If you take a look at the Wikipedia page on programming languages, you will be surprised by the number of programming languages today. To give you a hint, the languages are categorized into different sections by their first letters. When I browsed the page, I found most of them were new to me and will definitely remain so in the future. :-)

Hub Programming Language: Does It Matter To You?

August 23rd, 2011 1 comment

There are many programming languages today, sometimes too many to choose from for a new project. The good thing is that there aren’t many main stream programming languages, so picking one is not a daunting task. And almost all main stream languages can achieve similar things, meaning any one of them will work. So in the end it’s really a matter of team preference and sometimes company policy.

How Many Programming Languages Are Enough?

July 4th, 2011 2 comments

During last 60 some years after computer was invented, there have been hundreds, if not thousands, programming languages. If we include domain specific language (DSLs), which accorinding to Martin Fowler may include regular expression, spreadsheet, etc, the number can be even bigger, not to mention more programming languages continue to emerge.

This would be a big burden if we have to learn all of them. Luckily, we don’t have to. In fact, most of us just need to learn several most popular ones. Even better, these popular languages may look very similar in syntax. As a result,

Tech Talk: Accessing the Vsphere API from C/C++

May 26th, 2011 No comments

This talk is by Steven Wong who is an architect working at EMC on various backup and virtualization projects. If you are using C or C++ with gSOAP to manage vSphere, this talk is for you.

Check it out below:

Squares Aren’t Rectangles? A Common Misunderstanding of Object Oriented Design From MSDN Magazine

December 5th, 2010 3 comments

While reading the recent Dec 2010 issue of MSDN magazine, I found an article (Multiparadigmatic .Net, Part 4: Object Orientation) with misunderstandings on object oriented design. I was surprised that the author reached conclusions like, “squares aren’t rectangles,” and “no happy ending here.” The conclusions are based on misunderstandings of object oriented design.

Let me show you what the root problem is and how to get a happy ending. After reading this, you won’t be bothered by “squares aren’t rectangles.”

What’s the problem?

As most people already know, inheritance or generalization (I prefer the latter) is an important feature of OOD. Using it effectively can lead to a good object model and concise codebase. In an inheritance relationship, a subtype must maintain “IS-A” relationship with its super type, for example, a Student type IS-A Person. I think most people are just fine with this.

Facebook HipHop Compiler for PHP: What Is It For You?

May 6th, 2010 2 comments

I attended a great seminar at Stanford by Haiping Zhao on the open source compiler which converts PHP code to C++ yesterday. Haiping is the tech lead for the open source HipHop project at Facebook.

As many have known, Facebook is a PHP shop with all the front end dynamic pages written in PHP. The upside of using PHP is that it’s very easy to read, write and debug, plus platform independent. The downside is that it’s really slow, probably one of the slowest scripting languages.

Why PHP is slow?

Haiping summarized three reasons, which he thinks are common contributors for slowness of scripting languages in general:

  1. Byte-code interpreter.
  2. Dynamic symbol lookups, including functions, variables, constants, class methods, properties, etc.
  3. Weakly typing. The zval has to evaluate the data type of any variable before any operation. Plus, the PHP array is too generic because it can represent any collection. 

Why Should Facebook Care?

When Haiping joined Facebook, new servers cannot catch up the new users. The server farms became so big that any percentage saving could save the company millions of dollars. Like all the big web companies, Facebook does not disclose the number of servers they have. The size of the datacenter is guarded as a secret. One of the professors did an estimate in his questions anyway: 15,000 to 30,000 servers.

Top 20 Most Popular Programming Languages

April 30th, 2010 1 comment

If you are a software engineer, you might have known Tiobe popularity index of programming languages. The index is updated on monthly basis. The following table shows the top 20 most popular languages this month.

The index caught many people’s attention this month because C regained its No.1 position. Java, used to be No. 1 for years, dropped to No. 2. Although percentage wise Java is still very close to C, the declining of Java popularity can be eye-catching.

Why does C# Web Service code look weird?

January 25th, 2010 No comments

Today I read a posting at VMware community forum about the weird code required by C# Web Service. If the following line is missing, then the vSphere API call to get properties doesn’t work:

VimApi.VimService.PropertySpec.allSpecified = True 

But the problem is that there isn’t any property defined as allSpecified in the object PropertySpec according to vSphere API Reference.

So, where does the allSpecified come from? and why is it needed?