tag:blogger.com,1999:blog-13487825459353291442024-03-14T07:15:27.561+01:00Øyvind TeigTech posts by <a href="http://www.blogger.com/profile/16906423831624285447">aclassifier</a><br>
Also see <a href="http://www.teigfam.net/oyvind/pub/notes/">Designer's note</a> pageaclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.comBlogger40125tag:blogger.com,1999:blog-1348782545935329144.post-37958711394356367472012-04-18T20:44:00.048+02:002012-11-07T22:25:53.860+01:00045 - A nondeterministic note about nondeterminismThis blog note has been moved to <a href="http://www.teigfam.net/oyvind/home/049-nondeterminism/">http://www.teigfam.net/oyvind/home/049-nondeterminism/</a> on 7 Nov 2012.aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-86588101534935571752012-03-21T16:52:00.054+01:002016-09-23T22:20:03.844+02:00044 - Is (x < (x+1)) really always true?<br />
<ul>
<li>Update (16Sept2015): New blog note, similar theme: <a href="http://www.teigfam.net/oyvind/home/technology/109-know-your-timers-type/">Know your timer's type</a></li>
<li>Update (12April2012): one of the compiler vendors mentioned below has admitted to <i>consider</i> to make the compiler generate a #warning for the dead code examples here! So maybe it is possible to change the world, just a little?</li>
</ul>
<br />
<div>
<span class="Apple-style-span" style="-webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); color: red;"><b>One added to a number</b></span><br />
<div>
<br /></div>
<div>
Even if the value <b>one</b> added to any number is always greater than the number itself, this is not so when we work with finite word sizes in a program. The example code below shows some examples that should have a predefined semantics (but they don't seem to):<br />
<table border="0" cellpadding="10" cellspacing="10" style="text-align: left;"><tbody>
<tr><td style="vertical-align: top;"><pre>typedef signed char int8_a;
typedef unsigned char word8_a;
typedef unsigned short word16_a;
#define MAX 300
word16_a cnt;
{
// -------- signed --------
{
int8_a x = 0;
cnt = 0;
//
while (cnt &lt; MAX)
{
if (x &lt; (x+1))
{
cnt = cnt + 1;
}
else
{
cnt = MAX; // <b>BP1</b>
}
x = x + 1;
//
}
}
// -------- unsigned --------
{
word8_a x = 0;
cnt = 0;
//
while (cnt &lt; MAX)
{
if (x &lt; (x+1))
{
cnt = cnt + 1;
}
else
{
cnt = MAX; // <b>BP2</b>
}
x = x + 1;
//
}
}
}</pre>
</td><td style="vertical-align: top;"><pre>// Øyvind Teig
// Trondheim
// Norway
//
//
{
// -------- signed --------
{
int8_a x = 0;
int8_a y = 1;
cnt = 0;
while (cnt &lt; MAX)
{
if (x &lt; y)
{
cnt = cnt + 1;
}
else
{
cnt = MAX; // <b>BP3</b>
}
x = x + 1;
y = y + 1;
}
}
// -------- unsigned --------
{
word8_a x = 0;
word8_a y = 1;
cnt = 0;
while (cnt &lt; MAX)
{
if (x &lt; y)
{
cnt = cnt + 1;
}
else
{
cnt = MAX; // <b>BP4</b>
}
x = x + 1;
y = y + 1;
}
}
}</pre>
</td></tr>
</tbody></table>
I would not program with an expression like on the left side! Also, I never use single letters for variables. But this is <i>research</i>, where this is legal for an hour.<br />
<br />
A signed number would wrap around when "1" is added to it, from most positive 127 to most negative -128 (assuming 8 bit basic word length in these examples). An unsigned would wrap from its most positive 255 to 0. You must define the int.. and word.. types for yourself, and be sure that there is a greater value around it this would stop the loop (like my 300, which is more than 255 anyway). I do this so that I only have one complex ball in the air at a time. Research tries to divide and conquer.<br />
<br />
Since 127 is <b>not</b> less than -128 (top left and right code - it's greater!) and 255 is <b>not</b> less than 0 (bottom left and right code - it's also greater!), my compiler should make the program hit the four breakpoints BP1-BP4 in turn. Right?<br />
<br />
Not my compiler, optimized code or not! The program only hits BP3 and BP4! In the rightmost code, the variable "y" runs before "x" by "1", so all is fine. But in the leftmost code, the variable "x" incremented in the expression as "x+1" causes the compiler to get it wrong!<br />
<br />
I tried to take control of the value "1" that's added by making a variable "one" with value "1" as signed or unsigned, but it did not help. I tried two variables that followed each other and "x &lt; (y+1)", but it did not help. Finally I tried "(((x+1)-x)>0)", but still I never hit the false branches BP1-BP4!<br />
<br />
<span style="color: red;"><b>Compilers</b></span><br />
<br />
I compiled with the IAR compiler for an eight bit machine. We also compiled with gcc on Linux, and it's the same. I ran a test with static analysis tool QA·C from Programming Research with rather strict "personality", and it did not complain. I have not tested with PC-Lint.<br />
<br />
<span style="color: red;"><b>The "excuse"</b></span><br />
<br />
Of course there is an "excuse" for this in the C compiler world. How an expression is internally evaluated is not the programmer's business. He doesn't own the expression. This is so by language design.<br />
<br />
So, if they use 16 bits to evaluate an 8 bit expression (there is nothing like an "8 bit expression", it's "their any-bit expression"), then it would not wrap around from 127 or 255, but get straight into 128 or 256. If there is width enough. But they will sooner or later get another semantics from the same syntax, as widths go from 8 to 16 to 32 to 64 - and wrap around is or is not inevitable!<br />
<br />
(How about type casting inside the expression? In this case I could try to, but I would still have to test to know what happens - hugely unnecessary in 2012, almost 50 years after Fortran. WYSI-not-WYG! And besides, I had already used typed variables into the expression)<br />
<br />
(This remembers me of a situation where I was going to make a single-bit mask by shifting into a word8, 16 or 32. In order to make a macro work, the one'er that I had to use was required to be typecast to a long. So the macro became #define MASK_F(c) (1L &lt;&lt; c), observe the 'L'. The standard seems to state that it is supposed to be like this. The long typecast was required for the 32-bit mask, and did not hurt for the other masks. I wonder why this is intelligent language design)<br />
<br />
Back to the not hitting false issue. There is a serious cognitive problem also here. Any programmer relates to word widths. They are always finite, like a ruler inside our heads, from one ear to the other.<br />
<br />
We should hit all those breakpoints! But the state of the art is that we might probably not get there.<br />
<br />
We would never know, a priori. But this is as precise as it gets: we'd have to think about this expression is a bubble.<br />
<br />
(PS, if you are still with me. My starting sentence "Even if the value <b>one</b> added to any number is always greater than the number itself" is about as precise as I could make it..)<br />
.</div>
</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-54584735606357939402012-03-07T18:00:00.015+01:002016-09-23T22:20:50.563+02:00043 - Scratching my head with their HATS<b><span class="Apple-style-span" style="color: red;">HATS</span></b> stands for <span class="Apple-style-span" style="color: red;">Highly Adaptable and Trustworthy Software using Formal Models</span> and is an Integrated Project supported by the 7th Framework Programme of the EC within the FET (Future and Emerging Technologies) scheme, quoting from [1].<br />
<div>
<br /></div>
<div>
Since I have worked in a company with concurrency in a lifetime [2], and also touched the formal language Promela and verified with Spin [3] - and worked with CSP-based channel based concurrency for half a life [4] - HATS recently caugth my interest.<br />
<br />
[8March2012: This note became unmanagable for me, so I have parked it for the time being. I'll apply for a refill of brains and maybe come back. Sorry]</div>
<div>
<br />
[Lots of words here that I have removed and saved but perhaps may come back to. If you look at some of the references you may get an idea why I thought it difficult to extract concurrency related features. This is very comprehensive stuff!]</div>
<div>
<b><span class="Apple-style-span" style="color: red;"><br /></span></b></div>
<div>
<b><span class="Apple-style-span" style="color: red;">References</span></b></div>
<br />
<div>
[1] - <a href="http://www.hats-project.eu/">http://www.hats-project.eu</a></div>
<br />
[2] - <a href="http://www.teigfam.net/oyvind/pub/pub">http://www.teigfam.net/oyvind/pub/pub</a><br />
<br />
<div>
[2] - <a href="http://en.wikipedia.org/wiki/Promela">http://en.wikipedia.org/wiki/Promela</a></div>
<br />
<div>
[4] - <a href="http://en.wikipedia.org/wiki/Communicating_sequential_processes">http://en.wikipedia.org/wiki/Communicating_sequential_processes</a></div>
<br />
<div>
[5] - <a href="http://en.wikipedia.org/wiki/7th_Framework_Programme">http://en.wikipedia.org/wiki/7th_Framework_Programme</a></div>
<br />
<div>
[6] - <a href="http://www.hats-project.eu/sites/default/files/Deliverable11a_rev2.pdf">http://www.hats-project.eu/sites/default/files/Deliverable11a_rev2.pdf</a> - "HATS Deliverable D1.1A Report on the Core ABS Language and Methodology: Part A"</div>
<div>
<br />
[7] - <a href="http://www.hats-project.eu/sites/default/files/Deliverable25.pdf">http://www.hats-project.eu/sites/default/files/Deliverable25.pdf</a> -" Deliverable D2.5- Verification of Behavioral Properties"</div>
<div>
.</div>
<div>
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-2759658483728858222012-02-27T12:26:00.036+01:002015-09-04T15:45:27.137+02:00041 - Know your timer's typesMoved to <a href="http://www.teigfam.net/oyvind/home/technology/109-know-your-timers-types/">http://www.teigfam.net/oyvind/home/technology/109-know-your-timers-types/</a> on 4Sept2015aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-52559509391856772442012-02-04T22:32:00.048+01:002012-02-27T12:24:48.667+01:00040 - Amateur publishing for real<a href="http://www.teigfam.net/oyvind/blogspot/040/fig3.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"></a><div><b><span class="Apple-style-span" style="color:#FF0000;"><span class="Apple-style-span" style="font-size:x-large;">1.</span> From Apple Pages to iPhoto and your own paper book</span></b></div><div><b><span class="Apple-style-span" style="color:#FF0000;"><span><span></span></span><br /></span></b></div><div>I have now for the second time used Apple Pages and iPhoto to make my own books. Apple calls what I order for an <i>Apple print product</i>. This note will share some of that experience with you. (My books are in Norwegian and may be seen <a href="http://www.teigfam.net/oyvind/bok/index.html">here</a>, soon also the new book).</div><div><br /></div><div>The general problem is that when you get a book in paper (from any manufacturer, I assume - not just Apple), the machines have to cut the paper after printing. In this case the manufacturer needs individual sheets, since the book I ordered is glued. So the spine end needs to be cut. And the book needs to be cut after it has been bound (glued), so that the three other sides get ok. <i>Of course</i> I don't get what I see, there is not really any WYSIWYG book production. Then we amateurs enter, and assume that we should understand book production, after 600 years of professionalism. </div><div><br /></div><div>iPhoto's book assembly tool is heavily based on <i>theme</i> templates, with large portions of neutral parts around the edges. My pictures are automatically placed, or I pick and place them into predefined windows by hand. This may be difficult, since iPhoto (unlike Pages), does not seem to have any <i>scale to fit</i> or <i>scale to fill</i> options. For me this was a problem with the rear cover (more later). </div><div><br /></div><div>But in my case the major problems come with the <i>1 picture</i> possibility, where the whole page is mine! I love the option, but I hate the guessing. </div><div><br /></div><div>With a full picture page iPhoto basically has these options:</div><div><ul><li><i>Fit to frame</i> (tick on or off: I did off) ("Tilpass bilde til rammestørrelse" in Norwegian)</li><li>Moving picture around by hand (I did push to right on right pages and push to left on left pages)</li></ul></div><div>I guess the reason for the few choices is the complexity of cutting, as just outlined. For the front cover <i>I did not do fit to frame</i>, since I want (as much as possible) the top and bottom not to be cut. iPhoto crops the sides this way. When the book arrived I saw that it was not 20 cm wide, but 19.5 cm. If I had ticked fit to frame, I still don't think that they would have cut the height and kept the width. The option, I believe is for iPhoto, not production cuts.</div><div><br /></div><div>Here is my front cover. There is a higher resolution <a href="http://www.teigfam.net/oyvind/blogspot/040/fig1_large.jpg">here</a>. It shows iPhoto '11 9.2.0:</div><a href="http://www.teigfam.net/oyvind/blogspot/040/fig1.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 900px; height: 656px;" src="http://www.teigfam.net/oyvind/blogspot/040/fig1.jpg" border="0" alt="" /></a>I tried to figure out beforehand, but I could not find a figure like the above. Only complaints that there was none. There certainly are iPhoto forums and books, like <i>iPhoto '11: The Missing Manual</i>, there <i>may</i> be pictures like this there. Anyhow, the picture shows where my pixels go!<div><br /></div><div>Observe the 0.5 cm graded ruler, starting at the book spine. The outer picture is the original (outer on all sides), aligned correctly on top of the book. It would have its own ruler, which is not show here, not to confuse.<br /><div><br /></div><div>My last book contains 24 short stories, so it has text and pictures. I start by getting ISBN numbers for free from the Norwegian National Library (Nasjonalbiblioteket, ISBN-kontoret). Since I make paper, pdf an ePub, I get three ISBN numbers.</div><div><br /></div><div>This first chapter discusses the paper production.</div><div><br /></div><div>First I must say that these books are expensive. But for the limited editions I seem to do, I haven't found any better deals.</div><div><br /></div><div>Here's how I go ahead:</div><div><ol><li>I write the book in Pages on a Mac. I use <i>page layout</i> when the goal is paper or pdf. Page size 20 cm width x 15 cm height, since that's one of the formats that iPhoto book has. The picture above shows that the physical book I got back was 19.5 x 15.2 cm.</li><li>I export to pdf, <i>best</i> quality. I get one pdf.</li><li>I open this pdf in GraphicConverter as 400 dpi and export from GC. It will make jpg of all my pages in one batch. (In 2008 I could export directly from Pages to iPhoto, but it only yielded 200 dpi, which was not good enough for the 10 point text. Also, Preview for Lion does export to jpg any dpi you like, but only one page at a time).</li><li>I import all my jpg images of my book pages to iPhoto. It has no idea that this is a book with short stories.</li><li>I build the book and order it. This book uses <i>formal</i> layout and 20x15 cm <i>softcover</i>. But before that I iterate too many times, hence the figure above. The figure really says everything valid for my last order, the way it's described above.</li><li>To iterate I use <i>archive book as pdf</i> from iPhoto (one pdf), and <i>export as jpg</i> (one jpg per page). I study and try and study. Next time I'll reread this blog note!</li></ol><div>There are some things I'd like to be a little different (see some book terminology <a href="http://en.wikipedia.org/wiki/Book#Book_structure">here</a>). </div></div><div><ol><li>There is no title on the spine. I assume the books Apple produces often are too thin, so it's difficult to get the title correctly aligned at that cost.</li><li>The rear cover has a defined format, with one or two predefined windows (one for bitmap and one for text, see next figure). The rest of the structure may be defined by a few choices. I assume it's because letting me do the rear cover myself with include knowledge of how thick the back (book) is. </li></ol>Both points are probably done to make it easier for amateurs. But I would certainly like the possibility to be treated by Apple as a little more (and I believe both points could be automated).</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">1.1 Filling rear cover window</span></b></div><div><br /></div><div>As mentioned I had to experiment a lot to find a correctly sized graphics file to paste into the rear cover window. Again, <i>formal</i> theme, and a <i>layout</i> with a window for graphics and one for text. </div><div><br /></div><div><span class="Apple-style-span" style="color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; "><img src="http://www.teigfam.net/oyvind/blogspot/040/fig2.jpg" border="0" alt="" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 837px; height: 677px; " /></span>There are some problems. The first problem arises from the fact that Apple does some edge fading of the graphics. Probably nice for a picture, but not for an ISBN-13 barcode. The second problem is the limited handling: I can only scale up (not "smaller" from the original) with a slider, and push the picture left or right. In the picture you see that it's not aligned correctly in the middle yet. The third problem is the missing scale to fit or scale to fill. And the fourth is that I don't know how scaling & fitting is done initially. But I still assume that the tool designers at Apple have had their reasons for these design choices: probably to make standard handling as easy as possible.</div><div><br /></div><div>At first I made the graphics like I thought it should, thin and just enough white space. This did not fit, some part of it was lost. To make a long history short (I tried some 5-10 times), have a look at the graphics (top, right): much more right and left white space than I thought. The pixel width x height is 2669 x 2967 or 0.89. It's completely over-bitmapped, but iPhoto scales it down ok. I don't know if any 1:0.89 picture would do, but I assume so.</div><div><br /></div><div>I assume that if I had used other layouts than <i>1 picture</i>, the problems described here would go for scaling into any window on any page, not just the rear cover. But I haven't checked.</div><div><br /></div><div>Reported to <a href="http://www.apple.com/feedback/iphoto.html">http://www.apple.com/feedback/iphoto.html</a> 4Feb2012.</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;"><span class="Apple-style-span" style="font-size:x-large;">2.</span> </span></b><b><span class="Apple-style-span" style="color:#FF0000;">With Apple Pages towards export as ePub</span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div><b><span class="Apple-style-span" style="color:#FF0000;"></span><span><span><span class="Apple-style-span" style="font-weight: normal;">I start with Apple's own descriptive sample file, referenced at <a href="http://support.apple.com/kb/ht4168">http://support.apple.com/kb/ht4168</a> "Creating ePub files with Pages". Download their "ePub Best Practices" Pages document "Apple ePub Best Practices for Pages.pages".</span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;">(Later on you'll see that I'll verify the ePub with the validator provided by the <i>International Digital Publishing Forum</i> <a href="http://validator.idpf.org/">http://validator.idpf.org/</a> to check that I and Apple have done our jobs.)</span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;">Then I take my book, previously in a pages page layout document. </span><span class="Apple-style-span">I export it into a clean text file</span><span class="Apple-style-span" style="font-weight: normal;">. Then I copy and paste from it, onto the Apple example document (as they suggest). Going through the clean text is time consuming, but so is figuring out the different styles that the ePub needs to have, but would clash with what I previously had in the original document.</span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;">Then I delete all contents and set page size to 20 x 15 cm. What page size means in this context, see next chapter.</span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;">Observe that Pages export to ePub will not treat any page break entries! </span><span class="Apple-style-span">Page breaks are not exported to ePub!</span><span class="Apple-style-span" style="font-weight: normal;"> Even if they are available in the menu. Pages would not know that you are going to export as ePub later on! This is an impedance mismatch, if you ask me. Pages has two main modes now: 1.) word processor and a 2.) page layout. It knows partly what your'r doing. Not so with ePub! (And the new "iBooks Author" won't solve it, as it does not export ePub, only pdf and ibooks formats. The latter is an extension to ePub.).</span></span></span></b></div><div><b><span><span><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></span></b></div><div>Have a look at ePub here: <a href="http://en.wikipedia.org/wiki/EPUB">http://en.wikipedia.org/wiki/EPUB</a>. You will see that ePub are text-centric flow based books. And no layout control. Page breaks are layout. There is a good explanation at <a href="https://discussions.apple.com/message/17543346#17543346">https://discussions.apple.com/message/17543346#17543346</a> "Pages to ePub observations and hints" by <i>israfelli</i>. </div><div><br /></div><div>So, Pages treats everyting that goes into the index as start of page. So, I use "Chapter name" style for this. When pictures are included, they are often glued to the chapter in some way.</div><div><span class="Apple-style-span" style="color:#FF0000;"><b><br /></b></span></div><div><span class="Apple-style-span" style="color:#FF0000;"><b><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: normal; "><b><span class="Apple-style-span" style="color:#FF0000;">2.1 Page and object sizes</span></b></span></b></span></div><div><span class="Apple-style-span" style="color:#FF0000;"><b><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-weight: normal; "><b><span class="Apple-style-span" style="color:#FF0000;"><br /></span></b></span></b></span></div><div>Before you add any pictures, make sure to name them with old fashined ASCII only! See chapter 2.3.</div><div><br /></div><div>Even if the ePub won't have any widt or height, and not even any dpi for pixels, Pages uses it. My book is 20 x 15 cm. So, the front page is inserted as a 600 x 450 jpg. I tell pages that it is "text bound" and that it causes break with zero extra size around. Then I set the size of the jpg to 20 cm, and it ends up as 19.99. Some 4 years ago when I did my first book I remember that this was a hurdle to find out. It may not be so stringent now. The front page is shown by iBooks in the overview section. Still I have also included it at the end of the book, so that people may see it there.</div><div><br /></div><div>So, <i>width</i> is used to tell relative measures. To me, 20 cm is full width. 10 cm is half. I also think that a picture of full width is a page break, if there is no other reasaon to break the page.</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">2.2 Shadows</span></b></div><div><br /></div><div>There is no shadows in ePub (is there in 3.0?). In this book the paper version used pictures with shadows. Just copying them across seemed ok, but of course there were no shadows. So, I took the jpg pages sent to iPhoto, cropped them to become wide but not full height and inserted them into the document. Now a pixel is a pixel, shadow or a pimple on the nose.</div><div><br /></div><div>The first error I did was to insert the picture, then the text, then the picture as every other. Since the pictures were full width, they appeared correctly on a page. But then I increase the text size, so that some chapters were more than one page. My half/half system was broken, and it looked stupid with a picture after the previous, on the right side of the previous double page. </div><div><br /></div><div>So, pictures were added as part of the text: on top of it. If I set the attributes as with the front page, Pages aligns it on the top for me.</div><div><br /></div><div>All fine, the shadows went all fine.</div><div><br /></div><div>But when I in iBooks on iPad selected night theme, all was broken, see right part here (I have obfuscated the text, as it has no relevance here):</div><div><br /></div><div><a href="http://www.teigfam.net/oyvind/blogspot/040/fig3.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img src="http://www.teigfam.net/oyvind/blogspot/040/fig3.jpg" border="0" alt="" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 800px; height: 319px; " /></a></div><div>Of course the white background was white. Not very nice.</div><div><br /></div><div>I had to revert to the old pictures as I had inserted them into the original pages document. I inserted them into a beatuful tool called Picturesque by a company called Acqualia, see <a href="http://www.acqualia.com/picturesque/">http://www.acqualia.com/picturesque</a>/. I have used it for years on Tiger, and now I have it for Lion. It exports with transparent background if you want it. Into png (jpg has no transparency). It also knows when shadowing is over, with no more pixels changed. Photshop Elements is not so nice. It's not nice when a soft shadow gets an abrupt stop. So Picturesque expands your picture as much as needed. </div><div><br /></div><div>Then I used Graphic Converter to expand with 20% on each side. (I have mailed Acquila about this, if Picturesque could possibly save "with margins added". And got a positive reply.) GraphicConverter expanded transparent with transparent. Good. I want the picture not to fill the whole page (even if the file would). Then I rescaled to 600 pixel width and inserted into pages. You see the result in the figure above (left side).</div><div><br /></div><div>That being said, shadows are problematic when there is no semantic knowledge. Picturesque would calculate the colours according to the background colour. It's more or <i>less</i> nice when background changes (as it will dramatically, with iBooks night mode). So, ePub should have had shadows etc.</div><div><br /></div><div><div><b><span class="Apple-style-span" style="color:#FF0000;">2.3 File names of pictures and a Pages ('09 4.1) error</span></b></div><div><br /></div><div>Before you add any pictures, make sure to name them with old fashined ASCII only!</div></div><div><br /></div><div>The ePub file is a package of xml files and graphic files etc. When you drag a picture into Pages, it's just moved into the ePub package, with name and all.</div><div><br /></div><div>I believe that the error with Pages that I discovered, comes from Pages trying not to insert a graphics file more than once (a hypothesis). So, it has to keep an internal list of included files. Most of my pictures were taken from my picture library, with files with names and places etc. (I don't use iPhoto for this). In Norwegian, where we have the three letters Æ Ø and Å (æøå). When I verified the final ePub (mentioned earlier), the verifier issued warnings with these file names. I hate warning, I always want clean results. Back to the drawing board.</div><div><br /></div><div>So I inserted the pictures again, after renaming them. To my surprise I saw that Pages kept the old names. The file list must have also stored size and date, or at least some way where Pages would infer that what I inserted was the same file! So, if "same" file, no reason to change its name!</div><div><br /></div><div>Then I tried to remove all the pictures, save pages and edit it again. Still the old names were kept! With æ ø and å. Impressing. <b>I found no way at all to circumvent this!</b></div><div><br /></div><div><b>I had no other solution than to start from scratch! </b></div><div><br /></div><div>However, my backup with the jpg-files was good to have. I used it, and all fine. It did not believe that the jpg and png files were the same.</div><div><ul><li>Reported to <a href="http://www.apple.com/feedback/pages.html">http://www.apple.com/feedback/pages.html</a> on 22Feb2012</li><li>I also informed about this blog note at <a href="https://discussions.apple.com/thread/3755214">https://discussions.apple.com/thread/3755214</a>.</li></ul><div>After these reports I discovered another peculiarity: Pages may well keep the same name on two different files. This is possible by importing 12.jpg and then renaming the numbered list of file names on the outside so that previous 13.jpg now becomes 12.jpg. So, the next picture to import is 12.jpg, but a different picture than the previous 12.jpg. Either OS X handles this for it, or it has a file-indirection itself. Any way, renaming on the fly (in the Inspector window) should have been possible?</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">2.4 Alignment of chapter name <i>below</i> a picture</span></b></div><div><br /></div><div>Chapter heading is, as mentioned, of style "Chapter name" in Pages. </div><div><br /></div><div>I start every new chapter with a picture, as you may see in the picture above. Below the picture is the chapter name. Below or <i>below</i>?</div><div><br /></div><div>I had given up getting this to show up correctly in anything else than iBooks in iOS. Stanza deliberately seemed to start the chapter heading immediately to the right of the picture, if it decided that it was space for it. To make a long story short:</div></div></div><div><br /></div><div><span class="Apple-style-span" style="color:#006600;"><i>Make the chapter name start with a soft enter (Ctrl Enter) and then write the chapter name.</i></span> </div><div><br /></div><div>Of course, this pushes the cursor to the left. The index works fine, it does not see any extra empty line. There is no extra page (as hard enter causes). In both iBooks and Stanza! And Adobe Digital Editions on the Mac (Lion)!</div><div><br /></div><div>Ok, it appears below the picture. But it's left aligned in iBooks (iOS) and Adobe Digital Editions (Mac), and centered in Stanza (iOS). But it looks ten times better!</div><div><br /></div><div><div><span class="Apple-style-span" style="color:#FF0000;"><b>My ePub</b></span></div><div><br /></div><div>You may download the one I have described here from this page (search for "ePub"): <a href="http://www.teigfam.net/oyvind/ogderstodu/index.html">http://www.teigfam.net/oyvind/ogderstodu/</a>. It's free from that page.</div></div><div>.</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-73283974670263822882012-01-30T20:56:00.041+01:002012-02-09T07:57:54.386+01:00039 - Adding real-time processes to on/when programming?This note will try to discuss if it is possible (or reasonable) to add safe real-time processes to systems like the <span class="Apple-style-span" style="color:#FF0000;"><b>nRFGo</b></span> Studio by Nordic Semiconductor [1], or to the Echelon Lon-controller, programmed in <span class="Apple-style-span" style="color:#FF0000;"><b>Neuron C</b></span> [2]?<div><br /></div><div>(After having almost finished this note, it has swollen to show how a channel based system could be written, more generally.)<br /><div><br /></div><div>Neuron C is used in Neuron Chips and Smart Transceivers, where <i>Network variables</i> are fundamental to Neuron C and LONWORKS applications. The nRFgo SDK is a Software Development Kit for Nordic nRF24L Series 2.4GHz RF System-on-Chips (SoCs).</div><div><div><br /></div><div>Both have event-driven (on/when) architecture. Add "safe processes" to already well tuned software and hardware architectures, what do I mean?<br /><div><br /></div><div>Should you follow this note as it develops, please warn me if I say something wrong. To say it shortly, I would know my mantra (<i>write a CSP channel based process scheduler in C</i>) quite well. Many blog notes, publications and invited lectures revolve around that theme. But nRFGo and Neuron C I have never had any experience with. I simply rememeber long ago (about 1995) when some collegues did use the Neuron C. I see it's still alive. And the nRFGo seems to have been written just up the hill from where I live, so I got curious.</div><div><br /></div><div>I don't know if an nRFGo or Neuron C programmer would ever want or need a process term. Since it would be the first I would personally look for, I would even before that have a look at what's already there. I have programmed so much microcontrollers that I would know what an <i>interrupt</i> is there for. An interrupt function, is a sort of "process", since there is microcode (or whatever) to handle how it is able to set other functions aside, and later on return to the interrupted function the morning after. Only, the interrupted code slept without knowing it.</div><div><br /></div><div>And I remember around the year 2000, when I was on a committee called RTJWG [3] (now defunct), how <i>so much</i> of the discussions was about how to connect asynchronous I/O to the Java language. I had programmed the transputer for almost ten years at the time, and it and the <i>occam</i> language didn't even have a separate interrupt term. All was <i>processes</i>. So, I really didn't understand why they were discussing this so much then. I also remember a programmer I worked with back in the early eighties who got that part almost all wrong, and a collegue had to spend a year dismantling and collecting the assembly code back again. The part of the product that had a run time scheduler (a separate board and processor with code also written in assembly) worked from day one (in the asyncronous I/O and process term context). We got it all working according to specs before some Swedish nuclear power stations had to rely on the system.</div><div><br /></div><div>Here comes <b><span class="Apple-style-span" style="color:#FF0000;">on</span></b> or <b><span class="Apple-style-span" style="color:#FF0000;">when</span></b> programming, to deliver a framework to connect interrupts (or all internal events) to non-interrupt code. Or to decouple the two. It might not be a good idea to do an FFT in the interrupt, it may be better to just pass over the data and let some other code do it later on. The sooner the better, probably - but not in the interrupt. The interrupt would have some hard real-time schedule to it, like get it over in 20 us, because there are other interrupts, you know.</div><div><br /></div><div>In nRFGo there already is an <span class="Apple-style-span" style="font-family:'courier new';">on</span> (like <span class="Apple-style-span" style="font-family:'courier new';">on_pipe_updated</span> or <span class="Apple-style-span" style="font-family:'courier new';">on_transaction_finished</span>) and a <i>subscriber</i> term, and there is a <i>dispatcher</i> for handling of events and communication between different modules. I will later try to figure out what a <i>module</i> is, and what a <i>transaction</i> is. The nRFGo uses the Keil compiler, probably wrapped up by some tools that they developed in Qt. I think their Help tells me this. So, they seem to have a C compiler there. Even if their tool also builds code by the set-up config, the user has C available. After ARM bought Keil, the ARM suite was moved over to the Keil IDE. But Nordic lists the Keil C51 C compiler, so the core must be C51 based.</div><div><br /></div><div>In Neuron C there is a <span class="Apple-style-span" style="font-family:'courier new';">when</span>, and events are used in <i>when-clauses</i> to enable the execution of a<i> when-task</i>, using a special syntax. A when statement can contain more than one when clause.</div><div><br /></div><div>I think these two mechanism basically do the same: deliver a framework to connect asynchronous I/O to the rest of the code. </div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">Scheduler and dispatcher</span></b></div><div><br /></div><div>nRFGo contains a <i>dispatcher</i>, and Neuron C a <i>scheduler</i>. The Wikipedia article says that a scheduler typically decides which process is running, while the dispatcher makes it running [4]. This note will not be precise about this, as it is rather difficult to distinguish in a microcontroller. nFRGo and Neuron C will do about the same, with different wording - even if Neuron C's scheduler also have preemption mode.</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">Towards a process model</span></b></div><div><br /></div><div>The modules or tasks mentioned are meant to be independent subscribers to defined services. In a way they are a means to order the asynchronous I/O. </div><div><br /></div><div>However they don't seem to be processes as I would think of them. I will try to explain.</div><div><br /></div><div>They are closely connected to the hardware in the processors. None of the code would be portable. I remember when we wanted to port some embedded code that implemented a software UART from an AVR to and ARM, I wrote an interpreter <i>below</i> the hardcoded use of registers in the AVR. So, on the ARM, the interpreter picked up bytes at named memory locations and wrote back. And the oversampling represented in the UART and its use of timers, input capture and output compare registers etc. was handled with a single timer interrupt on the ARM. We didn't change a line of code on the AVR, and the ARM addition was a layer below. This layer handled two usch UARTS, one more than was available in the AVR.</div><div><br /></div><div>The more some code handles particular hw in the processor, the less it is portable. The sw described in this note connects to that hw alone. Nothing else, as far as I can see.</div><div><br /></div><div>There are no independent processes or tasks that may talk with each other, and have a life of their own. And since these are not defined, there is no communication or synchronization model either.</div><div><br /></div><div>One of the Lon chips "also supply one binary semaphore to support synchronized access to shared resources between the application and the ISR processor". This is interesting, and probably very useful. But it does not add the process model I am looking for.</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#FF0000;">The process model</span></b></div><div><br /></div><div>The process model I would suggest to add is "standard" <a href="http://en.wikipedia.org/wiki/Communicating_sequential_processes">CSP</a> type processes with safe buffered channels. I have used much of my professional life with this model, starting with the occam language. I have also published a lot about this. Blog note <a href="http://oyvteig.blogspot.com/2011/12/034-output-guard-vs-channel-ready.html">034</a> has something about buffered channels. Add<a href="http://www.teigfam.net/oyvind/pub/pub_details.html#NewALT"> this paper</a> (it's also [5]), and you'd have a good starting point. I will not re-refer to these papers. There will also be rationale for this type of programming in those references. </div><div><br /></div><div>It starts to dawn on me how difficult this note could become, or has become. I had not thought that I should include the code to anything like <i>BufChanSched</i> (buffered channel based process scheduler), you must do it yourself. But maybe my writings could be of some inspiration. </div><div><br /></div><div>In my experience this model is useful both for typical data-flow dominated systems (like regulating systems and more process-oriented designs) as well as control dominated systems (like drivers or protocols). And then, most systems I have seen are a mix of both styles.</div><div><br /></div><div><b><span class="Apple-style-span" style="color:#ff0000;">The process model by how to make it</span></b></div><div><br /></div><div>Still, here are some points (which basically says a lot about the process model):</div><div><ol><li>A process is a C function. Start all process names with P_.</li><li>Make a list of pointers to those functions.</li><li>No static variables in the functions.</li><li>No reference to external variables except the channels it uses.</li><li>A channel sends data and is basically blocking. The second on the channel (sender or receiver) continues to run, while the first becomes ready.</li><li>A channel sends signals (with no data) asynchronously (never blocks).</li><li>A buffered channel never blocks, but always returns an ok/full bool. When it's full the scheduler uses a channel ready signal channel to tell that the channel again may be sent to</li><li>A channel input may define three types of timers: ALTTIMER, EGGTIMER and REPTIMER.</li><li>If you need to pass parameters to a function, there is no way to do it in C. Since it's going to be called by its pointer when it's scheduled, adding parameters may be done with some kind of table. But this is most often not needed for a small scheduler in C. Since there is no language support, it's possible to get around it.</li><li>...</li><li>You need a standard scheduler in C, that keeps a list of the entry points to all processes. The entry points are assigned once only.</li><li>A process has initialization code, and a "while (true)" loop.</li><li>It has a "proctor table" described in the reference above, that by a simple, hidden goto gets the process to any rescheduling point. See <a href="http://www.teigfam.net/oyvind/pub/notes/18_A_scheduler_is_not_so_transparent.html">here</a>.</li><li>A process has only one reason to be scheduled.</li><li>A process may send on a channel, but there is no output guard.</li><li>A process may receive on a single channel.</li><li>A process may wait on a list of channels in an ALT. Each component may have a boolean guard to that it's easy to switch this on and off in the process. If false that component is skipped. When one component of the ALT has become activated (is that the word?), then the ALT is torn down, so that all the other entries's "first" state is nulled.</li><li>You could start "individs" of each process, but then you would have to parameterise the channels.</li><li>Each process has a struct of local variables which is allocated on the heap by a malloc in the initialisation part. Call this the "context". This is never freed, so it's easy to know if you have overflowed.</li><li>...</li><li>A simple return from the process code gets you down to the scheduler. Therefore, no blocking calls are allowed from any subroutine level.</li><li>When the scheduler finds no cause to schedule a channel or there is no channel waited for, there is a system fault. You probably have a deadlock.</li><li>To avoid deadlock, use a deadlock free pattern, like knock-come from blog note <a href="http://oyvteig.blogspot.com/2009/03/009-knock-come-deadlock-free-pattern.html">009</a>.</li><li>No external functions may call any function in a process file (except the scheduler).</li><li>The process context is local to a process, and not seen elsewhere. Only parts of it are exposed to the channel (place and sizeof).</li><li>Two processes may call a common function, since this scheduler is not preemptive. But do it seldom, and in no case let that function have any side effects. This means that it cannot alter common state (like registers or static etc.). The exception is all channel handling, ie. all scheduler functions. Of course it has system side effects, but not application side effects.</li><li>Channel size is dynamic, but the sender and receiver must agree. So a common protocol definition header file must be made. A protocol is a collection of structs with tags and data.</li><li>With this system communication and synchronization is the same. If you use buffering, it may become the same.</li><li>Channel names are handled by en enum, values from 0 to n. Channels may have to be initialized. I do it in a separate function, that would init all.</li><li>...</li><li>Coding the ALT is the most complex, because you may need a bitset (any primitive word size or array), used by each ALT to represent the ALT set. An ALT is "built" or "tore down". You need it so that the first that arrives on the channel, only refers to that bitset to tear down, with no knowledge of the other components.</li><li>If you need "fair ALT", then you could bundle the ALT set in an array, and start the ALT with an index which is one more than the one just "taken". The index needs to wrap around in modulo n</li><li>If you need processes to have priority, think twice (priority inversion etc.).</li><li>If you have thought twice, make one ready queue for each priority.</li><li>But maybe you would rather think of channels as the means to supply priority. Should they instead be prioritized? But do think twice on this too.</li><li>If you do need priority, play on team with the interrupt functions. The chip designers would have thought out a scheme for you.</li><li>Use macros to make it code better readable and hide parameters that don't need to be seen. But be aware of limitations, like Neuron C does not support #if or #elif. The synchronization points described in [5] uses labels thas absolutely should be invisible.</li><li>...</li></ol></div><div>These points are well documented in the literature. But a list like the above may still be ok. </div><div><br /></div><div><span class="Apple-style-span" style="color:#FF0000;"><b><span class="Apple-style-span" style="color:#000000;">So what about</span> nRFGo</b></span> and <span class="Apple-style-span" style="color:#FF0000;"><b>Neuron C<span class="Apple-style-span" style="color:#000000;">?</span></b></span></div><div><span class="Apple-style-span" style="color:#FF0000;"><b><br /></b></span></div><div>The challenge is to add a <i>small</i> and <i>safe</i> run-time system with light-weight processes to these already small systems. A hypothetical BufChanSched would probably just add a few kB of code, and around 10 bytes per blocking (zero-buffered) channel. Process overhead is also small in code and RAM. And scheduling and rescheduling is light weight, smaller than interrupt context switching.</div><div><br /></div><div>Maybe it would be nice to have processes available also for the application code in a radio chip like nRF24LE1 or the networking Neuron chip?</div><div><br /></div><div>Perhaps someone could make an open source project for a pluggable channel based scheduler? With it, the (right) process model comes creeping all by itself..</div><div><br /></div><div><i>..provided</i> you also have a glimpse at where it came from: <a href="http://en.wikipedia.org/wiki/Occam_(programming_language)">occam</a> and <a href="http://en.wikipedia.org/wiki/Occam-%CF%80">occam-π</a>. And assure your boss (and/or better half) that it's not going to be a waste of knowledge, as these days you'll even make a <a href="http://golang.org/doc/go_faq.html#csp">sneek peek</a> into some of <a href="http://en.wikipedia.org/wiki/Go_(programming_language)">Go</a>. </div><div><br /></div><div><span class="Apple-style-span" style="color:#FF0000;"><b>References</b></span></div><div><div><br /></div><div>[1] - <a href="http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-SDK">http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-SDK</a>. Is there a public manual like the Neuron C manual? So I have guessed my way.. However, there is a little used public talk forum, see <a href="http://www.nrftalk.net/">http://www.nrftalk.net</a></div><div><br /></div><div>[2] - <a href="http://www.echelon.com/support/documentation/manuals/devtools/default.htm">http://www.echelon.com/support/documentation/manuals/devtools/default.htm</a> (Search for "Neuron C")</div></div><div><br /></div><div>[3] - Real Time Java Working group, J Consortium (Java Consortium) - (<a href="http://en.wikipedia.org/wiki/NIST">NIST</a>), backed by HP, Microsoft, Newmonics. All remains of this seem lost. Of course, the Sun based initiative JSR-1 won (<a href="http://en.wikipedia.org/wiki/Real_time_Java">http://en.wikipedia.org/wiki/Real_time_Java</a>)</div><div><br /></div><div>[4] - <a href="http://en.wikipedia.org/wiki/Scheduling_(computing)">http://en.wikipedia.org/wiki/Scheduling_(computing)</a> dispatcher / scheduler</div><div><br /></div><div>[5] - "New ALT for Application Timers and Synchronisation Point Scheduling" by Vannebo and Teig. See <a href="http://www.teigfam.net/oyvind/pub/pub_details.html#NewALT">http://www.teigfam.net/oyvind/pub/pub_details.html#NewALT</a></div><div>.</div></div></div></div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-69520807341926157582012-01-15T22:59:00.014+01:002013-04-24T14:14:00.301+02:00038 - Concurrent programming paradigms all created equal to IEC 61508 functional safety standard?<div>
<br />
April 2013 moved to <a href="http://www.teigfam.net/oyvind/home/technology/065-iec-61508-and-programming-paradigms/">http://www.teigfam.net/oyvind/home/technology/065-iec-61508-and-programming-paradigms/</a><br />
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-49629284225731207252011-12-27T14:35:00.026+01:002014-01-23T11:04:02.960+01:00036 - WYSIWYG semanticsThis blog note has been moved to <a href="http://www.teigfam.net/oyvind/home/technology/079-wysiwyg-semantics/">http://www.teigfam.net/oyvind/home/technology/079-wysiwyg-semantics/</a> on 17Jan2014aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-4879567732152276762011-12-19T21:07:00.021+01:002017-04-11T13:49:46.632+02:00035 - Channels and rendezvous vs. safety-critical systemsNew 19Dec2011, updated 3Jan2017<br />
<br />
Moved to <a href="http://www.teigfam.net/oyvind/home/technology/035-channels-and-rendezvous-vs-safety-critical-systems">http://www.teigfam.net/oyvind/home/technology/035-channels-and-rendezvous-vs-safety-critical-systems</a> on 11April2017aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com1tag:blogger.com,1999:blog-1348782545935329144.post-54002385177809526972011-12-03T11:41:00.041+01:002012-08-16T22:06:47.176+02:00034 - Output guard vs. "channel ready" channelLast edit: 16. August 2012<br /><blockquote>On the airplane home, the other day, I came upon an idea that I thought would make life easier. When I told a guy at work, he said, "oh, it's already in Linux".<br /><br />I assume that you're somewhat familiar with "channels". In this respect I was raised with the occam language. (You would find Wikipedia-articles for most of the names I'll throw here. So I won't get too deep into some details.)<br /><br />Here, a <b>channel</b> is based on CSP (later), and it is one-directional, non-buffered and blocking. It's even one-to-one. It connects tight processes to each other. It also allows threads to be equally tight. So, the first process that comes to a channel (be it sender or receiver), must be descheduled and not ever run again before the second process arrives on the channel. At that time there's a memcpy of the correct data from the sender's private context, to the receiver's matching field. It is possible to make it type safe. The message is passed across, while both sender and receiver are still. In Ada it's called a rendezvous. In Go it has no name. When the memcpy is done, usually the second on the channel just runs on, while the first is put in the ready-to-be-scheduled queue.<br /><br />There is a mechanism called on ALT or a "select", where a process may wait for a number of (input) channels. A channel may be with data, without data, or timeouts. In my world (opposite to Linux select), there is exactly one cause that may trigger the SELECT. I will use capitalized "SELECT" here to cover any such idiom, to differentiate from the Linux "select". The first cause that triggers the SELECT will be stored and cause a later rescheduling, but any potential causes that "lost", will not be allowed to cause an additional triggering. Only one cause per scheduling of a process. Very different from Linux select.<br /><br />Said differently: the SELECT will put all the channels in the set to "first was here". When the first "second" contender on a channel in the set arrives, all the "first" attributes are removed from the rest of the set. This is a beautiful algorithm, that I think was first implemented in microcode on the first <a href="http://en.wikipedia.org/wiki/Transputer">transputer</a> processer in 1984. Inmos in Bristol, UK, made it, and David May and Tony Hoare (the father of CSP, "Communicating Sequential Processes" process algebra) were the main architects. The transputer basically was a machine designed to run the subset of CSP that was called occam. It's 28 years ago. Ada based its concurrency model on CSP. And 26 years after occam, Google designed the Go programming language, which also has based its concurrency model on CSP, just like the same guys had done at Lucent some 10 years before with their Limbo language. Except, at that time they didn't state the roots of their "chan of protocol". And transputer designer David May now is active with a company called XMOS, and a language called XC, based on the same ideas. So, CSP-based concurrency seems to be increasingly <i>coming</i>.<br /><br />With this scheme communication <i>equals</i> synchronization.<br /><br />In CSP they talk about "choice". It may be deterministic or "external" or nondeterministic or "internal" (often written as [] and |~|).<br /><br />The SELECT is for the teacher who assigns work to his students. He then falls to sleep (or does other things) and is awaked when the first student is finished. The student is then served, and the SELECT is entered again. The new set may include the first student, when some fair scheme is used to avoid him spam the teacher. Or the SELECT may be non-deterministic. Read in the literature, f.ex. the Promela Wiki-article (more below).<br /><br />With this scheme, the teacher may say that one of the students is not allowed to deliver his result before after two hours. So, there may be timers in the SELECT set. This would also make busy polling possible, should this be needed at the application level. But the run-time scheduler NEVER needs busy-polling. Another way to say this is that a process always has a cause when it's scheduled. Just think about Java's notify and notifyall, which may schedule a process for no reason!<br /><br />Also, there may be an INPUT GUARD for each channel (applied to our special student for two hours). This is usually implemented as a conditional to each member of the SELECT set. Think of the SELECT GUARD set as a bit-mask, one bit per element in the set, just like in Linux select.<br /><br />Now I'm getting closer to the theme of this note: <b>Output guard vs. "channel ready" channel. </b><br /><br />Some times it's required to buffer a message on a channel. In occam we used to do this by inserting a single buffer process, or a couple of processes to make one composite process called an "overflow buffer", which made it possible to detect a too eager producer and associated too slow consumer - at this application level. One time I needed a buffer of a hundred buffer positions, and I just started 100 buffers. Easy! The downside was that there would be 101 memory copies, so most often a ring buffer was administered inside the first of the two processes in the composite overflow buffer process.<br /><br />The alternative could be for the eager producer (it has no idea itself how eager it is) to have something called an OUTPUT GUARD available. If you want to see it, have a look at the Promela process meta language (Wikipedia). This way, both inputs and outputs may be collected in the SELECT. So, having just one channel, plus an "else", then the potential receiver, if it is able to receive, will inform through the output guard if it's ok to send. If not, the else will be taken. The SELECT with both input and output looks like the Linux select, but that one doesn't have the synchronized mechanism in the bottom.<div><br /></div><div>There is a code examples in [6] (<a href="http://www.teigfam.net/oyvind/pub/NTNU_2012/foredrag.pdf">here</a>, search for bufchansched).</div><div><br />It's a nice mechanism. I have never had it in my world. It was not implemented on the transputer, since it was a multi-core programming language. And implementing it across a network (links) presumably was not worth it. There was another mechanism to get the same functionality. If you know what mechanism, please comment.<br /><br />An output guard mechanism is good for detecting a <i>broken</i> line. To detected a <i>connected</i> line, there would have to be polling. Busy polling is most often necessary for this (assuming no hw edge interrupt). But the output guard seems not so relevant to handle the fast producer, slow consumer scenario - between internal processes. The same broken / connected scenario also would go for detecting that the other process has stopped, for some reason. Perhaps enough for a new blog note here.<br /><br />So, here's the solution, to avoid the output guard, to avoid busy polling. The solution that also almost exists in Linux.<br /><br />A standard channel has zero buffers. Have a look at Promela and Go. They both support buffered channels. So, why not add them to [1]? What should happen when such a channel is full? The channel send just returns a flag saying that it’s full, and the channel would not block in that situation. Observe that blocking is perfectly ok and does not impact what a system is able to do. With enough "parallel slackness" to get all the I/O going at required speed, having a process block (waiting in a non-busy way, for the second to arrive at the channel). But for a driver, close to the "asynchronous world" it's nice not to block to get rid of incoming messages. And it's nice not to send it into an asynchronous message system that may plainly overflow, crash and restart. We need a better system. We need the driver process to not block in that situation and itself handle overflows.<br /><br />So, in the suggestion, after the return of the buffer full flag, the process knows this and if any incoming message arrives from the external asynchronous world, it may set a hold line, send a hold message or throw away the message - or whatever it decides to. It's up to the process.<br /><br />In this state, the process will SELECT around a timeout channel and this channel that's triggered by the run-time system, that arrives when there is room in the channel. The receiver has picked out one message or all, that semantics is not so important here.<br /><br />When this "channel ready" channel fires, the process can send off the last message, which may also be tagged with an overflow bit, on the channel. And it's guaranteed to succeed (unlike in Linux).<br /><br />I was rather satisfied by inventing this on the plane home. I didn't like that it was already in Linux <b>write</b> and <b>select</b>. I have tried to describe some of the dissimilarities. See [2] for write, <b>EAGAIN</b> or <b>EWOULDBLOCK</b> and [3] for select (or <b>pselect</b>) and <b>fd_set *writefds</b>. It's in the context of writing to a Linux <b>pipe</b>.<br /><br />But please, could anyone help me with describing how my solution is much "thread safer" than Linux? I need more than this:<br /><br />I have more of a <i>language</i>, since I would do as described and reasoned above. Linux calls and Linux processes and threads are not understood by C or C++. Up to <a href="http://oyvteig.blogspot.com/2011/01/022-c1x-and-c0x-concurrency-in-c-and-c.html">C++11</a> at least. And only so much understood by Linux. A C++ library for Linux needed several mutexes and semaphors to implement an ALT/SELECT in the CSP context [4]. So, are write and select usages in Linux really thread safe? I have a scheduler that is driven by the channels, and it's not preemptive. And why do Linux programmers brag that they "program single-threaded"? Is it an indication that the Linux process model is too coarse or difficult or expensive? So that they haven't learned to decompose into processes, when there is state or roles to hide away into a separate process? After object-orientation or OO, it's time for process-orientation as an <b>additional</b> idiom.<br /><br />Should have been fun to set up a comparison table of the CSP type SELECT with channel ready channel and the <i>similar</i> Linux solution. Even if they are both fruits, I fear that one is apple and the other bananas?</div></blockquote><div><b><span class="Apple-style-span" style="color:#FF0000;">A Linux pipe vs. channel trait</span></b><br /><blockquote>Observe that a Linux pipe is byte-wise. You send so many bytes and then so many bytes, and they are concatenated in the pipe. There has to be a common view of how to pick out each message or token.<br /><br />This implies that you could read past a token, since a sender may have to break up a message into several chunks. There is no foldback, you cannot push anything back again. So, the receiver has to keep track of these things.<br /><br />A channel is message based. A full message per chunk. Finito.<br /></blockquote><b><span class="Apple-style-span" style="color:#FF0000;">Common usage of Linux select</span></b><br /><blockquote>A collegue told me that the common usage of a Linux select is to remove active polling for events from remote machines from the application level, in say a http server (router). He said that he always used select to wait for events on already open sockets. One socket per bit in the select bit map.<br /><br />Internally between threads he never had used select.<br /><br />And he rarely used ip addresses internally between processes, so no select there either.<br /></blockquote><b><span class="Apple-style-span" style="color:#FF0000;">"My idea" - again</span></b><br /><blockquote>I found an interesting sentence in [5]. Here is its <i>process-oriented specification</i> of a buffer: If a buffer is empty it must be ready for input. If it contains some messages, then the buffer must be ready to output the next message required. It is also possible that it will accept further input, but it does not have to. (my comment: is this buffer full?) But here is the interesting sentence: "If further events are to be possible (<span class="Apple-style-span" style="color:red;">such as a channel which can report on whether or not the channel is empty</span>), then...". This is "my" channel! I am even more convinced now, that "my" idea was quite good!</blockquote><b><span class="Apple-style-span" style="color:#FF0000;">Epilogue: "The XCHAN paper"</span></b></div><div><blockquote>During June and July 2012 I had the opportunity to channel this blog note into a full blown paper for the CPA-2012 (at University of Abertay Dundee, Scotland 26-29 August 2012). I have published for the WoTUG and CPA series conferences several times before, but this time it was especially exciting. See [8] and here:</blockquote><blockquote><p style="font-family: 'Times New Roman'; font-size: medium; "><strong class="paperTitle">XCHANs: Notes on a New Channel Type</strong><br /><span class="paperAuthors">Øyvind TEIG, <em>Autronica Fire and Security AS, Trondheim, Norway</em></span></p><blockquote class="paperAbstract" style="font-family: 'Times New Roman'; font-size: medium; "><p><strong>Abstract.</strong> This paper proposes a new channel type, XCHAN, for communicating messages between a sender and receiver. Sending on an XCHAN is asynchronous, with the sending process informed as to its success. XCHANs may be buffered, in which case a successful send means the message has got into the buffer. A successful send to an unbuffered XCHAN means the receiving process has the message. In either case, a failed send means the message has been discarded. If sending on an XCHAN fails, a built-in feedback channel (the x-channel, which has conventional channel semantics) will signal to the sender when the channel is ready for input (i.e., the next send will succeed). This x-channel may be used in a select or ALT by the sender side (only input guards are needed), so that the sender may passively wait for this notification whilst servicing other events. When the x-channel signal is taken, the sender should send as soon as possible -- but it is free to send something other than the message originally attempted (e.g. some freshly arrived data). The paper compares the use of XCHAN with the use of output guards in select/ALT statements. XCHAN usage should follow a design pattern, which is also described. Since the XCHAN never blocks, its use contributes towards deadlock- avoidance. The XCHAN offers one solution to the problem of overflow handling associated with a fast producer and slow consumer in message passing systems. The claim is that availability of XCHANs for channel based systems gives the designer and programmer another means to simplify and increase quality.</p></blockquote></blockquote></div><div><span class="Apple-style-span" style="color: rgb(255, 0, 0); "><b>References</b></span></div><blockquote><div>[1] - <a href="http://www.teigfam.net/oyvind/pub/pub_details.html#NewALT">http://www.teigfam.net/oyvind/pub/pub_details.html#NewALT</a><br />"New ALT for Application Timers and Synchronisation Point Scheduling"<br />Øyvind Teig and Per Johan Vannebo<br />Communicating Process Architectures 2009 (CPA-2009)<br />Peter H. Welch et. al. (Eds.)<br />IOS Press, 2009, ISBN 978-1-60750-065-0<br /><br />[2] - <a href="http://linux.die.net/man/2/write">http://linux.die.net/man/2/write</a><br /><br />[3] - <a href="http://linux.die.net/man/2/select">http://linux.die.net/man/2/select</a><br /><br />[4] - Search for "C++CSP2"<br /><br />[5] - Concurrent and real-time systems. The CSP approach. Steve Schneider. Wiley, 2000. Page 210, example about buffers (7.4.1).</div><div><br /></div><div>[6] - Lecture at NTNU, Trondheim in April 2012: <a href="http://www.teigfam.net/oyvind/pub/NTNU_2012/foredrag.pdf">http://www.teigfam.net/oyvind/pub/NTNU_2012/foredrag.pdf</a> - search for "bufchansched", since it's in Norwegian</div><div><br /></div><div>[7] - Communicating Process Architectures 2012 (CPA-2012): <a href="http://www.wotug.org/cpa2012/">http://www.wotug.org/cpa2012/</a>. Full programme: <a href="http://www.wotug.org/cpa2012/programme.shtml">http://www.wotug.org/cpa2012/programme.shtml</a></div><div><br /></div><div>[8] - "XCHANs: Notes on a New Channel Type"</div><div>Øyvind Teig</div><div>Communicating Process Architectures 2012. </div><div>Peter H. Welch et. al.(Eds.). </div><div>ISBN (later)</div><div>Read at <a href="http://www.teigfam.net/oyvind/pub/pub_details.html#XCHAN">http://www.teigfam.net/oyvind/pub/pub_details.html#XCHAN</a></div></blockquote><div>.<br />.</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-60644177552397613332011-09-26T21:21:00.002+02:002011-09-26T21:21:58.256+02:00030 - Burning an mp3 music CD from iTunes<div dir="ltr" style="text-align: left;" trbidi="on">
First written 22.Aug.2011, updated 24.Aug.11. <span class="Apple-style-span" style="color: #999999;">iTunes 10.4, Mac OS Snow Leopard 10.6.8.</span><br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Two entries for some songs, and a repair action</b></span><br />
<br />
First: The normal no-fuzz procedure is described at <a href="http://www.wikihow.com/Burn-iTunes-Music-to-MP3-CD-for-Stereos-and-CD-Players">http://www.wikihow.com/Burn-iTunes-Music-to-MP3-CD-for-Stereos-and-CD-Players</a><br />
<br />
I burnt an mp3 music CD the other day. Since some of the songs were not in mp3 format, I had to manually convert them to mp3 before I burnt the playlist. And I had to export the playlist to a file and then edit it in a text editor to replace all occurances of .m4a with .mp3. Then I had to import the playlist-file again. Only then did iTunes obey my wish to burn only .mp3 files, and not complain that "81 songs", sorry, could not be burnt.<br />
<br />
When I afterwards looked at one of the original CDs in the Music folder, it had two entries for each song: one m4a and one mp3, or one mp3 and another list entry also as mp3! And playing that album, every song was played twice.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/030/fig1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/030/fig1.jpg" /></a></div>
<br />
I then used Finder to track the music folder and move the mp3 files, that really should not be there, after the mp3 CD had been burnt, into another directory outside iTunes. Then I in iTunes scrolled through the list in the album, and it showed an exclamation mark for every song that was gone. Then I in iTunes picked them all out and moved them to the bin. The figure above shows the an album in the Music folder (left) and the almost same album as seen in the playlist.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>mp3 CD in 2011?</b></span><br />
<br />
Everybody else made mp3 CDs ten years ago. But it's only <i>now</i> that we in fact have <i>two</i> units that play them! The car stereo and the Denon CEOL. The second doesn't need mp3 CDs since it streams. And the car radio also has the aux input that takes music from iPad or iPhone's headphone outputs (see blog <a href="http://oyvteig.blogspot.com/2011/07/028-diy-prototype-of-ipad-2-holder-for.html">028</a>). But a few mp3 CDs in the car doesn't hurt, and makes it possible to see the song names in the car's display, and control music playing by steering wheel buttons. And since there's no USB memory stick input that would have obsoleted the mp3 CD, we will have to use standard CD, mp3 CD or aux input.<br />
<br />
I wanted to extract the mp3 CD from our iTunes music collection.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Some more points</b></span><br />
<br />
Some mp3 songs also all of a sudden appeared twice in the iTunes list, pointing to the same mp3 song. One lits entry has to go, so delete it, but do answer "yes" to the question whether you want to keep the file. I didn't realize and did kill a song or two. Some day I'll learn when I try to play it. Then it's going to be good with the synched backup I have!<br />
<br />
If an album comes up with exclamation marks just by itself, it's only the list entry that's been added. Delete the exclamation mark lines only, since the mp3 file in itself is not repeated. Two files can't have the same name in the same directory.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Don't they want me to make mp3 CDs?</b></span><br />
<br />
Probably not! Am I not supposed to make mp3 of purchased music? I think it's only ripped CDs that may be stored as mp3 out of the box, provided I had imported them to mp3.<br />
<br />
I still haven't finished the clean-up! Some 40 albums take time! I really feel stupid.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Advice</b></span><br />
<br />
Don't <i>convert to</i> mp3 if you want to <i>burn</i> an mp3 CD. Take the onces it has for you. Be sad and tell Apple.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">But is there another way?</span></b><br />
<br />
If there is something really wrong with what I did wrong, please comment! Like, if it's so wrong and it would have been easy to get it right, had I hit the right action trail immediately. Right?<br />
<br />
Reported to <a href="http://www.apple.com/feedback/itunesapp.html">http://www.apple.com/feedback/itunesapp.html</a>.<br />
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-90333785843486100472011-09-26T21:17:00.002+02:002011-09-26T21:17:50.883+02:00029 - From ceramic vase to cutlery drainerMoved to <a href="http://oyvteig-2.blogspot.com/2011/09/029-from-ceramic-vase-to-cutlery.html">http://oyvteig-2.blogspot.com/2011/09/029-from-ceramic-vase-to-cutlery.html</a><br />
.aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-34263463849564930652011-08-10T23:02:00.013+02:002011-09-26T21:14:41.627+02:00028 - DIY prototype of an iPad 2 holder for car glove compartmentMoved to <a href="http://oyvteig-2.blogspot.com/2011/09/028-diy-prototype-of-ipad-2-holder-for.html">http://oyvteig-2.blogspot.com/2011/09/028-diy-prototype-of-ipad-2-holder-for.html</a><br />
.aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-3412249331837972262011-07-19T21:40:00.024+02:002013-01-06T18:40:37.075+01:00027 - Experiencing Apple AirPlay<div style="text-align: left;">
<h3>
</h3>
<h3 style="text-align: -webkit-auto;">
<span style="color: red;">This note is updated at my new blog space only, blog note </span><a href="http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/">http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/</a><span style="color: red;">. Welcome there!</span></h3>
Updated 27Sept2012 (after iOS 6 update to AppleTV), chapter "Playing from and to different devices"</div>
<div style="text-align: left;">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Referring to blog <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">019</a> - we ended up with a <i>Denon RCD N7 Network CD Receiver (CEOL)</i>. I gave up on Sonos. I got real AirPlay instead. Now we can listen to music at places and by combinations I hadn't read myself to know. Let me go on from blog 019:<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Denon RCD N7 (CEOL)</span></b><br />
<br />
This was bought at <a href="http://www.hifiklubben.no/butikker/vare-butikker/trondheim.htm">Hi-Fi klubben</a> here in Trondheim in July 2011. Bringing it home, the first non-power cable I connected was the home network's ethernet cable. Joy! The only cables I plugged out from the 20 years old <i>Denon Precision Audio Component / AM-FM Stereo Receiver DRA-335R</i> were analogue. It has been tired some years now, together with the <i>Denon PCM Audio Technology / Compact Disc Player DCD-680</i>. Both were also bought at HiFiKlubben back then, and will now be stacked on the loft. Hard to scrap a friend.<br />
<br />
The Ceol took charge and asked me if I wanted to update its firmware. Yes, I did - and it did the job in some 30 minutes.<br />
<br />
I had bought the thing for its AirPlay capability (there are plenty other nice boxes without), and went to <a href="http://www.denon.eu/airplay/en/">http://www.denon.eu/airplay/en/</a>. First I had to pick out our unit's <i>serial number</i>, <i>MAC address</i> and <i>upgrade ID</i>. Paying with PayPal has always been a pleasure, so I expected the Ceol to be my everything's remote speaker any minute. For 48€ I thought it should. It didn't. Even if I got a receipt that all was fine - and in the background: Apple had got their licence fee. Since I get a salary every month I don't protest if others want some, even if they put it in the bank.<br />
<br />
The Ceol told me I could upgrade with AirPort, ok. I pushed the right menu entries, and it said <span class="Apple-style-span" style="color: red;"><b>Authenticating</b></span> for a minute, an hour, a night. All it accepts then is a power off, so I retried. Nope. A letter to HiFiKlubben and a reply from support adviced me to restart to factory settings. The updated firmware and the 48€ investment should be fine. In the manual it's called "Resetting the microprocessor: unplug the power cord, then hold volume up and down simultaneously and plug in the cable, then release the buttons". However, I used the slightly different procedure in the support email: "Total reset (to factory settings out of the box / virgin mode) 1. Switch Off the unit and unplug mains plug from wall outlet. 2. Press and hold both Volume up and Cursor down buttons on the front panel and plug the mains plug into the wall outlet. 3. Release the two buttons."<br />
<br />
This worked perfectly (as probably would have the manual's recipe?): AirPlay soon was in the box. And everywhere! Running Apple's <b><span class="Apple-style-span" style="color: red;">Remote</span></b> app on the iPad now, the iTunes library comes up as usual, but both the Ceol and the computer come up! I get "surround sound" that I did't know. The tv speakers with nice bass sound (from JackOSX router on the Mac Mini, see blog 019) also appeared. And they are in phase (thanks to some clock synchronization messages in the AirPlay protocol I believe).<br />
<br />
Now <span class="Apple-style-span" style="color: red;"><b>Gary Moore's Ballads & Blues 1982-1994</b></span> plays like music has never been heard in this house. At the moment: bliss.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Experience</b></span><br />
<br />
After a month's use I'd say I'm pretty satisfied with AirPlay. But there are some repeating weak spots:<br />
<ol style="text-align: left;">
<li><i>Sound level at connection</i>.<br />I still haven't figured out why it comes on with an enormous volume some times. So, if the amp is more powerful than the speakers, the AirPlay start-up volume may destroy your speakers! For me, it's ok, though.</li>
<li><i>Sound level up when down or down when up</i><br />The app volume control and the real volume may be out of synch before I have touch the app's volume control. So, when I try to push the volume down (from a shown high volume), it increases (from the unit's low volume) - so that the overall effect is increased volume! Aften that up is up and down is down.</li>
<li><i>Broken connection</i>.<br />Some times one of the AirPlay "speakers" fall out, and I'd have to manually reconnect.</li>
<li><i>Speakers out of phase</i>.<br />One time, while iTunes (version 10.4) converted a bunch of songs to mp3 (and was very busy in one of its "threads"), and it was playing a song simultaneously - the speakers went out of synch. I know this, since it was easy to hear. I would guess 50 ms since it was not <i>that</i> much.</li>
<li><i>"Connecting to AirPlay unit" when envisaged as already connected.</i><br />Every time I find a new melody it seems to disconnect and then needs some extra time to reconnect. I experience this as not necessary.</li>
<li><i>Outdated display</i>.<br />I have seen Denon not display the present melody, when I played iTunes through the Remote app. Didn't iTunes send it, or didn't Denon update? It stayed with the other day's melody through a whole playing session. At the moment I dont't know what updates it.</li>
</ol>
Reported to <a href="http://www.apple.com/feedback/itunesapp.html">http://www.apple.com/feedback/itunesapp.html</a>. I have found no similar feedback link to Denon.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: red;"><b>Playing from and to different devices</b></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://www.teigfam.net/oyvind/blogspot/027/fig1.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" src="http://www.teigfam.net/oyvind/blogspot/027/fig1.jpg" style="cursor: pointer; display: block; height: 668px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; width: 900px;" /></a>We finally (in July 2012) bought an Apple TV unit. This chapter does not discuss the Apple TV per se, but how AirPlay works . The figure above does not show all details, and I have done some shortcuts. Have a look at note <a href="http://oyvteig.blogspot.no/2010/08/019-play-with-network-disk-based-itunes.html">019</a> for more details (but not updated with Apple TV).</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
I am most concerned with when the <span class="Apple-style-span" style="color: red;">sound</span> is synchronized (playing without <span class="Apple-style-span" style="color: red;">relative delays</span> between individual units) in this note. Mirroring the <span class="Apple-style-span" style="color: #000099;">screen</span> is only possible to one screen, I assume. Anyhow, I can listen to sound from many speakers (connected to several amplifiers) but only want to see one screen at a time. The iPad and iPhone (as well as OSX Mountain Lion, which I don't have) can mirror the screen over AirPlay. That is just <b>so</b> nice.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: red;">Is the unwanted delay caused by the HDMI?</span> The screen is a Samsung RE26E0 TV (from 2005-06). The unwanted delays I am describing here may have to do with the internal D/A-conversion delay for the HDMI cable. But then, shouldn't that also have given reckognisable delay for the HDMI from the TV tuner? See discussion thread "AirPlay audio sync issue" <a href="https://discussions.apple.com/thread/2707379?start=0&tstart=0">here</a> (thanks, Anders!). That thread also mentions that AirPlay has a buffer delay of 2 seconds, so there should be no delays between the immediate outputs from any AirPlay unit. If I only had an optical input D/A converter to test the Apple TV's direct output.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: red;">YES! It helped to remove the default value of the programmed delay in the Samsung TV!</span> Here's <a href="http://www.hometheaterforum.com/t/280579/audio-delay-on-samsung-650-lcd-tv">the help</a> that Anders (again) dug out. See post 5 in there as to how to start the service menu. Then the Samsung RE26E0 TV menu was like this (the TV runs as normal with picture and sound): </div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ul>
<li>From post 5: "Turn off the TV then press Info -> Menu -> Mute in sequence then turn the TV back on again. This will get you into the secret Service Menu." (I had to fiddle a little to get it into that mode)</li>
<li>Ok, here's the top of the secret Service Menu:</li>
<li>Select "6. STV8257/STA323W"</li>
<li>I set "HDMI Delay" from "41H" to "00H" (41 Hex is (4*16)+(1*1)=65)</li>
<li>I also set "PC Delay" from "41H" to "00H"</li>
<li>There was no "save config", so it was saved immediately</li>
</ul>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
Then the delay through the HDMI port was zero! AirPlay has always been working!</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: #000099;">CASE 1: Playing sound <i>from</i> Apple TV</span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ol>
<li>Since I don't use the optical sound output from the Apple TV, the TV has to be on to get the sound to any speakers from the Apple TV. This is no problem, we need its screen anyhow.</li>
<li>(Obsoleted: With sound from Apple TV, only the green (left) speakers may get sound. Not the two others!) <br />New with iOS 6 upgrade on AppleTV (late Sept. 2012): Now it is possible to send AirPlay music to the other AirPlay units! It's also possible to adjust the volume with the AppleTV remote control on the AppleTV.</li>
<li>The green speakers are volume adjusted with the TV remote control. Apple TV has no volume control (not true for AirPlay outputs with iOS 6, see last sentence in bullet above.)</li>
<li>Observe the difference between <span class="Apple-style-span" style="color: red;">playing from Apple TV</span> and <span class="Apple-style-span" style="color: red;">playing with Apple TV</span>. More below.</li>
</ol>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: #000099;">CASE 2: Playing sound <i>with</i> Apple TV</span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ol>
<li>As I mentioned in the topmost chapter, playing from the Mac Mini (with iTunes) into the blue speakers (center) and the black Denon speakers (right) are completely synchronous. The Mini runs Lion, not Mountain Lion. The latter can mirror its screen to the Apple TV. Our Mini is too old for that.</li>
<li>If the following happens to you then try to check the HDMI delay, see above, to see if you can get rid of it. (I try to leave traces of the path to a solution in my blogs, and this is a paragraph "on the road":) "However, adding the Apple TV as the third speaker is not useful, since there is a reckognisable delay. It's not at all in synch! Routing the sound to Apple TV in this case does not make sense."</li>
</ol>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<span class="Apple-style-span" style="color: red;"><span class="Apple-style-span" style="color: #000099;">CASE 3: Playing from iPad or iPhone and Mini</span></span></div>
<div dir="ltr" style="text-align: left;" trbidi="on">
<ol>
<li>When selecting AirPlay units from iPad or iPhone, the Mini output (blue, center) does not appear. </li>
<li>This is easy to understand, since Lion is not a first class citizen of AirPlay. </li>
<li>When I run iTunes on the Mini, however, "This computer" appears as a selection - in addition to the other two.</li>
</ol>
</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
.</div>
<div dir="ltr" style="text-align: left;" trbidi="on">
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com1tag:blogger.com,1999:blog-1348782545935329144.post-89866367685949377362011-07-02T10:37:00.020+02:002011-10-24T21:47:47.400+02:00026 - iOS picture sorting and file system do not tango<div dir="ltr" style="text-align: left;" trbidi="on">
(2 July 2011, updated 24 October 2011)<br />
<br />
This note discusses synching pictures on iOS units (iDevices) by letting iTunes use a disk directory for picture synching. It does not initially deal with having iTunes synch using iPhoto, but I plan to also handle that. I use Mac OS X Snow Leopard. I will update this note as time goes. If it's not been updated, it's probably because I haven't seen anything new.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">iOS sorting by modification date only</span></b><br />
<blockquote>
<b><span class="Apple-style-span" style="color: red;">Update 24.Oct.2011 with iOS 5.0:</span></b> <b>Apple seem to have gone back to alphabetical sorting again!</b> However, in view of what I have written below, maybe they now have combined sorting methods, as I have suggested? </blockquote>
Apple has decided that the iPad, iPhone or iPod (all running iOS) pictures and movies shall be sorted according to last modification date and time. It didn't start that way, but has been like that since iOS 4.<br />
<br />
I would perhaps want iOS to let me select sorting method. Letting me choose alphabetical sorting could have been great, provided it worked. Since the alphabet I use is sortable (!?), it's a nice feature that our culture has become accustomed to. However, since camera picture names contain a number, the series would sooner or later wrap around: DSC_9999 would become DSC_0000. So any number would repeat, making alphabetical sorting difficult. And no matter how much <i>time</i> increases, it only seems to wrap at each big bang(?). (Being an embedded programmer I know that having a finite word length, counting the number of system clock tics does indeed overflow to zero. But that's why we're there, to know about these things.)<br />
<br />
Maybe combining some date/time and alphabetical sorting would have been smart? The engineers at Apple of course know that being smart some times is not always that smart. The framework in which to be smart may change, and in the new context it wasn't smart any more.<br />
<br />
So, sorting photos by date/time has come to stay. I'll have to take it in.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Vacation pictures oops.. changed!</span></b><br />
<br />
If I change a file, cropping it, resizing it, change the light or <i>anything, </i>then it would now cause that picture to get today's modification date/time. Synching it with iTunes to an iOS unit would place it down at the bottom in the sorted list.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">So I need to overwrite modification date by creation date</span></b><br />
<br />
I found an AppleScript that does exactly this on the net [1]. I'll call it "TheScript" from now on. Perfect, now the photos are in lane again after the next iTunes synch also. But hey, finding it, downloading it and start to use it is not simple in any context, Apple?<br />
<br />
Say the disk directory where iTunes finds the pictures is on a local disk, and say that TimeMachine is used for <i>backup</i>, then all is fine.<br />
<br />
However, if the picture directory is on a network disk, or if as above without TimeMachine as backup, or if not only backup but also <i>synchronization</i> is used, then I may have a problem.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">My synch program may push my pictures out of lane again!</span></b><br />
<br />
Synching disks and synching iOS units with iTunes are not the same thing. I'll try to be precise below. Later in 2011 Apple iCloud synching will happen without iTunes.<br />
<br />
Skip this chapter if you always plan to run TheScript before you synchronize the disk with another disk, after having modified a file.<br />
<br />
To get disk synchronization to work, modifying a set of files should be "atomic" with respect to disk synching. So, make yourself non-disturbable in that phase. A modified file should not be synched before TheScript!<br />
<br />
I'll try to explain the situation that might arise if you modified a file, got disturbed, and then synched the disks "out of synch".<br />
<br />
I use an old friend called ChronoSync. I have used it for years to synch several machines, using a network disk as the base. Whenever I change a photo, I do it at some local machine and synch the disks and then let iTunes use the synched base at the network disk for its photo synching.<br />
<br />
However, since I have modified a photo and thus made it newer, ChronoSync will (if I run it in this phase) let the newest version survive. Later iTunes iOS synching will place the picture at the bottom.<br />
<br />
I have found no way for the present ChronoSync to work this out. A change could be something like this, to be used after file change and we don't have TheScript:<br />
<blockquote>
Resolve conflict if two files have equal creation date to use the newest modified file but then change modification dates of both to become creation date</blockquote>
Or, how about a special synch session called iOS picture/movie synching?<br />
<br />
I have informed Econ Technologies about this 2July11 (<a href="http://www.econtechnologies.com//pages/support/support_comment.php">http://www.econtechnologies.com//pages/support/support_comment.php</a>). (And they have replied, stay tuned)<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Back to iTunes: re-date alphanumerically sorted files?</span></b><br />
<br />
I have no way to solve this! The name of all my files have started with som number and then a sentence, like "314 pythagoras.jpg" and "271 e.jpg". The operating system understands that the characters '0'-'9' are treated as numbers and sorted accordingly. I have called this alphabetical sorting, even if it does understand fields. So the 271 file is sorted as the first.<br />
<br />
Some times I could learn AppleScript and write a script that solves my problem: keep dates as much as possible, understand modification date and spread the set out over the dates wanted. Sorting by pushing around pictures by hand is perhaps best.. But this is difficult!<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Inserting a picture or a movie into the iOS sorting sequence</span></b><br />
<br />
Some times you need to add a picture into a sequence. Maybe you want a poster in front of each section, or the next country's flag. This is almost easy: 1.) Make a copy of the neighboring file. This has the same creation date. Experiment with the file before or after, it's not obvious how equal date/times are sorted. 2.) Open the new file in an editor. I use Graphic Convertor. 3.) Paste the image you have made prior to this so that it's inserted into the just opened picture, so that all is overwritten. You may have to delete all contents first. 4.) Save the file with the new contents. 5.) Run TheScript to make modification date from creation date.<br />
<br />
This works for picture files.<br />
<br />
Movies like .mov I have not been able to fix yet. Stay tuned.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Refs</span></b><br />
<br />
<b>[1]</b> - <i>MacFileDatesChanger</i> by Daniel A. Shockley, <a href="http://www.danshockley.com/">http://www.danshockley.com</a>. Includes some code from Paul Berkowitz and Nigel Garvey on applescript-users mailing list.<br />
<br />
.</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-79213230527225885432011-06-13T12:32:00.047+02:002012-02-18T16:02:09.288+01:00025 - iPad2 on vacation, ups and downsThis blog lists some random experience with using an iPad2 in Italy in the summer of 2011. The iOS version was 4.3.3. Some if these experiences may be of interest to others..<br />
<br />
<div>
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.1"></a><b><span class="Apple-style-span" style="color: red;">1 - Painting from a picture with a grid </span><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.1"><span class="Apple-style-span" style="color: red;">::</span></a></b></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/025/fig1-2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/025/fig1-2.jpg" /></a></div>
<br />
I did try paining water colour (aquarelle) again on this visit. Sitting at the spot to draw and paint feels most artistic. However, as the light and shadows, and indeed colours change, it's easy to shoot a picture and use it to paint off-spot.<br />
<br />
I took the picture and imported it to the iPad. More about this import scheme later; it does have some peculiar functionality.<br />
<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote>
</blockquote>
<blockquote>
Aside: With the newest version of iOS (5 and on) it's possible to get grid in a picture very easily this way: When you view a picture, there is an <i>edit</i> button. Push it, and then push the <i>crop</i> button. Up comes the picture with a 3x3 grid. Screen clip it and use it to paint after! You get the whole screen, with frames and buttons and all, but it's quite usable! If you like it, skip the rest of this note. (Added Feb. 2012)</blockquote>
<div dir="ltr" style="text-align: left;" trbidi="on">
</div>
<blockquote class="tr_bq">
<a href="http://www.teigfam.net/oyvind/blogspot/025/fig6.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span class="Apple-style-span" style="color: black;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/025/fig6.jpg" /></span></a></blockquote>
<blockquote class="tr_bq">
Apple <i>surely</i> has listened to my feedback below and made this possible..</blockquote>
<span class="Apple-style-span" style="color: #999999;"></span>It's so much easier to draw the picture to paper if we have a grid. A long arm and the thumb on a pencil is difficult with and iPad. With the iPad and its 4/3 ratio screen, a 4x3 grid is enough. I did not succeed making this in the iPad while the paint was wet, so I taped dental floss on the iPad! It worked, but was not very practical when touch was again needed.<br />
<br />
When the paint had dried and I had better time, I found a way to <b>overlay a grid</b> onto a picture, on the iPad - while on vacation:<br />
<br />
1. In Apple <b>Pages</b>, make a 4x3 table, with size 16 x 12 cm or as close as you can get. Save it. Turn the iPad to landscape and make the table as big as possible.<br />
<br />
2. Take s screen shot (Home and On/Off buttons simultaneously). It is saved in Camera Roll.<br />
<br />
3. Open <b>ArtStudio</b>. Load this screen cut from Camera Roll. Crop it. Rescale it to 2048x1536 since this is the internal format that ArtStudio "likes" best. Don't keep aspect ratio, as the table you made in Pages may not be accurately 4/3. Now smart-select (use magic wand) one square (512x512) and clear the contents. This makes it transparent. Do this 12 times. Now you have a 4x3 transparent grid. Save it to the Camera Roll.<br />
<br />
4. In <b>ArtStudio</b>, load the picture you want to paint. Make a new layer, and insert the just saved picture in that layer. Save it. Congratulations, you don't need the dental floss any more for this stuff!<br />
<br />
I have informed Lucky Clan (<a href="http://www.iphoneclan.com/artstudio/?page=support">http://www.iphoneclan.com/artstudio/</a>) about this - as having a built-in function would have been <i>much</i> nicer. I have also informed Apple (<a href="http://www.apple.com/feedback/iphone.html">http://www.apple.com/feedback/iphone.html</a>), as a magical "display picture with grid" would have been great! Or maybe there already is an app for this? I have not found any way for Pages to put pictures as table background.<br />
<br />
By the way, the picture is from San Gimignano. Also, I did not want to transform the picture inside ArtStudio to make a computer water colour. Would have been nice, but not this time.<br />
<br />
<div>
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.2"></a><b><span class="Apple-style-span" style="color: red;">2 - Deleting imported pictures from iPad but wanting to keep them in the camera </span><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.2"><span class="Apple-style-span" style="color: red;">::</span></a></b></div>
<br />
This problem is as simple to describe as the iOS solution is too simple.<br />
<ol style="text-align: left;">
<li>The first night we imported the first day's new pictures from the camera. Some were good, some were deleted. We had created <i><span class="Apple-style-span" style="color: blue;">one first day photo event</span></i>. ("hendelse" in Norwegian.) Good!</li>
<li>The next day we imported the second day's pictures from the camera. We were asked if we wanted to import the duplicates. Good. We answered no. We had <i><span class="Apple-style-span" style="color: blue;">one second day event</span></i>. Good!</li>
<li>But the pictures we deleted day one were put into <span class="Apple-style-span" style="color: blue;"><i>a second first day event</i></span>. This is not what we wanted!</li>
<li>The third day I understood the problem: <b>it's not possible to delete on the iPad alone!</b> If a picture is deleted from the iPad, it must also be deleted from the camera. However, since that picture had indeed been taken, and today's cameras have enough memory to keep everything for a week or four, having a backup of iPad's deleted pictures in the camera would have been nice.</li>
</ol>
There could be several ways to implement this. I have some ideas, but I trust Apple to solve this.<br />
<br />
Only observe, there could be (like) two cameras to import from. An additional problem is then if there should be(like) two first day events or one joined?<br />
<br />
Reported to <a href="http://www.apple.com/feedback/ipad.html">http://www.apple.com/feedback/ipad.html</a>.<br />
<br />
<div>
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.3"></a><b><span class="Apple-style-span" style="color: red;">3 - Using the iPad Navigon app for navigation in the car </span><span class="Apple-style-span" style="color: red;"><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.3">::</a></span></b><br />
<br />
<b><span class="Apple-style-span" style="font-weight: normal;">I have informed a Navigon support mail address about this blog.</span></b><br />
<b><br /></b></div>
<b><span class="Apple-style-span" style="color: blue;">Roundabout</span></b><br />
<span class="Apple-style-span" style="color: red;"><b><br /></b></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/025/fig3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/025/fig3.jpg" /></a></div>
<span class="Apple-style-span" style="color: red;"><b><br /></b></span><br />
We were using Navigon 1.8.2.<br />
<br />
This picture shows a typical problem we discovered. We're not certain who's wrong here, but we got it wrong. Here's the route:<br />
<ul style="text-align: left;">
<li>Via Pisana, 5**** Poggibonsi → Via San Gimignano, 53036 Poggibonsi</li>
<li>navigonITA://route/?target=address//ITA/5****/POGGIBONSI/VIA%20PISANA//11.13664/43.47654&<br />target=address//ITA/53036/POGGIBONSI/VIA%20SAN%20GIMIGNANO//11.12998/43.47651</li>
</ul>
I have isolated the problem to around this roundabout. The routing is fine, but starting from the green flag the voice tells us to:<br />
<ol style="text-align: left;">
<li>First take the second road in the roundabout</li>
<li>Then take the third road in the roundabout</li>
</ol>
We did 1. as told and went up the yellow road. It discovered we were wrong and correctly took us back to the roundabout coming in on Via Galileo Galilei, the white road. It then told us to take the second road, which was correct. But it still asked us to take the third in the final roundabout.<br />
<br />
If Navigon is right, then it did not count the white road coming into the first roundabout - but it did count the north white road in the second.<br />
<br />
Disclaimer: I don't really know if the map corresponds 100% with the roads, but I think so.<br />
<br />
<b><span class="Apple-style-span" style="color: blue;">Only going to first entry of route?</span></b><br />
<br />
I think a Navigon "route" is a list of targets that we can only jump into at one place: the first entry. So, if you have made San Gimignano, no special street, the first entry in the route nad want to go from "here" there is a danger that you'll use 15 minutes trying to reach the first entry from here, like telling Navigon to to go from home to some neighbour. It's made for this kind of stuff, but the Navigon people could probably detect this, and ask me if I wanted to go to the first or second entry in the route. And then next time, I could tell it to go from here to the third entry. And then I would not have to cut off the next goal once I've got there. Maybe this is not what Navigator software is about, maybe others have this, and maybe even Navigon has it? Bare with me: I am new to this!<br />
<br />
<b><span class="Apple-style-span" style="color: blue;">Map errors</span></b><br />
<br />
There were obvious map errors, mosty associated with temporary changes. <a href="http://en.wikipedia.org/wiki/Navteq">NAVTEQ</a> certainly has some work to do there.<br />
<br />
<span class="Apple-style-span" style="color: blue;"><b>Help</b></span><br />
<br />
Navigon contains no help whatsoever(?). Touch is not logical, it has to be learnt. Swiping! One, two, three or even more fingers. There is some common reaction to them among apps, but I'd certainly like to know from day one, or minute one, how they are used by Navigon. Tip for Navigon: download <b>ArtStudio</b>. They have a single help screen called "Quick tutorial" and courses called "Lessons".<br />
<br />
<b><span class="Apple-style-span" style="color: blue;">Stability</span></b><br />
<br />
Some times Navigon crashed and we had to restart, like once every two hours. It came back to where we were, but I certainly hope that Navigon has asked iOS to ask me to send crash logs back to them. Once simulation hung and Navigon did not respond. What I then did was terrible, next chapter.<br />
<br />
<span class="Apple-style-span" style="color: blue;"><b>Post script:</b></span><b> </b><span class="Apple-style-span" style="color: red;"><b>another experience with Navigon</b></span><br />
<br />
Have a look at this note: <a href="http://oyvteig-2.blogspot.com/2011/09/028-diy-prototype-of-ipad-2-holder-for.html">028 - DIY prototype of an iPad 2 holder for car glove compartment</a>. The bottom chapter there also comments on Navigon and the car's built-in navgiation.<br />
<br />
<div>
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.4"></a><b><span class="Apple-style-span" style="color: red;">4 - Too easy to fatally remove an iOS app, when only stopping it was the intention? </span><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.4"><span class="Apple-style-span" style="color: red;">::</span></a></b></div>
<br />
I deleted Navigon, <i>the navigation software that we relied on,</i> with my finger one late night. When I switched in the brain, it was too late. Norwegian iPad screens, but you should reckognize them ok:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/025/fig4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/025/fig4.jpg" /></a></div>
<br />
Then I decided that this was partly Apple's fault, even if I hadn't done my homework (stay tuned).<br />
<br />
I was tired and pressed buttons in a frenzy when my fingers took the wrong path between <span class="Apple-style-span" style="color: red;"><b>wobbling icon with a red minus</b></span> (top in figure, <span class="Apple-style-span" style="color: red;"><b>to kill or stop a program</b></span>) and a<b> wobbling icon black cross</b> (bottom in figure, <b>to remove a program and its data</b>) makes all the difference.<br />
<br />
Navigon was hanging, and I wanted to stop the thing. I should have taken the top path in the figure above, but it's difficult to get there: 1.) While the misbehaving app is running I have to double-tap the home button get to the running process list, 2.) I have to start <i>another</i> application, 3.) I have to double-tap again to get the running process list again, 4.) I have to hold the icon of the app which I want to kill (because only now it appears in the list) so they all start wobbling and then 5.) tap the cross, and that's it. No problem. Green arrow. Can't go wrong because it only stops the app.<br />
<br />
However, the mere complexity of the procedure above is so, that when you know how to do it, you do it cognitively without the brain. It's called routine.<br />
<br />
Navigon was hanging, and I wanted to stop it. But at that time I chose the wrong path (which is much simpler than the above. Yes, <i>simpler</i> to get to the dangerous thing than the ok thing). A.) I pressed the home button once, B.) I held the icon until it started wobbling and then, C.) I had to answer something in a query box, either D.1) Yes I want to delete the application and all its data or D.2) No I don't. I pressed Yes. Red arrow: very stupid. <i><span class="Apple-style-span" style="color: #cc0000;">Good for us that Navigon wasn't showing us the way to a hospital.</span></i><br />
<br />
<div style="text-align: auto;">
However, my home work should have been to <i><b>set restrictions</b></i>, which would have stopped my ability to remove a program! The black crosses simply won't appear no matter how long I hold an icon. See figure below. I had thought this was something that parents did with a kid's iDevice. Now I understand that it's certainly something I should have done to protect myself from my own stupid actions. And from Apple's elegant but dangerous route - even if by design.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/025/fig5.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/025/fig5.jpg" /></a></div>
<div style="text-align: auto;">
<br />
For our case it really wasn't so bad, though. I had also installed Navigon on my wife's 3GS, and we could happily drive on. And the hotell we arrived at in Urbino, Italy, had internet access included. Up with AppStore on the iOS, and a new almost 2 GB download. It's perfect that one purchase covers several machines, and that Navigon exists for both machines!<br />
<br />
But Apple - the whole of Navigon was probbaly still silently present in the iOS <a href="http://en.wikipedia.org/wiki/Flash_memory">flash</a>-based memory. How about just asking me if I wanted to wake up the just deleted app? I don't know if the iOS file system has a <a href="http://en.wikipedia.org/wiki/Recycle_bin_(computing)">recycle bin</a> internally, but the functionality would have been nice! Or a third choice to removal, <span class="Apple-style-span" style="color: red;">yes</span>, <span class="Apple-style-span" style="color: #38761d;">cancel</span> or <span class="Apple-style-span" style="color: blue;">stack</span> (move to some kind of iOS special recycle mechanism?).<br />
<br />
I have reported this to <a href="http://www.apple.com/feedback/ipad.html">http://www.apple.com/feedback/ipad.html</a><br />
<br />
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.5"></a><b><span class="Apple-style-span" style="color: red;">5 - one.com mail squelched on some routers </span><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.5"><span class="Apple-style-span" style="color: red;">::</span></a></b></div>
<br />
Usually it works surprisingly well to connect iPhone, iPod or iPad to a new router. However at <i>one</i> of the hotels we experienced problems with mail. Browsing with Safari (and Opera) worked fine. But sending and receiving mail with the iOS mail client failed. More detailed: sending always failed, bet reception a very few times seemed to work. We brought one iPad2 (iOS 4.3.3), one iPhone 3G (iOS 4.2.1) and one 3GS (iOS 4.3.1) - but I only experimented on the iPad.<br />
<br />
I think one.com and the router in mind together displayed the problem. Not only the Mail client, but even Safari webmail was not able to log in to my one.com account. Opera Mini webmail with one.com logged me in and I could read mail and also send (see below).<br />
<br />
We had one ingoing IMAP server connected, and up to three outgoing SPMT servers. Any combination of these did not seem to help.<br />
<br />
I don't know if the router had blocked IMAP incoming port 143 or SMTP outgoing port 25 or 587. I tried to test, and all ports looked blocked, even standard browser HTTP port 80. So, I must have used the tool wrongly, or it<br />
<br />
The strange thing is that I wasn't able to set up Gmail in iOS Mail either, even if it's more or less automatic and built-in. Another strange thing: why did the lady I asked, sitting with an iPad, have functional mail, in the same hotel?<br />
<br />
[1] "Setting up iPhone Mail/iPod Touch" help on one.com: <a href="http://www.one.com/en/support/guide/mail/setting-up-iphone-mail">http://www.one.com/en/support/guide/mail/setting-up-iphone-mail</a>. This is not updated with iPad, which is a shame. They don't support home page editing for Mac either, any type - Mac OSX or iOS. Another shame.<br />
<br />
<div>
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=7921323052722588543&from=pencil" name="025.6"></a><b><span class="Apple-style-span" style="color: red;">6 - Opera Mini browser and webmail </span><a href="http://oyvteig.blogspot.com/2011/06/025-ipad2-on-vacation-ups-and-downs.html#025.6"><span class="Apple-style-span" style="color: red;">::</span></a></b></div>
<br />
The Opera Mini was version 6.0.0.13548. One.com webmail did work to some extent with the particular router, mentioned above. But there are some points, most of them disregarding the fact of the router, I would assume.<br />
<div style="text-align: left;">
</div>
<ol style="text-align: left;">
<li>Opera Mini could only handle one session "per Opera". Different windows were not able to have different log-ins or sessions. This mixed up the webmail lists, which pointed to the last log-in list. So, if my wife logged in in one window, and I was already logged in in another - when I came back to mine and pressed mail #3, it confused that with entries in her list.</li>
<li>As when using iOS Safari at home (or at the other hotels) webmail sending of file attachments does not work. Both browsers would know perfectly well that this browser is for iOS, so giving me a possibility to browse pictures should have been piece of cake. </li>
<li>Opera Mini hindered me editing the file input line, which proves that they knew it is of little use.</li>
<li>Opera Mini let med pick out the Send text from the Send button, as if that is of any interest.</li>
<li>Opera Mini could not show pictures in mails.</li>
</ol>
I have another blog about Opera Mini here: <a href="http://oyvteig.blogspot.com/2010/04/017-safari-and-opera-mini-on-iphone.html">017</a><br />
.</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-2578820300513114922011-03-08T20:34:00.021+01:002012-02-16T17:39:47.212+01:00024 - 16:9 video aspect ratio with width 720 uses height 404 instead of 405<div dir="ltr" style="text-align: left;" trbidi="on"><div><b><span class="Apple-style-span" style="color:red;">iPhone movies..</span></b></div><blockquote>The iPhone 4 produces QuickTime HD movies (.mov) that are 1280 x 720 pixels (16:9 aspect ratio). Observe that this is not the screen aspect ratio, which is 960 x 640 (3:2 or 1.5). Here is a nice comparison: <a href="http://www.macrumors.com/2012/02/12/an-ipad-3-retina-display-comparison-graphic/">http://www.macrumors.com/2012/02/12/an-ipad-3-retina-display-comparison-graphic/</a> (but speculative about iPad3).</blockquote><span class="Apple-style-span" style="color:red;"><b>..do not play on all machines</b></span><br /><blockquote>This is very nice. I can play it on my Mac Mini running Mac OS X Snow Leopard and QuickTime Player 10.0. However, the iBook and iMac (lamp) G4 machines running Mac OS X Tiger with QuickTime Player 7.6.4 only plays the sound but shows the odd picture as it moves on.</blockquote><b><span class="Apple-style-span" style="color:red;">But QuickTime Player export to "HD 480p" helped</span></b><br /><blockquote>So, I exported from the newest QuickTime Player to a "HD 480p"-type file. This plays beautifully on the older Tiger machines. The movies turn out to be 640 x 360 pixels (16:9). The movies were brighter and better looking than corresponding mpeg-2 (.mpg) movies in 640 x 480 (4:3 or 1.33..) shot with a Sony DSC-W100. And <i>somewhat</i> smaller in file size, I think.</blockquote><blockquote>I have also seen some movies that have been converted to 985 x 544 pixels, which is approximately 16:9. See below. I doubt that this is a result og HD 480p export, though?</blockquote><blockquote>And I think that 480p is 640 x 480 in 4:3, but I have not tried. But <a href="http://www.dpreview.com/news/2010/7/21/panasonicdmclx5#specs">Panasonic Lumix DMC-LX5</a> takes several formats, so I will try one day.</blockquote><div><b><span class="Apple-style-span" style="color:red;">However, export to "HD 720p" intrigued me</span></b><br /><blockquote>But I wanted to try to see how export to "HD 720p" ran on the Tiger machines. Better, but really not. I could accept that. However, I saw that this movie was 720 x 404 pixels, a little more than 16:9. I used the lazy solution at Evalwave Factors at <a href="http://factors.evalwave.com/">http://factors.evalwave.com/</a> to factorize.</blockquote><blockquote>First, 16:9 is 1,7777777777.....</blockquote><blockquote><span class="Apple-style-span" style="color:red;"><b>720</b></span> = 2 x 2 x 2 x 2 x 3 x 3 x 5<br /><span class="Apple-style-span" style="color:red;"><b>404</b></span> = 2 x 2 x 101<br />removing common factors 2 x 2 yields<br /><span class="Apple-style-span" style="color:blue;"><b>180:101</b></span> = 1,78217821782.. is almost 16:9</blockquote><blockquote>How about one more pixel (404+1) on the short side:<br /><span class="Apple-style-span" style="color:red;"><b>720</b></span> = 2 x 2 x 2 x 2 x 3 x 3 x 5<br /><span class="Apple-style-span" style="color:red;"><b>405</b></span> = 3 x 3 x 3 x 3 x 5<br />removing common factors 3 x 3 x 5 yields<br /><span class="Apple-style-span" style="color:blue;"><b>16:9</b></span><br />bingo!</blockquote><b><span class="Apple-style-span" style="color:red;">So, why is 720 x 404 used?</span></b></div><div><blockquote>Kyle Gilman's page <a href="http://www.kylegilman.net/">http://www.kylegilman.net/</a> opens a door for me: "<i>Keep the height an even number. Odd numbers freak out the H.264 codec</i>. In this case 720×405 is closer to 16:9, but change it to 404 and everyone will be happier." </blockquote><blockquote>Some day I'll investigate more about the <a href="http://en.wikipedia.org/wiki/H.264">H.264 codec</a>. </blockquote><blockquote>However, I do remember from the time I did Fast Fourier Transforms that even numbers were required (even if there are odd number algorithms available). And hardware multiplies by two by shifting left by one bit. This is much faster, and does not build up any errors. </blockquote><blockquote>Screens certainly must show the missing 405th line as all dark! Or the other way around, the iPhone (or, really H.264) throws away a line?</blockquote><span class="Apple-style-span" style="color:red;"><b>Another example is 568 x 320</b></span><br /><blockquote>My daughter sent me this iPhone movie by mail, directly from the phone. </blockquote><blockquote><span class="Apple-style-span" style="color:red;"><b>568</b></span> = 2 x 2 x 2 x 71<br /><span class="Apple-style-span" style="color:red;"><b>320</b></span> = 2 x 2 x 2 x 2 x 2 x 2 x 5<br />removing common factors 2 x 2 x 2 yields<br /><span class="Apple-style-span" style="color:blue;"><b>71:40</b></span> = 1,775, some 0.0277777.. off 16:9</blockquote><blockquote>What is the "real" 16:9 numbers here, i.e. how much is lost? Around those values there are lots of prime numbers, which are never even. Moving one up or down by 1 does not get me there. </blockquote>I certainly need help here!<br />. </div></div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com1tag:blogger.com,1999:blog-1348782545935329144.post-57479932439689913032011-02-10T16:44:00.009+01:002011-09-21T18:56:32.797+02:00023 - Concurrency: one writer and one reader is bad enough<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span class="Apple-style-span" style="color: red;">Error on page 15 of IEEE Software Jan/Feb 2011</span></b><br />
<br />
Dear Forest Shull (editor of IEEE Software)<br />
<br />
There is an error at that page, in the article “Parallelism on the Desktop” (Guest Editors’ introduction: Victor Pankratius, Wolfram Schulte and Kurt Keutzer [1]). The authors have virtually fallen into the same trap as many programmers working with concurrency or parallelism.<br />
<br />
“If the shared resource is mutable, programmers must introduce exclusion mechanisms, such as locks in C++ or synchronized methods in Java, to prevent race conditions (where <i>two or more threads</i> change the resource at the same time and introduce an inconcistent state).”<br />
<br />
In order to be correct, the last part may instead read: “where even a single writer and a concurrent single reader may introduce an inconcistent state”.<br />
<br />
The principle is called CREW (Concurrent Read Exclusive Write), see <a href="http://en.wikipedia.org/wiki/Concurrent_read,_concurrent_write">http://en.wikipedia.org/wiki/Concurrent_read,_concurrent_write</a>: “Concurrent Read Exclusive Write (CREW) — multiple processors can read a memory cell but only one can write at a time”.<br />
<br />
The idea of the concurrency primitives is to avoid this type of situation. In the problem domain, CREW shows how bad it is. In the solution domain, it would be the accesses (read or write) that need protection if there is at most one writer.<br />
<br />
I may blog about this error at <a href="http://oyvteig.blogspot.com/">http://oyvteig.blogspot.com/</a> any day soon. (Done, with minor edits.)<br />
<br />
[1] - Read <a href="http://origin-www.computer.org/plugins/dl/pdf/mags/so/2011/01/mso2011010014.pdf?template=0&loginState=1&userData=anonymous-IP%253A%253AAddress%253A%2B95.34.37.229%252C%2B%255B172.16.161.5%252C%2B95.34.37.229%252C%2B127.0.0.1%255D">pdf</a> (4 MB)</div>
<br /></div>
<span class="Apple-style-span" style="color: #76a5af;">(29June11: no response to the contents)</span><br />
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-18388971825756666532011-01-09T21:18:00.035+01:002011-08-15T22:36:33.933+02:00022 - C1X and C++0x concurrency in C and C++ Working Drafts<div dir="ltr" style="text-align: left;" trbidi="on">Updated 15Aug11<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Intro</b></span><br />
<br />
The scope of this post is to learn how the renewed C and C++ standards may help programmers of concurrent systems do their job. I will of course look at this through my CSP-type glasses, with years of occam programming and using CSP/channel-type libraries in ANSI C in embedded systems as my bias. (Post <a href="http://oyvteig.blogspot.com/2010/12/021-problems-with-threads.html">021- The problems with threads</a> takes me up to <i>this</i> point.)<br />
<ul><li>I assume that C1X should end of with C12 for the year's publication data ("formal adoption of a revised standard by the end of 2011, with a publication date of 2012" (<a href="http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1250.pdf">C - The C1X Charter</a>)). </li>
<li>And C++0x I assume means that they are late, but from the wiki-page is looks like it's going to end up with C++11. <span class="Apple-style-span" style="color: red;">As of 12 August 2011, the C++0x specification has been approved by the ISO</span>. The final working draft before final ISO approval standard is N3291, dated 5 April 2011. This draft is not publicly available; the most recent working draft available is (N3242) dated 28 February 2011. So, it's probably going to be called <span class="Apple-style-span" style="color: red;"><b>C++11</b></span>.</li>
</ul>Here are the main references:<br />
<ul><li>C1X<br />
<a href="http://en.wikipedia.org/wiki/C1X">http://en.wikipedia.org/wiki/C1X</a><br />
<a href="http://www.open-std.org/Jtc1/sc22/wg14/www/docs/n1548.pdf">N1548</a> - 2 December 2010</li>
<li>C++0x<br />
<a href="http://en.wikipedia.org/wiki/C%2B%2B0x">http://en.wikipedia.org/wiki/C++0x</a><br />
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf">N3242</a> - 28 February 2011 (last before approved)</li>
<li>ISO C++ Strategic Plan for Multithreading<br />
<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1815.html">N1815</a> - 2005</li>
</ul><b><span class="Apple-style-span" style="color: red;">Analysis</span></b><br />
<br />
Letters-in-words and words that I will use to search in the documents. This should(?) indirectly direct me to all the new keywords:<br />
<ul><li>"thread"</li>
<li>"multi" <span class="Apple-style-span" style="color: #999999;">(task thread -threading)</span></li>
<li>"concurren" <span class="Apple-style-span" style="color: #999999;">(t cy tly)</span></li>
<li>"synchron" <span class="Apple-style-span" style="color: #999999;">(ization, ous, asynchron..) </span></li>
<li>"communicat" <span class="Apple-style-span" style="color: #999999;">(e ion ing)</span></li>
<li>"atomic"</li>
<li>" race" <span class="Apple-style-span" style="color: #999999;">(to exclude brace..)</span></li>
<li>"deadlock"</li>
<li><span class="Apple-style-span" style="color: #999999;">"process" (no such term, but there are some threads by name "</span>process<span class="Apple-style-span" style="color: #999999;">")</span></li>
<li>"schedul" <span class="Apple-style-span" style="color: #999999;">(e, ing)</span></li>
<li>"happens before"</li>
<li>"inter-thread happens before"</li>
</ul>I'd like to see if I could fill in these points:<br />
<ol><li>Process (no: thread) model (<i>versus</i> or <i>and</i> object model)?</li>
<li>Synchronization model?</li>
<li>Communication model?</li>
<li>Memory model - why is there so much about this?</li>
</ol>And<br />
<ol><li>Will the C concurrency features be a subset of the C++ concurrency features?</li>
<li>The difference between <i>third-party thread by library </i>(as discussed in post 021) and <i>language defined thread by library</i> as defined here. Is it assumed that the compiler knows what a process (or whatever) is? The answer to this is a function of what I would see from the above list</li>
<li>Per definition it will it be A Good Thing to build a CSP library on top of these! How "nice" will such a library be, i.e. how easy to get correct? (Again, see post 021)</li>
</ol><span class="Apple-style-span" style="color: red;"><b>First comments</b></span><br />
<br />
My post <a href="http://oyvteig.blogspot.com/2010/12/021-problems-with-threads.html">021</a> starts with quoting "It is widely acknowledged that concurrent programming is difficult" (Lee). Future programmers of C and C++ may learn by expensive experience that it is even "<i>very</i> difficult".<br />
<br />
These papers start after the climax in the middle of Lee's paper. Where he goes on in the right direction, these papers don't go back to square one. They elevate.<br />
<br />
Ok, they <i>add</i> concurrency where there was none before. That is their motivation, and it is an important motivation. But whose idea was it to build this on C and C++? Did they ask?<br />
<br />
These people are <i>specialists</i>. The papers are not for amateurs, like I would be in their eyes. I have been hidden from <i>most</i> of the problems they solve during my 30 years of concurrent programming. Starting off with a runtime system in 1980 that we bought from a university person who said his code in PL/M had "no errors". We though he was more crazy than he was! Modula 2 and a runtime system for it. Occam on transputers and occam to C (SPoC). Occam will stay the programmer's love of my life. And then back a few hops to C and CSP-type runtime systems.<br />
<br />
I really don't understand which planet the open-std.org is on when it comes to concurrency. In post 021 Per Brinch Hansen is quoted for "that Java ignores the last twenty-five years of research in parallel programming languages.". How many years will future C and C++ programmers have lost?<br />
<br />
I am not able to see the answer to any of the questions above. There may be answers, but they seem hidden for me. Except: yes - C is a subset of C++ still, at least when it comes to the <i>memory model</i>. I think.<br />
<br />
A language isn't for the future just because "futures" are implemented. This is a pattern that I could easily code in occam and install some 20 years ago. But it's nice to have it in a language. And it is nice to have atomicity described. Etc.<br />
<br />
But it is the complexity explosion of the standard that worries me. Inspired by Lee, they are two vast seas of nondeterminism - used in another domain - the definition-of-standard domain.<br />
<br />
This probably <i>is</i> very reasonable (from C++ page 1152):<br />
<blockquote><span class="Apple-style-span" style="color: #e06666;">29.6.5 Requirements for operations on atomic types [atomics.types.operations.req]</span></blockquote><blockquote><span class="Apple-style-span" style="color: #666666;">6 #define ATOMIC_VAR_INIT(value) see below</span></blockquote><blockquote><span class="Apple-style-span" style="color: #666666;">Remarks: The macro expands to a token sequence suitable for constant initialization an atomic variable of static storage duration of a type that is initialization-compatible with value. [ Note: This operation may need to initialize locks. — end note ] Concurrent access to the variable being initialized, even via an atomic operation, constitutes a data race.[ Example: atomic</span><int><span class="Apple-style-span" style="color: #666666;"> v = ATOMIC_VAR_INIT(5); — end example ] </span></int></blockquote>Please help me. And if I am able to understand, then I need help with some more.<br />
<br />
But this is rather ok (C++ page 11):<br />
<blockquote><span class="Apple-style-span" style="color: #e06666;">1.10 Multi-threaded executions and data races [intro.multithread]</span></blockquote><blockquote><span class="Apple-style-span" style="color: #666666;">1 Every thread in a program can potentially access every object and function in a program (10)</span></blockquote><blockquote><span class="Apple-style-span" style="color: #666666;">(10) An object with automatic or thread storage duration (3.7) is associated with one specific thread, and can be accessed by a different thread only indirectly through a pointer or reference (3.9.2).</span></blockquote>Let's say that I want to implement a CSP library, and when the second process is on a channel, I want to do the rendezvous memcpy from inside the sender process to inside the receiver process. So now I know that I may code this. In C or C++. But observe the level. <i>It's underneath where I should be.</i><br />
<br />
But isn't that what open-std.org has set out to do for me? Make it possible to build any concurrency paradigm on top of what they now give me? Probably they haven't missed that goal. Stroustrup told me exactly this when I approached him at Simula 67's 25th anniversary in Oslo in 1992:<i> C++ does not have any concurrency to let anybody build their own</i>. Now they are building their own.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Last comments</b></span><br />
<br />
Adam Sampson's thesis <a href="http://offog.org/publications/ats-thesis.pdf">Process-Oriented Patterns for Concurrent Software Engineering</a> that he posted in a comment to post 021 certainly points to <i>another direction of research</i> - and present good practices. And I must repeat: the <a href="http://golang.org/doc/go_faq.html#csp">Go programming language faq</a> also referenced in post 021.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Postscript</b></span><br />
<br />
Is the world <i>really</i> crying for these two houses built on sand?<br />
<br />
What did you say, do you need a C/C++ concurrency expert? If you find a <i>good</i> one, you'd need to wait 5-10 years before you know whether he was as good. And <i>he</i> wouldn't know if the house burnt. Working for other companies, making more good money.<br />
.<br />
.<br />
<br />
<br />
<br />
</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-77640452791466662442010-12-29T12:18:00.062+01:002011-01-08T23:41:34.904+01:00021 - The problems with threadsUpdated 8Jan11<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Intro</span></b><br />
<br />
Being year's passover 2010/11 it may be late to comment on a paper I found in a pile of IEEE Computer magazines. The article dates back to 2006. The article is available on the net as a report from the University of California at Berkeley:<br />
<blockquote><b>The Problem with Threads </b><br />
<b>Edward A. Lee </b><br />
Electrical Engineering and Computer Sciences<br />
University of California at Berkeley<br />
Technical Report No. UCB/EECS-2006-1<br />
<a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.html">http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.html</a> (<a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf">pdf</a>)<br />
January 10, 2006</blockquote><blockquote>IEEE Computer 39(5):33-42, May 2006</blockquote>That IEEE Computer magazine was themed "<b>Future Operating Systems (and) Programming Paradigms</b>" and the article was a cover article.<br />
<blockquote><table border="1" cellpadding="2" cellspacing="0" style="text-align: center;"><tbody>
<tr> <td style="vertical-align: top;">I advice you to read the well-written article. And it's outspoken and fun reading!</td> </tr>
</tbody> </table></blockquote>The quotes I use here are from the report (IEEE Computer have edited a little).<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Disclaimer</span></b><br />
<br />
This note's title uses plural "problems", not to make the titles equal - and it is a mix between a review and my own personal views and experience.<br />
<br />
Over some years I have published along the line of that article, see <a href="http://www.teigfam.net/oyvind/pub/pub.html">http://www.teigfam.net/oyvind/pub/pub.html</a>. I also have some posts here about the same theme, see <a href="http://oyvteig.blogspot.com/2009/07/013-overview.html">http://oyvteig.blogspot.com/2009/07/013-overview.html</a>.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">"It is widely acknowledged that concurrent programming is difficult" (Lee)</span></b><br />
<div><br />
</div><div>The magazine article says "Concurrent programming is difficult,..". This is what caused my interest, in addition to the title. But this first sentence seems to contradict the title. Why doesn't he say "..that programming with <i>threads</i> is difficult"?<br />
<br />
I have attended the <a href="http://www.wotug.org/">WoTUG- and now CPA- series of conferences</a> for quite some years. What I have learned over the years is the opposite:<br />
<br />
<b><span class="Apple-style-span" style="color: red;">"Contrary to the belief out there, concurrent programming <u>is</u> easy" (WoTUG/CPA)</span></b><br />
<br />
Here is the semantics of that statement: "Programming with threads is difficult, but programming with processes is easy". Later in his paper, I think this is also what Lee says. But he feels bleak about the future, while the conferences (and Lee's paper) try to do something with it.<br />
<br />
When I programmed in <a href="http://en.wikipedia.org/wiki/Occam_(programming_language)">occam 2</a> for some ten years, concurrent programming was indeed easy. I had no interrupts, only processes, so asynchronous I/O was tamed before it could overwrite common data. I had fully encapsulated processes, with parallel usage rules checked by the compiler. Processes only communicated over zero-buffered synchronous unidirectional named channels. Buffering had to be coded explicitly. Functions were side effect free, as they were not allowed to use channels. And, the compiler checked aliasing errors (so linked lists were not possible..). Occam 2 has been developed since it died as a commercial language, and now holds a plethora of new primitives.<br />
<br />
Yes, I did have to learn the art of the trade. Some has called it Process Oriented Programming.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>"</b></span><span class="Apple-style-span" style="color: red;"><b>The problem is that we have chosen concurrent abstractions that do not even vaguely</b></span><br />
<span class="Apple-style-span" style="color: red;"><b>resemble the concurrency of the physical world." (Lee)</b></span><br />
<br />
Even if "not even vaguely" is Lee's falsification term here I would disagree.<br />
<br />
The physical world is one axis, concretizations of abstract descriptions another. If my concurrent abstraction may be given a name so that I understand what it basically does, and may be seen as a cognitive entity, then I'm ok. I think this is what <a href="http://en.wikipedia.org/wiki/Wittgenstein">Wittgenstein</a> in 1921 proposed in his <i>Tractacus</i>.<br />
<br />
"Channels", "rendezvous", "port", "protocol", "process" and "alternation" are taken from daily vocabulary. These are good terms that I grasp, but they fit more or less to their physical (if any) counterpart. These are "vague" terms, really - so Lee might have his words ok.<br />
<br />
The idea that "object" as used in "object orientation" (OO) should resemble physical world objects is not needed for me. It has been used to describe OO ("object car has wheels"), but after those examples then just forget: "window has buttons" or worse "window has drop-down menu" makes little sense for real windows.<br />
<br />
By the way: "thread" is perhaps a good term! I have seen the result when a cat has played with a yarn of a long single thread. Maybe they should have used better <a href="http://en.wikipedia.org/wiki/Weaving">weaving</a> terms? Weaving could be seen as quite formal! And if the terms chosen had been better, maybe the solution would have been better, recursing into Lee's statement?<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Process model</span></b><br />
<br />
In my opinion the CSP "process model" is much easier to understand than "object model". The definition of an object these days emphasizes encapsulation more than before. Some years ago, inheritance and polymorphism were more "modern" to include in the object model.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">"Nondeterminism of threads" (Freely from Lee)</span></b><br />
<br />
I'll fill in with an example. The <a href="http://libcsp.sourceforge.net/">libcsp</a> library by R. Beton furnished Posix light weight thread programmers with a clean CSP API. However, the struct CSP_Channel_t contained three pthread_mutex_t and two pthread_cond_t, in addition to a CSP_Alt_t that contained one of each. Reading it out aloud:<br />
<blockquote>one channel at most needed 4 mutexes and 3 condition variables (*)</blockquote>This, just to attempt to tame the "nondeterminism of threads" as Lee calls it.<br />
<br />
(*) I don't know how many of these are there to handle asynchronous I/O (like interrupt) or preemption.<br />
<br />
You <i>could</i> argue that's it's the channel construct that's wrong, but then bear in mind that it is possible to build a "naked" CSP library without any mutexes, condition variables or critical regions. Again, asynchronous I/O of course needs to be handled. However, preemption has not been needed in any CSP-type embedded system I have seen, but I have learnt that it is necessary for an experimental language called Toc which handles deadline scheduling, see <a href="http://www.wotug.org/cpa2008/programme.shtml#paper11">this paper</a> by Korsgaard and Hendseth.<br />
<br />
Back to <i>nondeterminism</i>. I learned something from Lee's description. I have always though of nondeterminsim as what (should) happen in the occam ALT struct (as opposed to PRI ALT), or what happens with <a href="http://en.wikipedia.org/wiki/Promela#Executability">Promela's :: operator</a>. These nondeterminisms are wanted, and would explicitly read "if more than one choice are ready, select any one of them". If that behaviour is not what I want, I instead use the determinsitic construct.<br />
<br />
But here Lee points out that it's unwanted altogether in the <i>thread</i>'ed world. (Later on he goes on to describe the "judicious nondeterminism" - which is the one I am used to.)<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>WYSIWYG semantics (Welch)</b></span><br />
<blockquote>"In fact, we have to know about all other threads that might execute (something that may not itself be well defined), and we would have to analyze all possible interleavings. We conclude that with threads, there is no useful theory of equivalence."<br />
...<br />
"Threads, on the other hand, are wildly nondeterministic. The job of the programmer is to prune away that nondeterminism. We have, of course, developed tools to assist in the pruning. Semaphores, monitors, and more modern overlays on threads (discussed in the following section) offer the programmer ever more effective pruning. But pruning a wild mass of brambles rarely yields a satisfactory hedge." (Lee)</blockquote>Welch here has introduced the term WYSIWYG semantics. Lee in effect shows that threading does not have this type semantics.<br />
<br />
I have discussed this in note [<a href="http://oyvteig.blogspot.com/2009/02/007-synchronous-and-asynchronous.html">007 - Synchronous and asynchronous</a>]. Here is a quote from Welch et.al:<br />
<blockquote>"One crucial benefit of CSP is that its thread semantics are compositional (i.e. WYSIWYG), whereas monitor thread semantics are context-sensitive (i.e. non-WYSIWYG and that's why they hurt!). Example: to write and understand one synchronized method in a (Java) class, we need to write and understand all the synchronized methods in that class at the same time -- we can't knock them off one-by-one! This does not scale!! We have a combinatorial explosion of complexity!!!"<br />
(Letter to Edward A. Parrish, The Editor, IEEE Computer. Peter Welch (University of Kent, UK) et al. <a href="http://www.csp-consortium.org/images/IEEE_Computer.pdf">http://www.csp-consortium.org/images/IEEE_Computer.pdf</a> (1997)</blockquote>Observe that I in note 007 discuss this also relative to asynchronous "send and forget" message based systems.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>"This pattern can be made to work robustly in Java" (Lee)</b></span><br />
<br />
Lee shows how easy it is to make erroneous multithreaded code in Java. The <i>observer</i> pattern for one thread, and then the obvious thread safe version is shown. Only, the "thread safe" is only an <i>attempt</i> at it, as Lee shows. There is a potential deadlock lurking.<br />
<br />
A couple of memories spring to my mind.<br />
<br />
<b>First</b>, before the <a href="http://www.wotug.org/wotug19/wotug-pr.html">WoTUG-19</a> conference I thought that it might be a good idea to present the <a href="http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/sketch/commstime.occ?rev=5894">commstime</a> program (a very simple but effective benchmark program for concurrency) in the new Java language. I did, but concluded that the "Java 1.0's PipedInput/OutputStream classes seem impractical to use because of an implementation error at Sun". I had my fingers burnt on trial one.<br />
<br />
But here was a language with some built-in mechanisms for concurrency, so the community started building CSP libraries in Java. Commercial occam was dying, and so was the transputer. There was a void. So <a href="http://en.wikipedia.org/wiki/JCSP">JCSP</a> (Communicating Sequential Processes for Java) was developed by University of Kent at Canterbury. JCSP is being updated to have become a viable concurrency platform for Java; I note that last public release is from August 2010 (this is written in Dec. 2010).<br />
<br />
There were all these experts, learning all the intricacies of <i>synchronized</i> and Java's <i>monitor</i>. By 1998 all seemed to work fine. Until a student some <i>two years</i> and who knows how many uses later found a simple case where it deadlocked. The result was that parts of JCSP was formally verified and then fixed. Read about this exiting adventure <a href="http://www.wotug.org/paperdb/send_file.php?num=44">here</a> ("Formal Analysis of Concurrent Java Systems" by Peter H. Welch and Jeremy M.R. Martin). The error was subtle, but the fix was simple.<br />
<br />
<b>Second</b>, about the same time, <a href="http://en.wikipedia.org/wiki/Per_Brinch_Hansen#cite_note-0">Per Brinch Hansen</a> wrote a letter that floated around on the internet, later to have become seminal. It is very interesting reading, because what he's basically saying is that the Java designer's at Sun hadn't done their homework. Here's his ingress:<br />
<blockquote>"The author examines the synchronization features of Java and finds that they are insecure variants of his earliest ideas in parallel programming published in 1972–73. The claim that Java supports monitors is shown to be false. The author concludes that Java ignores the last twenty-five years of research in parallel programming languages."<br />
(Hansen, Per Brinch, "Java’s insecure parallelism" in ACM SIGPLAN Notices, V.34(4) pp.38-45, April 1999. <a href="http://brinch-hansen.net/papers/1999b.pdf">http://brinch-hansen.net/papers/1999b.pdf</a>)</blockquote>Per Brinch Hansen then goes on to describe exactly what's wrong with Java. Observe that Brinch Hansen in 1993 invented the <a href="http://en.wikipedia.org/wiki/Super_Pascal">SuperPascal</a> language, whose concurrency features are based on a subset of occam 2!-)<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>"Fixing threads by more aggressive pruning" (Lee)</b></span><br />
<br />
Lee describes how they in the <a href="http://en.wikipedia.org/wiki/Ptolemy_Project_(computing)">Ptolemy project</a> ("an ongoing project aimed at modeling, simulating, and designing concurrent, real-time, embedded systems") used several established software engineering processes like a new "code maturity rating system", design reviews, code reviews, nightly builds, regression tests, and automated code coverage metrics.<br />
<blockquote>"The strategy was to use Java threads with monitors." (Lee)</blockquote>I wander if they had had access to Per Brinch Hansen's paper, or the Welch and Martin paper. Surely they must have been familiar with the problems.<br />
<br />
Even with all this going on for them, Lee describes that "No problems were observed until the code deadlocked on April 26, 2004, four years later." Lee goes on to say that:<br />
<blockquote>"Regrettably, I have to conclude that testing may never reveal all the problems in nontrivial multithreaded code" (Lee)</blockquote>When a new version of some software is released, there has to be thorough testing. Case closed. But are we some times testing too much? Relying on testing where relying on other means would have been better?<br />
<br />
Lee points out that avoiding deadlocks in a system based on semaphores is just to follow some well-known rules:<br />
<blockquote>"Of course, there are tantalizingly simple rules for avoiding deadlock. For example, always acquire locks in the same order [32]. However, this rule is very difficult to apply in practice because no method signature in any widely used programming language indicates what locks the method acquires. <i>You need to examine the source code of all methods that you call, and all methods that those methods call, in order to confidently invoke a method.</i> Even if we fix this language problem by making locks part of the method signature, this rule makes it extremely difficult to implement symmetric accesses (where interactions can originate from either end). And no such fix gets around the problem that reasoning about mutual exclusion locks is extremely difficult. If programmers cannot understand their code, then the code will not be reliable" (Lee, italics by me)</blockquote>In other words semaphores don't have WYSIWYG semantics!<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Use of software patterns</b></span><br />
<br />
Lee also discusses patterns. I have myself used patterns like the "The 'knock-come' deadlock free pattern", described in <a href="http://oyvteig.blogspot.com/2009/03/009-knock-come-deadlock-free-pattern.html">Note 007</a>. But Lee has a point when he states that:<br />
<blockquote>"Programmers will make errors, and there are no scalable techniques for automatically checking compliance of implementations to patterns." (Lee)</blockquote>This is very true. But the shortest programs that function well with a pattern may become part of a repository for it. Real coding undermines patterns! Lee goes on:<br />
<blockquote>"More importantly, the patterns can be difficult to combine. Their properties are not typically composable, and hence nontrivial programs that require use of more than one pattern are unlikely to be understandable" (Lee)</blockquote>This is less universally true, I guess. If a pattern is based on composable components with WYSIWYG semantics, then combining these patterns should be ok semantically. Some times it's wanted to change Master and Slave processes in knock-come. Doing this has no other side effect than wanted. In a real-time system we need to know the timing constraints. If any process decides not to listen on a channel for some time, say 100 ms, then any one sending on that channel would have to block 100 ms. This blocking is no worse than an asynchronous message not been handled by some state for 100 ms. In fact it's better: the blocking doesn't fiddle with the toothwheels, since it would not even see a message that it would else have to schedule for itself some time later.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>WYSIWYG semantics and timing constraints</b></span><br />
<br />
This takes me to a point that I am not so sure about. WYSIWYG semantics will not include timing constraints? In such a system the protocol between processes describe all I need to know? Right? No, I don't think so. I think I need to describe (as a comment or whatever) what the maximum blocking time is. Or really, maximum time between any send and response (in any message based system).<br />
<br />
Usually one just discards this problem by stating that an event-action takes zero time. For most systems this is ok. But if we may block 100 ms, this needs to be propagated, just like with the Toc language mentioned above by Korsgaard and Hendseth.<br />
<br />
If a protocol is decorated with timing constraints and those are propagated, then You Can See What You Get. But only then.<br />
<br />
Time messes up any good argument!<br />
<br />
<b><span class="Apple-style-span" style="color: red;">Real-time Java</span></b><br />
<br />
Rounding the century my company (Navia/Autronica) was a member of the <i>J Consortium - Real-Time Java™ Working Group</i>. It was set up by <a href="http://www.nist.gov/index.html">NIST</a> and backed by HP, Microsoft, Newmonics and others. These days, the <a href="http://www.j-consortium.com/">www.j-consortium.com</a> honours its ancestry, but now it's about "real-time medical application".<br />
<br />
I was the one doing the work for Navia/Autronica, in the Real-Time Java Working Group (RTJWG).<br />
<br />
I remember the endless discussions about how to handle "asynchronous I/O". I had been working occam for 10 years then, and that problem <i>as a problem</i> was non-existing. As mentioned earlier, interrupt handlers were proper occam processes, where the interrupt vector was mapped as a channel, possible to use in an ALT (to be able to receive outputs as well). Results were preferably sent on a channel that never was in a steady state to block (by use of an "overflow buffer" process (two processes in series)). This was <i>so nice</i>, and there was no new thinking about an interrupt process or any process. They were born equal. The <i>process mode</i>l stayed.<br />
<br />
<span class="Apple-style-span" style="color: red;"><b>"Alternatives to threads" (Lee)</b></span><br />
<br />
Lee discusses several alternatives, but <i>for me</i> the most interesting is the fact that the Ptolemy II project also has a "<a href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/ptolemy/domains/csp/doc/main.htm">rendezvous domain CSP</a>" API. Here is their <a href="http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII8.0/ptII/doc/codeDoc/ptolemy/domains/csp/kernel/package-tree.html">class hierarchy</a>. They state that it's based on <a href="http://en.wikipedia.org/wiki/C._A._R._Hoare">C.A.R. Hoare</a>'s 1978 version of <a href="http://en.wikipedia.org/wiki/Communicating_Sequential_Processes">CSP</a>. A process in the 1978 version sends to a named process, whereas in the 1985 version a process sends to a named channel, as in occam. I believe Hoare changed it after the Ada experience, in which his 1978 solution hindered building of precompiled (?) libraries. (Please send <a href="http://www.teigfam.net/oyvind/me/me.html">me a mail</a> if Ptolemy II really sends on a named channel, so that I can fix.)<br />
<br />
Using a CSP class library is A Quite Good Thing. This criticism falls in Ptolemy as well as JCSP (mentioned earlier). If a channel (or whatever well thought out concurrency communication primitive..) is not a "first rate citizen" of the language CSP (or..) will "never" succeed if this is all that's supplied in the future.<br />
<br />
In a way it's "pruning of nondeterminstic" cognitive thinking, where each time something is read it has to be understood through a hierarchy. Every time! Not nice to say about OO which has its benefits and uses! A compiler would not know <i>what a process is</i>, it can't do parallel usage checks. At best it would be an add-on tool.<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b><span class="Apple-style-span" style="color: red;">"Coordination languages" (Lee)</span></b></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">Finally Lee taks about coordination language, which would sit on top of a more a standard language (with new keywords?) The Ptolemy II rendezvous CSP "framework is properly viewed as a coordination language". There nondeterminsm is explicit when wanted, else it's determinstic.</div><br />
<b>After Lee's 2006 article:<span class="Apple-style-span" style="color: red;"> "The Go programming language" (Google)</span></b><br />
<br />
But A Good Thing, invented after Lee's paper, is Google's <a href="http://en.wikipedia.org/wiki/Go_(programming_language)">Go programming language</a>. Its concurrency is based on the CSP model, and uses channels as interprocess communication. Even if it "does not provide any built-in notion of safe or verifiable concurrency", it is a step in the right direction. I let the Go people have the final words in this note:<br />
<blockquote><b><span class="Apple-style-span" style="color: red;">"Why build concurrency on the ideas of CSP?</span></b><br />
Concurrency and multi-threaded programming have a reputation for difficulty. We believe the problem is due partly to complex designs such as pthreads and partly to overemphasis on low-level details such as mutexes, condition variables, and even memory barriers. Higher-level interfaces enable much simpler code, even if there are still mutexes and such under the covers.<br />
One of the most successful models for providing high-level linguistic support for concurrency comes from Hoare's Communicating Sequential Processes, or CSP. Occam and Erlang are two well known languages that stem from CSP. Go's concurrency primitives derive from a different part of the family tree whose main contribution is the powerful notion of channels as first class objects."<br />
(<a href="http://golang.org/doc/go_faq.html#csp">Go programming language faq</a>)</blockquote>End<br />
.<br />
.</div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com2tag:blogger.com,1999:blog-1348782545935329144.post-60591300760497874082010-09-19T21:36:00.043+02:002011-04-21T11:01:45.216+02:00020 - Mac OS X network disk partially seen<div dir="ltr" style="text-align: left;" trbidi="on">This Network disk is connected via USB on an AirPort Extreme (7.4.2 and also the <i>better</i> 7.4.1 (*)). Mac OS X 10.6.4 Snow Leopard (but I have also noticed this on earlier versions). (Not fixed with "Apple Addresses AFP Vulnerability With Security Update 2010-006" in Sept. 2010). Tiger 10.4.11 on iBook G4. Disk connected to AirPort Extreme is via USB, and its a Western Digital WD My Book 1028, formatted as "Mac OS Extended (Journaled)".<br />
<br />
(*)<br />
<ol><li><span class="Apple-style-span" style="color: red;">New</span>: follow on <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html#004.6">004.6 - Airport Extreme version juggling</a></li>
<li>I am following this situation after the AirPort Extreme update from 7.4.1 to 7.5.2 in Dec. 2010. I wonder why Apple did such a version quantun leap. </li>
<li>I am also following the situation after the update of the Snow Leopard version of the <u>AirPort Tool</u> to 5.5.2 in Dec. 2010. This is the client sw that lets me configure the AirPort Extreme. I do not think that an update of it would have any effect on the situation described here, unless by a secondary effect coming from any error imposed by the AirPort Tool doing wrong configuring of the AirPort Extreme and its file server. (On Tiger 10.4.11 the AirPort Tool is 5.4.2, opening for configuration clash on the Airport Extreme. <i>Maybe I should only use the newest version</i>? How does Apple avoid any configuration clash?). Reported to <a href="http://www.apple.com/feedback/airportextreme.html">http://www.apple.com/feedback/airportextreme.html</a></li>
</ol><span class="Apple-style-span" style="color: red;"><b>Symptoms</b></span><br />
<br />
<span class="Apple-style-span" style="color: red;"><b>6Jan11 New: </b><span class="Apple-style-span" style="color: black;">the disk may have been in need of repair. See </span></span><a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html#004.5">004.5 - Time Machine backup on Airport Extreme's USB connected disk</a><br />
<ol><li>The Network disk was visible and "mountable" in Finder. Disk and contents. Fine!</li>
<li>But when I tried "Save as" from any application I could see the network disk, but not the files and directories</li>
<li>However, during the same "Save as" I could make a New directory <i>and</i> save the file in it, even if I could not see the rest</li>
<li>Running Spotlight on the Network disk showed me the hits, but double-clicking failed to open it, but gave an error message about "broken alias"</li>
<li>At the same Spotlight result window, the file path at the bottom was not shown. I guess that since the alias was wrong, it could not build any path either</li>
</ol><span class="Apple-style-span" style="color: red;"><b>Fix (permanent?)</b></span><br />
<br />
I tried to find a fix on the net, but failed. However, I reasoned that there must be at least two ways to look at the disk, and the system seems to pick the wrong some times. So I tried this (Disclaimer, I have Mac OS X in Norwegian, so the English texts could be wrong):<br />
<ol><li>Open Finder</li>
<li>Go, Connect to server</li>
<li>There were two previous servers in the "Last used servers" list</li>
<li>I copy-pasted both server addresses into a .txt-file, for "backup"</li>
<li>I tried first the one and then the other</li>
<li>The one that removed all the symptoms above I noted</li>
<li>Then I "Emptied" the list of last used servers (command in Finder:Go:Connect to server:look at the list)</li>
<li>Finally I copy-pasted back the one that worked</li>
<li>Now the system has <i>one</i> to look for, and since it's the only reasonable and correct - fine!</li>
<li>I think I have found out that using Go, Connect to server and then use the smb (even if that is the only alternative) seems to work (always?)</li>
</ol>It was the "afp://...." that caused my problems, and the "smb://...." that was correct. Please tell me why!<br />
<br />
Reported to <a href="http://www.apple.com/feedback/macosx.html">http://www.apple.com/feedback/macosx.html</a><br />
<br />
<span class="Apple-style-span" style="color: red;"><b>Postscript</b></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://www.teigfam.net/oyvind/blogspot/020/fig1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/020/fig1.jpg" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: left;">When I tried this again the other day, there were still two alternatives. The <a href="http://en.wikipedia.org/wiki/Server_Message_Block">smb</a> is the (right, top) icon with the three persons, which always works - and the AirPort-type (right, bottom) icon is the <a href="http://en.wikipedia.org/wiki/Apple_Filing_Protocol">afp</a>, which does not work. It's all cabled, the AirPort is not on. When I tried a "Save as", it knew that the afb didn't work - see, it was "grayed out", compare with the larger non grayed out alternatives. (I have garbled my disk names). Please teach me! At least, I now know which to use and which not to!</div><br />
<div class="separator" style="clear: both; text-align: left;">I can see that the Mac OS X displays <i>boths icons for the same disk</i>! The one in the window and the one in the title in the window are one of each! I am lost. But point 10 above is my rope now.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">(8April11) See further down (search for "smb") to find a point about a synchronization problem.</div><br />
<div class="separator" style="clear: both; text-align: left;"><b><span class="Apple-style-span" style="color: red;">My iTunes library and Time Machine on this network disk</span></b></div><br />
<div class="separator" style="clear: both; text-align: left;">After I had changed to smb (above), then iTunes it could not find the iTunes library. It's on a <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">network disk</a>. To recitfy I pointed it to to the smb disk with the three-person icon. All fine, also after I stopped iTunes and started it again. Same for Time Machine!</div><br />
<div class="separator" style="clear: both; text-align: left;">Another observation with iTunes. It also seems to use several mount paths to the network disk. I can start iTunes, and it shows almost everything, but it displays an exclamation mark in front of the music. Then, the first time I want to play it, it opens a shared network disk dialogue box. When I type the password, music plays. I doubt that iTunes has temporary files on the machine's disk, because it complains immediately if it can't find any network disk. </div><br />
<div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="color: red;"><b>Tiger - no problem!</b></span></div><br />
<div class="separator" style="clear: both; text-align: left;">Observe that I have no problem whatsoever accessing the same network disk from Mac OS X 10.4.7 Tiger. It seems to always pick afp AppleShare protocol, and the icon is always a globe.</div><br />
<div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="color: red;"><b><span class="Apple-style-span" style="font-size: large;">Another problem - a directory's contents invisible on Snow Leopard and not on Tiger</span></b></span></div><br />
<div class="separator" style="clear: both; text-align: left;">I noticed that synching my pictures on the iPhone from a Mac OS X Tiger machine (iTunes 9.x) all of a sudden showed a picture folder on the iPhone (3G, iOS4.1) that was'n on the network disk that I was synching against. It was called ".... orig" or something along that line. They both showed the exact 100 pictures in each folder, one real and one ghost.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I could see the <i>original</i> network disk directory from the Tiger machine, with contents.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Then I moved synching to the Snow Leopard machine, with iTunes 10. I had to point it to the picture folder of folders on the network disk. After synching the particular folder had gone on the iPhone!</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I deleted the iTunes picture data base, and thousands of pictures were rebuilt - but that particular folder was still invisible, both from the Snow Leopard machine and iPhone.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I noticed that both the smb and afb mounts from above showed me the picture folder on the network disk - but it was always empty. I checked access rights all over the place but couldn't find anything. I could not move the directory around, with error (-43) because it could not find the files.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">But from Tiger I could move it! (Remember all the other <i>folders</i> were visible on both machines, any mount). But I could not delete anything on Tiger, got error (-50). Tried to restart the disk server on the Airport Extreme. Nothing helped.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Until I made a copy of the folder from Tiger. That copy was fully visible also on Snow Leopard. Then I deleted the original from Tiger, which I now was allowed to! Then I renamed the copy back to the original name. </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Then all was visible, and I synched the iPhone from Snow Leopard - and the folder appeared again! </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">HW connected: see top of note.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Also reported to <a href="http://www.apple.com/feedback/macosx.html">http://www.apple.com/feedback/macosx.html</a> </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="color: red;"><b><span class="Apple-style-span" style="font-size: large;">Related problem - iPhone synching picture fails on 3G, not 3GS</span></b></span></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I just synched my wife's and my own iPhone. She has a 3GS (iOS 4.2.1) and I have a 3G (also iOS 4.2.1). We have separate picture folders on a network disk, connected to an AirPort Extreme (with 7.4.1, see blog <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html">004</a>, post 5 and 6).</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I had created two directories from the iBook running Tiger, one on her sector and one one mine. I synched from a Mac Mini running Snow Leopard. I used iTunes 10.2. All this was done on 6Mar11 with all sw up to date.</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><i>The picture folders were visible on the 3GS. But not on mine, even after an iPhone restart.</i> </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I tried an "old trick" by now: <i>from the Mini</i> I duplicated the directiory on my "sector", deleted the original and renamed it back to the same name. Now it worked! Now also I have the "47 Feb 11" album!</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I noticed that iTunes reported that it deleted pictures and then synched some after my "duplicate, delete and rename" exercise! It could look like iTunes saw the pictures on the 3G, but the 3G didn't?</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I <i>shouldn't</i> create new directories on a network disk used by iTunes on another machine!</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Also reported to <a href="http://www.apple.com/feedback/iphone.html">http://www.apple.com/feedback/iphone.html</a> </div><div class="separator" style="clear: both; text-align: left;">And referenced at <a href="http://oyvteig.blogspot.com/2009/07/014-notes-about-iphone.html#014.16">http://oyvteig.blogspot.com/2009/07/014-notes-about-iphone.html#014.16</a></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="color: red;"><b>Update: an experiment that went fine</b></span></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">I accessed the network disk that iTunes uses from all three <b>machines</b>: the two with Tiger (iBook G4 and lamp iMac) and one Snow Leopard (Mac Mini). I made a directory with one file from each machine. The files were also originally created on those machines from Grab. Then I duplicated the three <b>album</b> directories into three <b>unit</b> directiories, one for each unit: iPhone 3G, iPhone 3GS and iPad 2 picture synch directories. After synching -<span class="Apple-style-span" style="color: blue;"> all three album directories were visible on all three units.</span> </div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">This was with iTunes 10.2.1, and it exposed the rather peculiar behavior to have <i>all</i> units' pictures redone (thousands times three). (<span class="Apple-style-span" style="color: red;">Update 1</span>: next day it scaled and synchronized all the pictures <i>again</i>! For both iPhones and iPad. Remember, they do have separate picture directories, and <i>nothing has changed from yesterday</i>. Not even the in-logging to the network drive. (6April11)) (<span class="Apple-style-span" style="color: red;">Update 2</span>: I <i>think</i> that since I use a network disk, the unneccessary re-synching came because the same disk was mounted both with <b>smb</b> and <b>afp</b>. See further up in this post. When I removed the afb mount, iTunes again only synched what it should and not <i>all</i>.) (<span class="Apple-style-span" style="color: red;">Update 3</span>: Was this fixed with iTunes <a href="http://support.apple.com/kb/DL1103">10.2.2</a>? "<span class="Apple-style-span" style="color: #333333; font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif; font-size: 12px; line-height: 18px;">Resolves an issue which may cause syncing photos with iPhone, iPad, or iPod touch to take longer than necessary</span>".)</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">This blurs the previously original point: that the picture directory had to be created from the Snow Leopard machine to be visible on 3G. I observed this again two days ago when I synched with the exact same versions as today. (5April11)</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Also reported to <a href="http://www.apple.com/feedback/iphone.html">http://www.apple.com/feedback/iphone.html</a> (twice)</div><div class="separator" style="clear: both; text-align: left;">.</div></div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-86346201332128858712010-08-21T22:51:00.108+02:002013-01-06T18:40:14.854+01:00019 - Play (with) network-disk based iTunes library?<h3>
<span style="color: red;">This note is updated at my new blog space only, blog note </span><a href="http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/">http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/</a><span style="color: red;">. Welcome there!</span></h3>
Updated 5Nov2011<br />
<br />
This post is a follow-up from my post <a href="http://oyvteig.blogspot.com/2010/04/018-from-concrete-cds-to-abstract.html"><span class="Apple-style-span" style="color: black;"><i>018 - From concrete CDs to abstract iTunes files. And now the old amp broke</i></span></a>. Things have now become somewhat clearer for me. I now seem to know the questions - and some answers!<br />
<br />
<b><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#fig1" name="fig1"></a><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="color: red;">Fig. 1 - Obsoleted physical architecture. See it <a href="http://www.teigfam.net/oyvind/blogspot/019/fig1.jpg">here</a> </span><span class="Apple-style-span" style="color: red;"><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#fig1">::</a></span></b></span></b><br />
<br />
<b><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#fig2" name="fig2"></a><span class="Apple-style-span" style="color: red;">Fig. 2 - Present architecture </span><span class="Apple-style-span" style="color: red;"><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#fig2">::</a></span></b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/019/fig4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/019/fig4.jpg" /></a></div>
<b><span class="Apple-style-span" style="color: red;">Before Nov. 2011:</span> <a href="http://www.teigfam.net/oyvind/blogspot/019/fig2.jpg">http://www.teigfam.net/oyvind/blogspot/019/fig2.jpg</a></b><span class="Apple-style-span" style="color: red;"><b><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-weight: normal;"><br /></span></span></b></span><br />
<div>
<span class="Apple-style-span" style="color: red;"><b>Present architecture</b></span></div>
<div>
<span class="Apple-style-span" style="color: red;"><b><br /></b></span></div>
<div>
July 2012: I have added <span class="Apple-style-span" style="color: red;">Apple TV</span> and thrown out JackOSX because it did not seem stable on Lion. (I am not able to update the old Mini to Mountain Lion.) So, the figure above is not updated, but see a new and simpler figure at note <a href="http://oyvteig.blogspot.no/2011/07/027-experiencing-apple-airplay.html">027</a> "Experiencing Apple AirPlay" - and some points about Apple TV.</div>
<div>
<br /></div>
<div>
<span class="Apple-style-span" style="color: red;"><b>Previous architecure</b></span><br />
<br />
Now, all iTunes files are located on a network disk and the Media center (Mac Mini) is running the iTunes as Master while the other machines run iTunes as Slaves. I have dropped the pseudo multiclient architecture described in <a href="http://oyvteig.blogspot.com/2009/01/003-shared-itunes-library-on-network.html">003 - Shared iTunes library on a network disk</a> when iTunes went on to version 10.x but iTunes on Tiger machines now have stopped at version 9.x (Sept. 2010). There is a small description of the new architecture in the blog 003 ref above (blue text there).<br />
<br />
The stereo now is a Denon Ceol RCDN-7 with AirPlay, new June 2011. See blog <a href="http://oyvteig.blogspot.com/2011/07/027-experiencing-apple-airplay.html">027 Experiencing Apple AirPlay</a>.<br />
<br />
I also see the Apple's plug-in solution with the Remote app works like a dream! The whole library in the hand, with music graphics and all I sure have learned since I, half a year ago, deemed that solution as not practical!<br />
<br />
But I had to (or have to?) quarrel with firmware updates to get there! See <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html#004.5">004.5</a> and <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html#004.6">004.6</a>.<br />
<br />
In Nov. 2011 I gave up on Airport Extreme with a USB connected NAS disk for an Apple Time Capsule with internal disk instead. See <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html">004 - Living with a network disk in the house</a>.<br />
<br />
<i><span class="Apple-style-span" style="font-style: normal;"><b><span class="Apple-style-span" style="color: red;">How I got here</span></b></span></i><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="color: blue;"><br /></span></div>
The goal is to be able to play our music (and view the CD covers) on all the units above: the Media center, the Laptop and Desktop, the Stereo and the Portable (sitting permanently on the fridge). The existing local net should be used as much as possible. There should be as little direct cabling as possible, like analogue, USB or FireWire or opto-coupled TOSLINK (S/PDIF).<br />
<br />
Also, the Stereo should be controllable from the Media center and Laptop. And the Stereo should be able to stream "sound out" from those two units, meaning that we could have better sound while viewing TV or running iTunes on the Laptop - since they are all in the same room.<br />
<br />
A <i>goal</i> is to only require the <i>Airport Extreme and Network disk to be constantly running. </i>So, the Media center should not run to be able to listen to the Portable or Stereo. So, I hope not to have to install some server on the Media center to convert from iTunes file reading to datastreams. (Update: iTunes version conflict (above) and JackOSX (below) have already changed this for me!)<br />
<br />
The users would be me and my wife. Children are satisfied with the the wifi when they are visiting. And grandchildren are satisfied with what we are satisfied with, for now. If wishes coincide, then one of us must at best yield to earphones, since the iTunes <i>files</i> are readable from several sources, but the iTunes <i>client</i> is not multiclient. However, radio, internet radio, TV, DVD or a book would be acceptable alternatives, as well as the <a href="http://www.teigfam.net/oyvind/hob/woodwork.html"><span class="Apple-style-span" style="color: black;"><i>basement shop</i></span></a> - or a good walk. Please observe that a "5.1 home cinema system" or a "wireless multiroom music system" is not what we're after! However, we might end up using a component from one of these.<br />
<br />
Units in need of replacement<br />
<ul>
<li>Stereo</li>
<li>Portable</li>
<li>The audio switch</li>
</ul>
Then existing units, still in good working condition:<br />
<ul>
<li>Media center computer ("Mini"): Intel Mac Mini with Mac OS X Snow Leopard (10.6.4) (Also controlled from the other machines with a VNC client). This may be replaced later with a newer Mini, one that plays full size AVCHD films</li>
<li>Laptop: G4 iBook with Mac OS X Tiger (10.4.11) </li>
<li>Desktop: G4 «Lamp» iMac with Mac OS X Tiger (10.4.11) </li>
<li>Airport extreme router and disk server: 7.4.1 (7.4.2 is unstable for this usage) </li>
<li>The Screen: is a full LCD TV with tuner taken out of use since the shut-down of analogue airborne tv in Norway in 2009. But it has a HDMI and a DVI input which fit exactly to the Decoder and Mini</li>
<li>TV sound: is terrible as with most LCD tvs, and a pair of Logitech active PC speakers with subwoofer unit are still small enough and good enough for a tenfold enhancement by all measures. But the Stereo is much better, but too old these days.</li>
<li>Other units, as seen in the figure</li>
</ul>
Other<br />
<ul>
<li>CDs are already obsoleted, as they have all been imported to iTunes. But they are still their own best backup! However, music is dowloaded more and more from iTunes Store </li>
<li>DVDs are still kept and played on the Media center</li>
</ul>
Some existing problems<br />
<ul>
<li>50 Hz hum. The Mac Mini has a TOSLINK opto-coupled and analogue audio output. Since the audio switch does not have a TOSLINK input, I use the analogue connection. Since the switch is also connected to the Screen, then I get hum, barely audible at normal distance. And the switch is not a switch, it's a Logitech volume control box with 3.5 mm aux input, which does not disconnect the other source (TV) when the input jack is inserted. I need a better solution! (This could have been solved with a Logitech Z-5500 Digital 5.1 Speaker System which has a SPDIF/TOSLINK-input - but it's completely overkill)</li>
<li>When I want to play music in iTunes on the Laptop and want some more power, I use a cable from it to the existing Stereo's line input. Surprisingly there is no audible hum. But for a new Stereo I'd need a better solution!</li>
<li>There is no way at the moment to play TV sound on the Stereo. Wiring it is no viable alternative.</li>
<li>Likewise, there is no way to play the Mini's sound on the Stereo</li>
</ul>
Questions and answers<br />
<ul>
<li>Yes, I use iTunes for my music handling. I am not afraid, as I believe iTunes and Facebook both lock us in, to count two of them<a href="http://www.wired.com/magazine/2010/08/ff_webrip/all/1">The Web Is Dead</a>")</li>
<li>Streaming of "my?" music with a Spotify client I seldom do. If all I needed resided "in the cloud", some problems would go and some come - and some stay. The architecture I describe already streams a lot, internally and externally - like internet radio stations. So, when iTunes comes with streaming services, so be it! I would still not delete the music library on the network disk, and still wonder if I ever find time to import all the legacy 33 rpm record albums.</li>
<li>No, I have no plan to switch to Windows, Windows Media Player or Winamp. I know they're good and that people are satisfied with them. Fine!</li>
</ul>
I am studying <a href="http://jackaudio.org/">http://jackaudio.org/</a><br />
<ul>
<li>It supports Mac OS X "Core Audio" (<a href="http://www.applelinks.com/index.php/more/jack_os_x_jack_audio_connection_kit_implementation_for_mac_os_x/">ref</a>), which I learned about in note <a href="http://oyvteig.blogspot.com/2010/04/018-from-concrete-cds-to-abstract.html">018</a>.</li>
<li>It references <a href="http://www.jackosx.com/">http://www.jackosx.com/</a> "Jack OS X - a Jack audio connection kit implementation for Mac OS X. Connecting audio from any OS X application to any OS X application"</li>
</ul>
I also sent a letter to one of the JackOSX authors, who forwarded it to the <b>Yahoo! jackosx group</b>. See <a href="http://tech.groups.yahoo.com/group/jackosx/message/3109">http://tech.groups.yahoo.com/group/jackosx/message/3109</a>. I am now (again) registered as <a href="http://profiles.yahoo.com/aclassifier">aclassifier</a> there. I certainly hope there will be lots of help! I also am <a href="http://forums.sonos.com/member.php?u=33404">aclassifier</a> at Sonos.<br />
<br />
I have now dowloaded JackOSX onto the Media center (Mini).<br />
<ol>
<li>I now don't have to use the "switch" any more. Hum is gone</li>
<li>The TV sound now comes into the Media center (Mini), and is being routed by JAR (Jack Router), to the line (headphone) output to the Amp (unlike Rogue Amoeba's Airfoil there is no notisable delay, so it's actually useful for tv listening)</li>
<li>Setting up routing with the <u>JackOSX Connection Manager</u> is nice but has to be learned: push one end and then double-click the other end to connect. And stereo means connection '1' and '2' for "left" and "right"</li>
<li>The Mini has to run all the time, since it's not practical to take the Mini out of idle to switch on the TV. I wish I didn't have to. The Mini is very silent, i.e. I can't hear the fan with the present power</li>
<li>The JackRouter does not have a volume control. But the Mac OS X Sound config dialogue box shows that the Line-in and Headphone-out (used as "Line-out") both have. Line-in volume is set in that window only. Headphone-out volume may be set in that dialogue box, in the top Menu line, or with the Remote control. Perhaps this is called the Master or Main volume control? Then, if I connect Line-in to Headphone-out via JackServer (in the JackOSX Connection Manager) - then the<u> Remote control works both for iTunes, DVD and TV</u>! Of course the TV may also be controlled with the Tuner's Remote control, or the Screen's Remote control or Logitech's main control which is a nice <i>physical</i> knob which always works! (See figure below, where I assume that Norwegian should be little problem, Apple's graphics does most by itself)</li>
<li>TV and iTunes could sound <u>simultaneously</u>. It's not enough to switch. One has to turn something on and something off. However, switching the Screen to the Media center disconnects the TV sound, since it comes through the HDMI to the "TV"</li>
<li>Another thing: it's possible to run this sw invisibly. Stopping the JackPilot stops the Connection manager and the Pilot window but not the JackOSX server. Nice!</li>
</ol>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/019/fig3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://www.teigfam.net/oyvind/blogspot/019/fig3.jpg" /></a></div>
<br />
This is nice but rather complex. Next problem is to find a way to export a data stream to the Stereo and Portable. The JackOSX network module is not in the download since the authors are still(?) working on it. It's got to be more complex. Hmm<br />
<br />
<b>Yazsoft is not it</b><br />
<ul>
<li>I am looking at the Yazsoft media server <a href="http://yazsoft.com/">http://yazsoft.com</a> (which probably reads CoreAudio from JackOSX server?) and exports UPnP data streams..</li>
<li>..which may be read by a Stereo, being an Arcom Solo unit, see <a href="http://www.arcam.co.uk/products,solo,Music-Systems.htm">http://www.arcam.co.uk/products,solo,Music-Systems.htm</a>. </li>
<li>The Sonos ZonePlayer ZP120 I cannot see is able to read UPnP datastreams? </li>
<li>The best of the two worlds would be to find something that sees the network disk iTunes library <i>and</i> UPnP datastreams?</li>
</ul>
<b>Darwin Streaming Server is not it</b><br />
<br />
The Darwin Streaming Server does not seem to solve my needs See <a href="http://dss.macosforge.org/">http://dss.macosforge.org/</a>. I found this from reading <a href="http://en.wikipedia.org/wiki/Comparison_of_streaming_media_systems">Comparison of streaming media systems</a> at Wikipedia. Here is from macosforge's documentation:<br />
<blockquote>
The streaming server supports QuickTime Movie (MOV), MPEG-4 (MP4), and 3GPP (3GP) "hinted" files. Hinting is a post-process that you apply to your movies to make them RTSP-streamable. You can hint them with QuickTime Pro or the hinting tool available in the MPEG4IP package. If you don't hint your .mov's or mp4's they will still be <u>HTTP-downloadable but it will take them some seconds to start playing. You won't need a streaming server for this, just use good old Apache</u>. (<a href="http://dss.macosforge.org/post/40/">http://dss.macosforge.org/post/40/</a>)</blockquote>
<b>"Good old Apache"</b><br />
<br />
Ok, maybe? Entering a url to a datastream <i>plays</i> that datastream. Starting an Apache server is a matter of ticking in a dialogue box. But then, that's not all I want.<br />
<br />
<a href="http://www.blogger.com/post-edit.g?blogID=1348782545935329144&postID=8634620133212885871" name="airplay"></a><b><span class="Apple-style-span" style="color: red;">Apple AirPlay</span></b> <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#airplay">::</a><br />
<br />
Update July 2012: I added an <span class="Apple-style-span" style="color: red;">Apple TV</span> unit. See my new note <a href="http://oyvteig.blogspot.no/2011/07/027-experiencing-apple-airplay.html">027</a> "Experiencing Apple AirPlay".</div>
<div>
<br /></div>
<div>
Apple has already had the <i>AirTunes</i> streaming protocol some time, somewhat discussed in my previous note. I discarded it as pretty uninteresting there.<br />
<br />
However, the follow-up protocol <i>AirPlay</i>, introduced by Steve Jobs in Sept. 2010, looks more promising. (Maybe he saw the despair in the notes..).<br />
<br />
Apple informs about AirPlay at their <a href="http://www.apple.com/itunes/airplay/">page</a>. There's also a <a href="http://en.wikipedia.org/wiki/AirPlay">wiki-page</a>, of course. Read those now.<br />
<br />
Apple say that there will be "featured partners" like "<a href="http://www.denon.com/">Denon</a>, <a href="http://www.marantz.com/">Marantz</a>, <a href="http://www.bowers-wilkins.com/">B&W Bower & Wilkins</a>, <a href="http://www.jbl.com/">JBL</a> and <a href="http://www.ihomeaudio.com/airplay/"><span class="Apple-style-span" style="color: red;">iHome</span></a>" who will produce units that understand the AirPlay protocol. (Most of these companies are "so international" that they present top-level pages pointing to countries, where I found no AirPlay info (7Sept10). But the <span class="Apple-style-span" style="color: red;">red</span> should be interesting.)<br />
<br />
A company called Frontier Silicon develops solutions for modern radios, like the Pinell Supersound II (<a href="http://oyvteig.blogspot.com/2010/04/018-from-concrete-cds-to-abstract.html">blog 18</a>). I would be surprised not to see AirPlay appear from those sources. Not many (any?) present systems will support AirPlay, so I'll have to wait to see it included. It might be worth it. As one of the major vendors answered my question in a closed User group: "Will nn support AirPlay in any of your products?" with the reply "We don't know yet.. with our current line of products it's not possible."<br />
<br />
Please see <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html#fig1">fig.1</a> and the following (above).<br />
<br />
So, why do I think this is for me?<br />
<br />
Before I answer, I have a general worry here. See "Rogue Amoeba's Airfoil" (below). It routes AirPlay sound. However, it needs to insert a delay in the sound so that it can be heard in phase on all AirPlay units across the home wired or wireless network. In other words, the tv should also have delayed the video, like Rogue Amoeba's built-in Airfoil Video Player. So, in order to distribute tv, I would have to wait for a tv with builr in AirPlay? So, my general wish to have one audio routing sw only may not be easy to get for a while?<br />
<ol>
<li>I can play iTunes on any machine and treat my new Stereo (with AirPlay!?) as an external speaker, just like with Airport Express. Nice!</li>
<li>It would work over WiFi and Ethernet. So, the Portable (with AirPlay) could equally be an external speaker! </li>
<li>I would be able to stream also from iPhone to any of these units!</li>
</ol>
And what would I certainly <i>hope</i> for?<br />
<ol>
<li>I would hope that I also could take the sound from my tv and pick it up (via JackOSX server?) and route that sound also to the Stereo and Portable. In other words: it would also stream non-iTunes streams. I can't see why this should be a problem, I can already play radio url's in iTunes. (Update 3Jan11: see above, AirPlay probably delays sound like Rogue Amoeba's Airfoil, so this is not really possible?)</li>
<li>I would hope that the Stereo and the Portable, which do not have iTunes (but support AirPlay) would also be able to serve as a client, i.e. I would be able to browse the iTunes library, with artwork and info and all - without running iTunes on any machine. Like how the Sonos ZonePlayer ZP120 would (I have assumed) be able to read my network disk based iTunes library</li>
<li>I would certainly hope that the AirPlay sources would be available under <a href="http://dss.macosforge.org/">macosforge</a>. That way, any programmer like myself or the JacOSX people could get it going as well! Update: forget it! This most probably needs an AitPlay chip to run.</li>
</ol>
Posted to <a href="http://www.apple.com/feedback/itunesapp.html">http://www.apple.com/feedback/itunesapp.html</a><br />
<br />
Interesting reading is "Forget Apple TV. AirPlay Is Apple's Sneak Attack On Television" at <a href="http://m.gizmodo.com/5634087/forget-apple-tv-airplay-is-apples-sneak-attack-on-television">Gizmodo</a> which tells that there's a hw chip needed(?) for AirPlay - and asks if it will coexist with UPnP, DNLA, and Windows 7 streaming. That article points to this <a href="http://www.bridgeco.com/blog/">BridgeCo</a> blog. Read on!<br />
<br />
There also is an interesting post "AirTunes v2 UDP streaming protocol" at <a href="http://blog.technologeek.org/airtunes-v2">http://blog.technologeek.org/airtunes-v2</a><br />
<br />
<b><span class="Apple-style-span" style="color: red;">Rogue Amoeba's Airfoil (for Mac) seems to be AirPlay companion</span></b><br />
<br />
Conclusion: since I must also run the JackRouter, I don't need Airfoil before we also buy AirPlay hw. And then I would need to run both JackRouter (for tv) and Airfoil (for sound only or video played with the built-in Airfoil Video Player).<br />
<br />
It seems like I could "Send any audio from your Mac to AirPort Express units, Apple TVs, iPhones and iPods Touch, and even other Macs and PCs, all in sync!" with Rogue Amoeba's Airfoil for Mac. I will test <a href="http://www.rogueamoeba.com/airfoil/mac/">http://www.rogueamoeba.com/airfoil/mac/</a>. It may even outfunction the JackRouter. (The new version 4 in late 2010 seems more interesting than the version of Aug. 2010 when I first discovered it, partly because my target has moved..)<br />
<br />
However, "Airfoil recognizes only AirPlay (formerly AirTunes) devices" (reply to support mail). Therefore Airfoil sw will not see or be seen by Sonos devices, since Sonos doesn't support AirPlay with their present range of hw (as of late 2010).<br />
<br />
Rogue Amoeba does not have any white paper to describe Airplay's sw architecture. "As for a white paper, no, sorry" (reply to support mail).<br />
<br />
In my architecture TV sound comes in on sound system input. There is no point in taking "live" sound from that input! Simply because Airfoil delays all inputs by some 1-2 seconds. They need to do it like this so that they can play the music at different locations over the wired or wifi local network with all speakers in phase. Even if AirPlay may be designed for real-time response, since they run on top of ip or wireless protocols I don't see how they could ensure unnotisable delay. With regards to the fact that I'd like one sw sound component only, this worries me! Maybe I'll have to run JackRouter for tv sound and Airfoil for iTunes in the future? (This is the reason why they have a separate Airfoil Video Player, so that they can delay the video playback as much as sound playback.)<br />
.<br />
.<br />
.</div>
aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-3787685131735060232010-04-24T20:49:00.064+02:002013-01-06T18:39:52.327+01:00018 - From concrete CDs to abstract iTunes files. And now the old amp broke<h3>
<span style="color: red;">This note is updated at my new blog space only, blog note </span><a href="http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/">http://www.teigfam.net/oyvind/home/technology/050-sound-on-sound-and-picture/</a><span style="color: red;">. Welcome there!</span></h3>
<b><span class="Apple-style-span" style="color: red;">Latest (Aug.2010)</span>: </b><span class="Apple-style-span" style="color: #20124d;">This post is a discussion with myself, and has mostly been closed. Read<i> </i></span><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html"><span class="Apple-style-span" style="color: #20124d;"><i>019 - Play (with) network-disk based iTunes library?</i></span></a><span class="Apple-style-span" style="color: #20124d;"> as the next and more mature chapter.</span><br />
<br />
My excuse for keeping this blog somewhat unorganized is that it is being written <i>now</i>, while I try to get organized. I am writing it to help me get organized. And, perhaps you could reckognise your situation?<br />
<br />
<b>Intro: how? to play my music</b><br />
<br />
What can help, now that my LP vinyl collection has been stacked away for almost 20 years, and I have reached "9.5 days" of playing with CD import to iTunes, and still have a "day or two" left to import? In other words: I don't have to get more CD shelf space, it's opposite: I need less and less. In practice this also means that the the old Denon CD player DCD-680 will be out of use pretty soon. And it probably won't even be kept as a spare, as has been the old 33 rpm LP player. It was bought when I acquired the CD player, to make it possible to play LPs indefinitely. It still works. However, since CDs can be played (or imported) on any PC or Mac, I am uncertain about the short-term fate of the CD player.<br />
<br />
And - for a some time now the old Denon DRA-335R radio and amplifier has been getting rusty in its voice, i.e. broken for any real world listening.<br />
<br />
<i>The times they are a'changin</i>, sings Dylan on one of the CDs. Yes, they still are. But how do I cope?<br />
<br />
<b>The new backbone: a network disk with iTunes library</b><br />
<br />
My new backbone is not the shelf with plastic, but a network disk with iTunes files, and a good backup scheme. See blogs [1] and [2]. It's available over wifi , but I have also wired all necessary spots. We use the wires most: it's faster, and we swim in less radio waves (set to 10% power).<br />
<br />
But I have to move on with the blog. I'll start off with an example, and then perhaps later on try to set up a <i>specification</i>.<br />
<br />
<b>Background</b><br />
<br />
Sonos have a great box called ZonePlayer ZP120 [3]. What's in it for me?<br />
<br />
When I say "me" I really mean "us": my wife and me, with no children in the house any more, but they come along visiting, some with grandchildren. How should our new "stereo" be like?<br />
<br />
First, we're not talking about a home movie theatre, and no 5.1 surround sound. Not in our living room, and not in any other either. We go to the cinemas, watch tv, and we watch internet tv and DVDs using a Mac Mini and the tv as a screen. The central here is a multimedia rack I made a while ago [4].<br />
<br />
However, we are talking about iPhones with playlists. They play home made movies and music in their iPod applications. Quite nice. There is a subtle integration here, with the living room. Even the car. Perhaps also with my workshop in the basement. But how should I do this?<br />
<br />
<b>Scenario 1: <span class="Apple-style-span" style="color: red;">ZonePlayer ZP120</span>?</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/018/fig1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="292" src="http://www.teigfam.net/oyvind/blogspot/018/fig1.jpg" width="320" /></a></div>
This unit could easily replace the old amplifier. It's got a nice Class D amplifier [5] that I'd really <i>like</i> to own, and more than enough power. Power output for stereospeakers and a line subwoofer outputs. It connects to our home's wired network, which is nice - and reads files as well as radio stations out there. It also has wifi, but only over a proprietary SonosNet protocol.<br />
<br />
There is a remote control for it, but it costs more than half of the unit. However, a free iPhone App also controls it, and that would help. Especially since we have a first generation iPod touch laying around.<br />
<br />
Sonos would read iTunes playlists, once it's told by a Mac/Windows application called "Sonos Desktop Controller" where the iTunes library is located (where the file "iTunes Music Library.xml" is located). Even if it's on the home network disk. So, none of my machines need to run while Sonos streams music from the iTunes-loaded network disk. I like it. So, this software does set-up and it also is remote player client or control system for the ZonePlayer. They even say that it shows CD covers, also while playing iTunes [17]. The sw seems to have changed name since I first started this blog. Now (Aug.'10) it's called "Sonos Controller for Mac or PC".<br />
<br />
However, it doesn't play DRM and WMA lossless files. So, <i>some</i> of my songs would not be seen. I have not studied the percentage I loose there.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
On the other side Apple has this Airport Express that has the feature that it appears as an iTunes output channel [6]. Apple's protocol (<i>AirTunes</i>, in Sept. 2010 replaced by <i>AirPlay</i>, see <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">note 19</a>) is probably not any more standard than the SonosNet. The iTunes would stream to that unit, and I could connect the 3.5mm jack output to the ZonePlayer's input. The Airport Express also functions as a TOSLINK optical digital connector over the 3.5 mm jack [7]. This is beautiful to avoid hum - but the ZonePlayer only has RCA inputs, so I would need an optical PCM to analogue converter to use it [7]. This is a substantial extra cost. Also, a limitation with the Airport Express is that I can only stream from iTunes wirelessly, not via cable. However, the good thing is that Airport Express would be available from any machine that runs iTunes that sees the network disk.<br />
<br />
So, how about connecting the output from the Mac Mini (which also has TOSLINK) to the ZonePlayer? With 10 m of analogue wire, I would rather not. I already have a little hum from not using the TOSLINK output to the little Logitec Z4 that replaces the sound from the Samsung tv. When I switch it to the Mac Mini, that's when the hum comes - since I have not used the supplied TOSLINK. The hum is small, but I may hear it on a bad day. But, as mentioned, I could use 10m of optical and an optical PCM to anlogue converter box [7] here. The cost is about 40% of the price of ZonePlayer ZP120.<br />
<br />
I am confused. Buy a ZonePlayer just for the amp? Buy another little amp? Use two user interfaces, one for the ZonePlayer and one for iTunes? Drop iTunes? How big is the Sonos lock-in effect. Now that the iPhones already lock us in, I'd not want more!<br />
<br />
(Any system would probably <i>try</i> to lock a user in, ref. Gödel and Russell - and the laws of capitalism. So, trying to be outside one could easily be locked <i>out</i>, which is just another kind of lock-in? Standards or lack of standards also cause lock-in.)<br />
<br />
I would suggest you also read David Pogue's article in NYTimes [9].<br />
<br />
<b>Scenario 2: Just an amplifier: <span class="Apple-style-span" style="color: red;">Denon DRA-F107</span>? </b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/018/fig2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="http://www.teigfam.net/oyvind/blogspot/018/fig2.jpg" width="320" /></a></div>
This unit costs half of the ZP120. But if I add 10m of optical cable and the optical PCM to analogue converter [7] the only gain is a little lower price and the simplicity. As you understand, there is no TOSLINK input here, no digital audio input. DRA-F107 has a phono input from my still kept record player, to play LPs. It also has an FM radio, and DAB+ may be ordered. It also has a remote controller, somewhat easier than the AppStore remote app. ZP120 has internet radio, but no phono input.<br />
<br />
This unit is smaller than the two old Denon 43 cm width units, but a little wider than ZP120.<br />
<br />
I want to keep the small speakers we have: Bang & Olufsen Beovox CX50 [8]. I bought new elements in them some years ago, and the play quite well. But I would like a subwoofer in addition, since the CX50 are only 2.5 liter internally.<br />
<br />
<b>How easy should it be to play a song?</b><br />
<br />
A. Before<br />
<ol>
<li>Hmm, I'd like to play a record</li>
<li>Where is it, I think I placed it here. Darn, it's too dark, I can't find the CD.</li>
<li>There it is!</li>
<li>Switch on the units</li>
<li>Push in the CD</li>
<li>Find the song and play!</li>
</ol>
B.1 iTunes with help from external amplifier (before <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">Post 019</a>)<br />
<ol>
<li>Hmm, I'd like to play a record</li>
<li>Start the Mac and iTunes (I never switch it off, so I only need to wake it up)</li>
<li>Switch TV to become Mac mini screen</li>
<li>Since I played iTunes on another machine before, I must wait until iTunes library has been updated</li>
<li>Select speakers: the local PC/TV speakers or the nicer across the 10m optical cable</li>
<li>Switch that system on</li>
<li>Play</li>
</ol>
B.2 iTunes when <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">Post 019</a> is much easier (all already runs, machine and iTunes):<br />
<br />
<ol>
<li>Hmm, I'd like to play a record</li>
<li>Start Apple's "Remote" app your own iPhone (or iPod)</li>
<li>Or use the remote control that came with the Mac Mini to continue playing. Observe I haven't switched on the Mac Mini's tv screen</li>
<li>Play (it may take some seconds before the network disk spins)</li>
</ol>
<br />
C. iTunes files only with ZP120<br />
<ol>
<li>Hmm, I'd like to play a record</li>
<li>Switch on Sonos ZP120</li>
<li>Find the iPod and start the remote control App</li>
<li>Have it connect to the ZP120</li>
<li>Wait until the network disk is seen by ZP120</li>
<li>Find the song in the list</li>
<li>Play</li>
</ol>
I don't know which is fastest, but I suspect A. So, why not keep the old CDs? Because I cannot and want not stop the world alone. I see that with a ZP120 I also have the choice between B and C. But with DRA-107 I only have B.<br />
<br />
<span class="Apple-style-span" style="font-weight: bold;">Longevity of living-room music playing instruments</span><br />
<br />
So, how technical should it be? It is good that a two year old grandchild never would be able to start her favourite music alone (B and C, above). And I, being a computer programmer, in a way don't like B and C. They are not usage elegant! Just technically elegant!<br />
<br />
But maybe they are, after all, two steps ahead and only one back. And I won't come to half way by going two ahead and one back, but I'll come to another place. In iTunes I will be able to see the full collection at once, with front covers. I can search and group and play across albums with playlists. I can easily move music to iPhones etc.<br />
<br />
But is iTunes here in five or ten years? I do keep two networks disks: one connected and in the house, the other in another house, which carry over and mirror some times per year. I also have a copy on a machine in house. How do I know that my backup is a valid backup? Of the CDs there was no backup: lost is lost. Hmm.<br />
<br />
And how is ZP120 updated? For how long?<br />
<br />
Any system that needs backup and centralized storage needs an "adminstrator". That's me in this house! But will I survive my wife, and if so, admin myself? We're still only 60 young, but age is volatile. Hmm.<br />
<br />
<b>Ok, I need switch: <span class="Apple-style-span" style="color: red;">Presonus Firestudio Mobile</span> or <span class="Apple-style-span" style="color: red;">Apogee Duet </span>or <span class="Apple-style-span" style="color: red;">iMic</span>?</b><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.teigfam.net/oyvind/blogspot/018/fig3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="202" src="http://www.teigfam.net/oyvind/blogspot/018/fig3.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
I want to play iTunes directly from the external disk without any machine. And I want the same speakers to play music from any (?) machine playing iTunes, or any sound from any machine! And I want no hum from them. And I don't want to stream the music over WiFi. Seems like I'm starting to understand what I need?</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
Here are some products that could help. I could place one of these units beside the Sonos player, and any one of them could be of great help. The Presonus (left in the picture) unit takes both FireWire and S/PDIF (TOSLINK) inputs. I don't think it shows up as an external speaker on my Mac, and that I need Presonus sw to be able to stream music out on that FireWire? However, the Apogee Duet will turn up as an external sound unit because it supports Mac OS X Core Audio. </div>
<br />
<div class="separator" style="clear: both; text-align: left;">
Thinking about excatly the last point. I have a very old now, iMic USB Audio Interface from Griffin Technology. I have enjoyd it for 8 years, sitting next to a Lamp Mac that I love. It connects to USB and has 3.5 mm stereo input and also output. So it also must support Core Audio, and has since Mac OS X 10.3 I think it was! The iMic is still a product! </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
However, none of the products function as an USB, FireWire or optical switch. And I have to have wires from each machine up to the ZP120. Am I getting closer, or am I just learning?</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Another thing: FireWire or USB from a remote machine, and analogue out into ZP120 - I have a feeling I would still get some hum! </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I probably either want an optical switch or to stream music from a sound "http driver" directly into ZP120? That would be nice! One url from each machine! I think I will continue my search. Maybe I'm only a driver away! No extra hw!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>New knowledge: UPnP - Universal Plug and Play</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Maybe the UPnP - Universal Plug and Play [11] (for Mac, for me) comes to the rescue?</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
A. C. Ryan has a box that seems to read UPnP servers [12]. There is a lot about iTunes and the like at the discussion thread [13], "iTunes streaming". There is pointed to Allegro [14] and Yazsoft [15] Media Servers for Mac. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
And I must find out if Sono ZP120 reads UPnP. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>More new knowledge: DLNA - Digital Living Network Alliance</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This is an alliance that defines and looks after protocol usage(?) [16]. There is a connection between UPnP and DLNA that I'll have to find out about. More later, since "knowledge" in the headings is very exaggerated. I'll have to learn this!</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Sonos Controller for Mac or PC</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This is s <i>client</i> to control the ZonePlayer (see above). It is <i>not a server</i> that helps me stream music from an other machine, which is what I am discussing at this stage.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Jack Audio Connection Kit</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Just for the record for myself, this is very interesting, and I will certainly look into this more in my <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">next note</a>. Here is a quote from [18]:</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<blockquote>
<b>What is JACK?</b></blockquote>
<blockquote>
Have you ever wanted to take the audio output of one piece of software and send it to another? How about taking the output of that same program and send it to two others, then record the result in the first program? Or maybe you're a programmer who writes real-time audio and music applications and who is looking for a cross-platform API that enables not only device sharing but also inter-application audio routing, and is incredibly easy to learn and use? If so, JACK may be what you've been looking for.</blockquote>
<blockquote>
JACK is system for handling real-time, low latency audio (and MIDI). It runs on GNU/Linux, Solaris, FreeBSD, OS X and Windows (and can be ported to other POSIX-conformant platforms). It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a "plugin"). JACK also has support for distributing audio processing across a network, both fast & reliable LANs as well as slower, less reliable WANs.</blockquote>
<b>Logitech Squeezebox™ Touch</b><br />
<br />
Closing this name throwing, here is the last piece I need for homework for my next note: the Logitech Squeezebox™ Touch. It takes physical connections as well as works as a streaming client. See [19]. There's also the Logitech Squeezebox Radio, which I will need to look more into.<br />
<br />
<b>An "on the fridge" type radio: Pinell Supersound II</b><br />
<br />
I'll watch out for this in my next note. It's a Norwegian radio, but it looks interesting. See [20]. It also reads UPnP streams. It turns out that Pinell is using a "turnkey solution" from Frontier Silicon [22] for their units.<br />
<br />
<b>Finally</b><br />
<br />
I will try to connect all this in the next note <i><a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">019 - Play (with) network-disk based iTunes library?</a></i><br />
<br />
<b>References</b><br />
<br />
[1] - Blog post: <a href="http://oyvteig.blogspot.com/2009/01/003-shared-itunes-library-on-network.html">003 - Shared iTunes library on a network disk</a><br />
<br />
[2] - Blog post: <a href="http://oyvteig.blogspot.com/2009/02/004-living-with-network-disk-in-house.html">004 - Living with a network disk in the house</a><br />
<br />
[3] - Sonos: <a href="http://en.wikipedia.org/wiki/Sonos">http://en.wikipedia.org/wiki/Sonos</a><br />
<br />
[4] - Furniture design an building: <a href="http://www.teigfam.net/oyvind/hob/8/index.html">Multimedia rack</a><br />
<br />
[5] - Class D amplifier: <a href="http://en.wikipedia.org/wiki/Class_d_amplifier">http://en.wikipedia.org/wiki/Class_d_amplifier</a><br />
<br />
[6] - Apple Airport Express and <i>AirTunes</i>: <a href="http://en.wikipedia.org/wiki/AirPort_Express#AirTunes">http://en.wikipedia.org/wiki/AirPort_Express#AirTunes</a>. In Sept. 2010 replaced or expanded into the <i>AirPlay</i> protocol, see <a href="http://oyvteig.blogspot.com/2010/08/019-play-with-network-disk-based-itunes.html">note 19</a><br />
<br />
[7] - TOSLINK optical connection: <a href="http://en.wikipedia.org/wiki/TOSLINK">http://en.wikipedia.org/wiki/TOSLINK</a><br />
PCM decoding from Mac Mini: S/PDIF: <a href="http://en.wikipedia.org/wiki/S/PDIF">http://en.wikipedia.org/wiki/S/PDIF</a><br />
PCM adaptor: <a href="http://en.wikipedia.org/wiki/PCM_adaptor">http://en.wikipedia.org/wiki/PCM_adaptor</a><br />
Box to convert optical S/PDIF or TOSLINK digital audio to L/R analog audio:<br />
Gefen Digital Audio Decoder DD D/A-converter: <a href="http://www.gefen.com/kvm/dproduct.jsp?prod_id=5980">http://www.gefen.com/kvm/dproduct.jsp?prod_id=5980</a><br />
<br />
[8] - Bang & Olufsen Beovox CX50 <a href="http://www.beoworld.org/prod_details.asp?pid=482">http://www.beoworld.org</a><br />
<br />
[9] - David Pogue (The New York Times), "No ‘System,’ but Music Housewide" - <a href="http://www.nytimes.com/2009/11/19/technology/personaltech/19pogue.html?_r=3">http://www.nytimes.com/2009/11/19/technology/personaltech/19pogue.html?_r=3</a><br />
<br />
[10] - Denon DRA-F107: <a href="http://www.hifiklubben.no/produkter/stereo/receivere/denon_dra-f107_receiver_sort.htm">http://www.hifiklubben.no/produkter/stereo/receivere/denon_dra-f107_receiver_sort.htm</a><br />
<br />
[11] - <b>UPnP</b> - Universal Plug and Play: <a href="http://en.wikipedia.org/wiki/UPnP">http://en.wikipedia.org/wiki/UPnP</a><br />
<br />
[12] - A.C. Ryan - PlayOn! Media player: <a href="http://www.playonhd.com/en/">http://www.playonhd.com/en/</a><br />
<br />
[13] - Thread "iTunes streaming" - <a href="http://www.acryan.com/forums/viewtopic.php?f=98&t=4029&p=41492">http://www.acryan.com/forums/viewtopic.php?f=98&t=4029&p=41492</a><br />
<br />
[14] - Allegro Media Server for Mac: <a href="http://www.allegrosoft.com/ams.html">http://www.allegrosoft.com/ams.html</a><br />
<br />
[15] - Yazsoft Media Server for Mac: <a href="http://yazsoft.com/products/playback/">http://yazsoft.com/products/playback/</a><br />
<br />
[16] - <b>DLNA</b> - Digital Living Network Alliance: <a href="http://en.wikipedia.org/wiki/Digital_Living_Network_Alliance">http://en.wikipedia.org/wiki/Digital_Living_Network_Alliance</a><br />
<br />
[17] - Sonos Controller for Mac or PC - <a href="http://www.sonos.com/products/controllers/desktopcontroller/default.aspx?rdr=true&LangType=1033">http://www.sonos.com/products/controllers/desktopcontroller/default.aspx?rdr=true&LangType=1033</a><br />
<br />
[18] -<b> </b>Jack Audio Connection Kit - <a href="http://jackaudio.org/">http://jackaudio.org/</a><br />
<br />
[19] - Logitech Squeezebox™ Touch - <a href="http://www.logitech.com/en-us/speakers-audio/wireless-music-systems/devices/5745">http://www.logitech.com/en-us/speakers-audio/wireless-music-systems/devices/5745</a><br />
<br />
[20] - Pinell Supersound II - <a href="http://www.pinell.no/">http://www.pinell.no</a><br />
<br />
[21] - Comparison of streaming media systems: <a href="http://en.wikipedia.org/wiki/Comparison_of_streaming_media_systems">http://en.wikipedia.org/wiki/Comparison_of_streaming_media_systems</a><br />
<br />
[22] - Frontier Silicon: <a href="http://www.frontier-silicon.com/">http://www.frontier-silicon.com</a> - used by "practically all major consumer electronics brands, including Bang & Olufsen, Bose, Bush, Cyrus, Denon, Goodmans, Grundig, Harman/Kardon, Hitachi, JVC, Magic Box, Ministry of Sound, Onkyo, Panasonic, Philips, Pioneer, Pure, Revo, Roberts, Samsung, Sanyo, Sharp, Sony, TEAC and Yamaha".<br />
<br />
.aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-82106144306327047492010-04-13T22:18:00.036+02:002011-06-24T20:48:15.817+02:00017 - Safari and Opera Mini on iPhone/iPad<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><b><span class="Apple-style-span" style="font-weight: normal;">This blog will show how a table intensic page (my home page at <a href="http://www.teigfam.net/oyvind/">http://www.teigfam.net/oyvind/</a>) is rendered on the iPhone by Safari and Opera Mini. Naturally, for 10 years the page has been my private browser "acid" test. Since there are billions of other pages to compare with, I'll stick to this.</span></b><br />
<br />
<table border="1" cellpadding="2" cellspacing="0" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><b><span class="Apple-style-span" style="font-weight: normal;">Observe that <span class="Apple-style-span" style="color: red;">iPhone (original, 3G, 3GS, </span><span class="Apple-style-span" style="color: blue;">4</span><span class="Apple-style-span" style="color: red;">) has a 3/2 screen (480/320) or (</span><span class="Apple-style-span" style="color: blue;">960/640</span><span class="Apple-style-span" style="color: red;">)</span> while <span class="Apple-style-span" style="color: red;">iPad (1,2) has a 4/3 screen (1024/768)</span>. My index file uses table layout to percentage of screen, not pixel counts. Except for icons, which <i>have to</i> be pixel-defined. H, T, P and F are also graphics. </span><span class="Apple-style-span">Opera tries to use some heuristics for the small screens, which are basically not successful. Safari does what it's told and does not attempt to be smart, which is super.</span></b></td></tr>
</tbody></table><br />
<b><span class="Apple-style-span" style="color: red;">1 - Initial version of Opera Mini</span></b><br />
<ul><li>Safari on iPhone 3G 3.1.3 (7E18)</li>
<li>Opera Mini Web browser, v5.0 </li>
<li>13 April 2010</li>
</ul>Verdict: Presently I will use Opera if I need to search for text in a page, need to read it off-line, or have to download a large page with per-MB cost over my phone connection (good speed and also optionally no pictures). This means that I'll mostly stick to Safari, since it's also an iPhone Application<i>, not a port. </i>One "star" for this version.<br />
<ul></ul><b><span class="Apple-style-span" style="color: red;">1.1 - Safari has always been super</span></b><br />
<br />
<table border="0" cellpadding="2" cellspacing="2" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Safari" src="http://www.teigfam.net/oyvind/blogspot/017/001_safari.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 320px; width: 480px;" /></a></td> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Safari" src="http://www.teigfam.net/oyvind/blogspot/017/002_safari.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 320px;" /></a></td> </tr>
</tbody> </table><br />
<b><span class="Apple-style-span" style="color: red;">1.2 - Opera Mini on iPhone was bad</span></b><br />
<br />
<table border="0" cellpadding="2" cellspacing="2" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/003_opera.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 320px; width: 480px;" /></a></td> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/004_opera.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 320px;" /></a></td> </tr>
</tbody> </table><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b><span class="Apple-style-span" style="color: red;">2 - iOS 4 with Opera didn't help as Opera was the same</span></b></div><ul><li>Safari on iPhone 3G 4.0.1 (8A306)</li>
<li>Opera Mini Web browser, v5.0 (5.0.0119802 2010-05-06)</li>
<li>26 July 2010</li>
</ul>Safari is new, but the layout is 100% equal.<br />
Also no change in Opera Mini's layout. It's the same version so that's hardly no surprise.<br />
<br />
<b><span class="Apple-style-span" style="color: red;">3 - Opera Mini 6 on iPhone is getting better</span></b><br />
<div style="text-align: left;"></div><ul style="text-align: left;"><li>iPhone 3G, iOS 4.2.1</li>
<li>Opera Mini 6.0.0.13548</li>
<li>22 June 2011 (the file has modified contents, of no importance)</li>
</ul><table border="0" cellpadding="2" cellspacing="2" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/006_opera.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 320px; width: 480px;" /></a></td> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/005_opera.png" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 320px;" /></a></td> </tr>
</tbody> </table><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b><span class="Apple-style-span" style="color: red;">4 - Opera Mini 6 on iPhone 4 oops! and getting better</span></b></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><ul style="text-align: left;"><li>iPhone 4, iOS 4.3.3</li>
<li>Opera Mini 6.0.0.13548</li>
<li>24 June 2011</li>
<li>Showing two standing pictures here. Same iOne</li>
<li>Left screen cut reported to <a href="http://mini.bugs.opera.com/">http://mini.bugs.opera.com/</a></li>
</ul><table border="0" cellpadding="2" cellspacing="2" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/009_opera_iphone4.jpg" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 320px;" /></a></td> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/010_opera_iphone4.jpg" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 320px;" /></a></td> </tr>
</tbody> </table><br />
<b><span class="Apple-style-span" style="color: red;">5 - Opera Mini 6 on iPad is super</span></b></div><ul style="text-align: left;"><li>iPad2, iOS 4.3.3</li>
<li>Opera Mini 6.0.0.13548</li>
<li>23 June 2011</li>
<li>The pixel real estate available is about the same as on the iPhone 4, yet layout here is super. Do Opera Software use another algorithm, on board iPad or on their layout server?</li>
</ul></div><table border="0" cellpadding="2" cellspacing="2" style="text-align: left;"><tbody>
<tr> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/008_opera_ipad.jpg" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 360px; width: 480px;" /></a></td> <td style="vertical-align: top;"><a href="http://www.teigfam.net/oyvind/"><img alt="Opera" src="http://www.teigfam.net/oyvind/blogspot/017/007_opera_ipad.jpg" style="border-bottom-style: solid; border-bottom-width: 0px; border-color: initial; border-left-style: solid; border-left-width: 0px; border-right-style: solid; border-right-width: 0px; border-top-style: solid; border-top-width: 0px; height: 480px; width: 360px;" /></a></td> </tr>
</tbody> </table></div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0tag:blogger.com,1999:blog-1348782545935329144.post-43861994215180559132010-03-17T21:25:00.017+01:002020-10-26T20:12:37.502+01:00016 - Cooperative scheduling in ANSI-C and process body software quality metrics<div><span style="caret-color: rgb(102, 102, 102); color: #666666;">Moved to </span><a href="https://www.teigfam.net/oyvind/home/technology/016-cooperative-scheduling-in-ansi-c-and-process-body-software-quality-metrics/" style="caret-color: rgb(102, 102, 102);">https://www.teigfam.net/oyvind/home/technology/016-cooperative-scheduling-in-ansi-c-and-process-body-software-quality-metrics/</a></div>aclassifierhttp://www.blogger.com/profile/16906423831624285447noreply@blogger.com0