text:
Q: How can I print multiline output on the same line? Is there a method to print multi-line output (single output) on the same line?
For example, if the output is:
abc
def
qwerty

Is it possible to print:
abcdefqwerty

A: You can pipe your multiline output through awk
awk '{printf "%s",$0} END {print ""}'

or use sed:
sed ':a;N;$!ba;s/\n//g'

Example run
$ echo -e "1\n2\n3\n4" | awk '{printf "%s",$0} END {print ""}'
1234
$ echo -e "1\n2\n3\n4" | sed ':a;N;$!ba;s/\n//g'
1234

Further reading: remove line break using AWK · serverfault.SE

A: Also your_command | paste -sd '' which preserves the trailing newline.

A: This answer has a solution to the problem you are trying to create: Why does bash remove \n in $(cat file)?
If you type cat myfile.txt you will see:
abc
def
ghi

But if you type echo $(cat myfile.txt) you will see:
abc def ghi

Note this method inserts a space where separate new lines used to be. This makes the output easier to read but doesn't strictly adhere to your question scope.

A: If you want to use Perl for this, you can use its chomp function:
perl -pe chomp

Some more details, for those who are interested.
You can pass one or more filenames as subsequent arguments.
perl -pe chomp file1 file2 file3
In some cases you might not want to do that, but you can pipe or redirect to that command instead. (These abilities--and that caveat--all apply to any other perl -p or perl -n based solution, too.)
So, if you want to process output from running some-command:
some-command | perl -pe chomp
This is potentially faster than the Perl command in terdon's answer. Newline characters (represented by \n) only appear at the end of lines in this situation--because they are what Perl is using to decide where each line ends. s/\n// searches through the entire line for newlines, while chomp just removes the one at the end (if any, as the very last line might or might not have one).
Performance might not really be the main reason to prefer chomp. The  perl command in terdon's answer would only be slightly slower unless you're processing a huge file with very long lines. And if you need speed, David Foerster's way is still probably faster. chomp is, however, exactly the right tool for this if you are using Perl, and I think the intent of chomp is clearer than that of s/\n//. Ultimately there's probably no objective answer as to which is better.
Printing a final newline.
However, I do recommend against the use of command substitution ($( )) just to ensure a trailing newline gets printed. Unless the text you're processing is short, that's likely to be quite slow--it has to collect all the text at once and then print it--and it makes your command harder to understand. Instead you can do as David Foerster suggested and run echo or printf '\n' afterwards.
perl -pe chomp; echo

If you're piping from or (as David Foerster shows) redirecting from that command, then you can enclose it in { ;} so that the output of both commands is taken together. If you're just printing it to the terminal, then you can run it exactly as shown above. This works even if you're piping or redirecting to the command, because echo/printf '\n' does not actually read any input. That is, this works:
some-command | perl -pe chomp; echo
While here you cannot simply remove the { ;}:
{ perl -pe chomp; echo; } | some-other-command
Or, if you prefer, you can make perl print the final newline itself. Like enclosing the perl and echo commands in { ;}, this approach works even if you're piping or redirecting from it (and, like all approaches, this works when you're piping to it, too):
perl -wpe 'chomp; END { print "\n" }'

Note that the command in terdon's answer works fine with these methods of printing the final newline, too. For example:
perl -pe 's/\n//'; echo

perl -pe 's/\n//; END { print "\n" }'

A: You can remove all occurrences of characters from a given set with tr -d. To remove the newline character use:
tr -d '\n'

As always you can use input and output redirection and pipes to read from or write to files and other processes.
If you want to keep the last newline you can simply add it back with echo or printf '\n', e. g.:
cat file1 file2... | { tr -d '\n'; echo; } > output.txt

A: Many ways. To illustrate, I have saved your example in file:
$ cat file | tr -d '\n'
abcdefqwerty$
$ cat file | perl -pe 's/\n//'
abcdefqwerty$

That removes all newline characters, including the last one though. You might instead want to do:
$ printf "%s\n" "$(cat file | perl -pe 's/\n//')"
abcdefqwerty
$ printf "%s\n" "$(cat file | tr -d '\n')"
abcdefqwerty

A: Using shell-only way:
while IFS= read -r line || [ -n "$line" ]; do printf "%s"  "$line"; done < inputfile.txt

A: If you are using Bash, then you can do it without any external tool.
x=($(echo line1; echo line2))
echo "${x[@]}"

Result:
line1 line2

The first command turn multiline output into an array, the second command expand array into multiple arguments on one line.


text: Q: Candidate Elimination algorithm ordering list beneficial or not I need some help to understand a precondition with respect to the Candidate Elimination algorithm. If I order the list of training data that the negative entries at first my version space has fewer hypotheses. When I put the positive training data at the beginning the hypothesis room gets bigger. My assumption is based that the algorithm makes negative entries more specific and positive more general.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python magic * or ** method equivalent Is there a python method equivalent to * and ** magic?
So, what I mean by this is instead of doing:
a = (1,2,3)
method(*a)

Instead do something like:
a = (1,2,3)
method(remove_magic(a))

Whilst reading through code I see * and ** and just wish there was a nicer more readable way of doing this. I am hoping there is something within the python standard library which does this for me.

A: YES, THERE IS AN EQUIVALENT
Technically, you can use the builtin apply() function. According to the python docs:

The use of apply() is equivalent to function(*args, **keywords).

so you can do apply(function, args, keywords=None). (keywords is optional.)
BUT DON'T USE IT
On top of being non-idiomatic and confusing to more experienced programmers, this function has been deprecated and should not be used in new code:

Deprecated since version 2.3: Use function(*args, **keywords) instead of apply(function, args, keywords)

A: There is no way to make a function that does the same thing as * or **. You'd have to modify method itself. The reason is that the remove_magic function could return a tuple/list at best, but you already have one:
a = (1,2,3)
method(remove_magic(a))

A pythonic alternative might be to unpack the tuple and to pass the arguments explicitly:
a = (1, 2, 3)
x, y, z = a
method(x, y, z)

In Python 2.x, you can use apply, but I don't find it more legible. Its also not available in python 3.
apply(method, a)

The official reccomendation is to simply stick with
method(*a)


text:
Q: What is this blue rectangle thing for? How do i get rid of it?
I'm new to Android Studio have no idea what I'm doing. Just hit a course on Udemy and it doesn't have that weird blue square so how do I get rid of it?

A: It's called blueprint view. The first 3 buttons of the toolbar strip of the layout edit tab can switch between "design", "blueprint" and "design and blueprint".


text:
Q: How to solve below problem of Drawing Book Hackerrank problem Drawing Book.

Brie's Drawing teacher asks her class to open their books to a page number. Brie can either start turning pages from the front of the book or from the back of the book. She always turns pages one at a time. When she opens the book, page 1 is always on the right side:

When she flips to page 1, she sees pages 2 and 3. Each page except the last
  page will always be printed on both sides. The last page may only be
  printed on the front, given the length of the book. If the book is n
  pages long, and she wants to turn to page p, what is the minimum number
  of pages she will turn? She can start at the beginning or the end of
  the book.
Given n and p, find and print the minimum number of pages Brie must turn
  in order to arrive at page p.
Function Description
Complete the pageCount function in the editor below. It should return
  the minimum number of pages Brie must turn.
pageCount has the following parameter(s):

*

*n: the number of pages in the book

*p: the page number to turn to

Input Format
The first line contains an integer n, the number of pages in the book.
The second line contains an integer, p, the page that Brie's teacher wants her to turn to.

Constraints

Output Format
Print an integer denoting the minimum number of pages Brie must turn to get to page p.
Sample Input 0
6
2

Sample Output 0
1

Sample Input 1
5
4

Sample Output 1
0

===================================================

A: One should realize that 2 pages form a unit, using integer division by 2.
You did not utilize the remainder dropping integer division, where 12 / 7 == 1.
static int pagesTurnCount(int n, int p) {
    n /= 2; // >>= 1
    p /= 2;
    return Math.min(p, n - p); // From front, from back
}

       p
 0  >  1  <  2  <  3      page pairs
- 1   2 3   4 5   6 -     pages

The zero based programmer should be aware that that last index for double-pages
is indeed "the number of pages" n divided by 2.

