Flotsam and Jetsam #98

  • I’ve been whining about my difficulty in writing a book chapter about the Parallel Programming Library.  I’m getting the hang of it, though, and it is as cool as it’s been touted to be.  In fact, I’d venture to say that once you start using it, you’ll never really need to use TThread again.  The PPL is a nice abstraction of threading, with the notion of a TTask/ITask taking over the role of TThread.  You can pretty much parallelize anything you want with ease.  Very much worth the upgrade, if you are still on a pre-XE7 version.  And completely cross-platform – with nary an {$IFDEF} to be found. 
  • As many of you know, I work on my book at my local Burger King on Saturday and Sunday mornings.  As a result, I drink a lot of iced tea.  This is fine – I enjoy a good caffeine buzz – but the down side?  All that iced tea makes me cold, despite the fact that I have a heavy fleece jacket on most of the time.   And the iced tea in the container is warm, so you have to use a lot of ice to get it cold, because no one wants warm iced tea.  I wonder if I could give myself hypothermia.  I mean, I drink a lot of iced tea while I’m writing, and I am definitely lowering my body temperature.
  • Here’s a wish that I have for Delphi:  That the default behavior for many of the VCL components be changed to not include the caption in the initial component.  Does anyone want the TPanel caption to be anything other than blank?  Does anyone want “Memo1” in a TMemo? “Edit1” in an edit?  Maybe there was a time for that, but how tough can it be to change that and save us all the aggravation?  VCL team – make this happen!
  • I get the sense that Delphi folks don’t make use of environmental variables like they should. Am I right?  When I find a new library that I want to use, I put it in a directory called c:\code.  For instance, I have c:\code\duckduckdelphi.  Then, I create an environmental variable called “DUCK” that equals the source directory for DuckDuckDelphi.  Then I add $(DUCK) to my Delphi path.  That way, it keeps the path short and sweet and less awkward than a hard-coded path.  In team environments, this works great too, because then people don’t all have to have exactly the same directory structures.  Do others do this?  How do you guys handle your Delphi paths?
  • dummzeuch

    The GExperts “Rename Components” expert allows you in addition to the name to show additional properties and set a default value for them. So, for TPanel, I let it show Caption and set it to ”. Likewise for TEdit and Text.

  • Regarding paths: I only use relative paths as it makes it possible to compile from different working copies and in different enviroments (i.e. CI/build server) easily. This naturally only works using project specific search paths. Libraries are part of the working copy/repository. For quick testing its ok to include an absolute path locally. But as soon as your team needs that library too, it needs to be checked in along with the updated .dproj to include the new relative path to that library.

  • I used to use the environment variables too, and still do for things that are strictly related to my local development use – such as output directory. For library references, we’ve done as Steffen for the same reasons.

    As for the names in components – Yes I want the names in the designer – but I want them to be a design mode feature which only reflects the component name, and doesn’t set an actual property value… sort of like the “Join the discussion…” text right here in DisqUs 🙂

    I still use TThread for our worker threads, but I intend to test out TTask soon.

  • David Heffernan

    PPL is pretty bug ridden at the moment. Absolutely not fit for production use.

    • Colin Johnsun

      That’s a pretty bold statement. Can you explain why PPL is not fit for production?

      • David Heffernan

        Many bugs have been reported. These alone give cause for concern. But there are likely many more.

        The nature of threading is such that bugs can lie dormant and only be observed on certain hardware. So given the information that many bugs have been found already, the experience that Emba’s quality control is poor, we can only believe that there are more bugs not yet reported.

        Threading libraries need to be demonstrably correct. I would expect to see a large suite of tests. I would expect documentation. Libraries with neither don’t fill me with confidence.

        It has also transpired that Emba have not tested thee library on anything larger than a 12 core machine. That’s very small these days. Our company has an 80 core machine that was bought with the express intent of testing threaded code on hardware that matches our users.

        Be sceptical of threading libraries. Expect the vendor to demonstrate correctness.

  • Mason_Wheeler

    Finding out how much ice water changes your body temperature isn’t too difficult. Your body is over 60% water, and in your blood and the liquids inside your stomach, the percentage is even higher, so let’s pretend that you’re 100% water for simplicity’s sake, at 98.6 degrees. If the ice water you’re drinking has had time to chill, it will be at 32 degrees. Since water has the same specific heat as itself, it will lower your body temperature from 98.6 towards 32 in direct proportion to the ratio between the amount you drank and your body mass.

    If you actually swallowed some of the ice, the math gets a bit more complicated, but even so, the short version is that you don’t have the stomach capacity to give yourself hypothermia by drinking ice water. If you pour it on your skin, that’ll chill you a whole lot more because instead of reaching the point of equilibrium and then staying there, the water, being outside of you, will then proceed to evaporate, which takes a *lot* more energy.

    • Silver Warior

      I strongly disagree with your claim that it is easy to find out how much will drinking of cold water affect your body temperature. Why?
      Our bodies are smart enough to self adjust themselves to the surrounding environment.
      One of these adjustment is how fast does our body lose its temperature by shrinking or expanding the skin capillaries.
      So when you are in cold environment the skin capillaries shrink and thus reduce the rate of temperature loss of our body.
      If you are in warm environment the capillaries expand and thus speed up the process of reducing of the body temperature.
      And if it is really hot our body begins to sweat and thus greatly increase the rate of cooling of our bodies. This is possible by the fact that water (sweat) has much greater temperature conductivity.

      Now you are probably wondering why I’m talking about how outside environment affects body temperature loss while the discussion was about drinking cold liquids (ice tea).
      Well the body doesn’t actually care about the outside environment temperature but only the speed of losing its body temperature so that it can maintain it at optimal levels.
      So if you would start to drink lots of cold beverages the body will slow down its cooling process otherwise drinking of cold beverages could really lead to hypothermia.
      You see this in action when you go and drink a glass of cold water during the summer time and your body stops to sweat for a short time.

      Anyway leading your body to hypothermia by only drinking of cold beverages is practically impossible unless your body has severe problems with maintaining of its temperature.
      You could reduce the temperature of your upper digestion tract quite a but but your body will definitely warm you about that. I guess you have all experienced getting a headache after eating lots of ice cream Right?

      So Nick don’t be worried about drinking of cold ice tea. Your body will warn you long before you will be in danger of a hypothermia.

      • Mason_Wheeler

        Yes, obviously, being warm-blooded, the human body will adapt to such changes over time and act to return the core temperature to 98.6 degrees. But in the immediate term, before such processes have a chance to work, the change in temperature works as I described.

  • Soniya

    I get the sense that Delphi folks don’t make use of environmental variables like they should. Am I right? …..

    oh really good idea pleaz add an expert to gexperts whichs handles this automatically,
    mch thx in advance

    • Robert Love

      GExperts should not handle this, it easy to do with what is built in.

  • What are your thoughts on Delphi’s memory manager and its impact on the performance of PPL code? I’d love to use the PPL more but it would seem there is hardly any speed improvement if you allocate even the smallest of memory in a thread. I hope this will be addresses in XE8 and above

    • David Heffernan

      I see no evidence that Emba even recognise that there is an issue with their MM not being scalable. So I would not hold your breath.

      On the plus side though, the system design makes it easy to plug in a replacement MM of your own choice.