ezoic

Tuesday, May 31, 2016

Searching tips on google

If you want to search for something like 'configure R and perl on Atom', instead of only searching the string, if you search 'configure R and perl on Atom blogger.com' or 'configure R and perl on Atom blogspot.com', you will find something interesting.

You can search "Credit Risk SAS code github" . Just some content you want to search + website which might have it.

A wonderful SAS, R statistical blog


Found it through google, it is wonderful, having some examples on simulations etc. It is about R and SAS etc:


http://sas-and-r.blogspot.com/


To run a PHP embedded html file

To run a PHP embedded html file, you can write something like this in Atom:







Save it as a .php file, and use the shortcut 'Alt R' in Atom on windows to run the file, you will see:


How to set up a website using PHP amd MySQL


How to set up a website using PHP and MySQL, here is an article:



https://www.sitepoint.com/php-amp-mysql-1-installation/

Here is a bigger pic:

https://www.sitepoint.com/php-mysql-tutorial-2/


And the book:

http://www.amazon.com/Build-Database-Driven-Using-MySQL/dp/0980576814?ie=UTF8&keywords=database%20driven%20website%20php%20mysql&qid=1464738406&ref_=sr_1_2&sr=8-2





Here is a video:


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









This PHP tutorial is informative and concise

This PHP tutorial is informative and concise:



http://dashmeshedu.com/uploads/docNotice134.pdf


Only 28 pages. 





How I learned PHP or a new language after I have mastered one

I studied my first computer language (C) from undergraduate.  Then in graduate school, I learned Python, R etc by myself.

So, I mastered Python and R, got to know for basic usage of a language, I need to know hash table, loops, conditions  these things, and apply them to real world.

And then in my life, I need to learn PHP, so I started to learn PHP.

There are some good books on PHP, like this:

http://www.amazon.com/Learning-PHP-MySQL-JavaScript-Javascript/dp/1491918667/ref=sr_1_3?s=books&ie=UTF8&qid=1464735206&sr=1-3&keywords=php+and+mysql+web+development


And the book is thick, to finish it, takes time.

So, I read some tutorial, here are some tutorials I read:

 http://www.tutorialspoint.com/php/php_tutorial.pdf

http://prodevapp.com/ArmyPublicRelation/pdf/royalthaiarmynews/news_20141103173559.pdf

http://dashmeshedu.com/uploads/docNotice134.pdf

http://www.killerphp.com/downloads/object-oriented-php/downloads/oop_in_php_tutorial.pdf

http://www.cte.bilkent.edu.tr/~cte301/PHP_Notes_01.pdf

http://6.470.scripts.mit.edu/2012/assets/resources/php_ppt.pdf









Since, I know the languages' layout etc, I know what to learn for a new language, like how they use the loops, conditions, etc. Then I learned most of things about a programming language. But the book is still worth buying, you can systematically learn a programming language from a book. 






How to write a html script in Atom

To write a html script in Atom is simple.

You just write some .html file in Atom, and save it somewhere, like naming it html1.html







And you go to open the file in your computer and the webpage shows:






Sometimes,  you can go to "start" on windows and type the name of the file and find and run it.






But you can not run a php file inside html like this:

If you open your html file with the above content, you will get nothing.


Here is the explanation:



http://stackoverflow.com/questions/22853669/how-to-run-a-php-script-inside-a-html-file







Thursday, May 26, 2016

Configure R and Perl on Atom

See the configuration text for R and Perl on Atom.

How to configure PHP in atom-runner

Previously, I wanted to install "script" on Atom to run PHP. And there was some problem, like the firewall. So I tried atom-runner. It is easier to install, no firewall problem. So, I used atom-runner.

Atom-runner is a package in Atom. It can run JavaScript, CoffeeScript, Ruby, and Python, and you can add more.  And here is a page for it:

https://github.com/lsegal/atom-runner

To configure something on atom-runner, you need to add the configuration to ~/.atom/config.cson:





 

So to configure PHP, first download PHP and unzip it, and save it to some directory:


http://windows.php.net/download/


Use the 'zip' file. 




And I did something on my atom:





And when I ran my php file on Atom, I got an error:






And I deleted the '-file' on my configuration file to this:





And I ran the file, it worked:






Wednesday, May 25, 2016

One of the best free IDE/programming text editors that I found

I once needed to run some PHP script at work. And I tried to find a free and good PHP IDE. And it is difficult.

So someone suggested Atom.

And I studied it. It is awesome. It is free. It is built on github.

To use Atom on linux is straightforward, follow the steps:

https://codeforgeek.com/2014/09/install-atom-editor-ubuntu-14-04/

And to install Atom on windows is a little bit troublesome. You first need to install github on windows:

windows.github.com

And then install Atom:

https://atom.io/


To run PHP script on Atom, here is a how on youtube:

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

So you need to install the Atom package "script".

But to install the Atom package "script" on windows is troublesome, especially your PC has a firewall etc, otherwise, you will get npm error. I have not resolved my problem.

