Rectangle 27 1

Here shows the problem

Git introduces its own terminology. Some of these words have been used in a wrong way, I will describe the misunderstood concepts and the problematic commands that lead to the erroneous formulation.

Luckily git has a very strong, defined language, where each term has an exact meaning, some of them can be seen in git help gitglossary. To understand the concepts git uses, the git help git page is worth to be read 5-50 times together with the introductory pages that are linked from there.

Luckily git was initiated and its core was completely written by one of the most excellent minds of our days or at least, by one who uses strictest logic concepts, instead of applying killer tools, to write and control his software development: Linus Thorvalds.

That makes it possible to use the same terms with defined meanings, when we talk about git and operations in a git repository. I won't go to deep though, as some of the concepts are developed with quite advanced theoretical terms in computer science in mind.

There are two main types of git repositories, called bare and non-bare, or I sometimes say checked-out (git help init). In this article I just talk about non-bare repositories, where the tracked files of the repository live in the working directory

working tree
      The tree of actual checked out files. The working tree normally 
      contains the contents of the HEAD commits tree, plus any local
      changes that you have made but not yet committed.
gitglossary(7)
man -s7 gitglossary
git help gitglossary
git help --web gitglossary
man
man 1 git-add
git-add(1)

We have seen here, that the term tracked means that the git repository knows and controls that file. The glossary does not come from the gitglossary(7), but from git-add(1), option

-u, --update
        Update the index just where it already has an entry matching 
        <pathspec>. This removes as well as modifies index entries to 
        match the working tree, but adds no new files.

      If no <pathspec> is given when -u option is used, all tracked 
        files in the entire working tree are updated (old versions of 
        Git used to limit the update to the current directory and
        its subdirectories).

The command git add --update is one of the most important operations to understand the handling of in the working tree by git.

git commit file1.txt file2.txt file4.txt

The set of staged files build the index (see gitglossary(7) for index, but ignore the several merge levels or the unmerged index). For our purpose

The index is a stored version of your working tree.

