Tuesday, November 12, 2013

Bitcoin links

A coolection of useful Bitcoin links:






Bitcoin how to export private keys

Here I will collect some smart tips regarding Bitcoin apps.

I have tried the Bitcoin wallet app on Android. It has a Export Key function that results in an encrypted file that you can backup.

To decrypt this file you need openssl and then you run this command:
openssl enc -d -aes-256-cbc -a -in <filename>

If you are using Bitcoin-qt you can see your private keys by first listing your public keys with
listreceivedbyaddress 0 true

or
bitcoind listaddressgroupings

and then you can use
dumpprivkey <publickey>

to see your private key.
The console is brought up by using
launch your bitcoin client as usual and wait for it to load the blockchain and start up
click on 'help' in the menu bar (top right)
click on 'debug window'
select the 'console' tab
type: walletpassphrase "your walletpassphrase here" 600
type: dumpprivkey [your public key here]
this will return the private key, you can copy it now; ensure you clear your clipboard/history afterwards
type: walletlock

Tuesday, July 09, 2013

Google Currents

I'm trying out Google Currents at the moment. I stumbled across it searching for a replacement to Google Reader.
So far I kind of like it. Clicking Feeds and "Add..." even allows me to add all the RSS feeds I used to have in google reader. That's pretty nice.
Unfortunately I can't watch all my feeds on one and single page. I have to check them individually.

Other than that I like the layout and stuff when reading magazines and "Breaking Stories" for each category is also a nice feature giving you a quick heads up on current news. Seems pretty useful if there would a disaster somewhere in the world or something like that.

So far I have only used the iPad and Android app. I'm looking forward to see a web based version though. 

Tuesday, May 07, 2013

Setting up Eclipse with incremental hot deploy of maven projects

After spending several hours searching the net for a good way to make Eclipse, JBoss and Maven to do Hot Deploy incrementally after saving a file and never finding any good instructions I decided to do it myself.

Here is one way to do it. It might not be the best or the most correct way, but it works (at least for me).

After writing this document I discovered "Jboss Maven Integration" plugin and tried it out.
I had problems with it. It didn't generate my wsdl java classes as specified in my pom and after this I didn't have time to look more at it.

These instructions are based on that I have an EAR project, one or more EJB projects with API projects and one or more WAR projects that I want to hot deploy. My projects are located in a Subversion directory.


These are the steps.


  1. In Eclipse, check out projects EarProject1, EjbProject1 and EjbApiProject1 and WarProject1 as New General Projects. These are all Maven projects.
  2. When the projects have been checked out, delete them in Eclipse but do not remove them from the hard drive. This is done because we are going to scrap the eclipse settings files with maven.
  3. Next we open a command prompt or a unix terminal and for each project run "mvn eclipse:clean eclipse:eclipse" and "mvn clean package". This helps us with download dependencies and set up our classpaths.
  4. Now delete the ".settings" directory in each project. This is done because we do not want Eclipse to treat this as a Maven project any more, and for some reason, if I did not delete this folder Eclipse will not allow me to add any Modules to my EAR project. The "Deployment Assembly" tab does not show in the EAR properties window.
  5. Import the projects in Eclipse as "General/Existing Projects into Workspace".
  6. Set the project Facets for all the projects
    EAR as EAR
    EJB as EJB Module and Java
    API as Java
    WAR as Dynamic Web Module and Java
  7. In the WAR project open properties and go to "Java Build Path" and make sure you don't have any Junit test folders in your "Source" tab. I ran into a problem when not doing this because the junit tests were using different config files than what should be deployed.
  8. In the WAR projects properties go to "Deployment Assembly" and replace "/WebContent" with the folder where you have your Web Application files.
    I use "/src/main/webapp" to store my "WEB-INF" and jsp, css, javascripts etc. So remove "/WebContent" and add "Folder" and choose your Web Application folder. When this is done you can delete the default "WebContent" folder in your project if your'e not using it.
  9. Also add all jars that must be included in your WAR project. Choose Add... and select "Java Build Path Entries" and select the ones needed. I could not select everyone since some of them were provided by JBoss and including them caused the application to not know which one to use. My jars are located in my M2 repo so an example of what I added was
    M2_REPO/org/apache/poi/poi/3.9/poi-3.9.jar
  10. In the WAR projects "Java Build Path" also make sure you don't have any EJB project included under "Libraries" tab that should be included under the "Projects" tab. My WAR1 project depends on my EJB1 project, so I remove the EJB1 project from "Libraries" tab and add it under the "Projects" tab instead.
  11. I didn't have to do anything with my EJB project. It worked out of the box. But if you run into problems check the following in your EJB projects properties:
    - In "Deployment Assembly" make sure you have all the folders you need included. Including any Web Service generated source folders if you have any such.
    - In "Java Build Path" make sure you have removed the possible API project or any other project you want to hot-deploy under the "Libraries" tab and add them instead under the "Projects" tab.
  12. Do the same procedure with "Deployment Assembly" and "Java Build Path" for your other EJB, WAR and API projects as well.
  13. Now it's time for the EAR project. We are going to use some of the structure that maven has built for us.
    Open Properties and go to "Deployment Assembly". If you are not using the default directory architecture that that Eclipse uses, replace the "/EarContent" entry with your directory. I do not use "EarContent" so I removed this entry and chose "Add..." - "Folder" and selected my "/target/EAR1" directory. This is the directory that maven has created for me with all modules and lib jars that the EAR project needs.
    Also add the Projects that you want to deploy in your EAR file. I choose my EJB1 and WAR1 project and, if I had one, I would also choose my API project.
    Select Apply and OK.
  14. Maven has of course included all dependencies for me in my EAR project so had to remove the .jar files from the EAR project that I want to include as Eclipse Modules. In my case I remove the following:
    /target/EAR1/WAR1.jar
    /target/EAR1/EJB1.jar
    and if you have an API project this would have been located in
    /target/EAR1/lib/API1.jar
  15. Now I can delete my "EarContent" directory in the EAR projects root since I don't use it.
    I can also delete any META-INF in the root directory since I use the one under "/target/EAR1" instead.
    I also delete the "/target/EAR1/META-INF/application.xml" file since we are going to regenerate this one.
    Next I right click on the EAR project and select "Java EE Tools/Generate Deployment Descriptor Stub". This will create a new "/target/EAR1/META-INF/application.xml" file for me with the correct Modules included.

    In Eclipse Juno you can under "Deployment Assembly" select "Advanced" and choose which folder that should be used for you Deployment Descriptor. In Eclipse Indigo it always chooses your alphabetically first folder.
  16. I also had to Rename my EAR project in Eclipse. The project is actually called MyEARProject1 but all the remote services look for the jndi appname "EAR1" and JavaEE5 uses the filename of the ear as application name.
    So I right click on the EAR project and name it EAR1 instead.
    If you are using a JavaEE6 server I guess this could be fixed by setting "application-name" in the "application.xml" instead of renaming the project.
  17. One last thing to do. Check your "${JBOSS_HOME}/server/<conf>/deploy" (Jboss6.1)directory so you don't have any of the projects that we are hot-deploying in it.
    In my case I had to remove my "EAR1.ear" from the deploy folder.
  18. Now I can add my EAR project to my Eclipse JBoss server and start it up.

Done.
If you have any questions or suggestions regarding this document, please let me know.