A: Each time a page is turned 2 more pages get visible. So, it means that in the worst case the teacher needs n/2 turns to get from the first page to the last one. However, since she's also allowed to turn from the end of the book, she can do the worst case in n/4 flips.
So, if her page number is p <= n/2, then she needs p/2 flips, otherwise - n/2 - p/2 steps or just min(p/2, (n/2) - (p/2)):
uint32_t pageCount(uint32_t n, uint32_t p) {
    return std::min(p / 2, (n/2) - (p/2));
}

EDIT
Since a solution in JAVA is required I'm adding it here:
int pageCount(int n, int p) {
    return Math.min(p / 2, (n/2) - (p/2));
}

A: Javascript solution:
function pageCount(n, p) {
    var fromFront = Math.floor(p/2);
    var fromBack = (n%2 ===0 && p%2 !==0)? Math.floor((n-p)/2)+1 : Math.floor((n-p)/2);
    return fromFront>fromBack?fromBack:fromFront;
}

A: def pageCount(n, p):
    if p==n or p==1:
        c=0
    elif n%2!=0 and p==n-1:
        c=0
    else:
        if p%2==0:
            if n%2==0:
                c=min(p/2,(n-p)/2)
            else:
                c=min(p/2,(n-p-1)/2)
        else:
            if n%2==0:
                c=min((p-1)/2,(n-p+1)/2)
            else:
                c=min((p-1)/2,(n-p)/2)
return int(c)

A: Here's my solution to that
fun pageCount(n: Int, p: Int): Int {
    val pages = IntArray(n) { it }
    val pairs = mutableListOf<Pair<Int, Int>>()
    for (i in 0..n - 1 step 2) {
        val lastItem = if (pages[i] + 1 >= pages.size) 0 else 1
        pairs.add(pages[i] to pages[i + lastItem])
    }

    var forwardTurns = 0
    var backwardTurns = 0
    pairs.apply {
        this.forEach { pair ->
            if (pair.first == p || pair.second == p) return@apply else forwardTurns++
        }
    }
    for (i in pairs.size - 1 downTo 0) {
        if (pairs[i].first == p || pairs[i].second == p) break else backwardTurns++
    }
    return Math.min(forwardTurns, backwardTurns)
}

A: import java.io.*;
import java.util.*;
public class Solution {
private static int pageCount(int n, int p) {
return Math.min(p / 2, (n/2) - (p/2));
}
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
int p=sc.nextInt();
System.out.println(pageCount(n,p));
    }
}

A: Here's my Python3 solution to that
forward = 0
backward = 0
i, i_ = 0, 1

if n % 2 != 0:
    j, j_ = n-1, n
else:
    j, j_ = n, n+1

while p not in (i, i_, j, j_):
    i += 2
    i_ += 2
    forward += 1
    j -= 2
    j_ -= 2
    backward += 1

if backward < forward:
    return backward
else:
    return forward

A: simple python solution
def pageCount(n, p):
    back_val=0
    res=[i for i in range(n+1)]
    new=[res[i:i+2] for i in range(0,len(res),2)]

    for i in range(len(new)):
        if p in new[i]:
            front_val=i
        if p in new[::-1][i]:
            back_val=i
            print(back_val)

    return min([front_val,back_val])


text:
Q: SimpleDateFormat mmddyyyy returns improper data for month I want a timestamp field. I tried the below to get time in mmddyyyyhhmmss format.
All the fields give proper data but the month field has improper value.
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("mmddyyyyhhmmss");
String date = simpleDateFormat.format(new Date());

O/P I get is 13132013021331. What I expect is 03133013021331.

A: Your Month should be MM not mm
mm means Minutes

A:
SimpleDateFormat mmddyyyy returns improper data for month

coz your format for month is wrong.
it should be:
 new SimpleDateFormat("MMddyyyyhhmmss");
MM---> Month
mm---> minutes

A: You need this:
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMddyyyyhhmmss");
String date = simpleDateFormat.format(new Date());

You used "mm" twice - once for month (incorrect) and again for minutes (correct).


text:
Q: How to query a SQL Server backup file I am using SQL Server 2008 R2, I have a backup file B:\backups\full_backup.bak but I do not know what backups this file has or what files each back has. How can I write a query to restore a database from this backup file?
I have tried to restore database but it threw an error saying

Msg 3156, Level 16, State 4, Line 1
  File 'Application_Primary' cannot be restored to 'D:\Program Files\Microsoft SQL
  Server\MSSQL.1\MSSQL\Data\Application_Primary.mdf'. Use WITH MOVE to
  identify a valid location for the file.
Msg 3156, Level 16, State 4, Line 1
  File 'Application_FTS' cannot be restored to 'D:\Program Files\Microsoft SQL
  Server\MSSQL.1\MSSQL\Data\Application_FTS.mdf'. Use WITH MOVE to
  identify a valid location for the file.
Msg 3156, Level 16, State 4, Line 1
  File 'Application_Log' cannot be restored to 'L:\Program Files\Microsoft SQL
  Server\MSSQL.1\MSSQL\Data\Application_Log.ldf'. Use WITH MOVE to
  identify a valid location for the file.
Msg 3119, Level 16, State 1, Line 1
  Problems were identified while planning for the RESTORE statement. Previous messages provide details.
Msg 3013, Level 16, State 1, Line 1
  RESTORE DATABASE is terminating abnormally.

Code:
restore database Application_db
From disk = 'B:\backups\full_backup.bak'

A: It appears to me that you are trying to restore a backup which has a database backup from another server with some path stored for data file (.mdf,ldf).
You will need to restore the database using the MOVE clause. Just the RESTORE command will try to restore database to the paths of the database from where this backup was taken.
To Check what backups there are in a backup File
USE master;
GO

RESTORE HEADERONLY
FROM DISK = N'B:\backups\full_backup.bak'
GO

This will return the backups this backup file holds. You need to make sure what Position you backup file is at.
To Check what files are in a backup File
USE master;
GO

RESTORE FILELISTONLY
FROM DISK = N'B:\backups\full_backup.bak'
 WITH FILE = 1    --<-- Position of backup in the backup file
GO

This will return the files that particular backup has. You will need these file names for MOVE clause in your restore statement.
Restore Database
USE master;
GO

RESTORE DATABASE [Application_DB]
 FROM DISK = N'B:\backups\full_backup.bak'
WITH FILE = 1             --<-- position of database backup in the backup file
,MOVE N'Application_Primary' TO N'D:\<some valid path>\Application_Primary.mdf'
,MOVE N'Application_FTS'     TO N'D:\<some valid path>\Application_FTS.ndf'
,MOVE N'Application_Logy'    TO N'D:\<some valid path>\Application_Log.ldf'
,RECOVERY;

GO

