Wednesday, April 29, 2015

SVN - Merging the Same Change

Sometimes, I seem to be getting a conflict when trying to commit a change to SVN, if someone else has already committed the same exactly change before me.

So, I create a little repo with a single Java file in it and branched it.  Let's assume the file is like this:

1:    Line1  
2:    Line2  
3:    Line3  
4:    xxx NIE yyy  
5:    Line5  
6:    Line6  
7:    Line7  

On the trunk, I have changed NIE to TAK and Line2 to XXX and committed the change.  On the the branch, I have changed NIE to TAK and Line6 to YYY and committed the change as well.  When I merged the changes in trunk into the working copy of the branch, I've got only a change of Line2 brought in.

So, the conclusion is, that an identical change is merged by SVN smoothly, even if other non-matching changes were found nearby.  Or possibly, it's not SVN but the merge tool, which in my case was the Tortoise SVN built in merge tool.

Wednesday, April 22, 2015

SVN Externals - Create and Edit in Tortoise SVN Client

SVN let's you create links inside the repository.  For example, if with your project A you always need a module B, which is in another part of the SVN repo, you may want to create a svn:external to B in A.

  • open the project A in repo browser
  • right-click on the project and select properties
  • click New->Externals to create a new one or select it and click Edit to modify an existing one
  • point the external to B and carefully consider whether you want to point it to the HEAD or to a specific version; the latter will make your project A always build regardless of what happens with project B
The same dialogs you can access from windows menu of folder A of the working copy, from the Subversion tab. Once you're there, click on Properties.

Monday, April 20, 2015

Open Source Repositories over Time

First, there was Source Forge.  It was big, as if open source was invented there (well, other than linux).  Then, it faded into the past (security issues?).  Google Code became the thing.  This year, Google Code is closing.  GitHub is the center of the universe.

That's how it changes:

SQL - Write Universal Querries

This post is supposed to deal with pecularities of SQL, and not one or another SQL dialect but the universal SQL, that can be ported without doing any porting to any other SQL database.

Boolean in Where-clause

If table client has a boolean column active, you may be tempted to write a query:

select * from client where active

However, to be sure it works on all databases, you better write it like this (for example, there are many other options):

select * from client where active = true

And, remember about nulls.  In general, every condition involving a variable which is not set (null) will be considered as a unsatisfied condition.


Sometimes, it's convenient to save a copy results of a select into the same or different table. No problem.  Here's how you do this:

  (SELECT * FROM users1 WHERE age < 18)

Or, if you want just selected columns:

INSERT INTO users (id, age) 
  (SELECT id, age FROM users1 WHERE age < 18)

CREATE from SELECT (option: as temp table)

To create a table from select do:

CREATE [temp] table table_name as
SELECT, as my_id

FROM orig_table t
With the "temp", the table will be auto deleted when session is killed.

I'm not sure this is standard SQL, but for Postgres for example it works just fine.


Joins can be done with an update, but the first table joined is joined the old way (link) and the next tables can be joined the new way:

The first table:

UPDATE vehicles_vehicle AS
  SET price = s.price_per_vehicle  
  FROM shipments_shipment AS
  WHERE v.shipment_id =

Two or more tables joined:

UPDATE vehicles_vehicle AS
  SET price = s.price_per_vehicle  
  FROM shipments_shipment AS
  JOIN vehicles_owner o ON = v.owner_id
  WHERE v.shipment_id =

I'm not sure this is standard SQL, but for Postgres for example it works just fine.

Thursday, April 16, 2015

Substituting Voice in the Movie with Another Voice

The Task

I had a movie, in AVI format with only some random noise.  And I had a voice in an MP3 file (actually, it was a 3GP file format).  I wanted put the voice into the movie

The Method

  • Download and install VirtualDub application (I had version 1.10.4 on WinXP).
  • If you have a desired audio in a 3GP format, just rename the file by changing the file extension to MP3.
  • Convert audio to WAV (I used MusicBee for this).
  • Open the video file in VirtualDub.
  • Set the following in VD:
    • In Video menu, set Direct Stream Copy
    • In Audio menu, chose Audio from the other file and select the WAV file
    • From File menu, choose Save as AVI

 The Result

The generated AVI file was only 78.3 MB, while the original video was 76.3 MB and the WAV file was 3.85 MB.  Quality was just fine.  Sync didn't matter and I can't ass it.