Mostly about my amusement

Category: Cool (page 3 of 11)

What are the building codes there again?

In China’s Hunan province a glass bottom bridge exists and lets brave tourists walk across. Another one is scheduled for opening and will be the longest glass bottom bridge in the world. I don’t know if I’ll ever visit either but I am sure that if I do I’m not crossing. Here’s how I know.

In 2011 Lily and I took the kids to China. Part of that trip included stopping at Shanghai and we visited the Pearl Tower. The tower is concrete and very orderly, tourists lined up and took a fast elevator to the observation deck. Part of the deck goes around the perimeter and has thick glass panels for the floor.

It’s at least an 800 foot drop. It’s very safe but when you are walking around it and looking down you don’t think about the safety. It didn’t help that the kids worked up their courage and started jumping on the floor panels. That’s not what freaked me out though.

the-girl-skydeck

Making our way around the deck we came across a part that had those bank teller line posts. Except these posts were set at the corners of a new looking and very clean glass floor panel. Instead of a velvet rope, it had yellow plastic tape.

There was YELLOW DO NOT CROSS TAPE TELLING YOU NOT TO STEP ON THAT GLASS FLOOR PANEL.

That freaked me out. I wish I took a photo but instead I grabbed the kids and we went to the inside of the deck where the floor was concrete. The tower is amazing but at that moment I had to find an Internet connection. I really wanted to visit Google in the worst way possible. I had to look something up.

My small Windows 10 review

It was my 240GB SanDisk SSD Plus drive that bit the dust. I’m calling the manufacturer because I got the drive in July.

I’m getting a lot of practice rebuilding my PC. With that drive out I move the 3 TB into the first slot. Once that was done I re-installed Windows 10 and I’m back and running.

If you have Windows 7 and haven’t upgraded yet then you should. On my setup since there was no touch screen it’s defaults to acting and behaving like the previous versions.

There is one new feature I like: built in virtual desktops. If you use that you just click the Task View icon on the task bar and add a new desktop. The only thing I changed was as follows.

In the lower right hand corner is the notification icon, click that and you’ll get to see the “All settings” box. Click that then navigate to System -> Multitasking and change the Virtual Desktop settings from “Only the desktop I’m using”

old-settings

to “All desktops”.

new-settings

That way you can alt-tab through all your programs. When I created multiple desktops and could not see the other running apps in the task bar I did a double take.

Aside from the new look, Windows 10 runs just as well as my old Windows 7 did. It’s a free upgrade and I’m glad that I made the switch.

The new Press This in WordPress 4.2 beta 2 is slick

Try this: update to WordPress 4.2 beta 2 and drag the “Press This” to your bookmark bar. Visit a URL that you like and poof.

I just did that on a Flickr photo and I was able to select the image from the options and below is the result.

Explore Alvin Bernardo’s photos on Flickr!

Source: Custom Built HG 1/144 Acguy ( R2D2 Color Ver) | Flickr – Photo Sharing!

The post is complete with a source link for attribution. I added some categories and saved as a draft. The whole update to Press This really is well done. It’s more attractive and easier than ever.

New thrift shop find

I like old film cameras and I often visit Island Thrift to see what they’ve got. Normally it’s just a few 35mm plastic film cameras from the 80s. Those aren’t very interesting, but this week they had some good selections behind the case.

  • Olympus SLR OM-1MD w/50mm f/1.8 lens in good condition.
  • Olympus SLR OM-2 w/50mm f/1.8 lens. The shutter was jammed solid.
  • Yashica Electro 35 G (1968 version, up to ASA 500) with a dented lens rim.
  • Yashica Electro 35 from 1966. The original non-G version that went to ASA 400.

Of course I got the last one. 🙂

original-electro-35-1966-3

I did a check out of all 4 and gave the manager a lesson in old film cameras. I looked at the shutter settings from bulb to 1/1000 on the OM-1MD, checked the aperture changed when moved, the film advance, looked for fungus and scratches on the lens and made sure the shutter didn’t stick.

