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

May 1, 2015

Sending WakeOnLan packet from VMWare ESXi

Filed under: ESXi

After a long unsuccessful search for something that would work for making available backup storage (WD Elements 4GB USB HDD) from my MS Windows desktop system to ESXi 6.0 server (as a datastore) ended up using old Dell laptop. It runs Linux, auto-mounts the USB HDD at the boot time and exports the mount point over NFS.

In order to avoid running it all the time, ESXi powers it up by sending wake-on-lan Ethernet packet and shuts down the laptop after backup is done. WD Elements powers on/off automatically when USB connection is up/down.
Attached is the ether-wake tool sources (with minor tweak for sendto() to work) and statically compiled binary runnable under ESXi.

The ESXi firewall has to be turned off for it to send the packet:

esxcli network firewall set --enabled false
./ether-wake 00:11:22:33:44:11
esxcli network firewall set --enabled true


January 25, 2014

RepRap X2V3 Simultaneous Printing from 2 Extruders

Filed under: 3D Printing — Tags: , ,

carriagesAlthough the main purpose of adding multiple extruder feature to the RepRap machines is to allow printing the dissoluble support material, the new RepRap X2V3 dual carriage design opens a few new interesting possibilities.

The machine supports driving each extruder hotend independently on the X axis (”Dual X Drive”, see video here  Its predecessor (RepRap X2) had both hotends fixed on the same carriage (similar to Makerbot’s dual extruder machines) and at relatively close distance of about 20mm. If printing simultaneously from both extruders the machine’s build volume on the X axis would be limited to the distance between the extruders (not quite useful). Because of that I’ve decided not to implement the “follow-me” mode while adding multiple extruder support to Marlin firmware.

Unlike it’s predecessor RepRap X2V3 is free to position the hotends at any distance the size of the machine allows. That makes it possible to  effectively use all the build space (i.e. the build envelope for simultaneous printing on RepRap X2V3 is about 100×200x130mm). Moreover, independent carriage driving allows simultaneous printing of mirrored copy of the object. That is often required when printing parts for the dual extruding machine or any object that has mirror symmetry. These hardware capabilities have convinced me to add the “follow-me” support to the latest (v1.1.0 X2 Beta 1 as of this writing) version of MarlinX2 firmware. The command for turning it on/off is M322. Its description is available in the file. The video below demonstrates the feature in action:

October 29, 2012

Dual extruder PLA printing

Filed under: 3D Printing — Tags:
Dual color X2 whistle

Dual color object

One of the most annoying problems with the dual extruder printing is the plastic leaking from the idle extruder. It is especially noticeable with PLA that flows easier than ABS. Lowering the temperature of the idle extruder while it is not needed and restore it when it is time to start printing with that extruder again helps to deal with leaking. It is tricky though since leaking has to be prevented during the teperature changes.

The technique being used with the current generation of the RepRap X2 printers (S/N: 020*) is to print a “parking space” besides the actual object. That “parking space” serves two purposes, one is to plug the nozzles while the temperature changes and the other is to “prime” the extruders (i.e. establish the consistent flow of plastic) before printing the actual object after the temperature change.

You can see the full size video on YouTube:

The video demostrates the RepRap X2 S/N 0203 (find it on eBay) printing a dual color whistle (pictured above) using the described technique during the tune-up procedure. The STL files used for the print with the parking space object are here:
1. The whistle body (”BASE”, for printing with the extruder 0): Whistle X2 body
2. The text (”INSERT”, for printing with the extruder 1): Whistle X2 text

The special Skeinforge profiles for the X2 printer are needed to generate the G-code. They can be deployed using x2Profile app from the from the X2SW software bundle.

The …0.5C-BASE profile has to be used for slicing the body and …0.5C-INSERT for slicing the text STL of the model. The penultimate G-code generated has to be then merged using the “x2Merge” application (a part of the X2SW software bundle).

The “x2Merge” application merges together the G-code generated for the body and the text STLs. It is merged layer-by-layer. The content from the chosen alteration files for extruder switching is inserted in the places where there is a need to change the extruder. The inserted G-code positions the nozzles above the “parking space” object and changes the active extruder while lowering the temperature of the idle and restoring it for the active hotend before letting the printing continue.

The technique works the best for printing a few layers of color, for example a colored text on the top and bottom of the object. It essentially elliminates the discoloration due to the plastic leaking, but because of the time needed to adjust the temperatures it slows down the print substantially when there are a lot of layers requiring extruder switching.

Note: in order to use the technique X2SW software bundle of at least v1.1.0.4 and X2 firmware of at least v1.0.0b2 are required.

October 16, 2012

Slic3r advanced features experiment

Filed under: 3D Printing

Here are a few experiments with Slic3r advanced features.
The pucture shows the calibration cube printed with infill every 2 perimeter layers (perimeter height 0.2mm, infill height 0.4mm) and the same cube printed with infill from the second extruder (natural color ABS).

Slic3r dual infill height and dual extrusion (perimeter+infill)

Slic3r dual infill height and dual extrusion (perimeter+infill)

June 5, 2012

Nice things can come out from 3D printer even if the print fails!

Filed under: 3D Printing — Tags:

Recently I’ve had several attempts to print
That was a pretty hard print for 0.5mm nozzle especially given that I had to scale the model down to 125mm height. One of the failed attempts produced this:

Akiko print failed

Akiko print failed

which looks kind of nice, but still funny given thet the expected result was that:
Akiko successful print

Akiko successful print

September 20, 2009

Affordable mind reading

Filed under: HCI — Tags: , , ,

There finally appears to be an affordable product ( designed to recognize your mood, simple intentions etc. basing on the analysis of the readings from a futuristic looking device worn on your head and capturing EEG data (14 channels).
However farfetched this sounds, it is potentially possible although it is hard to tell how accurate, fast and practical it will be. I guess the situation now can be compared to the dawn of speech recognition. In the case of the speech recognition there are 6 billons of live proofs that it is doable, but it took quite a while to perfect it to the levels of accuracy when it finally became practical. In the case of EEG recognition, it is just the scientific experiments and no use in the “field” so far.
In any case it is very exciting to see an affordable commercial product like that. My attempt to experiment with EEG pattern recognition a few years back stalled as the only reasonable option I found at that time was, which targets research institutions and is priced accordingly. The Emotion product opens new grounds for curious minds…

June 4, 2009

Notes on WRT54 as VPN Client and Gateway to Remote Network

Filed under: Networks — Tags: , ,

This note is for a setup that allows using Linksys WRT54 router for VPNing into remote network and providing multiple PCs on your home network access to that remote network in similar fashion as they access Internet (through NAT). It is assumed that the VPN server is already available on the remote network and the “openvpn” client can be used to connect to that server. The WRT54 router is assumed to be connected to the local network  and not used for WAN/Internet access.

Full-time VPN Access to Remote Network from Home
The standard Tomato distribution as of today does not include openvpn, so a modded version is required (download from here):

The script below has to be updated to include correct addresses, VPN parameters, certificates and the private key.
Then it can be put into the “Firewall” script textbox under the “Administration->Scripts” in tomato menu.

The iptables commands for DNS_ADDRESS settings are not necessary, but might be useful for making the
router mimic the remote network DNS. The local DNS then can be set up to forward DNS requests for the remote
network domain directly to the router on the local network.

insmod tun.o
cd /tmp
ln -s /usr/sbin/openvpn /tmp/vpn
./vpn --mktun --dev tap0
ifconfig tap0 up
sleep 5
iptables -t nat -A POSTROUTING -s A.B.C.D/MASK -o tap0 -j MASQUERADE
iptables -t nat -A PREROUTING -p udp -i br0 --dport 53 -j DNAT --to DNS_ADDRESS
iptables -t nat -A PREROUTING -p tcp -i br0 --dport 53 -j DNAT --to DNS_ADDRESS
echo "
================== use your config here ======================
dev tap0
resolv-retry infinite
ca ca.crt
cert cl.crt
key cl.key
ns-cert-type server
verb 3
================ end use your config here =====================
" > /tmp/cl.conf
echo "
Cut&paste the CA or server certificate here.
" > /tmp/ca.crt
echo "
Cut&paste client private key here.
In order to decrypt it first use (for RSA):
> openssl rsa -in key.pem
" > /tmp/cl.key
chmod 600 /tmp/cl.key
echo "
Cut&paste client certificate here.
" > /tmp/cl.crt
./vpn --config cl.conf &

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