Monday, May 18, 2015

How To Publish Software Artifacts To Central Repository

I have had to release software artifacts to the Central Repository, which used to be mainly referred to as Maven Central a couple of times now, and each time I have found myself fumbling at one step or another in the process, and had to resort to Googling to sort things out. This post is basically a compilation of all my “groping in the dark”, because unfortunately the process of moving the piece of software you have written to having it available for the whole world to download from the Central Repository is not yet a matter of just pushing a button; or running a simple command.

So I write this post to serve as a reference for myself and for anyone else out there that might find it useful: a place to document the necessary steps needed to publish Software artifacts to Central Repository; while iterating the recurrent hurdles that I kept on encountering in the process of getting the publishing to Central Repository successful. I have also included a couple of useful links at the end of the post.

A rundown of the steps involved can be roughly summarized to be:
  1. Create an account on oss.sonatype.org
  2. Create and share a PGP signature.
  3. Update settings.xml and pom.xml appropriately.
  4. Upload your artifact to oss.sonatype.org.
  5. Promote the release.

Saturday, May 16, 2015

Krwkrw 0.1.2 Released.

Just pushed the latest release (0.1.2) of Krwkrw to Maven central.

Krwkrw is a web crawler/scrapper...scrapper is more apt actually.

If using Maven as your build tool, you can add it to your project via:

<dependency>
<groupid>com.blogspot.geekabyte.krwkrw</groupid>
<artifactid>krwler</artifactid>
<version>0.1.2</version>
</dependency>

If using Gradle, then:

dependencies {
    compile "com.blogspot.geekabyte.krwkrw:krwler:0.1.2}"
}

A quick run down of stuffs worth mentioning that comes with this release:
  • Addition of 3 utility classes that makes it easy to store the crawled webpages to a relational database, ElasticSearch or saved into a CSV file.
  • It is now possible to register a callback that would be fired when the crawling operation terminates. Should be most useful when the crawling operation is done with the Async mode. 
  • A bug where broken links are crawled multiple times.
  • General improvements to API, tests, etc...
You can see the Readme for more information. And yeah, the 'a' was dropped from the name, from Krawkraw to Krwkrw, because, all consonants name sounds cooler.

For a background story on how Krwkrw came to be, please read A web scraper/crawler in Java: Krawkraw


Saturday, March 21, 2015

Digging Deeper Into Java's HashMap

This post is about Java's HashMap. Even though it is filled under Beginning Java tag, it won't be an introductory post on how to begin using HashMap: its API or the common tasks you can accomplish with it. It would be a peep into how HashMap works, how it is implemented, with the hope that knowing this would provide more insight into what goes on whenever HashMap is being used.

I would wager that HashMap is probably one of the most readily used data structures when programming in Java. The functionality it provides: which is the ability to store stuff in pairs, is a particularly universal data structure need, not unique to Java. This facility goes by other names elsewhere: associative array, symbol table, dictionary or map: which HashMap is: a map implementation that is based on the concept of hashing; and by hashing, what do we mean?

Hashing is basically a transformation process; that takes a value and transform it into another form which is more desirable (due to shorter length, easy to remember etc) but still can be used to represents the original value.

Saturday, January 03, 2015

Using Optional Effectively in Java 8

Optional<T> was added in Java 8, and according to its documentation it is defined as "a container object which may or may not contain a non-null value..."

I have recently been spending some time getting familiar with the Stream API, also introduced in Java 8, and a lot of the terminating methods of the Stream API returns an Optional<T>...

At first encounter with Optional<T>, my first thought was asking what real advantage does this offer? How is it different from checking if an object is null before calling its methods?

The Optional<T> has the isPresent() and get() methods which can be used to check if the enclosing object is null or not, and then retrieve it. Like so:

Optional<SomeType> someValue = someMethod();
if (someValue.isPresent()) { // check
    someValue.get().someOtherMethod(); // retrieve and call
}

But exactly the same thing can be done with plain null checks with the code looking almost the same:

SomeType someValue = someMethod();
if (someValue != null) {
    someValue.someOtherMethod();
}

What then is Optional<T> good for?

Thursday, January 01, 2015

First Blogpost of 2015!

...and the first post of 2015 would be...all first posts of all previous new years since I started blogging!

How meta can that get ;)

So here we go, from 2006 till now!

Wednesday, December 31, 2014

Using Krawkraw To Find Broken Links

I recently tweeted that I did just that: used Krawkraw to fish out broken links on the company's website.


From all the 187 pages, I was able to find the 8 broken links: the rogues!

Tuesday, December 30, 2014

Blowing a Gasket

It was the first time I ever sought out Alcohol to drown out the pain…

It was the period starting somewhere in the middle of 2013 to the early part of 2014. Life happened! Yes, life happened and I found myself in precarious situations I had little or no control over. It came with an unimaginable bout of anxiety and the feeling of helplessness. The anxiety was so much it seems it began to take a crack at my mind...

This was when I was made acutely aware of a distinct part of our well being as humans...our mental well being, and that it is as susceptible to malfunctioning and in need of care just as our physical well being...Not that I have never been through situations that were extremely stressful, I have...and I have my occasional bout of the blues, and fatigue...but none has ever matched the intense craziness of that period…

Things started happening…

It literally felt as if fire has been set to my brain...and then at some other times, it feels as if cold hands made of steel, were mercilessly being inserted into my cranium…

Then I became mildly scared of sleeping! Yes! The thought of letting go of my consciousness to be enveloped, by the brief oblivion that comes with sleep became such a terrifying thought…What if? What if what? I did not know. It just felt terrifying.

Thinking and concentration became a laborious task also, it felt I needed to apply as much as 10x the effort to perform simple cognitive tasks…remembering stuffs also literally hurts...

...and with all these pain going on inside, on the outside, I looked and acted absolutely normal!

And this was the most scary part. The fact that my mind had such capacity to unleash that amount of distress and pain, and yet it remains all invisible...at that point I understood how putting a gun to your temple could feel like the way out to some folks, how swallowing pills or slashing your wrist could feel like the escape yearned…

I had a brief empathy with certain dark corners of our humanity...I understood.

It was a period I would never have a repeat of. It has taught me the need to be gentle with life, with myself, to devout as much attention to mental well being as we do to our physical well being...we eat good, exercise, avoid toxic habits, so also is the need to avoid ultra intense situations, the benefit of surrounding oneself with positive thoughts and family, learn not to give a fuck, cast your cares, and even if life happens, learn how to still not give a fuck, or better still, if you can, know how to stick a middle finger back at life...just do about everything you can to shield yourself...

We owe ourselves this.