How to delete de DefaultDomain of an Integrated Application Server for Weblogic on OS X

weblogicWow, this has a really long post title.

Basically what I just figured out is how to delete the default domain that is created by the integrated Application Server (weblogic) by Jdeveloper.

Open Terminal.app

cd  ~/.jdeveloper/

Here you’ll find various folders, go into the one that resembles systemjdevversion for example

cd system12.1.2.0.40.66.68

then delete folder DefaultDomain

rm -Rf DefaultDomain

After this just restart jdeveloper and you can create a default domain again.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

True meaning of blog

It’s been a while since I’ve added a post to my blog, I though I’d just add this quick note just to add the feel of new post to the main page.

When I decided to start a blog I realized that I could simply share with the world what I learn, of course not everything I learn, but the things that I learn that google couldn’t solve with a simple search, most knowledge is arcane, if you could see my notes you’d be surprised how much tweaks and work arounds I figure. For this 2014 I’ll try to share more of my findings on this website.

Hope something is reading out there.

Huh, the internet, such majestic creature.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Search for a song and play it with Alfred 2.0 for free

logoAlfred 2.0 just came out and personally I found it’s an amazing app, I’m still a huge fan of Butler but let’s face it, Manytricks hasn’t updated the software in a very long time and the users (at least me) are hungry for new features.

Alfred 2.0 delivers a lot of fetures, among them the chance to create your own workflows with many scripting languages likes bash, php and ruby among others.

So I had the need of searching a song in my iTunes library, that simple right? no! while Butler did that just out of the box, with Alfred 2.0 you need to buy the PowerPack which is 15 pounds (around $20 dollars) and still, when you look for a song using the mini-player, which you have to activate with a different set of keys or commands, the song you played will play once and then plain silence will be heard, that kinds of anoys me as I’m always expecting the music to keep player.

To solve this issue I made a really simple and fast workflow that allows you to look for songs on your iTunes Library, I don’t know if it could work without the power pack so I’ll post both, the one I’m sure that works with the powerpack of Alfred and the slower version that works with iTunes and applescript.

Hope it’s useful to you.

iTunes Search and Play (to use with PowerPack)

iTunes Search and Play (to use without powerpack)

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

Getting all the months in the current Fiscal Year with a Query on Oracle

logo_oracleI usually like to do everything dinamically, so I wanted to figure out the current set of months for the current fiscal year on Oracle DB using a simple query, from everyone’s favorite table dual.

So here’s there query:

SELECT TO_CHAR(add_months(TRUNC(SYSDATE, 'mm'),
              DECODE(EXTRACT(MONTH FROM SYSDATE),
              1,-7,
              2,-7,
              3,-7,
              4,-7,
              5,-7,
              6,5,
              5) - EXTRACT(MONTH FROM SYSDATE)+level),
              'Mon-yy')
FROM dual
CONNECT BY level <= 12;

This will output the following (SYSDATE at the time of writing is 03/07/13 “mm/dd/yy”)

Jun-12
Jul-12
Aug-12
Sep-12
Oct-12
Nov-12
Dec-12
Jan-13
Feb-13
Mar-13
Apr-13
May-13

 

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Scheduling jobs on Oracle Apex

So I’m working with apex to get some things done and I think it’s a nice tool, it already has everything in it so you can create quick reports and other fancy web tools so I designed a report on PL/SQL and I had the need to have it run daily, after finding out how I thought you might find useful this snippets of code.

We use the dbms_scheduler.create_job() API to easily add jobs to APEX’s scheduler:

BEGIN
dbms_scheduler.create_job(
     job_name => 'JOB_NAME',
     job_type => 'STORED_PROCEDURE',
     job_action => 'procedureName',
     start_date => '04-JUL-12 07.00.00.000000 AM -05:00',
     repeat_interval => 'FREQ=DAILY',
     enabled => TRUE,
     comments => 'My super report, dont delete.');
END;

To check for existing jobs on the scheduler we can query the user_scheduler_jobs table;

SELECT * FROM user_scheduler_jobs;

And lastly and just as useful, to delete a job from the scheduler we use the dbms_scheduler.drop_job() API call:

BEGIN
dbms_scheduler.drop_job(
     job_name => 'JOB_NAME');
END;

Hope you guys on the internetz find this useful.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

How to add an index on Doctrine 2 using YAML

I know this post is kind of small but this is something not so easy to find on google. The easiest way to add an index to a column on a YAML mapping is using the @indexes contraint.

 

Entity\Post:
    type: entity
    table: posts
    indexes:
        # index name
        title_slug_idx:
            # one or multiple columns separated by comma
            columns: [ slug ]
    id:
        id:
            type: integer
            generator: { strategy: AUTO }

    fields:
        name:
            type: string
        slug:
            type: string
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Data types for Latitude/Longitude on Doctrine 2 with YAML

NameI’m a devote Doctrine 1.2 user but times are changing and now I’m faced with the challenge of learning and updating all of my applications to use the brand new Doctrine 2.2 framework.

Doctrine 2.2 has been completely renewed and a lot of cool stuff from Doctrine 1.2 has dissapeared, one that will be missed the most I’m sure is the auto-magic the behaviours provided, this said some new challeneges arise, for example, what type of data to use to store basic data like latitud and longitud since the Geographical behaviour is now gone.

A solution I’ve find is to use decimal type of data with a size of 18,12, so if you are defining your models with YAML like I do you can do the following:

 

 

Entities\City:
  type: entity
  fields:
    id:
      type: integer
      id: true
      generator:
        strategy: AUTO      
    name:
      type: string(255)
    latitude:
      type: decimal(18)
      scale: 12
      precision: 18
      nullable: true
    longitude:
      type: decimal(18)
      scale: 12
      precision: 18
      nullable: true

With this type of data I fixed my need of storing latitude and longitud data.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Domains from How I Met Your Mother that actually exist

I know this post is off-topic about everything else on this blog but I thought it’d be funny to gather all those funny domain names that are used on the How I Met Your Mother TV show.

So far the domains I’ve found that work are:

So if you know any other domains from this serie, please post it on the comments and I’ll add it to the listing.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Using split on PHP 5.3.0

It’s been a while since it started coding again in PHP specially in PHP 5.3.0 and I’ve come across some interesting finding, for example some functions such as ereg, eregi and split are deprecated now in favor of a new library call Perl-Compatible Regular Expressions. For old coders (like me) we need to start updating our code to keep with the up to date standards.

A function I use a lot (for good or for bad) is split but as a matter of fact is one of the new deprecated functions on php so instead of calling it as usual (delimiter, string) now we have to call it using a perl-compatible regular expression (regex,string) as follows:

$email = “something@domain.com”;

$parts = preg_split(‘/@/’,$email);

Result:

Array ( [0] => something [1] => domain.com )

You can see it’s the same result as the old split() function.

Hope this saves you some time.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

How to convert a .cer certificate to .pem on Linux/Unix and OS X

While trying to update a certificate on a produciton enviroment I ran into the following issue, Apache only accepts certificates in PEM format, since my client provided me with his new certificate on a .cer file I had to find a way to convert it.

For x509 certificates this can be easily achieved using OpenSSL on Linux/Unix and OS X. First make sure you have OpenSSL (comes by default with OS X), open a terminal and issue the following command:

openssl x509 -inform pem -in certificate.cer -outform der -out certificate.pem

Where certificate.cer is the source certificate file you want to convert and certificate.pem is the name of the converted certificate.

VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)