Tag Archives: delete

Ubuntu 12.04: How to Format a USB Flash Drive CodeUnit 22 JUN 2012

If you are a Microsoft Windows user then no doubt you’ll be quite familiar with the concept of right-clicking on a USB flash drive icon under My Computer, selecting the context menu option ‘Format’, and then formatting your flash drive so that it is nice and sparkly empty. Unfortunately for us though, that tried and tested method isn’t quite supported under Ubuntu Desktop.

Using Ubuntu 12.04, this is one of the ways in which you can however format your USB flash drive. First, plug your USB stick in and wait for it to mount. Then open the Ubuntu Unity dashboard and type in “Disk Utility”.

Launch the resulting application and select your USB flash drive which should be listed in the left hand side device list. Scroll down the resulting page until the ‘Format Volume’ button becomes visible.

Click on this button, select the file system you want to use (9 out of 10 times, stick with FAT as this is supported by the widest range of devices) and hit the Format button.

Finally, marvel at how the application merrily discards all data currently on your USB flash drive before returning control of it to you, all sparkly empty.

How to Delete a YouTube Video CodeUnit 01 JUN 2012

Of course, the ability to delete videos that you uploaded is a must, and so, YouTube gives you the necessary tools to achieve this – though that said, I couldn’t figure it out the first time around, meaning a short trip to Google would have to solve it for me. And now that I know, I may as well record it here for future reference.

How to delete a YouTube video.

First, log in to YouTube and then click on your username in the upper right corner of any YouTube page. From the resulting drop-down menu, click on the Video Manager menu option. Identify the videos that you wish to delete from the list of videos, and mark the checkbox for each corresponding video to delete.

Now click on the Actions button at the top of the page and from this resulting drop-down menu, select Delete.

One confirmation screen later and you will be good to go, your YouTube footage now lost forever in the mists of abandoned digital pixels…

Nifty.

Why You Shouldn’t be Tweaking Your Blog at 01:00 in the Morning! CodeUnit 22 JUL 2011

Last Friday night I was having fun developing my first ever WordPress plugin (a thumbnail archive page if you must ask), that I happily stayed awake well past midnight to work on it. Now of course this was at the end of a week long slog at work so I was pretty tired as you can well imagine (yes, yes, I’m not as young as what I used to be!), but the excitement over what I was busy getting up to was more than enough to keep me awake, fingers glued to the keyboard as I furiously typed away at my PHP code.

But as it is with all good things, I had to eventually call it a night, as my mind and eyes slowly succumbed to the alluring call of bed, and I finished up with what I was busy and logged out of the FTP manager. Now properly tired, I thought hang on a minute, it is past midnight so my Google Analytics stats would have updated, meaning we can have a quick peek at Friday’s numbers, right?

So I duly logged into Google Analytics, checked the numbers, and then did something silly.

Because at a stage I also ran Touchwork’s Txt and Tell project’s analytics under my private account, I have two main Analytics accounts under my main Dashboard view. Seeing as I am no longer associated with the Txt and Tell project, I decided to delete that account, and so happily clicked away through the dialogs (of course saying yes to the all important “I’m sure because this is PERMANENT” one), before stepping back and smiling at my now cleaner Analytics dashboard view.

Except the smile didn’t last more than half a second.

In my blurry, hazy, sleepy state, I had accidentally deleted my personal Google Analytics account instead of the Txt and Tell one, wiping out all my Analytics accounts across ALL of my websites in one fell swoop!

Damn it.

(So Saturday morning I spend a hour recreating Analytics accounts and installing them across my various sites. Wifey was not impressed with my dawdling in the office on a day with so much to do I might add!)

And that, ladies and gentleman, is why you shouldn’t be messing around on the Internet after midnight and more importantly, when your mind has already shut down for the night! :)

LastPass: How To Delete All Saved Vault Items at Once CodeUnit 24 NOV 2010

LastPass is a fantastic password vault application available over a number of different platforms and with a huge range of rather useful features that includes things like automatic form filling, one-click login, synchronization across browsers and of course bullet-proof password management/storage.

Our quick little how to today deals with how to easily delete all your stored vault items at once.

Of course, if you have time and are a patient person, you could go row by row, deleting each item one item at a time by clicking on the delete action, but obviously if you were that type of person you wouldn’t be reading this post.

So instead, let me show you how to achieve deleting multiple or all items in one swoop. If you didn’t realise it yet, the LastPass vault acts a bit like a normal folder view, meaning that you can select multiple items by the usual combination of either holding down shift or ctrl and left clicking on the desired items.

Once you have selected all the items you wish to remove, simply right click and select the “Delete Selected” option in order to remove those vault items.

Simple.

Related Link: http://www.lastpass.com

Ubuntu: Delete Files Older than a Certain Number of Days via the Terminal CodeUnit 10 AUG 2010

For example, let’s say you currently do non-incremental backups of your data on a daily business. If you don’t keep an eye on it, pretty soon your backup folder will run out of space and your system would come crashing down – so maybe it isn’t such a bad idea to run a cron in the background that deletes unnecessary files that are older than a specified number of days.

So how do we do this?

Well one solution is to make use of the powerful little find utility that comes with pretty much any variant of Linux. What this littly beauty does is offer you a whole lot of useful arguments, one of the most interesting being that of specifying a command to run on each file found!

Leveraging this functionality, we will first use the find command to locate our files older than a nuber of days and then use the rm command to delete them.

So how would the syntax for this look then?

find /path/to/files* -mtime +7 -exec rm {} ;

(Note the spaces between rm, {} and ;)

The first argument is the path to the files, it being either a path, directory or even a wildcard as indicated above. Full path is probably the safest though!

The second -mtime argument is used to specify the number of days old a file needs to be in order to qualify for the search. If you enter +7 like we have, then find will return all files older than 7 days.

Finally, the -exec attribute allows us to pass our command (like rm) to the find function and apply it against each of the located files. The {} ; at the end is simply a control sequence to terminate the command.

Nifty.

Ubuntu Subversion: How to Delete a SVN Repository CodeUnit 27 JUL 2010

Although there is tons of documentation on creating new SVN project repositories for your shiny Ubuntu SVN (subversion) server, there isn’t all that much mention of how you actually remove a project repository should you no longer need it.

Funnily enough, that’s probably because the answer to this question is particularly easy.

Simply delete the desired project folder from your repository root and you are done.

Nifty.

PHP: Delete all Values to Reuse a Keyed Array CodeUnit 25 MAR 2010

It’s sometimes pretty valuable to reuse array structures if you’re kind of doing a task over and over again, and don’t necessarily want to recreate the array’s keyed structure from scratch with each iteration. In other words, it would be really nice to have a function that automatically sets every element in an array to null but doesn’t actually mess up the array in the process.

Sounds pretty logical and something that most people could use, but believe it or not, no native little PHP function actually exists to do this for us! O.O

Okay, so now that you are over that little bit of shock and horror, let’s quickly whip up some code to do the job ourselves. First, we’ll start be declaring a function that returns a blank or in this case empty string value:

function clearValue($value)
{
	$value = '';
	return $value;
}

Right, the next step is then to apply the handy array_map function we discussed previously in this blog, forcing it to apply our newly created function to the array at hand.

$qsvalues = array_map("clearValue",$qsvalues);

And Bob’s your uncle. The keyed array $qsvalues will now be sitting with a blank string in each and every one of its elements, exactly what we were looking for! :)