tar tips

tar

You’d think I’d just learn how to use this, but I suppose I use it so infrequently that I just can’t remember it. So here are my quick “go-to” tar references.

uncompressing

tar -xzvf filename.tar.gz

x:- eXtract
z:- parse through gzip
v:- verbose (show files)
f:- file archive

archiving/compressing

tar -cf archive.tar file1 file2 dir1
tar -czf archive.tar.gz file1 file2 dir1

notes to above:

  • you don’t HAVE to run the archive through gzip, although there’s no real reason not to. If you chose just to archive without compression, it merely means your file will be larger. This may or may not be a big deal
  • you [b]must[/b] specify a file archive (-f option), not specifying a file is an unrecoverable error and tar will exit
  • recursion is on by default, so if a directory name is specified, recursion will occur. To override that option specify (–no-recursion). Alternatively, if recursion is turned off within the environment it can be re-instated by stating (–recurse).

show me the contents

What if you just want to look at what’s in the archive?

Do a test (-t / –list) run.

tar -tvf archive.tar

This will output (list) the files to stdout without extracting the contents. Useful to see what’s in the archive.

Other useful options:

Here are just a few other useful options and command line usage options to tar that I find useful.

C:- Change to directory and extract at that location
–strip-components=1 :- use this if you need to remove the baseline directory from the archive

Youtube embedded videos in WordPress not working

You’ll notice above that there is a youtube URL on the first line… it hasn’t embedded within the post.

UPDATE 2015-12-10: it’s working now, is it a WordPress 4.4 thing? I have disabled a LOT of plugins for the moment, I’ll come back and revisit this in the next couple of days. I have spent many hours working on this problem over the last few months and having just found I’ve had other issues, I’ll revisit this again

Embed the URL without embed tags
Embed the URL without embed tags

Also, I have just learned today that the youtube style of embedding without embed tags have been extended in WordPress 4.4 to include URLs to your own WordPress site (and possibly others).

Are you finding your http://youtu.be/{videocode} youtube links not embedding correctly or working in WordPress?

The correct format for the link is any one of the following:

http://youtu.be/{videocode}
http://youtube.com/watch?v={videocode}
[ embed]http://youtu.be/{videocode}[/embed ]

(there is a space before the embed in the above one to have it display correctly)

There are three things to watch out for to ensure this works. And if you do each of these, then you don’t need to use the [ embed ] code you see in the third example above. They are:

  1. Ensure the URL is on it’s own line
  2. Ensure you use HTTP in lieu of HTTPS (*1)
  3. Ensure the link does NOT appear on the first DISPLAYED line of the content

*1 : this is not a big one, since it seems most of the time it works, but for some reason it didn’t when I used it on this particular occasion.

I say DISPLAYED because in an effort to fix this, I tried putting a blank line for the first line. The problem persisted. It also didn’t help to include just a full-stop (period) there either.

I do believe it could also be theme related as this theme does not use the different post type options that is present in the newer themes. And from what I did find elsewhere, selecting different options in that meta-box can alter this behaviour. I will probably be changing themes in the coming months as I work further on my own custom theme, but for the time being if I want it to appear on the first line, I will use the appropriate [ embed ] code above (with the space removed!). This was not a problem I found documented anywhere else, so hopefully you have found this useful!

WordPress MultiSite & sunrise.php

Are you getting the above error message as well?

After doing a fresh install and enabling multi-sites I couldn’t see the Domain Mapping and Domains sub-menu options under Network Admin / Settings.

I loaded up my trusty editor and confirmed

define('SUNRISE', 'on' );

was in fact in the file. It was slightly higher than where it said, it’s not important, but I moved it anyway, and I still got the error.

I checked and sunrise.php was in fact in the correct location under /home/public_html/wp-content/sunrise.php

So how did I fix it?

The problem was, it was the incorrect (read:old??) sunrise.php file!

Copy the correct one from:

/home/public_html/wp-content/plugins/wordpress-mu-domain-mapping/sunrise.php

and replace the previous one, and reload your admin page. You will now see the welcoming domains page :D

