Monday, October 29, 2012

Insert a Table of Contents in a Google Doc with LibreOffice

In another post, I told of my troubles with LibreOffice and Outline Numbering and how it stopped me from setting a table of contents in a file I downloaded from Google Drive.  Finally, I successfully inserted a table of contents into a Google Docs document using LibreOffice with the correct page numbering. It's not hard but somewhat tedious. There are basically 4 things you need to do.

Step 1: Setup the document.

Download the Google Doc document as an LibreOffice/OpenOffice .ODT file. It will likely download it into a temp file. Normally, you can't edit that. So save the file somewhere else to allow for editing. Move the cursor top of the page.
Insert a manual break and change the type to Page Break. Then set the Style to be Default. Now change page number to 1.
Again, move the cursor up to top of document.  Press F11 to bring up the Styles and Formatting window. Select the Page Styles icon from the top row and double click on the First Page style.
Just to check, move the cursors between the top of the document and into the other section and back up and check the name of the section on the status bar at the bottom of the window. The top one should say First Page while the one below it should say Default.
For a better way to do it, scroll down to the comments sections and check out Julian's way of doing Step 2 onward.

Step 2: Correct Outline Numbering styles
Click on Tools - >  Outline Numbering to bring up the Outline Numbering window.
Select Level 1 from the list on the left. In the Paragraph Styles section, choose Heading 1.
Now select Level 2 from the list. Under Paragraph Styles, select Heading 2.
Repeat the process for all levels that have an empty Paragraph Sytle.

Thursday, October 25, 2012

A tale of Tables of Contents, Google Docs and the Outline Numbering Monster

I love Google Drive. Specifically, I love Google Docs. It gives me what I always wanted. A word processor on demand, whenever, wherever I need it. As long as I'm near a browser. On a PC connected to the Internet.
Both of which is becoming more common by the day.
To tell the truth, I never really pushed Google Docs. I never really asked too much out of it because I never really needed more than a simple word processor. Have you ever been to a Microsoft Word class where they say that 90% of Microsoft Word users never really use more than 30% of it features. I'm one of those 10% of Microsoft Word users. There is not much I haven't done on Word. Frames. Pictures. Multiple Columns. Sections. Cross-references like footnotes and endnotes. Renumbering pages. Hierarchical documents, where a document is made of many documents that other people are writing. I've even done some marcos and VBA. Did you know that holding SHIFT and selecting text with a mouse will select a square block of text, not lines of text. Did you also know that you could set the background of the editing areas to blue. It was a feature to make WordPrefect users feel at home.
Despite all that, I've never asked a lot from Google Docs. I did ask much perhaps because I was still in awe of the ability to have word processor in a browser. A browser!
That changed recently when I did a proposal for a client. Working with other people in different geographical locations in a single document is what Google Docs was made for. No sending files back and forth. No problems of updating different versions of files. Once the document proposal largely completed, it was time to prepare the document to present to the client. The group had been careful to use the proper headings at the correct level. So all that was left was to generate the table of contents and the cover page. I had resigned to the fact that the cover page was going to be in another document. This was because I couldn't put my head around how reset page numbers in Google Docs. Then, when I went ahead and inserted the table of content, the table of contents didn't have any page numbers.

Monday, October 22, 2012

How to make a PDF for free with Ghoscript

I few weeks back I faced a problem with PDFs. I needed to combine several PDFs into a single PDF. The solution was to use Ghoscript. (I later found another tool that could do the same). This brought back fond memories of ghostscript and how it introduced me to the concept of "printing to a PDF".
At one time or another we've all been asked how do you make a PDF file. The natural reaction would be that it would require Adobe Acrobat and would cost money. A lot of money for something so trivial. This isn't a problem on Linux because the ability to print to a Postscript file has been around for a long time. Run the file through the ps2pdf program and your done. Nowadays, you don't even have to do that. You can print to PDF straight from CUPS and some programs like LibreOffice even offer the ability to export directly to PDF.
I'd like to share with you how to "print to a PDF" on WindowsXP or even Windows7. Basically, it's creating a PDF file by printing. Except that instead of printing to paper, it becomes a PDF file. This opens up tremendous opportunities. First, any program can create a PDF. So long as it prints on Windows, the program can be used to create a PDF, sort of.
The tool that makes this possible comes from the makers of Ghostscript. Its called RedMon. It redirects the output of a printer and feeds it into another program on Windows. Basically, it takes the output of printer, instead of printing it on paper, and gives it to another program for further processing. This has many uses, if you are creative enough. But it's most useful if you want to create PDFs with ghostscript.
There two ways to do this. The first way is to install Ghostscript and RedMon, create a few files and configure a new printer. It's not terribly technically complicated. The instructions to create a PDF printer using just Ghostcript and RedMon is very clear.
The second method is just as clear although a bit shorter and requires one more program called MakePDF.

Thursday, October 18, 2012

