vừng ơi, mở ra!

Tình hình là vẫn code cho đến tận ngày cuối năm Dương, và ngồi setup cái máy tính mới! Dù sao thì xài con laptop $3000 để thay thế cho vai trò của desktop một cách tạm bợ, từ ngày này sang ngày khác như vậy cũng thấy hơi xót, đến lúc cũng nên trang bị một máy desktop cho đúng nghĩa, công nhận chip M2 chạy cực lẹ…

Nãy cấu hình máy, đến phần username / password, định đặt pass là “open sesame” – tiếng Việt tức là: “Vừng ơi, mở ra!” (truyện Alibaba và 40 tên cướp), nhưng thấy pass dễ đoán quá nên thôi! Năm mới đang đến, hy vọng mọi thứ cũng sẽ… “Vừng ơi, mở ra”! Chúc mọi người năm mới… thân tâm an lạc, vạn sự như ý!

iphones 3, 4, 5

Dọn dẹp nhà cửa lòi ra mấy cái này, nguyên cái sảnh 3, 4, 5, một số vẫn còn xài được, giờ thì nó đã ra sảnh Đầm, Già, Xì rồi… Thế là đánh dấu gần 15 năm chuyển đổi qua hệ Mắc, Xinh và Tốt (Macintosh), hồi tưởng với cảm xúc lẫn lộn! Nhớ hồi đó ông sếp hỏi: em làm được không, mà chưa đụng đến máy Mac bao giờ? Trả lời: cho em 10 ngày sẽ xong việc, nói rồi vác xe chạy đi mua cái máy Mac, về cài Xcode, rồi lọ mọ đi học Objective-C…

Cũng giống như học võ vậy, nếu căn bản vững vàng thì ngôn ngữ, công nghệ gì cũng không quá quan trọng! Em rất sợ những người huyên thuyên trên trời dưới đất về công nghệ, giải pháp, triết lý, cái gì cũng biết… mà cuối cùng… không code được! Nói tới nói lui, rút cuộc “căn bản” là cái gì… bỗng dưng nhớ lại lời một ông thầy hồi đại học: dân làm toán chúng ta, nôm na gọi là đi “chẻ sợi tóc làm 4″…

games

Thực ra viết con game để chơi là phụ, chính yếu vẫn là muốn thử nghiệm các kỹ thuật khác nhau với “lambda function – anonymous function – hàm không tên”!

Tự viết con game Solitaire này mấy năm trước, nhưng lười, không bỏ lên AppStore. Game mà tôi tự viết để tự chơi thì cũng khá nhiều, viết vì kiếm không được game tương tự đúng ý, cái thì quảng cáo quá nhiều, cái thì đồ hoạ quá xấu, cái thì nặng nề, tốc độ quá chậm, chạy không mượt, mà tôi chơi Solitaire, mấy ngón tay bấm liên hồi như đánh piano vậy! Trò Solitaire chuẩn chơi trên máy Windows tối đa chỉ 24K điểm, nhưng cầm cái iPad mà chơi thì trên 30K điểm là chuyện thường! Game này viết chỉ một source code, chạy trên tất cả các nền Apple (Mac, iPhone, iPad…), làm cái engine sẵn, đọc game rules từ file lên, hiện tại hỗ trợ đến 99 biến thể (variant) Solitaire khác nhau!

Nhớ lại đợt Sài Gòn giãn cách XH vì Covid-19, suốt ngày chỉ có chơi game giải trí, hoặc làm mộc, cưa bào, đục đẽo để vận động tay chân! Nói về chơi game, căn bản đó không phải là chuyện gì xấu, nhưng tôi thường chỉ chơi game logic đơn giản, mỗi ngày chơi 15 ~ 30 phút tối đa, không chơi các game có kịch bản hay những game mất quá nhiều thời gian! Tác hại của game đối với giới trẻ không cần phải nói, nhưng lỗi không nằm ở game, lỗi ở xã hội và giáo dục, tạo ra cho chúng nó một môi trường nghèo nàn, một tâm hồn trống rỗng, như cái lỗ đen sâu hoắm, nên ngoài những thứ vớ vẩn, nhảm nhí ra, chúng nó không còn biết điều gì khác, riết rồi thành thần kinh, bệnh hoạn và tệ nạn!

panorama

