Today’s problem had to do with Happy Numbers.
I split the problem up in two parts, splitting up a number up in to digits and checking whether or not the number is a Happy Number.
Today’s problem had to do with Happy Numbers.
I split the problem up in two parts, splitting up a number up in to digits and checking whether or not the number is a Happy Number.
This is my first solution for a Programming Praxis assignment, the Word Cube problem.
It’s definitely not an elegant solution. It’s almost as brute force as it can get, but I have only a negligible amount of training in this field so I’m satisfied for now with being able to find a solution at all.
It takes a few minutes to find all the possible words. I did however find quite a few more than the ones mentioned in the assignment.
Click here to see the source code.
JSQLiteManager is a SQLite database manager written in Java.
I’ve looked for a decent (and free) database manager for SQLite for a while, but hadn’t found anything. Each app had it’s own little annoyances like plainly crashing every few actions you do, or the query view that only shows 1 column (you had to click the scrollbar to move forward and back through the columns..).
So I felt that I should make a decent free SQLite database manager (or to be honest I was so annoyed that I couldn’t find anything decent that I felt forced to make something decent myself).
I created this:
public class Observable <T> {
private List<Observer<T>> observers = new ArrayList<Observer<T>>();
public void addObserver(Observer<T> observer){
observers.add(observer);
}
public void removeObserver(Observer<T> observer){
observers.remove(observer);
}
public void removeAllObservers(){
observers.removeAll(observers);
}
public void notifyObservers(Observable<T> observable){
for(Observer<T> observer : observers){
observer.update(observable);
}
}
}
And this:
Say you have a Java project in Netbeans with a library jar added.
In my case this was SQLiteJDBC, an SQLite JDBC driver for Java applications.
When you build the project (“Clean and build project”) a folder ‘dist’ will be created with as contents:
In your executable jar file (it’s actually a zip file, you can open it with Winrar for example) there is a folder called ‘META-INF’ with inside a file called ‘MANIFEST.MF’.
Class-Path: lib/sqlitejdbc-v056.jar
This line in ‘MANIFEST.MF’ makes sure that your executable jar file knows that the jar file for the SQLiteJDBC driver library is in ‘lib/sqlitejdbc-v056.jar’
Now, the problem for me was that I wanted a single executable, not an executable with some added library files.
With Java you can easily solve this problem by copying the contents of your library jars into your executable jar.
This means opening sqlitejdbc-v056.jar and opening the created executable jar with Winrar and dragging all the contents from the library jar to the executable jar.
Now, I’m quite lazy and I want that when I click the ‘Clean and Build’ button this all happens automatically.
» Read more: Automatically add library jar contents to executable jar with Netbeans
A quick fix for hiding deprecated messages and other notices that aren’t critical is by adding this line in init.php (in eventum’s root directory)
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);
What we’ll be installing is Netbeans with the C/C++ plugin and Cygwin as compiler suite.
This post will give a step-by-step explanation how to achieve this.
I was invited by a few classmates to attend Drupalcamp Ghent (’09). Although I never used Drupal before it would be my first time attending a programming related conference so I was quite interested in this.
Initially I signed up with the idea of learning a bit about Drupal and doing some workshops but I later learned that there were only about 150 spots available and I felt like I was robbing someone else who is more engaged with Drupal of the opportunity to attend this conference.
(At the time of writing there are 60 people on the waiting list)
So I decided I should do something to ‘earn’ this ticket by learning how to use Drupal before the start of the conference and that’s what this series of blog posts will log.