Thursday, December 18, 2008

No audio & 'Unknown PCI Device'

I've installed a clean Windows XP on a new computer, using the following steps:
1. Windows XP + SP2 + SP3
2. New computer's drivers

However after finishing the audio didn't work, I had 'Unknown PCI Device' listed in my device manager and no audio device in the audio devices list. In the system devices there was no Microsoft AAU device.

I tried many things: check bios settings, update the bios, reinstall RealTek drivers... nothing helped.

The solution I found on one forum stated that there is a problem with Windows XP SP3 HD Audio driver. F**k. Why Microsoft? WHY?

Anyhow, the solution that worked for me:
1. Impersonate to WinXP SP2: Change registry key
"HKLM\SYSTEM\CurrentControlSet\Control\Windows\CSDVersion" value to 200
2. Restart
3. Install HD_Audio/kb888111xpsp2.exe
4. Install RealTek HD Audio driver
5. Restart (and check that the audio is now working)
6. Change the CSDVersion key back to XP SP3 again:
"HKLM\SYSTEM\CurrentControlSet\Control\Windows\CSDVersion" value to 300

Wednesday, December 17, 2008

Emerging Markets - Definition

"Emerging markets, definition: Markets you can't emerge from in a crisis", Ron Lubash

Wednesday, November 26, 2008

Can't install Win 2003/XP: not able to detect hard disk

I've tried to install Windows 2003 on my HP dv6000, and I got the following error: "not able to detect hard disk".

I found few people with the same problem, but no answer. Only after searching for Windows XP installation issues I found the solution: disable the native SATA support in the BIOS.

Problem: on some computers (including HP dv6000) there's no way to disable native SATA support... grrr...

Bypass: how to add SATA driver to the Windows installation disk see here. (Specifically, HP SATA drivers from my computer found here)

Business Plan

"Business plans are a branch of science fiction. In classic science fiction the focus is on words, in the business plans the focus is on numbers", Yossi Vardi

"Business plan is like a sausage, you'll eat it only if you don't know how it was prepared", Yossi Vardi

Tuesday, November 18, 2008

GPEH to XML, GPEH Parser

I was looking around for a GPEH parser, or even GPEH to XML converter but I couldn't find one any where. Anyone?

Sunday, October 26, 2008

How to get ERD Commander to boot from USB

UPDATE: For versions of ERD Commander that come with MS DaRT use "Windows 7 USB/DVD Download Tool"

Here's the best resource I've found:
http://forum.xatrix.org/viewtopic.php?f=26&p=9323, however it didn't work for me.

After some tests I found the problem - since I'm using a 4GB USB drive, I had to check the 'LBA' checkbox in the PE2USB application.

Summary:
1. Download PE2USB
2. Download ERD Commander 2005 & extract the files from the ISO (I use 7zip).
3. Create the USB bootable system using PE2USB:
*** Select destination drive
*** Check 'Enable Disk Format'
*** Set 'Disk Label' to 'CD'
*** Check 'Enable LBA' for USB drives larger than ? (I think 1G).
*** Check 'Enable File Copy' and select the source folder (of the ERD Commander files).
*** Click start

Note: If you get "No USB disks found" on Windows Vista/7, run PE2USB as Administrator (right click -> Run as Administrator).

Friday, September 5, 2008

Creating add-ons/toolbars for Google Chrome

I was looking for information how to write an add-on for Google Chrome, and while looking I couldn't find any information on this subject (the was this calculator JavaScript, but that's not an add-on).

After a while I've decided to try and dig in Chrome's code, however, even before doing that I found the answer in the Google Code repository of Chrome:

Q. How can I develop extensions for Chromium like in Firefox?
A. Chromium doesn't have an extension system yet. This is something we're interested in adding in a future version. Note that Chromium does support NPAPI-style "plugins", such as Adobe Flash and Apple QuickTime.

See the original FAQ here

Wednesday, September 3, 2008

Fixed aspect ratio in C# window

I needed to create a window with a fixed aspect ratio (for video), and I wanted that the resize frame will change with the user cursor drag.

I came around with this post. Which is almost perfect, but when you drag the left or upper bounds you get the window moving... Here is the fixed code:


#region Keep video window aspect ratio
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}

public class MyRect
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}