If you want to find out more as to why it happened, and how it is that my sunrise.php got “moved” or “re-moved”, it was due to a conflict by domain mapping plugins. I’ll be blogged about it in the near future and it will appear here (currently in draft and not published).

Change iTunes Language and Store Location

I had the need to setup my sister-in-law’s phone today from an iPhone 4 to an iPhone 6. In the process we needed to change her iTunes AppStore language from her default to English, and also change her store location. Even though her language settings had already been changed to English in the usual settings location, iTunes still had her in a foreign store with her home language.
Continue reading “Change iTunes Language and Store Location”

accented characters in osx

selectable accents for the letter 'a'
selectable accents

UPDATE: I upgraded my OS X to Mountain Lion recently and I am not sure if it is as a result of the upgrade, or some other setting change I may have made, but now if I hold down a letter key for a short period, I get a tool-tip style box (right) that then allows me to select the appropriate accent. This doesn’t work for all letters, but it does make it more convenient.

I had a need to be able to print accented characters on certain letters, mainly being vowels, but potentially others as well. Most character sets have a limited set of accents, and most of them only apply to certain letters, and others don’t have the accents I want.

For example I want to print 5 main types of accents, being:

à á ā â ǎ

another example

x̀ x́ x̄ x̂ x̌

I’m using a macbook pro and pages in OSX, although this applies to any application, this is how I did it:

Open up System Preferences >> Personal >> Language and Text >> Input Sources

Once there, add a new keyboard, in this case I added “US Extended”.

Now to add some accents, I need to type the accent first, and then the character, but this only works for some letters (I suppose those that can be normally accented), but as you can see above, I have accented the letter ‘x’. So achieve this you must type the letter first and then [option]+[shift]+[code]. Not too hard, the five I need are:

  • a bar over the letter – ā – [option]+a then type the letter
  • a ‘v’ over the letter – ǎ – [option]+v then the letter
  • a ‘^’ over the letter – â – [option]+^ then the letter
  • a ‘`’ over the letter – à – [option]+` then the letter, and finally
  • a ‘ ́’ over the letter – á – [option]+e then the letter

^ <– is [shift]+6
` <– is the back tick, or key with the tilde (~) on it
́ <– is the quote mark key with single and double quotes [‘,”]

It was that simple :-)

note: I am learning the thai language and it is a very tonal language and inflections on letters are necessary to determine the tone of the word, hence I need this ability. These 5 marks above fit the bill perfectly, although the bar one really isn’t needed, but at least now I have the option of including it, or not including it.

Originally found here: http://tlt.its.psu.edu/suggestions/…

RFID and hotels

calming image
a totally unrelated picture

Three of the last four hotels I have stayed in that used RFID tags for the rooms have absolutely sucked. Big time. Currently staying in the Novatel, KL, Malaysia and were only here four nights. The very first morning after having breakfast and travelling up 25 floors BOTH my wife’s RFID card and mine had decided to fail, yet mine did allow us to enter the floor – the floors are protected by RFID as well.

Then the first afternoon coming home they both failed again! The guy at reception reprogrammed our cards and gave us a third one.

Yesterday, my wife left her card in the room, along with the spare and when we got back mine failed again. We went back down. He reprogrammed mine and gave us a fourth card.

Today, after lugging up all our shopping, both my card, my wife’s card and one of the spares would not open the door. The second spare (luckily) did! But I would have been very peeved if it hadn’t!

The other recent hotels that used RFID and we had problems included big name, fancy places in Koh Samui (and that was a LONG walk back to reception), and Koh Phi Phi (again, another long walk – the longest – back to reception!). I would name them but I honestly forget the names. The only RFID card we haven’t had problems with was the most recent in Singapore – the (overpriced) V Lavender Hotel above the Lavender MRT.

I tried to recall, I thought for a moment swipe v actual RFID cards may have been worse, but the verdict is still out. Two have been swipe, and one was proximity type RFID. So, probably, this post is incorrectly titled. So sue me :/)

BTW, the image of the water is supposed to be a “calming effect” type of thing. This is just such an annoying thing that one needs a little meditation, medication or to go for a drink :-)