Security Advisory for Adobe Flash Player

Release date: December 3, 2009

Vulnerability identifier: APSB09-19

Platform: All Platforms

Summary

Adobe is planning to release an update for Adobe Flash Player 10.0.32.18 and earlier versions, and an update to Adobe AIR 1.5.2 and earlier versions, to resolve critical security issues. Adobe expects to make these updates available on December 8, 2009.

Security Bulletin

Posted Fri, Dec 4 2009 7:10 by Don | with no comments

Access Bulk Load data

We have already seen how to load individual records into an Access Table.  Sometime we require the ability to add multiple records.  We can easily adapt the way we use our Add-AccessRecord function to accommodate a bulk load scenario.

Lets create a csv file with the information

FirstName,LastName,DOB
Dave,Brown,15/06/1982
Jo,Black,27/07/1982
Alex,White,30/06/1982
Bill,Smith,17/07/1982

We can then write a script to read the csv file and add the data

001
002
003
004
005
006
007
008
009
010
011
Import-Module AccessFunctions
$db = Open-AccessDatabase -name test03.mdb -path c:\test
Import-Csv -Path c:\test\names.csv | foreach {
    $value = " ""$($_.FirstName)"", ""$($_.LastName)"", ""$($_.DOB)"" "
    $value
    Add-AccessRecord -connection $db -table test1 -values $value
}

Get-AccessData -sql "select * from test1" -connection $db -grid
Close-AccessDatabase $db
Remove-Module AccessFunctions

 

Start by importing the accessfunctions module and open the database.

use Import-Csv ro read the data file. Pipe the data into a foreach where we concatenate the values to give a single string. I’m using string substitution to achieve this. Notice the use of “” round the data values. This is to ensure that we get a each value wrapped as “value” when it is passed into the function. 

Once we have added the data we can use the Get-AccessData function to check our data has been inserted.

Final actions are to close the database and remove the module

Posted Fri, Dec 4 2009 11:40 by RichardSiddaway | with no comments

ALT.NET Hispano VAN: Get Things Done con Jeroen Sangers

Este sábado 5 de Diciembre, 18 GMT/UTC (3 de la tarde por aquí en Buenos Aires), habrá otra des-conferencia virtual de la comunidad ALT.NET Hispano. El tema será productividad, más específicamente Get Things Done (GTD) (ver también Consigue hacer el trabajo). La presentación inicial estará a cargo de Jeroen Sangers:

http://jeroensangers.com/

@jeroensangers

Este es el temario de Jeroen:

Mi presentación va más que nada sobre Getting Things Done y consiste
de tres partes:
1. Control: un flujo de trabajo para controlar tus acciones
2. Perspectiva: dar dirección a todo lo que haces
3. Consejos prácticas para implementar un sistema de productividad

GTD se populariza con un libro de David Allen. Pueden leer la descripción de GTD en el sitio de Allen:

What is GTD?

Ahí leo:

Sophisticated without being confining, the subtle effectiveness of GTD lies in its radically common sense notion that with a complete and current inventory of all your commitments, organized and reviewed in a systematic way, you can focus clearly, view your world from optimal angles and make trusted choices about what to do (and not do) at any moment. GTD embodies an easy, step-by-step and highly efficient method for achieving this relaxed, productive state. It includes:

  • Capturing anything and everything that has your attention
  • Defining actionable things discretely into outcomes and concrete next steps
  • Organizing reminders and information in the most streamlined way, in appropriate categories, based on how and when you need to access them
  • Keeping current and "on your game" with appropriately frequent reviews of the six horizons of your commitments (purpose, vision, goals, areas of focus, projects, and actions)

Pueden encontrar una buena descripción (con diagrama incluido, como el que aparece en el libro original) de GTD y una relación con los “cuadrantes de Covey” (me gusta recordar al creador de ese concepto, que es la matriz de Eisenhower).

Mis enlaces sobre GTD, y productividad:

http://delicious.com/ajlopez/gtd
http://delicious.com/ajlopez/productivity

Bueno, ya envíe varios posts sobre las VAN de ALT.NET Hispano, pero les recuerdo:

Si no conocen qué es una reunión VAN, pueden consultar VAN meetings. Para ver cómo se desarrolla una VAN de ALT.NET Hispano, y qué software necesitan para asistir, ver Descripcion-de-Reuniones-VAN. Pueden ver el historial de anteriores reuniones VAN (visiten las que dieron, por ejemplo, sobre NHibernate, WPF y demás) (yo participé en VAN sobre Scrum y en otra sobre generación de código). También pueden suscribirse para proponer nuevos temas, y colaborar con la comunidad. Si no pueden asistir a ésta VAN, seguramente quedará publicada más adelante, con video incluido.

Nos leemos!

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