Hồi đó, không nhớ là năm nào, xài cái iPhone 4S (dạng cũng rất hiện đại lúc đó) chụp ảnh panorama, chất lượng tệ, không hài lòng nên đi mua cái Sony NEX5R, chiếc máy ảnh không gương lật đầu tiên, chụp panorama khá tốt. Hôm nay thử dùng chỉ 1 cái iPhone 7 cũ rích chụp pano thử xem, cho ra một cái ảnh 15000 x 4000 pixel (chờ ảnh load hơi lâu), má ơi, đúng là mình lạc hậu về công nghệ thật rồi! Haiza, đúng là thời thế, công nghệ đi quá nhanh, đẹp hơn hẳn máy ảnh chuyên nghiệp ngày xưa!

P/S: nói có vẻ ngược đời, nhưng từ xưa giờ vẫn quan niệm rằng: tôi chẳng cần phải biết cái éo gì về công nghệ cả! Tôi chỉ biết về kỹ thuật (techniques) thôi! Vâng, nói rõ ràng như vậy! Tôi chỉ biết những mánh mẹo, kỹ xảo lập trình xa xưa, những thủ pháp cấu trúc dữ liệu, tối ưu hoá li ti, thời của “programming pearls” – những viên ngọc lập trình ấy! Coder giờ toàn ở “trên trời”, công nghệ này kia, AI, Machine learning, Big data, nói như vẹt, chỉ có điều mấy cái “căn bản” lại không biết!

Ảnh lớn, cuộn theo phương ngang để xem.

the man of wisdom delights in water…

仁者樂山
智者樂水

Written with a Bamboo stylus on iPad, using my inking mentioned earlier! A quote from Confucius’ Analects, and its partial, literal equivalence in English on this post’s title. Looks like there’s still lots of space for improvements on creating real, good looking strokes (for Chinese round brush and other kinds of brushes). Really discontent with my Chinese handwriting, it’s never been good enough for me, it’s been degrading greatly over time without practicing! My handwriting reflects my messy, chronically — undisciplined character!

inking

My proudly – announced achievement for the last 6 working months, now is a registering (pending) patent in the U.S. It’s about create inking effect to handwriting on iPad (ideally with a stylus): you can apply many pen styles: ball pen, fountain pen, calligraphy pen, Chinese round brush, and different levels of ink wetness. You may have seen my handwriting in severalpreviousposts, but this is completely different, a big step forward, much more a realistic look like ink on paper. You need to see it in action to witness how interesting the “beautification effect” it is!

Different pen styles:

Different ink wetness:

Another writing example, a poem in both Vietnamese and Chinese:

And now, a real world application, my new year greeting card, hand – written on iPad, printed on paper, with my signature and personal seal on it. Old vintage things are not to be perished, they just come back in new neoclassical forms, to have “inflated”, “degraded” contemporary values reprimanded!

styli

I was playing around with some iPad’s styli lately: the Wacom Bamboo stylus, TruGlide, Adonit Jot, Adonit Jot Touch, Jaja, Cregle’s iPen and ByZero. I’ve been loving the smoothness of Bamboo, but TruGlide is really an excellent one! The new Adonit Jot Touch seems to be promissing, and on the second position is Jaja (for pressure sensitive styli).

wwdc 2012

It would start within a week from now, the well – expected event of Apple’s world – wide developers conference of 2012 – WWDC 2012. To welcome the tech fair, on the left is a screen capture of what I’ve been working hard on for the whole last month (the video is not really clear since it’s shot with my phone), a photo browser UI like iPad’s Photos app. It takes time to learn insights into Core Graphics, Core Animation, and I’m still learning. For all those years of graphics I’ve been through, Apple UI and its graphics sysem are still sooo… brilliant and amazing to me! (and “our love has just begun”!) Keep heading North!

chuyện tình tự kể

Ngày nào, cho tôi biết, biết yêu em rồi, tôi biết tương tư, sau đây là câu chuyện tình tôi tự kể, ngày nào, biết mong chờ, biết rộn rã buồn vui đợi em dưới mưa… Chúng tôi quen nhau tính về thời gian chưa phải là quá lâu, chỉ một vài năm gì đó. Nhưng nguồn cơn, nguyên do câu chuyện có lẽ đã được vun vén, manh nha từ lâu rất lâu về trước, tôi thương em dễ có từ thủa mẹ về với cha.

Bao giờ biết tương tư - Tuấn Ngọc 