A: You can restore HEADERONLY of the file to see exactly which backups it contains:
DECLARE @HeaderInfo table
  (
        BackupName  nvarchar(128),
        BackupDescription  nvarchar(255) ,
        BackupType  smallint ,
        ExpirationDate  datetime ,
        Compressed  bit ,
        Position  smallint ,
        DeviceType  tinyint ,
        UserName  nvarchar(128) ,
        ServerName  nvarchar(128) ,
        DatabaseName  nvarchar(128) ,
        DatabaseVersion  int ,
        DatabaseCreationDate  datetime ,
        BackupSize  numeric(20,0) ,
        FirstLSN  numeric(25,0) ,
        LastLSN  numeric(25,0) ,
        CheckpointLSN  numeric(25,0) ,
        DatabaseBackupLSN  numeric(25,0) ,
        BackupStartDate  datetime ,
        BackupFinishDate  datetime ,
        SortOrder  smallint ,
        CodePage  smallint ,
        UnicodeLocaleId  int ,
        UnicodeComparisonStyle  int ,
        CompatibilityLevel  tinyint ,
        SoftwareVendorId  int ,
        SoftwareVersionMajor  int ,
        SoftwareVersionMinor  int ,
        SoftwareVersionBuild  int ,
        MachineName  nvarchar(128) ,
        Flags  int ,
        BindingID  uniqueidentifier ,
        RecoveryForkID  uniqueidentifier ,
        Collation  nvarchar(128) ,
        FamilyGUID  uniqueidentifier ,
        HasBulkLoggedData  bit ,
        IsSnapshot  bit ,
        IsReadOnly  bit ,
        IsSingleUser  bit ,
        HasBackupChecksums  bit ,
        IsDamaged  bit ,
        BeginsLogChain  bit ,
        HasIncompleteMetaData  bit ,
        IsForceOffline  bit ,
        IsCopyOnly  bit ,
        FirstRecoveryForkID  uniqueidentifier ,
        ForkPointLSN  numeric(25,0) NULL,
        RecoveryModel  nvarchar(60) ,
        DifferentialBaseLSN  numeric(25,0) NULL,
        DifferentialBaseGUID  uniqueidentifier ,
        BackupTypeDescription  nvarchar(60) ,
        BackupSetGUID  uniqueidentifier NULL,
        CompressedBackupSize  numeric(20,0)
  )

 INSERT INTO @HeaderInfo EXEC('RESTORE HEADERONLY
 FROM DISK = N''B:\backups\full_backup.bak''
 WITH NOUNLOAD')

 SELECT * FROM @HeaderInfo

is case of the error: MSSQLServer creates database phisical files in the path of main database file which has been backed up unless you specify a new path for the database files with move command:
RESTORE DATABASE Application
   FROM DISK=N'B:\backups\full_backup.bak'
   WITH FILE 1,--use currect file number
   MOVE 'Application_Primary' TO 'C:\Application_Primary.mdf',
   MOVE 'Application_FTS' TO 'C:\Application_FTS.mdf',
   MOVE 'Application_Log' TO 'C:\Application_Log.ldf'


text:
Q: Glitchy screen when trying to install Ubuntu from USB The USB is brand new. i launched Ubuntu in safe graphics mode and the screen goes like this and then goes completely black.

I downloaded Rufus and Ubuntu 20.04 from their websites, then with Rufus copied Ubuntu to the USB then I cleaned the disk (Shift  while resetting computer -> solve problem -> system symbol -> and emptied the disk) then I turned off and on the computer and selected safe graphics from the GNU GRUB menu, I launched safe graphics because I was following a tutorial.
I turned off the PC and tried the no safe graphics mode and it works!


text:
Q: C language: why do these two printf statements print different things #include <stdio.h>
typedef struct {
    int data;
    char * string;
}Node;

Node * init(){
    Node node;
    node.data = 5;
    node.string = "hello";
    Node * point = &node;
    return point;
}
int main() {
    Node * test = init();
    printf("%d\n", test->data);
    printf("%d", test->data);
}

Why do the last two printf statements produce different results. I suspect is has something to do with how I assigned my test pointer, but I don't know how to fix it.

A: In your case, node is a variable local to the function init() and yet, you return the address of this. So, once the function is returned, there's no existence of node anymore.
After the function returns accessing the return value is accessing invalid memory which causes undefined behavior.
You can, however, return the structure variable itself, not a pointer to it and collect the return value in the caller in another variable, it'll work out.

A: Yes, your code has undefined behavior on account of returning a pointer to a function local object. But it seems your approach is misguided to begin with. Your init function is supposed to initialize a structure with a proper initial value, there's no need to return a pointer to do this. You have three options:

*

*Return by value, like another answer suggested.

*Pass the address of a structure for the function to initialize. This frees up the return value, so you can signal success or failure:
bool init(Node *node) { // must include stdbool.h
    if(!node)
      return false;

    node->data = 5;
    node->string = "hello";
    return true;
}

//...

Node test;
if(!init(&test)) {
  //failed to initialize, handle the error
}

*Forgo the function entirely and supply a macro that stands for the nodes initial value:
#define NODE_INIT_VAL { \
  .data = 5, .string = "hello", \
}

This allows you to simply write Node test = NODE_INIT_VAL;. It's also how you'd prefer to initialize any objects with static storage duration.

A: node is defined as local variable in the function init() so it's memory is freed after the function returns.
You should either define node as global variable (I don't like globals :-)) or allocate memory by calling malloc.
node = malloc(sizeof(Node));

Don't forget to free the memory if you no longer need node.

A: Update init() to return struct:
    Node init(){
    Node node;
    node.data = 5;
    node.string = "hello";
    return node;
}

then access it like the following :
Node testNode = init();
printf("%d\n", testNode.data);
printf("%d", testNode.data);

Or if you want to use pointer like this :
Node testNode = init();
Node* pointerToNode = &testNode;
printf("%d\n", pointerToNode->data);
printf("%d", pointerToNode->data);

And the reason for this is as @Sourav answered that the data will be no longer valid.
Hope this is useful.


text:
Q: How do I crop and resize images using C# back-end for my android application? I am developing an android application which requires users to upload few images and then crop and resize them to fit in design of a web application. I don't want to perform these operations on user device to avoid slugginess in application. Please recommend some server side API or library.

A: Try to take a look at Amend Library for Android(Java) and Amend Library for Android(C#) on GitHub. It is an awesome and on the fly image processing Solution.I have used it in multiple applications.It is very light weighted and support many image processing features through just one API call. Documentation is available at Amend Website. Also you can install the Amend package through Nuget from here.


text:
Q: Arquillian & Testcontainers: Invalid Oracle URL I'm trying to embed a Database-Testcontainer in an existing arquillian-test with embedded-glassfish as a container. I'm using a JNDI-datasource defined in a glassfish-resources.xml- and a persistence.xml-File. That's why I'm trying to use the JDBC-Proxy-Driver from testcontainers, which should become active when using jdbc:tc:XY as a URL.
glassfish-resources.xml:
<resources>
    <jdbc-resource pool-name="MyDs" jndi-name="jdbc/myds"/>
    <jdbc-connection-pool name="MyDs" res-type="javax.sql.XADataSource" datasource-classname="oracle.jdbc.xa.client.OracleXADataSource">
        <property name="user" value="user"/>
        <property name="password" value="password"/>
        <property name="url" value="jdbc:tc:oracle:thin:@localhost:55821:XE"/>
    </jdbc-connection-pool>
</resources>

But all I'm getting is: java.sql.SQLException: Ungültiger Oracle-URL angegeben. By debugging I could verify that ContainerDatabaseDriver is registered in DriverManager, but it seems that this has no effect?
Any ideas?
Here's the full Stacktrace, maybe it's useful:
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
Error Code: 0
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:815)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:183)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getDatabaseSession(EntityManagerFactoryImpl.java:528)
    at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:385)
    at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:207)
    at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:114)
    at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:225)
    at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:520)
    at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:240)
    at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:170)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:926)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:435)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:488)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
    at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:134)
    at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:110)
    at org.jboss.arquillian.container.glassfish.embedded_3_1.GlassFishContainer.deploy(GlassFishContainer.java:193)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:151)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:118)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:239)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:118)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
    at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createDeploymentContext(ContainerDeploymentContextHandler.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
    at org.jboss.arquillian.container.impl.client.ContainerDeploymentContextHandler.createContainerContext(ContainerDeploymentContextHandler.java:54)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
    at org.jboss.arquillian.container.impl.client.container.DeploymentExceptionHandler.verifyExpectedExceptionDuringDeploy(DeploymentExceptionHandler.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:92)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$1.perform(ContainerDeployController.java:77)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachDeployment(ContainerDeployController.java:232)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.forEachManagedDeployment(ContainerDeployController.java:212)
    at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deployManaged(ContainerDeployController.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
    at org.jboss.arquillian.core.impl.EventImpl.fire(EventImpl.java:62)
    at org.jboss.arquillian.container.test.impl.client.ContainerEventController.execute(ContainerEventController.java:96)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:103)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:90)
    at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
    at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:69)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:86)
    at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:95)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:133)
    at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:105)
    at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:89)
    at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:163)
    at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:350)
    at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:54)
    at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:177)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:115)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.3.v20160428-59c81c5): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
Error Code: 0
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:316)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:147)
    at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:346)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:309)
    at org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:434)
    at org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:217)
    at org.eclipse.persistence.sessions.server.ExternalConnectionPool.startUp(ExternalConnectionPool.java:146)
    at org.eclipse.persistence.sessions.server.ServerSession.connect(ServerSession.java:488)
    at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.login(DatabaseSessionImpl.java:774)
    at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:267)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:731)
    ... 118 more
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:121)
    at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:135)
    ... 128 more
