Thursday Feb 16, 2006

MacOS Wanna Have Virus Too

Gosh, dudes, this is exciting: Open iChat and see whether you caught one! Sophos reports in "First ever virus for Mac OS X discovered" that the "OSX LEAP-A worm spreads via iChat instant messaging software."

And? \*Sigh\* Nope. Nothing in my iChat. I was so looking forward to downloading the worm, double-clicking it, then entering my sudo-password... What? Yes, it seems MacOS is less user-friendly than most people think. ;-)

If you don't know yet how the LEAP worm works, I recommened this extremely enlightening daringfireball article about how you get from smart crash Reports to InputManager hacks -- InputManagers are loaded automatically from the Libraries folder to add new functions to running apps as soon as the user starts them...

Are you thinking what I'm thinking? 8-|

Interestingly, the first (and only!) report of this virus said it came in a tgz-file -- a zipped tar archive that can be set to archive files while keeping the original permissions. Such as... an 'executable' permission on a file with a custom icon that happens to end in .jpg for example...

Preliminary fix?

  • If you have a folder /Library/InputManagers, use ls -la to check what's in there. If it's fishy, delete it. ;-) If you don't have this folder, create it (before another app creates it for you with unpleasant permissions).
    sudo mkdir /Library/InputManagers

  • Write-protect your InputManager folder and (all its contents, if you trust them) for everyone but root.
    sudo chown -R root:wheel /Library/InputManagers/
    sudo chmod -R go-w /Library/InputManagers/

  • Do the same for all /Users/\*/Library/InputManagers/

  • If you want to preven any Smart Crash Reporter from ever installing, create an empty locked root-owned file named "Smart Crash Reporter" in every InputManager folder.

  • General Tip: Do not use a root account for daily work. Don't make users sudoer (they may not " administrate this Mac" in System Preferences > Users) who don't know what this all means. If you yourself are working with a sudoer account... refrain from entering your sudo password into any old dialog that pops up. =-)

Phew. We did it. For now... :( See you again at the next worm!

Tuesday Jan 17, 2006

Remind me to never convert C to Cocoa ever again

I meant the first longer post in the Mac section to be different, but here goes: Aaarrggghh!

Once in my life I go out of my way to learn and implement a real algorithm from scratch -- and then the book's incomplete. I'll tell you another time what kind of demo I'm trying to write (a game), but now it suffices to say I am using Cocoa and it required a very basic scanline algorithm.

Well, I just copied an old version of scanline from the afore-mentioned "Programming 3D games in Macintosh C" book, and changed a couple of lines to make it run in Cocoa. No big deal, it all scales very well to Objective C. The book's author even cleverly relies on a variable xUnit when stepping through the image buffer when coloring pixels. Dispite this clever move, his implementation still only works with 8bit graphics. :-(

In short -- 8-bit-color means the buffer uses 8 bit = 1 byte to store the color information of 1 pixel, boiling down to 2\^8=256 individual colors per pixel. Alternatively, you could also use 24-bit-RGB-color, spoiling you with 16777216 different colors. (Using multiples of 8bit is preferable, since bytes usually can be more quickly accessed.) But in the 24-bit case, you have to make sure to make 3-byte steps in the buffer, otherwise everything you draw will slim down to one third its width and suddenly has a very very ugly coloring scheme... Trust me, I saw it.

Basicly, what happened was, that I relied on the authors's claim to be using xUnit consistently throughout his implementation. He, however, designed it with 8-bit in mind, where xUnit always equals 1. So when I tried to adapt the implementation to 24-bit by (roughly) simply setting xUnit=3, my pretty "6-color rotating cube demo" suddenly looked like a happily dancing multi-color architect's dream drawn by a two-year-old in the dark with mittens on. :-C

I spent half the month (well, the Sundays only...) systematically hunting down silly individual pixels in search for an explanation; only to discover that the original 8-bit implementation
a) in one case suddenly used ++ incrementors instead of +xUnit, and
b) in a second case didn't multiply by xUnit, (because xUnit=1 in his case)...
c) And then I noticed, that he had been using bytes per row instead of pixels per row all along...
Grrrmph. Well, it's obvious now, in 8-bit-mode, bytes and pixels per row are the same thing (1). But in 24bit, there are three times as many bytes as pixel, resulting in interesting patterns if mixed up. \*SIGH\*

Anyway, at least I can claim now in my CV that I'm a specialist in diagnosing typos in scanline-polygonfill by magically looking at crazy lines in an NSWindow... :-)

Wednesday Nov 30, 2005

Profiling Java Apps on Mac OS X

On the 15th of November, Apple released Java 2 SE 5.0 Release 3 (also known as J2SE 1.5.0_05). This was the biggest of the preliminaries mentioned in the FAQ for the release of a Profiler that would run on Mac OS X.

So today we asked the Profiler team (approximately), oh just by the way, how are things and stuff, and what's the estimate on this, you know, Mac support issue...? And we, like, immediately get an email back where they tell us (approximately), oh, yeah, right, the Mac support, well, you know, we needed to wait for Apple's JSE and all, and then we needed to port all thoses binaries and all, so, the next milestone will be released, at the earliest, let's see, ... tomorrow.

Wow. Now that what quick.

Okay, the NetBeans Profiler milestone 11 covers only so-called experimental Mac OS support, and of course it solely runs in the very latest J2SE 1.5.0_05, but I think that's quite okay for porting it in only half a day's time. ;-)

It will be available from December 1st 2005 from the Profiler Homepage. And until then, why not read this nice article about java performance tuning?

Update: What's new in NetBeans Profiler Milestone 11

About

NetBeans IDE, Java SE and ME, 3D Games, Linux, Mac, Cocoa, Prague, Linguistics.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News

No bookmarks in folder

Blogroll