Tuesday, May 22, 2007

How to Drive a Manual Transmission

Learning to drive a stick shift isn’t easy for most people, but with time and practice it becomes second nature. These pointers will get you started in the right direction.

  1. Look at the floorboard; you’ll see three pedals. From left to right, they are: clutch, brake, and gas.
  2. Study the simple diagram on the top of the gearshift, which will show you where the gears are. In most new cars, this will look like a three-legged H. First, third and fifth gears are at the tops of the legs; second, fourth and reverse gears are at the bottoms. The crossbar of the H is neutral.
  3. Make sure the parking brake is engaged and the car is on a flat surface in an area where you have plenty of room.
  4. Press down on the clutch pedal and then move the gearshift into the neutral position.
  5. Start the car.
  6. Keeping the clutch pedal down, put the car into first gear by moving the gearshift to the top-left position.
  7. Apply the foot brake and release the parking brake.
  8. Release the foot brake when you’re ready to start moving.
  9. Begin to release the clutch pedal slowly; when you hear or feel the engine begin to slow down, slowly press down on the gas pedal as you continue to release the clutch. The car will start to move forward.
  10. Accelerate until the car has reached about 3,000 rpm, then take your foot off the gas, press down on the clutch pedal, and pull the gearshift directly down through neutral to second gear. Be sure to pull the gearshift down until it can’t go any farther.
  11. Release the clutch pedal gently, simultaneously pressing down gently on the gas pedal.
  12. Repeat the shifting process each time you hit 3,000 rpm until you’re driving at the appropriate speed. (Third gear is up and to the right; fourth gear is all the way down from there; fifth gear is up to neutral, right and then up again.)
  13. Downshift by releasing the gas pedal when you want to decrease your speed. Press down on the clutch and move the gearshift through neutral into the next-lower gear (move down only 1 gear at a time). Once you’re in the lower gear, release the clutch slowly and brake as you do so.
  14. Stop the car by downshifting to second gear and applying the brakes. Apply the clutch just before the car stops. Don’t downshift into first.
  15. Drive in reverse by following the same steps you would for starting in first gear. The reverse gear engages more quickly than first gear, however, so be sure to release the clutch slowly and begin to press the gas pedal as soon as the car begins to move.

Avoid coasting with the clutch all the way down (called “riding the clutch”), as this will cause needless wear and tear on the clutch. When stopped at a traffic light, put the gearshift into the neutral position and release the clutch rather than sitting with the clutch engaged. You’ll know you’re in the right gear for your speed if the engine is running smoothly. If it’s coughing and sputtering, shift to a lower gear. If the engine noise pitch is too high, shift to a higher gear.

Do you have a question that you want answered? So do we! But we’re at a loss for the answer to our question. So why don’t you just ask us your question at How Do I? and see if either we can or one of our many viewers can answer it? Maybe…


Sunday, May 13, 2007

Changing Cell Color with VBA in Excel


By Guy Lecky-Thompson:


Introduction


This article covers ways to change cells and cell properties in Excel, using Visual Basic for Applications, or VBA. VBA is the built-in macro programming langauge used by all Microsoft Office applications, and allows the programmer to change the properties according to the document model provided by the underlying application.


Sometimes it is useful to change the appearance of a cell based on it’s contents. For example:



  • Teacher’s spreadsheets - low grades in red;

  • Web site statistics - climbers in green, losers in red;

  • Names in different colors, etc. etc.

In order to do this we need to isolate those cells that we wish to hilight, the criteria upon which we wish to make the decision, and the actual hilighting feature we wish to employ. In Excel, VBA provides a way to change many properties, including:



  • Font (Text) Color;

  • Font (Text) Size;

  • Cell background color (shading);

  • Cell borders, etc. etc.

For the purpose of this discussion, we shall assume that we have a spreadsheet, with a column titled ’Average’, and that we want anything less than 50.0 to be hilighted by a red background. The sheet shall be called ’Totals’.


(There is addition information in the article Getting Started with VBA for MS Excel that covers how to enter code, and prepare macros and Visual Basic programs, for the uniniated...)


Referencing the Cells


Excel works with cells in ranges. A range can be one or more cells. These cells are contained in rows and columns in a sheet. Each sheet has a property, ’Cells’, which allows us to reference such a range.


At it’s smallest granularity, we might use this propery to reference a single cell:


Worksheets("Totals").Cells(1,1)

The above refers to a single cell, at Row 1, Column 1 - it is the equivalent to A1 on a spreadsheet. Row 1, Column 2, (1,2) would be cell B1. Row 2, Column 3 would be cell C2, and so on.


We can also refer to an entire column:


Worksheets("Totals").Columns(1)

The above refers to all of Column A. So, we have enough information to prepare the code that determines which column we are interested in; this was the first step we isolated in the Introduction.


We need to look at all the column headers, and note down which column has the word ’Average’ in it. This can be done as follows:


Function FindColumn(szName) As Integer
nFoundColumn = 0
For nColumn = 1 To Worksheets("Totals").Columns.Count
If StrComp(Worksheets("Totals").Cells(1, nColumn), szName) = 0 Then
nFoundColumn = nColumn
End If
Next nColumn
FindColumn = nFoundColumn
End Function

In this snippet, the For loop (code between the For... and Next... statements) allows us to move through the columns, nColumn by nColumn. We use StrComp to evaluate the contents against the szName parameter fed into the Function.


The function returns (using the line FindColumn = nFoundColumn) the index of the column containing the value szName.


Scrolling Through the Dataset


Once we have found the column, we can proceed to loop through the rows (starting at row 2, row 1 containing the heading), evaluating the contents of each cell. To look up the column, we use the following call to our FindColumn function:


nCol = FindColumn("Average")

If this call returns 0, we know that the column does not exist, and we need go no further. From our previous For code snippet above, we can construct a similar loop for the rows:


For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
Rem Do Work Here
Next nRow

At each iteration of the loop, we need to evaluate the cell, and decide whether it is lower than the threshold (in this case, 50). However, given that the Count might include cells that are empty (rather than set to 0), we might not want to include them. This is especially true since Excel will run through all 65,000 rows, and evaluate each one. If we do not either:



  • Tell Excel to stop at the last Row;

  • Ignore empty cells.

There are therefore two possibilities - test for a known ’stop’ value in a cell, or ignore empty cells. The advantage of having a stop value is that empty cells will be chosen, and hilighted, otherwise they need to be set to 0 in order to be chosen.


For the sake of simplicity, we will just ignore empty cells:


For nRow = 0 To Worksheets("Totals").Columns(nCol).Rows.Count
If Not IsEmpty(Worksheets("Totals").Cells(nRow, nCol)) Then
If Worksheets("Totals").Cells(nRow, nCol) 50.0 Then
Rem Hilight cell
End If
End If
Next nRow

The above uses the IsEmpty function to ascertain whether the cell contains any data. The double If (nested If) statement is used for clarity, a Boolean operator could have been used to combine the two statements.


Hilighting the Cell


Finally, we need to hilight the chosen cell:


Worksheets("Totals").Cells(nRow, nCol).Interior.ColorIndex = 3

The Interior property references the color and style of the shading. It uses an index, rather than a real color, and a collection of constants to set the shading style. These are out of scope for this article, but can be found in the Visual Basic for Excel online help files.


Summary


The above is just one way to achieve the goal, and is presented here for education, and not as the most elegant solution. In particular, the bounds checking for the data set, and hilighting code could be changed to allow for more flexibility / user friendliness. Fee free to post your contribution at the end of this page.



Changing Cell Color w/VBA in Excel: How to conditionally change cell properties based on contents.


Wednesday, May 2, 2007

The Famous Hacked HD-DVD/Blu-Ray Processing Key

There appears to be a storm emerging on the internet regarding the famous HD-DVD/Blu-Ray processing key:

0x09,0xF9,0x11,0x02,0x9D,0x74,0xE3,0x5B,
0xD8,0x41,0x56,0xC5,0x63,0x56,0x88,0xC0

This key originated from one of the Wired blogs:

The New HD-DVD/Blu-Ray Hack: What It Might Mean For Us

That's the so-called "Processing Key" that unlocks the heart of every HD-DVD disk to date. Happy Valentine's day, AACS.

AACS, a DRM scheme used to encrypt data on HD-DVD and Blu-Ray disks, would appear to be cracked wide open by that short string of hexadecimal codes, as previously, only disk-specific Volume Keys were compromised. The new hack is the work of Arnezami, a hacker posting at the doom9 forums, fast becoming the front line in the war on DRM.

"The AACS is investigating the claims right regarding of the hack," said AACS spokesporson Jacqueline Price. "It is going to take a appropriate action if it can be verified."

Price said she could not disclose what their investigation might entail, or what "appropriate action" might be.

“We’ve just learned of this claim today and are checking into it,” said Andy Parsons, chair of the Blu-ray Disc Association and senior V.P. of product development at Pioneer Electronics, in an email.

The new crack follows that from earlier this year, when a hacker by the name of muslix64 broke the AACS system as it applied to each movie. While the earlier hack led to 100 HD-DVD titles and a small number of Blu-Ray movies being decrypted one-by-one, the so-called "processing keys" covers everything so far made.:

"Most of the time I spend studying the AACS papers," Arnezami said in his forum post revealing the successful assault on the next-gen DRM system. "... what I wanted to do is "record" all changes in this part of memory during startup of the movie. Hopefully I would catch something insteresting. ... I now had the feeling I had something. And I did. ... Nothing was hacked, cracked or even reverse engineered btw: I only had to watch the "show" in my own memory. No debugger was used, no binaries changed."

It's not yet clear what it means for the consumer's ability to copy movies, or, for that matter, that of mass-market piracy operations. The short form is that the user still needs a disk's volume ID to deploy the processing key and break the AACS encryption — but getting the ID is surprisingly easy.

