Lenovo Miix 300 tablet and Windows 10

I used a Google Nexus 7 for a couple of years and it was a great device for web browsing and watching YouTube videos. I found I was using the laptop much less and using the tablet for most things. The only limiting factor was the 7-inch screen size which made some web sites difficult to read and navigate.

Although I enjoyed using Android, I was also interested to try out Windows 10 on a tablet as it would be useful to have a super miniature PC-compatible option to use on the go. I still miss the netbook form factor that the Asus EEE PC 901 provided – mine still works, and is usable for some things with a lightweight Linux distribution installed.

Lenovo Miix 300

After looking at the options, and not wanting to spend a lot, I ended up with a Lenovo Miix 300. This is a 10-inch tablet that came with a detachable keyboard with a built-in touchpad. It has an Intel Atom 1.33GHz processor, 2GB RAM and a 30GB SSD drive. It also has a Micro SD slot to add more disk space. The operating system is Windows 10 Home and it comes with a cut-down version of Microsoft Office Mobile.

Lenovo Miix 300

The keyboard is pretty good with large keys with good travel, although the layout of some of the keys is odd and this can cause some frustration when typing. The touchpad is just about usable but is the weakest link and often seems jerky and unresponsive. Plus a slight brush while typing causes the cursor to jump around and you end up typing in a random location in your document.

The tablet attaches to the keyboard with a couple of prongs and a five pin connection. Despite the keyboard being a solid unit, the connection to the tablet is flaky and tends to disconnect with the slightest movement. Using it on your lap is a not really an option.

Windows 10 as a tablet OS

This is the first time I’ve used Windows on a tablet and it’s a bit of a mixed bag. Here are a few observations:

  • the on-screen keyboard sometimes disappears mid-word taking whatever was being typed with it. Also it often doesn’t appear when an edit control is selected and you have to press the tray icon to make it pop-up.

    The numbers share the top line of the QWERTY keyboard, and to use them you have to press and hold on the key, and then drag to the number on the pop-up that comes up. It makes typing passwords and filling forms tricky. The Android keyboard was miles better

  • even in tablet mode, some of the icons and buttons are too small to click on reliably

  • after the restart following each Windows update, the system clock drifts from the real time by several minutes. This causes apps like Twitter and Facebook to stop working as the system time is too far from their server time and their security measures don’t like it. Toggling the ‘Set time automatically’ setting off and then on again fixes it temporarily, but within 30 minutes it will be 5 minutes out again. It can take several shutdowns to fix this

  • The whole settings app/control panel is just a mess, and this applies to the desktop version as well as on a tablet. It just shows up how Windows 10 is trying to be two different things at the same time and not succeeding particularly well at either

  • The apps available from the Windows store are not as mature, feature rich or plentiful as those for Android. For example, the Amazon app on Windows is basic and it’s probably best to stick with their website, where as on Android their app is brilliant.

    The Twitter app is so poor that I had to buy a replacement in the shape of Tweetium

  • It is however nice to be able to use regular Windows programs on such a compact device, and with the keyboard attached, it makes a useful way to work on the go. On a recent train journey I was able to comfortably type notes and even work on a C program with Pelles C – I don’t think Visual Studio would even look at a machine like this!

Windows 10 has promise as a tablet OS, but Microsoft still has some work to do if they want to beat what Google has done with Android.

{ Comments are closed }

Using Markdown with WordPress

I prefer to write in plain text using Notepad++ so I had to find a way to make this work with WordPress.

I installed WP-Markdown from the WordPress plugin list, and then switched it on by going to the Settings – Writing page and ticking next to Posts and Pages. The help bar is useful to have, so I ticked that as well. As I will sometimes post source code, I ticked the Prettify option to have any code syntax highlighted.

Screenshot of the Markdown settings

The usual WordPress visual and text editors are replaced by a Markdown editor where text can be pasted from Notepad++. As far as I can see existing posts will be converted to Markdown if you edit them, but as I only have a few posts this was not too much of a concern for me (YMMV!).

When writing a post, the help bar allows direct editing of the text and a preview of the formatted text appears beneath the editing area.

