Thursday, July 29, 2010

Necessity of Optical Drives?

I have already gone from nine machines to seven.  The next net shift involves me giving up two machines and the wife giving up one.  Behold the power of virtual machines...

With the advent of the purchase of two Gateway LX series cases (the ones with the awesome dual SATA backplane and removable 3 1/2" caddies).  I am considering not having optical drives installed.

Both of the boards I will be building on will boot from my USB optical drive.  And with 100% of the software I use being accessible via the network after the OS install.  The OS install seems like the only reason I would want an optical drive.  I will never burn disks or read disks from those machines, why draw wattage for what amounts to vestigial components?  I suppose I could set up network booting, but using an install disk once seems so much easier.

So, I guess I am arguing that in our case a single optical USB drive and the optical drives on our laptops should be sufficient for our needs.

Friday, July 23, 2010

I have a virus! What do I do!

AVG ( http://free.avg.com/us-en/homepage ) is a good free anti-virus program that monitors your PC on a regular basis.  Surprisingly, another decent one is from Microsoft and also free; it is called Microsoft Security Essentials (MSE) ( http://www.microsoft.com/security_essentials/ ).

One program that I love and use at work regularly enough is called Malwarebytes ( http://www.malwarebytes.org/mbam.php ).  Install it and run it like any other program...

-----

If you already have an anti-virus program, try it first.

If you already have an anti-virus program and it is no longer activated or working, uninstall it through the control panel.  Then install either AVG or MSE and run a scan.

Obviously if you don't have anything and you're "running naked",  then install either AVG or MSE and run a scan.

Additionally, download and install Malwarebytes to work as a supplement to your anti-virus.  Malwarebytes will only run when you tell it to and it plays nice with your anti-virus software.

Note: having two anti-virus programs like both AVG and MSE at the same time will be worse than having viruses.  One anti-virus.  One.

-----

As an added measure, for the paranoid people, unplug your 'internet' wire when you are not using your PC until you get your virus issue solved.  That will interrupt most intermittent transmissions of your data to the virus mothership computers.

Then there is the option to call a professional, like me.  Message me if interested.

Good luck any which way.

P.S. For bonus nerd points take this interesting and promising bit of technology out for a spin ( http://www.free-av.com/en/products/12/avira_antivir_rescue_system.html ) .

PHP Server Time in Your Javascript Timer

<html>
<head>
<title>Simple PHP to Javascript date and time function</title>

<!-- The main trick to creating a timer in general with Javascript is to create a self-referencing function.  You can see the function is named timer() then several lines down inside itself it calls the timer() function. -->

<script type="text/javascript">
function timer() {

// The first thing to do is to check if we have already gotten the server time or if the timer has been running.  If the variable holding the "UNIX epoch" is empty (undefined-- whatever), then this is the first iteration and we should get the server time with the PHP function time().

if (typeof x=="undefined")
{
   x=<?php echo(time()); ?> ;
}

// At this point we have a date and time in the form of a 'UNIX epoch', or milliseconds since January 01, 1970 at midnight beginning the day.  That or we have the epoch with an unimportant number of seconds added depending on how long the script has been running.  In any event an acceptable format of the date and time is in variable x.

// We create a Date object based on our variable x every cycle of the function and name the object t.  If we already have a date object, it is destroyed by the new one.  The UNIX epoch in milliseconds is an acceptable time format for the new Date() function.  The epoch is also easy to get from PHP.  Yay, for compatible intersystem data portability!

   t=new Date(x);

// Awesome, now we can manipulate the object any way we see fit.  I am getting a few pieces of data out of the object here.

  hour=t.getHours();
  min=t.getMinutes();
  sec=t.getSeconds();

// These three lines are unimportant, I just happen to like fixed width displayed variables and leading zeros make that possible.

  if (min<=9) { min="0"+min; }
  if (sec<=9) { sec="0"+sec; }
  if (hour<10) { hour="0"+hour; }

// Each time this function is run I am changing the text within the HTML tags with the id of "id" to a concatenated and formatted string using the Document Object Model.

  document.getElementById("id").innerHTML=hour+":"+min+":"+sec;

// This is critical to incrementing the time.  I am simply adding 1000 milliseconds to the UNIX epoch each iteration.  The time object is based on x.  Adding time to a date object is hard and boring.  Adding 1000, the amount of milliseconds in 1 second, to x is easy.

   x=x+1000;

// Accuracy to the second is fine in our example.  This setTimeout() function sets a timer in milliseconds for the instructions within to be executed.  The instructions within are to run the timer() function.  This is referred to as self referencing and creates a theoretical infinite loop of these instructions.  And not randomly coincidental, the timing matches the increment of x.  So, to increase accuracy to the obvious maximum would to increment x by 1 and set the timer to execute every 1 millisecond.

  setTimeout("timer()", 1000);
}
</script>
</head>

<!-- This onLoad event in the body tag triggers our first iteration of the timer() function which sets into motion the infinite loop via self reference.-->

<body onLoad="timer()";>

<!-- Here is our HTML element with the id of "id".  We update what people see at the moment we change the innerHTML of these tags via the function.-->

<p id="id"></p>
</body>
</html>

Followers