Posted Fri, Dec 4 2009 10:13 by lopez | with no comments

Totalizadores y Contadores en una tabla de mi BD

Algunos de vosotros estáis preguntando como es posible totalizar ciertos valores ya sea de estadística o control en una de las tablas de nuestra aplicación.

Aquí os propongo una de las formas de implementarlo :
(Aunque no olvideis que existen otras formas de realizarlo, eso si quizas no tan accesibles :-))

En el lado de SQL podéis ejecutar este ‘script’ para generar la tabla…

CREATE TABLE [dbo].[Contadores](

      [Peras] [int] NOT NULL DEFAULT ((0)),

      [Naranjas] [int] NOT NULL DEFAULT ((0)),

      [Manzanas] [int] NOT NULL DEFAULT ((0))

) ON [PRIMARY]

Ahora solo tendréis que realizar el correspondiente ‘Update’ desde vuestra aplicación incrementando la columna que deseáis contabilizar. Esta pregunta es frecuente cuando se realizan aplicaciones tipo albaranes/facturas u otro tipo, en la que se requiere seguir o registrar una numeración aunque en ese caso no debéis olvidar bloquear el registro y más a lo sumo en aplicaciones que varios usuarios estén utilizando esa numeración.

    Private cn As New SqlClient.SqlConnection( _

          "Data Source=MiSrv\SQLEXPRESS;" + _

          "Initial Catalog=MiBd;" + _

          "Integrated Security=True")

    Private da As New SqlClient.SqlDataAdapter( _

          "Select * from Contadores", cn)

 

    Private Sub Button1_Click() Handles Button1.Click

        'En este caso simulamos incrementar el contador de Manzanas

        da.UpdateCommand = New SqlClient.SqlCommand( _

          "Update Contadores SET Manzanas = Manzanas + 1", cn)

        cn.Open()

        da.UpdateCommand.ExecuteNonQuery()

        cn.Close()

    End Sub

 

Espero que os sea útil,
Buen fin de semana.
Pep Lluis,

Posted Fri, Dec 4 2009 10:24 by peplluis | with no comments

Filed under: ,

Apple released 2 Security Bulletins for Java for Mac OS X 10.5 and 10.6

Java for Mac OS X 10.5 Update 6 and Java for Mac OS X 10.6 Update 1 was released yesterday by Apple. 

Posted Fri, Dec 4 2009 8:27 by donna | with no comments

Thanksgiving Webcam promo leads to malware

The $10 Webcam that Anna Giesman bought her daughter at Office Depot over the Thanksgiving weekend sounds like one of those deals that's too good to be true. And for her, it was.

A week later, she's worried and upset because a CD that came with the camera contained a Web link that apparently infected her PC with fake antivirus software.

Her story shows how easily malware can get onto the computers of unsuspecting consumers in an era when cyber-criminals are becoming expert at hacking legitimate Web sites to prey on their visitors.

Giesman bought the camera in order to give her daughter a way to chat over the Internet with a friend who had just moved to Germany. When she put the CD that came with the Markvision Magnetic Webcam into her PC, a menu popped up offering her drivers as well as a link to Markvision's site. Wanting to learn more about the product, she clicked on the Web link, but she immediately knew something was wrong.

Continued in http://www.computerworld.com/s/article/9141773/Thanksgiving_Webcam_promo_leads_to_malware

Posted Fri, Dec 4 2009 8:11 by donna | with no comments

EFF sues CIA, DoJ, DoD, DoT and Homeland Security on social networking surveillance

EFF sues feds for info on Facebook, Twitter, LinkedIn, YouTube and Flickr which I think a-OK if they have to find and able to find the correct bad guy.  It's good to question the guidelines though so they don't go overboard.

Posted Fri, Dec 4 2009 8:09 by donna | with no comments

[Misc] If you need to visit the American Embassy in London but…
… need to take your mobile or other electronic devices or ANYTHING with a battery in (yes including car keys that contain a battery for remote central locking whether the battery is built into the key or on a central fob), then you will NOT be admitted...

Posted Fri, Dec 4 2009 2:00 by Cliff Hobbs at myITforum.com

Filed under: , ,

"Fresh Carder" (fr3sh_card3r_rz) using Yahoo E-mail Account Creates Fake Bank Websites

