# Tag Archives: How-To

## Choosing an Acetophenetidin Solvent

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:

Water

• Room Temperature – Crude product appeared to be insoluble
• Boiling – Completely solvated the crude product
• Freezing – Crystals reappeared

Ethanol

• Room Temperature – Completely solvated
• Boiling – Still solvated
• Freezing – Remained solvated

Hexane

• 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.

1 Comment

Filed under How-To, Science

## Inkscape Bug #485269 – Strange Black Boxes

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.

Filed under Computing, How-To

## Debian 5.0 DHCP Hostname

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.

Filed under Computing, How-To

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.  #!/bin/bash # Roller # # 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 NAME="Roller"  # Change to the directory that contains the images # /home/user/Pictures/Wallpaper/* dir="/home/user/Pictures/Wallpaper/*"  # 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 j=0  # Generates a psuedo-random number ran_num=$RANDOM  # 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 do # If the file to be used has been found if [ "$j" -eq "$ran_num" ] then # If the image to be used is not this script # (Originally, this script sat in the same directory as the images) if [ "$file" != "$NAME" ] then # Set the image using feh feh --bg-center $file # Break out of the loop: it is done break else # Skip past Roller, will use the next file found let "j++" let "ran_num++" fi  # Appropriate file not found yet: increment and try again else let "j++" fi done  exit 0  Edit the$NAME and $dir variables to your needs. 1 Comment Filed under Computing, How-To ## Spring Pushing a Block Off Another Block Involving Simple Harmonic Motion Two blocks, the small one of mass 3.5 kg and the large one of mass 7.3 kg are stacked, small block on top. The large block is connected to a horizontal spring of spring constant 210 N/m. The large block sits on a frictionless floor. The coefficient of static friction between the two blocks is 0.492. What amplitude of simple harmonic motion of the spring-blocks system puts the smaller block on the verge of slipping over the larger block? The maximum acceleration is what is important here. The simple harmonic motion is merely a spin on an old problem. So lay out some Newtonian Force equations: $F=ma$ – Standard Force Equation $F_{s} = -kx$ – Hook’s Law for Spring Motion $F_{N} = mg$ – Normal Force $F_{f} = \mu_{s} F_{N}$ – Frictional Force, tailored for the small block. Start with the Spring equation, treating it as an external force acting on the two block system: $F_{s} = -kx$ Because it is the singular external force acting on the system, we can set the general force equation equal to this, reminding ourselves that we must add the two block masses together as they are one system currently: $M$ – Mass of the small block and the mass of the large block. $-kx = Ma$ $\frac{-kx}{M} = a$ – Acceleration of the two block system. With that, we concentrate on the two block system internally now. We find the maximum force that friction exerts between the two blocks: $m$ – Mass of the small block. $F_{f} = \mu_{s} F_{N}$ – Frictional Force $F_{f} = \mu_{s} mg$ – Substitute Normal Force $F_{f} = \mu_{s} mg = ma$ – Friction is the only force acting on the block. $F_{f} = \mu_{s} g = a$ – Small mass cancels Substitute one acceleration for the other: $\mu_{s} g = \frac{-kx}{M}$ Solve for x: $x = \frac{M\mu_{s}g}{-k}$ We can solve directly for x here because we know that the maximum acceleration that the system can undergo without sliding is always the negative of the maximum x value. This is a property of simple harmonic motion. $|x| = x_{max}$ And we solve: $x = \frac{(3.5[kg] + 7.3[kg]) * 0.492 * 9.8[m/s^2]}{-210[N/m]}$ $x_{max} = 0.248[m]$ 1 Comment Filed under Science ## Two Trains (Constant Velocity) and a Flying Creature Two trains are headed toward one another on the same track. Train A has a constant speed of 40[km/hour] and Train B has a constant speed of 20[km/hour]. A Tengu that can fly at 60[km/hour] is perched on top of Train A. When the trains are 90[km] apart, it hops off and begins to fly toward Train B. When it reaches Train B, it instantaneously reverses direction and begins flying toward Train A. How far does the Tengu fly before the trains collide? Do not make this harder than it is. A series of increasingly small distances would fit this problem perfectly, but that is needlessly complex. The trick here is to understand that the “Flying Creature” is always moving at a constant velocity and merely bounces off of an imaginary plane in front of the oncoming train before heading back to the other train. Because of this assumption, the Tengu will cover the same amount of ground in the time before the trains collide flying between them as if it had been flying in a straight line for the same amount of time. First, calculate the time between the start and when the trains collide. The idea is that at some time in the future, the distance traveled by Train A and Train B added together will equal the original distance between them at the start. $t$ = Time Before the Trains Collide [hour]. $V_{A}$ = Velocity of Train A [km/hour]. $V_{B}$ = Velocity of Train B [km/hour]. $D$ = Distance Between the Trains [km]. $(V_{A}*t)+(V_{B}*t)=D$ $(40[km/hour]*t)+(20[km/hour]*t)=90[km]$ $t=1.5[hour]$ Now with time in hand, it is simple to calculate how far the Tengu flew in the alloted time. $V_{T}$ = Velocity of the Tengu [km/hour]. $H$ = Distance Traveled by the Tengu [km]. $V_{T}*t=H$ $60[km/hour]*1.5[hour]=90[km]$ Leave a comment Filed under Science ## Remapping Keys in X for Linux I do not have any purpose for the Caps Lock key. So it remains useless in a prime real estate position. But I use an open-source operating system (GNU/Linux, xmonad GUI), which means that I can remap that key to do something useful. Here is how to remap the Caps Lock key to become a third Control key through your Linux terminal emulator: xmodmap -e “remove lock = Caps_Lock” xmodmap -e “add control = Caps_Lock” Test it out now. Go open new tabs in Firefox with one hand without straining your fingers. Just press “Caps Lock (Now Control) + t”. Now for some background on this. Start by entering this command into a terminal: xev With the pop-up box selected, Press and Release the Caps Lock key and then the left Control key. The keycode and the name associated with that keycode will be displayed for each of the keys will be displayed along with other information. Write it down. Output from xev Next, enter into the terminal: xmodmap This will display the information for which keys are acting as modifier keys. The two commands originally issued with the “-e” switch modified which keys act like modifiers. First, the key called “Caps_Lock” was removed from the “lock” function. We added it to the “control” function instead. Modified xmodmap Output If you want to see every keycode assigned on your keyboard, enter the command: xmodmap -pke Between the output from that command and the functions of “xev”, you should be able to figure out the name of any key on the keyboard. This includes funky custom keys that are not standard. If you mess something up, restart your computer with the mouse if you killed the keyboard, or just restart X with “Control + Alternate + Backspace” (Not Delete). This will reassign your keys to their default. If you want this to stick between sessions, you will need to edit some files in your home directory. Check you “home” directory with: ls -a | grep “\.” If the “.profile” and “.Xmodmap” files are not listed, create them with a text editor as will be discussed: Open up a text editor and have it open or create the file “.Xmodmap” in your home directory. Otherwise known as “/home/YOURUSERNAME/.Xmodmap”. Paste Xmodmap commands into there if it is new; at the end if there is stuff in this already existing file. remove lock = Caps_Lock add control = Caps_Lock We removed the “xmodmap -e” because these commands are being run within the “.Xmodmap” file. Save, and close. Now open the “.profile” document and drop this onto the end of it: xmodmap$HOME/.Xmodmap

For those left-handed people who would prefer to have their mouse viewed as left-handed, and have the primary button on the right side of the mouse, enter this command:

xmodmap -e “pointer = 3 2 1”

This will switch the order of your primary and secondary click buttons. If you like this, paste “pointer = 3 2 1” into “.Xmodmap”, too.