My News: TOP - Autos Intimate goods Chairs Underwear Ladies handbag Bracelets Sportswear Top auto-moto furniture Dating Boots FDA Approved Pharmacy Boats Necklace Yachts Medical tests Suits Medicine news Building materials Top casino Rington ya.by Tunings Sale Auto Chronometer Blog Search the Web Cases Mobiles Cigarettes Cars auto-moto Ear rings Cigarette Green Card Information
uncommonplace
 

    Follow me

     Overactive test
    Filed under: — David @ 9:07 am

    At first I thought that boost read-write mutex problem was affecting the Volley server: there was an error when the server would exit after running the tests. So I converted all the read-write mutexes to regular ones, but the problem persisted. Oh well, I probably needed to make that change anyway.

    It turned out the problem was brought up because of a test I had added to make sure connecting to the server works - it didn’t because of an endian problem. From the beginning (that is, before the whole MacIntel thing) I tried to have the proper endian conversions in place in Volley just in case I managed to get someone interested in porting it to Windows. Well, good thing I did, though I missed a couple of spots. Good thing I added that test, too, since it tested more than I intended it to.

    Anyway, because the test was opening and closing the connection so fast, it raised some thread synchronization issues because one thread started handling the disconnect before another finished handling the connect. Plus, since this was the last test, right about then the main thread would start to shut everything down, which meant closing down all connections. So there were three different threads trying to operate on this one connection all at the same time.

    It may sound strange that the connect and disconnect are handled on different threads, but what happens is there is one thread that handles all new connections, and it responds to a new connection by making a new thread for it. That new thread then handles the disconnect. This overlap is a little hard to avoid because of the asynchronous nature of networking.

    Threading is nice because it helps you encapsulate the different tasks in an program. The problem, as demonstrated, is keeping the threads from running into each other. It’s such an easy mistake to make because you tend to think of the tasks (like opening or closing a connection) as whole units, and then without realizing it you assume that this separation will be inherent in your program as well. But it’s not; you have to explicitly delineate these things.

    In a way that’s one of the things I like about programming. It forces you to constantly question your assumptions.

     The dream of Cocoa in Carbon
    Filed under: — David @ 10:21 am

    In theory, Carbon and Cocoa can be combined in an application at the window level. That is, an application can have both Carbon and Cocoa windows, and as long as you take the proper precautions when calling across frameworks - such as making sure you have your autorelease pools in place - everything will be fine. (I am, by the way, doing this from the perspective of using Cocoa in a Carbon application. Though I haven’t actually tried it, I have every reason to believe that the reverse situation has similar problems.)

    But if you want all these windows to work together like a single coherent application, where the line between Carbon and Cocoa is completely hidden from the user, I have come to the conclusion that as of Mac OS X 10.4.8 this doesn’t really work (unless your Cocoa-in-Carbon windows are application-modal). The fatal flaw: keyboard window switching. That is, the cmd-` hot key that rotates among document windows, and the lesser-known ctrl-F6 for rotating among floating windows.

    If no additional measures are taken, in a mixed application, cmd-` can activate a Cocoa window but doesn’t bring it in front of the Carbon windows. If a Cocoa window is already active, cmd-` will then only rotate among Cocoa windows. I filed this in Apple’s bug reporter as #4561066, which was marked as a duplicate, so they’re at least already aware of the problem.

    I attempted to work around this using Carbon Events, and one point of confusion is that there are two kinds of events involved, and there doesn’t seem to be complete consistency as to which events are sent when. On one hand, there are two application events that say “focus next document window” or “focus next floating window”, with a modifier keys parameter so that if the shift key is pressed then it rotates backwards. On the other hand, there are four command events for the two window types and the two rotation directions. Pressing cmd-` seems to generate the command event, while ctrl-F6 generates the application event. In some cases, the application event in turn generates the command event, which is the opposite of what I expected, even aside from the “in some cases” part.

    In the end, it’s impossible to make keyboard window switching work properly with mixed Carbon and Cocoa windows because:

    • If a Cocoa window is focused, then Cocoa eats the hot key event and handles it itself, and only switches among Cocoa windows.
    • The only way to prevent this is to explicitly capture the hot key event, such as with a menu command shortcut.
    • There’s no way to find out what the hot keys are in order to keep Cocoa from getting them. By default they are cmd-` and ctrl-F6, but they can be changed in the Keyboard preference pane. You can find out which keys are assigned as global hot keys, but not what function they’re assigned to.

    Then there’s the issue of window appearance. In Cocoa, when the keyboard focus is on a floating window, that window has a shaded title bar, other floating windows have a flat title bar, and the active document window has a lighter shaded title bar. This is documented in the Apple Human Interface Guidelines, but Carbon doesn’t do any of it. So if you mix Carbon and Cocoa, and you have floating windows, you’re not going to have consistent behavior in all your windows.

    So, caveat emptor and all that. Some developers might not care so much about details like window switching, but I’m picky like that.

     Now I don’t feel so bad
    Filed under: — David @ 9:34 pm

    So, way back when, I started putting boost’s thread classes into Volley, replacing the ones I had written. As I recall, part of the reason I did so, in addition to wanting to be all standard and cross-platform, was that my implementation of a read-write mutex wasn’t working. Now I’ve found that in the latest boost update (1.33.1, released 12/5/05) excludes their read-write mutex because it also had problems. So on one hand I feel better about not having been able to solve the problem, but on the other hand I’m still left without a solution.

    Fortunately this isn’t a huge deal. A regular mutex can be used instead, but it’s less efficient, because even reading can only be done by one thread at a time. Logically that restriction shouldn’t be necessary, since it doesn’t matter how many threads are reading as long as the data doesn’t change. But when you have a thread that wants to change the data, that’s harder to manage than it sounds.

    I went back to Volley because it’s been too long since I even committed any code, and ACCELA doesn’t need so much attention right now. I also need to transition Volley over to Subversion, and I think I’ll start from scratch instead of importing the CVS repository. This will let me more easily reorganize the files, and it could use some cleanup. I’m going to cut out the OS 9 stuff entirely, and maybe even the Carbon client.

     Dualism’s catch
    Filed under: — David @ 9:25 pm

    I finally looked up the C. S. Lewis quote that I referred to in my previous post, as well as another one from last year. It’s from the book The Case for Christianity, on pages 37-39 in my copy, or part 2 section 2.

    You can do a kind action when you’re not feeling kind and when it gives you no pleasure, simply because kindness is right; but no one ever did a cruel action simply because cruelty is wrong — only because cruelty was pleasant or useful to him. In other words badness can’t succeed even in being bad in the same way in which goodness is good. Goodness is, so to speak, itself: badness is only spoiled goodness. And there must be something good first before it can be spoiled.

    The book is only 56 pages long. It’s basically a logical explanation of, and argument for, Christianity, starting with the most basic concepts of morality. I definitely recommend reading it.

     Evil fire
    Filed under: — David @ 10:20 pm

    One interesting detail in Avatar - The Last Airbender is the choice of the Fire Nation as the one that’s trying to take over the world. Of the four primary elements in that world - water, earth, fire, and air - it is obvious to think of fire as the most aggressive and hostile. But to me the thing that makes it the most “evil”, or the most like evil, is that it is the only one of the four that cannot stand on its own. Fire must have fuel, or else it ceases to exist. It’s more of an event than an actual physical thing: it is what happens when something burns.

    Similarly, as C. S. Lewis said, evil is not really the polar opposite of good (just like fire isn’t the opposite of water, or even ice). It is good, corrupted. Therefore, evil cannot stand on its own: it must have something good to corrupt.

    I wonder if this will actually come up in the show: fire needs air as well as fuel, and our hero the Avatar is an airbender. Maybe they’ll even make a moral out of it.

     ACCELA October 2006 release
    Filed under: — David @ 8:02 pm

    The most sweeping change since the last release is the refactoring of the XWrapper and XRefCountObject templates. The constructors were split into two versions, instead of taking an inDoRetain/inOwner parameter. The new version is cleaner, especially when passing the result of a function to the constructor.

    The new Bindings group of classes provide support for basic Cocoa bindings in Carbon controls: value, text, enabled, minimum, and maximum. Data browser support is a work in progress.

    The AEventParameter family of classes have been reworked slightly to use template specialization to associate event parameters, types, and type codes. It’s just the kind of tedious work that ought to be done by the compiler.

    Many other changes and improvements have been made, including more examples and a few basic unit tests. I have also written up an overview of the major classes.

    Download here.

     Just when you think you’re done
    Filed under: — David @ 9:37 pm

    Releasing software is harder than it looks. I’ve been learning that lesson pretty thoroughly both at work and at home as I prepare the next release of ACCELA.

    The basic feeling is just when you think you’re done, there’s this whole other load of work to go through. For ACCELA the list looks something like this:

    • Make sure all the example projects build and work properly. I’ve made some good improvements in this area lately. Or rather, I’m not as lazy as before. I could use more unit tests, but there are some, especially on the documents & scripting code. That’s where it’s most needed, since there’s real stuff going on there, not just wrappers.
    • Compare the current files to the last release and compile the release notes. I don’t get enough feedback to know if this is actually needed, but I do this step as a matter of principle anyway, just to keep everything neat and tidy.
    • Generate new HeaderDoc files, fixing any errors that come up, and upload them to the web site. Every time I have to remind myself how to update a SourceForge project web site.
    • Create and upload the archive. This means exporting a clean copy from the archive so there are no .svn directories, and then reminding myself how the SourceForge file releases system works.
    • Announce the release. This means posting an article on the SourceForge project page, posting a news item on my blog, and sending a message to Apple’s Carbon Development mailing list.

    And then I finally go back to life as usual. For people outside the software industry, I bet it’s easy to assume that we just write some stuff, call it good, throw it in a box, and ship it. But there’s a lot more going on behind the scenes.

    That kind of thing always reminds me of when I went to Disneyland several years ago and they were running tests on the Rocket Racers ride, which was supposed to replace the PeopleMover. They had the cars running along the tracks with big plastic jugs of water to simulate passengers. The plastic jugs even had grooves for seatbelts, so you could tell this wasn’t just thrown together. And it turned out to be a good thing they ran those tests, because the ride turned out to be a bad idea. The PeopleMover tracks just weren’t designed for fast-moving cars.

    I suppose I could add some crack about other bad ideas that Disney should have abandoned, but I’ll leave it at that.

     Gimme a good old-fashioned DVD movie
    Filed under: — David @ 9:39 pm

    My recent experiences with downloading TV shows from the iTunes Store have reinforced my initial impression on downloading movies: I’m not into it. Some TV shows may be worth it, but not the movies.

    The time it would take to download a movie would largely cancel out the convenience of getting it on the Internet, especially if you have connection issues. I was constantly having to restart downloads when I was getting season 1 of Avatar: The Last Airbender. It’s also not as useful because I’m much more likely to watch half-hour TV episodes on my iPod than a full-length movie. If I’m sitting around with enough spare time to watch a movie, I’m probably at home, so I can watch it on my TV.

    Instead of downloading, I can spend maybe $5 more to get the DVD, giving me full “DVD quality” plus the extra features. Note that the difference for TV shows is usually about $10 compared to a boxed set. Plus I just picked up X-Men 3 for $15, the same price it would have been if it were available on the iTunes Store, so iTunes movies just aren’t competitive with DVDs on price.

    And then if I want a DVD movie on my computer and my iPod, I can use Handbrake to rip it in probably less time than it would take to download. So with current bandwidth and DRM issues, downloadable movies just don’t seem to be worth it right now.

    But that’s just movies. I still plan to buy the second season of Avatar.


    This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

    Powered by WordPress

    Shareware Icons Games
    Topic - News Blogs: Bracelets auto-moto Chairs Blog Search the Web Top auto-moto Boats Autos Cases Intimate goods Necklace Trousers Underwear Top casino Sale Auto Building materials Evening dress Yachts Tunings Medicine news furniture Rington Replica Rolex Mobiles Rolex Replica Boots Ear rings Fashions Green Card Information ya.by Balans Cigarettes Medical tests Sport Betting Cars