Delete Index With PyArango

I am using Python to create some background services and web service in the office. For the database, we are using Arangodb for our main database, so we use PyArango to connect to the database. At a time, I need to delete index in the database collection, but I cannot find any example related to index deletion. So after reading the code and API documentation, I will share the example here. ...

December 12, 2018

Removing Stop Words

I have a task to do word counting for some articles. The detail of the task is getting the list of id from Elasticsearch, get the content from ArangoDB, then do some text processing to clean the content and counting the word frequency. After did it with Scala, Go, and Python, I found out that it is very slow when I am doing it with Python. Doing it with Scala and Go only take around 3-4 seconds to process 12,563 articles. But when we do with Python, it takes around 15-18 seconds. And after do some profiling, finally I found out that it is very slow to remove any stopwords from big number of articles. I am using common method in Python to remove the stopwords. ...

October 20, 2018

Tensorflow GPU Memory Usage (Using Keras)

I am using Keras with Tensorflow backend for my project. In the beginning, when using Tensorflow backend, I am a bit surprised when seeing the memory usage. Although my model size is not more than 10 MB, It is still using all of my GPU memory. After reading tensorflow documentation, I found out, that by default, TensorFlow maps nearly all of the GPU memory. The purpose is to reduce the memory fragmentation. And also, from the documentation, I know there are two different approaches that can be used to handle this situation. ...

July 13, 2018

Syntaxnet with GPU Support

After compiling Syntaxnet (old version with bazel 0.5.x) with GPU support, you will find this error message. E tensorflow/stream_executor/cuda/cuda_driver.cc:965] failed to allocate xxxG (xxxxxxx bytes) from device: CUDA_ERROR_OUT_OF_MEMORY E tensorflow/stream_executor/cuda/cuda_driver.cc:965] failed to allocate xxxG (xxxxxxx bytes) from device: CUDA_ERROR_OUT_OF_MEMORY No, no. It is not because your GPU memory is not enough. It is because sometimes tensorflow eats all of your GPU memory. So, what do you have to do? You just have to modify the main function of this file. ...

May 20, 2018

Toml Config Value by Name (Go)

I use https://github.com/BurntSushi/toml for parsing the configuration file. Because the library use the struct type for the configuration variable, we have to access the struct fields with a dot to get a value. [code]config.Database.Username[/code] But I want to do it dynamically. I want to create a function that receive a string type key and return the configuration value. So I do it with this way. [code]package main import ( “fmt” “os” “reflect” “strings” “github.com/BurntSushi/toml” ) ...

January 20, 2018

Gin Memcached Middleware

If you are using gin to build a webservice, and you want to use memcached to store your data, you will search some articles about how to create a middleware to do that. After read some articles, I only found this middleware. But I got no luck. I cannot get a value from a key on one endpoint after I set it on another endpoint. So I didn’t use gin session and create my own middleware with gomemcache. ...

December 6, 2017

Gogstash - Logstash Alternative

I am now doing some projects that need a monitoring application to monitor the webservice. After having some chit and chat, we decide to use ELK (Elasticsearch, Logstash, and Kibana). If you want to know what ELK is, just search on Google and there will be so many articles related to it. If you have already read some articles about ELK, you will know that ELK is the application to monitor and analyze all types of log. ...

December 5, 2017

Ebean Partial Column Selection

Okay, because of some reasons, I have to learn Java and choose a Java web framework for my next project. After seeing around, I choose playframework, and I am using MySQL for the database. After reading some documentation, I use Evolution and Ebean for the ORM. And then I found a problem when using Ebean. It still returning all columns although I selected some columns with this method based on this documentation. List<MyModel> getUser = MyModel.find.select("columnA, columnB").findList() ...

November 9, 2015

Compiling fprynt in Linux Mint 17.1 64bit

Hi, If you are using Linux Mint 17.1 64bit and you want to compile this fprynt library, please open the CMakeLists.txt file and find these lines. target_link_libraries(fprynt /usr/lib/libboost_python.so) target_link_libraries(fprynt /usr/lib/libpython2.7.so) target_link_libraries(fprynt /usr/local/lib/libfprint.so) And change the library path. target_link_libraries(fprynt /usr/lib/x86_64-linux-gnu/libboost_python.so) target_link_libraries(fprynt /usr/lib/x86_64-linux-gnu/libpython2.7.so) target_link_libraries(fprynt /usr/lib/libfprint.so) But before doing this, please make sure that the library are exist.

October 24, 2015

Phalcon Framework and Volt Templating

Why Phalcon? Yes, because it’s fast and light. But please remember, when you are using volt templating, you will find the problem when you want to add the attributes inside the textField() tag. When you are not using volt, it should be like this. echo $this->tag->textField(array("name", "class"=>"tes")); But when you are using volt, from the documentation, you have to do like this. {{ textField("name", "class":"tes") }} But you will see this error. Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /var/www/phalcon/cache/volt/%%var%%www%%phalcon%%app%%views%%signup%%index.volt.php on line 7 ...

September 23, 2015