[TUTORIAL] HOW TO PAUSE AN AWS ELASTIC BEANSTALK ENVIRONMENT USING THE DASHBOARD

So you have set up a test elastic beanstalk environment because you don’t want to put at risk your production elastic bean.
You don’t want to pay for the time you’re not using it, and there’s no freaking “Pause Environment” option.

aws-elasticbean-no-pause-option

all you can do is “Terminate Environment”? but then to crete the damn environment it takes forever to configure (if you’re using the dashboard), so we don’t want to do that.

If you try to terminate the associated EC2 instance, the Elastic Beanstalk environment will automatically provision a new machine for you, so that doesn’t work. What do you do?

Open the Elastic Bean environment you want to pause and go to “Configuration”
Screen Shot 2016-06-23 at 1.55.02 PM

On the Scaling card, click on the Gear icon to change its settings

Screen Shot 2016-06-23 at 1.55.11 PM

in the “Auto Scaling” options, set the “Minimum instance count” to 0, and the “Maximum instance count” to 0

Screen Shot 2016-06-23 at 1.55.56 PM

Hit “Apply”
Screen Shot 2016-06-23 at 1.56.03 PM

Wait for your environment to apply the new configuration

Screen Shot 2016-06-23 at 1.56.15 PM

 

Now your health status has switched to gray. It’s now paused and you won’t be paying for the test ec2 instance while you’re not working on it.

Screen Shot 2016-06-23 at 1.58.11 PM

If you are curious and you check the ec2 instances associated to the environment, it/them should be terminated now, but now the environment won’t try to provision new ones.
thanks-bow

Savings in your pocket. Cheers.

 

Setting up Eclipse as your IDE for Bitcoin C++ development on MacOSX.

If you are a Java developer used to the productivity levels achieved by working with eclipse’s code navigation, code completion and refactoring tools, it’s worth your time staying in eclipse for any sort of C++ development.

Screen Shot 2014-02-09 at 1.03.21 PM

This post refers specifically to getting your eclipse environment to work with a particular C++ Open Source project, The Bitcoin Project.

Before you start setting up eclipse, please make sure you can build Bitcoin from the command line, this way you know that you have everything necessary to build Bitcoin, even if you’re still getting a few errors showing in Eclipse, in the end Eclipse will be using the Makefiles provided by the project whenever we need to compile (and it can do so incrementally when possible saving you a lot of compilation time)

I’m assuming you have installed:
– eclipse
eclipse CDT tools, up to date for the version of eclipse you’re working with (I’m still working with Juno)
– Qt/Eclipse plugin (optionally)
– All the dependencies (autoconf automake berkeley-db4 boost miniupnpc openssl pkg-config protobuf qt gdb) necessary to build Bitcoin which are easily installable via HomeBrew.

1. Let’s import the bitcoin/ project to our workspace.

File > Import > Existing Code as Makefile Project

Screen Shot 2014-02-09 at 12.41.45 PM

 

Look for the bitcoin/ git checkout folder, and make sure you use the GNU Autotools Toolchain

Screen Shot 2014-02-09 at 12.43.05 PM

 

Click Finish.

2. Fixing the C++ compiler Path and Symbols.

