27 Ocak 2018 Cumartesi

bash rasbian boring locale warning

to get rid of this warning

run those as root

echo "LC_ALL=en_US.UTF-8" >> /etc/environment
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen en_US.UTF-8

24 Ocak 2018 Çarşamba

django haystack index update only new items

When solr index becomes bigger, update_index is taking some time and in this period search is returning empty resultset to prevent this basicly you only need to include to the index latest modified records in database.

following changes in your model and index structure help you to achieve fast index updates

class MyModel(models.Model):
    user = models.ForeignKey(User)
    modified = models.DateTimeField(auto_now=True) # add this field to your model
class MyModelIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    user = CharField(model_attr='user')

    # add this function to your search_indexes.py
    def get_updated_field(self):
        return "modified"
./manage.py update_index --age=110 
indexing will run only items updated in the last 110 hours.

26 Mayıs 2017 Cuma

setting raspberry pi time from gps

I find this project works perfectly for this purpose


10 Şubat 2017 Cuma

Raspberry pi zero and pi3 gstreamer streaming without latency

pi@raspberrypi:~ $ more stream_working.sh 
raspivid -t 0 -w 1280 -h 720 -fps 30 -vf -b 1700000 -o - | tee YOURFILENAME.h264 | gst-launch-1.0 -v fdsrc ! h264parse config-interval=1 ! rtph264pay ! udpsink host = TARGET_IP(here is my macbook) port= 9000

sertac-MacBook-Air:~ sertac$ more get_stream_working.sh 
gst-launch-1.0 udpsrc port=9000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

here above you can find gstreamer commands to stream live HD video from raspberry pi and save it file at the same time it is working on pi3 almost no latency but pi zero could not be fast enough for this process I saw at least 45 seconds delay

27 Kasım 2016 Pazar

AttributeError: 'Feed' object has no attribute 'contenty_type' (solved)


I had this problem when I try to upgrade my system from django 1.8 to 1.10.3

- response = HttpResponse(content_type=feedgen.mime_type)
+ response = HttpResponse(content_type=feedgen.content_type)

    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File ..../lib/python2.7/site-packages/django/contrib/syndication/views.py", line 43, in __call__
    response = HttpResponse(content_type=feedgen.contenty_type)

AttributeError: 'Feed' object has no attribute 'contenty_type'

mime_type is dead so replace mime_type with content_type in your Feed.py to resolve this issue for django 1.10

21 Kasım 2016 Pazartesi

Ubuntu listing upgradeable packages

apt list --upgradable

Fixing nginx pagespeed cache folder write problem

Fixing nginx pagespeed cache folder write problem


2016/11/21 11:55:03 [error] 1765#0: [ngx_pagespeed] /var/ngx_pagespeed_cache/v3/xxxx.com/https,3A/,2Ffileblabla,.tempT7ZURX:0:opening temp file: No such file or directory


sudo chown -R www-data var/cache/mod_pagespeed