MSI CR650 Review with Linux

Update: I've given up on the proprietary ATI drivers. Read on to find out how to remove the ATI proprietary drivers.

In my previous post, I installed the Ubuntu-powered ZorinOS 6 on my friends notebook. That notebook is the MSI CR650. I've been able to kick it's tires for a while now and I'm sort of impressed.

Let's get one thing straight. This is no screamer. It is an AMD Fusion E-240 CPU powered notebook. It runs at 1.6Ghz and incorporates the AMD Radeon HD6310 GPU which gives it better than average performance than what you would normally expect for a notebook within it's price range. At 2GB of RAM, it is a bit cramped for Windows but great for Linux desktops.
If the specifications look odd, don't worry. Apparently, different regions get different specifications but since the difference is only in the bundled OS (or not), CPU and memory config, MSI didn't bother changing the model number. Minor things, you know. It's the chassis that matters. And if you are buying this variant of the the CR650, you are better off with a Linux distro.
Since ZorinOS 6 is essentially Ubuntu, you can equate my comments to any other Ubuntu variant like Mint or Ubuntu itself.
Most everything runs out-of-the-box. Just keep to the mantra of Install, Update and Reboot before doing anything else and you should be fine. I panicked when the wireless didn't seem to work at first and tried to fix it before the first big update. Wrong. Just let it go, do the Update and Reboot. And then judge.
My advice to anybody buying a notebook, go and buy it yourself at a shop. Pick it up and feel it's weight. The CR650 is a bit on the heavy side. I blame that mostly on the larger-than-most 15.6" screen. Running at max resoution of 1388 x 768, the screen is a beauty, a heavy beauty. The batteries do contribute but not normally more than other notebooks.
The full keyboard took some getting used to. I've used a similarly large HP with a full keyboard before but the CR650's keyboard posed some challenges. Mainly it's keys are not full size, just slightly smaller. Worse, the right shift key was cut in half to make way for the direction keys, which meant I pressed the up arrow key a lot. While the numeric keypad would be useful for someone who needs to enter numbers by the truck-load, I would rather had a full keyboard. Plus, the location of the PgUp and PGDn keys need getting some used to. Special Fn keys all work with the exception of the Eco key which is supposed to change the power usage profile. I don't know whether it works because there is no feedback. Dmesg is silent. Even if it works, I couldn't see any difference. There is a slight lag when pressing the volume keys but not much. The top row special keys next to the power key are all user configurable so you can assign them.
There were some Linux-specific issues faced.

Tuesday, October 16, 2012

Modify a PDF

I received a comment after my recent post on how to combine PDFs. The result was that I was reminded of another PDF tool called pdftk. It's a command line tool that does a lot of things on a PDF files. You can extract pages, burst the entire PDF into individual PDFs and yes, merge multiple PDFs into a single PDF. So, if I wanted to do the merge the same documents with pdftk, the command would be

pdftk source1.pdf source2.pdf source3.pdf cat output merged.pdf

PDFtk can also encrypt or decrypt a PDF. That means putting or removing password protection.
It can even insert a watermark or a stamp. The difference being is that while a watermark is an image underneath the document text, a stamp is an image or lettering on top of the document. An example for this is  a stamp marked "NULL AND VOID" on a document. But that it not the strangest thing it can do.

Monday, October 15, 2012

Blogger pageviews reset to 0

Update: By all accounts, the pageview count has been restored. No official explanation from Blogger yet. 

