I have a blog lol · uncategorized


Clutterhs 0.1 Released

I've made an early release of Clutterhs, and it's on Hackage. There's still a fair number of things that don't work yet, and lots of messy code that needs to be cleaned up, but most of the core stuff should work. There isn't a tutorial yet, but overall usage is similar to gtk2hs. If you want to try it, the best thing to do would be to look at the simple demos in the git repo. They aren't very good examples, and just sort of use a bunch of random stuff but they should help with the general idea of how to use it (which is still quite likely to change).


Clutterhs Update

Sometime between last night and this morning I may have had something of a Eureka moment about all of the problems I've been wondering about. I've realized I made a huge mistake when dealing with GObject Properties / Attributes that should be easy to fix. I missed something huge when looking at how gtk2hs deals with properties. I think I  can now easily avoid doing dirty things which I was very unhappy with to deal with functions which take GValues  (except for maybe the Model stuff).  I'm going to redo the animate* functions so you no longer have to deal with the dirty named property stuff directly, which is very unHaskelly and an obvious source of mistakes, as soon as possible.


Clutter Haskell Bindings

I've been working on the past few month and a half or so on Clutter
bindings for Haskell. Right now I have most of the basic stuff you
would want more or less working. Rectangles fully work as the simplest
example actor. Some parts of events work, and alphas. A bunch of other
stuff also works, but nothing is actually done. I don't have any
documentation yet either.
The most important goal has been achieved however. I rewrote the
famous Clutter Game originally from the Seed examples. There was an
issue for a while where the functions necessary for setting GValues
with Char/UChar were commented out in Gtk2hs. I submitted a patch, so
now it works if you use gtk2hs from darcs. GValues are rather unholy
and very much against the type safe philosophy of Haskell, so I'm
working to hide their existence as much as possible (which shouldn't
be particularly hard, just a little annoying).
I'm not sure what I'm going to work on next. I realized today that
using animation with signals in the property won't work. I think I'll
work on getting events working, and cleaning up the code related to
the implicit animation functions, and deal with all the GValues.
I've been working on the past few month and a half or so on Clutter bindings for Haskell here. Right now I have most of the basic stuff you would want more or less working. Rectangles fully work as the simplest example actor. Some parts of events work, and alphas. A bunch of other stuff also works, but nothing is actually done. I don't have any documentation yet either.

The most important goal has been achieved. I rewrote the famous Clutter Game originally from the Seed examples. There was an issue for a while where the functions necessary for setting GValues with Char/UChar were commented out in Gtk2hs. I submitted a patch, so now it works if you use gtk2hs from darcs. GValues are rather unholy and very much against the type safe philosophy of Haskell, so I'm working to hide their existence as much as possible (which shouldn't be particularly hard, just a little annoying).

I'm not sure what I'm going to work on next. I realized today that using animation with signals in the property won't work. I think I'll work on getting more parts of events working, and cleaning up the code related to the implicit animation functions, and deal with all the GValues.


Emacs and Vim

Last week I finally managed to switch to Emacs. I've meant to try this several times before, in particular when Richard Stallman, the original author of Emacs, stayed in my room for a night when he visited RPI. I had been using Vim since I switched to GNU/Linux. At that time, the Emacs keys made no sense. Also, in various Linux-related tutorials, Vim was usually mentioned first and there was no point in learning 2 editors.  I've found that moving around the text in Emacs is a bit easier, and the same as bash (and actually made me aware of more bash shortcuts). Since I had moved on from using qwerty over a year ago, I've been using the arrow keys instead of h, j, k, l. I never bothered to rebind the keys, which also would be annoying.  There are a number of things that annoy me about Emacs.

The syntax highlighting in Vim is nicer. First of all, the syntax highlighting of types in C in Emacs figures out what to highlight as a type based on context. Because of this, as you go along the colors change and it's kind of annoying. This also doesn't give you the alert that you would get in Vim when you make a typo and it doesn't change color, although the Vim way had the disadvantage of needing to specify the types in some syntax config file for more obscure types from a certain library, such as mpfr_rnd_t or something like that. Special escaped characters in strings, such as '\n' for newline or '\t' for tab, aren't highlighted in Emacs, but they are in Vim. The whole preprocessor directive is highlighted in Vim, but not in Emacs. Numeric constants aren't highlighted in Emacs. #if 0'd out sections are highlighted as comments, but not in Emacs. These things I could probably configure, although I'm rather lazy and probably won't look into it. My other issue with Emacs syntax highlighting is the theming. There seem to be no good themes in the only large collection I can find. The ones that could almost be the same as my old theme from Vim have odd things wrong with them, such as having strings or comments italicized and totally unreadable.

