Safari address bar and tabs problem, the temporary fix

I have crafted a short videos on how to temporary fix this.

Let me know if you still encounter the problem.

Advertisements

[Latex] Remove “Cited by” from bib

Problem:

Sometimes .bib generated contains useless contents which make their way to your references, see Figure 1. you cloud have 10 or 300 citations depend on the article that you are working on. Here how to clean it up in a few key strokes.

Before

before

Figure 1, some .bib generated include “cite by …”

 

 

Solution:

Make a copy of your .bib file. Get sublime -> use replace function -> enable regular express as shown in Figure 2. – > use regular express:

.* \{cited by.*

.* means to match anything, so this regular express match anything before an after “{cited by”.

Replace it with nothing.

  • You can search to see if the replacing is what you expected before actually hitting the replace button. See Figure 2.

 

Make good use of Sublime

regex

Figure 2, enable, use regular expression search in Sublime 2

 

Figure 3 shown the result. Just do the compilation normally and it is all cleanup.

After

after

Figure 3, cleaned up 🙂

 

Other thoughts

  • alternatively, a shell script can be written to do the something, but sublime works on Linux, OS X and Windows.
  • this trick can be used for other unwanted content in .bib or even for other type of file.
  • remember  to make a copy of the original file before you make the changes.

 

Bluemix-Matrix-Banana

[Exploration] IBM Bluemix with PHP and MySQL

IBM Bluemix is a good platform if you need a fast testing and deploying in the cloud without going through the trouble setting up a proper cloud virtual machine like EC2.

Attended one of the recent workshop organised by IBM and University of Wollongong, I was trying to create a sample testing app using PHP and MySQL, but PHP keep failing to connect to MySQL.

Short answer

Create a file called .bp-config/options.json.

{
    "PHP_EXTENSIONS": ["mysqli"]
}

Long answer

PHP and MySQL(ClearDB) is not connecting well because for some reasons PHP runtime is not part of the choose able runtime, known as community buildpack on Bluemix. Meaning there is no sample codes or boilerplates on Bluemix. For some other reason, PHP buildpack does not by default supports mysqli (because obvious “nobody use php and mysql”, lol). So, if you want PHP and MySQL on Bluemix.

1. Create a PHP runtime by using the community PHP buildpack.

2. Add the service ClearDB (MySQL) to PHP app.

3. Add Git repository to Dev Ops (aka jazz hub), allows you to edit the code.

4. Edit the code, add

.bp-config/options.json

5. Input the above option so that mysqli is included.

6. In your index.php add the following and echo something

$conn = new mysqli($servername, $username, $password);
if ($conn->connect_error){
echo "Something wrong"
} else {
echo "Hello world"
}

7. Build and Deploy!

Afterthought

The worst thing, failing at mysqli results in a blank page, absolutely nothing to help you to debug (you can using cf command line, but why!). The error message is shown only if php connects to mysql but wrong credential is supplied.

A few hours was spent to get a proper solution to this. Therefore, I am not totally sure how reliable Bluemix as a solution is if you are using PHP and MySQL. I can’t comment on other runtime such as Java, Node.js, Ruby as I haven’t got the time to try them out. However, the integration of git repo and deploy pipeline is amazingly good, Dev Ops deploys to Bluemix automatically once a change is committed and pushed, after some settings.

It doesn’t seems to me that Bluemix is any easier then Amazon EC2.

Either way, happy doing a lot of things before doing anything.

[Reference: Cloud Foundry / PHP Buildpack and Stack Overflow – your best friend]