ezoic

Thursday, September 21, 2017

Tokenize in python

Tokenize in python.

https://docs.python.org/3/library/tokenize.html


https://www.techopedia.com/definition/13698/tokenization


Tokenization is the act of breaking up a sequence of strings into pieces such as words, keywords, phrases, symbols and other elements called tokens. Tokens can be individual words, phrases or even whole sentences. In the process of tokenization, some characters like punctuation marks are discarded. The tokens become the input for another process like parsing and text mining.
Tokenization is used in computer science, where it plays a large part in the process of lexical analysis.

Lexical analysis:

https://en.wikipedia.org/wiki/Lexical_analysis



Serialize and deserialize in programming

Serialize and deserialize in programming:


https://en.wikipedia.org/wiki/Serialization


In computer science , in the context of data storage, serialization is the process of translating data structures or object state into a format that can be stored (for example, in a file or memory buffer) or transmitted (for example, across a network connection link) and reconstructed later (possibly in a different computer environment).When the resulting series of bits is reread according to the serialization format, it can be used to create a semantically identical clone of the original object. For many complex objects, such as those that make extensive use of references, this process is not straightforward. Serialization of object-oriented objects does not include any of their associated methods with which they were previously linked.
This process of serializing an object is also called marshalling an object.The opposite operation, extracting a data structure from a series of bytes, is deserialization (which is also called unmarshalling).



In python, we use pickle to do the serialization and deserialization. 

https://docs.python.org/3/library/pickle.html

There is a .pkl file.

https://fileinfo.com/extension/pkl

In php, there is a serialize function.




How to run php code in windows.

http://editrocket.com/articles/php_windows.html

results of the program in php:
a:3:{i:0;s:5:"Lorem";i:1;s:5:"Ipsum";i:2;s:5:"Dolor";}

serialize in c++, geeksforgeeks.

http://www.geeksforgeeks.org/serialize-deserialize-binary-tree/






Wednesday, September 20, 2017

How to improve programming skills

1. read, write as many lines of code as possible.

www.leetcode.com

http://poj.org/problem?id=2000


www.lintcode.com

http://www.jiuzhang.com/solutions/


http://codeforces.com/




www.github.com


https://projecteuler.net/


2. Do projects

3. study pattern design, objective oriented programming

https://www.youtube.com/watch?v=mym5m-GKG0Q

https://www.youtube.com/watch?v=j9arNRRoPe8

https://www.youtube.com/watch?v=0jjNjXcYmAU

https://www.youtube.com/watch?v=v9ejT8FO-7I

https://www.cp.eng.chula.ac.th/~wiwat/SDD/DP.pdf





4. learn as many as languages as you can , perl, python, java, js, scala, c, sh



places to learn python/pandas



1. Stackoverflow
2. Books: Python for data analysis, Learning the Pandas Library
3. planetpython.org
4. data skeptic podcast,
dataskeptic.com


encode, decode, python

  • Encoded. This is what's stored on disk. To Python, it's a bunch of 0's and 1's that you might treat like ASCII, but it could be anything -- binary data, a JPEG image, whatever. In Python 2.x, this is called a "string" variable. In Python 3.x, it's more accurately called a "bytes" variable.
  • Decoded. This is a string of actual characters. They could be encoded to 8-bit ASCII strings, or it could be encoded to 32-bit Chinese characters. But until it's time to convert to an encoded variable, it's just a Unicode string of characters.




https://stackoverflow.com/questions/5228925/python-string-comparison-problems-with-special-unicode-characters

Friday, September 15, 2017

How to use douban v2 api

make a request sample:


https://api.douban.com/v2/movie/subject/1764796


you will get a json.

Other usage/example:

https://developers.douban.com/wiki/?title=movie_v2






Apai-io php example

Apai-io php example


https://github.com/Exeu/apai-io

<?php
namespace Acme\Demo;

use ApaiIO\Configuration\GenericConfiguration;
use ApaiIO\Operations\Search;
use ApaiIO\ApaiIO;

$conf = new GenericConfiguration();
$client = new \GuzzleHttp\Client();
$request = new \ApaiIO\Request\GuzzleRequest($client);

$conf
    ->setCountry('com')
    ->setAccessKey(AWS_API_KEY)
    ->setSecretKey(AWS_API_SECRET_KEY)
    ->setAssociateTag(AWS_ASSOCIATE_TAG)
    ->setRequest($request);
$apaiIO = new ApaiIO($conf);

$search = new Search();
$search->setCategory('DVD');
$search->setActor('Bruce Willis');
$search->setKeywords('Die Hard');

$formattedResponse = $apaiIO->runOperation($search);

var_dump($formattedResponse);

looking for a man

 I am a mid aged woman. I live in southern california.  I was born in 1980. I do not have any kid. no compliacted dating.  I am looking for ...