Right click on the project containing folder in the Project Explorer > Properties.
Go to C/C++ General > Paths and Symbols > Languages: GNU C++ >  “Includes” Tab and make sure it looks something like the screenshot below (I got those paths by looking at  the  ones used by the Makefiles in the Bitcoin. Hit Apply , OK, then wait for the reindexing, you might still have a few weird errors because of how the compiler checking settings are.

Screen Shot 2014-02-09 at 12.55.38 PM

3. Remove a few more issues like “Error: Invalid arguments candidates are: void resize(?, int)."

We open again the project Properties, this time we go to C/C++ General > Preproessor Include Paths, Macros, etc.
Click on the Providers tab and make sure “CDT GCC Built-in Compiler Settings [Shared]” is checked. Hit Apply, OK, wait for reindexing.
If there are still errors, you might want to just delete them and refresh the project (F5 on the project folder in the Project explorer), all errors should be gone by now.

Screen Shot 2014-02-09 at 1.01.25 PM

Now start working just as fast as you’re used to with Java on Eclipse.

 

Code completion…

Screen Shot 2014-02-09 at 1.09.39 PM

 

Project wide renaming refactors in seconds…

Screen Shot 2014-02-09 at 1.10.07 PM

 

 

Find references of variables, methods, classes (Cmd+Shift+G)

Screen Shot 2014-02-09 at 1.23.37 PM

 

Find all the implementations of an interface (Cmd+T)

Screen Shot 2014-02-09 at 3.34.39 PM

and best of all

Interactive debugging with gdb*

Screen Shot 2014-02-11 at 1.21.07 PM

and all the tools you know and love from Eclipse.

*Setting up GDB debugging

To do step by step debugging you can use gdb, if you don’t have it installed just go to your Terminal and type brew install gdb.

On your command line, execute your Makefile to create an executable, once it appears on your Project Explorer you can Right click on it Debug As > Debug Configuration…

Screen Shot 2014-02-11 at 1.31.43 PM

then make sure you have set gdb as the executable debugger in the “Debugger” configuration tab, then just set your breakpoints and debug away!

Screen Shot 2014-02-11 at 1.32.00 PM

Not so fast… 🙁

As of Mac OSX 10.9, Apple decided that you cannot use gdb unless the gdb executable is signed with a certificate, they want you to use their super duper lldb debugger, but it’s still not compatible with Eclipse, you know, so you use their XCode IDE instead of what you want to use…

Anyways, signing the gdb at /usr/local/bin/gdb is not that hard.

To sign it you can create a certificate, or use an existing developer certificate. In my case, I already had a Mac Developer certificate so it was a very simple process, just issuing a single command in the Terminal and I finally got rid of the "Unable to find Mach task port for process-id 93213: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))" error.

codesign -s “Name of my certificate here” /usr/local/bin/gdb

Then I tried debugging, I got a password dialog to verify I was the owner of the certificate, and then gdb could take over and then I could do my step by step debugging, with the ocassional crash.

Happy Hacking.

How to add an existing GIT repository to github.

Most of the times, it makes more sense to start working on something that slowly transforms into the beginning of a project that deserves to be on github. This post is about creating a local repository and putting it on github.

1. First we must convert the main local folder into a git repository. For this example let’s call the folder “my-new-project”. With your terminal go to that folder and type:
[bash]git init[/bash]

the repository will initialize but nothing will be added to it yet. If you type git status you will see all the things you can add to it, so use git add to add the folders you want to track, and then go ahead and do a git commit -m “initial commit”

2. Now go to github.com and create your repository “my-new-project”, and copy the clone url of the repo, I personally like to work with the one that starts with “ssh://” since I like to work with ssh keys and not have to deal with passwords.

You can easily configure your ssh certificates for multiple things, not just github but keys for many many servers working with the ~/.ssh/config file (no need to deal with effing ssh-agent).

If you created this github repository with some other account, make sure to give yourself contributor access on the github role settings, otherwise you won’t be able to pull/push.

3. Time to pull (fetch+merge) the remote repo and then push this baby up.
You do that by invoking the following commands (let’s suppose the remote url is git remote add origin git@github.com:myaccount/my-new-project.git):
[bash]git remote add git@github.com:myaccount/my-new-project.git
git pull origin master[/bash]

you should see something like below coming from the remote repo’s master branch:

[bash]warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (4/4), done.
From github.com:myaccount/my-new-project
* branch master -> FETCH_HEAD
Merge made by the ‘recursive’ strategy.
.gitignore | 6 ++++++
README.md | 2 ++
2 files changed, 8 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md[/bash]

and then just
[bash]git push[/bash]

and you’re done, you should see your initial commit on github now.