F-secure has highlighted in their blog the following fake domains using Monica Lewinsky and other names (but using one Yahoo! e-mail account as fr3sh_car3r_rz@yahoo.com) to scam people by creating fake bank sites since 2008: 

     Domain Name: BENINECOB.COM
     Eco Bank
     David Kieselstein (fr3sh_card3r_rz@yahoo.com)
     81 fair hill drive
     westfield, New Jersey 07090
     US

     Domain Name: S-CFS.COM
     Citizens First Bank
     Monica Lewinsky (fr3sh_card3r_rz@yahoo.com)
     390 lewinsky ave
     hull port mn,49309
     US

     Domain name: NORDEABANKAB.COM
     Nordea Bank Ab
     Emilia Martins (fr3sh_card3r_rz@yahoo.com)
     1015 E Wylie St
     Bloomington, Indiana 47401
     US

     Domain name: BOF-IRELAND.INFO
     Bank of Ireland
     Patricia Jones (fr3sh_card3r_rz@yahoo.com)
     Rainwood Apts 1885 Harper Dr A
     Lake City 30260
     US

     Domain name: FIN-VB.COM
     First Investment Bank
     Don Spusta (fr3sh_card3r_rz@yahoo.com)
     1878 algonquin ave
     deltona, Florida 32725
     US

     Domain name: IRBUK-OFFICE.COM
     UK Inland Revenue & Customs
     West john (fr3sh_card3r_rz@yahoo.com)
     564 galant dr
     wincostin mn,48493
     US

     Domain Name: KCW-UK.COM
     Commonwealth Bank UK
     Monica Lewinsky (fr3sh_card3r_rz@yahoo.com)
     390 lewinsky ave
     hull port mn,49309
     US

Posted Fri, Dec 4 2009 7:57 by donna | with no comments

The reality of patching

Remember that skit with Lily Tomlin where she represented the phone company?

"We are omnipotent".  There are times I think people think that Microsoft's patching department thinks like this.

There are folks out there that think there are divisions in Redmond that are tasked with spyware better known as Windows Genuine Advantage and Office Genuine Advantage.

There are folks out there that think there are engineers in Redmond that have remote control buttons that remotely reboot computers at night for patching just at the opportune time to have the person lose data.

The reality is vastly different.

Fact 1:  Windows update settings never spontaneously change.  Ever.  If you think your settings changed, look in the windowsupdate.log file in the c:\windows directory.  You will probably find that either something got installed that changed the settings, or that you forgot that you set them that way. 

