Share experiences.

January 15, 2012

find . -name ‘*.py’ | xargs rm

Filed under: Uncategorized — Darek @ 5:54 am

Trying to remove any doubt which Django Python code I’m using I wrote:

find . -name ‘*.py’ | xargs rm

And as the result I lost all python source files from current directory and all directories below.

I should use:

find . -name ‘*.pyc’ | xargs rm

One small ‘c’ letter makes the difference between intended removal of compiled Python code
and the removal all source Python files in current directory and all directories inside it.

The lesson is to think before pressing enter one might think.

Well, it is one of lessons but there is more here.

I’ve restored all lost files using mercurial.

February 19, 2011

Debugging init scripts: set -x

Filed under: Uncategorized — Darek @ 2:30 pm

Init script does not behave correctly. How to debug init script?

Use set -x right after #!/bin/sh in init script.

From man set:

-x

The shell shall write to standard error a trace for each command
after it expands the command and before it executes  it.  It  is
unspecified  whether  the  command  that  turns  tracing  off is
traced.

December 9, 2010

New security requirements for industrial control systems

Filed under: Uncategorized — admin @ 3:13 pm

The times had changed. We live in the future now.

Are you responsible for running of the industrial plant?

So read, please, about security of industrial control systems in post Stuxnet world.

August 20, 2010

Webapps and static html pages – friends or enemies?

Filed under: Uncategorized — admin @ 4:48 pm

Is the clash of the rich internet applications and static html pages unevitable?

It depends on the main function of the page or web application. If main purpose is one way communication aimed at delivering content then there is little point in using excessive amounts of javascript. If, on the other hand, there is two way interaction between the man and machine one should consider using web applictaion techniques.

So it looks like the initial question is flawed.

There is a place for mainly static web page and for web application.

More, there are instances where both approaches can be mixed. Pipe liquid flow speed calculator is one of them.

June 1, 2008

Mysql gui data editing

Filed under: Uncategorized — admin @ 2:43 pm

To edit mysql table data (not table definition but data stored in the table) using

mysql-administrator (part of mysql-gui-tools) one has to install

mysql-query-browser package.

Strange?

For me – yes.

November 2, 2007

What “fuzzy” means – python, django, gettext.

Filed under: Uncategorized — Tags: , — foramber @ 10:44 am

A django application is in process of adding support for second language. During adding translations to the django.po file after next .po file compilation some of previously translated texts were displayed on target site in their original, untranslated form.

Afert usual digging in google’s search results the answer was found: a “#, fuzzy” flag was responsible for not translating my strings.

Fuzzy flag description. In short words: if you are sure that “fuzzy” marked translation is correct simply remove “fuzzy” flag, compile the .po file and you are done.

Powered by WordPress