namely that stored version of your working tree that is prepared to be committed as one commit (again gitgloassary(7)

commit `As a noun: A single point in the Git history;

linux - Git: How to list all (staged) files attempting to be committed...

linux git bash shell unix
Rectangle 27 4

The image below show your problem / question (i think):

To understand your problem you will have to study the grid and understand the difference between the default grid and the fluid grid, see: http://twitter.github.io/bootstrap/scaffolding.html#gridSystem

Your problem will happen on screens bigger as 767px width. Below this width columns (div with class="span{x}") will stack. On big screens the problem will don't happen also.

The default grid (Twitter's Bootstrap 2.x)

When nesting rows the child row gets a total span which sum up to the span of its parent.

<div class="row">
<div class="span6">
<!--nesting-->
    <div class="row">
    <div class="span3"></div>
    <div class="span3"></div>
    </div>
</div>
<div class="span6">
</div>
</div>

In the grid the span classes have a fixed width in pixels (depending on screen width), see: Between 768px and 980px screen width: Every span1 will be 940 - (11 gutters of 20px) /12 = 60px (above the 980px (1170-11*30)/12 = 70px).

Now your problem you have set: <input type="text" class="input-medium search-query"> The .input-medium will give this input a fixed width of 150px and the "search" button take also space (75px;). You put this in a span2 (<div class="input-append span2">) witch is in a span 3 (<div class="span3 offset9">). On the default 940 grid a span3 got a width of 3x60 + 2x20 = 220px; while your seachbox takes 75+150 = 225px. For this reason your searckbox breaks out of the grid. A span4 won't have this problem. Of course it will also breaks out your span2.

The fluid grid (Twitter's Bootstrap 2.x and Twitters Bootstrap 3)

In the fluid grid every column (span{x}) of get a percentage of the width of it's parent. When nesting the child row can be split in 12 columns again.

<div class="row-fluid">
<div class="span6">
<!--nesting-->
    <div class="row">
    <div class="span6">50% of the parent and 25% of the grid</div>
    <div class="span6">50% of the parent and 25% of the grid</div>
    </div>
</div>
<div class="span6">
    <div class="row">  
    <div class="span12">100% of the parent and 50% of the grid</div>
    </div>
</div>
</div>

In your case your searchbox is nested in a span2 in a span3. The span3 will get about 25% of the grid width. When 25% of your grid width will be smaller as 225px the searchbox will break out the grid. So your problem will start around a screen width of 4 x 225 = 900px (just below the default grid of 940 pixels). Also here it will help to put your searckbox in a span 4 or 5. NOTE <div class="input-append span2"> will have a width 16,6% of 25% of the grid (very small).

Possible solution: Use a pull-right class for your searchbox

<div class="row-fluid">
    <div class="span3 offset9">
        <form class="form-search">

                <div class="input-append pull-right">
                    <input type="text" class="input-medium search-query">
                    <button type="submit" class="btn btn-info"><i class="icon-search icon-white"></i> Search </button>
                </div>

        </form>
    </div>
</div>

Twitter bootstrap grid issues - Items overflow container when downscal...

twitter-bootstrap responsive-design
Rectangle 27 3

Here's a smaller test app that shows the problem:

import javax.swing.JFrame;
import javax.swing.JLabel;

public class LabelTest {

    public static void main(String args[]) {
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JLabel label = new JLabel();

        String text = "<html>/test</html>";

        label.setText(text);

        frame.add(label);

        frame.setSize(500, 500);
        frame.setVisible(true);
    }
}

The only fix I've found is to use the special html code instead:

String text = "<html>&#47;test</html>";

You could have a processing method that uses replaceAll() to automate this process.

I'm not sure why this happens, and it doesn't seem to happen with any other special character. Weird.

Java JLabel, Why does "/* test */" result in the JLabel b...

java html swing jlabel
Rectangle 27 3

Here's a smaller test app that shows the problem:

import javax.swing.JFrame;
import javax.swing.JLabel;

public class LabelTest {

    public static void main(String args[]) {
        JFrame frame = new JFrame("Test");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JLabel label = new JLabel();

        String text = "<html>/test</html>";

        label.setText(text);

        frame.add(label);

        frame.setSize(500, 500);
        frame.setVisible(true);
    }
}

The only fix I've found is to use the special html code instead:

String text = "<html>&#47;test</html>";

You could have a processing method that uses replaceAll() to automate this process.

I'm not sure why this happens, and it doesn't seem to happen with any other special character. Weird.

Java JLabel, Why does "/* test */" result in the JLabel b...

java html swing jlabel
Rectangle 27 81

/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/

Have you ever found yourself wishing you could keep your client-side code readable and more importantly debuggable even after you've combined and minified it, without impacting performance? Well now you can through the magic of source maps.

Basically it's a way to map a combined/minified file back to an unbuilt state. When you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. Developer tools (currently WebKit nightly builds, Google Chrome, or Firefox 23+) can parse the source map automatically and make it appear as though you're running unminified and uncombined files.

It's incredibly useful, and will only download if the user opens dev tools.

Remove the source mapping line, or do nothing. It isn't really a problem.

Side note: your server should return 404, not 500. It could point to a security problem if this happens in production.

"... but arguable as to whether it should download for every user..." : Actually, source maps will only be downloaded by users that have their dev tools open and that have the "enable JS source maps" option enabled.

In Safari browser, Failed to load resource: the server responded with a status of 404 (Not Found) (angular.min.js.map, line 0): causing issues.

My question is why only in safari this issue is occurring? Other browsers doesn't show such problem.

javascript - Missing .map resource? - Stack Overflow

javascript jquery html
Rectangle 27 3

It is a bug in pandas, not only in "to_csv" function, but in "read_csv" too. It's not a general floating point issue, despite it's true that floating point arithmetic is a subject which demands some care from the programmer. This article below clarifies a bit this subject:

http://docs.python.org/2/tutorial/floatingpoint.html

A classic one-liner which shows the "problem" is ...

>>> 0.1 + 0.1 + 0.1
0.30000000000000004

... which does not display 0.3 as one would expect. On the other hand, if you handle the calculation using fixed point arithmetic and only in the last step you employ floating point arithmetic, it will work as you expect. See this:

>>> (1 + 1 + 1)  * 1.0 / 10
0.3

If you desperately need to circumvent this problem, I recommend you create another CSV file which contains all figures as integers, for example multiplying by 100, 1000 or other factor which turns out to be convenient. Inside your application, read the CSV file as usual and you will get those integer figures back. Then convert those values to floating point, dividing by the same factor you multiplied before.

python - float64 with pandas to_csv - Stack Overflow

python numpy pandas
Rectangle 27 3

I went back and had a better look at this after seeing kleopatra's comment. I was changing my TableModel after creating a RowSorter, but before attaching the RowSorter to the JTable. Here's an example that shows the problem I was having.

import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableRowSorter;
import java.util.ArrayList;
import java.util.List;

public class TestTableMain {
    public static void main(String[] args) {
        new TestTableMain();
    }

    public TestTableMain() {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                buildAndShowMainFrame();
            }
        });
    }

    private void buildAndShowMainFrame() {
        JFrame frame = new JFrame();
        JScrollPane scrollPane = new JScrollPane();

        TestTableModel model = new TestTableModel();
        JTable table = new JTable(model);

        TableRowSorter<TestTableModel> rowSorter = new TableRowSorter<>(model);
        rowSorter.setRowFilter(null);

        model.add("First added item.");
        /* The RowSorter doesn't observe the TableModel directly. Instead,
         * the JTable observes the TableModel and notifies the RowSorter
         * about changes. At this point, the RowSorter(s) internal variable
         * modelRowCount is incorrect.  There are two easy ways to fix this:
         *
         * 1. Don't add data to the model until the RowSorter has been
         * attached to the JTable.
         *
         * 2. Notify the RowSorter about model changes just prior to
         * attaching it to the JTable.
         */

        // Uncomment the next line to notify rowSorter that you've changed
        // the model it's using prior to attaching it to the table.
        //rowSorter.modelStructureChanged();
        table.setRowSorter(rowSorter);

        scrollPane.setViewportView(table);
        frame.setContentPane(scrollPane);

        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);

        model.add("Second added item.");
    }

    private class TestTableModel extends AbstractTableModel {
        private List<String> items = new ArrayList<>();

        public TestTableModel() {
            for(int i=0;i<5;i++) {
                add("Item " + i);
            }
        }

        @Override
        public int getRowCount() {
            return items.size();
        }

        @Override
        public int getColumnCount() {
            return 1;
        }

        @Override
        public Object getValueAt(int rowIndex, int columnIndex) {
            return items.get(rowIndex);
        }

        public void add(String item) {
            items.add(item);
            fireTableRowsInserted(items.size() - 1, items.size() - 1);
        }
    }
}

simply wrong - never ever try to second guess the normal internal update. Instead, try to find the error in your code instead of randomly adding stuff ;-)

@kleopatra You're right. I tracked down the actual cause today and I've updated my answer.

you might consider to remove the original part - wrong stuff tends to stick in minds :-)

swing - After adding a TableRowSorter adding values to model cause jav...

swing jtable tablerowsorter
Rectangle 27 3

To know more precisely why a video is being rejected, open the developer console, and look at the code. Although Apple doesn't show the problem in the interface, the code reveals why a video was rejected.

errorCodes: Array (5) 
0"MOV_H264_LEVEL_TOO_HIGH" 
1"MOV_AUDIO_IS_MISSING" 
2"MOV_AUDIO_CODEC_NOT_ACCEPTABLE" 
3"MOV_INVALID_AUDIO_FORMAT" 
4"MOV_AUDIO_TRACKS_DURATION_TOO_SHORT" 
Array Prototype 
localizedMessage: "The H264 Level is too high. Please refer to Apple's documentation for appropriate formats." 
nonLocalizedMessage: "H264 Level is too high. Please refer to Apple's documentation for appropriate levels." 
statusCode: 400 
suggestionCode: "MOV_RESAVE_LOWER_LEVEL"

itunesconnect - Unable to load app preview in iTunes connect - Stack O...

itunesconnect
Rectangle 27 15

NP-complete problems are those problems that are both NP-Hard and in the complexity class NP. Therefore, to show that any given problem is NP-complete, you need to show that the problem is both in NP and that it is NP-hard.

Problems that are in the NP complexity class can be solved non-deterministically in polynomial time and a possible solution (i.e., a certificate) for a problem in NP can be verified for correctness in polynomial time.

An example of a non-deterministic solution to the k-clique problem would be something like:

1) randomly select k nodes from a graph

2) verify that these k nodes form a clique.

The above strategy is polynomial in the size of the input graph and therefore the k-clique problem is in NP.

Note that all problems deterministically solvable in polynomial time are also in NP.

Showing that a problem is NP-hard typically involves a reduction from some other NP-hard problem to your problem using a polynomial time mapping: http://en.wikipedia.org/wiki/Reduction_(complexity)

Not that I see anything in this answer that is incorrect, but I don't know why it was accepted. It doesn't really offer much to what the OP was asking. It's not really even different than the standard explanations of these problems, and there aren't any clear explanations as to what makes these problems in these classes. Not worth a downvote, but certainly not worth answer acceptance.

algorithm - What are the differences between NP, NP-Complete and NP-Ha...

algorithm complexity-theory computer-science np-complete np-hard
Rectangle 27 126

edit: As lots of people seem to want to do this, I have written up a short guide with a more general use case here https://www.atlascode.com/bootstrap-fixed-width-sidebars/. Hope it helps.

The bootstrap3 grid system supports row nesting which allows you to adjust the root row to allow fixed width side menus.

You need to put in a padding-left on the root row, then have a child row which contains your normal grid layout elements.

<div class="container">
    <div class="row">
        <div class="col-fixed-240">Fixed 240px</div>
        <div class="col-fixed-160">Fixed 160px</div>
        <div class="col-md-12 col-offset-400">
            <div class="row">
            Standard grid system content here
            </div>
        </div>
    </div>
</div>
.col-fixed-240{
    width:240px;
    background:red;
    position:fixed;
    height:100%;
    z-index:1;
}

.col-fixed-160{
    margin-left:240px;
    width:160px;
    background:blue;
    position:fixed;
    height:100%;
    z-index:1;
}

.col-offset-400{
    padding-left:415px;
    z-index:0;
}

This one is nice but if you put inside the fixed column e.g this <p><a class="btn btn-default" href="#" role="button">View details </a></p> or Bootstrap dropdown then these are not working in the fixed column. Is there any fix for this?

@VaclavElias try putting a full-size diff in it with position:relative and then the dropdown? It helps if you make a jsfiddle to show the problem

position: fixed means that when scrolling the content of that column floats above the rest of the page. In my case I fixed it using position: absolute.

Bootstrap 3.0 - Fluid Grid that includes Fixed Column Sizes - Stack Ov...

twitter-bootstrap twitter-bootstrap-3
Rectangle 27 24

to_date() returns a date at 00:00:00, so you need to "remove" the minutes from the date you are comparing to:

select * 
from table
where trunc(es_date) = TO_DATE('27-APR-12','dd-MON-yy')

You probably want to create an index on trunc(es_date) if that is something you are doing on a regular basis.

The literal '27-APR-12' can fail very easily if the default date format is changed to anything different. So make sure you you always use to_date() with a proper format mask (or an ANSI literal: date '2012-04-27')

Although you did right in using to_date() and not relying on implict data type conversion, your usage of to_date() still has a subtle pitfall because of the format 'dd-MON-yy'.

With a different language setting this might easily fail e.g. TO_DATE('27-MAY-12','dd-MON-yy') when NLS_LANG is set to german. Avoid anything in the format that might be different in a different language. Using a four digit year and only numbers e.g. 'dd-mm-yyyy' or 'yyyy-mm-dd'

@user2246725: then you are not telling us everything. Please create a simple example on sqlfiddle.com that shows your problem.

Where B.Timelog = to_date('14-Apr-17','DD-MM-YY')

database - Oracle SQL query for Date format - Stack Overflow

sql database oracle oracle11g
Rectangle 27 9

What it's saying about persistent state is this: even if you're using RAII and your object gets destructed properly, allowing you to clean up, if the code in the try block modified the state of the system in some way, you most likely need to figure out how to roll back those changes because the operation didn't complete successfully. They use the term commit here as it relates to transactions, the notion that when you execute an operation, the state of the system should be as if it was completed 100% successfully or it didn't happen at all.

Here's how this can get messed up even with RAII:

struct MyClass
{
    MyClass(Foo* foo) 
    { 
        m_bar = new Bar;
        foo->changeSomeState(); 
    }

    ~MyClass()
    {
        delete m_bar;
    }

    Bar* m_bar;
};

Now if you have this code:

try
{
    MyClass myClass(foo);
    Baz baz;
    baz.doSomething(); // Throws an exception
}
catch(...)
{
    // MyClass doesn't leak memory, but should it try to undo
    // the change it made to foo?
}

So to handle this kind of case correctly, you have to add more code to treat this as a transaction and to roll back whatever changes to persistent state were made in the try block when an exception is thrown. They're just saying that forcing transaction semantics can clutter up (obfuscate) the code.

I don't agree with banning exceptions, btw, just trying to show the problem they're referring to.

That doesn't give any reason to do them all at once though. For that situation you want small try/catch blocks. The only thing the exception is doing is forcing you to fix the problem, without them you'd still have the problem, you just wouldn't know about it.

@Brendan - Exceptions really don't help much with the problem you are referring too. It just gives you a different method (and more clean IMHO) of dealing with the problem. Lazy people will still be lazy.

@Brendan Long It's clearly possible to do correct error handling without exceptions. I prefer them, however, and as I said I don't agree with their reasoning here. But I think this definitely illustrates the argument that they're making, which was the point of the question.

does baz->doSomething(); really throw a C++ exception? i thought it would throw a platform specific exception of some kind, that you cant catch in C++ catch handlers, but with a debugger only...

@smerlin You're right, I updated the answer.

On a disadvantage of exceptions in C++ - Stack Overflow

c++
Rectangle 27 62

Same as C, you would do

#include <stdlib.h>
...
int r = rand() % 74
#include <time.h>
#include <stdlib.h>
...
srand(time(NULL));
int r = rand() % 74;

(assuming you meant including 0 but excluding 74, which is what your Java example does)

Edit: Feel free to substitute random() or arc4random() for rand() (which is, as others have pointed out, quite sucky).

-1. You need to seed the random number generator or you will get the same pattern of numbers on each execution.

How about I want to start from a different number than zero?

@amok: You can just add the number that you want to start from to the result

I keep getting the number 9. Pretty random I'd say ;D

i just tested random(), and it showed the same problem as rand()

Generating random numbers in Objective-C - Stack Overflow

objective-c random
Rectangle 27 62

Same as C, you would do

#include <time.h>
#include <stdlib.h>
...
srand(time(NULL));
int r = rand() % 74;

(assuming you meant including 0 but excluding 74, which is what your Java example does)

Edit: Feel free to substitute random() or arc4random() for rand() (which is, as others have pointed out, quite sucky).

-1. You need to seed the random number generator or you will get the same pattern of numbers on each execution.

How about I want to start from a different number than zero?

@amok: You can just add the number that you want to start from to the result

I keep getting the number 9. Pretty random I'd say ;D

i just tested random(), and it showed the same problem as rand()

Generating random numbers in Objective-C - Stack Overflow

objective-c random
Rectangle 27 62

Same as C, you would do

#include <time.h>
#include <stdlib.h>
...
srand(time(NULL));
int r = rand() % 74;

(assuming you meant including 0 but excluding 74, which is what your Java example does)

Edit: Feel free to substitute random() or arc4random() for rand() (which is, as others have pointed out, quite sucky).

-1. You need to seed the random number generator or you will get the same pattern of numbers on each execution.

How about I want to start from a different number than zero?

@amok: You can just add the number that you want to start from to the result

I keep getting the number 9. Pretty random I'd say ;D

i just tested random(), and it showed the same problem as rand()

Generating random numbers in Objective-C - Stack Overflow

objective-c random
Rectangle 27 62

Same as C, you would do

#include <time.h>
#include <stdlib.h>
...
srand(time(NULL));
int r = rand() % 74;

(assuming you meant including 0 but excluding 74, which is what your Java example does)

Edit: Feel free to substitute random() or arc4random() for rand() (which is, as others have pointed out, quite sucky).

-1. You need to seed the random number generator or you will get the same pattern of numbers on each execution.

How about I want to start from a different number than zero?

@amok: You can just add the number that you want to start from to the result

I keep getting the number 9. Pretty random I'd say ;D

i just tested random(), and it showed the same problem as rand()

Generating random numbers in Objective-C - Stack Overflow

objective-c random
Rectangle 27 5

if you want to paint over JComponents placed to the JScrollPane then you can paint to the JViewPort, example here

1) beacuse your code painted to the wrong Container, to the JFrame, sure is possible to paint to the JFrame, but you have to extract RootPane or GlassPane

2) you have to learn how to LayoutManagers works, I let your code with original Sizing, not nice and very bad

GlassPane
JViewPort

EDIT: 2, if you expecting single line, on the fixed Bounds

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Line2D;
import javax.swing.*;
import javax.swing.border.LineBorder;

public class GridTest extends JFrame {
    private static final long serialVersionUID = 1L;

    public static void main(String[] args) {
        new GridTest().run();
    }

    private void run() {
        setPreferredSize(new Dimension(200, 200));
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        final JPanel p = new JPanel() {
            private static final long serialVersionUID = 1L;

            @Override
            public void paint(Graphics g) {
                super.paint(g);
                Graphics2D gg = (Graphics2D) g.create();
                Line2D line = new Line2D.Double(0, 50, getWidth(), 50);
                gg.setStroke(new BasicStroke(3));
                gg.setColor(Color.red);
                gg.draw(line);
                gg.dispose();
            }
        };
        JPanel p1 = new JPanel();
        p1.setBorder(new LineBorder(Color.black,1));
        JPanel p2 = new JPanel();
        p2.setBorder(new LineBorder(Color.black,1));
        JPanel p3 = new JPanel();
        p3.setBorder(new LineBorder(Color.black,1));
        p.setLayout(new GridLayout(3,0));
        p.add(p1);
        p.add(p2);
        p.add(p3);
        p.setBounds(20, 20, 100, 100);
        p.setBackground(Color.white);
        add(p, BorderLayout.CENTER);

        JButton b = new JButton("Refresh");
        b.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                p.repaint();
            }
        });
        add(b, BorderLayout.SOUTH);

        pack();
        setVisible(true);
    }
}

I tried, but (at least in my test), when a child component of the scroll pane repaints itself, the viewPort's stageChanged (of ChangeListener) is not called (only when I do something else, like using the scroll bar). If my children components were fixed in their locations it would work, but the problem is that the user may drag them over the draw area

@Rafael Steil that very theoretical question, please post code in sscce.org form that demostrated your issues

Ok, I created a very small and simple example that shows the problem.

I understand how layout managers and everything else works, you can't ask for SSCCE and expect it to adhere to all best practices and patterns that simply doesn't add anything to explain the problem. Anyway, I found I solution here, where I draw to the scroll pane, and pass a reference of it to anyone who triggers repaint events. Not as slick as I wanted it to be, but works. (Please don't get me wrong, I appreciate the help. The discussion here helped me to find an alternative solution).

Paint over all other components (Swing, Java) - Stack Overflow

java swing drawing java-2d
Rectangle 27 5

The first thing you should do shoot the person that named your columns with spaces in them.

SELECT DISTINCT
   c.id, 
   c.`first name`, 
   c.`last name`, 
   c.`general mobile`, 
   c.`general phone`, 
   c.`business phone`
from contacts_test c
join contacts_test c2
    on (c.`general mobile`!= '' and c.`general mobile` in (c2.`general phone`, c2.`business phone`))
    or (c.`general phone` != '' and c.`general phone` in (c2.`general mobile`, c2.`business phone`))
    or (c.`business phone`!= '' and c.`business phone` in (c2.`general mobile`, c2.`general phone`))

See a live demo of this query in SQLFiddle.

Note the extra check for phone != '', which is required because the phone numbers are not nullable, so their "unknown" value is blank. Without this check, false matches are returned because of course blank equals blank.

The DISTINCT keyword was added in case there are multiple other rows that match, which would result in a nxn result set.

Thanks for that. Totally agree about the column names. I assumed your script would simply join records to the selection that match the values in general mobile, general phone & business phone however what actually happened was a never-ending loop of records exactly the same as the initial selection. Any ideas?

I don't understand what you mean. Please create an SQLFiddle including data to show the problem

See SQLFiddle data Ok so the test data has 3 records, 2 of which contain a duplicate number. I run the above code & it returns 9 rows. Presumably the join statement is not checking that there is a match before joining records Thanks in advance

I can see the problem, and I can fix it, but I must ask you, why are you storing blanks instead of nulls for "no number"? The readon I ask is that it makes the query quite different. Before I write the fix, are you intending to use nulls, blanks or either for missing numbers?

I'll use nulls if that makes things easier. I simply inherited the current situation. Thanks

mysql - Deduping database records comparing values in numerous fields ...

mysql sql deduplication
Rectangle 27 5

if you want to paint over JComponents placed to the JScrollPane then you can paint to the JViewPort, example here

1) beacuse your code painted to the wrong Container, to the JFrame, sure is possible to paint to the JFrame, but you have to extract RootPane or GlassPane

2) you have to learn how to LayoutManagers works, I let your code with original Sizing, not nice and very bad

GlassPane
JViewPort

EDIT: 2, if you expecting single line, on the fixed Bounds

import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Line2D;
import javax.swing.*;
import javax.swing.border.LineBorder;

public class GridTest extends JFrame {
    private static final long serialVersionUID = 1L;

    public static void main(String[] args) {
        new GridTest().run();
    }

    private void run() {
        setPreferredSize(new Dimension(200, 200));
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        final JPanel p = new JPanel() {
            private static final long serialVersionUID = 1L;

            @Override
            public void paint(Graphics g) {
                super.paint(g);
                Graphics2D gg = (Graphics2D) g.create();
                Line2D line = new Line2D.Double(0, 50, getWidth(), 50);
                gg.setStroke(new BasicStroke(3));
                gg.setColor(Color.red);
                gg.draw(line);
                gg.dispose();
            }
        };
        JPanel p1 = new JPanel();
        p1.setBorder(new LineBorder(Color.black,1));
        JPanel p2 = new JPanel();
        p2.setBorder(new LineBorder(Color.black,1));
        JPanel p3 = new JPanel();
        p3.setBorder(new LineBorder(Color.black,1));
        p.setLayout(new GridLayout(3,0));
        p.add(p1);
        p.add(p2);
        p.add(p3);
        p.setBounds(20, 20, 100, 100);
        p.setBackground(Color.white);
        add(p, BorderLayout.CENTER);

        JButton b = new JButton("Refresh");
        b.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                p.repaint();
            }
        });
        add(b, BorderLayout.SOUTH);

        pack();
        setVisible(true);
    }
}

I tried, but (at least in my test), when a child component of the scroll pane repaints itself, the viewPort's stageChanged (of ChangeListener) is not called (only when I do something else, like using the scroll bar). If my children components were fixed in their locations it would work, but the problem is that the user may drag them over the draw area

@Rafael Steil that very theoretical question, please post code in sscce.org form that demostrated your issues

Ok, I created a very small and simple example that shows the problem.

I understand how layout managers and everything else works, you can't ask for SSCCE and expect it to adhere to all best practices and patterns that simply doesn't add anything to explain the problem. Anyway, I found I solution here, where I draw to the scroll pane, and pass a reference of it to anyone who triggers repaint events. Not as slick as I wanted it to be, but works. (Please don't get me wrong, I appreciate the help. The discussion here helped me to find an alternative solution).

Paint over all other components (Swing, Java) - Stack Overflow

java swing drawing java-2d
Rectangle 27 81

box-sizing: border-box
.content {
    width: 100%;
    box-sizing: border-box;
}

so what is the cause of this strange behaviour ?

@drasto: The fact that you're applying width: 100% to an element that has a border and padding. border-box fixes this by including this border and padding inside the width: 100% calculation.

so I can set padding on div to 0 and remove the border(that is there only to show the problem - will not be needed in production html) to fix it ?

@drasto: No. It's the border/padding on the input element. To see what I mean, take a look at this exaggerated demo: jsfiddle.net/QkmSk/4

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

html - Content of div is longer then div itself when width is set to 1...

html css firefox