Recent blog postshttp://paulojorgepm.net/rss.atom2024-02-09T16:35:10ZWerkzeug3D Bingo Browser Gamehttp://paulojorgepm.net/blog/232024-02-09T16:35:10ZPaulo Jorge PM<p>Feel in the mood to play Bingo? If so, I got you, 3D Bingo in the browser at: <a href="http://paulojorgepm.net/sites/bingo-game/" target="_blank">Website</a></p>
<p>Note: slow server, be patient with the loading. Made for fun in a 3 days kind-of Jam with humble visual assets. Godot + Rust <3</p>
<p>Source-code at: <a href="http://paulojorgepm.net/sites/bingo-game/" target="_blank">Git</a></p>
<br>
<p><ul><li>Jump to my portfolio for more cool projects: <a href="http://paulojorgepm.net/portfolio">Portfolio</a></li></ul></p>
<br>
<p></p><iframe width="1280" height="720" src="https://www.youtube.com/embed/_TgPyEl2yyg?si=x-cXpKUrNNhBgJmZ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></p>
New year, new lifehttp://paulojorgepm.net/blog/222022-02-26T02:26:35ZPaulo Jorge PM<p>New year (2022), new life: </p>
<ul>
<li>Started working at <a href="https://viz.ai">Viz.ai</a>, developing software for saving lifes, loving it.</li>
<li>Personal projects milestone: a new open-source project (Entigraph) committed; E-Portfolio Social Network website progressing.</li>
<li>Had the most beautiful baby girl in the world day 12/01/2022 <3</li>
<li>Moved to Coimbra (and soon do Condeixa) - but plan on getting back to the glorious North some years from now.</li>
<li>Work on my Indie Game projects goes on.</li>
<li>One Piece is reaching Wano climax, long live the Pirate King!</li>
</ul>[2] Um poema por dia, nem sabe o bem que lhe faziahttp://paulojorgepm.net/blog/212021-08-09T15:19:52ZPaulo Jorge PM<p><b>Questions From a Worker Who Reads</b></p>
<p><span style="font-size:14px;">- By Bertolt Brecht, 1935</span></p>
<pre>
«Who built Thebes of the 7 gates ?
In the books you will read the names of kings.
Did the kings haul up the lumps of rock ?
And Babylon, many times demolished,
Who raised it up so many times ?
In what houses of gold glittering Lima did its builders live ?
Where, the evening that the Great Wall of China was finished, did the masons go?
Great Rome is full of triumphal arches.
Who erected them ?
Over whom did the Caesars triumph ?
Had Byzantium, much praised in song, only palaces for its inhabitants ?
Even in fabled Atlantis, the night that the ocean engulfed it,
The drowning still cried out for their slaves.
The young Alexander conquered India.
Was he alone ?
Caesar defeated the Gauls.
Did he not even have a cook with him ?
Philip of Spain wept when his armada went down.
Was he the only one to weep ?
Frederick the 2nd won the 7 Years War.
Who else won it ?
Every page a victory.
Who cooked the feast for the victors ?
Every 10 years a great man.
Who paid the bill ?
So many reports.
So many questions.»
</pre>Arquivo.pt: 1º Prémio http://paulojorgepm.net/blog/202021-06-20T15:19:52ZPaulo Jorge PM<p>Won the 1st prize in the "Arquivo.pt" FCCN national contest with the project “Major Minors”.</p>
<p>"Knowledge Graph (Web Ontologies) of press clippings from Portuguese newspapers with reference to minorities thematics, including a corpus of articles, comments and images, supported by Named-entity Recognition (NLP). The corpus covers thousands of newspapers articles from the first two decades of the 21st century. This project is supported by a Triple-store database, which is a graph representation of data, with semantic relevance/relations, supported by open-source SPARQL queries public to researchers."</p>
<ul>
<li>Newspaper: <a href="https://www.publico.pt/2021/06/17/ciencia/noticia/arquivopt-premiada-plataforma-recolhe-dados-minorias-jornais-1966463" target="_blank">Jornal Público</a>
</ul>
<br />
<p><iframe width="560" height="315" src="https://www.youtube.com/embed/oMs03zb8Hy8?si=vmrTdQyAPczfN7-1" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></p>Medical illustrationhttp://paulojorgepm.net/blog/192021-01-20T15:18:38ZPaulo Jorge PM<p>Some time ago I sketched a medical illustration (it was based on a source illustration and some bibliographical references which I don't remember anymore - I just redesigned with better resolution). It was forgotten in the depths of my computer. In case it is useful to someone, you are free to do with it what you please: in attachment you can find the original photoshop editable raw file. Open-source, free license.</p>
<p class="tags"><a href="http://www.paulojorgepm.net/static/images/illustrations/medical_illustration_1.jpg" target="_blank">Download JPG</a> <a href="http://www.paulojorgepm.net/static/images/illustrations/medical_illustration_1.psd" target="_blank">Download PSD</a></p>
<p style="text-align:center;"><img src="http://paulojorgepm.net/static/images/illustrations/medical_illustration_1.jpg"></p>[1] Um poema por dia, nem sabe o bem que lhe faziahttp://paulojorgepm.net/blog/182020-11-03T00:20:09ZPaulo Jorge PM<pre>«Que esta minha paz e este meu amado silêncio
Não iludam a ninguém
Não é a paz de uma cidade bombardeada e deserta
Nem tampouco a paz compulsória dos cemitérios
Acho-me relativamente feliz
Porque nada de exterior me acontece...
Mas,
Em mim, na minha alma,
Pressinto que vou ter um terremoto!»
<span style="font-size:13px;">- Por Mário Quintana</span></pre>Rust language - trending in 2020http://paulojorgepm.net/blog/172020-09-23T08:48:22ZPaulo Jorge PMI have been enamoring the Rust programming language for some years now. Never used it professionally but have been trying to do some pet projects on the side with it. I simply love the philosophy and community behind it. One could say that Rust is a reincarnation of Haskell for a modern public. But it is very recent (started on 2010 but got it's first stable industry ready version on 2015) and only recently we saw jobs searching for Rust programmers. I have been hoping for it to grow, it would be amazing to be able to use my pet language professionally, in the real world companies big guns.
For some years in a row (5 at least by my counts) it has won the StackOverflow most loved language survey (TypeScript, Python, Go and Kotlin have been next in the top 5 contenders). And this happens with a good reason: Rust is not just a new language with a new syntax in the block, it is a new paradigm trying to solve old hated problems with modern methods - low level system programming memory management is no more a gamble between performance vs risk for the developers. The majority of security problems and bug reports on systems come from memory management issues like buffer overflows, null pointer exceptions etc. Rust tries to solve it with new paradigms (e.g. introduces the concept of ownership for it's variables; has a very good and opinionated compiler, with the philosophy of preventing bugs before they happen - usually if your code compiles correctly with Rust and your logic is ok, it means it is ready to go, the compiler itself is like a test suite). Rust is a great contender for the C/C++ markets, because itself is a low level programming language with a focus on performance, but also competes with the middle ground (C#/Java) because it as a very good repository system (Cargo, similar to PIP or NPM) and a modern syntax with some functional style that can be used like an higher level language (it is not encouraged, but one can not declare variable types in some cases, because the compiler can infer them correctly most of the time; one can manage low level memory and open the hell doors, but if not explicitly declared the Rust compiler will protect the user from that).
In the end of the day, you have the C performance power, without the security/bug risks and with a modern syntax and tools. And the community is awesome, Rust have been improved by academics and very smart people at Mozilla. It was built to remake Firefox into a more secure and faster browser. Along the way it has been slowly adopted in interesting projects (e.g. the NPM repository system for JS were rewritten in Rust, in order to improve the performance and security/bugs - there are some nice talks on conferences from the team behind it about it that you can find on youtube; the videogame community has also trying to embrace Rust in order to replace C++, many good game engines have emerged and some companies have publicly declared it).
Well, but at the end of the day this kind of momentum and promises have been announced many times before and never C/C++ have seen a scratch to their supremacy. One saw this with Hasckel before for example, but nowadays it is not much more than an academics curiosity. I believed on Rust potential but was afraid that it would go the same road. 4 years ago it was not even in the top 50 TIOBE index (note: it started in 2010, but only in 2015 it went from alpha to 1.0 stable version, so it is a very recent language). But in recent years, after the stable version, many good libraries were created with it (very good async libraries; Rust was a pioneer with the Web Assembly support; very good web frameworks with top benchmarks; interesting voice recognition projects; amazing videogame engines etc.), the Cargo (repo) ecosystem evolved a lot, and Rust were used in real world scenarios by big companies. Because of this the public is embracing Rust more and more, thrusting on it's future.
In 2016 it got to the top 50 languages in the TIOBE index. In 1st semester of 2020 it got to the top 20 place in the same ranking for the first time. At the moment (September) it seats at 18th. For a language so young this is very impressive. Recently I searched the September rankings and noticed that Rust is the language with the most growth of all compared to the past year: from September 2019 to September 2020 Rust grew 15 positions, a lot above the average (the 2nd place is for R that grew 10 positions, the 3rdt one is Pearl with 7 positions, followed by Dart with 4).
This kind of indexes should be taken with a grain of salt, because they don't reflect 100% the reality. TIOBE is based on searched sentences with special criteria on popular search engines. This does not necessarily reflects how many people are using it or it's health (e.g. one could search for Java on Google with the intent of knowing if it is dying or not, not necessarily for good reasons). But this trend of growing popularity can be found in other indexes with different systems, for example on GitHut 2.0, which indexes by the number of pull requests for each language, Rust is even higher in the 13th position of most used languages with the 3rd highest growth rate of 0.4% (only TypeScript and Go ahead). GitHut index system also does not reflect 100% the reality (many companies/projects don't use it). But again, in other popular index (PYPL - based on number of searches for programming languages tutorials), one can notice this trend again, Rust seats at the 16th position with a 0.3% growth rate trend (again one of the best ones, only in 2nd place with Python in first).
The future of Rust is looking more and more brighter. Some people compare it with Haskell, a promising beloved language growing very fast, with a passion from academics, but because of the similarities people also pray that it doesn't follow the same path in the end into oblivion. The current trends seam to show that Rust will succeed where Haskell failed, time to embrace it.
<p><b>Indexes sources:</b></p>
<a href="https://www.tiobe.com/tiobe-index/" target="_blank">TIOBE Index</a>
<a href="https://madnight.github.io/githut/#/pull_requests/2020/2" target="_blank">GitHut 2.0</a>
<a href="http://pypl.github.io/PYPL.html" target="_blank">PYPL PopularitY of Programming Language</a>
<p><b>Quote sources:</b></p>
<a href="https://gist.github.com/graninas/22ab535d2913311e47a742c70f1d2f2b" target="_blank">"What killed Haskell, could kill Rust, too" (by R. Martin)</a>
"Haskell was the language everybody wished they could program in, but nobody did, except for maybe a few people (...) Haskell ruled. (...) What killed Haskell, could kill Rust, too. Why would I even mention Haskell in this context? Well, Haskell and Rust are deeply related. Not because Rust is Haskell without HKTs. (Some of you know what that means, and the rest of you will wonder for a very long time). Much of the style of Rust is similar in many ways to the style of Haskell. In some sense Rust is a reincarnation of Haskell, with a little bit of C-ish like syntax, a very small amount."
Thinkpad P53 + SSD Kingston A2000 = Freezehttp://paulojorgepm.net/blog/162020-07-29T18:15:46ZPaulo Jorge PMI have been testing Ubuntu 20 LTS on a Thinkpad P53. The laptop had only a SSD with 512GB by default, so I added a Kingston A2000 with 1TB (NVMe), making it my main drive for Ubuntu, while the original one had Windows 10 for dual boot with GRUB in cases of rare necessity (I have been avoiding W10 for some time now, because I feel that it became to dictatorial, it changes user configurations after updates without consent, and it became to intrusive with marketing and data thief, and let's not talk about the days when one get in the morning to a meeting, boot up the beast and a 30 minutes update-install starts running, while everyone is waiting for you to start your presentation).
Unfortunately my experience with this new laptop didn't start with the right foot (before I had the P52s and loved it, almost perfect machine). I started noticing freezes in the middle of work, to the point nothing responded, even the keyboard lights (like CapsLock) stopped completely, only a forced reboot would solve it (magic key to the rescue Sysrq+Alt+B).
After some tests and try and error I found out the freeze occurred only under I/O operations with the SSD (copy pasting or compiling code for example). Linux SmartTools tests indicated that the SSD was healthy, so it was not physical. I updated the BIOS and the SSD firmware for the most recent versions but it didn't change anything.
The caused seams to be something related to the APST (power management), that interferes with the I/O heavy operations when the SSD is under load. A solution was to disable it directly in the Kernel load trough GRUB adding this parameter:
<code>nvme_core.default_ps_max_latency_us=0</code>
To this moment I had no more freezes after repeating the same tests. I am stil researching but this seams to solve it for now.
To apply it edit this file (with Nano for example):
<code>sudo nano /etc/default/grub</code>
On the line that reads «GRUB_CMDLINE_LINUX_DEFAULT="quiet splash» (depending on your system configuration it could change, this is the default on mine - just append to the end of the line with a space before in case you have additional parameters) add the parameter that disables the APST that interfered with the SSD. In the end it should be something like this:
<code>GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nvme_core.default_ps_max_latency_us=0"</code>
Update the GRUB by running:
<code>sudo update-grub</code>
And done, no more freezes on the Thinkpad P53 with custom SSD and Ubuntu 20 LTS.Worth watching #1http://paulojorgepm.net/blog/152019-07-02T23:58:43ZPaulo Jorge PM<p style="color:#333;font-size:0.8em;">I watch a ton of youtube videos and am always eager to find good channels to subscribe to, there is very high quality content out there. But in the midst of every day not always quality trumps quantity, so sometimes I wonder "if people posted more favourite youtube channels than selfies on facebook maybe it would be more useful to follow". In one of those moments of wondering I wondered: "I got bored with the blog, and it is dying alone in a dark corner of the internet, lets share there this idea and feed the poor fellow" - so this is how this blog series came to be: "Worth watching". From time to time, without order or theme, I will share a list with the 10 last videos I added to my favourites or remember watching and found interesting (maybe, I don't know, don't trust me - time doesn't exist so I already started this sentence with a lie, didn’t I?).</p>
<br>
<p><b>#1 <a href="https://www.youtube.com/watch?v=m6buIdQacoM" target="_blank" style="font-style:italic;">16 Levels of Piano Composition: Easy to Complex</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/m6buIdQacoM" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#2 <a href="https://www.youtube.com/watch?v=w5R8gduPZw4" target="_blank" style="font-style:italic;">David Foster Wallace on Ambition</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/w5R8gduPZw4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#3 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">I Waterproofed Myself With Aerogel</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/GcdB5bFwio4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#4 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">These photos ended child labor in the US</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/ddiOJLuu2mo" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#5 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">The Portal Paradox</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/B19nlhbA7-E" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#6 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">The Incredible Storytelling Of South Korean Reality TV</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/1Lng4dn1uAc" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#7 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">My Favorite Things Summer 2019</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/vLaHYE0XbEw" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#8 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">How Art Arrived At Jackson Pollock</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/Q1irNBh2qg8" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#9 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">3 awesome 'out of the box' exercises for your practice routine</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/wtkxLb9TEaE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<br>
<br>
<br>
<p><b>#10 <a href="https://www.youtube.com/watch?v=" target="_blank" style="font-style:italic;">Why You Can't Trust Me</a></b></p>
<iframe width="854" height="480" src="https://www.youtube.com/embed/UaGTFeibOEk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>Portfolio update: visual identity for an eventhttp://paulojorgepm.net/blog/142018-11-23T00:30:00ZPaulo Jorge PM<p>Just updated the <a href="http://www.paulojorgepm.net/portfolio">portfolio</a> section with new work: visual identity for an event called Autumn Colloquium. It is an annual colloquium (this year the thematic was “Peace and Freedom”) and for the past years I’ve been designing/programming stuff for it: website, posters, booklets, etc.</p>
<p>This year the result of my work is a <a href="http://cehum.ilch.uminho.pt/xxco" target="_blank">website</a> for registration/disclosure and a <a href="http://www.paulojorgepm.net/static/images/posters/original/xxco.jpg" target="_blank">poster</a>:</p>
<p><a href="http://www.paulojorgepm.net/static/images/posters/original/xxco.jpg" target="_blank"><img src="http://www.paulojorgepm.net/static/images/posters/thumbnail/xxco-mini.png"></a></p>
<br>
<p>I choosed as the motif for the design the famous photo of Thích Quảng Đức who burned himself to death, protesting the persecution of Buddhists by the South Vietnamese government led by Ngo Dinh Diem:</p>
<p style="text-align:center;"><img src="http://www.paulojorgepm.net/static/images/misc/monge_fogo.jpg"></p>
<br>
<p>An interesting side note: the “dictator” Ngo Dinh Diem was catholic (with some roots also on confucianism), and imposed those values on others, resulting in the persecution of other religions; his family was originally converted to catholicism by portuguese missionaries and priests forced conversions on the population – one could say that the portuguese indirectly contributed to these sad affairs in Vietnam, by interfering on their culture and native religion.</p>
<p>I always loved this photo, if I would make a list of the most important ones in the 20th century I would include this one for sure. Side note/curiosity: the band <em>Rage Against the Machine</em> also used this image as the cover of their first album. For this reason my initial plan was to also use a song from this band as the background music in the website, but I doubted the organizers would approve that (its lyrics are too honest and hardcore), so instead I used an other song, originally from the portuguese band <em>Madredeus</em> “Os Senhores da Guerra”, adapted to metal by the most famous/successful band from Portugal: <em>Moonspell</em> (I prefer their version).</p>
<p>I’ve been recycling the original template of the website for some years, there is no need to build a new one from scratch each time, but each year I add something (little) new (parallax effect on the background, alternative backgrounds, music, etc.). When I have time I’ll clean it up and will add here the source-code of the template/back-end in open-source format for free use and build a new one from scratch for my use (for security reasons I don't like to share code while keeping using it), it is waiting on my checklist for some time.</p>
[Poem] Allegory of the cavehttp://paulojorgepm.net/blog/132018-09-25T23:30:00ZPaulo Jorge PM<pre>My soul is a wonderer
That wanders through dark.
Eyes closed, mind peeled
All I have is what I feel.
The stones are cold
My feet are in blood.
But my hands touch
Tell me where to roam.
In this caged cave
Everyone lost the key.
Savages killing
Each other for company.
The only light in the dark
Is the one you carry within.
Set it ablaze, like a mark,
So others can come in.
If stumbling on the walls
You ever find in a soul sympathy,
Hold tight, because
That’s your lost key.
<span style="font-size:12px;">- By me</span></pre>
Autumn playlisthttp://paulojorgepm.net/blog/122018-09-18T01:01:00ZPaulo Jorge PM<p>Playlist at the top of the page updated. Got bored with the past one, time for a new loop and background music in life. Autumn, my favourite season in every year (love it love it), is starting! My taste on music always changes during this period. I never was adept of paganism beliefs, but every year this season proves me wrong, because it fits the pagan roots and symbolisms in my daily life and mood. This season is composed of the 3 great days/festivals: "Mabon" ("the Autumn Equinox", symbolizing the moment of reaping what you have sown during the year, proximity to people and insight - in this time, day and night have the same no. of hours, it is the season of balance, according to ancient traditions), the "Samhain" (1st day of November, day of the dead, ancient people believed this was the day when the veil between the worlds of the living and the dead is the thinnest) and Yule (Winter solstice, the longest night of the year and start of the Winter).</p>
<p>For ancient people this period had great astronomical significance (it was the time of the last harvests and the preparion for the longest and hardest period of the year - the Winter, the season of death). Samhain divided the year in dark and light. Autumn is the season of transition, of reflection/meditation, of harvest, when the new becomes old. Relating to "Mabon" (the current period) it was believed that "in dark silence comes whisperings of new beginnings, like the stirring of the seed below the ground" (acorns, chestnuts, etc. were sleeping underground, waiting for new beginnings. This period was the season of reflection and celebration of life, it meant and was dedicated to how we relate to one another (the harvest season and the proximity of Winter - the death season - brings people together preparing for what is coming). It is a season of silence, of insight. Ancient people saw "Samhain" as the most important sabbat/festival of the year. Winters were very cruel to people of the past, the weak humans and non humans (animals, trees, etc.) would die if not prepared or weak, so one can imagine the importance of Autumn in the past, it was the transition (without good harvests Winter would spell certain doom).
<p>Later Catholicism persecuted pagan folks, and in a desperate way to convert them assimilate these festivals in their own religious agenda (the 1st of November, the day of dead in the catholic calendar, is in fact a censored pagan festival – candles were a pagan thing, never a catholic one; like Easter for example, it is 100% pagan with zero roots in catholicism, but this is a story for another time). Also Yule (Winter solstice) was assimilated as Christmas (the Pine Tree, the cakes, etc. these were all pagan traditions, that persecuted people kept doing until catholocism gave up on trying to kill them and assimilated them instead).</p>
<p>In fact I was never a paganism/wicca adept, I confess! I talk only about what I read, not about what I follow in my inner self. But this season, every year, proves me wrong - it certainly has some magic and changes my mood. I love it, always my favourite period in every year (and hate Spring by the way!! Death to Spring!). Let the walnuts, chestnuts, figs, mushrooms, red leaves and closure come, Autumn is here. Winter is coming. New playlist in honour of Autumn added.</p>
</p>PS: I am rediscovering the 1st album of Nightwish after Tarja were expelled from the band. At time I thought Nightwish were dead, but afterall I was very wrong, their next album ("Imaginaerum") is at the moment one of my favourites - I am sorry for doubting them and never giving a fair chance to this album, in the end the soul of Nightwish were always on Tuomas Holopainen, fortunately.</p>
<ul style="font-size:14px;margin:30px 0px;">
<p style="margin:10px 0 0 0;"><strong>2018-09-17</strong></p>
<li>Turn Loose The Mermaids - Nightwish [4:20] [<a href="https://www.youtube.com/watch?v=DJS5g4-p3K4" target="_blank">youtube</a>] [<a href="/static/music/nightwish-turn_loose_the_mermaids.mp3" target="_blank">mp3</a>] [<a href="#" target="_blank">lyrics</a>] [<a href="https://genius.com/Nightwish-turn-loose-the-mermaids-lyrics" target="_blank">lyrics</a>]</li>
<li>Solitary Ground - Epica [4:21] [<a href="https://www.youtube.com/watch?v=AXQCADdCAIk" target="_blank">youtube</a>] [<a href="/static/music/epica-solitary_ground.mp3" target="_blank">mp3</a>] [<a href="https://genius.com/Epica-solitary-ground-lyrics" target="_blank">lyrics</a>]</li>
<li>Birch White - Agalloch [3:45] [<a href="https://www.youtube.com/watch?v=QJumDxguTp8" target="_blank">youtube</a>] [<a href="/static/music/agalloch-birch_white.mp3" target="_blank">mp3</a>] [<a href="https://genius.com/Agalloch-birch-white-lyrics" target="_blank">lyrics</a>]</li>
<li>Flying - Anathema [5:57] [<a href="https://www.youtube.com/watch?v=KVF4uNiy2Zk" target="_blank">youtube</a>] [<a href="/static/music/anathema-flying.mp3" target="_blank">mp3</a>] [<a href="https://genius.com/Anathema-flying-lyrics" target="_blank">lyrics</a>]</li>
<li>Fairy Tale - Omnia [5:07] [<a href="https://www.youtube.com/watch?v=2hH2JFSGMiM" target="_blank">youtube</a>] [<a href="/static/music/omnia-fairy_tale.mp3" target="_blank">mp3</a>] [<a href="https://genius.com/Omnia-fairy-tale-lyrics" target="_blank">lyrics</a>]</li>
<li>Unicorn - Gojira [<a href="https://www.youtube.com/watch?v=vVvZ4bW2tYU" target="_blank">youtube</a>] [<a href="/static/music/gojira-unicorn.mp3" target="_blank">mp3</a>]</li>
<li>The Crow, The Owl And The Dove - Nightwish [4:10] [<a href="https://www.youtube.com/watch?v=Upt8_tPYIl0" target="_blank">youtube</a>] [<a href="/static/music/nightwish-the_crow_the_owl_and_the_dove.mp3" target="_blank">mp3</a>] [<a href="https://genius.com/Nightwish-the-crow-the-owl-and-the-dove-lyrics" target="_blank">lyrics</a>]</li>
</ul>Python and empty strings behaviourhttp://paulojorgepm.net/blog/112018-09-08T16:45:00ZPaulo Jorge PM<p>I am working on an app programmed with Python and Kivy. I was getting a strange bug and ended up tracking it to this line:</p>
<code>if string.startswith(word):
...do stuff</code>
<p>I defined "word" empty by default (word=""), but that resulted in an unexpected behaviour: it always checks True, even if the string var is not empy! Example:</p>
<code>key = ""
words = ["test1", "teste2", "teste3"]
[print("yes") for word in words if word.startswith(key)]</code>
<p>This resulted in 3 prints (I expected zero):</p>
<code>yes
yes
yes</code>
<p>This was not what I expected. After some research I found out that even the count() method has this strange behavior when counting empty strings:</p>
<code>"teste".count("")</code>
<p>This printed "6". I thought "WTF", how can this be, it should not have empty strings! After some research I found out that this was happening because Python always interprets a string as a concatenation between empty strings, example: "a", in the background is "''+"a"+''". So "a".count("") returns 2 (one empty string at start, other at the end. In the other hand, "aa" in the background is ""+"a"+""+"a"+"", and "aa".count("") returns 3.</p>
<p>That is why the method startswith("") always returns True for every string no matter what it contains.</p>
<p>Honestly, even thought I understand the logic and always knew about the concatenation in strings and am used to it, this is not very intuitive at first, was not expecting some string standard methods to interpret it this way, took me some time to debug.</p>
<p>A simple solution in my app scenario, for skipping the True check on empty strings, was adding "and x" (=if x is not empty) to the code above (but it turns it more verbose, it would be more Pythonic if startswith() had a flag for disabling this behaviour):</p>
<code>key = ""
words = ["test1", "teste2", "teste3"]
[print("yes") for x in words if x.startswith(key) and x]</code>Tablaturas para guitarra elétricahttp://paulojorgepm.net/blog/102018-09-05T17:51:00ZPaulo Jorge PM<p>Ando às cabeçadas com a guitarra há muito tempo. A teimosia em ser autodidata não estava a dar frutos, evoluía a passo de caracol, por isso voltei a inscrever-me em aulas no Salão Mozart (alguns anos depois). Recentemente descobri que o professor é guitarrista oficial na banda Heavenwood, uma banda de metal nortenha com mais de 25 anos e participação em festivais mundo fora. Confesso que não conhecia, mas pelo que tenho lido net fora estão entre as mais importantes bandas de metal portuguesas ao lado dos Moonspell, espreitei e por acaso têm uma qualidade surpreendente - fica a nota para passar a palavra.</p>
<P>O método e manuais usados nas aulas são da Rockschool. Futuramente tentarei digitalizar e colocar aqui pautas dos manuais que fui usando ao longo dos anos (tenho do grau 2, 3 e recentemente do 4). Infelizmente as músicas estudadas são fictícias, criadas pela Rockschool, mas de vez em quando nas aulas praticamos músicas de bandas conhecidas em livros do instrutor, normalmente alguns deles vendidos à parte e criados pela Rockschool - eu costumo tirar fotos dessas tablaturas oficiais para treinar em casa. Como são pautas oficiais dá jeito; pesquisando na net aparece para tudo, mas há mil variações e muitas são de amadores e imperfeitas - por exemplo a que eu tocava há longos anos do Iron Man, dos Black Sabbath, não tem nada a ver com a que vi esta semana nas aulas (mas não foi surpresa, nunca procurei a versão "oficial" por preguiça). Vou colando essas pautas/tablaturas que eu for apanhando na aula, caso dê jeito a mais alguém (eu tenho milhares sacadas do Piratebay, mas não é a mesma coisa que usar uma de uma fonte fiável).</p>
<p>Antes disso deixo url para o website oficial dos Heavenwood (caso alguém tenha curiosidade no youtube há alguns álbuns): <a href="http://www.heavenwoodofficial.com" target="_blank">http://www.heavenwoodofficial.com</a></p>
<p>Eis as pautas mais recentes (o wesbite/browser redimensiona para o tamanho do ecrã, se for muito pequeno não dá para ver bem as notas, abrindo o link e descarregando é o melhor método):</p>
<br>
<p><strong>Wherever I May Roam - Metallica:</strong></p>
<p><a href="http://www.paulojorgepm.net/static/images/photos-no-db/original/wherever_i_may_roam.jpg" target="_blank"><img src="http://www.paulojorgepm.net/static/images/photos-no-db/original/wherever_i_may_roam.jpg"></a></p>
<br>
<p><strong>Paranoid - Black Sabbath:</strong></p>
<p><a href="http://www.paulojorgepm.net/static/images/photos-no-db/original/paranoid.jpg" target="_blank"><img src="http://www.paulojorgepm.net/static/images/photos-no-db/original/paranoid.jpg"></a></p>
<br>
<p><strong>Iron Man - Black Sabbath:</strong></p>
<p><a href="http://www.paulojorgepm.net/static/images/photos-no-db/original/iron_man1.jpg" target="_blank"><img src="http://www.paulojorgepm.net/static/images/photos-no-db/original/iron_man1.jpg"></a></p>
<p><a href="http://www.paulojorgepm.net/static/images/photos-no-db/original/iron_man2.jpg" target="_blank"><img src="http://www.paulojorgepm.net/static/images/photos-no-db/original/iron_man2.jpg"></a></p>Web2py: <type 'exceptions.ValueError'> insecure string picklehttp://paulojorgepm.net/blog/92018-09-04T13:01:27ZPaulo Jorge PM<p>Não reza a história mas há um 11º mandamento perdido das tábuas do Moisés. Na altura ninguém sabia o que era um servidor, por isso os deuses, na sua infinita sabedoria, ordenaram ocultar este 11º mandamento para não criar confusão nos povos primitivos da altura, ficando para a posteridade. Diz o seguinte:</p>
<p>«Não atualizarás servidores perto de fins-de-semanas ou dias de festa»</p>
<p>Cometi tabu, o sacrilégio máximo dos webmasters: atualizei um servidor na primeira semana de agosto, faltava uma semana para começarem as férias. Sempre que o faço sinto-me como num filme, a tentar cortar o fio vermelho quando faltam cinco segundos para a bomba explodir. Fazê-lo tão perto das férias dramatiza a situação: é tentar cortar o fio vermelho, sentado numa ogiva nuclear em pleno voo, rodeado de 50 fios com tonalidades mais claras de vermelho, com um martelo em vez de alicate e luvas de boxe.</p>
<p>Exageros há parte: normalmente corre bem e foram atualizações básicas. Desta vez foi exceção e uma em particular quebrou-me uma dúzia de sites mais antigos: passei a framework Web2py (O.S. Ubuntu, Server Nginx) da versão R-2.14.6 (ou anterior, não recordo) para a versão R-2.16.1. Eles são impecáveis e asseguram retrocompatibilidade, mas esta foi a única exceção (é normal, no meio de tantos cenários é impossível cobrir tudo). Felizmente apenas influenciou websites criados com a base mais antiga da framework que poucos usam (criados antes de 2015), não tocou nos sites mais recentes com coisas a decorrer, por isso não tive de adiar as férias, bastou um "temporarily down for maintenance" nesses casos. Inspecionando os "error tickets" o erro era "<b><type 'exceptions.ValueError> insecure string pickle</b>" e tinha origem nos ficheiros que definiam as migrations da base de dados.</p>
<p>Uma das primeiras missões na vinda das férias foi corrigir isto. A coisa mais grave que ficou offline foi o painel de gestão de uma biblioteca com 12 mil registos dos empréstimos de livros ausentes - mas felizmente a biblioteca esteve fechada para obras até esta semana e não precisavam deles com urgência. Depois de alguma pesquisa e espreitadela nos logs eis a solução:</p>
<p>- O problema são os ficheiros ".table" corrompidos/incompatíveis - são apenas ficheiros gerados pela DAL para gerir as migrations da base de dados, não afeta os dados em si. Para corrigir, basta apagar todos os ficheiros com extensão ".table" na pasta "databases" (por default), na raiz do website - nota: se o website usar SQLite o ficheiro com os dados estará também nesse diretório entre os ".table" (com extensão ".sqlite"), não apagar ou a base de dados hasta la vista! Depois disso basta ir ao ficheiro com a instanciação principal da base de dados e ativar uma fake migration para o sistema gerar novos ficheiros ".table", ou seja, partindo do pressuposto que estão em uso os directórios/ficheiros default: em /models/db.py na linha que define a db acrescentar o atributo "fake_migrate_all=True", por default essa linha é semelhante a:</p>
<p><strong>db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])</strong></p>
<p>Depois disso basta lançar uma página do site, para obrigar a criação dos infames ".table", o erro deverá desaparecer nessa altura. Por último basta apagar o "fake_migrate_all=True" para desligar a fake migration (assume False por default) e voilà la, tudo deverá voltar ao normal. No meu caso este erro ocorreu principalmente em websites antigos (>2015), que usam uma base antiga da framework, cujos ficheiros das migrations (".table") são incompatíveis com as versões recentes.</p>
<p>Nota: um 12º mandamento dita que convém realizar um backup da base de dados antes de tentar indicações em posts de estranhos da internet.</p>
<p>Isto fica aqui para aparecer nas pesquisas do google caso alguém precise.</p>