Except for the OM-2, the cameras worked. The manager removed the OM-2 which I thought was decent of him.

Without a battery the Electro 35 will default to 1/500 exposure. I thought the aperture blades were stuck (they’re not)  but what this new camera needs is work on is the wiring. At home when I put a battery in I got the check battery light working but I also got a ZZZT! noise on the inside.

I took the battery out quickly. This camera is over 48 years old so I do expect some problems. The light seals disintegrate on touch and the whole thing can use a good cleaning.  I’ll do some research, I think I know where I can get this one serviced.

The mood struck me and I organized all the things

Saturday I went to Lowes and picked up new air filters for the house. The old filters were… they needed replacement badly. While there the lightbulb went off and I picked up the following.

The elbow brackets were bent into shape with just a little gentle persuasion. I mounted them on the pegboard and attached strips of rubber shower liner to make sure I did not scratch up the desk.

Yes, it is my desk but if I damaged it I’d have faced some serious adult supervision.

With the metal brackets safely rubberized I hung the board off the back of my desk and started attaching all the junk from the floor.

Pegged up equipment

The results came out OK. I’d love to tie up all of the power, USB and ethernet cables but I do move things on my desk so that’s not a good idea. If I ever have to take it apart I’ll put the new power strip on the top. Right now it bows out a little and the 42 inch long surge protector would prevent that.

It’s really too bad I did not take a before picture of that cable and outlet horror show. It cried out “Fire hazard!” every time I looked at it. I had one of those 2 pronged monsters on the wall outlet that made the 2 plugs into 6 outlets. Power cables and junk just littered the floor and I meant to fix it years ago.

How many years ago? The article that inspired me was this one. It’s not a new idea but I’m glad I got around to it.

Constantine is a fun show

I’m watching NBC’s Constantine via FIOS on demand. It’s a fun show but I wonder how faithful it’s going to be to the original comic.

I’ve not look at that comic for ages. Unlike the Keanu Reeves version, this one has someone playing as a brit.

It’s s fun show if a little grim. I mean what else to expect with a prime time show that deals work demons.

I’m writing this post from my phone as a way to play with the WordPress Android client. Easy so far and the client has come a long way since I last looked at it.

Excerpts and not full content, but only sometimes

WordPress filters and actions remains one of my favorite features. There is so much that you can easily manipulate without modifying a theme’s files.

For example: on my front page I like the latest published post to show the whole content with a featured image if there is one. For the rest of the articles I want to display the excerpt and no featured image. This is the same on the front page and subsequent pages.

One way to do this is to create a child theme and modify the PHP to get the effect you like. There’s a few reasons why I don’t like that option.

  1. Child themes are fun and I always recommend users create them. But I’m bad at maintaining them when the parent theme is updated.
  2. My CSS is just awful and I’m pretty sure I’d break the responsiveness of my site.
  3. Filters are cool! I can use this code in a plugin.

Filter the_content

I took a shot at making my own filter but a quick search found that Justin Tadlock had written a really good post on the topic already in 2008. I use that code in my function but added a few lines.

// Get the ID of the last published post
$mh_last_id = wp_get_recent_posts( array( 'numberposts' => '1' ,
     'post_status' => 'publish' ) )['0']['ID'];

// Get the post format. If the post is a standard format then the value will be false
$mh_post_type = get_post_format();

I do not want to show an excerpt for the latest post  and only want to modify standard post formats. Anything else I want to skip. The reason I only want to play with standard format posts is that other post types break horribly when I force the excerpt this way.

Except for adding to the conditional statement, the whole function is copied from Justin’s post. He writes great code and explains it much better than I do.

// If is the home page, an archive, or search results and not the last post and is a standard format
if((is_front_page() || is_archive() || is_search()) and $mh_last_id != get_the_ID() and !$mh_post_type )

