Leo's Journal

Ramblings from around the world

Wireless Supremacy – Reloaded

You may recall that a couple of weeks ago I described my failed attempt to connect to the on-board wireless connection on my flight from Boston to Dallas. Well, today I’m finally going back to Boston, however this time the service seems to work. After succesfully loading the welcome page I just realized that I need to pay (almost $7) to get internet. What is worse is that it will only work for the duration of THIS flight and I still have a connection to catch. I see no point I’m spending that money in half an hour of Internet that I will probably not use at it’s best. The only thing is that I am now going through all of the different cool things if I actually bought it: for one thing I publish this post, but going beyond that I could do things like calling back home through Skype… nice. Oh well, even so I still think it’s not worth. At least for this post I might as well just wait until I get off the plane and submit it through the 3G network. Can’t wait for these sort of services to be provided at no cost – until then I won’t be able to say that I have in-flight-blogged. Hmmm maybe we should call it flogged… Or something.

I just got arived at my stopover in Atlanta and got back to the cell network. Hope you enjy the post of while I was flying.

Filed under: Internet, Technology

Computer Headache

I think by now I should just stopped mentioning how much work I’ve had in the past weeks. Ok, I’ll complain once more, it’s a LOT. Even today, Sunday, when it is supposed my weekend break, I still have to grade tests, prepare classes and organize course materials. I spent most of the day doing this and just about when I was about to call it a day, my computer started to behave funny. It first said that it had no internet connection, although there was clearly other people connected to the wireless network.

The system started to feel slower and unresponsive at which moment I decided to restart the computer. When it came back on, nothing worked. Certain windows just wouldn’t open, I couldn’t connect to the internet and the Finder (Mac OSX‘s equivalent of Windows Explorer) was completely irresponsive. Restart again, and again, and again. I tried a bunch of commands done at restart that are sometimes recommended to troubleshoot macs. Nothing.

I was starting to freak out. All my work – and all the work of everyone else at this seminar – is stored in my computer. I had done a backup a week ago and was about to do one today. After around 2 hours of fighting with my laptop, I gave up. I though “Well, I’ll go tomorrow to the Apple store and hopefully they’ll fix it”. Went upstairs to my room and was about to go to sleep. I actually hadn’t even had the opportunity to blog today, so I thought of writing all of this in my iPhone – sort of a pain. I said to myself, I need to try one more time. I turned the laptop on I though “YOU HAVE TO WORK NOW”. For no real good reason, this time it worked. I have no idea what was different, or what caused it to behave so weirdly. The good thing is that I have now backed up everything. I will still bring it to be checked. Now, there is one even weirder thing. When I finally was able to operate my laptop normally again, I opened the trash folder and there was a directory called “Recovered Files”. Inside it was one file which I don’t remember ever throwing away. It was a song – I don’t have any music stored in my laptop. I don’t know how it got there, maybe some error while using Pandora, or something. It was labeled “FlashTmp”. I don’t even know the artist who plays it – if you know please send a comment telling me. Whatever, I just know that I have a really horrible headache and I want to get to sleep. It has been enough for today. Good night.

Filed under: Computers, Internet, Music, Technology, , , , , , , , , , , ,

Understanding Disorder

Right now I am half way done with my summer job. I had worked in this program twice before, but unlike past years, this time my hob has involved much more logistics and organization rather than teaching “per se”. It all started by setting up a smart way of retrieving and formatting all of the documents produced, which I described in the article “Smart Latex Typesetting”. It was the first time for me to engage in such a big project.   As such I have learned tons of things, specially by looking at my mistakes. If I had to say only one thing of what I’ve learned: Organize EVERYTHING perfectly from the beginning – think of the unthinkable and prepare for it.
Although it might sound somewhat trivial, it is amazing how much what may appear as small details can potentially become huge pains to deal with if not tackled in a timely fashion. This is specially true when whatever you are doing will eventually be distributed to a public. In this case any bug left behind will reproduce exponentially and hunt you down. My project is puny compared to anything done by a software company, say, Firefox. Still just after finishing it, I can now barely imagine the level of organization and care required in order to maintain such complex systems. In the bottom line this is just a reflection of the mathematical fact that starting from a small environment (or a project, or anything) and keeping organized as it grows is a lot easier than trying to organize a big environment that is disorganized. I guess that I should start applying that same principle to my room :P .

Right now I am half way done with my summer job. I had worked in this program twice before, but unlike past years, this time my hob has involved much more logistics and organization rather than teaching per se. It all started by setting up a smart way of retrieving and formatting all of the documents produced, which I described in the article “Smart Latex Typesetting”. It was the first time for me to engage in such a big project.   As such I have learned tons of things, specially by looking at my mistakes. If I had to say only one thing of what I’ve learned: Organize EVERYTHING perfectly from the beginning – think of the unthinkable and prepare for it.

