NEVER MIND. THE GNU PROJECT IMPRESSES AGAIN.
Please check out the org-mode to emacs for a program that did all this years ago.
Made a small change to the TextFileToTable script. Now the user is able to exploit more of the Text::ASCIITable work with the addition of horizontal lines.
By inserting a ‘<<hr>>’ on a line by itself, the program will put another horizontal rule there.
perl TextFileToTable.pl [delimiter] [File to be read]
perl TextFileToTable.pl \& data.txt
| ID | Fruit | Color |
| 1 | apple | red |
| 2 | banana | yellow |
| 3 | orange | orange |
Grab the new script here:
When synthesizing Acetophenetidin (Phenacetin) in an Organic Laboratory, you might end up with a cake of crude product filled with impurities from the synthesis process. A giveaway sign of this is a calculated percent yield in excess of one hundred percent. This is not high-quality product. It must be recrystallized in order to refine the product for larger crystals and purer yield.
In order to recrystallize a product for better purity, a solvent must be found that will solvate everything at high temperatures, but will precipitate the pure product at cooler temperatures while keeping the impurities solvated and out of the crystal structure of the reforming product.
Perhaps you are given three options: deionized water, ethanol, and hexane. To test which would be the better solvent, add a bit of the crude product to small amounts of the potential solvents in test tubes. Observe solubility. Then heat the solvents in a boiling hot-water bath and observe solubility at that state. Finish the mock recrystallization by removing the test tubes from the bath and letting them cool to room temperature before sticking them in an ice bath. Observe solubility once again.
The better solvent will preferably not solvate the acetophenetidin at room temperature. This means that the recrystallization will begin earlier in the cooling phase. Everything must be dissolved at boiling. A solvent with a low boiling point would not help here, as it will evaporate away leaving everything as an impure solid stuck to the sides of the test tube. When cooled in ice, crystals must form for the solvent to be worth anything.
Here is some sample data:
- Room Temperature – Crude product appeared to be insoluble
- Boiling – Completely solvated the crude product
- Freezing – Crystals reappeared
- Room Temperature – Completely solvated
- Boiling – Still solvated
- Freezing – Remained solvated
- Room Temperature – Insoluble
- Boiling – Solvent evaporated
- Freezing – The solvent evaporated away in the previous step
The hexane is out as a solvent; its boiling point is too low. Ethanol does not work because the acetophenetidin never precipitates out of it. This leaves only water, and the observations associated with it prove it to be a useful solvent.
It is important to know what to look for when observing the Freezing solubility. Even though the impure cake may enter the test tube as a lump, it will not precipitate that way. Once the test tubes are sitting in the ice bath, let them sit undisturbed for five minutes. Then remove and observe. Wipe the condensation off the tubes and look very closely at them. From farther away, the water and ethanol tubes look much the same. Upon closer inspection and perhaps a swirl, one can see very tiny white particles floating in the water that are absent in the ethanol. That is the pure acetophenetidin and a good sign. These particles may be even smaller than any dust in the tube; close observation is important here.
Filed under How-To, Science
Was working with Inkscape and upon viewing the SVG file in an image viewer, I noticed conspicuous black boxes that were not present in the Inkscape view of the SVG or the exported PNG version of the SVG. A quick Google query turned up a standards conflict.
The Inkscape FAQ reports:
When flowed text support was added to Inkscape, it was conformant to the then-current unfinished draft of SVG 1.2 specification (and was always described as an experimental feature). Unfortunately, in further SVG 1.2 drafts, the W3C decided to change the way this feature is specified. Currently SVG 1.2 is still not finished, and as a result, very few SVG renderers currently implement either the old or the new syntax of SVG 1.2 flowed text. So, technically, Inkscape SVG files that use flowed text are not valid SVG 1.1, and usually cause problems (errors or just black boxes with no text).
I found out that it was the flowed text. Now to remove the flowed text. It did not seem to exist, though, making deleting the flowed text difficult. One could remove the visible text, but the black box would remain.
Another Google query turned up this Inkscape bug to which this simple workaround was suggested:
Another workaround to find empty ‘Flowed text’ objects:
1) ‘Edit > Deselect’
2) activate the text tool
3) use <TAB> to cycle through all text objects in the drawing and watch the status line for the message “Type or edit flowed text (0 characters); Enter to start new paragraph”
4) use <DEL> or <Backspace> to delete the selected empty ‘Flowed Text’ object
5) continue with until the first text object is selected again
I was unable to delete the boxes with Delete or Backspace. I settled with right-clicking on the box and deleting it that way. Save, then view the image again. The black boxes should be gone. To prevent them from returning, use the “Text > Convert to Text” tool to turn all flowed text into static text.
Was setting up a seedbox on old hardware recently. Was going to run Screen and rTorrent on top of Debian. The problem that arose was the router did not report the computer’s hostname. It assigned it an IP address via DHCP, but the lack of a hostname prevented it from port forwarding correctly. If the IP address to the machine changed, the forwarded ports did not follow as they were assigned to a hostname-less static IP.
After some research, I discovered it was not a problem but a feature. I needed to set what the DHCP program sent to the router as a hostname. So the computer could have one hostname, and send a different one to the router.
A minimal Debian 5.0 install (no desktop environment or pre-packaged server setup) has a program by the name of “dhcp3-client” to take care of this function.
Read through the documentation for “man dhclient.conf” to find the sample configuration. The line with “send host-name” is what we are interested in.
Now to edit the configuration file. Fish on down to “/etc/dhcp3/” and open up “dhclient.conf” if it exists. Edit the “send host-name” option to whatever you want the router to call the machine. Uncomment the line if it is commented.
If “dhclient.conf” does not exist, check to make sure “dhcp3-client” is installed:
aptitude search dhcp3-client
The package will have an “i” to the left if it is installed.
If dhcp3-client is installed, drop this line in a file by the name of “dhclient.conf”.
send host-name “Seedbox”;
Save and restart the machine.
I could not find a utility to turn a delimited text file into an ASCII table. So I built a simple one in Perl. It builds on this work by preparing the data for it.
The user creates a file with some delimiter, such as a Comma-Separated Values file, and then runs it through the script. The table is sent to standard output, and the user can do what they want with it.
It is run as such:
perl TextFileToTable.pl [delimiter] [file to be read]
perl TextFileToTable.pl \& data.txt
The order is important.
The code, in an archive.
Markovnikov’s rule is a decent tool to predict some simple organic reactions. It states that in simple electrophilic additions of alkenes, such as Hydrogen Chloride to n-Pentene, the electrophile will attach itself to the carbon of the double bond that has more Hydrogen atoms already attached; the less substituted carbon. It can trip a user up, however, if they do not understand the actual process taking place. Example:
1-phenyl-2-methylpropene has two “sp2” hybridized carbons in its Propene backbone. In a reaction with Hydrogen Chloride, we will only consider these two points and will leave out attachments to the Benzene ring itself for simplicity.
When the PI bond reattaches itself to a passing Hydrogen (HCl), it creates an intermediate carbocation and a Chloride ion. Which of the two carbons the intermediate forms on is determined by stability considerations. Markovnikov’s rule would predict the hydrogen attaching to the Phenyl side, as there is only one substituent there. The reverse actually happens, creating a “non-Markovnikov” scenario where the Chloride ion attaches to the molecule close to the Phenyl substituent.
Instead of relying on Markovnikov’s rule for simple additions which create carbocations, use the idea of hyperconjugation. This boils down to the idea that carbocations (positively charged) can be stabilized by the sigma bonds of nearby substituents (usually carbon to hydrogen bonds) because the electrons involved in sigma bonding are negatively charged. The more substituents, the more stabilized a present carbocation becomes. The stability of carbons with positive charges becomes:
Primary carbocations are less stable than tertiary because tertiary carbocations have two more sets of hyperconjugation sigma bonds to stabilize the positive charge.
However, sigma hyperconjugation is nowhere near as stabilizing as the effects of lone pairs of nearby electrons such as those found in “sp2” hybridized carbons. The negative charge is less diluted in the lone pair. This makes Allyl and Benzene groups even more effective than tertiary carbons. The order stands at:
The point of this is that when a carbocation intermediate forms, it will form in the most probable place most of the time. The most probable is the most stable. Carbocations will form on carbons attached to Benzene before they attach to carbons with only two other carbons (methyl groups, for instance) attached to themselves.
Feh can Stretch, Center, and Tile a background image, among other functions, but cannot Scale an image. That is fine. Feh follows the Unix Philosophy. This is where Image Magick and some bash scripting come in.
The plan is to create a directory of images that a bash script will peruse and feh will plaster to the background.
Start by compiling a directory of images to use. Copy these images to a new directory as the next step could irrevocably change the size of the used images. This is unlikely, however, as Image Magick tends to leave the originals alone.
Enter this into a terminal emulator:
convert * -resize 1024×768 background
It runs “convert” on all files. Resizes them to a best fit within a 1024 by 768 pixel box. Then names the new copy after the last argument. Adjust the numbers to your screen’s resolution. You can find it using:
xdpyinfo | grep dimensions
After the images are properly sized, it is time to set up the random selector. This is the bash code used. It assumes you have feh installed. Stick it in a file named “Roller” (or whatever you want; change the $NAME variable so that it can prevent itself from being selected) and make it executable.
# Version 1
# Does not sterilize input and such
# Assumes feh is installed
# Change to match the name of the file the script sits in
# Only need to change the script's name once this way
# Change to the directory that contains the images
# Counts the number of files in the directory
count=`ls $dir | wc -l`
# Sets a variable for counting the number of files skipped to that point
# Generates a psuedo-random number
# Sets ran_num to an integer in range:
# 0 to $count - 1
let "ran_num %= $count"
# For all files in the directory
for file in $dir
# If the file to be used has been found
if [ "$j" -eq "$ran_num" ]
# If the image to be used is not this script
# (Originally, this script sat in the same directory as the images)
if [ "$file" != "$NAME" ]
# Set the image using feh
feh --bg-center $file
# Break out of the loop: it is done
# Skip past Roller, will use the next file found
# Appropriate file not found yet: increment and try again
Edit the $NAME and $dir variables to your needs.