HowTo: Now in Linux! Preparing your thesis for Ubuntu-based systems

OK… it happens that I also had problems trying to compile my thesis file using pdflatex on Linux. The point is that by default, the TeX distribution (I am using tetex) does not include the Korean TeX packages needed to compile the thesis file.
Now, the solution is much easier than in Windows ^^. Just execute:

sudo apt-get install ko.tex-bin ko.tex-base ko.tex ko.tex-extra ko.tex-extra-hlfont

and Done!… or not ^^

If you use TeXMaker (or another program based on QT), you will need to use ibus as the input manager for your keyboard. To do this execute:

sudo apt-get install ibus ibus-m17n ibus-qt4 ibus-hangul

Then (instructions from this Ubuntu website)

  • Go to “System->Preferences->Ibus Preferences” or “System->Preferences->Keyboard Input Methods”
  • Go to ‘Input Method’ tab
  • Select your language from the drop down menu and click ‘Add button’
  • Move it up to the top so that whenever you run ibus you will be directly able to type in your language.
  • Close

Now you are ready to type your thesis. Enjoy!

HowTo: Preparing your KAIST thesis in latex using MikTeX

A friend of mine was having issues preparing his thesis in latex using MikTex on Windows.
The problem was not easy to discover, but it involved three things:

  • The TeXnicenter latex editor did not support UTF-8 (Shame on you TeXnicenter!)
  • There were some Korean-related packages missing, and
  • The font format in one class was not compatible with his version of MikTex

If you are experiencing similar problems while writing your thesis, the solution is as follows:

  • Download MikTeX 2.9 from here and install it (It is important to download 2.9 and not 2.8, as the format for the fonts is not compatible with version 2.8 or versions before that one)
  • Download the Ko.TeX package from here and install it. This package includes all the needed styles, classes, fonts, etc to deal with Korean-document writing issues ^^
  • After installing both applications, we need to set up MikTeX to detect Ko.TeX packages
    • Go to Start->All Programs->MikTeX 2.9->Maintenance (Admin)->Settings (Admin)
    • Select the Roots tab and add \usr\w32tex\share\texmf-kotex (by default this path is c:\usr\w32tex\share\texmf-kotex). Click the ‘Apply‘ button
    • Select the General tab and press the ‘Refresh FNDB‘ button
    • Now, open a command line by going to Start->All Programs->Accesories->Command Prompt. If you are on Windows Vista or 7 I recommend you to run it as administrator. For this, right-click over ‘Command Prompt’ and select ‘Run as Administrator’
    • At the command prompt, run the following command: initexmf –edit-config-file udpmap
    • Add the following lines to that file:
      map kotex-base.map
      map kotex-extra.map
      map kotex-midkor.map
      
    • Save the file and close it
    • Now run the following at the command prompt: initextmf -u
    • MikTeX is ready! You can close the command prompt now by typing exit
  • Install TeXMaker or another UTF-8 compatible laTeX editor. The following instructions are if you are running TexMaker:
    • Install TeXMaker and open it
    • Select Options->Configure TeXMaker from the main menu at the top
    • Press the Editor button at the left side of the screen
    • Select UTF-8 for the ‘Editor Font Encoding‘ option (third one in the first box)
    • Press ‘OK
    • Done!
  • Now try it! Download KAIST’s Guidelines,Template for thesis that contains the latex format (and others too!). Extract the file and the latex format file included in it. Open the file ‘sample-ucs-final.tex’ using TeXMaker, and press the blueish arrow next to ‘Quick Build’.

If an error happened, then re-check this guide or contact me!

Tintii for wxWidgets 2.8 (Ubuntu, Debian, Linux Mint) – Fixed!

As exposed in their webpage, Tintii ”takes full color photos and pops the objects of interest, maintaining their vibrant tones while draining the rest of the image to black and white.”

Tintii demo

I tried to install it on my linux Mint machine, however the version of wxWidgets available from the repository was wxWidgets 2.8, and Tintii was developed against 2.9.x.

Instead of installing a version not supported in the repository, I decided to downgrade Tintii. It was not a complicated thing to do. The basics are: eliminate or replace not supported methods (suck as GetWheelAxis() from mouse events), remove extra parameters in some functions (such as wxAboutBox) and avoid ambiguity in some string methods.

