Delanover

    Personal Blog

    Artículos publicados por lipman

    After my screen mysteriously stopped working properly, I brought my computer to the shop where I bought it and Lenovo replaced my screen successfully without any extra cost (except for the fact that I had to go to other country twice). Well, for some reason, they thought it would be a good idea to format my PC that previously had Windows and Ubuntu, but even if the Ubuntu partitio was there, I couldn’t access. Anyway, I decided that it was a good idea to format Ubuntu, but it was not as straightforward as I would had liked and I read about many different solutions, so I will just write mine and hopefully it will be useful to someone.

    Step 1: Create a bootable USB choosing “GPT partition scheme for UEFI”. I used the Ubuntu 16.04.2 LTS amd64 iso.

    Step 2: Go to the BIOS screen (press F2 very fast when booting) and go to “Boot”. Boot mode: UEFI. Fast boot: Disabled. USB Boot: Enabled. Go to “Security”. Secure Boot: Disabled.

    Step 3: Reboot the computer with the USB plugged in. If you can’t boot from the USB go to the BIOS and on “Boot”, EFI section, move the USB up to be the first one to boot. If not, it might not boot and might boot Windows instead (this happened to me all the time).

    Step 4: Install Ubuntu and enjoy.

    Long ago, around 4 years ago already, I implemented a Twitter Fingerprinting tool in PHP that was available for everybody which unfortunately stopped working when the API changed. I was really excited because I could also help the Spanish police with another version of this online tool.

    Recently, I decided to implement something similar in Python, but with a considerable difference: not using the Twitter API. There are many reasons:

    • Due to the own Twitter API limitation, you cannot use the application intensively. I do not know the limit nowadays, but long ago it was around 150 requests per hour and IP.
    • I do not usually like that the guys of Twitter know what I am doing with the API.
    • If you use the API, you have to make an account, and use certain credentials. Some people may not like this.
    • Less flexibility. With the API you only can do what you can only do. Obviously.

    On the other hand, the basic disadvantage of not using the API and parsing code with regexps directly is that a small change in their website will make the code not work properly.

    After saying this, here is the Github link of this small library where you can find more information.

    An example of how to use it:

    Get all the images uploaded from a specific user:

    from TwitterFingerprint import TwitterFingerprint
    tw = TwitterFingerprint("google")
    tw.obtainLastTweets() # Get all tweets
    tw.getPicturesLinks(savePath="images/",includeRTs=0)

    Get the language, hashtags, and text (tweet) of the last 30 tweets:

    from TwitterFingerprint import TwitterFingerprint
    tw = TwitterFingerprint("google")
    tw.obtainLastTweets(limit=30,verbose=False)
    for tweet in tw.tweets:
    	print(tweet["lang"],tweet["hashtags"],tweet["text"])

    Get three histograms (months, weekdays, hours) of the last 500 tweets. Interesting when analyzing when someone is using Twitter.

    from TwitterFingerprint import TwitterFingerprint
    tw = TwitterFingerprint("google")
    tw.obtainLastTweets(limit=500)
    [histMonths,histWeekdays,histHours] = tw.getHistograms()

    As a Japanese language learner, any tool that makes this difficult journey easier is always welcome. I do not want to debate anything about the learning process, so I will just say that, as with any other language, the “reading” skill is very useful as a proof of understanding both grammar and vocabulary. For this reason, everyday I have to say “thank you” for the guys of NHK Web Easy, who upload news in very simple Japanese (the grammar is very simple, the vocabulary is something around “medium level”).

    When I go to the university I always read on the metro as many news as I can, but very often I have to switch back to my dictionary because I do not have certain words in my vocabulary. This event makes the reading task more difficult because during the “long” process of memorizing the word (reading+writting), minimizing the browser, opening the dictionary, writting the word and understanding it, I usually forgot what I was reading before. And it is not a matter of memory. When you are reading in a language you are not good at, it is extremely difficult to keep track of everything, especially in Japanese where the grammar is absolutely different from any European language (even more different than Finnish).

    Therefore, I decided to make a tool to avoid all those previously mentioned steps (except for the “understanding part” of course). This tool allows me to read very fast and make the reading way more pleasant. I called this tool “NHK Reader” and, in a few words, is a language parser tool.

    Steps:

    1. Takes the text from the news
    2. Uses jisho.org to separate the words (POS tagging)
    3. Uses jisho.org to get the meanings of the words
    4. Pastes that into the webpage (using jQuery)

    POS tagging is not something easy, so it does not detects all words correctly and, sadly, I cannot do anything about that since I take the output from jisho.org

    A couple of screenshots

    GHJWAXNq YYX98bS3

    This tool is parsing directly from jisho and nhk, so the regular expressions are hardcoded and it might fail if the owners decide to change the HTML code, but it should not be difficult to fix.

    The code will be available on my github when the version 1.0 is ready.

    My computer:
    Windows 10, Python 3.4, OpenCV 3.0.0

    I had uncountable desperate attempts to install OpenCV 3.0 in my machine, including the always last plan when installing software: building it from the source. There is an apparently nice tutorial from the official OpenCV webpage which didn’t work for me because I needed to do a couple of steps, so please, try to follow this tutorial (section Building OpenCV from source) with this addition tips:

    • 7.2: Use the path you want, but remember that you will not be able to delete it (because you need to refer to that path) so choose wisely.
    • 7.4: You can use any Visual Studio. In fact, I used Visual Studio 13. Just remember to specify it when configuring CMake
    • 8,9,10,11: When you are checking and unchecking all those checkboxes you will realize that many of the options are not listed on the provided pictures. What to do in that case? Easy: just leave it there as it is.
    • 16: Some of the projects will not be built and will be skipped. Don’t worry.

    Now, it’s supposed to be installed in your computer, and if you try to import cv2, it should work.
    However, at least for me, it didn’t work. The final step to get rid of that annoying message is to add the appropiate path to the PATH system variable. This is the path that you have to add: X\bin\Release where X is the folder where you compiled it.

    I hope this is helpful. This could have saved me many hours…

    I temporaly decided to stop writing about general stuff and focus on Artificial Intelligence. Because of this, I opened a new WordPress blog in a subdomain of mine –> http://laid.delanover.com.

    Neural Networks, Image Processing, [Un]supervised learning, and so on. I also decided to share every piece of code uploading it to my personal github repositories which can be found in the new blog.