Arnezami found that they are not even random, but often obvious to the point of foolishness: one movie's Volume ID turns out to be it's own name and the date it was released. There isn't yet an automatic system, however, that will copy any disk, in the manner of DeCSS-based DVD copying systems.

Even so, the new method completely compromises HD-DVD in principle, as it relies on AACS alone to encrypt data, even if there are other parts of the puzzle that are yet to fit together. Blu-Ray has two more levels of protection: ROM-MARK (a per factory watermark, which might revoke mass production rights from a factory but not, it seems individuals) and BD+, another encyption system, which hasn't actually been used yet on sold disks (but which soon will be), meaning that its own status seems less obviously compromised.

How might the companies respond? The processing key can now be changed for future disks. However, the flaws inherent in the system make it appear easy to discover the replacement: the method of attack itself will be hard to offset without causing knock-on effects. For example, revoking player keys (in advance of obfuscating the keys in memory in future revisions of the system) would render current players unable to view future movies. Revoking the volume and processing keys that have been hacked would mean that all movies to date would not run on new players.

Publishers could randomly generate Volume IDs in future releases (as they are still needed for the current hack to work), which would make them harder to brute-force. That said, it's claimed that the "specific structure" of the Volume ID in memory makes it feasible to brute-force randomized ones anyway.

Following are links to the current discussion at the doom9 forums, in which Arnezami and other provide regular updates on their progress. We don't offer any warantee that the software implementations so far produced won't blow up your computer or get you thrown in jail and whipped with wet towels by MPAA lawyers:

Proof of concept code for the process key hack is here:
http://forum.doom9.org/showthread.php?p=953484#post953484

Implementation for Windows:
http://forum.doom9.org/showthread.php?p=953496#post953496

Implementation for OSX:
http://forum.doom9.org/showthread.php?p=953516#post953516

Here is the sample code:

// Processing Key
static unsigned char processing_key[16] = {0x09,0xF9,0x11,0x02,0x9D,0x74,0xE3,0x5B,0xD8,
0x41,0x56,0xC5,0x63,0x56,0x88,0xC0};


// Encrypted C Value
static unsigned char encrypted_c_value[16] = {0x6D,0x02,0xCA,0xC6,0x7B,0x1A,0x7E,0x95,0xC2,
0x16,0xEF,0xD4,0xC9,0x28,0x09,0xCF};


//Decrypted C Value
static unsigned char decrypted_c_value[16];
static unsigned char uv[4] = {0x00,0x00,0x00,0x01};

// Media Key
static unsigned char media_key[16];

//Encrypted Verification Data (King Kong)
static unsigned char encrypted_verification_data[16] = {0x87,0xB8,0xA2,0xB7,0xC1,0x0B,0x9F,0xAD,0xF8,0xC4,0x36,
0x1E,0x23,0x86,0x59,0xE5};


//Decrypted Verification Data Should Be
static unsigned char decrypted_verification_data_should_be[8] = {0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF};

//Decrypted Verification Data
static unsigned char decrypted_verification_data[16];

// Volume ID
static unsigned char volume_id[16] = {0x40,0x00,0x09,0x18,0x20,0x06,0x08,0x41,0x00,0x20,
0x20,0x20,0x20,0x20,0x00,0x00};


//Decrypted Volume ID
static unsigned char decrypted_volumeid[16];

//Volume Unique Key
static unsigned char volume_unqiue_key[16];


// First decrypt the C-value with the processing key
oRijndael.MakeKey((char *)processing_key, CRijndael::sm_chain0, 16, 16);
oRijndael.DecryptBlock((char *)encrypted_c_value,
(char *)decrypted_c_value);


// Then XOR it with with the uv (of the corresponding C-value)
for (j = 0; j <>
{
if (j <>
{
media_key[j] = decrypted_c_value[j];
}
else
{
media_key[j] = decrypted_c_value[j]^uv[j-12];
}
}

// Then check if the resulting media key is correct using the verify media key
oRijndael.MakeKey((char *)media_key, CRijndael::sm_chain0, 16, 16);
oRijndael.DecryptBlock((char *)encrypted_verification_data,
(char *)decrypted_verification_data);


if (!memcmp(decrypted_verification_data_should_be, decrypted_verification_data, 8))
{
for (j = 0; j <>
{
printf("%02X ", decrypted_verification_data[j]);
}
}
printf("\n");

// Then do a AES-G (basicly a decrypt and an XOR) on the media key + volumeID
oRijndael.MakeKey((char *)media_key, CRijndael::sm_chain0, 16, 16);
oRijndael.DecryptBlock((char *)volume_id, (char *)decrypted_volumeid);
for (j = 0; j <>
{
volume_unqiue_key[j] = volume_id[j]^decrypted_volumeid[j];
}
printf("\n");

// This results in the Volume Unique Key
for (j = 0; j <>
{
printf("%02X ", volume_unqiue_key[j]);
}
printf("\n");

Also, rumor has it that DVD copying software (such as Slysoft's AnyDVD) already has the ability to copy HD-DVD /Blu-Ray.