Qifeng Zhou


  • Home

  • About

  • Tags

  • Categories

  • Archives

Web Projects

Posted on 2019-03-28 | In Web Development |

WEB PROJECTS
• Responsive Web Design Projects
Tribute Page https://qifengzhou.github.io/Albrecht-Duerer-Tribute/
Survey Form https://qifengzhou.github.io/Survey-Form/
Product Landing Page https://qifengzhou.github.io/Product-Landing-Page/
Technical Document Page https://qifengzhou.github.io/Technical-Documentation-Page/
Personal Portfolio https://qifengzhou.github.io/Personal-Portofolio/

• JavaScript Algorithms and Data Structures Projects
https://github.com/qifengzhou/freeCodeCamp-JavaScript-Algorithms-and-Data-Structures-Projects

• Front End Libraries Projects
Random Quote Machine https://github.com/qifengzhou/Random-Quote-Machine

JavaScript is not working on Github Pages

Posted on 2019-03-18 | In Web Development |

I was developing some web projects on codepen.io, as parts of the freeCodeCamp full-stack web development certification. codepen is fine, but I want to take the onwership of my project and make it personal. Thanks to Github Pages, you can deploy web pages for free. In my ‘Random quote machine’ project. It draws a random quote when loaded, and if you click the ‘new quote’ button. It is working well on codepen, so the problem should be compatibility of jQuery and Github Pages.

The layout and appearance was developed by HTML and CSS, they should be fine. The deployed Github Pages was displayed normal, except no quote!! That part was controled by JavaScript, to make the webpage responsive and much fun to interact. To make things simpler (or complicated?), I used jQuery, a JavaScript library for DOM handling.

Now thing getting routine, just search the problem. The seperate closing tag is not the case as I have it. Someone suggest the problem might come from the serving of jQuery with ‘HTTP’, on Github Pages it prefers ‘HTTPS’, which is a safer option. Changing ‘HTTP’ to ‘HTTPS’ sovled the problem. Now my ‘Random Quote Machine’ is working, like a charm. You can find it at https://qifengzhou.github.io/Random-Quote-Machine/

Upload files bigger than 25 MB to Github

Posted on 2018-04-29 | In Git |

Github has a uploading limit for 25 MB. If you use the browser mode for uploading.

One solution for this will be using Git LFS.

  1. let’s install Git lfs:
    I assume you have Homebrew installed. Open the terminal and execute.

    1
    brew install git-lfs
  2. Set up Git LFS in Git, you only have to do it once.

    1
    git lfs install
  3. Specify the file type you want to upload. If you want to upload a .mp4 file, as an example.

    1
    git lfs track "*.mp4"
  4. Add the file type to .gitattributes, so it will remember this file type, for next time uploading the same type of files you don’t have to do this step again.

    1
    git add .gitattributes
  5. Open the directory of the project in the terminal.

    1
    cd the path of the directory
  6. Creat a new repository on Github. Do not add README or gitignore.

  7. Initilize the directory as a Git reposity.

    1
    git init
  8. Add the file you want to upload from the directory.

    1
    git add test.mp4
  9. Commit the files in the local repository.

    1
    git commit -m "Upload video"
  10. Copy the URL of the remote repository, its at the top of the repository you set up at step 5.

  11. Set the repository as origin.

    1
    2
    3
    4
    5
    git remote add origin *remote repository URL*

    # Confirm the origin.

    git remote -v
  12. Push the changes in the local repository to Github.

    1
    git push -u origin master

When you have a url error, normally its the wrong url as origin.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Show the current remotes
git remote -v

# Something showing up
origin https://github.com/OWNER/REPOSITORY.git (fetch)
origin https://github.com/OWNER/REPOSITORY.git (push)

# Remove them by
git remote rm origin

# Verify remote
git remote -v

# Set the new remote by following step 11

If you have problems, feel free to comment.

Uploading big docs onto AWS

Posted on 2018-04-20 | In Cloud |