public const int WM_SIZING = 0x0214;
int _lastWidth = 0;
MyRect _lastRect = null;
double _aspectRatio = 0.5;

protected override void WndProc(ref Message m)
{
if (m.Msg == WM_SIZING)
{
RECT rc;
rc = (RECT)Marshal.PtrToStructure(m.LParam, typeof(RECT));

if (_lastRect == null)
{
_lastRect = new MyRect();
_lastRect.Top = rc.Top;
_lastRect.Bottom = rc.Bottom;
_lastRect.Left = rc.Left ;
_lastRect.Right = rc.Right;
}

if (rc.Right - rc.Left != _lastWidth)
{
double newHeight = ((double)(rc.Right - rc.Left))
/ _aspectRatio;
rc.Bottom = (int)newHeight + _lastRect.Top;
Marshal.StructureToPtr(rc, m.LParam, true);
}
else
{
double newWidth = ((double)(rc.Bottom - rc.Top))
* _aspectRatio;

rc.Right = (int)newWidth + _lastRect.Left;
Marshal.StructureToPtr(rc, m.LParam, true);
}

_lastWidth = rc.Right - rc.Left;
_lastRect.Top = rc.Top;
_lastRect.Bottom = rc.Bottom;
_lastRect.Left = rc.Left;
_lastRect.Right = rc.Right;
}

base.WndProc(ref m);
}
#endregion

Sunday, July 6, 2008

Deleting locked VSP files

Few days ago I found huge VSP files on one of my servers. I found out that those files are temporary files of a symantec backup software. For some reason, from time to time the backup application does not delete it's temporary files.

When I tried to delete the files I couldn't do it - "File is used by another process" or something like that.

DISCLAIMER: Do the following procedure on your own risk. The writer of this blog takes zero (0) responsibility.

To bypass it I used the procedure to delete locked files (without restart):
1. Start Process Explorer by Microsoft/SysInternals(no need for installation, just copy the EXE file to the target machine).
2. Make sure the lower panel is visible: View -> Lower Pane View -> Handles
3. In the process tree select "System"
4. Sort the lower pane by Name, and find the VSP file lock (since the pane is sorted by name, it should be easy to find it by 'e:\WhatEverFileName.vsp')
5. Right-click the record in the lower pane and select "Close Handle".
6. Delete the file.

Thursday, April 17, 2008

int.Parse throws FormatException without a reason

For few days I've tried to debug a client's problem - int.Parse kept on throwing FormatException when everything was OK.

Finally I found this post, which says - check the regional settings:
Registry: HKEY_CURRENT_USER\Control Panel\International
Key: sPositiveSign (and the negative one).

My client checked both and they were just fine, but I've decided to write my own int.Parse which does this following:

if (str == "0")
return 0;
else
return int.Parse(str);

This fixed everything (I did the same for double.Parse too).

Friday, April 4, 2008

Hiding/disabling UpdatePanel during update

One of the most common tasks in AJAX is disabling UpdatePanel during AJAX call, i.e:



I expected UpdateProgress to do just that. It doesn't. I searched to web but I only found patches that forced using JavaScript with-in my pages.

Finally I found this (from which I took the image above):
http://www.codeplex.com/FlanAjaxControls

Open source, Ajax.Net only extender, that lets you disable the UpdatePanel and display the UpdateProgress over the disabled control during the update. No JavaScript, just add the control and CSS style.

Friday, January 25, 2008

Failed connecting to VPN using a cellular modem

I bought a cellular data package of few gigs and tried to connect to the internet (using my cellular phone as modem, connecting it to my laptop with bluetooth). Everything was working except VPNs. Any VPN I tried connecting to hanged during the authentication (e.g. "Authenticating username and password").

This is a symptom that the network does work correctly with GRE protocol (which is not UDP/TCP). Usually I would look for a firewall or port forwarding issue, but since I got the same result with my 2 VPNs (which worked just fine with my ADSL connection) - I decide to call my cellular operator.

The answer was very simple, and I don't understand why I didn't find it on the web.

1. Open the "Network Connection" you defined for the connection, and find the name of the modem you're using for the connection (since I was using bluetooth the modem name was a generic one).
2. Open "Control Panel" -> "Phone and Modem options".
3. Select the "Modems" tab and open the modem properties.
3. In the advanced tab put the following string:
+cgdcont=1,"ip","intereal"