Caused by: javax.resource.spi.ResourceAllocationException: Error in allocating a connection. Cause: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:319)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:196)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:171)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:166)
    at com.sun.gjc.spi.base.AbstractDataSource.getConnection(AbstractDataSource.java:115)
    ... 129 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:103)
    at com.sun.enterprise.resource.pool.ConnectionPool.addResource(ConnectionPool.java:282)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResourceAndAddToPool(ConnectionPool.java:1512)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResources(ConnectionPool.java:944)
    at com.sun.enterprise.resource.pool.ConnectionPool.initPool(ConnectionPool.java:230)
    at com.sun.enterprise.resource.pool.ConnectionPool.internalGetResource(ConnectionPool.java:511)
    at com.sun.enterprise.resource.pool.ConnectionPool.getResource(ConnectionPool.java:381)
    at com.sun.enterprise.resource.pool.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:244)
    at com.sun.enterprise.resource.pool.PoolManagerImpl.getResource(PoolManagerImpl.java:171)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.getResource(ConnectionManagerImpl.java:354)
    at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:307)
    ... 133 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:924)
    at com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1189)
    at com.sun.enterprise.resource.pool.datastructure.RWLockDataStructure.addResource(RWLockDataStructure.java:98)
    ... 143 more
Caused by: com.sun.appserv.connectors.internal.api.PoolingException: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:181)
    at com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:907)
    ... 145 more
Caused by: javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: Ungültiger Oracle-URL angegeben
    at com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:133)
    at com.sun.enterprise.resource.allocator.ConnectorAllocator.createResource(ConnectorAllocator.java:161)
    ... 146 more
Caused by: java.sql.SQLException: Ungültiger Oracle-URL angegeben
    at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:286)
    at oracle.jdbc.xa.client.OracleXADataSource.getPooledConnection(OracleXADataSource.java:511)
    at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:156)
    at oracle.jdbc.xa.client.OracleXADataSource.getXAConnection(OracleXADataSource.java:101)
    at com.sun.gjc.spi.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:119)
    ... 147 more


text:
Q: How to create a list from a for-loop I am trying to create a list of numbers from a function and a for-loop. Here is a copy of my code:
Rh = 1096776000000

print "What is your value for 'n'?"
n = float(raw_input(">"))

m = range(int(n+1), int(n+21))

def wavelength(a,b):
    list = [((1 / (Rh * ((1 / (a**2)) - (1 / (float(x)**2))))) * 10 ** 14)
    for x in b]
    return list

for elements in wavelength(n,m):
    print "%.3f" % elements, 'nm'

This will print out what I want, but I need to take all of the data points and put them into a list. Any ideas?

A: I guess you're in need of something like this:
l = [] # An empty list
for elements in wavelength(n,m):
    l.append("%.3f" % elements, 'nm') # Adding rounded values to the list
print l # Print the full list

A: results = ["%.3f nm" % elements for elements in wavelength(n,m)]


text:
Q: How to make tesseract recognize number 0 with open top right corner which is included in EU plates? I have this character image:

This Image of 0 is similar to ones found in some eu plate cars. for example this image:

How to make tesseract (if possible) to recognise the 0 in the image as 0 in python or any other language? Currently on its on it is recognize it as u. Of-course if I croped the 0 and the 2 together is recognises them as digits (0 2) as there is nothing else but I want to recognize every single character where any general plate can have any number of characters in any order. Do I need to retrain tesseract? Thank you.

A: I used the trained font (tesseract) from this git repository:
https://github.com/openalpr/openalpr/tree/master/runtime_data/ocr/tessdata
They have trained data for various car plates and use can use any of them for your plate OCR.


text:
Q: Winforms MVP show mdi child form Guys i have problem with MVP design pattern becouse am not shure how can i show child view in parent form.
My view does not have MdiParent property. Can i manually create it in view interface?
Very ugly look to every form opens in a new window!
I have two presenters:

*

*MainPresenter (represent mainForm(parent) logic)

*TaskPresenter (represent logic for save,insert,delete logic)

Two View interfaces:

*

*IMainView

*ITaskView

And two winforms:

*

*MainForm - mainwindow(parrent mdi form)

*TaskForm

Check code:
MainPresenter
public class MainPresenter
{
    private readonly IMainView view;

    private List<ITaskModel> tasks;

    // Constructor
    public MainPresenter(IMainView view)
    {
        this.view = view;
        this.Init();
        this.tasks = new List<ITaskModel>();
    }

    // Initialize
    private void Init()
    {
        this.view.AddTask += AddTask;
    }

    // Add task
    private void AddTask(object sender, EventArgs e)
    {
        // Show as MDI CHILD
    }
}

IMainView
  public interface IMainView
  {
        event EventHandler<EventArgs> AddTask;
  }

TaskPresenter
public class TaskPresenter
{
    private readonly ITaskView view;
    private List<ITaskModel> tasks;

    private bool isNew = true;
    private int currentIndex = 0;

    // Constructor
    public TaskPresenter(ITaskView view)
    {
        this.view = view;
        this.Initialize();
    }

    // Initialize
    public void Initialize()
    {
        tasks = new List<ITaskModel>();

        view.SaveTask += Save;
        view.NewTask += New;
        view.PrevTask += Previous;
        view.NextTask += Next;
    }

    private void Save(object sender, EventArgs e)
    {
    }
    private void New(object sender, EventArgs e)
    {
    }
    private void Next(object sender, EventArgs e)
    {
    }
    private void Previous(object sender, EventArgs e)
    {
    }
    private void BlankTask()
    {
    }
    private void LoadTask(ITaskModel task)
    {
    }
}

ITaskView
public interface ITaskView
{
    String TaskName { get; set; }
    String TaskPriority { get; set; }
    DateTime? StartDate { get; set; }
    DateTime? DuoDate { get; set; }

    event EventHandler<EventArgs> SaveTask;
    event EventHandler<EventArgs> NewTask;
    event EventHandler<EventArgs> NextTask;
    event EventHandler<EventArgs> PrevTask;
}

And here is MainForm
public partial class MainForm : Form, IMainView
{
    MainPresenter Presenter;

    // Construcor
    public MainForm()
    {
        InitializeComponent();
    }

    // Events
    public event EventHandler<EventArgs> AddTask;

    // On load
    private void MainForm_Load(object sender, EventArgs e)
    {
        Presenter = new MainPresenter(this);
    }

    // On click add task btn
    private void addTaskBtn_Click(object sender, EventArgs e)
    {
        if(AddTask != null)
        {
            // When is this event triggered i want to show another child form for adding new task
            AddTask(this, EventArgs.Empty);
        }
    }
}

So how can i show TaskView as child in MainView?

A: UIApplication it is Windows Forms Application but output type Class Library.
Add referance MVPFramework
MainForm
public partial class MainForm : Form , IMainView
{
    [Resolve]
    public IMainControl mainControl;

    public MainForm()
    {
        InitializeComponent();
    }

    public bool ShowAsDialog()
    {
        throw new NotImplementedException();
    }

    private void openChildFormToolStripMenuItem_Click(object sender, EventArgs e)
    {
        mainControl.OnOpenChildForm();
    }
}

Child Form
public partial class ChildForm : Form , IChildView
    {
        public ChildForm()
        {
            InitializeComponent();
        }

        public bool ShowAsDialog()
        {
            throw new NotImplementedException();
        }

        public object MDIparent
        {
            set
            {
                this.MdiParent = (Form)value;
            }
        }
    }

CoreApplication it is class Library
IMainControl
 public interface  IMainControl :IControl
  {
      void OnOpenChildForm();
  }

MainControl
public class MainControl  :IMainControl
    {
        [Resolve]
      public IApplicationController applicationController;
      public void OnOpenChildForm()
      {
       IChildControl TransfersOnTheWayControl = applicationController.Resolve<IChildControl>();
       TransfersOnTheWayControl.Run();
      }
    }

IChildControl
 public interface IChildControl :IControl
      {
         void Run();
      }

IMainView
public interface  IMainView :IView
{

}

IChildView
public interface  IChildView :IView
      {
      bool ShowAsDialog();`enter code here`

      object MDIparent { set; }
  }

