What does href expression do?

An <a> element is invalid HTML unless it has either an href or name attribute. If you want it to render correctly as a link (ie underlined, hand pointer, etc), then it will only do so if it has a href attribute. Code like this is therefore sometimes used as a way of making a link, but without having to provide an actual … Read more

Use tag with a map

The <form:options> tag supports what you want right out of the box, using the items attribute. You can do something like this: And so on. Then in your form: That will be rendered to something like:

DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704

I created local database in DB2 called “TestDB” then I created table called “TestTable“.I found that the table is put under schema name is “yasmin“.I am trying to connect to the DB2 database using JDBC but I got this exception I tried many solutions on the internet Like set schema but unfortunately doesn’t work. This is the JDBC code … Read more

How to move or position a legend in ggplot2

In versions > 0.9.3 (when opts was deprecated) Older version: Unfortunately it’s a bug in ggplot2 which I really really hope to fix this summer. Update: The bug involving opts(legend.position = “left”) has been fixed using the most current version of ggplot2. In addition, version 0.9.0 saw the introduction of guide_legend and guide_colorbar which allow much finer control over the appearance and positioning of … Read more

Categories R

Java – Best way to print 2D array?

I was wondering what the best way of printing a 2D array was. This is some code that I have and I was just wondering if this is good practice or not. Also correct me in any other mistakes I made in this code if you find any. Thanks!

What’s the difference between import java.util.*; and import java.util.stream;?

I doubt that the second attempt (import java.util.stream;) works. As JonSkeet pointed out in their comment, it should result in a compilation error: error: cannot find symbol. Maybe you wanted to import java.util.stream.*;? To the actual question: If we import with a wildcard, that is the asterisk (*) character, only the direct classes in this package will be imported, not the … Read more

How to assign colors to categorical variables in ggplot2 that have stable mapping?

For simple situations like the exact example in the OP, I agree that Thierry’s answer is the best. However, I think it’s useful to point out another approach that becomes easier when you’re trying to maintain consistent color schemes across multiple data frames that are not all obtained by subsetting a single large data frame. Managing the … Read more

Categories R

Converting data frame column from character to numeric

If we need only one column to be numeric But, if all the columns needs to changed to numeric, use lapply to loop over the columns and convert to numeric by first converting it to character class as the columns were factor. Both the columns in the OP’s post are factor because of the string “n/a”. This could be easily avoided while reading the file using na.strings = … Read more

Categories R

deleting rows in numpy array

I have an array that might look like this: Notice that one of the rows has a zero value at the end. I want to delete any row that contains a zero, while keeping any row that contains non-zero values in all cells. But the array will have different numbers of rows every time it … Read more

Invalid use of non-static member function c++

Unlike static member functions or free functions, non-static member functions won’t implicitly convert to member function pointers. (emphasis mine) An lvalue of function type T can be implicitly converted to a prvalue pointer to that function. This does not apply to non-static member functions because lvalues that refer to non-static member functions do not exist. So you need to use & explicitly to … Read more