CodeDigest.Com - Article,FAQ's, Code Snippets - June 2009

CodeDigest Article Digest

CodeDigest For the Month 7\2009

CodeDigest.Com is a very young site(just 1 and a half year old) and this month marks as a benchmark in the growth of CodeDigest.Com! This month we have entered into the top 1,00,000 sites listed by Alexa.Com. Thanks to all our supporters!
New Articles Published
Custom Paging for GridView using LINQ
LINQ stands for Language Integrated Query. LINQ is a data querying methodology that provides querying capabilities to .Net languages which have similar to SQL query syntax. Moving forward, we will build custom paging for GridView control using LINQ to SQL classes.
DatePicker Control in ASP.Net
Most often we will get a requirement to capture date input from the users. Normally, we can do this with a textbox and asking user to input the date in a particular format using a help text near by the textbox. This article will help us to build this control ourselves and also some of the other options available.
BizTalk - Errors and Warnings, Causes and Solutions
The following article will discuss on the common errors and warning that we face when using BizTalk and their resolutions.
Customize User Controls with Smart Tag feature in Windows Forms
This article explains how to create a usercontrol with a Smart Tag(Task List) attached to it.
Beginning Windows Presentation Foundation Project
This article by Jayaram Krishnaswamy introduces the reader accustomed to working with the traditional graphic user interface in earlier versions of VB to Windows Presentation Foundation. Importantly, it introduces the reader to the XAML's declarative format and what it means in the design interface of VS 2008.
Beginning Windows Communication Foundation (WCF) Service Development and Consuming it
SOA is an architectural design pattern by which several guiding principles determine the nature of the design. Basically, SOA states that every component of a system should be a service, and the system should be composed of several loosely-coupled services.WCF is the acronym for Windows Communication Foundation. It is Microsoft's latest technology that enables applications in a distributed environment to communicate with each other. Read more...
C# Arrays-Explained
What is an array?In simplest terms, an array is an organized collection. It can be a collection of anything. The important thing to remember is that it is a collection. This example uses an array of system.drawing.color.colors to change the background color of a windows form.
Working with static and dynamic arrays in C#
Arrays are an extremely important part of any programmer's code library. There are static and dynamic arrays. This article discusses these two types of arrays and includes examples of each.
How to Open File Dialog in C#?
This article demonstrates using the windows API FileOpen Dialog to get a user's file selection.
Populating RadioButtonList Using jQuery, JSON in ASP.Net
One of my previous article Building Cascading DropDownList in ASP.Net Using jQuery and JSON discussed about constructing cascading DropDownList control using jQuery and JSON. One of the user [Shah] has commented that his requirement was to populate a RadioButtonList instead of a child DropDownList control. Read more..
GridView Style Edit Update in Repeater Control Using jQuery and Ajax
Repeater control is one of the light weight control when compared to the other databound controls. It provides more flexibility on the layout of data displayed and the control itself will not render any additional HTML like GridView and DataList control do. Repeater control as such will not provide edit/update functionalities for the data. In this article, we will overcome this difficulty and provide an edit update feature similar to GridView control using the powerful jQuery library and Ajax.

New Codes Published
Get Website IP Address in ASP.Net
Disabling Theme Set in Web.Config in a Page
Prevent Web.Config settings inheritance in ASP.Net
Setting Media property for StyleSheets When Using Themes in ASP.Net
How to create a simple JOIN LINQ query to fetch data from 2 entities?

New FAQs Published
What is the difference between ASP.Net AJAX ScriptManager and Ajax control ToolkitScriptManager?

Last Month Winners
Winner:balamurali balaji
Silver Mini LCD Projection Clock
Contribution Done:Write one article or 2 Code Snippet or 3 FAQs
Posted by satheeshbabu | with no comments
Filed under:

Volviendo a AjContab

Hace ya un tiempo que vengo pensando en reflotar AjContab:

http://www.ajlopez.com/ajcontab/