Fact 2:  Periodically the AU engine underneath Windows updates gets updated.  This engine update occurs even if you have it set to 'notify only'.  This is updating the under plumbing of the AU engine.  It's happened several times in the past.  And it always silently updates just fine in the past.  They do blog and warn people it's coming (see the http://blogs.technet.com/mu blog for details)

Fact 3:  Security patches get deployed on the second Tuesday of the month.  Then there are non security updates that get released at the end of the month on the 4th Tuesday.  You can track these releases by looking at this http://support.microsoft.com/kb/894199 .  There is a set release intended. 

Fact 4:  Not all patches are security patches.  Thus there are times you don't NEED to get patches on asap.  Conversely there are times you want to push up the deployment of a service pack that you'd otherwise hold back on.  Windows 2008 sp2 is one of these "you want it on the box" service pacsk.

Fact 5:  The people who code up Windows genuine advantage and Office genuine advantage do not secretly work for Apple, nor do they code spyware into the software.  While some argue that the WGA and now OGA should only do the test for validation once, the argument from the Redmond camp is that you need to protect yourself and retest the validity of software to ensure that you didn't get ripped off from a repair person.  I say they need to make the replacement media easier to get.  I'm still not sure if I should be more mad at OEMs or more mad at Microsoft for how hard it is to get repair media but that's another rant blog post for another day.

Fact 6:  Microsoft documents what each patch does and what the known issues are in each security bulletin at the top of each section.  You think I magically know the side effects?  I read the bulletins.  I also look at the patches being installed and unlike some vendors and journalists that were taken to task by Ed Bott, the goal for each Tuesday patching is to first step back and ask yourself if it makes any sense that the patch is doing what you think it's doing.  Prevx's claims that the updates were hardening registry keys didn't make sense.  Microsoft would have documented these changes.  They don't randomly throw out code.  And for all of the pain of patch Tuesday you think you see, there are gazillions of folks that get through Patch Tuesday just fine.

Fact 7:  Microsoft never blocks your Windows update settings.  If they are blocked you are either in a domain and the group policy on the server is controlling it, you have had a malware infection and the malware mangled the registry keys, or you've installed some lovely security software that decided that their security center was so vastly better than Microsoft's that they've taken it over.

Fact 8:  That warning the system gives you in the beginning of the install that they warn you to choose to install updates during the installation because if you don't the install could fail and you could be insecure is false.  At the present time, there are no installer only patches that fix things during the install.  Furthermore installing security updates during the intial install is placing the system more at risk as I guarantee that the Server teams and the Win7 teams are not testing build installs every time a patch comes out.  When the system is built, the firewall is enabled on the nic anyway, so exactly how do they think you are more at risk from attack is beyond me as well.  Not to mention most of us build servers and workstations behind firewalls anyway.

At the end of the day if you really think the operating system you use is that out to get you, maybe you need to find another operating system.  Because there is an element of trust that must be made with all software vendors. 

To the folks at Prevx who just damaged the trust of patching just a little bit more due to the "black screen of death" story fiasco ....way to go guys and thanks for the help in destroying it more.

Posted Thu, Dec 3 2009 23:49 by bradley | with no comments

Filed under:

Do you have a build document?

So officially demoted my SBS 2003 box tonight (sniff sniff, it served me well for five years) and once again, the first time I ran the dcpromo the netlogon service wouldn't shut down.  I just went into the service, shut it off and then the server dcpromo'd down.

I went back to my own recap of blog posts (which reminds me I need to add to) as my guidance.  See you guys think I blog to entertain you and gain brownie points with the Mini Cooper management so I can become a Mini Cooper MVP?  Wrong.  I do it for me because it helps me understand and document what I've done.  Go back to November of 2004 and that's the tasks I did when I built my SBS 2003.

To you this is a blog.  To me, it was my build document.  As I did a true dry run of my exact network migration from start to finish.  So when I hit those slight little roadblocks along the way... like the pdf file with the messed up permissions that stopped the robocopy from copying over that I fixed ahead of time by merely deleting the file since I didn't need it.   Like the fact that on the final step where the dcpromo got stuck on netlogon service still running and not shutting down, I went "oh yea, I blogged about that, just turn off the service and try it again"

And it reminds me that we need/you need/we all need to have a build document.  A plan of action.  A document that provides you guildance all the way from start to finish to patching. 

http://blogs.msdn.com/sbsdocsteam/archive/2009/11/12/the-windows-sbs-2008-migration-guides-are-updated.aspx

Something that takes those documents and make them your own.

Posted Thu, Dec 3 2009 23:30 by bradley | with no comments

Filed under:

When a C++ destructor did not run – Part 1

Consider this piece of C++ code.

   1: using namespace std;
   2:  
   3: class C
   4: {
   5: public:
   6:     C() 
   7:     { 
   8:         cout << "Constructed"; 
   9:     }
  10:     ~C() 
  11:     { 
  12:         cout << "Destructed"; 
  13:     }
  14: };
  15:  
  16: void SomeFunc()
  17: {
  18:     C c;
  19:     throw std::exception("Gone");
  20: }

If you know any C++ at all, you’ll know that when SomeFunc returns, both “Constructed” and “Destructed” will be printed to the console. That is because RAII in C++ guarantees that the destructor of an object created on the stack will always run when control leaves the scope, no matter what.

You put all this code is in a static library, say PureCPP.lib, and you compile it with the /EHs option, because you want to use C++ exceptions.

You then write a native application to consume this library, statically link to it, and everything works great.

One day, you wake up and realize you’ll have to try out this .NET stuff that everyone is talking about. You discover that there’s this language called C++/CLI that’s great for interfacing with native code. So you fire up VS, create a CLR console application that calls SomeFunc, and link PureCPP.lib against it.

Just when you’re wondering how easy things turned out to be, you notice something strange. There’s something missing in the console output. When you figure out what’s missing, your jaw hits the ground. Mine did too, when I realized that it was the “Destructed” part that was missing. Which means the impossible just happened - the destructor for class C did not run.

What followed was a long and exciting journey into the world of SEH (Structured Exception Handling), exception codes and exception propagation and handling by the CLR versus C++. All that in the next part – stay tuned.

Posted Fri, Dec 4 2009 0:01 by Senthil | with no comments

Remember the ‘wow’ factor?

How quickly it turned into the ‘Whoa’ factor?

I have been working the Microsoft Answers forum for a while now, and there is one forum group, Hardware and Drivers, which demonstrates the above very quickly. The basic claim is that Windows 7 will run on a less powerful machine than Vista ever could.

OK, I have a less powerful machine, but will Windows 7 run on it? I am not even going to try. You see, I know that there are components which are eminently not compatible with Windows 7 and the reason I know this is because manufacturers don’t like supporting older hardware.

The machine in question is a desktop model. One of the MAJOR benefits is that I can replace hardware devices for something that will work, but what if I had a laptop? I hate to think how many owners of older laptops have wasted cash on buying Windows 7 only to find out too late that Windows 7 compatible hardware drivers need to be made available by the respective hardware manufacturers.

OLDER HARDWARE? The adverts didn’t say anything about Windows 7 not running on older hardware. In fact, Microsoft went to some lengths to say that Windows 7 was more compatible with older hardware than Vista was. The problem is that your average computer user does not distinguish between ‘less powerful’ and ‘older’ because older is less powerful, so it should work, yes?

NO!!

There is no easy answer, and I have mixed feelings about the current advertising. Was Windows 7 really MY IDEA? I don’t think so, especially the new menu and task bar. It is about time that advertising rules were re-worked. If a product is worth anything, it will sell on its feature set and merits, not vague claims to greatness which are difficult to substantiate.

However, little Kylie is ok.. See YouTube – Windows 7 adverts because every time I try to paste a link, the video embeds and the blog is hardly able to open.. grrrrrrrrrr

Posted Fri, Dec 4 2009 0:59 by Mike Hall | with no comments

Filed under: ,

Steven Burn maintains hpHOSTS but he don't post as hpHOSTS and he's Professional and recognized Security Researcher! Do your research or come and join the security community to know him before you talk.

Microsoft MVP Steven Burn do not post in forums as hpHOSTS.  He post using MysteryFCM and his blog is here.  The hpHOSTS entry in WOT comments is not Steven Burn but it is a reference by WOT that the domain is in hpHOSTS database because hpHOSTS is a friend of WOT and WOT is using hpHOSTS database just like how some other good companies are using hpHOSTS database.

Steven Burn is a professional.  He help in forums for FREE.  He don't sell products too.  His work (software and online services) is free and you can find it in his other website - Ur I.T. Mate.  He's very active in security circle and I personally find him very professional.  His hpHOSTS was featured in Windows Secrets last October 2009 and May 2008 because he got the service that will help people to prevent bad sites.  He was interviewed last August 2009 and he was mentioned at SANS ISC Handler's diary (his investigation).  He was featured or thanked by Microsoft in their Security Newsletter last September 2009 and also is a RECOGNIZED security researcher.  See:  Security Researcher Acknowledgments for Microsoft Online Services.

Why this blog entry about our friend, Steven? It's because of this editorial or newsletter from Cloudeight InfoAve or Thundercloud.net is INCORRECT and WRONG article about Steven, about WOT and about Windows Secrets!  They simply don't know him and never even contacted him about hpHOSTS or did not even check with WOT what is hpHOSTS entry in WOT database and yet, they attacked his name three times (3 newsletters).

See Steven's take on this in http://hphosts.blogspot.com/2009/12/cloudeight-ever-hear-of-e-mail.html

Posted Fri, Dec 4 2009 1:30 by donna | with no comments

Silverlight 3 Parte No.3: Usando Elementos de estilos (Styles) para generar un mejor encapsulamiento de "Look and Feel" con VS 2008 y C#

Hola Amigos, gracias por leer mi blog, si te gusta los posts en mi blog, por favor sígueme en Twitter bajo @lalfarod> para ver mis aportaciones. 

 

Continuaremos con la tercera parte de nuestros post sobre Silverlight 3, esto lo estamos haciendo ya que está por salir Silverlight 4 y muchos de la comunidad desean aprender para estar listos antes de su lanzamiento. En esta ocasión hablaremos de cómo usar elementos de estilos (Styles) para generar un mejor encapsulamiento de "Look and Feel".

 

Silverlight soporta un mecanismo de estilo que nos permite encapsular varios valores de propiedades o configuraciones de controles como un recurso reciclable.

 

Podemos guardar estas declaraciones de estilos en diferentes archivos para nuestras páginas, esto es similar a usar el CSS con HTML cuando hacemos diferentes escenarios de customización.

 

Para nuestro ejemplo que venimos trayendo en las dos últimas partes (Parte numero 1 y Parte numero 2), vamos crear nuestros estilos adentro del archivo App.xaml que se encuentra en nuestro proyecto, esto permitirá que cualquier pagina pueda usarlo:

Vamos a empezar por encapsular estilos (Styles) en el control <Border></Border>   y el control <TextBlock></TextBlock>  que se encuentra en él:

Podemos crear dos elementos de estilos (Style) en nuestro archivo App.xaml, para encapsular las configuraciones que anteriormente pusimos de los controles <Border></Border>   y  <TextBlock></TextBlock>  :

Tomen en cuenta como le estamos colocando un valor único “Key” a cada estilo (Style).

Ahora podemos modificar nuestros los controles <Border></Border>   y  <TextBlock></TextBlock>  para que hagan referencia a estos valores únicos “Keys”. Usaremos un feature de XAML llamado "markup extensions" para hacer esto, los mismos son usados cuando no hay un valor constante o literal.

Primero les voy a mostrar cómo estaban declarados los controles en nuestro archivo MainPage.xaml:

Ahora asignando los valores únicos “Keys”, verán un código mucho más ordenado y fácil de entender:

Ahora veamos como quedo nuestra página en el IE:

Ya después de haber escrito toda la configuración de los controles en el archivo App.xaml, su código se vera de esta forma:

Encapsulando las configuraciones de los estilos de esta forma, deja a los programadores tener un mejor focus de los comportamientos en las aplicaciones y al igual deja poder usar de nuevo estos estilos en otros controles o paginas.

Un Saludo, 

Luis Antonio Alfaro
  

 

Posted Thu, Dec 3 2009 19:30 by lalfaro | with no comments

Filed under: , , ,

US CERT Warning - Fake H1N1 alerts circulating in email

Storm Please do not visit any H1N1 sites offered by email, as your PC may become infected with malware.

US CERT Warning - Fake H1N1 alerts circulating in email
http://www.us-cert.gov/current/index.html#h1n1_malware_campaign_circulating

Fake H1N1 (Swine Flu) alerts lead to malware
http://blogs.zdnet.com/security/?p=5045

QUOTE: Malicious hackers are using fake alerts around H1N1 (Swine Flu) vaccines to trick end users into installing malware on Windows computers, according to warnings issued by computer security firms.  The latest malware campaign begins with e-mail messages offering information regarding the H1N1 vaccination. The e-mail messages contain a link to a bogus Centers for Disease Control and Prevention site with prompts to create a user profile.  During this process, a malware file gets planted on the user’s machine.

Posted Thu, Dec 3 2009 20:15 by Harry Waldron | with no comments

Black Screen of Death Issues and free wallpaper

PrevX may have encountered a large pocket of users with KSOD issues and felt the issue was larger than it is currently being reported.  They have since updated the earlier post and apologized for some of the misleading information. Malware or video driver issues can indeed create KSODs. PrevX offers a good recovery tool that may reset Windows back to normal from a KSOD. I've downloaded a copy if needed to help friends or family in the future.

Most importantly, please continue to use the automated Microsoft Update to keep Windows and Office updated.  Patch management is important in staying secure. So far, there are no documented KSOD issues with Microsoft Update.  Graham Cluley’s blog was rated in one assessment as "Best IT Security blog".   I've found it to be a great resource.  He just posted some good feedback on the KSOD issue.

I've added some wallpaper to my growing library as well Smile

Download your very own Black Screen of Death Wallpaper
http://www.sophos.com/blogs/gc/g/2009/12/03/download-black-screen-death/

QUOTE:  I've even made it available for download as a 1024x768 pixel Black Screen of Death wallpaper should you want it. Look! I even managed to get a Black Screen of Death on my MacBook. Joking aside, PrevX's original blog post does seem to have been unfortunate. The claim that the problem could affect "millions" or Windows users was clearly far wide of the mark. If there had been problem as widespread as PrevX's initial headline suggested then we would have expected many reports popping up on the net.  Obviously Prevx's alert has backfired on them, and I think they've shown good character in coming clean and apologising to the IT community and Microsoft specifically for any confusion that has occurred.

P.S. KSOD = blac(K) (S)creen (O)f (D)eath

Posted Thu, Dec 3 2009 19:44 by Harry Waldron | with no comments

NOVELL: Downloads - Novell Linux Management Pack for System Center Operations Manager
  Novell ® Linux* Management Pack for Microsoft* System Center Operations Manager expands the monitoring capabilities of Operations Manager in enterprise environments by enabling monitoring of key Linux services. A consolidated operations console...

Posted Thu, Dec 3 2009 17:38 by Rod Trent at myITforum.com

PowerShell script to check if an OpsMgr Agent was installed
  PowerShell script to check if an OpsMgr Agent was installed: Stefan Stranger's Weblog - Manage your IT Infrastructure : Have these servers an OpsMgr agent installed? Read More...

Posted Thu, Dec 3 2009 16:09 by Rod Trent at myITforum.com

C# – Bitmap – Como Convertir Una Imagen a Escala de Grises

Este articulo es una copia cruzada de mi blog original, visítalo en:

http://juank.black-byte.com/c-bitmap-convertir-imagen-escala-grises/

-------------------

Hola, hace apenas unos días publiqué un artículo para convertir una imagen  a escala de grises utilizando XNA Framework:

C# – XNA- Como Convertir Una Imagen a Escala de Grises

 

Bien como no todo mundo conoce XNA Framework he decidido hacer una versión más accesible utilizando el objeto Bitmap de System.Drawing. Algunas cosas serán un ligeramente más difíciles pero en esencia es lo mismo.

 

Nuevamente explicare el tema de la conversión de Color para evitar el ir y venir al  link anterior.

 

Cómo Convertir una Imagen a Escala de Grises

Básicamente para que una imagen sea vea en tonos de gris se requiere que los tres componentes básicos del color (  en el computador: rojo, verde, azul – RGB por sus siglas en ingles  ) tengan más o menos la misma intensidad, podemos decir que si queremos convertir un pixel a su equivalente en escala de grises bastaría con hacer algo como esto:

 

  1. Sumar los valores de los componentes de color del pixel, es decir sumar R + G + B
  2. Sacar el promedio de esa suma
  3. El valor hallado se debe asignar a R, G y B

Con estos tres pasos ya logramos que el pixel sea de color gris ya que cada uno de sus componentes tiene el mismo valor.

 

Hay muchas otras formas de hacerlo, incluso alguien que haya trabajado previamente con imágenes puede tener su propia versión de como implementarlo de acuerdo a lo que necesite o al tiempo que tenga. Pero existe una manera ampliamente conocida y aceptada en el gremio de las personas que trabajan con imágenes y visión por computador esa manera es la que aprenderemos a efectuar.

El ojo humano y su sensibilidad

Bien, resulta que el ojo humano es mucho más sensible a los colores verdes y rojos que al azul, por lo que en cuanto a precepción de iluminación se trata nuestro ojo reconoce los patrones de iluminación en color en las siguientes proporciones para cada componente:

 

  • Rojo:30%
  • Verde:59%
  • Azul:11%

 

Así que lo más adecuado es calcular el valor de cada componente de color con base a esta proporción y de este modo se obtiene el pixel de color gris con la iluminación adecuada para que nuestro ojo lo perciba como un mejor equivalente a su versión en color.

 

Manos A La Obra, Tiempo de Programar

Los Bitmap tienen diversos formatos, el más normal hoy día es el de color de 24 bit, el cual tambien es el valor por defecto cuando cargamos imagenes jpg, en este artículo trabajaremos diseñando un algoritmo para 24 bit de color, a diferencia de como se hizo en el artículo de XNA donde presumimos que trabajabamos con imagenes de 32 bit. Para visualizar un objeto Bitmap basta con usar un PictureBox y a este se le asigna la imagen en su atributo Image, tal como lo vemos a continuación:

private void Form1_Load(object sender, EventArgs e)
{
Bitmap imagen = new Bitmap("conejo.jpg");
pictureBox1.Image = imagen;
}






 

image

Ahora lo que haremos es crear una función que reciba como parámetro un objeto Bitmap ( o imagen ) y devuelva un nuevo Bitmap ( o imagen ) convertido a escala de grises:

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);
 
