ut

A slice of the past, preserved for the future

Did one of the most difficult things I’ve ever done: I cut up my mother’s wedding dress. Now, Mom always *loathed* her wedding dress. Her mother talked her into a waltz length, ballerina-y dress, and she never enjoyed looking at her wedding pictures. She put it in her cedar chest and never looked at it. […]




ut

Timofei Shatrov: Previewing images in and out of SLIME REPL

As any Common Lisp coder knows, a REPL is an incredibly useful tool. It can be used not just for development, but for running all sorts of tasks. Personally, I don't bother making my Lisp tools into executable scripts and just run them directly from SLIME. As such, any operation that requires leaving the REPL is quite inconvenient. For me, one such operation was viewing image files, for example in conjunction with my match-client:match tool. So lately I've been researching various methods to incorporate this functionality into the normal REPL workflow. Below, I present 3 methods that can be used to achieve this.

Open in external program

This one's easy. When you want to view a file, launch an external process with your favorite image viewer. On Windows a shell command consisting of the image filename would launch the associated application, on Linux it's necessary to provide the name of the image viewer.

(defvar *image-app* nil) ;; set it to '("eog") or something

(defun view-file-native (file)
  (let ((ns (uiop:native-namestring file)))
    (uiop:launch-program (if *image-app*
                             (append *image-app* (list ns))
                             (uiop:escape-shell-token ns)))))

Note that uiop:launch-program is used instead of uiop:run-program. The difference is that launch- is non-blocking - you can continue to work in your REPL while the image is displayed, whereas run- will not return until you close the image viewer.

Also note that when the first argument to run/launch-program is a string, it is not escaped, so I have to do it manually. And if the first argument is a list, it must be a program and a list of its arguments, so merely using (list ns) wouldn’t work on Windows.

Inline image in REPL

The disadvantage of the previous method is that the external program might steal focus, appear on top of your REPL and disrupt your workflow. And it's well known that Emacs can do everything, including viewing images, so why not use that?

In fact, SLIME has a plugin specifically for displaying images in REPL, slime-media. However it’s difficult to find any information on how to use it. Eventually I figured out that SWANK (SLIME’s CL backend) needs to send an event :write-image with appropriate arguments and slime-media's handler will display it right in the REPL. The easiest way is to just send the file path. The second argument is the resulting image's string value. If you copy-paste (sorry, "kill-yank") it in the repl, it would act just like if you typed this string.