Encuentro este mensaje viejo, en la lista de Arquitectura del MUG de Argentina

http://www.mail-archive.com/arquitectura@mug.org.ar/msg00504.html

AjContab es un viejo ejemplo que daba en mis cursos de .NET 1.x, hace unos años. Debería reescribirlo, en ASP.NET 2, VS2008, tal vez ASP.NET MVC? Veré. Pero en estos días habia tweeteado:

http://twitter.com/ajlopez/status/2258288758

La idea es tener:

- Múltiples Tenants
- Múltiples Empresas
- Múltiples Planes de Cuenta por Empresa
- Múltiples Ejercicios
- Usuarios y Roles
- Minutas/Asientos
- Reportes como Balance, Libro Diario, Libro Mayor

Al escribirlo en PHP/MySql, podría colocarlo fácilmente en línea. Me serviría como ejercicio de repaso de PHP, y comenzaría a tener un proyecto con Ajax, Javascript, JQuery quizás? Trataría de codificarlo liviano, para no ponerle demasiada arquitectura o parafernalia al principio. En todo caso, eso lo dejaría para la versión .NET o Java.

Será interesante ver cómo los usuarios reciben la idea de tener un sistema así en la web. En el Proyecto Medusa (que mencioné hace poco, en Generación de código con AjGenesis para Mere Mortals Framework), está incluido el desarrollo de un sistema contable en web. AjContab me serviría para afilar las uñas en el tema de poner este tipo de aplicaciones andando.

En cuanto tenga algo publicado, escribo por acá. Keep tuned! :-)

Sugerencias? Bienvenidas!

Nos leemos!

Angel “Java” Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez

Excel dates counted differently and a reliable way of working out the day of the week

Following my recent post about 40,000 days, I got a couple of emails telling me that Excel disagrees about when the 40,000th day is. And this is true – Excel counts Day 40000 as July 6th 2009, not July 7th.

Unfortunately for Excel users, they’re wrong. And it’s down to the fact that Excel thinks that 1900 was a leap-year, when we all know it wasn’t. You see, leap-years only fall on the century year if the year is divisible by 400. So 2000 was a leap-year, but 1900 wasn’t, and 2100 won’t be either.

What’s more, this has been a problem for ages, and it was a conscious decision to introduce the bug. Essentially, Lotus 1-2-3 thought 1900 was a leap-year, and to be consistent with the market leader of the day, Microsoft treated 1900 as a leap-year too. And nowadays, we have a situation where backwards compatibility is more important. Today, if you have an application which knows that day 40000 is July 7th, then you’d better not treat your date that same way in Excel (or vice-versa).

The thing that I find really amazing with this is that Excel tells me that Feb 29, 1900 was a Wednesday. But it didn’t exist – so what happened that week? Actually (and you can check other calendars for this, including Windows’ one), Feb 28th was a Wednesday, and Excel gets the day of the week wrong for the first 59 days of its calendar.

I know you don’t care, but perhaps you should – in case you ever write an application that needs to know what day of the week it is.

Working out the day of the week is really trivial. For instance, in SQL Server, you can generally ask for the DATEPART(dw,…) of the date in question, and get a number back, telling you what day of the week it is. It’ll tell you 1 for the 1st day of the week, 2 for the 2nd, and so on.

Which is great, until you find that someone in your organisation says that Sunday is the first of the week, but someone else insists that it’s Monday. In the movie industry, I think Thursday is the first day of the week. So then, when is the 5th day? In SQL we have @@DATEFIRST, which helps a lot, but a method I like to use is to count the number of days since a known Sunday (or whatever), and take the “mod 7”. If that’s zero, I’m an exact number of weeks since that known Sunday. It works nicely, and it’s simple enough for everyone to understand (and it works regardless of location or other changeable settings).