return target;
}






Padding y Stride

El siguiente paso es obtener del bitmap la información de los pixeles que lo conforman, esta tarea si bien es sencilla es un poco más complicada de hacer a lo que es con un Texture2D de XNA, debido a que el objeto Bitmap representa su información de color fielmente a lo que es un archivo bmp. Por ello se debe tener en cuenta que no todos los bytes son información de color, algunos de estos bytes solo son de relleno y ello puede cambiar de un Bitmap a otro segun sus dimensiones y profundidad de color, esta caracteristica es normalmente conocida como padding y en su momento se implemento para hacer que la lectura del archivo bmp fuera mucho mas rápida al poder cargarla en bloques de enteros.

Asi que lo siguiente a realizar es obtener la información de la imagen lo cual lo hacemos con el método LockBits, el cual retorna un objeto BitmapData

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);
BitmapData bmpData = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly,
source.PixelFormat);

return target;
}






 

Sin embargo BitmapData no nos sirve para recorrer byte por byte la información de color, por lo que ahora debemos convertir bmpData a un byte[]… pero Como?

Debemos apoyarnos en los mecanismos de Marshal provistos por el .net Framework, la clase Marshal permite por ejemplo convertir un bloque de memoria no administrado en un bloque administrado, el objeto bmpData tiene un atributo Scan0 que no es más que un puntero al arreglo de bytes donde esta la información del color, así que podemos utilizar ese puntero para crear poner la información en nuestro array de bytes.

