0%

A cookie, also known as an HTTP cookie, web cookie, or browser cookie, is a small piece of data sent from a website and stored in a user's web browser while a user is browsing a website. When the user browses the same website in the future, the data stored in the cookie can be retrieved by the website to notify the website of the user's previous activity. (refer)

HTTP is a stateless protocol, which does not require the HTTP server to retain information or status about each visit for the duration of multiple requests, when a HTTP server receives multiple requests, it can't recognize whether those requests are coming from one single browser or not.

HTTP cookie is designed to be a reliable mechanism for websites to remember the state of the website or activity the user had taken in the past. When a user visits a website, cookies are sent by user's browser to the HTTP server inside HTTP header fields, the HTTP server can set cookies for its own purposes and sent them back to the user, e.g., set values to identify the user.

With cookie, the website recognizes its users, on the one hand, users don't need to set language preferences or login, etc. every time when they visit the site again, on the other hand, the website could provide their users customized contents or services.

Read more »

Ranking

App ranking informations can be get from iTunes RSS feeds provided by Apple, currently, at most Top 300 are listed in each feed.

For example, if I want the top 300 grossing apps in "Games" category, after input my requirements, I get the feed URL as follows:

https://itunes.apple.com/us/rss/topgrossingapplications/limit=300/genre=6014/xml

Using python, I chose feedparser as an RSS parser.

Read more »

I was working on a mobile app analytics system recent months, how well the system works relies on the app usage data captured on the users' devices.

This post is about technically how I did it in both iOS and Android operating systems.

Making Thread

When a user opens an app, an open session event needs to be captured, when a user tap the home button, app transitions to the background, the session needs to be marked as closed, when a user view an important page, or click a fancy button, counters need to be increased. Those needs must be handled in background threads since I don't want my app UI freezing by some time-consuming "needs".

In iOS, Grand Central Dispatch (GCD) is amazing, create a serial dispatch queue, and a background thread is alive.

Read more »

Last week, I read the old book Get Things Done again, it did make me think. I read it first two years ago, at that time, I didn't feel the benefits since I could manage all stuff in my mind. But now, I can't, I do forget things, I do procrastinate things. During my reread, I kept asking me, why I just missed this treasure, so silly I was.

Below are my reading notes.


Stuff: anything you have allowed into your psychological or physical world that doesn’t belong where it is, but for which you haven’t yet determined the desired outcome and the next action step.

We need to transform all the “stuff” we’re trying to organize into actionable stuff we need to do.

Read more »

I just can't believe displaying LaTeX math formula in Octopress could be this easy.

  1. Add gem 'kramdown' to "GemFile", then run bundle install.
  2. Edit "_config.yml", replace markdown: rdiscount to markdown: kramdown, kramdown is a fast, pure-Ruby Markdown-superset converter.
  3. Open "source/_includes/custom/head.html", and add below scripts to use MathJax, a decent js display engine for mathematics.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!-- MathJax -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true
}
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
</script>

<script type="text/x-mathjax-config">
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>

<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

Now, let's enjoy the beauty of Gaussian Distribution

\[ f(x;\mu,\sigma^2) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2} \]

Read more »

Problem

The day before yesterday, I looked into the Markdown menu of Emacs and saw "Preview" and "Export" commands while I was editing one markdown document, then, I just clicked, and opened the exported HTML file, but found out that almost all my contents were emptied, that document were written in Chinese.

I had another separate Emacs instance running on a terminal, I do the same thing there, the non-ASCII characters were well outputted.

Solution

Before, I always used markdown directly by shell-command, and it worked well. I doubt there might be something wrong in the encoding functions of markdown-mode. Then I checked.

Read more »

Before I learned "Web Analytics", I was stupid at this area.

For example, I only knew and obsessed with "PageView", I got angry for Google not putting "pageviews" as the default selected metric in "Google Analytics", instead, it uses "visits".

Let Them Go

A page view (PV) or page impression is a request to load a single HTML file (web page) of an Internet site. (Wikipedia)

Yes, from the early days of web, we all obsessed about "page views", it is a calculation of how many times a page is viewed, so, more "page views" means more "famous" your site is, or more opportunity for someone to click your ads.

Read more »