ezoic

Friday, April 29, 2016

How I got my first Amazon advertising api search

How I got my first Amazon advertising api search.

It is not very easy.

You need to get, access_key,  secret_key,  associate_tag.



And especially, your access_key need to register with Amazon advertising api. Otherwise, you will get one  error, saying your account need to register with Amazon advertising api.

To do this, you first register on:

https://affiliate-program.amazon.com/

And you will get the associate_tag which is on the right upper corner of your sign-in page. There is a word 'Store' besides the associate_tag. 

And then under 'tools' tab:


select product advertising API. And you go to a new page:

Click  'sign up now'. And you are there.

And to get the access_key and secret_key, log into the following page:


https://aws.amazon.com/console/

There is a 'secret credentials' on your name. And you click it, go to a page like this:





And you can generate Access key and secret Access key. The system will generate a txt file which contains your keys. Sometimes, you need to delete some old keys to generate new keys.




At beginning, I continuously got error on chrome Restful app.

Then, I use python amazon searching api on Jupyter, I got



I got the results. 

Here is the doc on this api:


And this page shows which item it can return. 


And here is a good book talking about this project. It is called Python Network Programming Cookbook. You can buy it on Amazon.com. 


 





How to install python zip package on windows

Sometimes, when we try to install zip python package on windows using 'python setup.py install'  on cmd, we got the following error:







One way to solve it is to install python package using pip on Anaconda.

First install/upgrade Anaconda using the following cheatsheet:

http://conda.pydata.org/docs/using/cheatsheet.html

I mainly used on cmd:

conda info
conda update conda
conda update anaconda

And my Anaconda was upgraded to Jupyter:





For example, I want to install bottlenose, it does not have exe file for installing, I typed the following on Jupyter:

And I got it.







Wednesday, April 27, 2016

Netezza SQL, substr, instr usage.

In SQl, one way to manipulate the string is to extract some data from the strings based on some patterns. 

An example, we have strings, TOM-XYZ12356-DIM34345-TE123456 or TOM-XYZR3455667AB-RXB75855-RYB434553.  main focus is to  extract  the string between the 1st and the 2nd '-'.

use INSTR to provide the start character after the first '-', and then calculate the SUBSTR length by substracting the position of the first '-' from the position of the second '-'.

SELECT SUBSTR(col1, instr(col1,'-',1,1)+1 , 
instr(col1,'-',1,2) - instr(col1,'-',1,1) -1 )
FROM tableA; 
 
If we want to get the string before the first '-', the query will be:
 
SELECT SUBSTR(col1,1,  instr(col1,'-',1,1)-1 ) FROM tableA;  
 

Tuesday, April 12, 2016

Best tools to debug python script

Best tools to debug python script is Pycharm and Spyder.

Pycharm is in JetBrains

Spyder is in  Anaconda

Place to download Pycharm:

https://www.jetbrains.com/pycharm/download/#section=windows

Place to download Spyder:

https://www.continuum.io/downloads

My experience is that Pycharm is better than Spyder. If there is any tiny problem wrong with your script, there will be a red line under the title of the script, and there will be a red line where the problem exists.

Thursday, April 7, 2016

One way to install linux on your pc without a disk

The official way to install linux on PC is to use an installing disk, like a CD.

I found a way to install it without a disk, but a USB:

https://builtvisible.com/the-ubuntu-installation-guide/#Install-from-USB

It can help you to install the ubuntu on your computer properly.


One way to deal with the csv file " comma inside quotes" problem.

Sometimes, we got some annoying csv files, they are not properly delimited. When we open it, we saw the "," showing in the file together with the text. And when we try to open it through excel, it won't work either.

One way to deal with this kind of csv file, is:

1. download the csv file, but do not touch it, like opening it or something.
2. change the file name ".csv" to ".txt" without opening it.
3. open an excel, and use "open file" inside the excel to open the file, step by step, use delimiter as "comma". and use the Text_Qualifier field in your Flat file connection manager to as ". This should wrap your data in quotes and only separate by commas which are outside the quotes.

The data looks like below:


 The step to open the new txt file:


looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...