Pero antes debemos crear el array de bytes, el tamaño del array debe ser básicamente ancho x alto x número de bytes por pixel… pero… hay que tener en cuenta el padding…los bytes de relleno. Calcular el padding es muy fácil aunque es dependiente sobre todo de la profundidad del color, pero el objeto bmpData tiene un atributo llamado Stride el cual es el ancho en bytes de cada línea de pixeles incluyendo el stride, así que nuestra formula para hallar el tamaño del array de bytes se reduce a: bmpData.Stride * alto

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);

BitmapData bmpData = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly,
source.PixelFormat);
 
byte[] targetBytes = new byte[bmpData.Stride * source.Height ];
 

return target;
}






 

El engorroso sistema de acceso a los pixeles

Ahora utilizando Marshal obtenemos el array de bytes:

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);

BitmapData bmpData = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly,
source.PixelFormat);
 
byte[] targetBytes = new byte[bmpData.Stride * source.Height ];
 
Marshal.Copy(bmpData.Scan0, targetBytes, 0, targetBytes.Length);

return target;
}






 

como tambien necesitamos acceder a la infromación en bytes del bmp de destino es necesario repetir las mismas tres operaciones pero en LockBits ahora colocamos WriteOnly.

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);

BitmapData bmpData = source.LockBits(new Rectangle(0, 0, source.Width, source.Height),
ImageLockMode.ReadOnly,
source.PixelFormat);
 
