Monday, August 02, 2010
Wednesday, July 28, 2010
Reality programming
It is a reality that we have a huge army of programmers that do not care about the quality of the code they write. It’s the reality, and we should not really blame them: they are trying to put bread on the table, feed their kids, parents and possibly other relatives as well.
So the reality should dictate different approach to programming. Rather than assuming that no code will be duplicated, we should assume that copy-paste will be the primary tool of development, and build our process around this. And when a programmer attempts to change some code that is also duplicated in 99 other places, the IDE should ask the programmer if he or she want also to modify the code in other 99 places, or maybe even give the programmer option to modify the code in 50 other places and leave the other 49 not modified. I know this is possible, because I am now checking out the tool called Atomiq that can find duplication in the code base.
What about source code? Say, if we want to revert a changeset in one file, the IDE will prompt us to revert the changes to all the code that is duplicated?
I know that most of developers will never write unit tests, but for the cases when their customers force them to do so what if the IDE will also duplicate unit tests to cover all duplicated code?
I know that most of the customers never test, but for those whose process requires them to do so what if the IDE will tell them that if they write a test case for a screen it will also work for 10 other screens that are duplicate of this one?
The purpose of these enhancements is not to encourage poor code quality, but to reduce the effect of the inevitably poor quality.
So the reality should dictate different approach to programming. Rather than assuming that no code will be duplicated, we should assume that copy-paste will be the primary tool of development, and build our process around this. And when a programmer attempts to change some code that is also duplicated in 99 other places, the IDE should ask the programmer if he or she want also to modify the code in other 99 places, or maybe even give the programmer option to modify the code in 50 other places and leave the other 49 not modified. I know this is possible, because I am now checking out the tool called Atomiq that can find duplication in the code base.
What about source code? Say, if we want to revert a changeset in one file, the IDE will prompt us to revert the changes to all the code that is duplicated?
I know that most of developers will never write unit tests, but for the cases when their customers force them to do so what if the IDE will also duplicate unit tests to cover all duplicated code?
I know that most of the customers never test, but for those whose process requires them to do so what if the IDE will tell them that if they write a test case for a screen it will also work for 10 other screens that are duplicate of this one?
The purpose of these enhancements is not to encourage poor code quality, but to reduce the effect of the inevitably poor quality.
Generate encryption key (128-bit) for RijndaelManaged
$algorithm = [System.Security.Cryptography.SymmetricAlgorithm]::Create("Rijndael")
$algorithm.set_keysize(128)
$keybytes = $algorithm.get_Key()
$ivbytes = $algorithm.get_IV()
[System.Convert]::ToBase64String($keybytes)
[System.Convert]::ToBase64String($ivbytes)
$algorithm.set_keysize(128)
$keybytes = $algorithm.get_Key()
$ivbytes = $algorithm.get_IV()
[System.Convert]::ToBase64String($keybytes)
[System.Convert]::ToBase64String($ivbytes)
Wednesday, July 21, 2010
My profile
Create folder WindowsPowerShell in My Documents
Create file Microsoft.PowerShell_profile.ps1
Copy this into the file:
function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}
Create file Microsoft.PowerShell_profile.ps1
Copy this into the file:
function prompt {
$Host.UI.RawUI.WindowTitle=$(get-location)
"$ ";
}
Powershell command to get all the groups I belong to.
$ [Security.Principal.WindowsIdentity]::GetCurrent().Groups | % {$_.Translate([Security.Principal.NTAccount]) }
Wednesday, May 05, 2010
Посредственные программисты.
Засилию посредственных программистов способствует политика компаний, не желающий тратить деньги на тренинг своих сотрудников. Мол, хороший программист сам должен учиться, если хочет преуспеть как профессионал. Ха! Скажите это женщине с двумя маленькими детьми, или её мужу, работающему по 60 часов в неделю! Так многие программисты не поднимаются выше уровня, который они получили в институте.
Monday, May 03, 2010
Serialize objects into C#
Am I the only crazy person who would like to serialize objects into C# code? Not binary or XML serialization. I want to take an object and generate C# code that will recreate all the public properties of this object and save the code to CS files.
Thursday, April 29, 2010
MSDN and Offshore developer
Including TFS (and some other features) in MSDN Pro has another benefit: it makes it possible to use these features when working with offshore outsourcing partner. It is no secret, that offshore development is all about cost, so to keep the cost down the offshore partners limit the money they are willing to pay for development tools. Having extra $2000 per developer means extra 96c per hour, which can reach 5% of the hourly rate. Which means that either the company risk losing business or the developer will be underpaid.
So this is really a smart move from Microsoft side.
So this is really a smart move from Microsoft side.
Wednesday, April 28, 2010
Overheard today...
A manager about the consulting company he uses for software development:
"I don't like them to be creative. We are not paying them to be creative."
"I don't like them to be creative. We are not paying them to be creative."
Tuesday, April 27, 2010
Why Non-broadcast Networks are not a Security Feature
http://technet.microsoft.com/en-us/library/bb726942.aspx
Wireless security consists of two main elements: authentication and encryption. Authentication controls access to the network and encryption ensures that malicious users cannot determine the contents of wireless data frames. Although having users manually configure the SSID of a wireless network in order to connect to it creates the illusion of providing an additional layer of security, it does not substitute for either authentication or encryption.
A non-broadcast network is not undetectable. Non-broadcast networks are advertised in the probe requests sent out by wireless clients and in the responses to the probe requests sent by wireless APs. Unlike broadcast networks, wireless clients running Windows XP with Service Pack 2 or Windows Server® 2003 with Service Pack 1 that are configured to connect to non-broadcast networks are constantly disclosing the SSID of those networks, even when those networks are not in range.
Therefore, using non-broadcast networks compromises the privacy of the wireless network configuration of a Windows XP or Windows Server 2003-based wireless client because it is periodically disclosing its set of preferred non-broadcast wireless networks. When non-broadcast networks are used to hide a vulnerable wireless network—such as one that uses open authentication and Wired Equivalent Privacy—a Windows XP or Windows Server 2003-based wireless client can inadvertently aid malicious users, who can detect the wireless network SSID from the wireless client that is attempting to connect. Software that can be downloaded for free from the Internet leverages these information disclosures and targets non-broadcast networks.
This behavior is worse for enterprise wireless networks because of the number of wireless clients that are periodically advertising the non-broadcast network name. For example, an enterprise wireless network consists of 20 wireless APs and 500 wireless laptops. If the wireless APs are configured to broadcast, each wireless AP would periodically advertise the enterprise’s wireless network name, but only within the range of the wireless APs. If the wireless APs are configured as non-broadcast, each of the 500 Windows XP or Windows Server 2003-based laptops would periodically advertise the enterprise’s wireless network name, regardless of their location (in the office, at a wireless hotspot, or at home).
For these reasons, it is highly recommended that you do not use non-broadcast wireless networks. Instead, configure your wireless networks as broadcast and use the authentication and encryption security features of your wireless network hardware and Windows to protect your wireless network, rather than relying on non-broadcast behavior.
Wireless security consists of two main elements: authentication and encryption. Authentication controls access to the network and encryption ensures that malicious users cannot determine the contents of wireless data frames. Although having users manually configure the SSID of a wireless network in order to connect to it creates the illusion of providing an additional layer of security, it does not substitute for either authentication or encryption.
A non-broadcast network is not undetectable. Non-broadcast networks are advertised in the probe requests sent out by wireless clients and in the responses to the probe requests sent by wireless APs. Unlike broadcast networks, wireless clients running Windows XP with Service Pack 2 or Windows Server® 2003 with Service Pack 1 that are configured to connect to non-broadcast networks are constantly disclosing the SSID of those networks, even when those networks are not in range.
Therefore, using non-broadcast networks compromises the privacy of the wireless network configuration of a Windows XP or Windows Server 2003-based wireless client because it is periodically disclosing its set of preferred non-broadcast wireless networks. When non-broadcast networks are used to hide a vulnerable wireless network—such as one that uses open authentication and Wired Equivalent Privacy—a Windows XP or Windows Server 2003-based wireless client can inadvertently aid malicious users, who can detect the wireless network SSID from the wireless client that is attempting to connect. Software that can be downloaded for free from the Internet leverages these information disclosures and targets non-broadcast networks.
This behavior is worse for enterprise wireless networks because of the number of wireless clients that are periodically advertising the non-broadcast network name. For example, an enterprise wireless network consists of 20 wireless APs and 500 wireless laptops. If the wireless APs are configured to broadcast, each wireless AP would periodically advertise the enterprise’s wireless network name, but only within the range of the wireless APs. If the wireless APs are configured as non-broadcast, each of the 500 Windows XP or Windows Server 2003-based laptops would periodically advertise the enterprise’s wireless network name, regardless of their location (in the office, at a wireless hotspot, or at home).
For these reasons, it is highly recommended that you do not use non-broadcast wireless networks. Instead, configure your wireless networks as broadcast and use the authentication and encryption security features of your wireless network hardware and Windows to protect your wireless network, rather than relying on non-broadcast behavior.
Wednesday, April 21, 2010
MSDN
Am I the only one who is confused by MSDN download screen? I have two MSDN subscription on my email, and I have no idea which software belongs to which client. I hope I don't get punished by Microsoft.
Tuesday, April 20, 2010
UPS
Just connected my server to APC UPS I just received. I realized that WHS does not have USB support, and the server itself does not have COM ports, and APC does not have a server version of the software that take care of shutdown. Oops...
This means I'll have to shutdown the server manually if I loose power for extended periods. Luckily that almost never happens. Most of the time I lose power for a few seconds, and the UPS should cover that.
This means I'll have to shutdown the server manually if I loose power for extended periods. Luckily that almost never happens. Most of the time I lose power for a few seconds, and the UPS should cover that.
Tuesday, March 09, 2010
Variable naming...
How do you pronounce variable "contactus"? "Con-cactus"?
One more argument for correct variable casing...
Wednesday, May 06, 2009
Too many items