Below is a short sample of some of the formatting supported (ignore the syntax highlighting – don’t think it understands Markdown!).

### Markdown example

Paragraphs are made by joining 
all of the text that appears between
blank lines.

Text to appear in *italics* should be surrounded by asterisks and a pair of
them for **bold text**. Underscore characters can be used __if you prefer__.

*   Bullet points start with an asterisk

*   The bullet point above had one line, but bullets can consist of 
    multiple paragraphs of text.

    Extra paragraphs should be indented by a tab or 4 spaces.

*   These points are separated by blank lines so will be wrapped in `<P>` tags

Now for some numbers:    
1. numbered items start with a number, a dot and at least one space
1. note that the items are numbered automatically
1. there are no blank lines between these items, so they will not be wrapped 
   in `<P>` tags

Blocks of code can be included by indenting by a tab or at least 4 spaces. 
Here is some C code:

    #include <stdio.h>

    int main(void)
    {
      printf("Hello Pelles C World\n");
      return 0;
    }

Links are made with square brackets for the link text and round brackets for
the address [like this link to Google](http://www.google.com/) or by using 
a second pair of square brackets like this [link to Google][2] and listing
the address later.

Images can be included by using syntax similar to links but with 
an exclamation mark. Start with the ALT text, then the index of the 
thumbnail and then the index of the full image.

[![Screenshot of the WP-Markdown editor][3]][4]

Here are the results of the above text formatted by WP-Markdown.

Markdown example

Paragraphs are made by joining all of the text that appears between blank lines.

Text to appear in italics should be surrounded by asterisks and a pair of them for bold text. Underscore characters can be used if you prefer.

  • Bullet points start with an asterisk

  • The bullet point above had one line, but bullets can consist of multiple paragraphs of text.

    Extra paragraphs should be indented by a tab or 4 spaces.

  • These points are separated by blank lines so will be wrapped in <P> tags

Now for some numbers:

  1. numbered items start with a number, a dot and at least one space
  2. note that the items are numbered automatically
  3. there are no blank lines between these items, so they will not be wrapped in <P> tags

Blocks of code can be included by indenting by a tab or at least 4 spaces. Here is some C code:

#include <stdio.h>

int main(void)
{
  printf("Hello Pelles C World\n");
  return 0;
}

Links are made with square brackets for the link text and round brackets for the address like this link to Google or by using another pair of square brackets like this second link to Google and listing the address later.

Images can be included by using syntax similar to links but with an exclamation mark. Start with the ALT text, then the index of the thumbnail and then the index of the full image.

Screenshot of the WP-Markdown editor

Here is the full Markdown syntax reference.

{ Comments are closed }

Colour in the Windows console with Curses

Console programs in Linux often use the Curses library to display colourful and attractive user interfaces even when running in a terminal. I wanted to use something similar for the display of a Windows console utility I am writing in Pelles C. The program processes large data files and can take a while to complete, so it is useful to show progress as the program is working.

Pelles C has a CONIO library similar to the one I remember from Turbo Pascal years ago, but I wanted something that would still work if I need to use a different compiler in future. Plus I’ve always been impressed by what is possible with Curses and wanted to give it a go as a learning exercise.

There are several implementations of Curses for use with Windows but I am using PDCurses.

Start by downloading the file pdc34dllw.zip.

The ZIP should contain 4 files:

  • Copy the files curses.h and panel.h into C:\Program Files\PellesC\Include

  • Copy the pdcurses.lib file into C:\Program Files\PellesC\Lib

  • Create a new console project in Pelles C and copy the pdcurses.dll file into the project folder

At the top of your C program, add the following 2 lines:

#include <curses.h>
#pragma comment(lib, "pdcurses.lib")

You can now add code to your program to use the Curses functions.

All of the functions available are described in the PDCurses documentation and I also suggest you check out the NCurses documentation as it is very comprehensive and mostly applies equally to PDCurses. If you are not familiar with programming using Curses, have a look at the NCURSES Programming HOWTO to get started.

Here is a screenshot of my test program as an example:

Screenshot

At the top of the screen is a header that shows the program name and version, the input filename and a count of the lines processed so far. Underneath, the main part of the screen is used to show scrolling text as the process is working.

Download my example program cursetest.c if you want to give it a try.

{ Comments are closed }

Using Pelles C to compile simple C programs

Recently I have been refreshing my knowledge of C programming by reading C Primer Plus by Stephen Prata and trying out the code samples. Although I use Microsoft's Visual Studio for most stuff, it's a bit heavyweight for the sort of 10 line example programs in the book.

After searching for a leaner alternative, I found Pelles C which is a really great pure C development system for Windows.

As well as a compiler supporting the latest C11 standard, it has a nice simple IDE and a lightweight project manager. Also the help text is short and to the point and you don't need to scroll through multiple screens as you often do in Visual Studio/MSDN.

Get the 32-bit or 64-bit setup file from the download area of the website. The 32-bit version was only 9.6MB so pretty lean!

After installing, to create a project for a basic console program follow these steps:

1) Choose File -> New -> Project from the main menu