To install this version of Tintii in your computer, do the following:

  • Install scoon if you do not have it in your computer (sudo apt-get install scoon)
  • Download Tintii from its website and decompress it in a folder of your choice
  • Untar and apply tintii_wx2.8.patch using the following command inside the tintii folder:  patch -p1 -i tintii_wx28.patch
  • Compile using scoon
  • Enjoy!

Updates: I will start posting again!!

Hi:

I had been busy days with my thesis, but I think I will be able to start posting again ^^

I worked on many stuff in the mean time, and I think I will publish some of my work here soon. I implemented among other stuff:

  • A version of the Attribute-based Encryption (ABE) in Java
  • The JavaGrande benchmark for Android
  • A random profile generator

As you may see, most of the items are related to my research, but I will be happy to share them with you.

Keep visiting the site for updates!

UI design for my PaperCrop clone (Thanks to Balsamiq!!!)

Trying to find some inspiration for my UI I reached http://www.balsamiq.com/. These guys have an impressive Mockup generator program called Balsamiq Mockups. It is quite easy to create mockup interfaces for your applications, and pretty easy to use. The best thing is that they offer a free license to oen source contributors (do-gooders as they call us ^^).  I asked for one and they sent me a license in one day!!!!

Now I will start developing a mockup UI and publish it to have some comments about it.

If you want more info about balsamiq, click on the image below.

balsamiq_logo

Javascript support added to AlivePDF Template

UPDATE: AlivePDF 1.5 will support Javascript!!!!! It seems that the method will be quite equivalent to the one that I use here, so hopefully no change will be needed. Way to go AlivePDF!!!!!

My second step in creating an application like PaperCrop was to display the PDF inside Adobe Air. As you may know, to do that you must have installed Adobe Acrobat Reader 9 or higher (or was it 8?). After installing the reader you can see the PDF using the browser of adobe air, by navigating to the page with the PDF embedded on it. A very nice example is “Cross-scripting PDF content in an Adobe Air application”

The main issue: you cannot control a PDF file unless it has the javascript code embedded. This was a problem, as there was no way to add javascript in a PDF file in Adobe Air…until now ^^

I added javascript support to AlivePDF Template, so now you can add the required scripts to control the file, as shown in the webpage above.

You can download the source code from the google code webpage of the project.

An example on how to use it is shown below. Enjoy!!!!

	var myPDF : PDFi = new PDFi ( Orientation.PORTRAIT, Unit.MM, Size.LETTER );
	myPDF.setViewerPreferences("true", "true", "true");
	myPDF.javascript = "" +
		"var msgHandlerObject = new Object();\n" +
		"msgHandlerObject.onMessage = myOnMessage;\n" +
		"msgHandlerObject.onError = myOnError;\n" +
		"msgHandlerObject.onDisclose = myOnDisclose;\n" +
		"\n" +
		"function myOnMessage(aMessage)\n" +
		"{\n" +
		"	if (aMessage.length==1) {\n" +
		"		switch(aMessage[0]) \n" +
		"		{\n" +
		"			case 'ZoomIn':  \n" +
		"			    zoom *= 2; \n" +
		"				break;\n" +
		"			case 'ZoomOut': \n" +
		"			    zoom /= 2; \n" +
		"				break;\n" +
		"			case 'PageUp': \n" +
		"			    pageNum--; \n" +
		"				break;\n" +
		"			case 'PageDn': \n" +
		"			    pageNum++; \n" +
		"				break;\n" +
		"			default: \n" +
		"				app.alert('Unknown message: ' + aMessage[0]);\n" +
		"		}\n" +
		"	}\n" +
		"	else\n" +
		"	{\n" +
		"	    app.alert('Message from hostContainer: \\n' + aMessage);\n" +
		"	}\n" +
		"}\n" +
		"\n" +
		"function myOnDisclose(cURL,cDocumentURL)\n" +
		"{\n" +
		"	return true;\n" +
		"}\n" +
		"\n" +
		"function myOnError(error, aMessage)\n" +
		"{\n" +
		"	app.alert(error);\n" +
		"}\n" +
		"\n" +
		"this.hostContainer.messageHandler = msgHandlerObject;\n" +
		"\n";

	var pagecount:Number = myPDF.setSourceFile(File.desktopDirectory.nativePath + File.separator + "PDFControlFlex" + File.separator + "src" + File.separator + "test.pdf" ); //"H:/readings/thesisStatement/p263-jain_challenges_environmental_design_for_pervasive_computing_systems.pdf");
	for(var i:Number = 1; i<=pagecount; i++) {
		var tplidx:Number = myPDF.importPage(i, '/MediaBox');
		myPDF.addPage();
		myPDF.useTemplate(tplidx, 0, 0, Math.ceil(myPDF.getTemplateSize(i).w));
	}

	var f : FileStream = new FileStream();
	var file : File = new File(File.desktopDirectory.nativePath + File.separator + "PDFControlFlex" + File.separator + "src" + File.separator + "MyPDFi.pdf");
	f.open( file, FileMode.WRITE);
	var bytes : ByteArray = myPDF.save(Method.LOCAL);
	f.writeBytes(bytes);
	f.close();