But if you had picked your “known Sunday” in early 1900 using Excel, you’d’ve got it wrong, and your data might not work if you push your system out to SQL later (so pick something later – like 1901). I recently dealt with a date dimension that someone had put together in Excel and imported into SQL – if this data had gone back to 1900, then there would’ve certainly been errors in it (for a start, the import wouldn’t’ve worked because SQL would’ve complained that Feb 29, 1900 wasn’t a valid date).

My preference with date dimensions is to use a lot of computed columns, and only ever populate a single field. It works nicely, and it’s almost no effort to extend the table to include extra dates when required.

Posted by Rob Farley | 1 comment(s)
Filed under: ,

The path <path> is already mapped in workspace <workspace>

i was getting the following error:

The path <path> is already mapped in workspace <workspace>

Here's  how i solved it.

Theres another way to do it through command line

Posted by hammad | with no comments
Filed under: , , ,

HP G60

I am currently using a HP G60 laptop.  Runs Windows 7 very well. I created a dual boot environment so I could install Windows 2008 R2 and to my pleasant surprise found Hyper-V runs on it.  Need to enable virtualisation in the BIOS but apart from that slight hiccup it installs and works very well.  Once I get the RTM version it will be time to finally abandon Virtual PC.

Also gives me a chance to play with James’ Hyper-V library.

Technorati Tags:
Posted by RichardSiddaway | with no comments
Filed under:

ISE on Windows 2008 R2

PowerShell version 2 is installed by default on Windows 2008 R2 Release Candidate (apart from server core). If you go looking for ISE you may not find it as it appears to be an optional feature install.

Easy to install and can of course be scripted from the server manager cmdlets.  That really is the way to configure R2 I think.  Vanilla install then have a set of scripts to install the roles\features you need.  Can’t dcpromo that way but everything else works.

Posted by RichardSiddaway | with no comments
Filed under:

A little coding of a remote control

http://www.comcast.com/Customers/Clu/ChannelLineup.ashx?area=0

I'm desiging a remote control... one that categorizes the stations we look at a regular basis.. and I'm using a piece of software to 'code up' the remote control.  Due to the fact that this is an older remote control and the driver for this is not 64bit, I'm having to use VMware to run the software and then download the program to the remote control.

But in seeing this thread on RemoteCentral I may try it again on the native Vista sp2.. I tried it initially on Sp1 and it sometimes worked fine, sometimes didn't....

In case anyone is still looking for a solution for NG TSU3500, I was able to install prontoeditNG using XP SP2 compatibility mode under Vista x64 bit SP2.
When conecting the remote, it is seen as an HID device, but uploads and downloads work fine.

And yes the icons look like an iPhone.  I'm using the template of several Prontos from the Remote Central site to design the remote for our house.  Instead of his and her stations, we have hers, hers, the Dog however doesn't have too many favorite channels other than Animal Planet.  Speaking of iPhones, my Sister got one of the new 3gS models and when they say that you have to recharge after a day... they weren't kidding.

IPhone 3GS owners bemoan its battery life - Los Angeles Times:
http://www.latimes.com/business/la-fi-iphone3-2009jul03,0,2546606.story

The do tell you that if you want to conserve battery life to turn off push, turn off 3g, turn off wireless, turn off.... well you get the idea...

Posted by bradley | with no comments
Filed under:

Feeding a driver

Notice: HP ProLiant G5 Servers - Installing the Embedded SATA RAID Controller Driver During an Installation of Windows Server 2008, Windows Small Business Server 2008, or Windows Essential Server 2008 - c01660474 - HP Business Support Center:
http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?objectID=c01660474

When building a server ... and especially if you are reusing hardware and well.. being ..cheap about it... one thing to check to see if the hardware you are trying to install on has a Server 2008 64bit driver.  Even on the newer low cost hardware that is meant to be used in the low end marketplace, you get to that very first screen where the system has booted up, it goes to find a harddrive to install to and....

nothing...