IMainPresenter
public interface  IMainPresenter :IPresenter
 {

 }

IChildPresenter
public interface  IChildPresenter :IPresenter
 {
   bool Ask();
 }

MainPresenter
public class MainPresenter :BasePresenter<IMainView>, IMainPresenter
 {

 }

ChildPresenter
public class ChildPresenter : BasePresenter<IChildView>, IChildPresenter
    {

       public bool Ask()
       {
            this.Init();
            bool res = View.ShowAsDialog();
            ApplicationController.ClearInstance<IChildView>();
            return res;
       }

        public override void Init()
        {
            View.MDIparent = ApplicationController.GetMainFrom<IMainPresenter>();
            base.Init();
        }
    }

LauncherApplication it is Console Application but output type Windows Form.
 class Program
        {
            static void Main(string[] args)
            {
                IApplicationController applicationController = new ApplicationController(new ServicesContainerAdapter());

                applicationController

                    //RegisterView
                    .RegisterView<IMainView, MainForm>()
                    .RegisterView<IChildView, ChildForm>()

                    //RegisterPresenter
                    .RegisterPresenter<IMainPresenter, MainPresenter>()
                    .RegisterPresenter<IChildPresenter, ChildPresenter>()

                    //RegisterController
                    .RegisterController<IMainControl, MainControl>()
                    .RegisterController<IChildControl, ChildControl>();

                IMainPresenter mainPresenter = applicationController.Resolve<IMainPresenter>();
                mainPresenter.Init();

                Application.Run((Form)mainPresenter.FormObject);
            }
       }


text:
Q: Windsor & NServiceBus I'm going to use NServiceBus and I'd like to use Windsor as "Builder"
I read a lot of posts in the past about bugs & incompatiblity concerning handler creation vs lifestyle.
I also read about fixing and new releases.
I'd like to be advised about the status of the integration.
Which are the builds (NServiceBus / Windsor) that are going along well?
Is http://nuget.org/packages/NServiceBus.CastleWindsor/3.3.5 a good and stable start?
Is there any contrib sample to use those 2 guys within a MVC3 project?
Thanks a lot.

A: Yes, http://nuget.org/packages/NServiceBus.CastleWindsor/3.3.5 is the latest stable version of Windsor + NServiceBus integration, this package was tested against Castle.Windsor v3.0.0.4001
Using NServiceBus + Windsor in a MVC3 project should be pretty easy, see this sample as a starting point.
All you should need to do is reference the nuget package and change in the Global.asax.cs the Application_Start() to use the Windsor container, for example:
protected void Application_Start()
{
    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);

    // NServiceBus configuration
    Configure.WithWeb()
        .CastleWindsorBuilder()
        .ForMvc()
        .JsonSerializer()
        .Log4Net()
        .MsmqTransport()
            .IsTransactional(false)
            .PurgeOnStartup(true)
        .UnicastBus()
            .ImpersonateSender(false)
        .CreateBus()
        .Start(() => Configure.Instance.ForInstallationOn<NServiceBus.Installation.Environments.Windows>().Install());
}


text:
Q: Adding footers to posts? I'm trying to add footers to the end of my posts. I need to be able to assign different footers to different posts (not globally).
I tried using WP Post Footer, but it's not working on WP 3.1.2.

A: Here is a quick solution for you:
on the page or post you want to add a post footer create a new custom field named post_footer and in the value add the footer content.
then paste this code in your theme's functions.php file
add_filter('the_content',`my_post_footer`,99);
function my_post_footer($content){
   global $post;
   $footer = get_post_meta($post->ID,'post_footer',true);
   if ($footer){
      return $content . $footer;
   }
   return $content
}

and you are done!
This way you can have different footers on each page/post and none at all if you don't want it.

A: Was able to get WP Post Footer working.  The online instructions at WP Plugin page is missing an instruction (found it in the readme in the zip pkg).
Need to add the following line to the Single.php module for the theme you are using:
<?php if (function_exists('wp_post_footer')) wp_post_footer(); ?>

A: Anything you add, inside the Loop, but after the call to either the_content() or the_excerpt(), will, in essence, be a Post "footer".
Say you have:
<div <?php post_class(); ?>

<?php the_title(); ?>

          <?php the_content(); ?>

You could do something like this:
<div <?php post_class(); ?>

<?php the_title(); ?>

          <?php the_content(); ?>

Hello! I'm a Post Footer!

To give specific instruction, we'll need to know what Theme you're using.

A: Someone may have a more elegant solution, but if you're comfortable editing some of the template files, you can copy your footer.php and rename to footer-alt.php or whatever suits you. Make the changes you need, and in the template file you're using for the specific post-type, replace <?php get_footer(); ?> with <?php include("footer-alt.php"); ?>
If you keep the div and class names the same, you should not have any issues with the layout.
Cheers!


