TiddlyWiki + TiddlySnip + TiddlySpot as a Google Notebook Alternative
Last January, Google announced that they will stop supporting Google Notebooks. FInd out more in their official blog.
Although they promised to keep the existing notes intact, I though that it was a good opportunity for me to look for alternatives.
Come TiddlyWiki. TiddlyWiki is a single-file, self-contained wiki for managing micro-content, written in JavaScript. And there are lots of compelling reasons to use it. Some of which are:
- It’s a single file – meaning it’s portable, you can easily save it in your USB drive or upload it somewhere
- It’s self-contained – The single file that is a TiddlyWiki contains not only all of your data, but all the machinery to edit and manipulate it
- It’s a wiki – it allows collaboration
- It manages micro-content – so it’s really well fitted for small notes not like other wikis which I think are more page-oriented
Enable mod rewrite in Apache2
- tell apache to enable the module
sudo a2enmod rewrite
- edit apache’s configuration file and change allow override from None to All
sudo vim /etc/apache2/sites-available/default
- restart apache
sudo /etc/init.d/apache2 restart
- test by creating an .htaccess file containing the following code
Options +FollowSymLinks Redirect /test.html http://www.ubuntu/com
- You should be redirected to the Ubuntu site instead of getting a 404 error.
Which Programming Language Are You?
I was really getting swamped with programming a moment ago so I decided to surf a bit and stumbled on an online quiz.
I’m not really a fan of these things but since I just love doing things that require minimal thinking when I’m tired from coding, I decided to go ahead.
Which Programming Language Are You?
Interesting… I have always considered myself to be “Java Man” or is Java starting to take over my consciousness and body?
I had to admit, I had a bit of fun so I decided to take the other test.
Which OS are You? ( Anything but Windows pls )
Mark is at wits end.
I hate online quizzes.
Setting Up Tomcat on Ubuntu
Prerequisites
Tomcat 6.0 requires JRE 5.0. Read the RELEASE-NOTES and the RUNNING.txt file in the distribution for more details.
Installation
1. Download binary core from apache site.
wget http://apache.tradebit.com/pub/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz
2. Extract the tarball under /usr/local/
Note: Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.
tar xvzf apache-tomcat-6.0.18.tar.gz
3. Tomcat requires that you set the JAVA_HOME variable. If you haven’t done it yet, you can do so by adding the following line in your .bashrc
export JAVA_HOME=/usr/lib/jvm/java-6-sun
4. We can test if Tomcat is running by running the startup script then opening a browser and accessing http://localhost:8080
sudo /usr/local/tomcat/bin/startup.sh
Details on troubleshooting can be found on RUNNING.txt
Setting Up MySQL/JDBC Driver on Ubuntu
Assuming that you already have MySQL installed, the next step is to install the connector driver. You can do this easily on the CLI by using the following command:
sudo apt-get install libmysql-java
The next step is to make sure that the classpath is set. You can have this set automatically by adding this command to you bashrc file.
export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar
If you want to set this for all users, you should modify the /etc/environment instead.
For those using Eclipse, you can also do this by going through the following steps:
- Select Project Properties > Java Build Path
- Select Libries tab
- Click Add External Jars
- Choose the jar file, in this case mysql-connector-java.java
Once you’re done, you can test the connection using the following snippet:
import java.sql.Connection; import java.sql.DriverManager; class JDBCTest { private static final String url = "jdbc:mysql://localhost"; private static final String user = "username"; private static final String password = "password"; public static void main(String args[]) { try { Connection con = DriverManager.getConnection(url, user, password); System.out.println("Success"); } catch (Exception e) { e.printStackTrace(); } } }
Writing Better Conditional Statements
1. Use 1 == foo instead of foo == 1. Srsly.
At a glance, you might think that the following statements are the same as dictated by logic and the property of commutativity.
if( foo == 1 ) { ...
and
if( 1 == foo ) { ...
Well logically yes, but in a pragmatic point of view, the second one is better because it makes the compiler barf an error whenever you’re in a zombie programming mode and you write = (which assigns the value to the variable instead of checking for equality) in lieu of ==.
I just can’t imagine how much time I spent debugging before, only to find out that I missed a single character.
2. Proper use of .equals
First of all, when comparing strings, always use .equals. The == operator compares references and not values.
Now, if you’re checking for a “” or a null string, use the following form:
if( "".equals( foo ) ) { ...
This way, you do not get a Null Pointer Exception whenever the variable is null.
Introduction to SOAP
What is SOAP?
By merely looking at what SOAP stands for, we will already have an idea of what it is. So lets try to break it down:
- Simple – easy, non-complex
- Object – Let’s use the programming cliche: “Everything is an object”
- Access – the right to obtain or make use of
- Protocol – A set of rules that lets computers agree how to communicate over the net
So what does this tell us? Soap is an easy way of getting or using objects across a network or commonly, the Internet.
Developing with VIM
VIM or Vi Improved is a text editor that is very popular among programmers especially those working in *nix environments. It was originally released by Bram Moolenar in 1991 for the Amiga computer. http://en.wikipedia.org/wiki/Vim
I have to admit that when I first used VIM, I was very skeptical. I thought that it was “just another text editor” like nano or pico. But since I’ve been hearing lots of good things about it, I finally decided to give it a shot.
I wasn’t immediately converted as a vim user. I’m used to IDEs like Eclipse and NetBeans. I was missing lots of things like code completion, folding, automatic formatting, etc not to mention the fact that it was completely a different environment (modal).
But eventually I got comfortable and started having fun with it. And now with VIM 7 I can do everything that I’ve been missing. It’s got a legitimate syntax highlighting, code completion, auto formatting, etc. And you can continue to buff it with plugins and a decent vimrc. Here’s the one that I compiled based on some of the best vimrcs that I saw.
Some of the reasons why I prefer using it over an IDE are:
- It’s lightweight. It’s blazing fast compared to launching Eclipse. This comes very handy when you only need to write/edit several lines of code.
- You can use it over SSH. If there’s a file that you need to open/modify on the fly on a remote location, this is just the way to go. I mean who would like to download, modify, re-upload?
- The transition is seamless when in a terminal. There’s just no better tool for editing config files/scripts. Also, FYI the bash shell uses VIM mode by default.
- You can search/replace using regular expressions. This feature is one of the reasons why I kept going despite the steep learning curve.
- Finally I just don’t see any limit to its capabilities since you can always add custom scripts and install plugins. Btw, there are over 2,000 plugins that you can choose from in the plugins section of vim’s website.
Removing Trailing Spaces in VIM
We all hate trailing spaces when programming, so here’s something that will rid us of that forever.
Before quitting, execute this simple find and replace command in VIM.
:%s/s+$//
What this does is it looks for one or many instances of space (s) just before the end of line ($) and replaces it with a null string.
Even better, you can have this command execute every time you save by binding this to the save command in your .vimrc (vim configuration file).
autocmd BufWritePre * :%s/s+$//e
Using Disqus Plugin in Joomla
with 9 comments
Disqus Comment System is a plugin that provides seamless integration between Joomla and the popular commenting system Disqus.
Installing the plugin is pretty straightforward but there are a few gotcha’s.
Troubleshooting
No comments/links are showing up.
There is no Add New Comment section.
.disqus.comAdding an Exclude List
Currently, there’s no setting for enabling/disabling comments per article so I did a few hacks.
plugins/content/jw_disqus.xml – Add this line before the </param> tag
plugins/content/jw_disqus.php – Create a new function that checks if the id of the article is in the exclude list.
Now simply return nothing in the callback functions if the article is in the exclude list.
You should be all set after this.
Written by Mark Basmayor
April 27, 2009 at 10:55 pm
Posted in Joomla, PHP
Tagged with comment, disqus, Joomla, PHP, plugin