Monthly Archives: June 2014

How to swap the post title and date in P2

wordpress-iconI’ve just posted this tweak in the WordPress P2 forum to help a user and thought I’d add it here too before I forget what I did.

To swap the post title and date in P2 we’ll first grab a reference to each element, then we move one up and the other down.

Like so:

Note that the date line does not have a selector for the author, so it’s difficult to remove it if that’s required. You can remove the entire line though (#main h4).

Add padding where appropriate.

  • http://wordpress.org/support/topic/blog-date-after-title?replies=2

How to use iCloud in your iOS App

In this series I’ll show you how to use iCloud in your iOS apps. We’ll discuss how to setup Xcode and your app, including App ID and Provisioning Profiles and I’ll demonstrate how to use all three flavours of iCloud: Key Value Storage, Document Storage and iCloud with Core Data.

The rest of this series is for members of my iOS Dev Diary only – you can watch it here: http://pinkstone.co.uk/how-t-use-icloud-in-your-ios-apps/

Enjoy!

How to enable Touchpad Taps as Mouse Clicks on your NC10 in CentOS

CentOS-LogoThe NC10’s integrated Synaptics Touch Pad works out of the box in CentOS 6, both under GNOME and KDE. No drivers or patches requried.

But I remember that when it was running Windows XP I could “tap” the pad instead of clicking the dedicated key (that loud CLACK noise annoys the neighbours). How can we bring this behaviour to CentOS?

A quick serach reveals this post by Russel in the CentOS forum:

  • https://www.centos.org/forums/viewtopic.php?t=4560

his suggests that a configuration file needs to be created somewhere. However I found that there’s an easier solution which – at least on the NC10 – works with just one click. I assume this will work for other latops too:

  • head over to System – Preferences – Mouse
  • select the Toucpad tab at the top
  • tick the box “enable mouse clicks with touchpad”
  • works instantly

Tourpad-Taps

How to install Dropbox on CentOS 6 from source

Dropbox-LogoBeing the sport that I am I thought I’d install Dropbox from source on my NC10. Even though an rpm installer package is available, I do enjoy a challenge.

My laptop is cunnrently running CentOS 6.5 (32bit) and has GNOME installed.

Turns out I needed a couple of packages – and before I forget, here’s how I did it. We’ll do all this from the command line (you have to be root for this):

Pick the latest .tar file from here https://linux.dropbox.com/packages/, then download it with

Extract and enter the directory it produces:

At this point the following sequence of commands should build the project:

However on my system I received an error message after ./configure, letting me know that I needed the libnautilus-extension and docutils packages. I installed them with

Once installed, make and make install worked fine. If you run into issues, make sure you’re logged in as root, or prefix every command with sudo (as in “sudo make install”).

Now Dropbox is installed but it’s not running or configured. Let’s do that next:

This will start the daemon and prompt you to download the desktop client from the GUI which will allow you to login and sync your content, just like on Windows and Mac.

  • https://www.dropbox.com/help/247/en
  • https://github.com/dropbox/nautilus-dropbox

How to install GNOME on your Samsung NC10 (CentOS 6.5)

CentOS-LogoWith the WiFi card on my NC10 enabled, I struggled to connect to my actual WiFi network from the command line (WPA2). After an entire day of research, trial and error I had to admit to myself that setting this up on a minimal CentOS 6 installation is simply beyond me.

Likewise, monitoring the levels of my new battery had me greatly puzzled.

But those two points aside, I also wanted to install a Desktop type environment on my NC10 so it would be more useful – now that it has a new battery and all.

As it turns out installing GNOME – almost as a side effect – will take care of both those problems in a flash: easily connecting the NC10 to my WiFi network, monitoring my battery, and so much more.

Let me show you how I did it.

My machine has a minimal CentOS 6.5 installation on it and I’ve installed the Atheros driver as explained in my previous article. I’m on a wired network connection to install the additional GNOME packages.

yum groupinstall

I didn’t know this but yum is even more magical than I always thought: not only can it install single packages and resolve their dependencies; yum can also install entire sets of packages called groups.

To see what’s available type

This will show you a huge list of available and installed groups. We’re interested in the following:

  • Desktop
  • Desktop Platform
  • X Window System
  • Fonts
  • Internet Browser

To install all those without being asked for every group, type

Since groups can have spaces in their names it is necessary to put them into “quotes” . Once issued, yum will go to work. This will take some time so let’s grab coffee.

Thanks to the Vagabond Geek and Jeff Hunter for the above info.

Using GNOME by default

Now that my NC10 is more of a laptop rather than a remote web server, I like the idea of booting into the desktop environment by default. To do this tweak a single number in /etc/inittab:

Above this line you’ll see an explanation of what each ID will do at boot time. Realistically you’ll only ever need to worry about 3 and 5. Save the file and restart your system – and upon next boot you’re prompted to create a new user, or login with existing credentials.

Change it back anytime you like.

 

NC10 – meet GNOME

I had looked at GNOME many years ago on an old and long retired slow Sony Vaio laptop – and was surprised how relatively slick it runs on the NC10’s underpowered hardware.

To my surprise things like the integrated Samsung Function keys for screen backlight and volume were working out of the box without the need for additional drivers or patches! Just like the touchpad – it just works. Same with monitoring my battery level.

Bravo, CentOS! Here’s what the NC10 looks like running GNOME:

GNOME on NC10

 

Connecting to your WiFi Network

GNOME isn’t all that different from other desktop OSes and reminds me of Windows and Mac OS X. You connect to your local network simply by clicking the “antenna” type symbol at the top of the screen, pick your network from the list and enter the password.

If you’ve ticked the relevant box, you’ll be connected automatically on subsequent logins.

 

Why CentOS on the NC10? Why not use Windows?

My NC10 came with Windows XP back in 2009 when I first bought it – because Vista was such a joke and nobody wanted it.

Later models of the NC10 came with Windows 7, but 2GB of RAM are highly recommended – and mine only has 1 GB. “Recommended” doesn’t mean that the experience is going to be great though. Windows 8 isn’t even an option on the NC10.

But more importantly, XP is has ended extended support in April 2014 – and Windows 7 is going to exit mainstream support in January 2015. At the time of writing that’s in 6 months.

CentOS 6 will be around until 2020 and copes extremely well with the NC10’s hardware.

 

I’m confused: X11, GNOME, KDE… what’s all this?

You and me both, brother! As I understand it, GNOME and KDE are both desktop systems that show you a graphical user interface (GUI) – much like Windows and Mac OS X. They both look slightly different and are developed by different teams.

X11 is the actual engine that allows apps to interact with content in windows. This wasn’t always the case, especially in the early age of computers which were text and column based. X11 is a breakthrough and allows for processing to happen on a remote machine, while graphics are rendered on the local system.

As with many things in Linux, you have a choice of which GUI you’d like to run: GNOME or KDE. You can even install both on your system and boot into the one you fancy:

Or, from GNOME, head over to System – Administration – Add/Remove Software and search for KDE, then install it from there.

Once the install is complete, log out (top right) and log back in, selecting your desired interface from the drop down at the bottom. Here’s what it looks like on the NC10:

KDE-NC10

Both systems get the job done and it really comes down to personal preferences and needs.

GNOME is a more “barebones”, while KDE contains accessories like a calculator, games, different web browser and a whole lot of other stuff by default.

I found that on the NC10 I much prefer GNOME over KDE – perhaps because GNOME reminds me of Mac and KDE of Windows. As I said, it’s really about personal taste.

 

Further Reading

  • https://thevagabondgeek.com/centos-yum-groupinstall-basics/
  • http://www.idevelopment.info/data/Unix/Linux/LINUX_AddGNOMEToCentOSMinimalInstall.shtml
  • http://toastytech.com/guis/remotex11.html
  • http://windows.microsoft.com/en-us/windows/lifecycle

How to enable WiFi on your Samsung NC10 under Centos 6.x

NC10When I installed CentOS on my NC10 last year I did so knowing that its battery was bust. Since it wasn’t going to live without a power supply, I didn’t setup WiFi at the time – the NC10 being tied to one cable, I simply added another (the network cable) and that was that. Worked fine and without problems.

Today a new battery for my NC10 arrived, breathing new (wireless) life into the little guy – and needless to say now I wanted to setup WiFi. Sadly I don’t know enough about network adaptors under CentOS, so I thought how hard can it be?

Actually it’s easy – it’s just not very well documented on the whole wide web due to the multitude of Distribution vs Hardware configurations.

Thanks to two great articles (by Joris and Paul – find links at the end) I managed to connect my NC10 to my WiFi network: an Apple AirPort Timecapsule. It works a treat. Thanks guys!

I deviated a little from both articles, so here’s the “remix” which should work specifically for the Samsung NC10. I’m running CentOS 6.5 in 32bit, minimal installation without any bells or whistles, on a 1GB Intel Atom machine.

Continue reading How to enable WiFi on your Samsung NC10 under Centos 6.x

How to dismiss the keyboard from a UITextField in iOS

In this screencast I’ll show you how to dismiss the iOS Keyboard, which is commonly brought up by a UITextField – but doesn’t want to leave easy once summoned.

It’s easy to overlook a step in this procedure, so I thought a screencast is in order. We’re discussing two dismissal options here:

  • when the DONE button is pressed
  • and when users tap outside the textfield

The latter option isn’t built into iOS, but users have come to rely on this behaviour. I’m using Xcode 5.1.1 and iOS 7.1 in this demo.

Happy hacking!

How to load a .PRG file in VICE

Commodore LogoUsually you’d attach a disk image to the VICE emulator and load one of several files from your virtual disk. Occasionally though you’ll come across single files ending in .PRG – those are the files that are contained on a disk image.

Remember those weird three letter abbreviations on the right hand side when you list your floppy directory?

DIrectory

Those are the extensions of single files (there’s PRG, SEQ, USR and REL), and the actual file name appears on the left.

VICE can attach disk images, but it can also display lose files we may have stored in a directory. All we need to do is tell VICE where that directory is and it will make it accessible to the virtual machine.

To do this, start your favourite emulator and head over to Settings – Peripheral Settings. Next pick the drive you’d like to attach the directory to (say Drive 8) and tick the box that reads “Use IEC Device”. Now pick the desired directory and you’re all set!

This will turn the entire directory into a disk image on the fly. Now you can list whatever is in said directory either with DIRECTORY or LOAD”$”,8 followed by LIST. Load and run your .PRG as you usually would.

Capture

This works fine on the C64 and C128 emulators. The Plus/4 seems to have a problem with this approach as of VICE version 2.4.

How to use the Commodore C128 in 2MHz FAST mode

Commodore LogoThe C128 could run twice as fast as its predecessor, the legendary C64. All you had to do was issue the FAST command, or switch back with the SLOW command to its default speed (1MHz).

One drawback of using FAST mode was that the VIC which powered the 40 column (standard) display wasn’t capable of such a high frequency and therefore would go blank when use go FAST. You had to work on the 80 column display to reap the benefits of a faster computer.

Here’s how to first switch into 80 column mode, then go fast:

and to switch back into 40 column slow mode:

Switching GRAPHIC modes was not necessary to perform long running calculations though – as long as that blank screen isn’t a problem for the user. Consider this:

During the “screen outage” keyboard commands were accepted as usual too, so you could type SLOW on the blank screen and see your 40 column display come back to life.

How to switch graphic modes on the Commodore C128

Commodore LogoThe C128 had various chips to display different kinds of graphics that man just stuck to the standard 40 column text display for “ease of use” and let their software handle the rest.

To appreciate why these modes existed one had to understand what was happening behind the scenes. Here are the various modes and how to enter them, followed by a brief explanation of why they came to be:

Optionally you could add a “clear graphics” parameter by adding a comma (like GRAPHIC 1,0 or GRAPHIC 5,1). 1 would clear the graphic portion while 0 would leave it in memory.

Split screen mode could be used when you wanted the top part of the 40 column display to show graphics and the bottom part text – much like the Magnetic Scrolls text adventures did on the C64:

Lab

You could define where this split would occur with another optional parameter between 0 and 25 (0 being no text, and 25 being all text). When no optional parameter was given the split would occur at line 20, leaving 5 lines of text underneath the “super high resolution multimedia graphics” (and an ugly flickering line where said split occured).

For example:

The 80 Column Display

While the VIC chip would take care of the 40 column text and graphic display just like it did on the C64, the 80 coilumn display was powered by a MOS 8563 chip which wasn’t officially supposed to display anything other than text. Even though the hardware did support graphics, BASIC 7 commands did not.

The good news was that this made a dual monitor setup possible – and thanks to VICE we can emulate exactly that. This makes it possible to write programmes on the 80 column display, while creating graphics “live” on the 40 column display. Back in the day with Commodore’s “Dual Monitor” you had to press a button to switch between modes and see your results (most of us just didn’t have two different monitors at our disposal).

Switch to the 80 column display by executing GRAPHIC 5, and type GRAPHIC 0 to switch back to 40 column mode.