mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-04-25 14:37:47 +00:00
lots of fixes: formatting, broken links and markup, add comments
This commit is contained in:
parent
5f159ef1ee
commit
5960252f24
45 changed files with 349 additions and 223 deletions
|
|
@ -36,8 +36,8 @@ Redirect 301 /blog/2006.02.20-obligatory-post-about-ruby-on-rails /posts/2006/02
|
|||
Redirect 301 /blog/2006.02.20-textmate-snippets-for-rails-assertions /posts/2006/02/textmate-snippets-for-rails-assertions
|
||||
Redirect 301 /blog/2006.02.21-textmate-insert-text-into-self-down /posts/2006/02/textmate-insert-text-into-self-down
|
||||
Redirect 301 /blog/2006.02.21-textmate-move-selection-to-self-down /posts/2006/02/textmate-move-selection-to-self-down
|
||||
Redirect 301 /blog/2006.02.22-intelligent-migration-snippets-0.1-for-textmate /posts/2006/02/intelligent-migration-snippets-0.1-for-textmate
|
||||
Redirect 301 /blog/2006.02.23-sjs-rails-bundle-0.2-for-textmate /posts/2006/02/sjs-rails-bundle-0.2-for-textmate
|
||||
Redirect 301 /blog/2006.02.22-intelligent-migration-snippets-0.1-for-textmate /posts/2006/02/intelligent-migration-snippets-0_1-for-textmate
|
||||
Redirect 301 /blog/2006.02.23-sjs-rails-bundle-0.2-for-textmate /posts/2006/02/sjs-rails-bundle-0_2-for-textmate
|
||||
Redirect 301 /blog/2006.03.03-generate-selfdown-in-your-rails-migrations /posts/2006/03/generate-selfdown-in-your-rails-migrations
|
||||
Redirect 301 /blog/2006.03.03-i-dont-mind-fairplay-either /posts/2006/03/i-dont-mind-fairplay-either
|
||||
Redirect 301 /blog/2006.03.03-spore /posts/2006/03/spore
|
||||
|
|
@ -59,7 +59,7 @@ Redirect 301 /blog/2006.09.22-some-features-you-might-have-missed-in-itunes-7 /p
|
|||
Redirect 301 /blog/2006.12.17-coping-with-windows-xp-activiation-on-a-mac /posts/2006/12/coping-with-windows-xp-activiation-on-a-mac
|
||||
Redirect 301 /blog/2007.03.06-full-screen-cover-flow /posts/2007/03/full-screen-cover-flow
|
||||
Redirect 301 /blog/2007.03.08-digg-v4-reply-to-replies-greasemonkey-script /posts/2007/03/digg-v4-reply-to-replies-greasemonkey-script
|
||||
Redirect 301 /blog/2007.03.25-diggscuss-0.9 /posts/2007/03/diggscuss-0.9
|
||||
Redirect 301 /blog/2007.03.25-diggscuss-0.9 /posts/2007/03/diggscuss-0_9
|
||||
Redirect 301 /blog/2007.04.04-a-triple-booting-schizophrenic-macbook /posts/2007/04/a-triple-booting-schizophrenic-macbook
|
||||
Redirect 301 /blog/2007.04.11-activerecord-base.find_or_create-and-find_or_initialize /posts/2007/04/activerecord-base.find_or_create-and-find_or_initialize
|
||||
Redirect 301 /blog/2007.04.16-getting-to-know-vista /posts/2007/04/getting-to-know-vista
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<head>
|
||||
|
||||
<% if (typeof title != 'undefined') { -%>
|
||||
<title><%= title %> - <%= site %></title>
|
||||
<title><%= site %>: <%= title %></title>
|
||||
<% } else { -%>
|
||||
<title><%= site %></title>
|
||||
<% } -%>
|
||||
|
|
@ -60,7 +60,8 @@
|
|||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<% var bodyClasses = current.path -%>
|
||||
<body class="<%= bodyClasses.join(' ') %>">
|
||||
|
||||
<header class="primary">
|
||||
<div class="title">
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ code,
|
|||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace;
|
||||
/* font-family: monospace, monospace;*/
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ img {
|
|||
@highlight: #a00;
|
||||
|
||||
// font weight
|
||||
@weight-thin: 300;
|
||||
@weight-thin: 400;
|
||||
|
||||
body {
|
||||
background-color: @background;
|
||||
|
|
@ -125,7 +125,7 @@ header.primary {
|
|||
}
|
||||
|
||||
nav {
|
||||
|
||||
-webkit-transform: translate3d(0, 0, 0);
|
||||
padding-top: 0.5rem;
|
||||
clear: left;
|
||||
|
||||
|
|
@ -146,10 +146,6 @@ header.primary {
|
|||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
@media (min-width: @screen-medium) {
|
||||
font-weight: @weight-thin;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
list-style-type: none;
|
||||
|
|
@ -249,15 +245,17 @@ ul.archive {
|
|||
|
||||
}
|
||||
|
||||
body.projects:not(.index) .container {
|
||||
h2, h4 {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.project-info {
|
||||
|
||||
h3 {
|
||||
text-align: center;
|
||||
margin-bottom: 0.2rem;
|
||||
|
||||
@media (min-width: @screen-medium) {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.column {
|
||||
|
|
@ -266,6 +264,7 @@ ul.archive {
|
|||
|
||||
ul {
|
||||
padding-left: 0;
|
||||
text-align: center;
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
|
|
@ -274,3 +273,22 @@ ul.archive {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Posts
|
||||
*/
|
||||
|
||||
ul.audio li {
|
||||
height: 2rem;
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
|
||||
ul.audio audio {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
table.code pre {
|
||||
width: 100%;
|
||||
overflow: scroll;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
"typocode"
|
||||
]
|
||||
},
|
||||
"intelligent-migration-snippets-0.1-for-textmate": {
|
||||
"intelligent-migration-snippets-0_1-for-textmate": {
|
||||
"title": "Intelligent Migration Snippets 0.1 for TextMate",
|
||||
"date": "February 22, 2006",
|
||||
"timestamp": 1140607680,
|
||||
|
|
@ -153,9 +153,9 @@
|
|||
"snippets"
|
||||
],
|
||||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2006/02/intelligent-migration-snippets-0.1-for-textmate"
|
||||
"url": "/posts/2006/02/intelligent-migration-snippets-0_1-for-textmate"
|
||||
},
|
||||
"sjs-rails-bundle-0.2-for-textmate": {
|
||||
"sjs-rails-bundle-0_2-for-textmate": {
|
||||
"title": "SJ's Rails Bundle 0.2 for TextMate",
|
||||
"date": "February 23, 2006",
|
||||
"timestamp": 1140743880,
|
||||
|
|
@ -170,7 +170,7 @@
|
|||
"textmate"
|
||||
],
|
||||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2006/02/sjs-rails-bundle-0.2-for-textmate",
|
||||
"url": "/posts/2006/02/sjs-rails-bundle-0_2-for-textmate",
|
||||
"styles": [
|
||||
"typocode"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
so it's 2am and i should be asleep, but instead i'm setting up a blog. i got a new desk last night and so today i finally got my apartment re-arranged and it's much better now. that's it for now... time to sleep.
|
||||
|
||||
(speaking of sleep, this new <a href="http://www.musuchouse.com/">sleeping bag</a> design makes so much sense. awesome.)
|
||||
(speaking of sleep, this new [sleeping bag](http://www.musuchouse.com/) design makes so much sense. awesome.)
|
||||
|
|
|
|||
|
|
@ -43,3 +43,43 @@ mrc: **M**igration **R**remove **C**olumn
|
|||
remove_column "${1:table}", "${2:column}"
|
||||
|
||||
I'll be adding more snippets and macros. There should be a central place where the rails bundle can be improved and extended. Maybe there is...
|
||||
|
||||
----
|
||||
|
||||
#### Comments
|
||||
|
||||
<div id="comment-1" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://blog.inquirylabs.com/">Duane Johnson</a>
|
||||
</div>
|
||||
<span class="date" title="2006-02-19 06:48:00 -0800">Feb 19, 2006</span>
|
||||
<div class="body">
|
||||
<p>This looks great! I agree, we should have some sort of central place for these things, and
|
||||
preferably something that's not under the management of the core Rails team as they have too
|
||||
much to worry about already.</p>
|
||||
|
||||
<p>Would you mind if I steal your snippets and put them in the syncPeople on Rails bundle?</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-2" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://samhuri.net">Sami Samhuri</a>
|
||||
</div>
|
||||
<span class="date" title="2006-02-19 18:48:00 -0800">Feb 19, 2006</span>
|
||||
<div class="body">
|
||||
<p>Not at all. I'm excited about this bundle you've got. Keep up the great work.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-3" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://blog.inquirylabs.com/">Duane Johnson</a>
|
||||
</div>
|
||||
<span class="date" title="2006-02-20 02:48:00 -0800">Feb 20, 2006</span>
|
||||
<div class="body">
|
||||
<p>Just added the snippets, Sami. I'll try to make a release tonight. Great work, and keep it coming!</p>
|
||||
|
||||
<p>P.S. I tried several ways to get the combo-snippets to put the pieces inside the right functions but failed. We'll see tomorrow if Allan (creator of TextMate) has any ideas.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<p><em><strong>UPDATE:</strong> I got everything working and it's all packaged up <a href="2006.02.22-intelligent-migration-snippets-0.1-for-textmate">here</a>. There's an installation script this time as well.</em></p>
|
||||
<p><em><strong>UPDATE:</strong> I got everything working and it's all packaged up <a href="/posts/2006/02/intelligent-migration-snippets-0_1-for-textmate">here</a>. There's an installation script this time as well.</em></p>
|
||||
|
||||
<p>Thanks to <a href="http://thread.gmane.org/gmane.editors.textmate.general/8520">a helpful thread</a> on the TextMate mailing list I have the beginning of a solution to insert text at 2 (or more) locations in a file.</p>
|
||||
|
||||
|
||||
<p>I implemented this for a new snippet I was working on for migrations, <code>rename_column</code>. Since the command is the same in self.up and self.down simply doing a reverse search for <code>rename_column</code> in my <a href="2006.02.21-textmate-move-selection-to-self-down">hackish macro</a> didn't return the cursor the desired location.</p><p>That's enough introduction, here's the program to do the insertion:</p>
|
||||
<p>I implemented this for a new snippet I was working on for migrations, <code>rename_column</code>. Since the command is the same in self.up and self.down simply doing a reverse search for <code>rename_column</code> in my <a href="/posts/2006/02/textmate-move-selection-to-self-down">hackish macro</a> didn't return the cursor the desired location.</p><p>That's enough introduction, here's the program to do the insertion:</p>
|
||||
|
||||
|
||||
<div class="typocode"><pre><code class="typocode_ruby "><span class="comment">#!/usr/bin/env ruby</span>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<p><strong>UPDATE:</strong> <em>This is obsolete, see <a href="2006.02.21-textmate-insert-text-into-self-down">this post</a> for a better solution.</em></p>
|
||||
<p><strong>UPDATE:</strong> <em>This is obsolete, see <a href="/posts/2006/02/textmate-insert-text-into-self-down">this post</a> for a better solution.</em></p>
|
||||
|
||||
<p><a href="2006.02.18-some-textmate-snippets-for-rails-migrations.html#comment-3">Duane's comment</a> prompted me to think about how to get the <code>drop_table</code> and <code>remove_column</code> lines inserted in the right place. I don't think TextMate's snippets are built to do this sort of text manipulation. It would be nicer, but a quick hack will suffice for now.</p><p>Use <acronym title="Migration Create and Drop Table">MCDT</acronym> to insert:</p>
|
||||
<p><a href="/posts/2006/02/some-textmate-snippets-for-rails-migrations.html#comment-3">Duane's comment</a> prompted me to think about how to get the <code>drop_table</code> and <code>remove_column</code> lines inserted in the right place. I don't think TextMate's snippets are built to do this sort of text manipulation. It would be nicer, but a quick hack will suffice for now.</p><p>Use <acronym title="Migration Create and Drop Table">MCDT</acronym> to insert:</p>
|
||||
|
||||
<div class="typocode"><pre><code class="typocode_ruby "><span class="ident">create_table</span> <span class="punct">"</span><span class="string">table</span><span class="punct">"</span> <span class="keyword">do</span> <span class="punct">|</span><span class="ident">t</span><span class="punct">|</span>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
Till now I've been using my own version of <a href="http://meta.wikimedia.org/wiki/Pywikipedia">pywikipedia</a> for scripting MediaWiki, and it works well. But I read about <a href="http://wikipediafs.sourceforge.net/">WikipediaFS</a> and had to check it out. It's a user space filesystem for Linux that's built using the <a href="http://fuse.sourceforge.net/wiki/index.php/LanguageBindings">Python bindings</a> for <a href="http://fuse.sourceforge.net/">FUSE</a>. What it does is mounts a filesystem that represents your wiki, with articles as text files. You can use them just like any other files with mv, cp, ls, vim, and so on.
|
||||
Until now I've been using my own version of <a href="http://meta.wikimedia.org/wiki/Pywikipedia">pywikipedia</a> for scripting MediaWiki, and it works well. But I read about <a href="http://wikipediafs.sourceforge.net/">WikipediaFS</a> and had to check it out. It's a user space filesystem for Linux that's built using the <a href="http://fuse.sourceforge.net/wiki/index.php/LanguageBindings">Python bindings</a> for <a href="http://fuse.sourceforge.net/">FUSE</a>. What it does is mounts a filesystem that represents your wiki, with articles as text files. You can use them just like any other files with mv, cp, ls, vim, and so on.
|
||||
|
||||
There hasen't been any action on that project for 13 months though, and it doesn't work on my wiki (MediaWiki 1.4.15) so I'm going to try and make it work after I upgrade to MediaWiki 1.6.3 tonight. This will be pretty cool when it works. I haven't looked at the code yet but it's only 650 lines.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
How's this for an update: I'm working in Munich for the summer at a European search engine called <a href="http://www.seekport.co.uk/">Seekport</a>. The search engine isn't all they do, as right now I'm programming a desktop widget that shows live scores & news from World Cup matches (in English and Arabic). I'm building it on top of the <a href="http://widgets.yahoo.com/">Yahoo! Widget Engine</a> because it needs to run on Windows. Even though I quite like the Y! Engine, I would still prefer to be coding in straight HTML, CSS & JavaScript like Dashboard programmers get to use. The Y! Engine uses XML (it is somewhat HTML-like) and JavaScript.
|
||||
|
||||
The place I'm living in is like a dormitory for younger people. I share a bathroom & kitchen with a German guy named Sebastian who is 21 and an artist; a stonecutter actually. I only met him briefly yesterday, but he seems nice. I'm going to teach him English, and he'll teach me German, though his English is much better than my German. It's a pretty quiet place, and we get breakfast included, dinner can be bought for €2,50, and Internet access is included as well. I brought my Mac Mini with me, and as soon as I find an AC adapter I'll be ready to go with the 'net at home. I probably won't blog again till then, since I'm at work right now.
|
||||
The place I'm living in is like a dormitory for younger people. I share a bathroom & kitchen with a German guy named Sebastian who is 21 and an artist; a stonecutter actually. I only met him briefly yesterday, but he seems nice. I'm going to teach him English, and he'll teach me German, though his English is much better than my German. It's a pretty quiet place, and we get breakfast included, dinner can be bought for €2,50, and Internet access is included as well. I brought my Mac Mini with me, and as soon as I find an AC adapter I'll be ready to go with the 'net at home. I probably won't blog again until then, since I'm at work right now.
|
||||
|
||||
Germany is great so far, and as soon as I get learning some German I'll be a much happier person. I consider it rude of me to expect everyone to converse with me in English, like I have to do right now.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
At <a href="http://www.seekport.co.uk/">Seekport</a> I'm currently working on an app to handle
|
||||
At [Seekport](http://translate.google.ca/translate?hl=en&sl=de&u=http://de.wikipedia.org/wiki/Seekport&prev=/search%3Fq%3Dseekport%26client%3Dsafari%26rls%3Den) I'm currently working on an app to handle
|
||||
the config of their business-to-business search engine. It's web-based and I'm using PHP, since
|
||||
that's what they're re-doing the front-end in. Right now it's a big mess of Perl, the main
|
||||
developer (for the front-end) is gone, and they're having trouble managing it. I have read
|
||||
|
|
@ -9,26 +9,24 @@ Anyway, I've been looking at basically every damn PHP framework there is and mos
|
|||
aren't that great (sorry to the devs, but they're not). It's not really necessary for my little
|
||||
project, but it helps in both writing and maintaining it. Many of them are unusable because
|
||||
they're still beta and have bugs, and I need to develop the app not debug a framework. Some of
|
||||
them are nice, but not really what I'm looking for, such as <a
|
||||
href="http://www.qcodo.com/">Qcodo</a>, which otherwise look really cool.
|
||||
them are nice, but not really what I'm looking for, such as [Qcodo](http://www.qcodo.com/), which otherwise look really cool.
|
||||
|
||||
<a href="http://cakephp.org/">CakePHP</a> and <a
|
||||
href="http://www.symfony-project.com/">Symfony</a> seem to want to be <a
|
||||
href="http://www.rubyonrails.org/">Rails</a> so badly, but fall short in many ways, code beauty
|
||||
[CakePHP](http://cakephp.org/) and [Symfony](http://www.symfony-project.com/) seem to want to be
|
||||
[Rails](http://www.rubyonrails.org/) so badly, but fall short in many ways, code beauty
|
||||
being the most obvious one.
|
||||
|
||||
I could go on about them all, I looked at over a dozen and took at least 5 of them for a
|
||||
test-drive. The only one I really think has a chance to be <em>the</em> PHP framework is the <a
|
||||
href="http://framework.zend.com/">Zend Framework</a>. I really don't find it that amazing, but
|
||||
test-drive. The only one I really think has a chance to be *the* PHP framework is the
|
||||
[Zend Framework](http://framework.zend.com/). I really don't find it that amazing, but
|
||||
it feels right, whereas the others feel very thrown-together. In other words, it does a good
|
||||
job of not making it feel like PHP. ;-)
|
||||
|
||||
Nothing they're doing is relovutionary, and I question the inclusion of things like PDF
|
||||
Nothing they're doing is revolutionary, and I question the inclusion of things like PDF
|
||||
handling when they don't even seem to have relationships figured out, but it provides a nice
|
||||
level of convenience above PHP without forcing you into their pattern of thinking. A lot of the
|
||||
other frameworks I tried seemed like one, big, unbreakable unit. With Zend I can really tell
|
||||
that nothing is coupled.
|
||||
|
||||
So I'll probably be writing some notes here about my experience with this framework. I also
|
||||
hope to throw Adobe's <a href="http://labs.adobe.com/technologies/spry/">Spry</a> into the mix.
|
||||
hope to throw Adobe's [Spry](http://labs.adobe.com/technologies/spry/) into the mix.
|
||||
That little JS library is a lot of fun.
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Some people left Seekport this month and 2 of the remaining employees moved into the office I’m working in. That’s fine, and I’m leaving at the end of the week, but man I’m going crazy. This guy’s pounding on his keyboard like it’s a fucking whack-a-mole game! I don’t know what kind of keyboard he learned to type on but it must’ve been horrible. It sounds like he must go through at least 10 of those things in a year. I don’t know if I’ll make it till Friday without yelling "AGH! STOP THE MADNESS YOU CRAZY BASTARD YOU JUST HAVE TO TOUCH THE KEYS!"
|
||||
Some people left Seekport this month and 2 of the remaining employees moved into the office I’m working in. That’s fine, and I’m leaving at the end of the week, but man I’m going crazy. This guy’s pounding on his keyboard like it’s a fucking whack-a-mole game! I don’t know what kind of keyboard he learned to type on but it must’ve been horrible. It sounds like he must go through at least 10 of those things in a year. I don’t know if I’ll make it until Friday without yelling "AGH! STOP THE MADNESS YOU CRAZY BASTARD YOU JUST HAVE TO TOUCH THE KEYS!"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
**Update:** This needs to be run at system startup, before you log in. I have XP Home and haven't been able to get it to run that way yet.
|
||||
|
||||
I can't test my method until I get XP Pro, if I get XP Pro at all. However chack left a <a href="2006.12.17-coping-with-windows-xp-activiation-on-a-mac.html#comment-1">comment</a> saying that he got it to work on XP Pro, so it seems we've got a solution here.
|
||||
I can't test my method until I get XP Pro, if I get XP Pro at all. However chack left a <a href="/posts/2006/12/coping-with-windows-xp-activiation-on-a-mac.html#comment-1">comment</a> saying that he got it to work on XP Pro, so it seems we've got a solution here.
|
||||
|
||||
<hr>
|
||||
|
||||
|
|
@ -65,11 +65,11 @@ If you have XP Pro then you can get it to run using the Group Policy editor. Sav
|
|||
<p>If you have XP Home then the best you can do is run this script from your Startup folder (Start -> All Programs -> Startup), but that is not really going to work because eventually Windows will not even let you log in until you activate it. What a P.O.S.</p>
|
||||
|
||||
@echo off
|
||||
|
||||
|
||||
ipconfig /all | find "Parallels" > network.tmp
|
||||
for /F "tokens=14" %%x in (network.tmp) do set parallels=%x
|
||||
del network.tmp
|
||||
|
||||
|
||||
if defined parallels (
|
||||
echo Parallels
|
||||
copy C:\Windows\System32\Parallels\wpa.* C:\Windows\System32
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2007/03/digg-v4-reply-to-replies-greasemonkey-script"
|
||||
},
|
||||
"diggscuss-0.9": {
|
||||
"diggscuss-0_9": {
|
||||
"title": "Diggscuss 0.9",
|
||||
"date": "March 25, 2007",
|
||||
"timestamp": 1174834980,
|
||||
|
|
@ -35,6 +35,6 @@
|
|||
"userscript"
|
||||
],
|
||||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2007/03/diggscuss-0.9"
|
||||
"url": "/posts/2007/03/diggscuss-0_9"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2007/04/a-triple-booting-schizophrenic-macbook"
|
||||
},
|
||||
"activerecord-base.find_or_create-and-find_or_initialize": {
|
||||
"activerecord-base_find_or_create-and-find_or_initialize": {
|
||||
"title": "ActiveRecord::Base.find_or_create and find_or_initialize",
|
||||
"date": "April 11, 2007",
|
||||
"timestamp": 1176287040,
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
"ruby"
|
||||
],
|
||||
"author": "Sami Samhuri",
|
||||
"url": "/posts/2007/04/activerecord-base.find_or_create-and-find_or_initialize"
|
||||
"url": "/posts/2007/04/activerecord-base_find_or_create-and-find_or_initialize"
|
||||
},
|
||||
"getting-to-know-vista": {
|
||||
"title": "Getting to know Vista",
|
||||
|
|
|
|||
|
|
@ -10,21 +10,18 @@ With <a href="http://www.macports.org/">MacPorts</a> and <a href="http://www.met
|
|||
|
||||
*[edit: 25 minutes to compile X.org, not too shabby!]*
|
||||
|
||||
My initial experience with Vista is quite good. Sadly the <a href="http://www.manicai.net/comp/swap-caps-ctrl.html">same old registry hack</a> is required to swap Caps lock and Control but I was just glad it worked. I really like the new Start menu and the eye-candy is fairly pleasant for the most part. Till now I’d only used RC2 on a machine incapable of running Aero Glass and it looked terrible. I switched to Windows Classic just like I do with XP. Not so with Aero at its finest though. Without thinking about the price Vista is a nice upgrade to Windows. But because of the price and uncertainty of running Aero Glass I still hesitate to urge non-geeks to upgrade.
|
||||
My initial experience with Vista is quite good. Sadly the <a href="http://www.manicai.net/comp/swap-caps-ctrl.html">same old registry hack</a> is required to swap Caps lock and Control but I was just glad it worked. I really like the new Start menu and the eye-candy is fairly pleasant for the most part. Until now I’d only used RC2 on a machine incapable of running Aero Glass and it looked terrible. I switched to Windows Classic just like I do with XP. Not so with Aero at its finest though. Without thinking about the price Vista is a nice upgrade to Windows. But because of the price and uncertainty of running Aero Glass I still hesitate to urge non-geeks to upgrade.
|
||||
|
||||
OS X is OS X. It’s my favourite desktop OS right now because of apps like LaunchBar/Quicksilver and TextMate, a generally excellent UI, good old *nix stability, zsh out of the box! When I need WireShark or the GIMP X11 is there waiting. Mac notebooks are great and tight integration with the hardware is a clear advantage for OS X.
|
||||
|
||||
Oh yeah, I also have a Parallels VM for Windows 3.11. It boots in about second to the <tt>C:\></tt> prompt and then another second to type <tt>win</tt> and Windows to start. Without TCP/IP there’s not much to do though (I’m not going to write a driver for Parallels’ ethernet adapter).
|
||||
|
||||
<ol>
|
||||
<li><a id="fn1" name="fn1"></a>
|
||||
<ul>
|
||||
<li>Dual head setups are more work than plugging in a 2nd monitor, which is too much work.
|
||||
<li>X requires a restart to enable or disable a 2nd display.
|
||||
<li>Overall clunkiness such as displaying the houndstooth background before the WM starts,
|
||||
<li>and/or going through a screwed up mode with a black & white scrambled screen for a seconds before getting to the houndstooth.
|
||||
</ul>
|
||||
<a href="#fn1-ret">back up ↑</a>
|
||||
</ol>
|
||||
* Dual head setups are more work than plugging in a 2nd monitor, which is too much work.
|
||||
|
||||
* X requires a restart to enable or disable a 2nd display.
|
||||
|
||||
* Overall clunkiness such as displaying the houndstooth background before the WM starts,
|
||||
|
||||
* and/or going through a screwed up mode with a black & white scrambled screen for a seconds before getting to the houndstooth.
|
||||
|
||||
Like I said the X.org boys are doing amazing work. Hopefully soon after the current eye-candy craze is over they’ll get to more important work that needs to be done.
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ They work exactly as you'd expect them to work with possibly one gotcha. If you
|
|||
|
||||
Enough chat, here's the self-explanatory code:
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>4 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="c"># extend ActiveRecord::Base with find_or_create and find_or_initialize.</span><tt>
|
||||
</tt><span class="co">ActiveRecord</span>::<span class="co">Base</span>.class_eval <span class="r">do</span><tt>
|
||||
|
|
@ -17,8 +17,8 @@ Enough chat, here's the self-explanatory code:
|
|||
</tr></table>
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -58,7 +58,7 @@ Enough chat, here's the self-explanatory code:
|
|||
</tt>38<tt>
|
||||
</tt>39<tt>
|
||||
</tt><strong>40</strong><tt>
|
||||
</tt>41<tt>
|
||||
</tt>41 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="r">module</span> <span class="cl">ActiveRecordExtensions</span><tt>
|
||||
</tt> <span class="r">def</span> <span class="pc">self</span>.included(base)<tt>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<p>I've been really frustrated with <a href="http://www.typosphere.org/">Typo</a> recently. For some reason changing my <a href="2007.04.30-funny-how-code-can-be-beautiful">last post</a> would cause MySQL to timeout and I'd have to kill the rogue ruby process manually before any other changes to the DB would work, instead of hanging for a minute or two then timing out. Luckily I was able to disable the post using the command line client, the bug only manifested itself when issuing an UPDATE with all the fields present. Presumably the body was tripping things up because most other fields are simple booleans, numbers, or very short strings.
|
||||
<p>I've been really frustrated with <a href="http://www.typosphere.org/">Typo</a> recently. For some reason changing my <a href="/posts/2007/04/funny-how-code-can-be-beautiful">last post</a> would cause MySQL to timeout and I'd have to kill the rogue ruby process manually before any other changes to the DB would work, instead of hanging for a minute or two then timing out. Luckily I was able to disable the post using the command line client, the bug only manifested itself when issuing an UPDATE with all the fields present. Presumably the body was tripping things up because most other fields are simple booleans, numbers, or very short strings.
|
||||
|
||||
Add to that the random HTTP 500 errors which were very noticeable while I was trying to fix that post and I was about to write my own blog or switch to WordPress.
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ zsh has an impressive completion system but I just don't feel the urge to ever c
|
|||
|
||||
### Linux is stable. Really stable. ###
|
||||
|
||||
While people bash Microsoft daily for tying the GUI layer to the kernel, Apple seems to get away with it scot-free. I don't know if it's caused by my external display hooked up to the dock, or the Prolific Firewire chip in my external disk enclosure but something causes the mysterious "music plays till the end of the song, mouse can be moved, but nothing works" bug now and then and all I can do is a hard reset.
|
||||
While people bash Microsoft daily for tying the GUI layer to the kernel, Apple seems to get away with it scot-free. I don't know if it's caused by my external display hooked up to the dock, or the Prolific Firewire chip in my external disk enclosure but something causes the mysterious "music plays until the end of the song, mouse can be moved, but nothing works" bug now and then and all I can do is a hard reset.
|
||||
|
||||
On Linux I currently use Fluxbox so everything is rock solid and fast (except Firefox! ;-), but in the extremely rare event that shit does hit the fan usually only a single app will crash, though sometimes X (and hence many others) go with it. A <code>sudo /etc/init.d/gdm restart</code> fixes that. The only times I've had to hard reset Linux was because of a random bug (strangely similar to my MacBook bug) with Nvidia's driver with dual head setups. All this is pretty moot since Linux is generally just stable.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
I'm currently reading <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html">SICP</a> since it's highly recommended by many people, available for free, and interesting. The fact that I have a little <a href="2007.06.14-more-scheming-with-haskell">Scheme interpreter</a> to play with makes it much more fun since I can add missing functionality to it as I progress through the book, thereby learning more Haskell in the process. Yay!
|
||||
I'm currently reading <a href="http://mitpress.mit.edu/sicp/full-text/book/book.html">SICP</a> since it's highly recommended by many people, available for free, and interesting. The fact that I have a little <a href="/posts/2007/06/more-scheming-with-haskell">Scheme interpreter</a> to play with makes it much more fun since I can add missing functionality to it as I progress through the book, thereby learning more Haskell in the process. Yay!
|
||||
|
||||
Anyway I was very pleased to see the only correct usage of the phrase "begs the question" I have seen in a while. It's a pet peeve of mine, but I have submitted myself to the fact that the phrase is so oft used to mean "begs for the following question to be asked..." that it may as well be re-defined. In its correct usage the sentence seems to hang there if you try to apply the commonly mistaken meaning to it. That's all very hazy so here's the usage in SICP (emphasis my own):
|
||||
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@
|
|||
Despite my current infatuation with Emacs there are many reasons I started using TextMate, especially little time-savers that are very addictive. I'll talk about one of those features tonight. When you have text selected in TextMate and you hit say the <code>'</code> (single quote) then TextMate will surround the selected text with single quotes. The same goes for double quotes, parentheses, brackets, and braces. This little trick is one of my favourites so I had to come up with something similar in Emacs. It was easy since a <a href="http://osdir.com/ml/emacs.nxml.general/2005-08/msg00002.html">mailing list post</a> has a solution for surrounding the current region with tags, which served as a great starting point.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>7 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">(defun surround-region-with-tag (tag-name beg end)<tt>
|
||||
</tt> (interactive "sTag name: \nr")<tt>
|
||||
|
|
@ -29,8 +29,8 @@ Despite my current infatuation with Emacs there are many reasons I started using
|
|||
With a little modification I now have the following in my ~/.emacs file:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -76,7 +76,7 @@ With a little modification I now have the following in my ~/.emacs file:
|
|||
</tt>44<tt>
|
||||
</tt>45<tt>
|
||||
</tt>46<tt>
|
||||
</tt>47<tt>
|
||||
</tt>47 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">;; help out a TextMate junkie<tt>
|
||||
</tt><tt>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
After <a href="2007.06.26-rtfm">axing</a> half of <a href="2007.06.23-emacs-for-textmate-junkies">wrap-region.el</a> I renamed it to <a href="/f/tagify.el">tagify.el</a> and improved it ever so slightly. It's leaner, and does more!
|
||||
After <a href="/posts/2007/06/rtfm">axing</a> half of <a href="/posts/2007/06/emacs-for-textmate-junkies">wrap-region.el</a> I renamed it to <a href="/f/tagify.el">tagify.el</a> and improved it ever so slightly. It's leaner, and does more!
|
||||
|
||||
<code>tagify-region-or-insert-tag</code> does the same thing as <code>wrap-region-with-tag</code> except if there is no region it now inserts the opening and closing tags and sets point in between them. I have this bound to <code>C-z t</code>, as I use <code>C-z</code> as my personal command prefix.
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
The first task is extending the <code>LispVal</code> type to grok floats.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -18,7 +18,7 @@ The first task is extending the <code>LispVal</code> type to grok floats.
|
|||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>14<tt>
|
||||
</tt>15<tt>
|
||||
</tt>15 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">type LispInt = Integer<tt>
|
||||
</tt>type LispFloat = Float<tt>
|
||||
|
|
@ -43,14 +43,14 @@ The reason for using the new <code>LispNum</code> type and not just throwing a n
|
|||
ElSchemo now parses negative numbers so I'll start with 2 helper functions that are used when parsing both integers and floats:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>7 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">parseSign :: Parser Char<tt>
|
||||
</tt>parseSign = do try (char '-')<tt>
|
||||
|
|
@ -69,15 +69,15 @@ ElSchemo now parses negative numbers so I'll start with 2 helper functions that
|
|||
Armed with these 2 functions we can now parse floating point numbers in decimal. Conforming to R5RS an optional <code>#d</code> prefix is allowed.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>8<tt>
|
||||
</tt>8 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">parseFloat :: Parser LispVal<tt>
|
||||
</tt>parseFloat = do optional (string "#d")<tt>
|
||||
|
|
@ -95,8 +95,8 @@ The first 6 lines should be clear. Line 7 simply applies the parsed sign to the
|
|||
The last step for parsing is to modify <code>parseExpr</code> to try and parse floats.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -109,7 +109,7 @@ The last step for parsing is to modify <code>parseExpr</code> to try and parse f
|
|||
</tt>11<tt>
|
||||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>14<tt>
|
||||
</tt>14 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">-- Integers, floats, characters and atoms can all start with a # so wrap those with try.<tt>
|
||||
</tt>-- (Left factor the grammar in the future)<tt>
|
||||
|
|
@ -134,14 +134,14 @@ The last step for parsing is to modify <code>parseExpr</code> to try and parse f
|
|||
That's it for parsing, now let's provide a way to display these suckers. <code>LispVal</code> is an instance of show, where <code>show</code> = <code>showVal</code> so <code>showVal</code> is our first stop. Remembering that <code>LispVal</code> now has a single <code>Number</code> constructor we modify it accordingly:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>7 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">showVal (Number n) = showNum n<tt>
|
||||
</tt><tt>
|
||||
|
|
@ -170,8 +170,8 @@ Oops, we don't know how to operate on floats yet!
|
|||
Parsing was the easy part. Operating on the new floats is not necessarily difficult, but it was more work than I realized it would be. I don't claim that this is the best or the only way to operate on any <code>LispNum</code>, it's just the way I did it and it seems to work. There's a bunch of boilerplate necessary to make <code>LispNum</code> an instance of the required classes, Eq, Num, Real, and Ord. I don't think I have done this properly but for now it works. What is clearly necessary is the code that operates on different types of numbers. I think I've specified sane semantics for coercion. This will be very handy shortly.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -240,7 +240,7 @@ Parsing was the easy part. Operating on the new floats is not necessarily diffi
|
|||
</tt>67<tt>
|
||||
</tt>68<tt>
|
||||
</tt>69<tt>
|
||||
</tt><strong>70</strong><tt>
|
||||
</tt><strong>70 </strong><tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">lispNumEq :: LispNum -> LispNum -> Bool<tt>
|
||||
</tt>lispNumEq (Integer arg1) (Integer arg2) = arg1 == arg2<tt>
|
||||
|
|
@ -318,8 +318,8 @@ Parsing was the easy part. Operating on the new floats is not necessarily diffi
|
|||
Phew, ok with that out of the way now we can actually extend our operators to work with any type of <code>LispNum</code>. Our Scheme operators are defined using the functions <code>numericBinop</code> and <code>numBoolBinop</code>. First we'll slightly modify our definition of <code>primitives</code>:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -333,7 +333,7 @@ Phew, ok with that out of the way now we can actually extend our operators to wo
|
|||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>14<tt>
|
||||
</tt>15<tt>
|
||||
</tt>15 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">primitives :: [(String, [LispVal] -> ThrowsError LispVal)]<tt>
|
||||
</tt>primitives = [("+", numericBinop (+)),<tt>
|
||||
|
|
@ -356,8 +356,8 @@ Phew, ok with that out of the way now we can actually extend our operators to wo
|
|||
Note that <code>mod</code>, <code>quotient</code>, and <code>remainder</code> are only defined for integers and as such use <code>integralBinop</code>, while division (/) is only defined for floating point numbers using <code>floatBinop</code>. <code>subtractOp</code> is different to support unary usage, e.g. <code>(- 4) => -4</code>, but it uses <code>numericBinop</code> internally when more than 1 argument is given. On to the implementation! First extend <code>unpackNum</code> to work with any <code>LispNum</code>, and provide separate <code>unpackInt</code> and <code>unpackFloat</code> functions to handle both kinds of <code>LispNum</code>.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -371,7 +371,7 @@ Note that <code>mod</code>, <code>quotient</code>, and <code>remainder</code> ar
|
|||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>14<tt>
|
||||
</tt>15<tt>
|
||||
</tt>15 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">unpackNum :: LispVal -> ThrowsError LispNum<tt>
|
||||
</tt>unpackNum (Number (Integer n)) = return $ Integer n<tt>
|
||||
|
|
@ -394,8 +394,8 @@ Note that <code>mod</code>, <code>quotient</code>, and <code>remainder</code> ar
|
|||
The initial work of separating integers and floats into the <code>LispNum</code> abstraction, and the code I said would be handy shortly, are going to be really handy here. There's relatively no change in <code>numericBinop</code> except for the type signature. <code>integralBinop</code> and <code>floatBinop</code> are just specific versions of the same function. I'm sure there's a nice Haskelly way of doing this with less repetition, and I welcome such corrections.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -412,7 +412,7 @@ The initial work of separating integers and floats into the <code>LispNum</code>
|
|||
</tt>15<tt>
|
||||
</tt>16<tt>
|
||||
</tt>17<tt>
|
||||
</tt>18<tt>
|
||||
</tt>18 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">numericBinop :: (LispNum -> LispNum -> LispNum) -> [LispVal] -> ThrowsError LispVal<tt>
|
||||
</tt>numericBinop op singleVal@[_] = throwError $ NumArgs 2 singleVal<tt>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
It's been a little while since I wrote about Haskell and the <a href="2007.05.03-a-scheme-parser-in-haskell-part-1">Scheme interpreter</a> I've been using to learn and play with both Haskell and Scheme. I finished the tutorial and got myself a working Scheme interpreter and indeed it has been fun to use it for trying out little things now and then. (Normally I would use Emacs or Dr. Scheme for that sort of thing.) There certainly are <a href="http://www.lshift.net/blog/2007/06/11/folds-and-continuation-passing-style">interesting things</a> to try floating around da intranet. And also things to read and learn from, such as <a href="http://cubiclemuses.com/cm/blog/tags/Misp">misp</a> (via <a href="http://moonbase.rydia.net/mental/blog/programming/misp-is-a-lisp">Moonbase</a>).
|
||||
It's been a little while since I wrote about Haskell and the <a href="/posts/2007/05/a-scheme-parser-in-haskell-part-1">Scheme interpreter</a> I've been using to learn and play with both Haskell and Scheme. I finished the tutorial and got myself a working Scheme interpreter and indeed it has been fun to use it for trying out little things now and then. (Normally I would use Emacs or Dr. Scheme for that sort of thing.) There certainly are <a href="http://www.lshift.net/blog/2007/06/11/folds-and-continuation-passing-style">interesting things</a> to try floating around da intranet. And also things to read and learn from, such as <a href="http://cubiclemuses.com/cm/blog/tags/Misp">misp</a> (via <a href="http://moonbase.rydia.net/mental/blog/programming/misp-is-a-lisp">Moonbase</a>).
|
||||
|
||||
*I'm going to describe two new features of my Scheme in this post. The second one is more interesting and was more fun to implement (cond).*
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ In order to parse binary digits we need to write a few short functions to help u
|
|||
|
||||
<pre><code>-- parse a binary digit, analagous to decDigit, octDigit, hexDigit
|
||||
binDigit :: Parser Char
|
||||
binDigit = oneOf "01"
|
||||
binDigit = oneOf "01"
|
||||
|
||||
-- analogous to isDigit, isOctdigit, isHexDigit
|
||||
isBinDigit :: Char - Bool
|
||||
|
|
@ -54,8 +54,8 @@ The trickiest part of all this was figuring out how to use the various <code>rea
|
|||
It still takes me some time to knit together meaningful Haskell statements. Tonight I spent said time cobbling together an implementation of <a href="http://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_sec_4.1.5">cond</a> as a new special form. Have a look at the code. The explanation follows.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -63,7 +63,7 @@ It still takes me some time to knit together meaningful Haskell statements. Toni
|
|||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>8<tt>
|
||||
</tt>9<tt>
|
||||
</tt>9 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">eval env (List (Atom "cond" : List (Atom "else" : exprs) : [])) =<tt>
|
||||
</tt> liftM last $ mapM (eval env) exprs<tt>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
Emacs is very impressive. I only felt lost and unproductive for minutes and now it seems natural to use and get around in. I've got <a href="2007.06.14-more-scheming-with-haskell">ElSchemo</a> set as the default scheme, and running inferior processes interactively is an absolute dream. My scheme doesn't have readline support (which bothers me to the point where I've thought about adding it just so I can use the thing) but when running it under Emacs there's absoutely no need for anything like that since I have the power of my editor when interacting with any program.
|
||||
Emacs is very impressive. I only felt lost and unproductive for minutes and now it seems natural to use and get around in. I've got <a href="/posts/2007/06/more-scheming-with-haskell">ElSchemo</a> set as the default scheme, and running inferior processes interactively is an absolute dream. My scheme doesn't have readline support (which bothers me to the point where I've thought about adding it just so I can use the thing) but when running it under Emacs there's absoutely no need for anything like that since I have the power of my editor when interacting with any program.
|
||||
|
||||
There has been a considerable amount of work done to aide in Rails development which makes Emacs especially comfortable for me. I now know why people have Emacs windows maximized on their screens. Because of its age Emacs is a handy window manager that basically eliminates the need for anything like <a href="http://en.wikipedia.org/wiki/GNU_Screen">GNU screen</a> or a window manager such as <a href="http://www.nongnu.org/ratpoison/">Rat poison</a> (which is great if you like screen), just maximize that Emacs "frame" or open one for each display and get to it. If you need a shell you just split the window and run your shell, when you're done you can easily switch back to your editing and your shell will wait in the background until you need it again. With rails-mode on I can run script/console (or switch back to it) with <code>C-c C-c s c</code>. My zsh alias for script/console is <code>sc</code> and I have other similarly succint ones for other stuff, so I took right to the shortcuts for all the handy things that I no longer have to switch applications to do:
|
||||
|
||||
|
|
@ -9,4 +9,4 @@ There has been a considerable amount of work done to aide in Rails development w
|
|||
|
||||
The Rails integration is simply stunning and I could go on all day about the mature indentation support, the Speedbar and what not, but I won't. I'm fairly sure that Emacs has taken the place of TextMate as my weapon of choice now, on all platforms. And after only 2 days!
|
||||
|
||||
Anyway, the point of all this was to mention the one thing that's missing: support for <a href="2006.02.22-intelligent-migration-snippets-0.1-for-textmate">intelligent snippets</a> which insert text at more than one point in the document (well, they appear to do so). I don't have any E-Lisp-fu to break out and solve the deficiency but if it ever bugs me enough I might try implementing it for Emacs one day. If they were useful to me outside of writing migrations I might have more incentive to do so, but I guess they aren't useful in normal editing situations (maybe I just haven't recognised the need).
|
||||
Anyway, the point of all this was to mention the one thing that's missing: support for <a href="/posts/2006/02/intelligent-migration-snippets-0_1-for-textmate">intelligent snippets</a> which insert text at more than one point in the document (well, they appear to do so). I don't have any E-Lisp-fu to break out and solve the deficiency but if it ever bugs me enough I might try implementing it for Emacs one day. If they were useful to me outside of writing migrations I might have more incentive to do so, but I guess they aren't useful in normal editing situations (maybe I just haven't recognised the need).
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
I should read the Emacs manual sometime, especially since I have it in dead-tree form. Check out <a href="http://www.gnu.org/software/emacs/manual/html_node/autotype/Inserting-Pairs.html">skeleton pairs</a> in the Emacs manual, or better yet <code>C-h f skeleton-pair-insert-maybe</code>. skeleton-pair has already been massaged to do what you most likely want if you set the correct options. Cool. I like Emacs more every day.
|
||||
|
||||
This renders <a href="2007.06.23-emacs-for-textmate-junkies">wrap-region</a> useless, which is great! I like a trim .emacs and .emacs.d.
|
||||
This renders <a href="/posts/2007/06/emacs-for-textmate-junkies">wrap-region</a> useless, which is great! I like a trim .emacs and .emacs.d.
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ Recently I had looked at converting Typo to Mephisto and it seemed pretty painle
|
|||
|
||||
After running that code snippet to fix my tags, I decided to completely ditch categories in favour of tags. I tagged each new Mephisto article with a tag for each Typo category it had previously belonged to. I fired up <code>RAILS_ENV=production script/console</code> and typed something similar to the following:
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>7 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">require <span class="s"><span class="dl">'</span><span class="k">converters/base</span><span class="dl">'</span></span><tt>
|
||||
</tt>require <span class="s"><span class="dl">'</span><span class="k">converters/typo</span><span class="dl">'</span></span><tt>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ This last week I've been getting to know <a href="http://chneukirchen.org/blog/a
|
|||
I did hit a little snag with functional testing though. The method of declaring which controller to use takes the form:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre><tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">use_controller <span class="sy">:foo</span></pre></td>
|
||||
|
|
@ -13,8 +13,8 @@ I did hit a little snag with functional testing though. The method of declaring
|
|||
and can be placed in the <code>setup</code> method, like so:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -28,7 +28,7 @@ and can be placed in the <code>setup</code> method, like so:
|
|||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>14<tt>
|
||||
</tt>15<tt>
|
||||
</tt>15 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="c"># in test/functional/sessions_controller_test.rb</span><tt>
|
||||
</tt><tt>
|
||||
|
|
@ -51,8 +51,8 @@ and can be placed in the <code>setup</code> method, like so:
|
|||
This is great and the test will work. But let's say that I have another controller that guests can access:
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
|
|
@ -64,7 +64,7 @@ This is great and the test will work. But let's say that I have another controll
|
|||
</tt><strong>10</strong><tt>
|
||||
</tt>11<tt>
|
||||
</tt>12<tt>
|
||||
</tt>13<tt>
|
||||
</tt>13 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }"><span class="c"># in test/functional/foo_controller_test.rb</span><tt>
|
||||
</tt><tt>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ My Linux box is down due to a hardware failure; a cheap SATA controller to be sp
|
|||
This gave me an opportunity to accidentally discover some shortcuts in TextMate. A result of the Emacs shortcuts that my fingers are already wired to, here are some TextMate keyboard shortcuts that may or may not be <a href="http://macromates.com/textmate/manual/">documented</a> (I need to RTFM some day).
|
||||
|
||||
* As in most Cocoa text areas, <code>C-f</code>, <code>C-b</code>, <code>C-n</code>, <code>C-p</code>, <code>C-a</code>, <code>C-e</code>, and <code>C-t</code> work as expected (and others I'm sure).
|
||||
* <code>C-k</code>: behaves as a vanilla Emacs, killing till a newline or killing a bare newline. I use the word killing specifically because you can yank it back with...
|
||||
* <code>C-k</code>: behaves as a vanilla Emacs, killing until a newline or killing a bare newline. I use the word killing specifically because you can yank it back with...
|
||||
* <code>C-y</code>: yanks back the last thing on the kill ring (paste history). You still have to use <code>C-S-v</code> to yank previous items.
|
||||
|
||||
I think TextMate may have helped ease me into Emacs without me even knowing. I had my suspicions that Allan was an Emacs fan and now I'm certain of it. I keep finding things in one that the other has, which makes switching between them easy. Well done Allan.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
*Update #2 [2007.08.10]: Editing cheats and diffs have been implemented.*
|
||||
|
||||
*Update #3 [2007.08.21]: I <a href="2007.08.21-cheat-productively-in-emacs">added completion</a> to cheat.el. The file linked on this page is still the latest version.*
|
||||
*Update #3 [2007.08.21]: I <a href="/posts/2007/08/cheat-productively-in-emacs">added completion</a> to cheat.el. The file linked on this page is still the latest version.*
|
||||
|
||||
We all know and love <a href="http://cheat.errtheblog.com/">cheat</a>. Now you can cheat without leaving Emacs (and without using a shell in Emacs).
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
By now you may have heard about <a href="http://cheat.errtheblog.com/">cheat</a>, the command line cheat sheet collection that's completely open to editing, wiki style. A couple of weeks ago I posted <a href="2007.08.10-cheat-from-emacs">cheat.el</a> which allows one to cheat from within Emacs. There's an update. However, before I get to cheat.el there's a small detour.
|
||||
By now you may have heard about <a href="http://cheat.errtheblog.com/">cheat</a>, the command line cheat sheet collection that's completely open to editing, wiki style. A couple of weeks ago I posted <a href="/posts/2007/08/cheat-from-emacs">cheat.el</a> which allows one to cheat from within Emacs. There's an update. However, before I get to cheat.el there's a small detour.
|
||||
|
||||
Cheat is not just about Ruby! A few examples of cheats available are:
|
||||
|
||||
|
|
@ -18,4 +18,4 @@ So what's new in this version of cheat.el? <strong>Completion!</strong> The on
|
|||
|
||||
Download it now: <a href="/f/cheat.el">cheat.el</a>
|
||||
|
||||
For any newcomers, just drop this into <code>~/.emacs.d</code>, <code>~/.elisp</code>, or any directory in your <code>load-path</code> and then <code>(require 'cheat)</code>. For more info check the <a href="2007.08.09-cheat-from-emacs">original article</a> for a rundown on the cheat commands.
|
||||
For any newcomers, just drop this into <code>~/.emacs.d</code>, <code>~/.elisp</code>, or any directory in your <code>load-path</code> and then <code>(require 'cheat)</code>. For more info check the <a href="/posts/2007/08/cheat-from-emacs">original article</a> for a rundown on the cheat commands.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
I've been developing a Scheme
|
||||
interpreter in Haskell called
|
||||
<a href="2007.06.24-floating-point-in-elschemo">ElSchemo</a>.
|
||||
<a href="/posts/2007/06/floating-point-in-elschemo">ElSchemo</a>.
|
||||
It started from <a href="http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html">Jonathan's excellent Haskell
|
||||
tutorial</a>
|
||||
which I followed in order to learn both Haskell and Scheme. Basically
|
||||
|
|
@ -38,15 +38,15 @@ concise language. My explanations may be redundant because of this.
|
|||
### lispAnd ###
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>8<tt>
|
||||
</tt>8 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">lispAnd :: Env -> [LispVal] -> IOThrowsError LispVal<tt>
|
||||
</tt>lispAnd env [] = return $ Bool True<tt>
|
||||
|
|
@ -79,15 +79,15 @@ just complicates things but it's a viable solution.
|
|||
Predictably this is quite similar to <code>lispAnd</code>.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>8<tt>
|
||||
</tt>8 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">lispOr :: Env -> [LispVal] -> IOThrowsError LispVal<tt>
|
||||
</tt>lispOr env [] = return $ Bool False<tt>
|
||||
|
|
@ -114,9 +114,9 @@ ElSchemo. It maps a list of expressions to their values by evaluating
|
|||
each one in the given environment.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
</tt>2<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">evalExprs :: Env -> [LispVal] -> IOThrowsError [LispVal]<tt>
|
||||
</tt>evalExprs env exprs = mapM (eval env) exprs</pre></td>
|
||||
|
|
@ -128,13 +128,13 @@ each one in the given environment.
|
|||
Again, <code>lispCond</code> has the same type as <code>eval</code>.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>6 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">lispCond :: Env -> [LispVal] -> IOThrowsError LispVal<tt>
|
||||
</tt>lispCond env (List (pred:conseq) : rest) = do<tt>
|
||||
|
|
@ -165,10 +165,10 @@ expressions and return the value of the last one.
|
|||
Now all that's left is to hook up the new functions in <code>eval</code>.
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>3 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">eval env (List (Atom "and" : params)) = lispAnd env params<tt>
|
||||
</tt>eval env (List (Atom "or" : params)) = lispOr env params<tt>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
I think that every now and then we need to be reminded of the frail nature of our human bodies. Yesterday morning as I walked to my kitchen I was turning right by pivoting on my right foot when my 24 years of walking experience suddenly failed me. I clearly did something wrong, as I heard a crunching pop or two in my right ankle and went down. Luckily it's just a sprain but my foot is fairly bruised and still sore today. I'm trying to follow the <a href="http://orthopedics.about.com/cs/sprainsstrains/a/sprain_4.htm">RICE</a> method for recuperating but one can only lay down for so long before having to eat, work, use the bathroom, etc. Thank goodness I don't work on my feet or I'd be out of commission. If it still hurts next week I'm going to see a doctor but till then I'm trying not to leave my house. The idea of hopping and hobbling to a bus to go to a doctor does not thrill me in the slightest.
|
||||
I think that every now and then we need to be reminded of the frail nature of our human bodies. Yesterday morning as I walked to my kitchen I was turning right by pivoting on my right foot when my 24 years of walking experience suddenly failed me. I clearly did something wrong, as I heard a crunching pop or two in my right ankle and went down. Luckily it's just a sprain but my foot is fairly bruised and still sore today. I'm trying to follow the <a href="http://orthopedics.about.com/cs/sprainsstrains/a/sprain_4.htm">RICE</a> method for recuperating but one can only lay down for so long before having to eat, work, use the bathroom, etc. Thank goodness I don't work on my feet or I'd be out of commission. If it still hurts next week I'm going to see a doctor but until then I'm trying not to leave my house. The idea of hopping and hobbling to a bus to go to a doctor does not thrill me in the slightest.
|
||||
|
||||
Oh, if you find yourself in a bind an upside down hockey stick is a decent makeshift crutch. You'll need 2 hands to operate the thing though.
|
||||
|
||||
|
|
|
|||
|
|
@ -11,22 +11,21 @@ Download those 4 .deb files and install them. You can ignore any advise to use
|
|||
|
||||
Now that you know what to do I'll give you what you probably wanted at the beginning. As long as you have wget, subversion, and use a Bourne-like shell this should work for you.
|
||||
|
||||
↓ <a href="/f/gtkpod-aac-fix.sh">gtkpod-aac-fix.sh</a>
|
||||
↓ <a href="/f/gtkpod-aac-fix.sh">gtkpod-aac-fix.sh</a>
|
||||
|
||||
|
||||
<table class="CodeRay"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre>1<tt>
|
||||
</tt>2<tt>
|
||||
</tt>3<tt>
|
||||
</tt>4<tt>
|
||||
</tt>5<tt>
|
||||
</tt>6<tt>
|
||||
</tt>7<tt>
|
||||
</tt>8<tt>
|
||||
</tt>9<tt>
|
||||
</tt><strong>10</strong><tt>
|
||||
</tt>11<tt>
|
||||
</tt>12<tt>
|
||||
<table class="code"><tr>
|
||||
<td class="line_numbers" title="click to toggle" onclick="with (this.firstChild.style) { display = (display == '') ? 'none' : '' }"><pre style="color: #888">1 <tt>
|
||||
</tt>2 <tt>
|
||||
</tt>3 <tt>
|
||||
</tt>4 <tt>
|
||||
</tt>5 <tt>
|
||||
</tt>6 <tt>
|
||||
</tt>7 <tt>
|
||||
</tt>8 <tt>
|
||||
</tt>9 <tt>
|
||||
</tt>10 <tt>
|
||||
</tt>11 <tt>
|
||||
</tt>12 <tt>
|
||||
</tt></pre></td>
|
||||
<td class="code"><pre ondblclick="with (this.style) { overflow = (overflow == 'auto' || overflow == '') ? 'visible' : 'auto' }">mkdir /tmp/gtkpod-fix<tt>
|
||||
</tt>cd /tmp/gtkpod-fix<tt>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
<p>This month I got back into an x86 compiler I started last May. It lives <a
|
||||
href="https://github.com/samsonjs/compiler">on github</a>.</p>
|
||||
This month I got back into an x86 compiler I started last May. It lives
|
||||
[on github](https://github.com/samsonjs/compiler).
|
||||
|
||||
<p>The code is a bit of a mess but it mostly works. It generates Mach object
|
||||
files that are linked with gcc to produce executable binaries.</p>
|
||||
The code is a bit of a mess but it mostly works. It generates Mach object
|
||||
files that are linked with gcc to produce executable binaries.
|
||||
|
||||
<p>The Big Refactoring of January 2010 has come to an end and the tests pass
|
||||
again, even if printing is broken it prints <i>something</i>, and more
|
||||
importantly compiles test/test_huge.code into something that works.</p>
|
||||
The Big Refactoring of January 2010 has come to an end and the tests pass
|
||||
again, even if printing is broken it prints *something*, and more
|
||||
importantly compiles test/test_huge.code into something that works.
|
||||
|
||||
<p>After print is fixed I can clean up the code before implementing anything
|
||||
After print is fixed I can clean up the code before implementing anything
|
||||
new. I wasn't sure if I'd get back into this or not and am pretty excited
|
||||
about it. I'm learning a lot from this project.</p>
|
||||
about it. I'm learning a lot from this project.
|
||||
|
||||
<p>If you are following the Mach-O posts you might want to look at
|
||||
If you are following the Mach-O posts you might want to look at
|
||||
asm/machofile.rb, a library for creating Mach-O files. Using it is quite
|
||||
straightforward, an example is in asm/binary.rb, in the #output method.</p>
|
||||
straightforward, an example is in asm/binary.rb, in the #output method.
|
||||
|
||||
<p>Definitely time for bed now!</p>
|
||||
Definitely time for bed now!
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<p><i>This post is part of a series on generating basic x86 Mach-O files
|
||||
with Ruby. The
|
||||
<a href="2010.01.17-working-with-c-style-structs-in-ruby">
|
||||
<a href="/posts/2010/01/working-with-c-style-structs-in-ruby">
|
||||
first post</a> introduced CStruct, a Ruby class used to serialize
|
||||
simple struct-like objects.</i></p>
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ diagram showing the layout of such a file:</p>
|
|||
Header | Mach header |
|
||||
| Segment 1 |
|
||||
| Section 1 (__text) | --,
|
||||
|---------------------------| |
|
||||
|---------------------------| |
|
||||
Data | blob | <-'
|
||||
'---------------------------'
|
||||
'---------------------------'
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ Mach header fire up a shell and type <tt>otool -h /bin/zsh</tt> (on a
|
|||
Mac).</p>
|
||||
|
||||
<p>Using
|
||||
<a href="2010.01.17-working-with-c-style-structs-in-ruby">
|
||||
<a href="/posts/2010/01/working-with-c-style-structs-in-ruby">
|
||||
CStruct</a> we define the Mach header like so:</p>
|
||||
|
||||
<script src="http://gist.github.com/280635.js"></script>
|
||||
|
|
@ -155,4 +155,4 @@ segment (nsects=1), and then a section named __text with a segment
|
|||
name of __TEXT, and some x86 machine code as the section data, you
|
||||
would almost have a useful Mach object file.)</i></p>
|
||||
|
||||
<p>Till next time, happy hacking!</p>
|
||||
<p>Until next time, happy hacking!</p>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,21 @@
|
|||
<p>This is the beginning of a series on generating Mach-O object files in
|
||||
This is the beginning of a series on generating Mach-O object files in
|
||||
Ruby. We start small by introducing some Ruby tools that are useful when
|
||||
working with binary data. Subsequent articles will cover a subset of the
|
||||
Mach-O file format, then generating Mach object files suitable for linking
|
||||
with ld or gcc to produce working executables. A basic knowledge of Ruby and C
|
||||
are assumed. You can likely wing it on the Ruby side of things if you know any
|
||||
similar languages.</p>
|
||||
similar languages.
|
||||
|
||||
<p>First we need to read and write structured binary files with Ruby. <a
|
||||
href="http://ruby-doc.org/core/classes/Array.html#M002222">Array#pack</a> and
|
||||
<a
|
||||
href="http://ruby-doc.org/core/classes/String.html#M000760">String#unpack</a>
|
||||
First we need to read and write structured binary files with Ruby.
|
||||
[Array#pack](http://ruby-doc.org/core/classes/Array.html#M002222) and
|
||||
[String#unpack](http://ruby-doc.org/core/classes/String.html#M000760)
|
||||
get the job done at a low level, but every time I use them I have to look up
|
||||
the documentation. It would also be nice to encapsulate serializing and
|
||||
deserializing into classes describing the various binary data structures. The
|
||||
built-in <a href="http://ruby-doc.org/core/classes/Struct.html">Struct
|
||||
class</a> sounds promising but did not meet my needs, nor was it easily
|
||||
extended to meet them.</p>
|
||||
built-in [Struct class](http://ruby-doc.org/core/classes/Struct.html) sounds
|
||||
promising but did not meet my needs, nor was it easily extended to meet them.
|
||||
|
||||
<p>Meet <a
|
||||
href="http://github.com/samsonjs/compiler/blob/master/asm/cstruct.rb#files">CStruct</a>,
|
||||
Meet [CStruct](https://github.com/samsonjs/compiler/blob/20c758ae85daa5cfa0ad9276c6633b78e982f8b4/asm/cstruct.rb#files),
|
||||
a class that you can use to describe a binary structure, somewhat similar to
|
||||
how you would do it in C. Subclassing CStruct results in a class whose
|
||||
instances can be serialized, and unserialized, with little effort. You can
|
||||
|
|
@ -26,42 +23,40 @@ subclass descendants of CStruct to extend them with additional members.
|
|||
CStruct does not implement much more than is necessary for the compiler. For
|
||||
example there is no support for floating point. If you want to use this for
|
||||
more general purpose tasks be warned that it may require some work. Anything
|
||||
supported by Array#pack is fairly easy to add though.</p>
|
||||
supported by Array#pack is fairly easy to add though.
|
||||
|
||||
<p>First a quick example and then we'll get into the CStruct class itself. In
|
||||
C you may write the following to have one struct "inherit" from another:</p>
|
||||
First a quick example and then we'll get into the CStruct class itself. In
|
||||
C you may write the following to have one struct "inherit" from another:
|
||||
|
||||
<p><script src="http://gist.github.com/279790.js"></script></p>
|
||||
<script src="http://gist.github.com/279790.js"></script>
|
||||
|
||||
<p>With CStruct in Ruby that translates to:</p>
|
||||
With CStruct in Ruby that translates to:
|
||||
|
||||
<p><script src="http://gist.github.com/279794.js"></script></p>
|
||||
<script src="http://gist.github.com/279794.js"></script>
|
||||
|
||||
<p>CStructs act like Ruby's built-in Struct to a certain extent. They are
|
||||
CStructs act like Ruby's built-in Struct to a certain extent. They are
|
||||
instantiated the same way, by passing values to #new in the same order they
|
||||
are defined in the class. You can find out the size (in bytes) of a CStruct
|
||||
instance using the #bytesize method, or of any member using #sizeof(name).</p>
|
||||
instance using the #bytesize method, or of any member using #sizeof(name).
|
||||
|
||||
<p>The most important method (for us) is #serialize, which returns a binary
|
||||
string representing the contents of the CStruct.</p>
|
||||
The most important method (for us) is #serialize, which returns a binary
|
||||
string representing the contents of the CStruct.
|
||||
|
||||
<p>(I know that CStruct.new_from_bin should be called CStruct.unserialize, you
|
||||
can see where my focus was when I wrote it.)</p>
|
||||
(I know that CStruct.new_from_bin should be called CStruct.unserialize, you
|
||||
can see where my focus was when I wrote it.)
|
||||
|
||||
<p>CStruct#serialize automatically creates a "pack pattern", which is an array
|
||||
CStruct#serialize automatically creates a "pack pattern", which is an array
|
||||
of strings used to pack each member in turn. The pack pattern is mapped to the
|
||||
result of calling Array#pack on each corresponding member, and then the
|
||||
resulting strings are joined together. Serializing strings complicates matters
|
||||
so we cannot build up a pack pattern string and then serialize it in one go,
|
||||
but conceptually it's quite similar.</p>
|
||||
but conceptually it's quite similar.
|
||||
|
||||
<p>Unserializing is the same process in reverse, and was mainly added for
|
||||
completeness and testing purposes.</p>
|
||||
Unserializing is the same process in reverse, and was mainly added for
|
||||
completeness and testing purposes.
|
||||
|
||||
<p>That's about all you need to know to use CStruct. The code needs some work
|
||||
That's about all you need to know to use CStruct. The code needs some work
|
||||
but I decided to just go with what I have already so I can get on with the
|
||||
more interesting and fun tasks.</p>
|
||||
more interesting and fun tasks.
|
||||
|
||||
<p><i>Next in this series: <a
|
||||
href="2010.01.18-basics-of-the-mach-o-file-format">Basics
|
||||
of the Mach-O file format</a></i><p>
|
||||
*Next in this series: [Basics of the Mach-O file format](/posts/2010/01/basics-of-the-mach-o-file-format)*
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ chalk-sprites.png </div>
|
|||
|
||||
<p>The draw function is called for each point in the points array at 30ms intervals. A line is started by calling <code>context.beginPath()</code>, each point is drawn, and then the line is ended with <code>context.stroke()</code>. <strike>The 2nd condition of the while loop ensures that we don't draw for too long, as bad things would happen if the function were executed a 2nd time while it was already running.</strike></p>
|
||||
|
||||
<p><b>Sam Stephenson was kind enough to clarify these points. <a href="#Blog1_cmt-1187434093983456531">See his comment below</a> the post for clarification on using [x, y] in the touchend handler and the 10ms limit when drawing points.</b></p>
|
||||
<p><b>Sam Stephenson was kind enough to clarify these points. <a href="#comment-2">See his comment below</a> the post for clarification on using [x, y] in the touchend handler and the 10ms limit when drawing points.</b></p>
|
||||
|
||||
<p> </p>
|
||||
<h3>Light Switch & Shade</h3>
|
||||
|
|
@ -176,7 +176,7 @@ chalk-sprites.png </div>
|
|||
|
||||
<p>The share window is opened after a 10ms delay, just enough time for any drawing to be completed before rendering the image. The image is created by assigning the result of canvas' <code>toDataURL()</code> method to the output image element's src attribute.</p>
|
||||
|
||||
<p>When the share window is closed the output image element gets its src set to the sprites image. <strike>I'm not sure why that was done.</strike> <i>As Sam mentions in <a href="#Blog1_cmt-118743409398345653">his comment below</a>, this is done to reclaim the memory used by the rendered image.</i></p>
|
||||
<p>When the share window is closed the output image element gets its src set to the sprites image. <strike>I'm not sure why that was done.</strike> <i>As Sam mentions in <a href="#comment-2">his comment below</a>, this is done to reclaim the memory used by the rendered image.</i></p>
|
||||
|
||||
<p>The rest of the code there just sets up event handlers and toggles CSS classes.</p>
|
||||
|
||||
|
|
@ -215,3 +215,86 @@ function _addLineNumbersToGist(css_selector) {
|
|||
|
||||
addLineNumbersToAllGists();
|
||||
</script>
|
||||
|
||||
----
|
||||
|
||||
#### Comments
|
||||
|
||||
<div id="comment-1" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://www.blogger.com/profile/03323308464846759827">Bijan</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 08:15:22 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>Fuckin' beautiful code.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-2" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://sstephenson.us/">Sam Stephenson</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 09:00:47 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>Excellent analysis. A couple of clarifications:</p>
|
||||
|
||||
<p>[x, y] is used in the touchend handler because the event.touches array is empty at that point. We push the coordinates on twice to ensure that a dot is drawn if you tap the screen without moving.</p>
|
||||
|
||||
<p>The 10ms constraint inside the drawing loop restricts the amount of time spent drawing in order to maximize the time available to receive touch events. setInterval callbacks would never run concurrently if the loop were unbounded, but it could prevent us from receiving touch events.</p>
|
||||
|
||||
<p>The output image's src is reset when the share window is closed to reclaim memory used by the image.</p>
|
||||
|
||||
<p>Here's the full CoffeeScript source: https://gist.github.com/664351</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-3" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://joel.meador.myopenid.com/">Meador</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 09:39:29 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>Awesome post!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-4" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://www.blogger.com/profile/16010963576677778438">Mike</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 10:19:30 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>That was a sweet post!</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-5" class="comment">
|
||||
<div class="name">
|
||||
anonymous
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 11:33:07 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>Why is the variable "_ref" named with an underline and "touch" is not with an underline ... found in the "canvas.bind" function (line 23)?</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-6" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://samhuri.net">sjs</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 11:35:27 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>The code was written in <a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> and then compiled down to JavaScript. _ref is a CoffeeScript thing.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="comment-7" class="comment">
|
||||
<div class="name">
|
||||
<a href="http://greenido.wordpress.com/">greenido</a>
|
||||
</div>
|
||||
<span class="date" title="2010-11-05 12:53:15 -0700">Nov 05, 2010</span>
|
||||
<div class="body">
|
||||
<p>Very cool code!
|
||||
Good job guys...</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<p align="center"><a href="/f/zelda-tones.zip">Get the Zelda tones</a></p>
|
||||
|
||||
<ul>
|
||||
<ul class="audio">
|
||||
<li><audio controls><source src="/f/zelda-tones/Zelda Theme.mp3" type="audio/mpeg"></audio> Theme</li>
|
||||
<li><audio controls><source src="/f/zelda-tones/Zelda Overture.mp3" type="audio/mpeg"></audio> Overworld overture</li>
|
||||
<li><audio controls><source src="/f/zelda-tones/Zelda Song of Storms.mp3" type="audio/mpeg"></audio> Song of Storms</li>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<p>The second pack is two Pacman tones.</p>
|
||||
<p align="center"><a href="/f/pacman-tones.zip">Get the Pacman tones</a></p>
|
||||
|
||||
<ul>
|
||||
<ul class="audio">
|
||||
<li><audio controls><source src="/f/pacman-tones/Pacman.mp3" type="audio/mpeg"></audio> Pacman starts</li>
|
||||
<li><audio controls><source src="/f/pacman-tones/Pacman Dies.mp3" type="audio/mpeg"></audio> Pacman dies</li>
|
||||
</ul>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
performed by the <a href="http://www.lpo.co.uk">London Philharmonic Orchestra</a>.
|
||||
</p>
|
||||
|
||||
<ul><li><audio controls><source src="/f/Carmina Burana - O Fortuna.mp3" type="audio/mpeg"></audio> O Fortuna</li></ul>
|
||||
<ul class="audio"><li><audio controls><source src="/f/Carmina Burana - O Fortuna.mp3" type="audio/mpeg"></audio> O Fortuna</li></ul>
|
||||
|
||||
<p align="center"><a href="/f/Carmina Burana - O Fortuna.m4r">Get the O Fortuna ringtone</a></p>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,26 @@
|
|||
<p><i>
|
||||
This post is the last of a triplet on generating basic x86 Mach-O files
|
||||
with Ruby. The
|
||||
<a href="2010.01.17-working-with-c-style-structs-in-ruby">
|
||||
first post</a> introduced CStruct, a Ruby class used to serialize
|
||||
simple struct-like objects, while the
|
||||
second describes
|
||||
<a href="2010.01.18-basics-of-the-mach-o-file-format">the
|
||||
structure of a simple Mach-O file</a>.
|
||||
</i></p>
|
||||
|
||||
*This post is the last of a triplet on generating basic x86 Mach-O files
|
||||
with Ruby. The first post](/posts/2010/01/working-with-c-style-structs-in-ruby) introduced CStruct,
|
||||
a Ruby class used to serialize simple struct-like objects, while the second describes
|
||||
[the structure of a simple Mach-O file](/posts/2010/01/basics-of-the-mach-o-file-format).*
|
||||
|
||||
<h2>Symbol Tables</h2>
|
||||
|
||||
<p></p>
|
||||
TODO
|
||||
|
||||
|
||||
<h3>N-List structures</h3>
|
||||
|
||||
<p></p>
|
||||
TODO
|
||||
|
||||
|
||||
<h3>Load Command</h3>
|
||||
|
||||
<p></p>
|
||||
TODO
|
||||
|
||||
|
||||
<h2>Relocation Tables</h2>
|
||||
|
||||
<p></p>
|
||||
TODO
|
||||
|
||||
|
||||
<h2>Putting it all together</h2>
|
||||
|
|
@ -35,4 +28,3 @@
|
|||
As promised I'll show you how to create a very basic Mach-O binary
|
||||
that you can execute on a machine running OS X (well, any x86 machine
|
||||
running Darwin but at least 99% of the time that is OS X).
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
"/js/store.js",
|
||||
"/js/projects.js"
|
||||
],
|
||||
"index": {
|
||||
"title": "Projects"
|
||||
},
|
||||
"strftime": {
|
||||
"title": "strftime",
|
||||
"description": "strftime for JavaScript"
|
||||
|
|
|
|||
Loading…
Reference in a new issue