Trying JSON in Django and PostgreSQL (and compare with MongoDB)

class Product(models.Model):
    name = models.CharField(max_length=100)
    category = models.ForeignKey(Category)
    price = models.IntegerField()
    attributes = JSONField()

    def __str__(self):
        return self.name

 

Product.objects.create(name='Bamboo tshirt', category=tshirt, price=120, attributes={
    'colors': ['white', 'yellow'],
    'sizes': ['M', 'L', 'XL'],
    'model': 'poet',
    'material': 'bamboo',
})

 

Use inotifywait to move file when it loads in dropbox folder

I’m trying to find a way to immediately move a file to another folder as soon as it appears in my dropbox on CentOS.

<span class="com">#!/usr/bin/env bash</span><span class="pln">

dir</span><span class="pun">=/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">ortix</span><span class="pun">/</span><span class="typ">Dropbox</span><span class="pun">/</span><span class="pln">new</span><span class="pun">/</span><span class="pln">
target</span><span class="pun">=/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">ortix</span><span class="pun">/</span><span class="pln">movedfiles</span><span class="pun">/</span><span class="pln">

inotifywait </span><span class="pun">-</span><span class="pln">m </span><span class="str">"$dir"</span> <span class="pun">--</span><span class="pln">format </span><span class="str">'%w%f'</span> <span class="pun">-</span><span class="pln">e create </span><span class="pun">|</span>
    <span class="kwd">while</span><span class="pln"> read file</span><span class="pun">;</span> <span class="kwd">do</span><span class="pln">
        mv </span><span class="str">"$file"</span> <span class="str">"$target"</span>
    <span class="kwd">done</span>

PhantomJS

PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

PhantomJS is an optimal solution for:

HEADLESS WEBSITE TESTING
Run functional tests with frameworks such as Jasmine, QUnit, Mocha, Capybara, WebDriver, and many others. Learn more

SCREEN CAPTURE
Programmatically capture web contents, including SVG and Canvas. Create web site screenshots with thumbnail preview. Learn more

PAGE AUTOMATION
Access and manipulate webpages with the standard DOM API, or with usual libraries like jQuery.
Learn more

NETWORK MONITORING
Monitor page loading and export as standard HAR files. Automate performance analysis using YSlow and Jenkins. Learn more