C

Bitwise operation

Initialize char with zeros

Align bits from the right

Shift bits to the left

Extract bits using bit mask

   

C++

fscanf problems with double

Trying to get input from the FILE* stream with image processing filter.   Example One:   Sample input (.txt)

Code snippet for scanning the double

Setting breakpoint in visual studio 2017, the filter.m returns set of values as the following

Which the first value, 0.7, wrongly being scanned as 0.69999999999999996.   Example Two:   Sample input (.txt)

Continue Reading

Algorithms, C++, std

std::map

Simple insert

  Access to second element using key (C++ 11)

  Iterate

  Find element

 

std

std::set

Simple insert

  Quick match

  Store search result

  Check if duplicate insert

 

Discovery, MS Office, Python

SharePoint URL study

For each SharePoint URL, the pattern can be observed as:

  Root folder is encoded with HTML (%2F), which is /

  FolderCTID is digits of length 38, i.e. 0x { 38 digits }   The View is also encoded with HTML (%7B), which is { (%7D), which is } The format of digits length will be { 8 –…

Continue Reading

MS Office, Python

Pyexcelerate write file

 

Selenium

Vimeo fetching video title

  Login

  Check if xpath exist in current page

  Load all the components (3s pause by default for loading)

  The format of video title will be (XPATH)  

  Fetch all the video titles

 

Python

PyCharm setup scrapy (updated: Dec 2018)

Setup of PyCharm 2018   Download the .tar.gz from the official website   Download PyCharm from official link and unzip it

  Remove the old zip file and move the folder to /opt/

  Create symbolic link for PyCharm for bash

  Execute PyCharm

    Scrapy basic setup Install using pip

  Make the demo…

Continue Reading

Linux, Python, Windows

Scrapy setup

Start a scrapy project at current directory

  File structure

  Set up the first spider file (tutorial/tutorial/spiders/quotes_spider.py)

 

Linux, Python, Windows

Scrapy (web crawling) installation [Windows / Kali Linx]

For Python 2.7 / 3.3+ Windows Install scrapy using pip

    Kali Linux Since I have both of the Python 2.7 (python) and 3.5.3+ (python3) installed, in order to install the scrapy on python3: Install the pip3 for python3, instead of using pip for old python

  Try install scrapy using pip3

  However, the dependency…

Continue Reading