brew install php70
git clone -b NON_BLOCKING_IO_php7 https://github.com/websupport-sk/pecl-memcache.git
cd pecl-memcache
phpize
./configure
make && make install
/** | |
* Write content into file | |
* | |
* @param path require WRITE_EXTERNAL | |
* @param contentString | |
*/ | |
public static void writeContentFile(String path, String contentString) { | |
File file = new File(path); | |
if (!file.exists()) |
/** | |
* Get the "android:versionName" value from the Manifest file. | |
* | |
* @param context The current Context or Activity that this method is called from | |
* @return the application version string, or "Unknown" if versionName cannot be found for | |
* the given context. | |
*/ | |
public static String getVersionName(Context context) { | |
String versionName; | |
try { |
/** | |
* for send object between fragment, activity, service... | |
* REMEMBER: dispose if not in use to avoid leak memory | |
*/ | |
public class RxBus<T> { | |
private static final String PREFIX = "$^%)@"; | |
private static RxBus instance; | |
private PublishSubject<BusMessage<T>> subject = PublishSubject.create(); |
server { | |
listen 80; | |
server_name localhost; | |
root /Users/YOUR_USERNAME/Sites; | |
access_log /Library/Logs/default.access.log main; | |
location / { | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
} |
/* | |
Umm Al-Qura Islamic Calendar | |
valid from 1356 AH (14 March 1937 CE) to 1500 AH (16 November 2077 CE). | |
Outside this interval, the converter will give erroneous results. | |
ported from javascript from: | |
http://www.staff.science.uu.nl/~gent0113/islam/ummalqura_converter.htm#top | |
*/ | |
import java.util.Calendar; |
Have you ever wanted to get a specific data from another website but there's no API available for it? That's where Web Scraping comes in, if the data is not made available by the website we can just scrape it from the website itself.
But before we dive in let us first define what web scraping is. According to Wikipedia:
{% blockquote %} Web scraping (web harvesting or web data extraction) is a computer software technique of extracting information from websites. Usually, such software programs simulate human exploration of the World Wide Web by either implementing low-level Hypertext Transfer Protocol (HTTP), or embedding a fully-fledged web browser, such as Internet Explorer or Mozilla Firefox. {% endblockquote %}
Looking at the officiel Twitter Android client I've noticed the slight cool & sexy transition between activities. I was curious to know how that worked so I had fun with android xml animations and ended up with that:
push_left_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="red_50">#fde0dc</color> | |
<color name="red_100">#f9bdbb</color> | |
<color name="red_200">#f69988</color> | |
<color name="red_300">#f36c60</color> | |
<color name="red_400">#e84e40</color> | |
<color name="red_500">#e51c23</color> |
/** | |
* Generates the string for the Haversine function. We assume that the `zipcode`, `latitude`, | |
* and `longitude` columns are named accordingly. We are also not doing much error-checking | |
* here; this is a simple text cruncher to make things prettier. | |
* We may also be integrating some extra SQL in, passed in via the $extra parameter | |
* | |
* @param string $table The table to search in | |
* @param float $lat The latitude part of the reference coordinates | |
* @param float $lng The longitude part of the reference coordinates | |
* @param int $radius The radius to search within |