byte[] targetBytes = new byte[bmpData.Stride * source.Height ];
 
Marshal.Copy(bmpData.Scan0, targetBytes, 0, targetBytes.Length);

BitmapData targetData = target.LockBits(new Rectangle(0, 0, target.Width, target.Height),
ImageLockMode.WriteOnly,
target.PixelFormat);
byte[] targetBytes = new byte[targetData.Stride * targetData.Height];
Marshal.Copy(targetData.Scan0, targetBytes, 0, targetBytes.Length);
 
return target;
}






 

Como es casi el mismo código podemos optimizarlo y organizarlo un poco así:

private byte[] GetImageBytes(Bitmap image, ImageLockMode lockMode, out BitmapData bmpData)
{
bmpData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
lockMode, image.PixelFormat);
 
byte[] imageBytes = new byte[bmpData.Stride * image.Height];
Marshal.Copy(bmpData.Scan0, imageBytes, 0, imageBytes.Length);
 
return imageBytes;
}
 
private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);
BitmapData targetData, sourceData;
 
byte[] sourceBytes = GetImageBytes(source, ImageLockMode.ReadOnly, out sourceData);
byte[] targetBytes = GetImageBytes(target, ImageLockMode.ReadWrite,out targetData);

return target;
}






 

Ahora se debe recorrer el array de bytes para convertirlo a escala de grises, para poder hacerlo necesitamos recorrer el arreglo en saltos de a pixel, si trabajamos con BMP de 24 bit el tamaño de cada pixel es de 3 bytes.