Although it might sound somewhat trivial, it is amazing how much what may appear as small details can potentially become huge pains to deal with if not tackled in a timely fashion. This is specially true when whatever you are doing will eventually be distributed to a public. In this case any bug left behind will reproduce exponentially and hunt you down. My project is puny compared to anything done by a software company, say, Firefox. Still just after finishing it, I can now barely imagine the level of organization and care required in order to maintain such complex systems. In the bottom line this is just a reflection of the mathematical fact that starting from a small environment (or a project, or anything) and keeping organized as it grows is a lot easier than trying to organize a big environment that is disorganized. I guess that I should start applying that same principle to my room :P .

Filed under: Computers, Internet, Life, Technology, , , , , , ,

Smart Latex Typesetting

Before I even start I will give a disclaimer: Today’s post is way more technical than those you have found thus far in this blog.

Almost anybody who is somewhat involved into science, especially mathematics,  is very likely to have ran across the Latex typesetting system. It is an extremely powerful and versatile markup language that allows for scientific (and non-scientific) formatting of documents.

I have been familiar to Latex for about five years already, however, since starting my job at Dallas I confronted the biggest Latex project I have ever been in. The program I am has 12 mathematics classes going on every day. Each day every class has at least one hand out, which in general is typed using Latex. However, these handouts are to be stored and later made into booklet containing all of them. The question is, what is the best way of doing this?

Well, the first solution to come into mind is to make a new latex file and copy/paste manually the code of each of the individual handout and then compile. This may work for small projects, however, considering that the program I am in lasts for 3 weeks, by the end of it we would have 180 handouts at the very least. That would take a while to do, not to mention the possibility of mistakes and the tediousness.

Another alternative is to use the command \input. It should be as simple as making a ‘master file’ where the command \input is called to get the code of all the individual handout files. However this solution is still not perfect. Whenever we call \input, the whole code of the handouts is read by the compiler and as soon as it reads the header commands of the handouts (\documentclass{article}, begin{document}, etc) it will start complaining. So this solution, as is, would require to manually delete the header declarations of each handout. For my project this is still not feasible.

You may think “there should be a better way” – I thought this myself – and fortunately there is. First let’s make clear what we want: We want to make Latex files that compile normally separately, however we also want to be able to use a ‘master file’ where we can call all of them and also compile without problems. After asking my friends and googling for around this past 2 days I have finally solved it. Here it goes:

We will have three main files: header.tex, footer.tex and master.tex. I will explain all of what I will write – just follow on me for now:

In header.tex we will write the following:

\providecommand{setflag}{\newif \ifwhole \wholefalse}
\setflag
\ifwhole\else
% Here you write your declarations, usepackages, etc
\begin{document}
\fi

The footer.tex file should say

\ifwhole\else
\end{document}
\fi

The master.tex file should have

\input{head.tex}
\renewcommand{\setflag}{\newif \ifwhole \wholetrue}
\input{handout-1.tex} //put as many inserts here as needed
\renewcommand{\setflag}{\newif\ifwhole \wholefals}
\setflag
\input{footer.tex}

And finally, individual handout should look like

\input{header.tex}
% handout text here
\input{footer.tex}

So let’s explain what’s going on. First of all look a the header.tex file. We have \providecommand which checks if a command already exists, if it does, it leaves it alone otherwise it defines it as specified. . Here we provide the command ‘\setflag’ and defines a new boolean variable by calling ‘\newif \ifwhole’. This boolean (‘whole’) can be set to true or false by calling \wholetrue or \whofalse respectively. In this case we set it to true. Conditional statements can be written using this boolean using the command

\iswhole
%Type here what should be executed if 'whole' is true
\else
%Type here what should be executed otherwise
\fi

With this we can explain how individual handouts compile. The compiler reads \input{header.tex} goes to the file and reads \providecommand{setflag}. Since \setflag does not exists, it creates it. Afterwards \setflag is run (as defined by \providecommand) creating a boolean ‘whole’ and set to false. After we get a conditional statement, but since ‘whole’ is false, we get to the else and read all of the declarations, definitions and \begin{document}. Similarly, the compiler reads the footer.tex in the individual handouts.

