There have been a number of interesting projects I’ve been asked to work on over the course of the last few weeks. They all involve writing a little code and so I want to document some of those projects here. They are not math related but my interests are broader than just numerical analysis and bioinformatics. Plus, in the age where “google” has become a verb, I attract occasional visitors to this site looking for solutions to problems that I have solved for myself, like repairing a broken headphone jack or enabling wifi on a misbehaving smart phone.
Consolidating data in multiple excel workbooks
Consider the case where you might have a large set of excel spreadsheets spread across a number of different workbooks. If you want to consolidate, merge, extract or just combine data, there isn’t really an ideal tool for doing this. There is a “Consolidate data” function in excel but it isn’t suited to large numbers of files because it becomes tedious opening and selecting the range over and over. While many Excel gurus might have other solutions, I decided to go the macro route.
As in most cases, I was able to find resources available online that would accomplish something similar to what I wanted.
Take all the data (used range of cells) in all the worksheets in all the workbooks in a specified directory and combine them into a single sheet (or several sheets in the same workbook if they don’t fit)
In my Fall course of Math Models, I have three groups working on projects to finish up the semester. One of the groups have an assignment to explore a model of the spread of a forest fire. The assumptions are that the trees are on a rectangular grid, or a lattice. The time is a discrete variable and at each time step the probability that the fire spreads from one point in the lattice to an adjacent point (up, down, left or right) is given by p. For simplicity, the event that the fire spreads to each point is assumed to be independent of any other point.
Part of their project is to implement a numerical simulation of their forest fire. I couldn’t let them have all the fun, so below is an example of my version of the simulation in MATLAB. I have to hold off on posting the code until after they have handed in their project.
In the graphical representation of my simulation, green represents an unburnt tree, black is burnt and red is currently on fire. The fire lasts for exactly one time step. I also implemented a 3-D version, where a height of 1 is unburnt, 2 is on fire, and 0 is burnt. I’ll confess to having way too much fun with this.
I have used a 200×200 lattice with p = 0.5.
I had to solve two problems for myself today. I am posting my solutions here, mainly for my own reference but maybe somebody out there might have the same issues to be solved.
The first problem I faced was installing a network printer so that it would be available to all users on that machine. This is probably a minor problem for seasoned IT pros, but since I am not one, it took some investigating. I learned that local printers are installed automatically for all users, while network printers are associated with user profiles. This means that when you install a network printer it is only available to the user profile that you used when installing.
The solution is to install the network printer as a local printer. In other words, go to Control Panel .. Printers. Click "Add a printer". Select that you want to install a local printer. At this point you will create a new port, using a Standard TCP/IP port. You’ll need to have the IP address of the printer to do this and you’ll also want to have the drivers handy.
Since it is installed as a local printer it will now be available to all users when they log in. The bug I still haven’t worked out, though some of you may have an idea, is that even though I have selected it to be the default printer in my profile, it is not necessarily the default printer for other users. If is the first printer installed, no problem, but otherwise it is not the default for other users.
I wish I’d thought of that.
Thanks to a post in LifeHacker, I have set up a few bookmarks in Firefox that will open in the sidebar. I recently discovered the trick of opening links in the sidebar but I did not think to use mobile apps such as the new iphone app in Google Reader.
Some other mobile web apps that I am likely to use include:
If you want more suggestions to things to stick in your sidebar, go straight to apple for some ideas: http://www.apple.com/webapps/index_top.html
The “how to” comes from Mozilla Links
And it’s pretty simple:
- Open the Bookmarks Manager (Bookmarks/Organize Bookmarks…)
- In Firefox 2, in the File menu, select New bookmark… In Firefox 3, press Organize in the toolbar and select New bookmark…
- Enter a name, http://www.google.com/reader/i/ for location, and ensure to check Load this bookmark in the sidebar.
- Press Save Changes and now you can select the bookmark to load Google Reader in the sidebar.
Try it out. It’s handy.
Both Microsoft Access and Microsoft Excel became heavily used tools in my bioinformatics research. Scripting came in handy on occasion to automate tasks but my lask of “skills” in that arena left me relying heavily these applications. Within the last two months, I couldn’t count how many tables and queries I’ve created (point-and-click style) in Access, how many times I used VLOOKUP and MATCH in Excel. I’ve just recently discovered the many, many joys of Pivot Tables (amazing!). Oh and by the way, I’m flat in love with Excel 2007.
Here were a couple of new tips I stumbled across today:
Convert one column into two
Suppose you have a list of full names in a column, and you’d like to separate the first names from the last names. In Excel 2003, select the column and click Data*Text to Columns. In Excel 2007, click the Data tab, and select the Text to Columns button. In both versions, choose Delimited (unless all the entries are the same length, in which case you can select Fixed width), click Next, and check Space (or whichever option applies; see the screen below). You can leave “Treat consecutive delimiters as one” checked. Click Next again to view data-formatting options, and then Finish.
Select Space (or whatever separates the items in the column you wish to split) to create two columns where there once was one.
At this point, you may want to change the order of the columns. To do so, simply select the column header, right-click the selection, and choose Cut. Now click the header of the blank column you want to place the cut cells in, right-click, and select Insert Cut Cells.
Paste formatting with one keystroke
If you’d like several disconnected cells to share a format, such as bold text and a background color, it can be a hassle to select each cell one at a time, open its cell-format dialog box, and make the changes you want. Instead, reformat one of the cells, and then select all of the others by pressing Ctrl, and clicking them one by one. Once they’re all highlighted, press F4 to apply the formatting to all of them at once.
I finally finished getting my laptop setup to dual boot with Fedora Core Linux and Windows XP.
I had a few major issues but was finally able to find the correct solution to my problem.
1. After setting up separate partition with Partition Magic and then install Fedora Core 8, the Windows system would not boot saying “autochk autocheck not found” and going straight to the dreaded blue screen of death. I discovered that Partition Magic (or the Fedora install) marked the NTFS partition as hidden. I had to use a utility called BootIT NG, creating a bootable CD and using this utility (without installing to) to switch from a hidden NTFS partition to not hidden.
Problem 1 Solved.
2. This one took a lot longer. I have Dell Latitude D420 with a Broadcom 1390 WLAN MiniCard. These drivers were never offered for Linux so the necessary drivers had to be reverse engineered (not by me, of course, but they are out there). There are apparently two options which as a Linux-noob, I couldn’t tell more than that. I tried a number of forums and went step by step through the provided procedure. I did at least 3 fresh installs of the entire operating system, after I felt I had mucked up the system beyond fixing. Finally, the one the worked was here:
I’m going to quote most of it here for future reference, but I give them full credit for something that works. And definitely use the NetworkManager hint below. I used the b43 drivers below and everything worked.
Doing the Work
- Open a terminal .
- Install the bcm43xx-fwcutter and b43-fwcutter packages:
su -c 'yum install bcm43xx-fwcutter b43-fwcutter'
- Download the correct firmware for your device from here or select the correct firmware from the following links:For b43, download and untar Version 4 firmware:
For b43legacy and bcm43xx, download Version 3 firmware:
- Extract the firmware:For b43:
su -c 'b43-fwcutter -w /lib/firmware /path/to/kmod/wl_apsta.o'
su - c 'b43-fwcutter -w /lib/firmware /path/to/wl_apsta-22.214.171.124.o'
su -c 'bcm43xx-fwcutter -w /lib/firmware /path/to/wl_apsta-126.96.36.199.o'
- Optional: Enable NetworkManager for managing this device (very recommended!)
- Alias the correct module to your wlan0 device:For b43:
echo "alias wlan0 b43" >> /etc/modprobe.conf
echo "alias wlan0 b43legacy" >> /etc/modprobe.conf
- Now, reload the driver:For b43:
su -l -c 'rmmod b43 && modprobe b43'
su -l -c 'rmmod b43legacy && modprobe b43legacy'
- If the reload fails, just reboot.
Problem 2 Solved: WOOOHOOOO!!!!
In responding to a comment on the last entry, I answered the questions of what equipment and software I am using to create our online course materials:
For our College Algebra course, we cover the last six chapters from an Intermediate Algebra textbook. There will be a lecture for each section of each of the chapters. It looks like every full section lecture will be about 20 – 30 minutes in length. I am shooting a screen (or slide) one at a time which comes to about 10 slides or so per section. This post was one of those slides. Each of those slides ranges from 2 – 5 minutes in length. I think that comes to a total of about 27 lectures about 30 minutes each. I will probably have the students order a DVD with hi-res versions of the video, but post compressed versions on the web, maybe even as podcasts available through an RSS feed.
In terms of software, I am doing everything the hard way since I am on a PC. I hear this would probably be easier with a Mac. Nevertheless, I am mostly using free software. For the screen capture, I use CamStudio. I piece all the slides together using Windows Movie Maker. The software I use for writing on the screen is the software that was included with my tablet. My first choice would have been to use a tablet PC but the cost was prohibitive. Instead, I went with the WACOM Intuos3 tablet. We purchased the 9×12 tablet which works well, but is probably larger than needed. The Corel Painter Essentials software was included with the tablet and it worked quite well for the screen casting.
I hope this answers your questions. I got most of my ideas from a podcast I watched in iTunes by the name of “Is All About Math“.
I have tried to do a little research into the compatibility of Maple 11 with Microsoft Vista. A student of mine report that he attempted to run his new copy of Maple 11 on his new Vista machine and was unsuccessful. I could not find a statement on the Maplesoft website confirming or denying. I did see a MaplePrimes forum post that seemed to imply that it was not compatible but nothing official.
Does anyone know? I surely expect them to be working on this but finding no information was frustrating.
A while back, I started using the site, del.icio.us, for my bookmarks. My primary reason for doing so was so that I would have access to my bookmarks from any of the multiple computers that I use. Way down on the list of reasons to use the delicious bookmarks were for the “social networking” aspect of letting others see what I link to. But if you are interested you can see my links here: http://del.icio.us/splineguy.
But now, I have a new toy!! Google Browser Sync. I love this thing. It is an extension to the firefox browser available from Google Lab which allows you sync your firefox browser across different computers. It actually allows you to syncronize your cookies, bookmarks, history and even saved passwords. It is configurable so that you can choose exactly which data is syncronized. Personally, I had no desire to syncronize anything except my bookmarks. There is also an option for encryption and there is a 4 digit PIN that must be chosen so that you can verify the identity of your other browsers. I am pretty sure that you do need a Google Account to be able to use this tool.
powered by performancing firefox