En un Bitmap el formato de color viene en BGR (Blue Green Red) mientras que en XNA viene en BGRA (Blue Green Red Alpha) teniendo en cuenta esto la implementación para convertir los bytes a escala grises queda:

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);
BitmapData targetData, sourceData;
 
byte[] sourceBytes = GetImageBytes(source, ImageLockMode.ReadOnly, out sourceData);
byte[] targetBytes = GetImageBytes(target, ImageLockMode.ReadWrite,out targetData);

//recorrer los pixeles
for (int i = 0; i &lt; sourceBytes.Length; i += 3)
{
//ignorar el padding, es decir solo procesar los bytes necesarios
if ( (i + 3) % (source.Width * 3) &gt; 0 )
{
//Hallar tono gris
byte y = (byte)(sourceBytes[i+2] * 0.3f
+ sourceBytes[i + 1] * 0.59f
+ sourceBytes[i] * 0.11f);
 
//Asignar tono gris a cada byte del pixel
targetBytes[i + 2] = targetBytes[i + 1] = targetBytes[i] = y;
}
}
 
return target;
}






Finalmente hay que copiar el array de bytes modificado al bitmap de destino, y desbloquear ambos bitmaps:

private Bitmap CreateGrayScaleBitmap(Bitmap source)
{
Bitmap target = new Bitmap(source.Width, source.Height, source.PixelFormat);
BitmapData targetData, sourceData;
 
byte[] sourceBytes = GetImageBytes(source, ImageLockMode.ReadOnly, out sourceData);
byte[] targetBytes = GetImageBytes(target, ImageLockMode.ReadWrite,out targetData);

//recorrer los pixeles
for (int i = 0; i &lt; sourceBytes.Length; i += 3)
{
//ignorar el padding, es decir solo procesar los bytes necesarios
if ( (i + 3) % (source.Width * 3) &gt; 0 )
{
//Hallar tono gris
byte y = (byte)(sourceBytes[i+2] * 0.3f
+ sourceBytes[i + 1] * 0.59f
+ sourceBytes[i] * 0.11f);
 
//Asignar tono gris a cada byte del pixel
targetBytes[i + 2] = targetBytes[i + 1] = targetBytes[i] = y;
}
}
 
Marshal.Copy(targetBytes, 0, targetData.Scan0, targetBytes.Length);
 
source.UnlockBits(sourceData);
target.UnlockBits(targetData);
 
return target;
}






Wowfff! finalmente asignamos la imagen al PictureBox:

private void Form1_Load(object sender, EventArgs e)
{
Bitmap imagen = new Bitmap("conejo.jpg");
pictureBox1.Image = imagen;
pictureBox2.Image = CreateGrayScaleBitmap(imagen);
}






image

Posted Thu, Dec 3 2009 17:02 by Juan Carlos Ruiz Pacheco | with no comments

More Posts Next page »