Skip to main content

Posts

Showing posts from January, 2017

docker : folder sharing on windows

To share a folder / volume using Docker, you need to understand the layers involved. There are 3 main layers - which are

Host (Your machine) -> Docker (a virtual machine using Oracle VM called default / or your Windows Hypervisor )  -> Image (the image you download from Docker hub for example hello-world or ubuntu.


Virtual machine configuration 

Using Oracle virtual machine, shutdown default virtual machine if it is already running. The click on Properties->Shared Folder->Add your share location as shown below :-

In this example, you're sharing /c/blog -> c:\tmp\laravel\blog


Running the container

Next, we will mount the volume to a container path /var/www/laravel. What's going on is we're trying to mount virtual machine shared folder (indirectly host machine share folder) to a container folder.

docker run -p 8000:80 -p 443:443 -v /c/blog/:/var/www/laravel/ -d eboraas/laravel

I think many people got confused with providing a windows directory here. (-v /c/blog…

Google cloud bitnami LAMP mysql data password

After you spin up a Bitnami LAMP server and you might wonder what is the mysql database password .....well, just go into Google Console and open up details of your LAMP server.

Then look under bitnami-based password as shown below :-



After that try ssh into your LAMP server and then login to mysql with the password above :-

mysql -u root -p

Deploying Laravel on Google Cloud

Since Google Cloud Platform Bitnami LAMP comes ready with composer and Laravel, we can drive straight in, after you spin up a new LAMP virtual machine.

The public directory accessible to the world is htdocs.

Lets change directory to htdocs by issuing this command "cd htdocs"

Run the following command
composer globalrequire"laravel/installer" Next, we will create a application using the command below: -

$HOME/.composer/vendor/bin/laravel new blog

Please note that this will create a directory called blog under htdocs.

Important! Ensure a folder called storage is writable by

cd blog

Then issue the following command

chmod -R o+w storage

Fire up your brower and browse to the following link
http://your-lamp-server-ip/blog/public/index.php Your laravel page will fire up. :)







Project WAH - (What Happened Here)

WAH - (What Happened Here) - Is a project that allows developer to figure what's going on with an application during runtime. For example, if an application crash, we wanted to find out why.
Unfortunately most of the it time, we ask did you enable logging, read through the logs and find out its root cost and finally cross check that with source code. This takes up alot of time
Instead of using the traditional logging, it allows developer for ask the app what actually happened and why it crash. Yeap, something like interrogation - but with more intelligent way.




Docs on deploying LAMP apps to Google Cloud

Apparently the following links provide good information on deploying PHP based application.

https://docs.bitnami.com/google/infrastructure/lamp/

So what is supported in this LAMP package?

Php scripting language, Apache Web Server, MySQl, MariaDB, phpMyAdmin.

It also support Zend Framework, Symfony, CodeIgniter, CakePhp, Smarty and Laravel. So essentially you can dive straight into development.

google cloud platform : using the lamp stack

when i first install my LAMP stack on Google cloud, I am at a loss trying to find my way  through. The only thing available was ssh. What if  i wanted to install Laravel?

Thankfully it came with "Composer" - PHP dependency manager. I was able to fire up my ssh and just install Laravel using the following command :-

composer globalrequire"laravel/installer=~1.1"
Phew that's was easy

Once you have installed that, $HOME/.composer/vendor/bin/laravel new blog

And you have just created your first project :)


powershell gotchas :- Use global variable / function when you have event in your code

Did you know that its a good idea to use global function and variables when you use event in your code.

Have a look at example below :-



You will not be able to call GetActiveQueueMessage function and your script just dies.

Key take from this is, if you have event, any variable or function you're referring to, please make sure its defined on global or script scope.

Otherwise, you pretty much get uninitialized or empty variable everywhere.







passing parameters in powershell script

Lets say you would like to pass some parameters to your powershell script, you can easily do it using the param keyword. You just have to have it right on top of your scripts. I know this kinda lame post but sometimes when you just can't seems to be able to write that code out.... :)


powershell encrypting credentials using key

Think many of us, already know how to encrypt password in our powershell automation and normally we would just use "Get-Credential". This approach uses Windows Data Protection and only the same user will able to encrypt / decrypt a secure string.

Alternatively you can use a key for the same purpose. Here's my quick and simple  script to encrypt a password.



So we're using our key which starts from 1 until 16 and then it encrypts our password which is "admin" into a file called "password.txt".

Lets instantiate our credential object. Its just a call to say instantiate PSCredential('username', 'password' - tho its a big longer)




We now have a object called MyCredential which stores username and password (extracted from encrypted password.txt file.

We can just pass $MyCredential username and password into our application for further execution.






Powershell to read JBoss Fuse activeMQ using Powershell with NMS Provider .Net

There wasn't much documentation available. Essentially you need 2 files to get your apps running, namely :-

1. Apache.NMS.dll

2. Apache.NMS.ActiveMQ.dll

Next, you can carry on with your powershell coding using code example below :-

In summary, it create a timer and easy elapsed interval, it goes and peek at the message queue. If it is older than a pre-configure days, messages gets archived into a file. (this module is not implemented yet).

Assumption : You have installed and configure activeMq provider like Jboss Fuse.






ionic2 - unable to issue http.get / post

Probably faced by many ionic 2 developer. You can probably fire up your android studio, fire up your android emulator, deploy app and then look at android monitor window for error messages or .....

The fix




Please ensure you allow http and  https connection out to different host in your config.xml file. (i assume that you have installed cordova whitelisting plug-in component.


ionic2 cordova build android - Unable resolve gradle 2.2.3

Faced  this problem when trying to build android using ionic2/cordova. Seems like com.android.tools.build:gradle:2.2.3 is not listed in maven.org (but is available in jcenter).

I was able to compile and run it using Android studio 2.  Would still trying to find a better solution here.

*What went wrong: A problem occurred configuring root project ''.>Couldnot resolve all dependencies for configuration ':classpath'.>Couldnot find com.android.tools.build:gradle:2.2.3.Searchedin the following locations: file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2

Zurb foundation responsive email site is awesome

If you ever wanted to write any responsive email html and see how it looks like on different platform like on IOS, Android, Outlook 2015, Outlook 2013, Gmail, Yahoo and many more... try going to this link http://foundation.zurb.com/emails/getting-started.html

Truly awesome! :)

Have alook at some examples given :-

http://foundation.zurb.com/emails/email-templates.html

There is a couple of catch tho, You should download templates from here (click on Download Foundation for Emails).

http://foundation.zurb.com/emails/docs/css-guide.html

Once you follow the example and crank up some email template of your own, please test it here.

http://foundation.zurb.com/emails/inliner.html

If you still have problem downloading, you can still get it from github.

https://github.com/zurb/foundation-emails-template/tree/master/src/pages


Javascript ES5, ES6 and next is pretty confusing

Think ES5 and ES6 language features are pretty confusing. I got mixed up with ES2015 with ES5, thinking "let or destructuring" feature were actually supported. What a huge mixed up.




What was actually supported by ES5 is pretty minimal. ES6 is a huge change.

You can easily find out the list of features ES5, ES6 supports by clicking on this link here.

To learn about ES6 or ES2015, please click here. Think i just got confused again.