text:
Q: C# XNA SpriteBatch is null? Hey guys I really need some help here my spriteBatch keeps returning a NullReference Exception and I don't know what I am doing wrong!? (I am making a brickbreaker game) and whenever my bricks are created inside Game1.cs it works fine but when I move it to Wall.cs (which is where I want to display a pattern of bricks) the game just crashes and gives a NullReference exception. Heres my code:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace BrickBreaker
{
    /// <summary>
    /// This is the main type for your game
    /// </summary>
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        private Paddle paddle;
        private Ball ball;
        private Texture2D background;
        private static int screenWidth = 750;
        private static int screenHeight = 600;
        private int leftBorder = 20;
        private int rightBorder = 28;
        private int topBorder = 20;
        private readonly int normalBrickResist = 2;
        private readonly int normalBrickPoints = 10;
        private Wall wall;

        //DELETE this shit
        private Brick brick;

        /// <summary>
        /// Contructor for the Game1 class.
        /// </summary>
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        /// <summary>
        /// Read only property for the screen height.
        /// </summary>
        public static int ScreenHeight
        {
            get { return screenHeight; }
        }

        /// <summary>
        /// Read only property for the screen width.
        /// </summary>
        public static int ScreenWidth
        {
            get { return screenWidth; }
        }

        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize() will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.PreferredBackBufferWidth = screenWidth;
            graphics.ApplyChanges();

            paddle = new Paddle(this);
            Components.Add(paddle);

            wall = new Wall(this);
            Components.Add(wall);

            ball = new Ball(this, paddle, leftBorder, rightBorder, topBorder, brick);
            Components.Add(ball);

            base.Initialize();
        }

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            background = Content.Load<Texture2D>("background");
        }

        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            // TODO: Unload any non ContentManager content here
        }

        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            base.Update(gameTime);
        }

        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();
            Vector2 position = new Vector2(0, 0);
            spriteBatch.Draw(background, position, Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

        public void RemoveComponent(IGameComponent obj)
        {
            this.Components.Remove(obj);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace BrickBreaker
{

    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Wall : Microsoft.Xna.Framework.DrawableGameComponent
    {
        private Brick brick;
        private Brick[,] brickLayout = new Brick[5, 8];
        private Game game;
        SpriteBatch spriteBatch;
        private Texture2D brickImg;

        public Wall(Game game)
            : base(game)
        {
            this.game = game;
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {
            foreach (var item in brickLayout)
            {
                if (item != null)
                {
                    item.Draw(gameTime);
                }

            }

            base.Draw(gameTime);
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            foreach (Brick item in brickLayout)
            {
                item.Update(gameTime);
            }

            base.Update(gameTime);
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here
            foreach (var item in brickLayout)
            {
                if (item != null)
                {
                    item.Initialize();
                }
            }
            base.Initialize();
        }

        protected override void LoadContent()
        {

            int x = 0;
            int y = 0;
            Vector2 startPosition;
            for (int i = 0; i < brickLayout.GetLength(0); i++)
            {
                for (int j = 0; j < brickLayout.GetLength(1); j++)
                {
                    startPosition = new Vector2(x, y);
                    brickLayout[i, j] = new Brick(game, 20, 1, startPosition);
                    x += 20;
                }
                y += 20;
            }

            base.LoadContent();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace BrickBreaker
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Brick : Microsoft.Xna.Framework.DrawableGameComponent
    {
        enum brickType
        {
            Regular1,
            Regular2,
            Regular3,
            Regular4,
            Regular5,
            PowerUp,
            Unbreakable
        }

        private Texture2D brick;
        private SpriteBatch spriteBatch;
        private Game game;
        private int brickValue;
        private Vector2 startPosition, position;
        private Rectangle collisionBox;
        private int brickWidth;
        private bool isBroken = false;
        private int resistance;

        public Brick(Game game, int brickValue, int resistance, Vector2 startPosition)
            : base(game)
        {
            this.brickValue = brickValue;
            this.game = game;
            this.resistance = resistance;
            this.startPosition = startPosition;
        }

        public Boolean IsBroken
        {
            get
            {
                return this.isBroken;
            }
            set
            {
                this.isBroken = value;
            }
        }

        /// <summary>
        /// Property for the paddle collision box.
        /// </summary>
        public Rectangle CollisionBox
        {
            get { return collisionBox; }
        }

        /// <summary>
        /// Read only property for the paddle width.
        /// </summary>
        public int BrickWidth
        {
            get { return brickWidth; }
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            // TODO: Add your update code here

            base.Update(gameTime);
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Draw(GameTime gameTime)
        {

            if (isBroken == false)
            {
                spriteBatch.Begin();
                spriteBatch.Draw(brick, this.position, Color.White);
                spriteBatch.End();
            }

            base.Draw(gameTime);
        }

        /// <summary>
        /// Comment
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            brick = game.Content.Load<Texture2D>("brick");

            collisionBox = new Rectangle(0, 0, brick.Width, brick.Height);

            position = startPosition;
            collisionBox.X = (int)position.X;
            collisionBox.Y = (int)position.Y;

            base.LoadContent();
        }

        public void TakeHit()
        {
            resistance--;

            if (resistance == 0)
                IsBroken = true;

        }

    }
}

Edit: Fixed the old problem by adding this in wall.cs
   for (int i = 0; i < brickLayout.GetLength(0); i++)
    {
        for (int j = 0; j < brickLayout.GetLength(1); j++)
        {
            startPosition = new Vector2(x, y);
            brickLayout[i, j] = new Brick(game, 20, 1, startPosition);
            //Added this line:
            brickLayout[i, j].Initialize();
            x += 45;
        }
        x = 150;
        y += 25;
    }

BUT now the collision box isn't working at all.

A: Look closer at your Brick class.  In your wall class you're not initializing spriteBatch, and you're not calling Begin and End
Your LoadContent method needs this:
spriteBatch = new SpriteBatch(GraphicsDevice);

And you need to be sure to call this is your Draw method:
spriteBatch.Begin();

and
spriteBatch.End();

EDIT: You're never calling LoadContent on your brick class which is why spriteBatch never gets initialized.  Try:
    protected override void LoadContent()
    {

        int x = 0;
        int y = 0;
        Vector2 startPosition;
        for (int i = 0; i < brickLayout.GetLength(0); i++)
        {
            for (int j = 0; j < brickLayout.GetLength(1); j++)
            {
                startPosition = new Vector2(x, y);
                brickLayout[i, j] = new Brick(game, 20, 1, startPosition);
                // This new line...
                brickLayout[i, j].LoadContent();
                x += 20;
            }
            y += 20;
        }

        base.LoadContent();
    }

A: It's giving NullReferenceException in the Brick class at the SpriteBatch.Begin() line in the Draw method.


text:
Q: Swift Generic types Hi I am new to swift and writing iOS application.
I would like to know how can I better use generics to pass my result data.
I have one delegate which gives data of person from server
protocol PersonDataProvider {
    func dataReceived(_ result: PersonResult)
}

Result can have success and fail status through enumeration.
enum PersonResult {
    case success
    case networkFailed
}

Below class calls server api and fetch data, passes back
class MyNetworkClass {

    var personDataProvider: PersonDataProvider
    func getDataFromServer() {
        personDataProvider.dataReceived(.success)
    }
}

Below is viewcontroller where i subscribe provider
class MyViewController: PersonDataProvider {

    func dataReceived(_ result: PersonResult) {

        switch result {
        case .success:
            print("success")

        case .networkFailed:
            print("no network")

        }
    }

}

Now, I would like send extra information with success block which can be anything like below data model. It may have any type.
class Employer:Person {
    let id
    let salary
}

class Student:Person {
    let id
    let rollNumber
}

How can I achieve that? Can i define associate type in protocol and achieve if yes how?
How can I subscriber "MyViewController" of "PersonDataProvider" can define type of result he expects from "success" block?

A: Use an associated value as part of the .success case.
Let's say you have a superclass Person for your types of people. Then define your enum like this:
enum PersonResult {
    case success(Person)
    case networkFailed
}

Now when you hand back a .success value you must supply a Person to go with it:
func getDataFromServer() {
    let person = Student.init(...) // initialize, or fetch, or whatever
    personDataProvider.dataReceived(.success(person))
}

Here is a complete fake example that mocks up the whole thing; you'll have to change the details, but the point is, this compiles:
enum PersonResult {
    case success(Person)
    case networkFailed
}
protocol PersonDataProvider {
    func dataReceived(_ result: PersonResult)
}
class MyNetworkClass {
    var personDataProvider: PersonDataProvider!
    func getDataFromServer() {
        let person = Student.init(id: 3, rollNumber: 10)
        personDataProvider.dataReceived(.success(person))
    }
}
class Person {}
class Employer:Person {
    let id : Int
    let salary : Int
    init(id:Int, salary:Int) {
        self.id = id; self.salary = salary
    }
}
class Student:Person {
    let id : Int
    let rollNumber : Int
    init(id:Int, rollNumber:Int) {
        self.id = id; self.rollNumber = rollNumber
    }
}

A: You have to move away from delegation pattern to achieve something like what you want. Instead you will need a generic enum of Result type and your networking class which is generic to your data model type.
enum Result<T> {
    case success(T)
    case networkFailed
}

class MyNetworkClass<T: Person> {
    func getDataFromServer(completion: @escaping (Result<T>)-> Void) {
        // here goes your implementation (data fetching)
        // for demonstration purpose I just initialized object
        if let student = Student(id: 112233, rollNumber: 25) as? T {
            completion(Result.success(student))
        } else if let employer = Employer(id: 445566, salary: 5200) as? T {
            completion(Result.success(employer))
        } else {
            completion(Result.networkFailed)
        }
    }
}

Then your usage would be:
MyNetworkClass().getDataFromServer { (result: Result<Student>) in // you can also use Employer type
    switch result {
    case .success(let student):
        print(student.id)
    case .networkFailed:
        print("Error")
    }
}


text:
Q: Example of multi label, multi class(multi output) RandomForest & Nearest Neighbor in scikit-learn? could someone post a basic example of what a multi output, multi class  RandomForest Classifier and Nearest Neighbor algorithm looks like?  They are supported out of the box, but I do not know how to use them as the docs are too abstract to me.
Essentially, what do I have to do to access the multilabel properties of the classifer?  I already have my Y labels in a list() format as shown below. I have also transformed my labels:
from sklearn.preprocessing import MultiLabelBinarizer
mlb = MultiLabelBinarizer()
YC = mlb.fit_transform(df['combined_atc'].astype(str))

Dataset snippet:
X1   X2     X3        Y
red  NaN    NaN       [candy, pen]
red  green  blue      [clown, rainbow]
red  yellow NaN       [sun, car, shirt]
yello pink  black     [shirt, car]

As long as I can predict one of the items in Y, I'm "correct".
So if I had an X1 of "red" then if I said "candy" or "pen" or "candy and pen" then I'm correct. There is no inherent ordering and it wouldn't matter.
Is this a multiple label, multiple class problem?  What would be the ideal algorithm to use here? Anything out of the box support my use case?
import pandas
from sklearn import model_selection
from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(n_jobs=2)#use 2 cores
seed=7
max_features = 'auto'
num_trees = 2

kfold = model_selection.KFold(n_splits=3, random_state=seed)

model = RandomForestClassifier(n_estimators=num_trees,
max_features=max_features, verbose=1)

results = model_selection.cross_val_score(model, X, YC, cv=kfold)
print(results.mean())

A: The problem you presented is indeed a multi-label multi-class problem. In scikit-learn, Decision Trees, Random Forests, Nearest Neighbors support mulit-label multi-class problems out-of-the-box.
Other approach would be to build a model for every unique label in your dataset. Thus converting the problem to a binary classification problem for each label.
If you want to create a custom evaluation function as you mentioned you can use metrics.make_scorer


text:
Q: how to change the color of column in chart ? I am making a skacked column chart using highchart library .
can we change the color of chart ..? There is three color display (blue, black ,green)..Is there way to change the default color like (yellow,pink,red )
I need to change the color of column ?
fiddle
http://jsfiddle.net/cr91t8wj/
$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Stacked column chart'
        },
        xAxis: {
            categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Total fruit consumption'
            },
            stackLabels: {
                enabled: true,
                style: {
                    fontWeight: 'bold',
                    color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
                }
            }
        },
        legend: {
            align: 'right',
            x: -30,
            verticalAlign: 'top',
            y: 25,
            floating: true,
            backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
            borderColor: '#CCC',
            borderWidth: 1,
            shadow: false
        },
        tooltip: {
            headerFormat: '{point.x}
',
            pointFormat: '{series.name}: {point.y}
Total: {point.stackTotal}'
        },
        plotOptions: {
            column: {
                stacking: 'normal',
                dataLabels: {
                    enabled: true,
                    color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                    style: {
                        textShadow: '0 0 3px black'
                    }
                }
            }
        },
        series: [{
            name: 'John',
            data: [5, 3, 4, 7, 2]
        }, {
            name: 'Jane',
            data: [2, 2, 3, 2, 1]
        }, {
            name: 'Joe',
            data: [3, 4, 4, 2, 5]
        }]
    });
});

