Archive for October, 2006

Oct 31 2006

Disassemble MacBook Pro (Core 2 duo)

Published by under Mac

ifixit.com has a First look at disassembly of the new MacBook Pro’s.

No responses yet

Oct 30 2006

UTF-8, 16, 32

Published by under General,Mac,web

In a mailing list post today, I saw the following succinct explanation of the various UTF’s encodings and how they relate to unicode.

All UTF’s are able to encode “EXACTLY” the same set of characters. That’s the whole point of Unicode. The UTF’s specify the nit-picky details about how to actually represent Unicode text in bytes, but the Unicode text itself is a stream of characters, and it is not affected by the encoding method used.

UTF-8 is an 8-bit encoding only in the sense that it’s defined in terms of bytes. That doesn’t mean that each character takes up only one byte. Depending on the character, it may take up one, two, three, or four bytes.

Example UTF-8 representations:
U+0041 LATIN CAPITAL LETTER A (‘A’) one byte, value 0x41.
U+00E7 LATIN SMALL LETTER C WITH CEDILLA (‘ç’): two bytes, values 0xC3 0xA7
U+0905 DEVANAGARI LETTER A (‘¿’): three bytes, values 0xE0 0xA4 0x85
U+10000 LINEAR B SYLLABLE A (‘¿’): four bytes, values 0xF0 0x90 0x80 0x80

UTF-16 is defined in terms of 16-bit ‘short words’ (two bytes). That doesn’t mean that each character takes up only one word, however. Depending on the character it may take up one or two words: UTF-16 by itself just defines that sequence of 16-bit values; it has nothing to say about how they’re physically stored as bytes.