Now, when we run the master.tex file the \input{header.tex} works the same as before. However, just after reading header.tex the compiler encounter \renewcommand which overrides the definition of \setflag. From this point on \setflag is set to define the boolean variable ‘whole’ and set it to true. Afterwards, when the input{handout.tex} are read the first thing the compiler sees is \provide{seflag}. The catch is that now \setflag is defined, so \providecommand doesn’t do anything to it. Next, \setflag is run returning a boolean ‘whole’ with value true. Hence this time the conditional statement goes through the first clause (instead of the else). This way all of the declarations, headers, begin{document} and all of those things that the compiler would complain if it were to read them in the middle of the document, are magically skipped. The handouts as I defined them here will compile both individually and inside the master.tex file with no hiccups. That’s how it works.

Sorry, again, to most of you for the technicality of this post. However this might prove extremely useful for the more scientifically oriented out there. If you have a big project this may help to save tons of time. Hope you liked it and let me know if you have any troubles implementing it. As for me, I need to go sleep as I have to wake up early tomorrow to continue my work. See you ’round.

Filed under: Computers, Technology, , , , , , ,

WordPress is WHAT?!

As you may recall from a recent post, I have been in contact with many of my Chinese friends through Skype. It came to me that starting a Blog in Chinese would be a great way to practice my written Chinese besides keeping in contact with my friends and sharing my opinions with them. I also mentioned tha I was originally afraid of not being able to contact my friends using Skype due to the Golden Shield Project but later realized that this is (apparently) not a problem (although I wouldn’t be surprised if they were actually letting calls but monitoring all of them).
It turns out that my fears were justified, not by Skype, but by WordPress. Yes, apparently the Chinese government has blocked all of the domains hosted by WordPress. So my Chinese friends won’t be able to access neither the blog 魏立宁的日记 nor this one.Although this sucks, I think I can still manage to make a blog that they can acces, I just need to find the righ place to host it. Currently I have a bunch of options and I will be working to set it up these days. As soon as its don, I’ll let you guys know. See you ’round.

As you may recall from a recent post, I have been in contact with many of my Chinese friends through Skype. It came to me that starting a Blog in Chinese would be a great way to practice my written Chinese besides keeping in contact with my friends and sharing my opinions with them. I also mentioned that I was originally afraid of not being able to contact my friends using Skype due to the Golden Shield Project but later realized that this is (apparently) not a problem (although I wouldn’t be surprised if they were actually letting calls but monitoring all of them).

It turns out that my fears were justified, not by Skype, but by WordPress. Yes, apparently the Chinese government has blocked all of the domains hosted by WordPress. So my Chinese friends won’t be able to access either the blog 魏立宁的日记 nor this one. It’s a pity that such a good blogging software is totally prohibited by a country. Although this sucks, I think I can still manage to make a blog that they can access, I just need to find the right place to host it. Currently I have a bunch of options and I will be working to set it up these days. As soon as its done, I’ll let you guys know. See you ’round.

Filed under: Computers, Technology, , , , ,

The Technology in our Hands

I’ve had an idea stuck in my mind for a while and I thought it would be interesting to share it and check out other points of view. It all originated from the following situation: Imagine you had a computer with no operative system installed. Actually imagine it to be a computer that just came fresh out of factory. It has absolutely no software in it (no drivers, no BIOS, nothing). The question is, how do you make this device into a working computer? Well, many people would say “simple, connect it to another computer and install the BIOS and everything else the same way it would be done with any other computer that just came out of a factory”. Great, but wait a minute, does that mean that the only way to get this computer working is resorting to an already working computer? Apparently this so (to the best of my knowledge).

What strikes me about this situation is that, even though we may know the exact inner workings of the computer at hand, without another computer to assist us we are confronted with an impossible task. If this is so, how did computers appear in the first place? Well, originally digital computers were manually programmed, in a way we used an already working computer – our brains. Punched cards were used as the main source of input and output of information. So the way the story goes is that, we created computers and manually programmed them using punched cards. Later on when new computers came along, we used the older – already programmed – computers to help us program the new computers. This continued in the same fashion to the point at which we are faced today. It is impossible to manually program a modern computer due to the vast complexities found in it. Only existing computers can handle such a thing.

The way I see it, its as if we had given a piece of life to computers. People created them using nothing but wires, silicon and metal. But it was until the genius of geeks who sat down and manually programmed the earliest computers that these stopped being inert pieces of junk and became useful tools. These computers later reproduced there “piece of life” into newer computers and son on. Every computer today has traces of the original manually programmed computers. This can only make me think about slightly apocalyptic thoughts. If after a 3rd World War all computers were destroyed, even if some survivor knew the exact workings of modern computers, he would still have to go back and start by using punched cards to slowly move on to more advanced computers, etc. It is actually very likely that somewhere in some secret bunker there are instructions of how to restart computing technology using punched cards… weird. What do you think?

Filed under: Computers, Technology, , , , , ,

Follow

Get every new post delivered to your Inbox.