Những lý do, ngọn nguồn chẳng thể nào mà giải thích và truy nguyên cho được đã dần đưa chúng tôi lại với nhau tự lúc nào. Tình yêu nào rồi cũng sẽ đi qua nhiều thăng trầm, đã có lúc tôi cảm giác chẳng hiểu gì về em, nhiều khi sự khó khăn của em làm tôi nản chí, cũng có khi tôi đã hoang mang, nghi ngờ em và chính mình.

Nhưng với tình cảm chân thành, bằng trực giác tự nhiên mách bảo, chúng tôi đã vượt qua nhiều sóng gió, để đến một ngày: ngày nào, cảnh thiên đường, đã mở hé tình yêu là trái táo thơm, tôi ghé răng cắn vào… Đến đây thì hẳn các bạn đã đoán ra nàng thơ của tôi tên là… Apple –  hiện diện trên các MacBook, iPhone, iPod, iPad xinh xắn!

writing on the margins

This is just a post of my truly nonsense and random thought. Some notions are just interesting in their own forms, like writing on the margins or sub luna saltamus – dance beneath the moon… I just particularly like the phrase writing on the margins, the action and its meaning, that’s why this website layout is designed with that notion in mind, the left column is reserved for additional and complementary information, as side notes along main content.

Take a look at the two iPad’s screenshots on the left and you would see how nice it is, writing on the margins in a modern and digital form, especially when you could still use your own handwriting with it. You may have noticed the two classical masterpieces (one in mathematics and the other in literature) referenced in those notes!

the new ipad

Just got the new iPad (or we called it: the iPad 3) in hand today and I’m stunned by it’s new retina display. There’s not such a fever like when the iPad 2 was released, I guess since the new iPad is almost identical to iPad 2 in appearance, people will consider about the fact that they won’t be able to show it off. In term of general performance, iPad 3 does not stand out to the previous iPad, or it could be worse in term of 3D – OpenGL performance according to some reviews. From a programmer’s point of view, this could easily be understood since doubling the resolution means 4 times the memory and processing power for each graphics API, which also means Apple has been pushing things over the Moore law’s limit!

Personally I’m not really a passionate fan of these Mắc – Xinh – Tốt (Macintosh) assets, but professionally as a computer – graphics coder, I’ve always admired the prestigous 2D graphics tradition come with Apple’s products. Back to the retina display, on the left is a reduced – size screenshot of this blog taken on the iPad 3 (see full version here, it would take some times to load).

2048 x 1536 is a huge resolution that does magic to the vector things, e.g: displaying fonts! Not only the screen is much sharper, even at first look, its color tone appears to be truer, and the new iPad gamut covers 44% more into the sRGB color space compared to the previous iPad. The second picture: funny capture of Walter Isaacson’s Steve Jobs autobiography put on – top the God of Wealth’s altar in our office!

⓵⏎Mắc – Xinh – Tốt: a phonetical transcription of the name: Macintosh, which is a play–on–words, Mắc means: expensive, Xinh means: cute and Tốt means: good in Vietnamese.


ios-widgets

Having written myself numerous UI widgets, from simple to complex, from Windows to Linux, from 2D to 3D… but I’ve just started writing iOS widgets not too long ago. Making iOS widgets is really fun, for we have supports from the most powerful 2D graphics system ever built, that is CoreGraphics (Quartz 2D). The code, hosted on github, is released under MIT license, check it out for a demo project, I hope that these widgets would be useful somewhere, but yes, I know, don’t complain about the code quality, most is written in a rush and still have flaws in it, use at your own discretion!

1.   XFilePathHeader

This tabular header let you quickly browse a hierachy structure (like file system directories). The levels are shown as tabs, tap on a tab to jump to a parent folder, tap on the “Home” icon to jump to root folder.

2.   XSegmentedControl

The Apple’s standard UISegmentedControl only displays text, not image. This class lets you use image along with text (or image or text alone) in any orders (image then text, or text then image).

3.   XProgressTextField

This is a copy of Safari’s address textfield which shows a progress bar while the webpage is loading. Would continue to add more of these miscellaneous tiny widgets just for fun when I have time.

handwriting

This is part of the really fascinating broader concept of neo – analog as mentioned in a previous post. Below is my handwriting with a stylus on my iPad (click to see large version), not too bad after 10 years of solely keyboard and mouse, not pen, right? Also, I’m quite excited with the coming Kindle touch (which should be delivered at end of the month). My thought is that it’s just a matter of time before e – ink would have color and refresh rate capabilities near those of conventional displays, and serious applications would be feasible within the vintage look and feel of e – ink!