I've lost lots of time trying to get a usable config. I fought especially long trying to get indentation that makes sense. The default "GNU" indentation style is basically the worst thing ever, with braces halfway indented and such. Once I got an indentation style, Emacs forces you to that style. The tab key sent the current line to the "correct" indentation for that line. I wanted tab to just insert 4 spaces, and when I went to a new line to have it go to a suggested indentation level. This was frustrating primarily for 2 reasons. First, I like to indent my comments after lines of code, and try to line my comments up off to the side. I think it looks neater that way. Also, it would not allow you to indent preprocessor directives, which was annoying when dealing with OpenMP, where it makes sense to indent the #pragmas for parallelizing loops and such. I eventually gave up on getting tab to do what I want, and ended up just using M-i to tab in where I wanted to outside of the indentation guidelines, and rebinding enter to newline and indent.

I still can't do everything I used to be able to do in Vim. I haven't looked into a few things yet. But overall, I seem to do things more efficiently, and do things I never bothered learning in Vim. Emacs macros are also wonderful.



So it's now been a year since I switched my keyboard layout to Dvorak, and now it's time to change it again now to Colemak. It was very upsetting last year when I first found out about Colemak. It was about a week into the transition and I had destroyed my ability to type on any keyboard, and I was already committed to Dvorak. Colemak is supposed to be much easier for QWERTY users to switch to because there are fewer changes, so I was wondering how it would be for me coming from Dvorak. I wanted to switch to Colemak largely so I could have Z, X, C, V in a row again for common keyboard shortcuts, as well as it supposedly being a little bit better. So far this transition is going much faster and smoother. I started on Friday night, and by the end of the weekend I could more or less use all 3 rows of letters on the keyboard. I'm now ready to try using it full time, although it will be slow for a while, and I'll need to drop to Dvorak for passwords. It took at least a week or two in the last switch, so this is much faster. I wonder why. There are several possible reasons I've thought of. Could it be that because I already successfully changed my keyboard layout before and my brain is now keyboard trainable? Is it because of Colemak's similarity to QWERTY and something was retained (I pretty much can't use QWERTY keyboards at all anymore)? This time I learned it a row at a time instead of tiny steps adding pairs of keys on each finger and gradually adding the 1st and 3rd rows. I hit 44 wpm on keybr, although the number of  errors I make varies. For a while my Dvorak ability seemed to not be affected. More recently I've been experiencing some issues (which may still get worse), but it seems that for now at least my Dvorak ability has not been completely destroyed. Unlike last time when I lost all ability to use QWERTY. So I used only Colemak to type this post, although it took forever. This is the longest block of text typed so far using Colemak. I also remember making note of my first wowomg typed with Colemak. Alternative keyboard layouts are fun and everyone should try one, although learning and switching requires some degree of patience. It's supposedly relatively easy to switch to Colemak for QWERTY because there are few changes.


I'm bored so I'm making a blog post.

So I was really bored and trying to avoid doing work right now, but then I realized I don't actually have anything to say.  Here are some words in a blog. It's April fool's so today the unicorns were replaced with cats.



So Amy was coming so I built a welcome wagon. It was the greatest wagon ever constructed, out of computer cases, office chairs, duct tape, and rope I guess. Of course everything was from the dumpsters except the rope and the duct tape. Some of the cases were hard to get from the dumpsters, nd required ripping them off to the metal part which is always annoying. The rope came from walmart. Initially I took two chairs from the dumpsters, and because they were somewhat broken, and I didn't have a screwdriver, I used brute force to hybridize them. I was going to drag this wagon all the way to Albany, but it wasn't very wagonlike. So then I harvested more computer cases. I then realized it was easy to remove the wheels from the chairs, and just using the cases I could make a better wagon. I was considering walking into Albany the next day to meet Amy at the bus station, which was a long way and I likely would have died. I was initially supposed to pick her up on Thursday by myself when Nate had class and wasn't going to pick her up. She told me she was expecting me to pull out the welcome wagon, and there to be fireworks. This would have been great because Amy would finally be coming for me in 2009. The heavy 'wagon' may have made it difficult, although I'm pretty sure I would have made it if I had no wagon and was running. Also it turned out it was raining anyway. I couldn't attach them so I went to the engineering lab the next day to drill holes in the cases, which I did. I should have cut the other cases up to make proper walls, but I was too incompetent to do that. Then using duct tape, the wheels were held in the holes I drilled. I used rope and duct tape to join the two wheeled case pieces together. I used only duct tape to make the walls. Then Welcome Wagon signs were printed and thrown on. Also there were peeps, skittles and fake pink flowers also from the random walmart trip. I didn't manage the fireworks requested by Amy. So then with this greatest of wagons I walked into Troy to the bus station, where Nate was, and then rode the bus to Amy. Amy's primary response to the Welcome wagon was to hit me in the face with the flowers. Why is Amy so mean to me? I build her a welcome wagon and she hits me with the flowers. On the bus back the driver wanted to know if she liked the flowers or something and maybe something about if he could have them. I don't know. I'm very confused most of the time. Wagons are wagony. Wagon wagon. Wagon. I think Welcome Wagon 2.0 will need to be a vast improvement. This 1st welcome wagon didn't even roll quite properly when pulled. The wheels were poorly attached, and not all straight. I think the next one will need blinking lights, some kind of reasonable suspension, proper rolling capabilities and even sounds. I think it needs a welcome wagon song, that we will record. That would make a truly formidable wagon for maximum welcoming. [gallery]


Galaxy Sized Spoon: A Problem for the Ages

I got to wondering again about the greatest engineering problem we could ever face: the challenge of constructing a galaxy size spoon.  Forget Dyson spheres, those things are useless and easy. What we need is a galaxy size spoon. Clearly the most useful goal we should have as a race. It will likely take many generations, much patience and there will be many challenges, but I think the end result will be well worth it. There are many questions and challenging relating to the construction of this super spoon, which I hope someday to have answers to.

So what challenges are faced in the construction of this greatest of spoons? Well the first problem I've thought of is simply if there is enough material in the universe to do it. Furthermore, what is this spoon going to be made of?

A metal spoon? A plastic spoon? Aluminum? Iron? Copper? All of the above? Now I think a metal spoon would really be ideal. Now if we had a plastic spoon, we could use some of the hydrogen in addition to the carbon, although the mass of the carbon is much more significant, and really all these numbers are fairly arbitrary so I'll just say a plastic spoon is composed of pure carbon. Actually a pure carbon spoon would be really cool too. Then we could experiment with different allotropes of carbon. A diamond spoon! Graphite! Buckyballs?

Now the total mass of the universe is not really known for many obvious reasons, but I've seen estimates ranging from on the order of 10⁵⁰ to 10⁶⁰ kg. I'll say 10⁵⁵ kg because it's the first number I saw when using duck duck go to find the mass of the universe. This is clearly flawless reasoning in choosing a number.

So suppose the mass of the universe is 10⁵⁵ kg. Now of this, we only want the non-hydrogen/helium components. Now of the total mass, it's estimated only about 4% is normal matter, with the rest being the mysterious dark energy and dark matter and what not. Of that remaining normal matter, about 99% is hydrogen and helium, which aren't good spoon building materials. So about 1% of 4%, so I'll say that the amount of potentially usable material is on the order of 10⁵⁵ * 10⁻⁴ = 10⁵¹ kg. Now this includes all the elements. Most of this is going to be the more common fusion products, such as carbon, oxygen, and nitrogen, with diminishing amounts as you approach and pass iron with the whole belt of nuclear stability with the binding energy and all that, but whatever. You have 10⁵¹ kg of potentially usable material in total to use for the spoon. Now how much material do we need for such a spoon? When we say galaxy sized spoon, what do we mean? Do we mean the bowl, actual spoon part is capable of engulfing the milky way? Or do we mean from tip of the spoon to the tip of the handle is about 1 galactic diameter? I'll arbitrarily choose the second option, and say the spoon is 100,000 light years from tip of the handle to the other end.

Now we need to estimate the volume of the spoon. So I have a spoon here I'll use as an example. I measured it to be about 15.5 cm long. The spoon part is sort of elliptical shaped, 3.2 cm and 5 cm on each axis, and about 8mm deep. The spoon is about 1mm thick in the spoon part, and 2 mm in the handle, although this varies a lot in different places, like it's 'bubbly' in the center where it kind of hollows in the bottom. The handle varies in width, from ~5mm to 1.6 cm. So the spoon is a somewhat complex shape, at least this spoon. So I'll just take ratios derived from these numbers, and assume the spoon is composed of a rectangular handle attached to a hollowed half ellipsoid, where the rectangle I'll say is 3 cm x 10.5 cm x 2 mm.

The handle's length is then 15.5 cm - 5 cm = 10.5 cm. By calculating the volume of the volume of the half ellipsoid, and subtracting the hollow part, and adding the handle (and of course scaling up in the ratio 15.5cm:100,000 ly), I find that this crude estimate of the spoon's volume to be about 2 * 10⁶⁰ m³ of physical parts of the spoon.

This is indeed a large spoon. Now using some density figure we can find the mass of the spoon. The question of the density is another tricky one, as it varies with temperature and pressure. What would these be in this galaxy sized spoon? The issue of pressure on different parts of the spoon is another issue to be addressed later, and temperature is another tricky one. Because I'm lazy and also have no idea what kind of things happen when you have a mass of this magnitude, I'll just say the densities of the materials are the standard ones we use under earthy conditions.

Now calculating for different materials, I get for the mass of the spoon to be:

  • Iron (ρ = 7870 kg/m³) = 1.6 * 10⁶⁴ kg
  • Gold (for the lulz) (ρ = 19,300 kg/m³) = 4.0 * 10⁶⁴ kg
  • Copper (ρ = 8960 kg/m³) = 1.9 * 10⁶⁴ kg
  • Nickel (ρ = 8900 kg/m³) =  1.8 * 10⁶⁴ kg
  • Silicon (ρ = 2330 kg/m³) = 4.8*10⁶³ kg
  • Corn Syrup (ρ = 1380 kg/m³) = 2.8*10⁶³ kg
  • Ice (ρ = 927 kg/m³) =  1.9 * 10⁶³ kg
  • Lard (ρ = 919 kg/m³) = 1.9 * 10⁶³ kg
  • Plastics (850 < ρ < 1400 kg/m³) = 1.8*10⁶³ - 2.9*10⁶³ kg
  • Diamond (ρ = 3500 kg/m³) = 7.2 * 10⁶³ kg
  • Graphite (ρ = 2090 kg/m³) = 4.3 * 10⁶³ kg
So we are looking at a range from 1.8*10⁶³ to 2 * 10⁶⁴ kg of material for the spoon. This is larger than even the largest figure for the total mass of the universe by several orders of magnitude, much less the figure for material we could potentially use as normal matter that isn't H or He. This is a very sad result. I’m a bit disappointed. Actually I should have realized the magnitude would be too large just from the volume before even calculating the actual mass, but I’m rather dumb so I went through all that for almost no reason. But I’m not giving up that easily. We could try refining the spoon parameters, maybe save some mass. Maybe make this a galaxy sized SPORK instead. Everyone loves sporks. Could make this a hollow spoon, or shorten the handle and change the proportions a bit. My example spoon may not have been very good.

We could make it a mesh spoon, although that’s sort of cheating. Is it really a spoon if it’s meshed? Well probably not in the actual spoon part, but I think a "mesh" handle if feasible would work, and would save considerable mass. Also making the surface of the spoon ’pitted’ could help save mass, in a similar way to how in Hadrian’s Pantheon has the tessellated coffers to reduce the mass so building the dome was possible.

I remember being there and there construction or something going on which was funny because it’s an ancient building, now with scaffolding and plastic sheets being worked on.

A smaller spoon compromise might be needed, maybe a dwarf galaxy sized spoon or something. So let us assume that we can get this spoon down to a reasonable mass. And by reasonable mass I mean a mass less than the total mass in the universe. I will arbitrarily decide this to be 1/2 of the total non-H/He matter. Or could just take the whole thing. I mean at this level of technology you probably have synthesis of any element thing from anything taken care of. Now it doesn't really matter because I’m too lazy to calculate how big of a spoon this would produce either way right now, so now the other issues should be considered.

Next there are the obvious issues of the simple size of the spoon and delivering materials to areas being worked on. The speed of light limit when constructing a multi-lightyear ultrastructure must really be inconvenient. How would you move along the spoon? How would you navigate it? It would take many years from any given point on the spoon to see the progress on the construction of a relatively ’nearby’ part of the spoon. Obviously most of the construction would have to be taken care of by robots. These would have to be quite the robots. They would have to last for a very long time, and be able to handle the construction, and be able to supply themselves with the power. There would have to be 'gatherer' robots to acquire material and convert it into spoon construction material.

What’s the surface of the spoon like? On one hand I envision giant bubbles holding entire civilizations that are somehow there and somehow producing energy and surviving there on the surface. Actually, they could be inside the spoon, which also may be hollow anyway to save the tons of mass necessary to make any of it possible. Now that I think of it, this is thinking of the spoon too much as an artificial planet, which it is not. It’s far too large and massive.

The gravity problem is quite the problem. Could anything survive near it, or in it? Maybe inside the surface at certain points to have nice cancellation of forces so you don’t die. Although moving around near portions of the spoon, the tidal forces I would think would be terrible. With all this mass, could the spoon even survive? Well anyways, that’s a separate issue to think about...what about random surface features like you might see on the death star or something, but that would be an unnecessary decoration and would take a lot of extra mass. There was a name for that which was on reddit not too long ago that I don’t remember.  So from very close, the spoon’s surface would be very smooth, unless it’s easier to produce a rough, jagged surfaced spoon. Although if you’re going through all the trouble of producing this great spoon you might as well make it nice and produce a nice clean, smooth surface.

So gravity…it’s a problem. This spoon is huge and heavy. I think it’s likely to collapse, at least without some kind of special structure or shape, which may vary considerably from my model spoon. I don’t really know how I could try calculating this. I don’t know much about structure. However, this is not your typical engineering structure problem. Instead of building some structure where the gravity of the earth is your concern, in this extraordinary case, the gravity of the structure itself is the only concern. I have very little idea how to begin calculating this. I should think about this some more. I’m not sure anyone has considered such an issue before.

What about moving the spoon? Rotating it? With it’s huge mass, the amount of energy required to accelerate it is obviously huge as well. With a structure on the scale of thousands of light years, how does the motion propagate? What does motion even mean for a structure this big? I mean this really becomes a strange question if you have consumed all the mass and energy producing the spoon, and then there is nothing left to measure your velocity relative to, just the 1 enormous spoon that is what’s left of the universe. Would it just snap? Parts shear off? I assume it isn't a truly solid mass. We have these hollow parts now.

However, at this point the technology to produce the spoon is such that we might as well assume the construction is perfect doesn't have any weak points or anything like that which could cause problems. I feel like the whole thing would just collapse in on itself. It’s just too massive. However, the mass is rather spread out over a large area. However, a considerable portion of the mass of the universe concentrated into the area of a small galaxy is very dense. Could this mass actually collapse to form a black hole? Is this the cycle of the universe? Civilizations form to produce a giant spoon that collapses in on itself to form a new universe?

Now assume you can somehow generate the energy to move it. What do you do with it? Well it’s so massive, it probably pulls in stars and things into it over huge amounts of time with the whole gravity thing. You could scoop stars I guess? What would that mean? The time it takes you to move the spoon may be longer than the lifetime of the stars.

What happens if a star or something else hits the spoon? Would it be disastrous to the integrity of the spoon? What kind of crater in the surface would it produce? I don’t think it could penetrate. There’s still a great many light years through to the other side of the spoon from any point on the surface. Although, if it is hollow, how thick are the walls? What kind of space is inside? Is this a vacuous hollow, or more of a honeycomb type of thing? Are there even stars, galaxies or other items left to scoop with so much mass incorporated into the spoon?

Here I have a picture of what I think the spoon would look like from a very far distance. Notice you can’t see it. This is probably because you've put most of the energy of the universe into the material of the spoon, and also tapped whatever photons were flying around too. Also you've used all the nearby stars and galaxies in producing the spoon, so there’s no light sources. The spoon doesn't glow. Well if you really wanted you might try, but this brings a whole new level to the problem, bringing issues such as what parts glow, and generating power for it. You might need to do something like recapture the lost energy of the emitted light to continue emitting or something crazy if there’s nothing left.

Galaxy Sized Spoon

Artist's Rendition of what the spoon might look like when completed. (Whale is from open clip art)

(The accompanying spacewhale oversees the construction of the spoon and also may be the vessel containing remaining civilization. The reason it is visible is not known. It also isn't clear why it's so big next to the spoon. It is a very large spacewhale. However, it could be very close. It probably isn't to scale. Although the spoon definitely is in this picture.)

Or does the spoon glow? It should be a blackbody. But what is the temperature of the spoon? I think all this madness, between bringing all this mass together, along with all the manipulations going on it would heat up. Now heating up where? I think if it’s heated up in the portion of the spoon currently being worked on, you've got this huge surface with a heterogeneous temperature distribution, and this I think would have consequences on the structure of the spoon. You may need to take measures to keep the temperature approximately constant over the entirety of the spoon to prevent bad things from happening.

With all these challenges, the ambition may need to be scaled down to something less impressive like a star or planet sized spoon, which is far more manageable, although all the same issues apply but many orders of magnitude less.

So those are some of the issues I've thought of for the spoon in a somewhat random order. There are probably many more issues, some of which I've just not remembered right now. I hope to develop more thoughts on these issues, figure out how to calculate some of them and try to imagine solutions. Also there’s probably a lot of problems with my thinking about these problems and just wrong things. It’s not like I’m actually going to proofread any of this or try to make it coherent or anything.


Tongue Shadows

I discovered the other day that I could see my tongues' shadow if I stick it out far enough and look. I don't think I had ever seen my tongue's shadow before. It's quite the development. I'm not sure how I functioned before I knew I could see my tongue's shadow. This is even more exciting when a few months ago I discovered I could see my tongue if I stuck it out far enough. That was quite the day. My tongue got really tired.


Random Thoughts and Exciting things.

The other day I rescued a squirrel that was trapped in the trash. It was that kind of trash can with the dome thing on the top with the door that you push in to open, but doesn't swing out. The squirrel was flailing around and trying to push itself up against the door, and falling down sometimes into the trash. That's probably the most exciting thing. I let it out and then it ran away. So sad.

This weekend I spent my time accomplishing very little of what I planned. One thing I was working on for a while was for my next OpSys homework. The professor said we can use "any" language for our next project, so obviously it should be done in JavaScript with Seed. But the RPI CS machines running FreeBSD 6.3 obviously don't have Seed installed, so I would need to submit Seed along with the actual assignment, probably as a huge, statically linked binary. So I spent some time trying to get Seed built in a FreeBSD install in a virtual machine. Ports is really weird. I spent a long time trying to get all the dependencies for WebKit installed. Eventually I got an old WebKit from ports installed, but for some reason couldn't get one from git built, because somehow the dependencies that clearly had been installed for the ports WebKit were there. I don't understand ports. It seems to make no sense at all. I tried building gobject-introspection anyway, but the build scripts were looking for Glib headers in the wrong place, so then I forgot about that project for the rest of the weekend because autotools hates me.

I have a list of random projects I'm trying to start working on. One of them is GHamlet. A Clutter+Seed thing that plays Hamlet. The actors are Clutter actors naturally, so GHamlet will consist of colored rectangles moving around with text appearing around them for the dialogue. So far, I've found a text file copy of the Hamlet script. A major difficulty in creating GHamlet is the stage directions. I tried inventing a system of describing actions in a way that is hopefully easily parsed, but I think I failed. There are a small number of repeatable actions, such as move on and off stage, and death. Other than that, most of the actions are unique. After spending several hours going through Hamlet and translating the stage directions, not much has changed. I probably could have simplified the directions much more for the few that are easily repeated. Oh well. It will be slightly easier to regexp a new system now at least.

Anyway it took a long time to go through editing the file. Then today on Reddit there was a video about effective vim usage that was over an hour long. I watched it, and now my life has been revolutionized. I now know so much more about vim. My life has been revolutionized. Now I can do all kinds of magic that would have made processing Hamlet much easier. Oh well.

While my blog may have a cornify feature, and that's fine but there's a problem: the rest of the internet is lacking unicorns. Well I plan to fix this. With the new Seed Epiphany extensions, it's on my todo list to write a cornify extension for Epiphany which will bring unicorns to everywhere you look!

See Older Posts