Skip to content

Instantly share code, notes, and snippets.

@markbao
markbao / PHP 5.3 and MySQL: certain features only available with mysqlnd - codedoc.md
Last active April 20, 2016 05:19
PHP 5.3 and MySQL: certain features only available with mysqlnd Fatal error: Call to undefined method mysqli_stmt::get_result() Fatal error: Call to undefined function mysqli_stmt_get_result() Fatal error: Call to unefined method mysqli_result::fetch_all() Fatal error: Call to undefined function mysqli_fetch_all

If you've deployed an app based on PHP 5.3 and MySQL using PHP's mysqli, then you may have run into some issues because the mysqlnd driver for PHP is not installed. This is required for some mysqli features like get_result().

You may run into some of the following isseus:

Fatal error: Call to undefined method mysqli_stmt::get_result()

Fatal error: Call to undefined function mysqli_stmt_get_result()

Fatal error: Call to unefined method mysqli_result::fetch_all()

@markbao
markbao / gist:4061193
Created November 12, 2012 19:02
The Negative Effects of Tourism

In Barcelona, I stayed on La Rambla, a historic, but highly commericalized and touristic street. In Florence, I walked through the Piazza del Duomo daily to go to the library, dodging pushy vendors and visitors taking photos. And in every city I go to, I begin my visit by lamenting the number of streetside folks selling fridge magnets and mugs, characature artists on the sidewalk, and tour buses everywhere.

No. This isn't the genuine, authentic, raw city that I'm here to experience. This isn't the beautiful, historical part of the world that locals call home. It resembles its former self, but it's been plagued by the

As I spend more time traveling, I'm becoming increasingly wary of the effect of tourism on an area's culture, especially when I walk down La Rambla, which is highly commercialized and geared almost solely to tourists. While tourism is a plus for the economy of an area, I'm worried about the effects on the development of the local culture, as well as how that culture is portrayed to the outside

@markbao
markbao / gist:3977035
Created October 29, 2012 22:49
The problem with taking photos while traveling

Photography is one of my favorite things to do, and traveling brings about incredible opportunities for photography. However, I’ve always been wary that photography might be detracting from the experience of traveling.

I see this constantly with tourists in every city I’ve been to, including the one I’m in right now (Bilbao, Spain). Someone comes across an incredible sight, and immediately whips out their camera and take a picture of it—instead of taking it in and experiencing the feeling. And a lot of the time, after the snapshot is saved, they take a glance at the subject and move on to whatever’s next.

On this trip, I’ve experimented with not using my camera for the entire day, not even taking it with me, and just being in the moment. The result is: I do feel like I’m experiencing the moment more, and I’m more appreciative of the places I go. But why?

I think we have different motives based on our environment. If I leave my hostel in the morning without my camera, phone, or anything other than a few b

@markbao
markbao / gist:3737095
Created September 17, 2012 12:48
Read less, reflect more

I read a lot of material every day, especially since I’m traveling and have the free time to devote to reading and writing. Over time, however, I’ve realized that as much as I do read, few of it really makes an impact on me. There are articles and books here and there that have really changed my thinking, but in general, a lot of my reading material is read and then promptly forgotten. If the knowledge gained from reading doesn’t stick, I need to figure out a way to read and think about what I’m reading at a deeper level.

So, I’ve decided to do the following:

  1. Read less.
  2. Write a reflection for every article or book I read.

Reading less. Instead of reading as many articles as I can and soaking it all up, I now make an effort to read only the most important things out there—the most thoughtful articles, the most relevant books—and to really understand it.

Writing a summary. For every book or article I read, I write a summary of the article of the main points, so I can go back to it and refer

@markbao
markbao / gist:3492218
Created August 27, 2012 21:05
The problem with taking photos while traveling

Photography is one of my favorite things to do, and it’s heaps better while traveling. However, I’ve always been wary that photography might be detracting from the experience of traveling.

I see this constantly with tourists in every city I’ve been to, including the one I’m in right now (Bilbao, Spain). They come across an incredible sight and immediately whip out their camera and take a picture of it—instead of taking it in and experiencing the feeling, or thinking about how it makes them feel. And a lot of the time, after the snapshot is saved, they take a glance at the subject and move on to whatever’s next.

On this trip, I’ve experimented with not using my camera for the entire day, not even taking it with me, and just being in the moment. The result is: I do feel like I’m experiencing the moment more, and I’m more appreciative of the places I go. But why?

My hypothesis is that we have different motives based on our environment. If I leave my hostel in the morning without my camera, mobile phone, or

@markbao
markbao / gist:3229178
Created August 1, 2012 17:47
Dancing and Psychology

Most people can’t step into a dance club and start dancing immediately. I, like other people, slowly build up to dancing—first with the meditative headnod to the beat, then involving some hand and arm movement, and—after some time—throwing out big shapes.

But why do we have to slowly build up enough confidence to really start busting moves, and why do we have to do the same thing every night? How do we get to the point where we’re in the mood to dance? Why is dancing a bit scary at first, but becomes easier and less worriesome to do later on? (Other than alcohol—let’s talk about that later.)

I think of it as increasing your tolerance for doing something risky, where the risky activity is dancing. When you first step in, you haven’t been dancing at all, and you might have a worry in your mind that you’ll look stupid dancing. Maybe it’s because you woke up the morning after thinking about how stupid you probably looked dancing last night, or maybe it’s because you just haven’t gotten into the mood to dance.

@markbao
markbao / gist:3210806
Created July 30, 2012 22:05
The Negative Effects of Tourism

I’m on my second day of traveling around for a bit, and my first stop is Barcelona. I’m staying in a hostel right off La Rambla, one of the more famous streets in Barcelona, in the relatively modern district of Eixample.

As I spend more time traveling, I’m becoming increasingly wary of the effect of tourism on an area’s culture, especially when I walk down La Rambla, which is highly commercialized and geared almost solely to tourists. While tourism is a plus for the economy of an area, I’m worried about the effects on the development of the local culture, as well as how that culture is portrayed to the outside world.

What are the advantages of tourism?

Local economic development. An area with tourism will enjoy a larger population of people going in and out, and therefore restaurants, souvenir shops, museums, tour groups, and like parties will contribute to the development of the local economy.

Travel is enjoyable. On a more personal level, travel offers different perspectives on cultures and

@markbao
markbao / gist:3158873
Created July 22, 2012 08:08
Issue with triple-bracket with django verbatim
#### home.html
{% verbatim %}
<script id="temp" type="text/x-handlebars-template">
<div class="journeyLogContent">
{{{ content }}}
</div>
{% endverbatim %}
#### rendered in browser
@markbao
markbao / gist:2516639
Created April 28, 2012 06:53
arduino: alternating blinking lights
//LED Pin Variables
int ledPins[] = {2,3,4,5,6,7,8,9}; //An array to hold the pin each LED is connected to
//i.e. LED #0 is connected to pin 2, LED #1, 3 and so on
//to address an array use ledPins[0] this would equal 2
//and ledPins[7] would equal 9
int lightModulo = 0; // for which modulo to light
/*
* setup() - this function runs once when you turn your Arduino on
+ sudo -u app /usr/local/bin/forever start -p /logs -l /logs/forever.log -o /logs/out.log -e /logs/err.log server.js
22:21:30: The "sys" module is now called "util". It should have a similar interface.
22:21:31: info: Forever processing file: server.js
22:21:31: {
"process": {
"pid": 11307,
"uid": 1000,
"gid": 1000,
"cwd": "/srv/synapse",