vectorial

The classical SVG example rendered using a thin OpenVG layer on top of OpenGL (or Quartz) on a Mac. This is also to say goodbye to the old Lunar year (year of the tiger) that is ending!

Finished with my survey on vectorial graphics, in details, about rendering SVG using Quartz, OpenGL (ES) on Mac, iOS and some Android flatforms. I’d had the chances to systematize more my knowledge on vectorial: path, stroke, anti – aliasing, solid, gradient and pattern fill, etc… Todays, people’s all talking about 3D, OpenGL, DirectX, etc… While few mentions much about 2D stuffs, I’ve traced back some historical evolution paths, since I believe that it’s through history would we understand technologies.

In the beginning, there was… PostScript

It was John Warnock who kindled the idea, he joined Xerox in 1978 and an early version of PostScript (named InterPress) became the language to drive a laser printer. Laser printer was then a revolutionary device, which offers extraordinary graphics compared to the capability of dot or matrix printers. Warnock left and founded Adobe in 1982, the company that produced well – known graphics softwares including Illustrator, king of the vectorial editors.

Then there was DPS, PDF and Quartz

But it was Steve Job who realized the superiority of PostScript and urged John Warnock to popularize it. When Steve Jobs left Apple and started NeXT, he co – developed with Adobe DPS – Display PostScript, a derivative of PostScript – the language that drives the NeXT computer’s graphics system. When Steve has got back to Apple, DPS then evolved into what is now known as PDF, and Quartz is the C binding that bridges traditional Unix programmers to the Mac graphics world.

The X window system

The X’s designers also started with a PostScript RedBook in hand. But due to various reasons including the lack of in – depth consensus about vectorial, X maintains until now low level of PostScript support. The X server can only handle basic PostScript commands (it can’t even draw splines). X took a hybrid approach using both vectorial and raster – based solutions to the problem. Also the Unix root has an impact: X is the only true client/server windowing system to the current day.

Until now, the NeXT computer remains an idealistic symbol, pure vectorial remains a pursuit, perhaps for higher – standard devices, such as with this Backbone:

Backbone is an attempt (our attempt) at creating a Really Good Desktop. The metric we use for “Really Good” is our own. In short, to us, to carry on the NeXTSTEP® and OPENSTEP® spirit!

The Windows’ GDI

Born to be the youngest of all graphics systems, GDI learns nothing from it predecessors. Neither it is device and resolution independent (like Macs) nor a true client/server system (like X). GDI sticks to screen and the pixel unit with quite a lot implementation flaws. These flaws won’t become obvious until we come to serious editing, publishing and printing: text documents and graphics designs would never has the on – screen – display and printing qualities we would expect, though various 3rd party softwares would come to rescue somewhat the situations.

Then, things change with time

The 2D graphics systems on Mac, Windows, Unix… all has different origins, and all targets different real – world problem domains. All has hardware acceleration to various levels and qualities, and it’s hard to compare them in some cases. To the present day, no system is known to keep the original idealistic model that uses pure PostScript: X has been mixed from the beginning, Mac & iOS have switched to raster to some extent, GDI is essentially pixel – based. Then come the wind of change! It would be another story, another evolution path, but today, 3D hardwares has become quite popular with reasonable prices. It’s counter – intuitive to treat 2D as a separate part from 3D, and the trend is merging 2D to become a subset of 3D rendering. However, the process hasn’t been very easy, it would take some more time to reach maturity:

  • WPF (Windows Presentation Foundation): first came with Windows Vista, GDI now runs as part of DirectX 3D rendering environment. Vista was not a success indeed!

  • QuartzGL: Quartz2D runs on top of OpenGL since OS X 10.2 (Jaguar). However, QuartzGL is not enabled by default even in the current version (10.6 – Snow Leopard) since it’s still quite buggy.

  • GLX & AIGLX: both has some implementation problems and is competing to each other to become the official 3D extension for X.

Taken an arbitrary GDI’s API (such as MoveTo, LineTo…) we can see the parameters’ type is integer, which is in reality the pixel unit. The Quartz’s counterparts are always in float, a virtual unit so that the APIs can be device and resolution independent.

The so called “GDI printer” is actually a bitmap device, it lacks a PostScript interpreter and hence need to be attached to a computer to do the actual computing. Reason is obvious: cheapness, adding a PostScript interpreter would significantly raise the cost!