Tips & Tricks Blog
Notes, ideas and general comments on anything related to high-tech.

May 5, 2009

Artificial Aging of Wine Using Electric Field

Filed under: Wine — Tags: , , , ,

I have just read an interesting NewScientist article. It mentioned that they have had an unprecedented success with artificial aging of wine. To be precise, they mentioned taking a cheap 3-month old cabernet sauvignon and making it taste and smell like a really good wine according to a blind test of a group of wine experts. The chemical analysis also showed that the treatment sped up production of chemical compounds usually found in aged wine.
The process involved placing the wine for 3 min. into 600V/cm. electric field.
That should not be that hard to try at home unless some important details were missing from the article.
Maybe I should take an old TV and replace the picture tube with appropriately sized wine container between two plates under high voltage…
Note that they said that overexposure will ruin the wine…

May 4, 2009

Wordpress, PHP and MySQL Setup

Filed under: Web — Tags: , , , ,

It has happened many times that I’d spend long hours looking for a solution for a particular software or hardware problem or just searching for information on an interesting subject. After the problem is solved, the details usually fade away from memory pretty quickly and if similar problem resurfaces a lot needs to be rediscovered. The blogging software allowing to publish a quick memo and associate images, links etc. with it from anywhere in the world seems to be the most convenient way of keeping track record for the future references and sharing.

After looking around a little bit, I finally decided to go ahead with Wordpress mainly due to its famous 5-min install claim and despite the fact that it drags MySql and PHP to my site…

I’m using IIS under W2K (for historical reasons) and the quick research showed that there should be no problems with installation of any of the packages needed. Moreover, there are even MSI distributions for PHP and MySql available.

The MySql MSI setup was relatively painless. The only problem encountered was the failure to start the installed service. That problem appears to be caused by some racing conditions. Clicking the “Back” button, and asking the installer to install the MySql service under different name solved the problem (just needed to cleanup the first service entry from HKLM\System\CurrentControlSet\Services after that).

The PHP MSI created much more troubles. It only allowed the installation for running PHP in CGI mode, and did not do any file associations setup in IIS (maybe it only works w/ IIS6 and up). Anyway I completed the setup manually, the phpinfo.php script worked fine and everything appeared to be up and running, but not the Wordpress. The server error 500 with no any other information showed up any time I tried to access the Wordpress pages. After a painful investigation the problem narrowed down to the “new” operator on the WP_Error class. At that moment I just replaced the MSI distribution, with the PHP ZIP binary distribution for windows, set up the server to use PHP ISAPI DLL and finally everything started to work (and worked noticeably faster).

Conclusion: it is better to stay away from php-cgi.exe

After that point there seems to be no nasty surprises. It is probably an overkill to run that much software for a personal blog, but the Wordpress UI is really nice, there are tons of plugins and support information. All that is unlikely to be as easily available for a simple personal blog solution.

April 30, 2009

ICMP Over Raw Sockets Under Windows Vista

Filed under: Windows — Tags: , , ,

Microsoft has changed how the raw sockets behave several times throughout their OS release history. Starting from XP SP2 the transmissions through raw sockets are limited to prevent sending hand crafted frames of particular types (TCP, UDP with foreign source addresses, …) on client family of OSes. Fortunately the ICMP frames can still be sent and the applications that were using ICMP and  raw sockets are still compatible or easily portable to various Windows OSes.

The only reasonable alternative to the raw sockets when it comes to working with ICMP under Windows is to use the ICMP API DLL. That method is acceptable for simple use cases, but does not allow customizations or fine control over what is transmitted and received. If an application has to manage TTL, payload and types of the ICMP messages, examine the responses, needs to be portable or is built around winsock  for all other operations the ICMP API is not an acceptable or desired choice. 

The problem is that starting from Windows Vista the applications that under XP would successfully receive ICMP responses like “Destination Unreachable” or “TTL Expired” no longer see them. In order for such applications to work correctly under Windows Vista small adjustments have to be made. The following code snippet shows how to set up a raw socket under Vista to assure that it receives frames as it used to do under Windows XP or 2K.

/* Get the address of the interface to work with (using the first one found here) */
hostent *host_addr_list = gethostbyname(NULL);
if(host_addr_list == NULL)
  /* Handle error here */
  src.sin_addr.S_un.S_addr = *((u_long *)(host_addr_list->h_addr_list[0]));

/* Bind the socket */
if(bind(s, (sockaddr *)&src, sizeof(src)) != NO_ERROR)
  /* Handle error here */

/* Run the IOCTL that disables packet filtering on the socket. */
DWORD tmp, prm = 3; /* "RCVALL_IPLEVEL" (Vista SDK) */
if(WSAIoctl(s, SIO_RCVALL, &prm, sizeof(prm), NULL, 0,
            &tmp, NULL, NULL) == SOCKET_ERROR)
  /* Handle error here */

Note that you have to bind the socket to a specific interface address. This is required for the RCVALL_IPLEVEL IOCTL to work.

« Newer Posts

Home Tips & Tricks Blog
Powered by WordPress