AWS has a limit for uploading docs bigger than 25 MB, the same as GitHub. Machine learning tasks for computer vision will easily have bigger data sets than this. After researching on the web, I found this option is quite good. Using FileZilla will make the life a lot easier.

First you need to download and install FileZilla. Afterwards following the best answer on Connect to Amazon EC2 file directory using Filezilla and SFTP on StackOverflow. For AWS EC2 instances you should choose ‘ubuntu’ as the ‘user’ instead of ‘ec2-user’. Now connect the SFTP site you set with the EC2 instance. When the connection is successful, browse the left side to the source and the right side to the target directory. You can easily pull the docs from the site just established to the EC2 instance.

If you encounter with ‘permission denied’ warning message.
Following the answer on Stackoverflow Amazon Ec2 FTP Write Permission [closed]
In brief, it works like this:
Open up your terminal, execute ‘sudo -s’. This command give you right as root user.
Give write permission to all users by executing ‘chmod 777 /the path you want to write/‘
Now you can pull the files to EC2 instance.

Have fun!

Enable both Python 2 and Python 3 in Jupyter Notebook

Posted on 2018-04-01 | In Python 3 |

Creating the working environment on the machine can be painful. I am using Homebrew for python packages management, it works great. The cons are Homebrew takes over the PATH, the directory which the computer reads and writes docs. Through its possible to change the PATH but not that straightforward.

Python 2 will not be maintained soon. The future is Python 3. But sometimes you will need to work in Python 2, as needed. Or the legacy codes were written in Python 2 and its too costly for you to move to Python 3. Meanwhile most of the packages went to Python 3 but some are still in Python 2. At the moment its nice to have both.

I have both Python 2 and Python 3 installed. But when I call Jupyter Notebook only Python 2 can be launched. I tried few things untill I found this post on Stackoverflow Using both Python 2.x and Python 3.x in IPython Notebook

A person wanted use Python 2 and Python 3 in the notebook. I tried one of the answers by the user “lsh”

If you?re running Jupyter on Python 3, you can set up a Python 2 kernel like this:

python2 -m pip install ipykernel

python2 -m ipykernel install –user
http://ipython.readthedocs.io/en/stable/install/kernel_install.html

I have Python 2 and what I wanted is Python 3, so I changed “python2” into “python3” in both commands and executed them in the terminal. When I launch Jupyter Notebook, I can choose Python 2 or Python 3.

fanyir: a R tool translates text from German to English and produces a PDF

Posted on 2018-01-07 | In Projects |

A German learner, myself. Often annoyed that I have always to look for in dictionary like Google Translator or Linguee for the words in German for their English meanings. Next time I have do that again if I don’t remember the meaning, and again until I keep it in my memory.

I started to my note on a notebook manually, its slow and painful. I need to type the words in the translator and when it gets something, write it down on my notebook. Why not automate this?

Google this for the possibilities in R. I found R package “translateR”, it can read words or text from a dataframe and append the translatedContent. Perfect for me!

Uhmm.. Spend a night I realized its not working for me, I don’t see the translated contents at all. Tried all the methods, with very few irrelevent quesntions found on Stakoverflow. And opend a issue on the ‘translateR’ GitHub repository. Can’t wait, I decided to move on to other solutions.

The ‘translate’ package popped up. The difference is ‘translate’ translates one cell at a time, and I need the whole column to be translated and appended, the function like in ‘translateR’.

At least the ‘translate’ works for me. I wrote a function to have the same function as I wanted in ‘transalteR’, fanyir here we go. Give it a .xlsx file, it can translate and produce PDF.

To use it by yourself, you can read the instructions at the repository at GitHub https://github.com/qifengzhou/fanyir

Qifeng Zhou

Data science and machine learning

6 posts
5 categories
8 tags
GitHub E-Mail Linkedin
© 2019 Qifeng Zhou
Powered by Hexo
|
Theme — NexT.Muse v6.0.0