That’s a little ugly to look at but it does the job.

What about the featured image?

In the past when I wanted to hide the featured image in a child theme I would use CSS like so.

.ryu-featured-thumbnail, .attachment-ryu-featured-thumbnail, .wp-post-image {
     display: none;
}

Which works but is a little heavy handed. My WordPress installation still sends the HTML for the featured image and the browser still pulls that image. The end user just doesn’t see it because it’s not being displayed.

I don’t want to remove featured image support from the theme and I don’t want to send that HTML either. Thanks to the post_thumbnail_html filter I don’t have to.

add_filter( 'post_thumbnail_html', 'mh_post_image_html', 10, 3 );

function mh_post_image_html( $html, $post_id, $post_image_id ) {

// Get the ID of the last published post
$mh_last_id = wp_get_recent_posts( array( 'numberposts' => '1' ,
     'post_status' => 'publish' ) )['0']['ID'];

if ( (is_front_page() || is_archive() || is_search()) and $mh_last_id != get_the_ID() ) {
     $html = '<!-- Featured image not displayed in excerpt -->';
     }
return $html;
}

This code checks if we’re the first post and replaces the post_thumbnail_html with a simple HTML comment.

Child theme or plugin?

This code works either way. At the moment I am using this in a plugin but the whole thing can be implemented in my child theme’s function.php file.

It belongs in the child theme because I’m playing with the presentation and that is theme territory. Editing a copy of content.php in the child theme directory would be more theme’ish but I like filters. Filters are cool.

I’m not good at keeping my child theme changes in sync with the parent theme so using a filter lets me just play with the results and not mess with theme files. In a plugin or the child theme’s functions.php file the filters still work the same.

Favorite new WordPress 3.9 feature

Copying and pasting from Microsoft Word directly into the Visual Editor is my new favorite thing in 3.9 beta. I just tried it on Lily’s store WordPress site and it worked alright. This is a fortunate side effect of 3.9 getting a new version of TinyMCE.

I know, that sounds anti-climatic even a little mundane given the great enhancements that 3.9 will be delivering. But I occasionally (once a month) have this conversation.

Them: How can I copy this Word document into WordPress?

Me: First select the text and paste that into notepad. I like notepad++ myself.

Me: Then you take the text you just copied into notepad select and copy it into the Visual Editor. Again.

Me: Make sure you copy from notepad. Bad things will happen if you paste that into the Visual Editor directly from Word.

Me: Then you apply the styling such as bold, underline, etc. To that text. For titles I like to use the <h3> tag myself.

Me: No, that layout thing you did in Word won’t work.

Me: Images? If you use the Snipping Tool then you can save that image to your hard disk.

Me: Once you’ve done that, upload that into the media library.

Me: Then you can insert it into the WordPress post. The image I mean, I usually go with centered and no link.

Them: Zzzzzz Wha-? What we’re we talking about??

I myself don’t like the idea of users creating content for WordPress outside of WordPress but I’m told I’m special. Apparently “regular” users (yes I’m doing the “air quotes”) such as my wife and some siblings use Word that way.

Lily creates flyers for wine tastings once a week. Right now she has to wait for me to create the event on the WordPress site (thank you Modern Tribe! that’s a great plugin) then cross post it to the company Facebook page. If I can show her how to just paste the content into WordPress to create the event then she can deliver the post sooner.

Also that means I’ll have one less thing to do each week.

Next I have got to test out dragging images into the Visual Editor to upload them that way. That’s got to improve “regular” users workflow too.

Some journalists still inspire you

miles-obrien

Miles O’Brien has always been one of my favorite science reporters and I was sorry to hear about the loss of his left arm.

You know he’s going to get through it but it’s horrific that this could happen to him. Give a few minutes and see his interview on PBS NewsHour. It’s great to see him moving forward and explain his phantom pain and what he’s going through.

His Contaminated Waters report is informative and I look forward to seeing what he produces next.