UTF-8 is useful for several reasons, not least of which is that it’s backwards compatible with ASCII: a 7-bit ASCII text file is, without any modifications whatsoever, a perfectly legal UTF-8 text file. UTF-8 is also reasonably compact for Latin-based scripts. It starts losing the size battle to UTF-16 for the scripts of the Subcontinent and the far East, which is why there are things like SCSU (http://www.unicode.org/reports/tr6/) that let you shift the position of the subset of characters that’s representable with single-byte values.

No responses yet

Oct 28 2006

Vim again…..

Published by under Mac,vim

It has been just over two weeks since I started using Vim; actually Gvim a more graphical interface aware version with the same core capabilities. There is a lot to like but the mode switching and my inability to get used to it is driving me crazy. I continually type normal mode commands into the text and have to erase them. Not efficient. Then there is the issue of inconsistency with browser and OS X conventions. Different key mappings slow me down in Vim and when using other programs such as this simple editor.
I’m really torn between continuing to put effort into Vim and going back to BBedit. The brevity and efficiency of keyboard commands is beautiful (when it works) in comparison to a gui select something, select a menu, and click. I think I’ll try both for a while. That’s a cop out (but, I’m in a fog!). What I’m really doing is giving BBedit another try while thinking I’ll still use Gvim for some things. I suspect this is realy the end of Vim for me – except on servers where it will provide basic editing only.

One response so far

Oct 24 2006

Gvim session restore

Published by under General,Mac,vim

The ability to save and then restore a session (files being edit, windows, etc.) in vim appealed to me, but I couldn’t get it to work in Gvim on OS X. The documentation all said to call vim with -S {sessionFileName} to restore the session but in OS X, I haven’t figured out how to do that. A work around is to just start Gvim and then use “:source {sessionFileName}” to load and execute the session file. I’m sure there is some easy way to start an application with parameters in OS X, but I don’t know what it is. One way would be use applescript, I suppose. Or maybe automator, but there has to be something more native to the GUI.

No responses yet

Oct 20 2006

Vim wins….

Published by under General,Mac,vim

I’m still getting my head around Vim as an ‘editor’ for daily use and think that I’m making progress. Overall I’m very impressed, but it does take a major investment to get reasonably competent in its use. It has an exceptionally good and accessible built in help system to find, remember and use the many command options Vim provides. And, the Vim mailing list is exceptionally helpful, full of interesting ideas, and well mannered. Best list that I’ve run into for a long while.

Vim is a text manipulation environment more than just an editor; extremely configurable and programmable; programmable with respect to its functions and with respect to manipulating text. Open as in open source. Expandable as is Unix and it builds on Unix capabilities and convention. So, I plan to continue and stop using BBedit regularly. A lot has been written on Vim so I’ll probably not write much more about it. Unless, I’m really astounded or subsequently decide to drop it.

Next, I plan to work up a decent look and style for this site. I’ll use Vim in that process so I’ll see how effective it is with php, css, and xhtml.

No responses yet

Oct 17 2006

Vim – Second Look

Published by under General,Linux,Mac,vim

Well, I’m continuing with Vim. At least for now and as I get more time invested in understanding how it works, it gets less likely I’ll go back to BBedit. However in my more practical moments, I’m not sure this is a ‘good idea’. Vim comes with its own approach to text and hoard of keyboard based commands. Its heritage is a text terminal though the graphical wrapper (gvim) works well and does support use of the mouse and at least clipboard based interaction with other OS X programs. Apple’s command key is used and a reasonable set of mappings for most common Apple conventions are supplied with the mac version of Vim (compiling your own is said to be easy, but I’ve not tried that).

Modes continue to be an issue. Insert vs command mode is the main concern. This is one area in which Vim’s world view is at odds with the typical “modeless” editor. Text manipulation is pretty much split between insertion, originally just typing, and movement around with the ability to modify, e.g. delete, without switching to insert mode. There are a huge number of predefined key stroke combinations and the ability to remap them to fit your own way of working.

It is very nice to be able to use the same text editor on my linux servers and on my desktop. Get some efficiency there.

It has a simplified regular expression capability, but not Perl compatible which is a hassle for me. Good integration with CLI capabilities provided by OS X and an endless supply of scripts for common writing and coding tasks. I’ve not begun to test how effective Vim’s HTML, CSS, etc. tools are in comparison to BBedits. That could still sink this project.

So for now, I’ll say very capable, fully functioned text processor. Steep learning curve. Be prepared to adapt and learn for a while. But I knew that before I started!

No responses yet

Oct 11 2006

Vim as my editor?

Published by under General,Linux,Mac,vim

Once upon a time, I tried to use emacs and tried to use vi(m) and gave up on both as too exceedingly complex! They both have seemingly infinite keystroke combinations and, worst of all, many modes with scant indication of what mode the program was in! That was several years ago when I was mainly using Linux. Now I mainly use OS X as my ‘desktop’ and Linux on servers. On OS X, there is a nice graphical text editor called BBedit which I’ve been using. Using only a subset of its features without much trouble, and I recently upgraded to the latest version which has significant improvements, text folding for one.

Despite, or maybe because of, the slickness of BBedit, I decided to get the latest version of vim and give it a try. I now have a little more time so I thought if I could learn its concepts, i.e. how vim ‘viewed’ text, it might make more sense and be a good alternative to BBedit. One that is open source and can be tailored to how I work. Well I’ve been at it off and on for 3 days now and confirm that vim has a steep learning curve, and while it can be tailored to my way of working, I first need to understand it. I don’t know if I’ll keep using it long enough to get a pay off but, it is ‘interesting’.

My uses for a text editor are primarily writing and maintaining
personal and technical notes,
perl and shell code,
xml, html, css documents,
Linux config files.

There are a lot of detailed capabilites that I use and will want to find in vim. Features such as:
Maintain indent level of prior line (autoindent).
Shift line indent left or right.
Intelligent insertion of xml/html tags.
Insertion of text segments (glossary).
Some of these are major and some minor and there are a lot I’ve not listed since there use is almost subconscious.

After three days, I’m continuing to use vim and have temporarily(?) put BBedit aside. There are a lot of powerful capabilities in vim but a lot of aggravation at this point. Insert mode being the most common irritation at present, but modes in general. Vim in itself is a different “mode” from the conventions used in OS X’s user interface. We’ll see how it goes.

No responses yet

Oct 04 2006

Bandwidth between two laptops on a wireless router (part 2)

Published by under Network

Following up from my previous post on very slow file transfers between two laptops, I ran some tests in which I changed the router configuration with the following results.

TiBook to iBook – kbps
Router Configuration
mixed ‘b only’
wireless to wireless 400 1600
wired to wireless 20800 5000

The TiBook(11b) to iBook(11g) using a mixed mode router configurations remains in the same range as prior tests, but the switch to “b only” configuration shows a significant improvement. But, the performance is still mediocre: 1.6Mbps vs 6Mbps which should be reached. The TiBooks poor wireless performance is a factor in that reduction. (Note: wireless tests were done at my normal usage distance of about 30 ft). A price paid for the somewhat improved wireless to wireless performance is worse wired to iBook performance.

Lastly, I did some up/download tests to a remote server out on the internet and the relatively low bandwidth of my dsl connection (384up/1.5down) dominates all other factors and performance on the two machines is the same when up or downloading. The greater efficiency of using a common mode on the router is a significant factor but only on potentially high speed internal transfers.

No responses yet

Oct 03 2006

Bandwidth between two laptops on a wireless router

Published by under Mac,Network

I have two OS X based laptops and a linux based server connected to a linksys WRT54GL wireless router which in turn connects them all to the internet. Internet performs is okay and pretty much consistent with the stated speed of the dsl connection to the internet. Connection speed among the local machines is less than expected: laptop to server 200-400 kB/s but only 30-40 kB/s between the laptops. Both of those bandwidths are low, but laptop to laptop is ridiculous! Traceroute says the two laptops are communicating with no intermediate stops.

In an attempt to pin down the bottleneck, I ran various comparisons which are summarized in the following table. All the tests used scp and there were no other machines connected to the router when the tests were run. The iBook is two years old and the TiBook is four years old.

File transfer via scp – avg bandwidth in kbits/sec
to—-> 802.11g 802.11b 100baseT 100baseT 100baseT
from: iBook TiBook iBook TiBook Linux
iBook-802.11g 2240 8800 8800
TiBook-802.11b 200-440 800-3200 2728
100baseT 2672 8800

So where’s the bottleneck?

  1. Looking at the first row, the wireless iBook(802.11g) is capable of maxing out 10baseT on a linux box, but can only push about a fourth of that rate to the wireles TiBook. So it seems neither the router nor iBook are the source of the problem.
  2. In the second row, I’ve put a couple of ranges which reflect varying the distance of TiBook from the wireless base station. Distance (and correspondingly poorer reception) is a factor, but does not account for much of the speed difference. Even when the TiBook is within 10 feet of the base station, it can only reach about 30% of the 100baseT, though it does double the throughput to the iBook. But that is still terribly low. From this second line of data, it seems that the TiBook wireless can only get up to about 2.7Mbits/sec. Well below the theoretical max (11Mb/s) and about 50% of the practical max of around 6Mb/s. The difference between the wireless to wireless and wired to wired speeds must reflect some sort of interference/inefficiency between the three devices; possibly due to mixing g and b on the same router.
  3. And finally, the last line seems to indicate that the TiBooks wireless reception capacity is about the same 2.7Mb/s that it could send to a wired machine. i.e. the max is symetric.

Seemingly, the mixing of b & g is the most likely culprit. Next test will set the router to b only and I’ll see if the wireless to wireless transfer rate improves.

No responses yet

Oct 02 2006

OS X finder’s ftp provides ‘read only’ access.

Published by under Mac

Ridiculous! Finder supports ftp connections(good) but forces all connections to be ‘read only'(dumb). As far as I can tell, Apple doesn’t provide any way to override that built in setting. A third party ftp program must be used to upload. Seems like a dumb configuration choice.

No responses yet

Next »