And without that driver in the right spot right there for that OS to see that embedded raid to then in turn see the drive, you go no where really fast.  The good news is that in this era you no longer have to find floppy disks and feed it to the server, you can now use cdroms or usb flash drives.  But the bottom line is still, you MUST have a driver for that hardware that the drives hang off of, otherwise that Windows Server 2008/SBS 2008/EBS 2008 will not see that system. 

This is why for the SBS 2008 era, the Win2k8 era, heck the Windows 7 era, your best experience will still be with new hardware that has the drivers tailored for that OS.

More posts here -- Business support forums - Works for me: ML110 G5, MS Windows Server 2008 Standard x64, and Embedded SATA RAID drivers:
http://forums11.itrc.hp.com/service/forums/bizsupport/questionanswer.do?prodSeriesId=3580609&prodTypeId=15351&threadId=1309171&admit=109447626+1246730114966+28353475

(as always, this is only an on premises problem, cloud computing never ever has any issues.)

(Yeah I know ... totally cheap shot, but I couldn't resist)

Posted by bradley | with no comments
Filed under:

Some Pretty Bizarre Excel Behavior (Mac-based)

Macs are the rage, right? Stable, intuitive, splashy looking? Unless you're me - I don't use them - perhaps a subject for another day. But, I do have friends who do, and while I give them an ear-load for doing so, so be it.

I recently received a fairly strange email from a friend of mine, using Excel, in an Office 2004 environment:

"I have an excel file open with multiple tabs, but all of the tab titles are blank with the exception of the one on the screen.  It happened after I copied one of them, and now all excel files I open with multiple tabs have the same issue."

Ce qui? Having never seen anything quite like this, I figured, either someone had a long night out on the town, or something freakish happened. My advice? Reboot your machine and try that again.

No good - to my surprise, not only did the issue persist, I actually got a screen-shot of it, here:

 

 

I've blurred out the cells' text to protect the innocent, but I didn't play games with Worksheets 2-4 tab names. Notice how they have no names, what-so-ever? Another issue with this Workbook is that the cell-formatting isn't correct in the Worksheets, either.

This is strange stuff. I've heard the song about having dessert on a horse with no name, but snacking while staring at a Worksheet with no name? This is new to me and, apparently, for real.

Not having a Mac close-by, where I could even attempt to replicate this strange phenomenon, I decided to scour the WWW. Oddly enough, while limited, I did get some pings, e.g.,

http://forum.soft32.com/mac/thread-sheet-tabs-ftopict82279.html

"I now noticed that if the file is double clicked to start Excel the blank sheet tabs (not really blank, just white text) will appear as with all subsequent files opened."

And the big one:

http://forum.soft32.com/mac/Text-disappears-worksheet-tabs-ftopict82593.html

"I discovered that it was due to a conflich with Acrobat's PDF Maker plug-in which was in the Excel startup folder. Once I removed it, the problem disappeared."

Spelling and terminology aside, it turns out that the Acrobat Distiller Add-in was the issue, in this case. Once she unloaded that, everything works as expected. Two thoughts:

  1. This only appears to be a problem with specific Excel files, although it can daisy-chain to other files in the same Excel instance
  2. This isn't to say all Add-ins are bad news, but some might cause problems

Part of me wonders how this Add-in managed to create this scenario? It's not normal, to say the least - is it a neat trick? I've never seen this on a PC, so I assume most readers will never run into this, and your chances of seeing this are probably slim on a Mac, as well.

This is on my top-5 of weird, unexpected, things seen in Excel, before.

Happy 4th of July!

Presenting at BA World

I'm going to be brave over the next couple of months and present a few times at the series of BA World conferences in Australia.  I'm presenting the following at Business Analysts World in Sydney 6-8th July and then in Melbourne 13-15th July on Business Analysts v Architects.  You did know there was a war, right? Wink Here's the adbstract:

There is much tension in all IT shops and all projects about the role of Business Analysts and Architects. The point where the roles meet is subject to much contention, and even anguish in some cases. This issue has been further exasperated by the advent of agile approaches and new design tools that further blur the line between Architects, Developer and Business Analysts. In his presentation, Kevin Francis, who is an experienced Architect and senior manager of Architects, Developers and Business Analysts will examine this issue. He’ll provide best practices in integration between Business Analysts and the rest of the development team in a pragmatic manner that can align with agile. He’ll also discuss the use of tools in enabling this interface.

Learning Objectives:

  • Understand the points of interface between Business Analysts and Architects from an Architect’s perspective
  • Learn the best practices available in the space and the division of labour across the roles
  • Review tools available to support the analysis, design and architecture of solutions

I'll post the presentation to my SlideShare page after the conference.

I'm also presenting at BA World in Canberra on September 21st-22nd on Requirements for Sustainable IT Systems.  More details on that to follow later.

Posted by Kevin Francis | with no comments

Early Bird Registration for Australian Architecture Forum

Just a quick note to let you know that Early Bird registration is open for the Australian Architecture Forum until July 15.  We are assembling a fantastic line-up of international speakers and Open Space participants from across the breadth of the IT landscape.  The conference is looking like better and better value all the time, and it is even better value if you register early.

Hope you can come and join us!

Stupid Outlook 2007 RSS Feed Workaround

I was starting to wonder why other people were getting news stories before me.

Then I realised I just wasn’t getting news at all.

Looking at my Unread RSS Feeds search folder in Outlook 2007, I noticed that I hadn’t received a single post since June 10th 2009. Coincidentally, this is when I installed a number of updates:

image

None of these updates had any “Known Issues” listed in the Knowledge Base articles associated with them that would stop feeds from updating, so I went searching.

First I went searching at Microsoft’s support page (a supported fix or workaround is generally so much safer and more reliable than an unsupported one), and found that this problem had indeed been fixed in the February 2009 Cumulative Update for Outlook 2007 (“RSS feeds become dormant and do not reactivate.”), which was incorporated into Outlook 2007 Service Pack 2. I’ve already installed those.

Great. They’re obviously talking about a completely different problem cause.

Next I go searching the web in general – I use Bing, simply because it’s easy to get to, and Google when I think the answer is more likely to be in the Usenet newsgroups (is it too much to ask Microsoft to maintain their own Usenet archive and search there from Bing?)

In this case, the web had sporadic references to people deleting “~last~.sharing.xml.obi” and “Outlook.sharing.xml.obi” – I would generally avoid doing this sort of change without a backup and a box of tissues to cry into when things go wrong. Deleting temporary files and hoping they get rebuilt is sometimes a miracle, and sometimes more of a magic trick, making things disappear without a trace. So I continued looking.

One question that was asked – and that I should have asked myself – is what kind of “feeds not updating” issue I was having. There are several kinds:

  • Feed data present, connection attempted, mismatch in dates
  • Feed data present, connection attempted, some other error
  • Feed data present, connection not attempted
  • Feed data not present

I was in the latter category – when I opened the Tools menu and selected Account Settings, the RSS Feeds tab contained only a few items, rather than the several dozen I was expecting to see. This is what I was expecting:

image

As it turns out, there is a simple and stupid workaround for this issue, which requires no deletion of files.

imageNavigate to the RSS Feeds folder (mine is under an RSS Feeds PST file, but if you selected the default, it’ll still be in your Personal Folders file), and for each feed that you’re missing, simply select the feed’s folder, as shown to the right.

For each folder you select, Outlook will display the downloaded items from that feed – and will slyly go behind the scenes to make sure that the feed is in the RSS Feeds tab.

For my several dozen feeds, this took a while, but wasn’t too bad.

[Note: Don’t try to navigate back through the folder history by holding down the ‘back’ key on your keyboard or Alt-Left Arrow – when I did this, Outlook crashed after zipping through a few folders.]

As you can see from my later screenshot of the “RSS Feeds” tab above, all my feeds are re-added, and a new sync caused them to be updated with new content.

It’d be really nice if this process could be automated for a number of folders at a time, to “refresh feeds from RSS Folders” – but for now, this is at least a workaround when you notice that you’re just not as well-informed as you used to be.

Posted by Alun Jones | with no comments

El viaje más caro de mi vida .. hasta ahora

Como suele suceder para finales del primer cuarto del año, este año asistí al MVP Global Summit en la ciudad de Seattle, Washington.  Una reunión que a lo largo de los años me ha dejado experiencias personales y profesionales muy enriquecedoras.

Tal vez, este año me dejó las experiencias y lecciones más inolvidables y dificiles de digerir.

Como parte de ese viaje decidimos con mi socio, visitar la ciudad de Vancouver en Canada.  Y como hacemos en algunas ocasiones llevamos nuestros portatiles, así como varias cosas de tecnología con nosotros.  Aunque generalmente somos muy cuidadosos, esta vez algo falló y nos robaron las maletas que teniamos en la cajuela del carro mientras almorzabamos.  Aparentemente esto es algo demasiado común en Vancouver, por el alto indice de drogadictos que buscan carros rentados seguros que ahí encontraran cosas de valor (como tristemente fue en nuestro caso), y especialmente con placas de U.S.

Aunque inicialmente pense que la situación iba a ser totalmente catastrofica porque recordaba que mi pasaporte con la VISA de Canada, la VISA de U.S., el formato I-94 se encontraban en mi backpack.  Por un golpe de suerte mi compañero puso los papeles por error en una guantera del carrro (definitivamente algo raro pasaba ese día porque yo nunca me separo de mi pasaporte...).

Al final, la situación se resumió en dos maletas menos con todo su contenido (laptops, GPS, una cantidad de discos duros externos, y todos los gadgets que solemos cargar los amantes de la tecnología...).

Pero ahí empezó también nuestro otro gran dilema: "Que hay sobre la información en todos esos medios?"

Aunque precisamente por el tipo de trabajo que hago apoyando a las compañias en buenas prácticas asociadas a la tecnología, esperaba que la situación no fuera tan crítica, una serie de eventos se confabularon para que al menos perdiera unas 3 semanas de trabajo:

  • Venia de dos viajes casi consecutivos de más de 10 días cada uno.
  • La política de backup semanal había fallado constantemente antes de los viajes por espacio en el disco de destino.
  • La poltica de backup diario estaba asociada a un disco portatil que también se perdió en el robo.
  • La noche antes de viajar intenté hacer backup pero fallo nuevamente por espacio .

Aunque el riesgo de que puedan acceder a la información (information disclosure) en este caso es mínimo (siempre habrá opciones de todas maneras), la perdida del trabajo total no la hemos terminado de estimar.

Esto me lleva a hacerles un par de recomendaciones especialmente dirigidas a los usuarios de portatiles:

  • Establezcan políticas de backup que minimicen la cantidad de información nueva que no esta protegida por periodos largos de tiempo.
  • Dispongan siempre de espacio sufiente para cumplir con su política de retención de backups.  En mi caso retengo solamente el backup inicial, el anterior y el que estoy realizando, pero un crecimiento explosivo en el tamaño de los archivos hizo que no se pudiera terminar el nuevo backup.  En este viaje ya llevaba una solución entre manos incluso antes de que nos robaran había comprado el Disco Maxtor OneTouch™ III Turbo Edition para solucionar mi problema de backups personales.
  • Los backups tienen múltiples objetivos, no enfoque sus backups con uno solo.  Entre Bien sea para protegernos contra fallos de hardware, contra acciones involuntarias o malintenciondas, pero siempre lo que buscan es tener la información disponible ante cualquier evento.  En mi caso cargar el otro disco con el backup diario en la misma ubicación con el laptop, fue un error grave, principalmente porque enfoque el backup como un medio de protección contra fallos de hardware.
  • Utilicen diferentes tipos de backup.
  • Si va a viajar haga backup antes que cualquier cosa, no lo deje para último momento cuando algo puede fallar.
  • Minimice el uso de tarjetas de almacenamiento portatiles(memorias USB, external H.D.D., SD, CF, etc), como medio de almacenamiento definitivo.  Estas tarjetas son principalmente para transferir información, no para guardarla definitivamente.  En mi caso se robaron un par de tarjetas, una SD (una que solo usaba para ReadyBoost , y otra USB que no utilizo para transportar archivos, por lo que tenia nada.
  • Proteja sus discos con mecanimos de autorización y encripción adecuados.  Windows Vista permite encriptar sus discos con BitLocker o por ejemplo herramientas como TrueCrypt, permiten encriptar sus discos sin tener una disminución  apreciable en el rendimiento
  • No almacene contraseñas, así sea en su propio computador.

Saludos, desde mi nuevo portatil.

 P.D.  Si alguién les ofrece un portatil Hp tx2022us de serie 13YL, no lo compren, por favor haganmelo saber (this is a small world, belive me).

Posted by mmendozg | with no comments
Filed under: ,

Multithreading: a final example on how CompareExchange might help you

In the last posts we’ve been poking around memory models, memory fences and other interesting things that might lead to the so called lock free programming. Before keep looking at how we can use those features from our C# code, I’d like to add one more example that shows how the interlocked operations might help you in the real world. Do you recall our implementation of the IAsyncResult interface?

At the time, we’ve used a lock for ensuring proper access and initialization of our manual reset event used for signaling the end of the operation. Now that we’ve met interlocked operations, we can improve that code and get rid of the lock. Let’s focus on the private GetEvtHandle method:

private ManualResetEvent GetEvtHandle() {
  var newEvt = new ManualResetEvent(false);
  if (Interlocked.CompareExchange(ref _evt, newEvt, null) != null) {
    newEvt.Close();
  }      
  if (_isCompleted) {
    _evt.Set();
  }      
  return _evt;
}

As you can see, we’ve replaced the lock with a CompareExchange method call for ensuring proper atomic update: if the _evt field is null, then set it to newEvt (which, if you recall our previous post on interlocked operations, will only happen when that value is null!). Since the method returns the old value, if we get anything different from null, then it means that some other thread already set the field to a valid value. When that happens, we need to clean up and close the manual reset event we’ve just created. And there you go: the lock is gone.

As you’ve probably guessed, This strategy can be adjusted to objects that implement the IDisposable interface and you can use it when the creation of new objects isn’t too expensive and you need to have only a single instance of an item (in other words, it might be a valid option for implementing singletons in multithreading scenarios).

And that’s it. Keep tuned for more on multithreading.

Posted by luisabreu | with no comments
Filed under: ,

McAfee DAT 5664 - False Positives may affect Compaq/HP drivers

For McAfee users, I'm sure also AVERT Labs is correcting this issue.  Still, it's worthwhile to monitor developments, as I'm staying on DAT 5663 on my corporate PC until this issue is resolved.

McAfee DAT 5664 - False Positives may affect Compaq/HP drivers
http://community.mcafee.com/showthread.php?t=231901
http://www.theregister.co.uk/2009/07/03/mcafee_false_positive_glitch/

QUOTE: IT admins across the globe are letting out a collective groan after servers and PCs running McAfee VirusScan were brought down when the anti-virus program attack their core system files. In some cases, this caused the machines to display the dreaded blue screen of death. Details are still coming in, but forums here and here show that it's affecting McAfee customers in Germany, Italy, and elsewhere. A UK-based Reg reader, who asked to remain anonymous because he was not authorized by his employer to speak to the press, said the glitch simultaneously leveled half of a customer's 140 machines after they updated the latest virus signature file.

Based on anecdotes, the glitch appears to be caused when older VirusScan engines install DAT 5664, which McAfee seems to have pushed out in the past 24 hours. Affected systems then begin identifying a wide variety of legitimate - and frequently crucial - system files as malware. Files belonging to Microsoft Internet Explorer, drivers for Compaq computers, and even the McAfee-associated McScript.exe were being identified as a trojan called PWS!hv.aq, according to the posts and interviews.

 

Posted by Harry Waldron | with no comments

July 4th based Malware circulating

 Malicious emails are being spammed related to the themes of: Independence Day, the Fourth of July and fireworks shows. Please avoid related email messages/attachments, special website links, and You-Tube links.

Cake July 4th based Malware circulating
http://isc.sans.org/diary.html?storyid=6727
http://securitylabs.websense.com/content/Alerts/3431.aspx
http://www.eset.com/threat-center/blog/?p=1244
http://www.symantec.com/connect/blogs/waledac-july-campaign

Cake Waldac.DU Information
http://blog.trendmicro.com/waledac-celebrates-independence-day-too/
http://threatinfo.trendmicro.com/vinfo/virusencyclo/default5.asp?VName=WORM_WALEDAC.DU 

QUOTE: The malicious Web sites in the current attack also have a July 4 or fireworks theme within the domain name. ThreatSeeker has been monitoring the registration of these domains. Should the user click on the video, which is designed to appear to be a YouTube video, an .exe is offered. When downloaded the .exe would install the latest Waledac variant onto the user's machine.

Posted by Harry Waldron | with no comments

MSI Compatibility: Lying about VersionNT and ServicePackLevel

MSI 5 on Windows 7 introduces a new application compatibility setting, as Chris Jackson describes in his blog.

To work around too strict OS version checks in LaunchConditions, Windows Installer can automatically try several variations of values for the VersionNT and ServicePackLevel properties to circumvent the condition. For instance it will start with VersionNT=600 (Windows Vista) and ServicePackLevel=14, then count down the SP level (13, 12, …, 0), then repeat the same with VersionNT=502 (Windows Server 2003) and so on, until the LaunchCondition succeeds. This is a per-msi setting on the local machine, which can be turned on using this dialog:

msiappcompat

According to the blog, Windows Installer also sets these properties which might be useful to detect that version lying is going on:

  • SHIMFLAGS
  • SHIMVERSIONNT
  • SHIMSERVICEPACKLEVEL

As far as I know these properties are currently not documented in MSDN.

Original article:
Unraveling the Mysteries of MSI Compatibility Modes in Windows 7

You deployed a new SBS 2008 and now the phones demand a password

...and the people in the office are not too pleased with that.  Or you have a PalmPre that won't work with the password policy - http://geekswithblogs.net/ntpro/archive/2009/06/25/133047.aspx

To edit this launch the Exchange 2007 console, click on the organization configuration, then on client access.  Right mouse click on the "Windows SBS Mobile Mailbox policy".  Click on the password tab and uncheck the "require password".

Sync the phones again, and you'll be good to go.

Here's the bad news... you just disabled that on EVERYONE and you probably don't want to do that in all cases. 

So here's a compromise.  Set up a brand NEW policy that copies over all of the settings of the SBS default policy, this time unchecking that password box.

Then you go down in the console to the recipient configuration, click on Mailbox and go into the properties of the user you want to exclude from the passwords on the mobile devices.

You Had Me At EHLO... : Exchange 2007 ActiveSync policies:
http://msexchangeteam.com/archive/2007/05/23/439541.aspx

To add a user to a policy using the management console, the following steps need to be completed:

1. In the console tree, expand the Recipient Configuration node, and then click Mailbox.

2. In the work pane, right-click the user who you want to assign to a policy, and then click Properties.

3. In the user's Properties dialog box, click Mailbox Features.

4. Click ActiveSync, and then click Properties.

5. Select the Apply an ActiveSync mailbox policy check box.

6. Click Browse to view the Select Exchange ActiveSync Mailbox Policy dialog box.

7. Select an available policy, and then click OK three times to apply your changes.

 

Posted by bradley | with no comments
Filed under:
More Posts Next page »