A: Specify a colour with the data like so:
name: 'Joe',
data: [3, 4, 4, 2, 5],
color: '#FF0000'


text:
Q: How to Fix JUnit Allure Issue? I'm dealing with a test task to build some JUnit tests upon numbers in a .txt file. The project is built in Maven, i use Win7 and Idea 2016.1.1.
Also I have to export results to Yandex Allure with values from .txt as test parameters.
The problem is that when i perform an unsuccessful test, the report is not generated despite it works ok when the test is successful.
I'm totally stuck, spent 4 or 5 hours trying to solve it.
Please tell me what do i do wrong?
Here is the POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>Tel</groupId>
    <artifactId>Entry_Task</artifactId>
    <version>1.0-SNAPSHOT</version>
    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>ru.yandex.qatools.allure</groupId>
                <artifactId>allure-maven-plugin</artifactId>
                <version>${allure-maven-plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>
    <properties>
        <allure-junit-adaptor.version>1.4.23</allure-junit-adaptor.version>
        <aspectj.version>1.7.4</aspectj.version>
        <allure-maven-plugin.version>2.5</allure-maven-plugin.version>
        <maven-surefire-plugin.version>2.18</maven-surefire-plugin.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <argLine>
                        -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar
                    </argLine>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
                        </property>
                    </properties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjweaver</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>ru.yandex.qatools.allure</groupId>
            <artifactId>allure-junit-adaptor</artifactId>
            <version>${allure-junit-adaptor.version}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

Test file:
import org.junit.Assert;
import org.junit.Test;

public class TestLine_001 extends Assert {
    @Test
    public void factorial() {
        assertTrue("z"=="p");
    }
}

Error:
"C:\Program Files\Java\jdk1.8.0_66\bin\java" -Dmaven.multiModuleProjectDirectory=D:\Users\Stas\IdeaProjects\SBT_Entry_Task "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.1\plugins\maven\lib\apache-maven-3.3.9" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.1\plugins\maven\lib\apache-maven-3.3.9\bin\m2.conf" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.1\plugins\maven\lib\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2016.1.1 clean test site
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Entry_Task 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Entry_Task ---
[INFO] Deleting D:\Users\Stas\IdeaProjects\SBT_Entry_Task\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Entry_Task ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Entry_Task ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\Users\Stas\IdeaProjects\SBT_Entry_Task\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Entry_Task ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Users\Stas\IdeaProjects\SBT_Entry_Task\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Entry_Task ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\Users\Stas\IdeaProjects\SBT_Entry_Task\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.18:test (default-test) @ Entry_Task ---
[INFO] Surefire report directory: D:\Users\Stas\IdeaProjects\SBT_Entry_Task\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Running TestLine_001
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.258 sec <<< FAILURE! - in TestLine_001
factorial(TestLine_001)  Time elapsed: 0.204 sec  <<< FAILURE!
java.lang.AssertionError: null
    at org.junit.Assert.fail(Assert.java:86)
    at org.junit.Assert.assertTrue(Assert.java:41)
    at org.junit.Assert.assertTrue(Assert.java:52)
    at TestLine_001.factorial(TestLine_001.java:7)

Results :

Failed tests:
  TestLine_001.factorial:7->Assert.assertTrue:52->Assert.assertTrue:41->Assert.fail:86 null

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.789 s
[INFO] Finished at: 2016-04-02T14:00:03+06:00
[INFO] Final Memory: 18M/255M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test (default-test) on project Entry_Task: There are test failures.
[ERROR]
[ERROR] Please refer to D:\Users\Stas\IdeaProjects\SBT_Entry_Task\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] Maven execution terminated abnormally (exit code 1)

A: I guess it is Maven feature - when you run several goals it stops on first failure (which usually makes sense, e.g. "mvn clean install").
Just run goals separately:
mvn clean test
mvn site

A: Just add
<testFailureIgnore>true</testFailureIgnore>

to maven-surefire-plugin config
<groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-surefire-plugin</artifactId>
     <version>${maven-surefire-plugin.version}</version>
     <configuration>
           <testFailureIgnore>true</testFailureIgnore>
           <argLine>....


text:
Q: How do I share the MySQL server running on Ubuntu under Docker with a Windows PC? I have MySQL server running on Ubuntu 18.04 under Docker. I have a need to load a MySQL debugger (dbForge Studio) to develop a complex stored proc. dbForge Studio only runs under Windows 10. I found a Windows 10 PC on my network and loaded dbForge Studio.
When I try to connect from the Win PC to the MySQL server (on Ubuntu) I get error 10061, can't connect.
How do I accomplish this connection?
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.XX.0.1  netmask 255.255.0.0  broadcast 172.XX.255.255
        ether 02:42:e5:9e:83:17  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Here is my definition of mysql in the docker-compose:
mysql:
    container_name: "mysql"
    restart: unless-stopped
    image: mysql:5.7
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --sql_mode='' --general-log=1
    environment:
      - MYSQL_DATABASE
      - MYSQL_PASSWORD
      - MYSQL_ROOT_PASSWORD
      - MYSQL_USER
    volumes:
      - data:/var/lib/mysql
      - ./mysql/mysql.sql:/docker-entrypoint-initdb.d/mysql.sql
    ports:
      - "3306:3306"
    networks:
      - net

A: Error 10061 means the network connection has been refused and this would happen under only two circumstances:

*

*The firewall is blocking access

*You're trying to connect as root
For the first issue, you'll need to confirm that the Docker container is listening for external traffic on 3306 and that the my.conf file has a binding to 0.0.0.0 rather than the default 127.0.0.1.
For the second option, don't connect as root. Create an account with GRANT ALL ON *.* WITH GRANT OPTION to essentially give that account the same permissions as root.
Hope this points you in the right direction


text:
Q: Bar graph code works, but results in error when trying to knit to flexdashboard or rnotebook Here is the error I'm receiving when I try to knit to a flexdashboard/rnotebook:

Error in match.arg(method) : 'arg' must be NULL or a character vector calls:  ... withVisible -> eval -> ggplot -> filter -> match.arg Execution halted.

title: "Untitled"
output:
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill

```{r setup, include=FALSE}
library("flexdashboard")
library("ggplot2")
load("K:/Research/Jamie/R/#6/stl7172.Rda")```

Column {data-width=333}
-----------------------------------------------------------------------

### Chart A