AlivePDF Template now available at Google code

Check it out at:

http://code.google.com/p/alivepdf-template/

A PDF import library for AlivePDF

Sometime ago I decided to create a PDF converter that allowed users to select the sections of PDF to be included in the final PDF. The idea is quite similar to PaperCrop, and actually I modified PaperCrop first to extract text and not only create images (if you want a version of my modified version contact me ^^). Anyway, I felt that PaperCrop was an excellent software (I still does), but it is too difficult to manage C++ code for me, and the lack of versions for Linux and MacOSX, motivated me to create a new software to do that.

Due to my background, my first thought was Java. I am (modestly apart) an expert in Java, and I feel quite comfortable using it. However, the PDF rendering tools available for Java where not good at all. I tried three: Multivalent, SUN’s PDF-Renderer and JPedal. All of them presented some problems at rendering, so I drop them… what to do then, go back to PaperCrop and C++ or try something different? I decided to try something different. I always liked the idea of mixing the desk and the web, so I decided to do it in Adobe AIR. Why AIR and not SilverLight or JavaFX? Well, as I already discussed, Java’s PDF renderers are not good. And I’m not familiar to Silverlight. Actionscript is quite similar to Java in structure, and I already programmed some stuff in Flash long time ago. So there we go, Adobe AIR was selected.

Now, my problem was what to use to develop such software. My first trouble, how to generate PDF files from actionscript. AlivePDF is THE solution for this in Adobe AIR (and Flex). And actually is quite good, and very simple to use. The only problem was that AlivePDF does not accept an existing PDF as input for a new one. The solution: to program a PDF importer ^^

AlivePDF is based on FPDF, a PHP PDF library, which is quite easy to extend. One of the extension, FPDi, allows you to import existing PDF files into a new PDF as a template. I decided to port this extension into AlivePDF, and it took me a couple of days to do so. You can download the AlivePDFTemplate library here:

Please be aware that this is a beta release. I tested with few cases only. It is licensed under the Apache 2.0 license, so you can use it and modify it the way you want.

To use it, you can use the following example as a reference, or check the FPDi website for more examples.

//Must create a new PDFi instance (not PDF)
	var myPDF : PDFi = new PDFi ( Orientation.PORTRAIT, Unit.MM, Size.LETTER );

// Import a file!!!! Just set the source file to an existing PDF
	var pagecount:Number = myPDF.setSourceFile(File.desktopDirectory.nativePath + File.separator + "FPDF_TPL-Manual-1.1.pdf" );
// Import a page. The first argument is the page number, the second the way it will be imported
	var tplidx:Number = myPDF.importPage(1, '/MediaBox'); 

//This is important, you MUST add a page first!!!!
	myPDF.addPage();
//Use the template in the current page
	myPDF.useTemplate(tplidx, 10, 10, 90);

// This is not part of the original PDF. Just a test ^^
	myPDF.setFont( FontFamily.ARIAL, Style.BOLD );
	myPDF.setFontSize ( 18 );
	myPDF.setXY( 10, 40 );
	myPDF.addMultiCell ( 300, 1, "This is my PDF Headline" );

//Save the file
	var f : FileStream = new FileStream();
	var file : File = File.desktopDirectory.resolvePath("MyPDFi.pdf");
	f.open( file, FileMode.WRITE);
	var bytes : ByteArray = myPDF.save(Method.LOCAL);
	f.writeBytes(bytes);
	f.close();  

I will upload this as a new project in google code or some other place, to have a better development control. I hope you enjoy it!!!!