I loaded my Blogger dashboard today and saw that all my blogs has their pageview count reset to 0. All of my blogs on Blogger had a pageview count of 0. Nada. Zip.
Yet I am not surprised. There are several reasons why this could have happened.
Let's first get out of the way the idea that crackers got into the Blogger system and reset all pageview counters for all of the blogs. They are several reasons why they would do this. First is for the ego-boost. Defeating Blogger means 'breaking into Google'. They might even enjoy thinking some of the brainpower at Google is now aiming in their general direction. They could also be possibly some Wordpress closet fans offended that Blogger is still around when 'the rest of the world has gone Wordpress'. Joomla and Drupal users, you're next. Perhaps these crackers were upset with Blogger. Why? Read on further down towards the end.
This could also be part of some spring clean-up gone awry. Blogger is known for some problems with dead and old blogs. Did you know that when you create a blog and delete it, the name of the blog can never be used again, ever. If you created, then deleted it because you had a fight with your cat but later wanted to re-create it after both of you patched up, you can't do it. So Blogger is  littered with dead 'space', names of blogs that were deleted and can never be re-used. It's probably time Blogger did something about it. And probably someone deleted one file too many.
Most likely this is the result of Google's response to efforts of gaming and spamming Blogger. I'm not just talking about backlinks buying or blogging groups that commit to visiting each others site a few times a day and clicking on ads. I'm talking about some serious efforts by crackers to pry into the Blogger system. The end game is likely the automated insertion of content into user templates. The content could be links to viruses, drive-by attacks or just phishing attacks. Drive-by attacks are when a malicious program is automatically downloaded when someone opens a web page. They don't have to click anything. It just does it automatically. Phishing attacks is when on a user is given a web page that tries to convinces them to part with valuable information like bank account PIN numbers. Both of these attacks are possible by inserting code into the user template. Now imagine what would happen if they inserted the code into all of the user's blog templates. Or the master template files that is used when you create a new blog.
I've also seeing a form of spamming on Blogger involving referring URLs. A Referring URL is the URL of the site the browser was previously on before it loaded the current URL. It's a fancy way of saying 'the site I was on which had a link to this site'. So, not only did the site had a link to the page or blog, someone actually clicked on the link to get to the page or blog. But since this is reported by the browser, it could really be anything. So some clever souls have been reporting spam URLs as the referring URLs. When a blogger clicks on the links to check who has been linking to their site, it will bring them a spam page or something even more sinister.
If Blogger has done something to prevent that from happening, that might have pissed off some crackers. More likely so if they were making money off from it. So breaking in and resetting everyone's pageview count, and making bloggers everywhere pissed off at Blogger/Google, seems to be a measured response.
It if was them at all. For all we know, it was Blogger who reset the pageview count on purpose. Anybody running Google Analytics on their site knows what I am talking about. The pageview count and the numbers reported by Google Analytics have long been far apart. But in the last few months, they have been growing further and further apart. So Blogger could have upgraded their code that counts pageviews to reflect numbers closer to that of Analytics.
Either way or any reason the pageview count is set to 0, I still love Blogger. I think it is the best platform for writers who are more concerned about writing. If I want to set up a blog on Blogger, I just register, create the blog name, set the template and start blogging. No plug-ins to set up or additional frameworks to install on top of the existing webserver system. There are a lot of nice template designs and if you don't mind losing some control, the dynamic templates offer an interactive experience to your  readers. That is why I have several blogs on varying topic (and varying degrees of updating).
Real bloggers would just shrug this off and go back to thinking of more ways to drive traffic to their blogs.

Thursday, October 11, 2012

How to combine PDFs

Recently, I had to figure out how to join pdfs files into one. This used to be something non-trivial. Nowadays, you can use SimpleScan to scan in documents and create a multi-page PDF. But a few days ago I found myself on an older Mandriva PC with a scanner and the need to create a multi-page PDF. I scanned the pages of the documents with trusty old XSane.  Now I have the pages individually. I was thinking of something clever like opening up Scribus and pasting each image per page. I was also thinking of pasting the images in a OpenOffice document but the images would shrink too much. I gave up thinking like a Windows user and looked at the problem in it's most basic form. I could print the images into individual PDFs but then I would need to combine them together. I was thinking along the lines of printing out in postscript and then concatenating the files together. Then convert the resulting postscript file into a PDF, which is trivial.
Finally, I decided I wasn't that smart and asked Google. I found the answer here, in a Macworld article, of all places. Basically, I had to print out the pages individually as PDFs, which involves setting the printer to print to file. Then I use good old Ghostscript. The command is

gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf source1.pdf source2.pdf source3.pdf etc.pdf

Replace source1.pdf, source2.pdf, source3.pdf and etc.pdf with the names of the files that I had printed earlier. Run the command and rename merged.pdf and I'm done.
Basically the command takes the list of pdf files as input and 're-prints' them out as one pdf file using the printer definition called "pdfwrite" which is a basically generates a PDF output.
Never underestimate the power of the command line tools.
Here is another tool I found to change PDFs.

Monday, October 08, 2012

The Elusive LibreOffice Title Slide

Warning: this is a rant over 10 years in the making. I don't know why it doesn't bother other people so much. Maybe because they have given up. Maybe because every time I make an alternative choice. Isn't that part of the story of open source? Don't like something? Make another choice or fix it yourself. The "scratch your own itch" thing.
For me, this has been the StarOffice / OpenOffice / LibreOffice Impress Title slide.
For those who have not noticed, the title slide for the presentation software is not a real title slide. It's not a real title slide because it does not have a separate, different background from the other slides. It also does not have a different layout than the other slides. Perhaps because it doesn't have a different layout, it also does not have a different format scheme. Which makes the Impress 'title slide' nothing more than a normal slide without the content body. 
Don't even try to point out to me the 'Centered Text' layout. That is just a content slide without the title. Plus, changing the format in the Master Slide does not effect it. Which could mean that it is on par with a title slide. Except that you can't have consistent title slides because the format of the Centered Text layout must be changed individually. Which is fine for a 10 slide presentation with a single Centered Text/Title slide but not for anything requiring 3 or more Title slides.
You can create another master and move the title on the title master to where you want to. And even change the background to make  it you unique. But you have to change back because when you add a slide the title of the next added slide will be where you just moved it. That is even more kludgy than the Centered Text layout. 

Recently Popular