```{r}
ggplot(data= filter(stl7172, SEX == "Male" | SEX == "Female", stl7172$MET2013 == "STL_MSA"),
         aes(x = SEX, y = INCTOT, fill = RACE)) +
  geom_bar(stat = "summary", position= position_dodge(), width = .9) +
  labs(
    title="Mean Income Level for Workers in the Leisure & Hospitality Industry",
    subtitle= "(St. Louis MSA, by race and sex)",
    caption = "(Source: IPUMS)")


text:
Q: Adding values to an array of undefined size I have researched and tried for hours to solve my problem, but the reality is that I can't find anything on it. It is simple really. I need to initialize java arrays of undefined size, and then compare the two. In the process of testing my program, when I have defined the array to a specific length (for example)
int[] array = new int[6];

the code waits until I have entered the six objects to move on to the next segment of code, because it is waiting for 6 integers as defined as the array length. But I can't define the array using
int[] array = {};

it obviously won't work, since array.length function will be 0.
My code is below.
import java.util.Scanner;
import java.util.Arrays;
public class Test {
    public static void main(String[] args){

        Scanner input = new Scanner(System.in);

        // My problem is in the definition of the arrays or the for loops defining them below.
        int[] list1 = new int[]; // undefined
        int[] list2 = new int[]; // undefined
        // ask user to fill the two arrays to see if they are equal
        System.out.print("Enter list one >> ");

        for (int i = 0; i < list1.length; i++){
            list1[i] = input.nextInt();
        }

        System.out.print("Enter list two >> ");

        for (int i = 0; i < list2.length; i++){
            list2[i] = input.nextInt();
        }

        // call the equality testing method and output whether or not the two lists are strictly identical or not.
        if (equals(list1, list2) == true)
            System.out.println("The two lists are strictly identical");
        else
            System.out.println("The two lists are not strictly identical");

    }

    // this method
    public static boolean equals(int[] list1, int[] list2){
        boolean bool = false;
        if (Arrays.equals(list1, list2))
            bool = true;
        else
            bool = false;

        return bool;
    }
}

A:
I need to initialize java arrays of undefined size,

You need to use an ArrayList or ask the length at the start.
List<Integer> list1 = new ArrayList<>();
System.out.println("Enter numbers, with a blank line to end");
for (String line; !(line = input.nextLine()).trim().isEmpty(); ) {
     list1.add(Integer.parseInt(line));
}

// later
if (list1.equals(list2))

or use an array
System.out.println("Enter the number of numbers, followed by the numbers");
int[] array1 = new int[input.nextInt()]; // enter the size first.
for (int i = 0; i < array1.length; i++)
    array[i] = input.nextInt();

// later
if (Arrays.equals(array1, array2))

int[] array = {};

it obviously won't work, since array.length function cannot work.

This works as expected and array.length is always 0

A: I am still unable to fulfill what I am really trying to accomplish, but I've used my code to compromise. It is to allow the user to specify the length before entering integers.

import java.util.Scanner;
import java.util.Arrays;
public class Test {
    public static void main(String[] args){

        Scanner input = new Scanner(System.in);

        System.out.print("How many variables long is the first list? ");
        int n = input.nextInt();
        int[] list1 = new int[n];

        System.out.print("How many variables long is the second list? ");
        n = input.nextInt();
        int[] list2 = new int[n];

        // ask user to fill the two arrays to see if they are equal
        System.out.print("Enter list one >> ");

        for (int i = 0; i < list1.length; i++){
            list1[i] = input.nextInt();
        }

        System.out.print("Enter list two >> ");

        for (int i = 0; i < list2.length; i++){
            list2[i] = input.nextInt();
        }

        // call the equality testing method and output whether or not the two lists are strictly identical or not.
        if (equals(list1, list2) == true)
            System.out.println("The two lists are strictly identical");
        else
            System.out.println("The two lists are not strictly identical");

    }

    // this method
    public static boolean equals(int[] list1, int[] list2){
        boolean bool = false;
        if (Arrays.equals(list1, list2))
            bool = true;
        else
            bool = false;

        return bool;
    }

}

A: I see that this question is an older one but I had the same one (or at least similar) and couldn't find answer I was searching for. And now I believe I have the answer for this and would like to share it. Maybe for someone this will be handy.
According to my understanding the question is about creating a single dimensional array with undefined length and the length of this array is going to be increased by the Scanner input. Lot of answers I have seen were about using the ArrayList. But still I wanted to know how to do it with a single dimensional array. First, let me share with you the code and then the explanation:
public class Main {

    static Scanner scanner = new Scanner(System.in);
    final static int ARRAY_MAX_LENGTH = 400_000_000;

    public static void main(String[] args) {

        int[] numbers = createIntArray();

        displayArray(numbers);

    }

    public static int[] createIntArray() {
        int[] ints = new int[ARRAY_MAX_LENGTH];

        System.out.print("Enter numbers: ");
        for (int i = 0; i < ints.length; i++) {
            ints[i] = scanner.nextInt();
            if (ints[i] == 0) {
                break;
            }
        } return ints;
    }

    public static void displayArray(int[] ints) {
        for (int i = 0; i < ints.length; i++) {
            System.out.print(ints[i] + " ");
            if (ints[i] == 0) {
                break;
            }
        }
    }
}

Now the explanation:
We want undefined/infinite array length. The truth is: you can not have it. In programming everything has limit. The byte limit is between -128 to 127 the short limit is -32,768 to 32,767 and the int limit is between -2,147,483,648 to 2,147,483,647. So how do you create array with undefined length? Paradoxically: set the array length. And the length should be the maximum length an array can hold. And then create an exit point when you want the array to accept no more inputs from the Scanner class. I solved it by including in my code the if statement with a break keyword (if(input == 0) break;). Once I do not want to make any input with the Scanner class I just type '0' and press enter and the array does not accept any other input and the inputs made before the '0' is saved int the defined int[] numbers array.

Now coming back to the array max length... I found articles that the array max length is the int max length minus 8 (or something similar). This didn't work for me. I read some posts here on Stack Overflow that the array length depends on the JVM and on other factors I have not explored further. I thing the max array length depends on some settings too but I don't want to lie. This is why I set my array length to 400 000 000. When I set the length to 500 000 000 I got the error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

If you want to use this code just figure out what is your max array length and use it.

For me this problem was interesting to think about but definitely I would not use it in big programs. It is not efficient at all. For newbies: if you have just learned the one dimensional array, be patient, ArrayList is coming in your later studies and it could make things easier.


text:
Q: Open a link when alert ok button is pressed I get this alert code when I press a button it opens a message:
- (void)patchButtonPressed
{
UIAlertView *patchAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"After clicking `OK` you will be redirected to Cydia" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[patchAlert show];
[patchAlert release];

But I want that after clicking OK, it redirects to an URL (cydia://package/mypackage).
How can I do this?

A: set the delegate of the alertView and in the didDismiss method open the url
UIAlertView *patchAlert = [[UIAlertView alloc] initWithTitle:@"" message:@"After clicking `OK` you will be redirected to Cydia" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
pathAlert.delegate = self;
[patchAlert show];
[patchAlert release];

...
- alertView:(id)alert didDismissWithButton:(int)index {
    [[UIpplication sharedApplication] openURL:[NSURL URLWithString:@"BLA"];
}

A: You don't actually need pathAlert.delegate = self.  You've already set the delegate in the initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles: method call.
In your .h file, you need to do this:
@interface YourViewControllerName : UIViewController <UIAlertViewDelegate>

And in the .m file add this method:
- alertView:(id)alert didDismissWithButton:(int)index {
    [[UIpplication sharedApplication] openURL:[NSURL URLWithString:@"foo"];
}

Alternatively, and possibly better might be to give the user the option of "Ok" to be redirected or "Cancel" to not navigate to that page.  In which case, you need to create the alert as such:
UIAlertView *patchAlert = [[UIAlertView alloc] initWithTitle:@""
              message:@"After clicking `OK` you will be redirected to Cydia"
             delegate:self
    cancelButtonTitle:@"Cancel"
    otherButtonTitles:@"OK", nil];

Then, you can modify the handle method as such:
- alertView:(id)alert didDismissWithButton:(int)index {
    if(index == 1) {
        [[UIpplication sharedApplication] openURL:[NSURL URLWithString:@"foo"];
    }
}

Now the URL is only opened if they click "OK", otherwise nothing happens.