Wednesday, April 15, 2009
Boolean is difficult
Sometimes you see the C# code like this:
if(isValid()) {
return true;
}
else {
return false;
}
or even "better":
return (isValid()? true : false);
I always wondered why not just write the code like this:
return isValid()
Is the reason is that some of the younger developers don't have any background in C, C++ or any languages where the conditional statements return int, not bool? It is psychologically difficult for them to accept Boolean as the first class citizen - data type. For them Boolean cannot be separated from the if statements or "?" operator. Am I correct? What is your opinion?
if(isValid()) {
return true;
}
else {
return false;
}
or even "better":
return (isValid()? true : false);
I always wondered why not just write the code like this:
return isValid()
Is the reason is that some of the younger developers don't have any background in C, C++ or any languages where the conditional statements return int, not bool? It is psychologically difficult for them to accept Boolean as the first class citizen - data type. For them Boolean cannot be separated from the if statements or "?" operator. Am I correct? What is your opinion?
Tuesday, April 14, 2009
JavaFx installation
Oddly enough it did not prompt me to download and install JavaFx, it just showed me the small icon. When I clicked on the icon it prompted me to download the latest Java, and after 6 minutes (on high-speed connection) and two browser restarts I've got it up and running.
Monday, April 06, 2009
Fixing Outlook annoyancies
If a message comes as plain text, Outlook will use plain text format to reply to this message. As a result the signature gets messed up, etc. This article shows how to overcome this limitations. A simple macro can convert a received email from plain text to html:
Sub ConvertMessage()
Dim oMailItem As MailItem
Set oMailItem = Application.ActiveExplorer.Selection.Item(1)
oMailItem.BodyFormat = olFormatHTML
'oMailItem.HTMLBody = oMailItem.Body
oMailItem.Close (olSave)
Set oMailItem = Nothing
End Sub
I commented out one of the lines because it works better for me this way.
Sub ConvertMessage()
Dim oMailItem As MailItem
Set oMailItem = Application.ActiveExplorer.Selection.Item(1)
oMailItem.BodyFormat = olFormatHTML
'oMailItem.HTMLBody = oMailItem.Body
oMailItem.Close (olSave)
Set oMailItem = Nothing
End Sub
I commented out one of the lines because it works better for me this way.
Tuesday, March 31, 2009
Anger-driven development
Being angry at the badly written code stimulated me to a few hours of very productive refactoring and bug fixing. Do I need to get angry to be productive?
Monday, March 16, 2009
IOC container
I found a great idea in Dave Laribee's article in MSDN Vol 24 # 2: Don't use IOC containers for entities, only for services. I am saying this becase our team is practicing this for the last year or so.
Monday, December 08, 2008
Silverlight instead of JavaScript?
I would not recommend anyone to use Silverlight instead of JavaScript, because of low tolerance of the former to browser differences. Besides, why would you trade your almost strongly typed JavaScript to weakly typed Silverlight syntax like:
HtmlElement label1 = HtmlPage.Document.GetElementById("Label1");However there is one scenario that could provide a good case for using Silverlight in place of JavaScript, as described here: http://msdn.microsoft.com/en-us/magazine/dd148642.aspx . Look at this piece of code:
label1.SetProperty("innerHTML", "Dino");
HtmlElement button1;You can attach a managed event handler to an HTML button!
button1 = HtmlPage.Document.GetElementById("Button1");
button1.AttachEvent("click", new System.EventHandler(Button1_Click));
Subscribe to:
Posts (Atom)