2) From the the New Project window, Empty projects section, choose Win32 Console program (EXE)

3) Type a name such as HelloWorld for the name of the new project

4) In Location use the .. button to choose the folder where your projects will be saved, eg C:\Source\CPrimer\. The name from step 3 will be added to give a project folder of C:\Source\CPrimer\HelloWorld

5) You should now have a screen with the empty project showing at the right side of the screen. From the menu choose File -> New -> Source code

6) Use File -> Save and name the file HelloWorld.c

7) A message box will ask if you want to add the file to the current project, so click the Yes button

8) Now you can add your code to the edit window

9) Use the items on the Project menu to build and execute your program

Any compiler errors will be displayed in a panel at the bottom of the window, and you can double-click on a message to go to the location of the error in the edit window.

{ Comments are closed }

Useful Notepad++ Settings and Plugins

Notepad++ is a great, fast editor for working with plain text files in Windows.

I like Notepad2-mod for ultimate Notepad-like speed, but Notepad++ has some great features like multiple file tabs and loads of useful add-ons to make it even better.

The Document Map is really useful for scrolling around text files, although the Function List is even better when programming in C.

To see the list of available plugins, go to the Plugins menu and select Plugin Manager and then Show Plugin Manager. The Available tab shows all the good stuff that can be installed.

Here are a few useful plugins that I use:

  • DSpellCheck shows wrongly spelled words with the squiggly red underline we know so well from Word! Right-clicking on a marked word will show a list of possible corrections. The plugin uses HunSpell dictionaries – go to Plugins -> DSpellCheck -> Settings to install dictionaries
  • MarkdownViewer++ shows a sidebar to the right of the Notepad++ window with a preview of how a Markdown document will be rendered when converted to a formatted document
  • Customize Toolbar tidy up the toolbar and remove things you don’t need for a more compact display
  • Snippets great way to save typing and insert those tricky HTML codes you can never remember

Notepad ++ showing MarkdownViewer++ sidebar:

{ Comments are closed }

Using Notepad++ and Pandoc to write documents

Having got fed-up writing long documents in Word, I switched to using the text editor Notepad++ instead. Unfortunately, this means I was left with the task of formatting the final text in Word before I could distribute it. Then if there were amendments to make, I would end up doing them in Word to avoid having to do the formatting again.

There had to be a better way! I only need a few basic formatting features like headings, bullets and the odd link. If only I could use some simple mark-up and then convert to Word automatically.

After some Googling I found Markdown, a way to write in plain text with simple formatting. Couple this with Pandoc and a plain text file can be converted directly into a neatly formatted Word DOCX file.

Here’s the command I use to do the conversion:

pandoc input.txt -f markdown -t docx -s -o output.docx

One point to note is that the text file needs to be saved in UTF-8 encoding as that as what Pandoc expects.

Even better, you can get Pandoc to generate a blank DOCX template for you, and then customise it with your own styles, footers and page size etc. Then add the name of the template to the end of the command line like this:

pandoc input.txt -f markdown -t docx -s -o output.docx --reference-docx=template.docx

I can now do all my editing in Notepad++ and convert to a Word document at the last minute. Joy!

Here’s a handy page with a Markdown Cheatsheet.

{ Comments are closed }