(swank::send-to-emacs '(:write-image "/path/to/test.png" "test"))

You can even send raw image data using this method. I don't have anything on hand to generate raw image data so here's some code that reads from a file, converts it to a base64 string and sends it over SWANK.

(with-open-file (in "/path/to/test.png" :direction :input  :element-type '(unsigned-byte 8))
                (let* ((arr (make-array (file-length in) :element-type '(unsigned-byte 8)))
                       (b64 (progn (read-sequence arr in) (cl-base64:usb8-array-to-base64-string arr))))
                  (swank::send-to-emacs `(:write-image ((:data ,b64 :type swank-io-package::png)) "12345"))))

Note that the first argument to :write-image must be a list with a single element, which is itself a plist containing :data and :type keys. :data must be a base64-encoded raw image data. :type must be a symbol in swank-io-package. It’s not exactly convenient, so if you’re going to use this functionality a helper function/macro might be necessary.

Image in a SLIME popup buffer

Inline images are not always convenient. They can’t be resized, and will take up as much space as is necessary to display them. Meanwhile EMACS itself has a built-in image viewer (image-mode) which can fit images to width or height of a buffer. And SLIME has a concept of a “popup buffer” which is for example used by macroexpander (C-c C-m) to display the result of a macro expansion in a separate window.

Interestingly, slime-media.el defines an event :popup-buffer but it seems impossible to trigger it from SWANK. It is however a useful code reference for how to create the popup buffer in ELisp. This time we won’t bother with “events” and just straight up execute some ELisp code using swank::eval-in-emacs. However by default, this feature is disabled on Emacs-side, so you’ll have to set Emacs variable slime-enable-evaluate-in-emacs to t in order for this method to work.

Also Emacs must be compiled with ImageMagick for the resizing functionality to work.

Anyway, the code to view file in the popup buffer looks like this:

(defun view-file-slime (file &key (bufname "*image-viewer*"))
  (let ((ns (namestring file)))
    (swank::eval-in-emacs
     `(progn
        (slime-with-popup-buffer (,bufname :connection t :package t)
          (insert-image (create-image ,ns))
          (image-mode)
          (setf buffer-file-name ,ns)
          (not-modified)
          (image-toggle-display-image))
        ;; try to resize the image after the buffer is displayed
        (with-current-buffer ,bufname (image-toggle-display-image))))))
    ))

Arriving to this solution has required reading image-mode’s source code to understand what exactly makes image-mode behave just like if the image file was opened in Emacs via C-x C-f. First off, image-mode can be a major and a minor mode - and the minor mode is not nearly as useful. slime-with-popup-buffer has a :mode keyword argument but it would cause image-mode to be set before the image is inserted, and it will be a minor mode in this case! Therefore (image-mode) must be called after insert-image.

Next, the buffer must satisfy several conditions in order to get image data from the filename and not from the buffer itself. Technically it shouldn’t be necessary, but I couldn’t get auto resizing to work when data-p is true. So I set buffer-file-name to image’s filename and set not-modified flag on.

Next, image-toggle-display-image is called to possibly resize the image according to image-mode settings. It's called outside of slime-with-popup-buffer for the following reason: the buffer might not yet be visible and have any specific dimensions assigned to it, and therefore resizing will do nothing.

Here’s an example of how calling this function looks in Emacs.

The position of the popup buffer depends on whether the original Emacs window is wide enough or not. I think it looks better when it’s divided vertically. Use M-x image-transform-fit-to-height or M-x image-transform-fit-to-width to set up the auto-resizing method (it gets remembered for future images). Unfortunately there’s no way to fit both height and width, at least with vanilla Emacs. I prefer fit-to-width because in case the image is too tall, it is possible to scroll the image vertically with M-PgDn and M-PgUp from the other buffer. Unlike other image-mode buffers, this buffer supports a shortcut q to close itself, as well as various SLIME shortcuts, for example C-c C-z to return to the REPL.

That's it for now, hope you enjoyed this overview and if you happen to know a better way to display images in Emacs, I would be interested to hear about it.




ut

South Kingstown Beach House














ut

SAN HOLO – THE FUTURE (FEAT. JAMES VINCENT MCMORROW)

musicisart magazine SAN HOLO – THE FUTURE (FEAT. JAMES VINCENT MCMORROW)

Producer San Holo, AKA Sander van Dijck, creates ballad like electronic music that brings a listener on a journey full of emotion. San Holo is most known for his hit single ‘Light‘, which reached over 151 thousand likes on Soundcloud. SAN HOLO – THE LIGHT || San Holo’s latest single ‘The Future‘ features the smooth Irish vocals of […]

The post SAN HOLO – THE FUTURE (FEAT. JAMES VINCENT MCMORROW) appeared first on musicisart magazine.







ut

The Government, The Catholic Church and the prostitution in Malta

In today's The Times, you can read in an article by David Pace O’Shea, that, in general, Maltese are a helpful people, generous, hardworking, humble, careful with their money, welcoming, peaceful and unaggressive and that they love their families and, especially, their children. In the Observer’s opinion, anyone who states that he or she has all those qualities also might add the words conceited and boastful. The word humble is not the first that comes to one’s mind when reading all the other characteristics Mr. O’Shea states that Maltese in general possess. Thank God (just an expression!) that most Maltese do not consider themselves to have all those qualities (and I do not know of any other country’s citizens that would claim all these good characteristics). Since the article is written by a convinced catholic believer it might be interesting to hear his humble view, from a moral and Christian standpoint, on prostitution in Malta. Every time one passes the area around the closed Empire Stadium one can see prostitutes hanging out from windows or standing on the street offering men their services. In Malta it is allowed to buy and sell sexual services; such services are forbidden in many other EU states. One can ask how this complies with the Maltese character as described in today’s Times. The Maltese government and the Church might not officially be in favor of prostitution but they certainly do not try hard to solve the problem. Prostitution is closely connected with criminality such as trafficking and drug related crimes. There is no reason whatsoever to let young women be treated like slaves in any country and especially not in a country like Malta, which is said to be one of the most Christian in the world. It is a shame for Malta!




ut

Malta - a Lilliput state with potentates separated from and above the people?


Memorial plaque
Memorial plaque
Malta is the smallest country among EU member states. It has only about 400000 inhabitants and the area is only 312 square kilometers. The Maltese people are very proud of their country and are very right to be so. During WW II the Maltese people were very courageous and it was then the Maltese people was rewarded S: t George’s cross 1942 by the king of England, which cross since 1943 is a symbol on the Maltese flag. The president of the United States of America, Franklin D. Roosevelt, has expressed his gratitude to the Maltese people, which can be seen on a memorial plaque on the wall of the predidential palace in Valletta. 
However, the majority of Maltese do not seem to travel a lot and therefore are rather ignorant about other countries. Malta is just a rock in the Mediterranean, but, of course, historically an important rock. Yet, you can hear Maltese people quite seriously say that Malta is the most beautiful country in the world. Of course, what is beautiful is a very subjective. Still, very few people, but the Maltese, would say that Malta is the most beautiful country in the world. I have also heard that the Maltese wines as well as its vegetables are the best in the world! There might be a few countries which would like to contest that. Maybe it is beacuse of this ignorance that the Maltese people accept the behaviour of their potentates.

The government, backed by its loudspeaker, The Times, does everything to give the impression to the Maltese people that Malta has an important role to play in EU and in the rest of the world. If prime minister Gonzi for instance travels to some conference abroad, the articles in The Times have headlines giving the impression that the other prime ministers were there just to listen to Mr. Gonzi. Malta also has a Head of State, a President with his own flag and a car with a special license plate. His wife is called Malta's first lady! Even the The Commissioner of Police has his own flag as well as the Archbishop. The corruption is widely spread. But there is of course a reason for all these cars and flags and mumbo jumbo; the government wants to give the people the impression that Malta has a bigger role to play in EU and in the world than it really has and therefore one also must have men in formal high positions with attributes. One must remember that Malta, although a sovereign state, is not bigger than a middlesized european town and ought to be be governed more in accordance with that and not like United States of America..



Archbishops BMW license plate
Gozo bishops Toyota license plate
The catholic faith is state religion in Malta. The archbishop as well as the bishop of Gozo has company cars, the latter a smaller one than the BMW that is archbishop Cremona's company car. Do not for a moment think that these cars have ordinary license plates. No way, they have plates of a silvery material in the shape of a bishop’s miter. If you do not believe me, look at the pictures. And, of course, the archbishop has a more expensive car than the Gozo bishop (The Observer wonders what Jesus would think of that!).To a foreigner from a more secular state this looks really ridiculous. Of course also the prime minister’s car have special plates. As far as the Head of the State, the President, is concerned, it is more understandable. He is, after all, a symbol. If the president and the prime minister want to attend a mass in Valletta they travel by these cars about 200 meters to the church. This is just window dressing. One could argue that they travel by car for security reasons; no way, anyone could go close to these potentates. All this is also a part of implementing the belief in people that Malta and its potentates are very important, separated from and above the people. They act like royalties more than the royalties in the Netherlands, Belgium and Sweden.

President Abela's car and flag
To a foreigner all these attributes are kind of sweet and touching, except for the corruption. Malta is a Lilliput with its attributes similar to those in operettas. This is sweet, but, of course,  fulfills a not so honorable cause, namely to keep the people in a feeling that Malta is something it is not.




ut

Last Five Minutes of Fame

Last Five Minutes of Fame

To what lengths does one have to go in order to achieve fame? It wasn’t until years later that by simply sucking on someone’s cock (Monica Lewinsky and Kim Kardashian) that the distance one had to go to achieve fame was not that far at all. The only distance they had to go...was down.

I Mean…What?!?









ut

Citywide Blackout: Steampunk Dragons

.


I've been podcast! Or at least my words have, podded up into an electronic bundle and cast out into the Noosphere. Over on Citywide Blackout, I discuss The Iron Dragon's Mother, worldbuilding, and the novel I wrote with Gardner Dozois--City Under the Stars.

It is impossible to exaggerate the influence Gardner had on my life. Over the course of a single evening, he and Jack Dann taught me how to write.  He and I and Jack, in various combinations, wrote stories together and routinely sold them to publications like Playboy, Penthouse, and (this always amused Gardner hugely) High Times. Gardner and his wife, Susan Casper, were good friends to me and to Marianne for over forty years.

But then Susan died and, a little later, Gardner did too, leaving our last collaboration unfinished. But he'd told me how it would end and so I finished it so all the world could discover that he'd finished on a high note. I wanted one last novel, to stand as a monument to him.

You can hear the entire story by clicking here.


*




ut

The Postutopian Adventures of Michael Swanwick

.


Look what came in the mail! My contributor's copies of The Postmodern Adventures of Darger and Surplus. Which I can now honestly tell you are beautiful books. Marianne--owner, reditor, and sole entrepreneur of Dragonstairs Press, remember--especially admired the texture of the endpapers.

This is the first Darger and Surplus collection of short, and it collects everything except the two novels. But I should caution you that it is a slim book--five previously published stories, four related short-shorts, and "There Was an Old Woman..." a story written expressly for this collection.  Bloated this volume is not.

Subterranean Press has created, as I said, one lovely volume. It costs $40, because it's a high-quality collector's item, published in a limited edition of one thousand. But for a high quality collector's item, published in a limited edition of one thousand, that's pretty cheap.

Here's the table of contents:

Introduction:
  • Mother Goose’s Errant Sons
Stories:
  • The Dog Said Bow-Wow
  • The Little Cat Laughed to See Such Sport
  • Girls and Boys, Come Out to Play
  • Tawny Petticoats
  • There Was An Old Woman
  • Appendix:

  • Introduction to Appendix: A Little Smoke and a Mirror or Three
  • Smoke and Mirrors: Four Scenes from the Postutopian Future

If you're interested, you can buy a copy of the book here.

Or you can buy an e-book version for $5 here.

Oe you can simply go the the Subterranean website and poke around here.  Mine isn't the only book there you want. Far from it.


*





ut

A Last Minute Ten, Nine, Eight … Point Transit Plan

The mayor's list of ideas to alleviate crowding offers little relief in the short term.

Mayor John Tory announced a ten-point plan to fight congestion and delays on the TTC at a press conference just before Toronto Council began its final debates on the 2018 budget. Through the entire budget process, starting with Tory’s cohort on the TTC Board and continuing through the City Budget and Executive committees, transit has […]

The post A Last Minute Ten, Nine, Eight … Point Transit Plan appeared first on Torontoist.




ut

Mixed feelings around hockey about holding NHL draft early

Mixed feelings around hockey about holding NHL draft early




ut

Wisconsin asks Alvarez, Chryst, Gard to take pay cut

Wisconsin officials believe a plan of reducing compensation to highest-earning employees should help save the athletic department about $2.8 million.




ut

Crazy-seeming research, now and then, turns up something true and beautiful

Crazy-seeming research, every now and then, leads to something really, really wonder-filled. In this case, the discovery of something long-predicted (by Einstein) but seemingly impossible to perceive: gravity waves. (HT Maggie Lettvin)




ut

Recent Progress in Automatic Sarcasm Detection

‘Sentiment mining’ – i.e. trying to gauge the Public’s attitude towards an institution, product, firm (etc. etc.) though automatic analysis of Social Media posts (etc. etc.) is now considered an essential tool for market researchers and ‘reputation managers’. But there are problems. One of which is sarcasm. Given its prevalence, serious errors can be introduced […]




ut

12-Tone Music, explained without needless worship

Vi Hart, adept at mathematics, music, and explaining things, made this video that explains the point (and the lack of point, too) of 12-tone music:




ut

A new comic (in 2 languages) about Ig Nobel Prize winners

A new comic strip—in Russian and in English—about some of the curious characters who have won Ig Nobel Prizes. The series appears on Instagram.




ut

The automatic diaper-changing machine is now in development

BabyWasher, the automatic dirty-diaper-changing invention, honored by the 2019 Ig Nobel Prize for engineering, now has a name, and is now undergoing intense development. You can follow the progress by visiting the inventor’s new web site, BabyWashers.com.




ut

"Be careful of the truth"

Two years on, and still my favourite Chinese mistranslation…. pic.twitter.com/0EHeQjybeB — Antiokhos in the East (@AntiokhosE) May 6, 2020   How did it happen? There's no problem with "xiǎoxīn 小心"; it just means "be careful [of]; pay heed to". The problem comes with the second half of the warning, where luòshí 落石 ("falling rocks") is […]



  • Lost in translation
  • Signs

ut

Autres temps, autres mœurs




ut

Out of school? Make Friends Challenge

Hi all.  Check out some of the really great party ideas some of you have added to my last post.  Watch the What’s New on the homepage.  Soon we’ll be doing some of them.  Continue to send me your party ideas – you guys rock. I have a challenge for you – how many NEW friends can […]




ut

The Caffeine Traces Give the Car About 100 More Horsepower

The tail light cover used to be a plastic Folgers can. I know because the label is still on it.



  • coffe
  • car-repairs-tail-lights


ut

Internet Addiction Drives Creative Solutions

Power outage? Grab a length of steel automotive brakeline tubing, the straw from a box of Yoo-Hoo, D-cell batteries to make a 6V. Also may require generous amounts of duct tape, electrical tape, bell wire, and boredom.




ut

How to make a bug out bag

When this website was focused on post apocalyptic survival one of the topics I mentioned was how to create a “bug out bag”. These are ready made emergency packs that you would grab when staying in your home was not an option. A bug out bag or emergency bag can be used for more then the possible collapse of civilization as we know it. In the event of a natural disaster, or if your stranded in the middle of nowhere, having an emergency supply of necessities can save your life.




ut

How to pack a bug out bag

Now that you know what essentials you need to pack in your bug out bag, we can now pack it. But packing your bug out bag isn’t just stuffing it in a big ball and hoping for the best. You need to pack it in an organized manner that allows you to find things quickly and know exactly where they are, and allow you to easily keep track of your bug out bag’s inventory when it’s being stored. As a former soldier I can’t stress the importance of keeping things organized and neat because when your adrenaline is going and your in a fight or flight state you won’t be thinking rationally. So here’s how you pack your bug out bag effectively.




ut

A basic understanding of youtube copyright

Posting videos on YouTube can be a great way to show off your video editing skills, post video blogs, or even your own mini series. Because YouTube is the largest video sharing site it’s also a great way to promote products, or your website to thousands new potential viewers. But what happens when you post a video and it’s either slapped with a copyright infringement or banned all together, and what are the consequences to your account?




ut

How to get your youtube videos more hits

YouTube and other video sharing sites like Vimeo for example are great places to get traffic to your website or blog. But there only as effective as the traffic those video receive, makes sense right. Obviously if your vides are getting next to no hits, your website will see little to no increase in traffic, which in a word sucks. So for this post I'm going to go over some simple steps you can use if your new to YouTube to help get your videos noticed. In the next post I'll cover some ways you can take those videos and use them to get traffic back to your site.




ut

How to use youtube to get more traffic

In my last post I showed some simple ways you can use to help get your videos more views and subscribers. Now let's talk about getting some of that traffic over to your website or blog. Being that YouTube is the most used search engine in the world right now, and showing no signs of slowing down, this is something you want to tap into.




ut

How To Pick The Right Backpack For Your Bug Out Bag

So you’ve decided to make a bug out bag, you’ve picked all the items you know will be the most effective. But what about the bug out bag itself? Selecting the right pack is just as important as what you put inside it, after all this will probably be on your back for a good length of time. The last thing you want is a bag that either isn’t strong enough to hold the weight of your equipment, and doesn’t fit you properly causing pain and discomfort. Here are some things to look for when selecting the proper bug out bag for your emergency supplies. The first thing you want to do before you buy anything is know what your budget is. Check online and store flyers to see what brands they have for sale and compare prices. Other sources to investigate are websites such as Ebay, Craigslist, or Kijiji, to see if there’s some second hand bags that are in good shape. Also check with places like Amazon.com and U.S Calvary (U.S Calvary deals with military and police clothing and equipment) And of course look for local military surplus stores. Now you want to decide what type of bug out bag you want to use. All bags can be broken down into three categories.




ut

How To Become A YouTube Partner

If you’ve spent some time on Youtube you’ve probably heard of their partner program, and that you can make money from your videos through revenue sharing. This means that you put ads on your videos and get paid for them. Sounds good right but what do you need to do to be a partner and is it worth it? How to become a YouTube partner, to partner with YouTube you have to meet some criteria before they’ll consider you for a partnership. There are four things that YouTube analyzes before they accept or reject your application, they are 1. Subscribers And Friends 2. Video Views 3. Daily Video View Count 4. Copyrighted content




ut

How To Autoplay Videos And Why You Don't Want To

How to get your YouTube videos to auto play on your website Depending on your site having your videos auto play can help your site stand out. When it comes to embedding your videos from YouTube however there’s no feature to set up your video to auto play. It’s important to remember before you enable auto play on your videos that doing so can actually harm your site. Many people don’t like videos or music playing as soon as they open a page, especially if there’s no way to turn it off that’s easy to spot. Look at your site to see if this is something that you want to do.




ut

How To Make Your Own Custom Share Buttons (Blog Post)

Most of the popular social book marking or networking sites have some form of social media share button. A little button that with one click allows you to share an article, video or web page on there site, in the hopes that it goes viral and gets you a tonne of hits. And while these buttons are usually easy to install, most sites only have either a limited number of choices, or a one size fits all approach. This is fine if you like what they offer, but if you want something that fits better with the theme and look of your website you have to do a bit of digging around.