I'm using Django and Mysql in order to, for instance, display some news articles. These articles are in English and German. I would like to know what database organization is more efficient:  1 table made of the following fields:  Articles   English_title  (char field) English_body  (char field) German_title  (char field) German_body  (char field) Picture  (file field)   or  2 tables made of the following fields:  English articles   English_title  (char field) English_body  (char field) Picture       (file field)   German articles   German_title (char field) German_body  (char field)   It'll display English articles on a template and German ones in another one.
I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them.  But what is the best approach in defining a multilanguage database schema? Let's say we have a lot of tables (100 or more), and each table can have multiple columns that can be localized (most of nvarchar columns should be localizable). For instance one of the tables might hold product information:  CREATE TABLE T_PRODUCT (   NAME        NVARCHAR(50),   DESCRIPTION NTEXT,   PRICE       NUMBER(18, 2) )   I can think of three approaches to support multilingual text in NAME and DESCRIPTION columns:   Separate column for each language  When we add a new language to the system, we must create additional columns to store the translated text, like this:  CREATE TABLE T_PRODUCT (   NAME_EN        NVARCHAR(50),   NAME_DE        NVARCHAR(50),   NAME_SP        NVARCHAR(50),   DESCRIPTION_EN NTEXT,   DESCRIPTION_DE NTEXT,   DESCRIPTION_SP NTEXT,   PRICE          NUMBER(18,2) )  Translation table with columns for each language  Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains a column for each language.  CREATE TABLE T_PRODUCT (   NAME_FK        int,   DESCRIPTION_FK int,   PRICE          NUMBER(18, 2) )  CREATE TABLE T_TRANSLATION (   TRANSLATION_ID,   TEXT_EN NTEXT,   TEXT_DE NTEXT,   TEXT_SP NTEXT )  Translation tables with rows for each language  Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains only a key, and a separate table contains a row for each translation to a language.  CREATE TABLE T_PRODUCT (   NAME_FK        int,   DESCRIPTION_FK int,   PRICE          NUMBER(18, 2) )  CREATE TABLE T_TRANSLATION (   TRANSLATION_ID )  CREATE TABLE T_TRANSLATION_ENTRY (   TRANSLATION_FK,   LANGUAGE_FK,   TRANSLATED_TEXT NTEXT )  CREATE TABLE T_TRANSLATION_LANGUAGE (   LANGUAGE_ID,   LANGUAGE_CODE CHAR(2) )    There are pros and cons to each solution, and I would like to know what are your experiences with these approaches, what do you recommend and how would you go about designing a multilanguage database schema.
How do I limit the number of rows returned by an Oracle query after ordering? Is there a way to make an Oracle query behave like it contains a MySQL limit clause? In MySQL, I can do this: select *  from sometable order by name limit 20,10  to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are selected after the order by, so it really starts on the 20th name alphabetically. In Oracle, the only thing people mention is the rownum pseudo-column, but it is evaluated before order by, which means this: select *  from sometable where rownum &lt;= 10 order by name  will return a random set of ten rows ordered by name, which is not usually what I want. It also doesn't allow for specifying an offset. I'm trying to approximate the computer's write speed using dd:  dd if=/dev/urandom of=/dev/null bs=1K count=10000   which gives the following output  10000+0 records in 10000+0 records out 10240000 bytes (10 MB) copied, 0.746313 s, 13.7 MB/s   How can I get the '13.7 MB/s' into a bash variable? I've tried piping the output from dd to progs like awk, sed and grep to no avail.  Ultimately, I'm calling this via os.system(...) from within a python script. If anyone knows of a more direct way to get a similar result inside python I'd be interested in that also. I'm trying to predict how long a file copy will take, based on the file size.  Any help would be greatly appreciated. How to sort a ConcurrentSkipListMap by value? Accessing UI thread handler from a service Why is the sum of two random variables a convolution? For long time I did not understand why the "sum" of two random variables is , whereas a mixture density function sum of $f(x)$ and $g(x)$ is $p\,f(x)+(1-p)g(x)$; the arithmetic sum and not their convolution. The exact phrase "the sum of two random variables" appears in google 146,000 times, and is elliptical as follows. If one considers an RV to yield a single value, then that single value can be added to another RV single value, which has nothing to do with convolution, at least not directly, all that is is a sum of two numbers. An RV outcome in statistics is however a collection of values and thus a more exact phrase would be something like "the set of coordinated sums of pairs of associated individual values from two RV's is their discrete convolution"...and can be approximated by the convolution of the density functions corresponding to those RV's. Even simpler language: 2 RV's of $n$-samples are in effect two n-dimensional vectors that add as their vector sum.           Please show the details of how the sum of two random variables are a convolution and a sum. Variable importance from GLMNET How to set vertex weights using Blender's Python API? Looking at the API docs I found , but It cannot be called in Edit Mode. When I try to call it, I always get:     RuntimeError: VertexGroup.add(): cannot be called while object is in edit mode.   The buttons in the vertex group list use bpy.ops.objects.vertex_group_assign(), but to work with it you have to manipulate selections, this is not nice to do from a script.    Why I try to use VertexGroup.add() in Edit Mode? My script works this way:  Human weight paint a bone, "Arm_1.L", "Arm_1.L" shares vertices with "Arm_2.L" in this case they share half the vertices (4 bone arm rig, trick to have nice deform in certain movements). When script run, all selected vertices that exist in both groups (Arm_1.L and Arm_2.L) will copy the weights of Arm_1.L into Arm_2.L but inverted. This way, I only need to weight paint "Arm_1.L" and "Arm_3.L", the script will fill the weights for "Arm_2.L".  import bpy  # ensure we are in edit mode bpy.ops.object.mode_set(mode="EDIT")  # configurable parameters src_group = "Arm_03.L" dst_group = "Arm_02.L"  obj = bpy.context.edit_object src_group_index = obj.vertex_groups[src_group].index dst_group_index = obj.vertex_groups[dst_group].index  mesh = obj.data sel_verts = [v for v in mesh.vertices if v.select] #sel_verts = mesh.vertices  # SEGFAULT in this line bpy.ops.object.mode_set(mode="OBJECT")  print("Working")  for v in sel_verts:     v1in = False     v2in = False     for g in v.groups:         if g.group == src_group_index:             v1in = True         if g.group == dst_group_index:             v2in = True     if v1in and v2in:         print("True")         obj.vertex_groups[dst_group].add([v.index], 1.0 - obj.vertex_groups[src_group].weight(v.index), 'REPLACE')  print("Finished") Automatically update field value in one column based on change to another column in same table? When editing I want to be able to change the attributes of one field and upon doing this allow for the automatic update of another field in the same attribute table.   Essentially I have one layer with a code, description and legend information.   I would like to be able to edit the code and have the description and the legend information update with this edit with its correct description and legend information.   Is there any way to do this within ArcMap's tools or an associated script? I often see tutorials online that connect various commands with different symbols. For example:  command1 |  command2 command1 &amp;  command2 command1 || command2     command1 &amp;&amp; command2   Others seem to be connecting commands to files:  command1  &gt; file1 command1  &gt;&gt; file1   What are these things? What are they called? What do they do? Are there more of them?    . Listing feature classes with active domains? Why don't the Ubuntu repositories have the latest versions of software? Why are packages in the official Ubuntu repositories older than the latest (upstream) versions from Debian Sid, PPAs, the authors, etc.? How do I import a Python module given its relative path?  For example, if dirFoo contains Foo.py and dirBar, and dirBar contains Bar.py, how do I import Bar.py into Foo.py?  Here's a visual representation:  dirFoo\     Foo.py     dirBar\         Bar.py   Foo wishes to include Bar, but restructuring the folder hierarchy is not an option. How to grep standard error stream (stderr)? I am using ffmpeg to get the meta info of an audio clip. But I am unable to grep it.      $ ffmpeg -i 01-Daemon.mp3  |grep -i Duration     FFmpeg version SVN-r15261, Copyright (c) 2000-2008 Fabrice Bellard, et al.       configuration: --prefix=/usr --bindir=/usr/bin        --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib       --mandir=/usr/share/man --arch=i386 --extra-cflags=-O2        ...   I checked, this ffmpeg output is directed to stderr.  $ ffmpeg -i 01-Daemon.mp3 2&gt; /dev/null   So I think that grep is unable to read error stream to catch matching lines. How can we enable grep to read error stream?  Using  link, I redirected standard error stream to standard output stream, then grep worked.  $ ffmpeg -i 01-Daemon.mp3 2&gt;&amp;1 | grep -i Duration   Duration: 01:15:12.33, start: 0.000000, bitrate: 64 kb/s   But what if we do not want to redirect stderr to stdout? Rendering of Favorite/Ignored Tags in Firefox When will my device get the Android 4.1 update (Jelly Bean)? Android 4.1 (Jelly Bean) was announced at Google I|O 2012 on June 27, 2012.  (You can review  at the official Android Developer's site.)  Of course, not all devices will get this update right away and others won't get it at all. Each manufacturer and carrier often choose to add their custom modifications which tend to delay the official release.  When will each device get Android 4.1, either officially or unofficially, if ever?  See also: I followed the instructions and got success response but I didn't receive email.  Then I used the id to get Email Status and got 404 error.  Here is my json :  POST :   {     "To": {         "Address": "example@gmail.com",         "SubscriberKey": "example@gmail.com.tw"     },     "Options": {         "RequestType": "ASYNC"     } }   GET : {id}  Please let me know how I can resolve the issue. Why are these pistons pushing? I've lately become hooked into building computers in Minecraft and today I decided to build a giant hard drive. I've built HDDs before, but not at the scale I'm currently attempting, and I anticipated problems. As I was wiring some pistons, they activated and pushed forward oddly. As far as I can tell, there's nothing powering them.    I thought at first that it might be the redstone torches (top left of above pic) but they aren't powered.   Here's a top view of the same pistons. I also thought the line of redstone above  them might be the problem (middle of above pic), but when I destroy it, the pistons stay extended.  Is there a reason why my pistons are extending? If so, is there a way to get them to power (when I want them to) without disturbing the pistons above? An awful identity We take place on $\mathbb C(x_1,...,x_r,x'_1,...,x'_p,u_0,...,u_r,u'_0,...,u'_p)$ with $r,p\in \mathbb N$     Show that :   $$\displaystyle{\sum_{i=1}^r \left(   \frac{\prod_{j=0}^r (u_j-x_i) \prod_{j=1}^p (x'_j-x_i) }{  \prod_{1\leq j\leq r, j\neq i     }(x_j-x_i) \prod_{j=0}^p (u'_j-x_i)}      \right)}-\displaystyle{\sum_{i=0}^p \left(   \frac{\prod_{j=0}^r (u'_i-u_j) \prod_{j=1}^p (u'_i-x'_j) }{  \prod_{0\leq j\leq p, j\neq i     }(u'_i-u'_j) \prod_{j=1}^r (u'_i-x_j)}      \right)}=\displaystyle{\sum_{i=1}^p x'_i +\sum_{i=0}^r u_i -\sum_{i=1}^r x_i-\sum_{i=0}^p u'_i}$$   I have seen this exercise in an old book at the library. Unfortunately there was no indication how can I solve the problem.   Anyway if someone can give me some ideas it will be greatful.   NB: Sorry for the title, I have not had other ideas Combine Two SQL queries in one statement Drush installed and running; No Drupal site found even with uri specified After much trial and tribulation, I thought I had drush all ready to roar. Much excitement. But then, no joy...  Drush is working. The sites operate fine via MAMP. Regardless, a "drush cc all" command returns:   No Drupal site found, only 'drush' cache was cleared.                                          [warning] 'all' cache was cleared.                                                                       [success]   This question has stumped drupalcon attendees and very experienced developers. Any ideas?  I am on Mac OS 10.9.3 using MAMP (free) Version 3.0.5  Here is my drush status:   Drupal version         :  7.29-dev                                 Site URI               :  http://default                           Database driver        :  mysql                                    Database hostname      :  localhost                                Database username      :  db_user                             Database name          :  db_name                        PHP executable         :  /usr/bin/php                             PHP configuration      :                                           PHP OS                 :  Darwin                                   Drush version          :  7.0-dev                                  Drush temp directory   :  /tmp                                     Drush configuration    :                                           Drush alias files      :                                           Drupal root            :  /Applications/MAMP/htdocs/mysite.dev   Site path              :  sites/default       Have tried executing drush from /Applications/MAMP/htdocs/mysite.dev; from /Applications/MAMP/htdocs/mysite.dev/sites/default; and using drush cc all --uri=http://localhost/mysite.dev  Tried running drush from sites/default. Same result.