There are some other package in Atom which can run the script, like atom-runner. But atom-runner can not run PHP file. 

Here is a good video on how to use Atom:

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


Here is an interesting Atom windows video:

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







Friday, May 20, 2016

Python code to query all newly added videos.


BrowseNode='3003959011'



import argparse
import bottlenose
from xml.dom import minidom as xml
import amazonproduct
from urlparse import urlparse
config = {
    'access_key': 'XXX',
    'secret_key': 'XXX',
    'associate_tag': 'XXX',
    'locale':'us'
}






bb=[]
api = amazonproduct.API(cfg=config)
results1=api.item_search('Video',BrowseNode='3003959011',SearchIndex='Video',ResponseGroup='ItemAttributes')
for thing in results1:
        
         aa=thing.DetailPageURL
         asin=thing.ASIN
         title=thing.ItemAttributes.Title
        
         url=str(aa)
         aa=url.split('/')

       
         uuu=[url, asin, aa[3],title]
         print uuu

Thursday, May 19, 2016

One amazon web scraping script


using the following script to do the web scarper on Amazon.com:

import requests
import re
url='http://www.amazon.com/s?keywords=new+girl+season+5+amazon+video+'
htmltext=requests.get(url).content
pattern=re.compile(r"http://www.amazon.com/.*/dp/(.*?)\"")
re.findall(pattern,htmltext)

And it works, giving the following ASIN numbers:

['B019DA0TTY',
 'B01EG3ZQG4',
 'B003NS4Q6U',
 'B00J1ZOMQ8',
 'B014DT715A',
 'B00F2CFT02',
 'B017WUJVE6',
 'B005GC8D6U',
 'B002PHLFEG',
 'B00NGYMN3O',
 'B00AWMINLY',
 'B003FOFJAY',
 'B0095NWC36',
 'B005JR3Y5W',
 'B017UGXPG2',
 'B005D643PO',
 'B005D67NTC#customerReviews']
 
First one is what we want.  

Wednesday, May 18, 2016

A python regular expression matching number group

aa='Wicked Tuna SSN 5  NGG'
aa=re.sub(r'NGC','',aa)
aa=re.sub(r'NGG','',aa)
match1=re.match(r'(.*) SSN (\d+)',aa)
match2=re.match(r'(.*) S(\d+)', aa)
if match1:
        aa=match1.group(1)+' '+'Season'+' '+match1.group(2)
 
if match2:
        aa=match2.group(1)+' '+'Season'+' '+match2.group(2)
print aa

Returned value:

Wicked Tuna Season 5

Tuesday, May 17, 2016

How I learned programming.

I was not CS major when I was in college. I studied science. And there was some programming during my study.

So I decided to learn some programming myself.

I found this book on amazon.com  was helpful:

http://www.amazon.com/Structures-Algorithms-Python-Michael-Goodrich/dp/1118290275/ref=sr_1_sc_2?ie=UTF8&qid=1463509016&sr=8-2-spell&keywords=python+data+strudtures+and+algorithms


The key for me is to study the theory and practice.  You must do the two things simultaneously.  If after you study the theory, you still can not get it, pick some exercises in the book, and practice, you will suddenly see the light. 

One class which can make your programming more efficient

Recommending this class

https://www.coursera.org/course/algo

https://www.coursera.org/course/algo2

A post about python loop

http://www.dotnetperls.com/while-python


python's indent loop

 we have a file:


Title

Avatar
500 days of summer


etc

And for the following program, because, each title has multiple amazon outputs, and we only need the top one, so we used a counter ww,  if  ww==1, we print the  top 1 result.


import argparse
import bottlenose
from xml.dom import minidom as xml
import amazonproduct
from urlparse import urlparse
config = {
    'access_key': 'XXX',
    'secret_key': 'XXX',
    'associate_tag': 'XXX',
    'locale':'us'
}


b1=[]
with open("C:/Users/XXX/Desktop/CVA v4.txt","rb") as k:
             for row in k:
                row=row.strip()
                row=row.split("\t")
                b1.append(row)

k.close()

api = amazonproduct.API(cfg=config)




bb=[]


for i in range(len(b1)):
   
    if b1[i][2]!='':
     ww=0
     results1=api.item_search('Movies',Title=b1[i][2], BrowseNodes='2676882011' )
     for thing in results1:
         ww=ww+1
         aa=thing.DetailPageURL
         asin=thing.ASIN

         url=str(aa)
         if ww==1:
           print asin, url, ww
      


Friday, May 13, 2016

API for different platforms

There are top 12 platforms we want to study:

Apple iTunes
Google Play
Amazon
Comcast
Sony Playstation
Directv
Verizon
VUDU
Xbox
AT & T U-Verse
Time Warner
Dish


And I tried to find the search API for all the platforms:

And the results are:

Apple iTunes:

use the command line to install Apple iTunes:

!pip install https://pypi.python.org/packages/source/p/python-itunes/python-itunes.tar.gz

And the python code for query:


And the apple affiliate ID is not necessary. You still can get searching results even without affiliate ID.

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 ...