text:
Q: Scrolling only selected content in the body document I would like to use the page scroll effect so that only the content of the #right element is scrolled in the layout. A similar effect can be seen on Facebook when scrolling posts (posts are scrolled while the left panel and upper bar remain in place). Any of you have an idea how can I get the same effect for my #right container in the code?

#header,#footer{
  width:100%;
  height:80px;
  background:blue;
}

#content{
  width:1000px;
  margin:0 auto;
  overflow:hidden;
}

#left{
  width:200px;
  float:left;
  background:green;
  margin:20px 0;
  height:100vh;
}

#right{
  float:right;
  width:calc(100% - 220px);
}

.item{
  height:80px;
  margin:20px 0;
  background:red;
}

    header

        left

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

    footer

A: Using JQuery you can add a class with style of position:fixed and top:0 and triggered using scroll function for better view/effect of the element on the side.

$(window).scroll(function(){
  var header_height = $('#header').height();
      if ($(this).scrollTop() > header_height) {
          $('#left').addClass('fixed');
      } else {
          $('#left').removeClass('fixed');
      }
});
#header,#footer{
  width:100%;
  height:80px;
  background:blue;
}

#content{
  width:1000px;
  margin:0 auto;
  overflow:hidden;
}

#left{
  width:200px;
  float:left;
  background:green;
  margin:20px 0;
  height:100vh;
}

#right{
  float:right;
  width:calc(100% - 220px);
}

.item{
  height:80px;
  margin:20px 0;
  background:red;
}

.fixed{
  position:fixed;
  top:0;
}

    header

        left

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

    footer

A: Use position: fixed property in CSS

#header,#footer{
  width:100%;
  height:80px;
  background:blue;
}

#content{
  width:1000px;
  margin:0 auto;
  overflow:hidden;
}

#left{
  width:200px;
  float:left;
  background:green;
  /* Enter The Position Fixed Property Here! */
  position:fixed;
  margin:20px 0;
  height:100vh;
}

#right{
  float:right;
  width:calc(100% - 220px);
}

.item{
  height:80px;
  margin:20px 0;
  background:red;
}

    header

        left

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

item

    footer

There is some position disblancing because you have your header. Use this property to which div you want to stick with scroll. An do placement as you need.

A: Use position: fixed and decrease its height of class "left".


text:
Q: Remove duplicate objects from child List I have a class Items and want to remove duplicates
public class Items
        {
            public List<int> Parts { get; set; }
            public int Total { get; set; }
        }

And here the sample data:
List<Items> items = new List<Items>()
            {
                new Items(){ Parts = new List<int> { 6, 4, 0, 2, 0 }, Total = 100},
                new Items(){ Parts = new List<int> { 6, 4, 0, 2, 0 }, Total = 100},
                new Items(){ Parts = new List<int> { 1, 5, 0, 7, 3, 2 }, Total = 80},
                new Items(){ Parts = new List<int> { 1, 5, 0, 7, 3, 2 }, Total = 80},
                new Items(){ Parts = new List<int> { 1, 0, 4, 1 }, Total = 64},
                new Items(){ Parts = new List<int> { 3, 4, 0, 0, 2, 1 }, Total = 125},
                new Items(){ Parts = new List<int> { 3, 4, 0, 0, 2, 1 }, Total = 125},
                new Items(){ Parts = new List<int> { 2, 0, 1 }, Total = 26}
            };
        }

How to remove the duplicates in the list by using Linq?

A: You can use Distinct() method from System.Linq namespace. But, first of all it must now how to compare your custom object instances. For this, you can implement IEquatable<T> interface:
public class Items : IEquatable<Items>
{
    public int Total { get; set; }
    public List<int> Parts { get; set; }

    public bool Equals(Items other)
    {
        if (Total == other.Total && Parts.SequenceEqual(other.Parts))
            return true;

        return false;
    }

    public override int GetHashCode()
    {
        return Total.GetHashCode();
    }
}

And then:
items = items.Distinct().ToList();

redpajama_set_name: RedPajamaStackExchange


text:
Q: 404 Error on all github pages except for index.html (no underscores) I am experiencing a 404 error on every page other than the home index.html page. Any ideas?
Here is my GitHub repo: "https://github.com/lfalisse/Home"
I've been looking for a solution through other posters but unlike (Github Pages 404 for everything but index.html) I don't have any underscores in my file names.

A: It depends what URL you are actually using for testing those pages.
For a normal GitHub repo, you can publish it as a project page site: http(s)://<username>.github.io/<projectname>.
In your case:
https://lfalisse.github.io/Home/
And you can see that https://lfalisse.github.io/Home/Poster/Poster.html does not return 404: it is actually accessible.


text:
Q: Immutable composable builder in scala I'm interested how to improve the piece of code bellow. The idea is to build an immutable composable builder. In the end the builder just builds a Map[String, Object]. I want to be able to define core builder components that can be reused and to also let people define their own additional builders to extend the main builder. I'm able to do so but not without the ugly use of reflection. The code looks as follows:
object TestPizzaBuilder {
  def main(args: Array[String]): Unit = {

    val build = new PizzaBuilder()
      .withCheese("blue")
      .withSauce("tomato")
      .build()

    println(build)
  }
}

object PizzaBuilder {
  type BuilderParams = Map[String, Object]
}

class PizzaBuilder(params: BuilderParams = Map.empty) extends BaseBuilder[PizzaBuilder](params: BuilderParams)
  with CheeseBuilder[PizzaBuilder]
  with SauceBuilder[PizzaBuilder] {
}

abstract class BaseBuilder[A <: BaseBuilder[A]](params: BuilderParams)(implicit tag: ClassTag[A]) {

  protected def _copy(tuples: (String, Object)*): A = {
    val constr = tag.runtimeClass.getConstructors()(0)
    constr.newInstance(params ++ tuples).asInstanceOf[A]
  }

  def build(): Map[String, Object] = {
    params
  }
}

trait CheeseBuilder[A <: BaseBuilder[A]] {
  this: BaseBuilder[A] =>
  def withCheese(cheese: String): A = _copy("cheese" -> cheese)
}

trait SauceBuilder[A <: BaseBuilder[A]] {
  this: BaseBuilder[A] =>
  def withSauce(sauce: String): A = _copy("sauce" -> sauce)
}

Do you have suggestions how reflection can be avoided in this scenario yet keeping the builder immutable and also allowing to compose the builder of tiny other builders.

A: Smallest change would be to pass the constructor (as a function) instead of a ClassTag:
abstract class BaseBuilder[A <: BaseBuilder[A]](params: BuilderParams)(constructor: BuilderParams => A) {

  protected def _copy(tuples: (String, Object)*): A = constructor(params ++ tuples)

  def build(): Map[String, Object] = {
    params
  }
}

// or class PizzaBuilder(params: BuilderParams = Map.empty) extends BaseBuilder[PizzaBuilder](params)(new PizzaBuilder(_))
case class PizzaBuilder(params: BuilderParams = Map.empty) extends BaseBuilder[PizzaBuilder](params)(PizzaBuilder)
  with CheeseBuilder[PizzaBuilder]
  with SauceBuilder[PizzaBuilder] {
}


text:
Q: rdiff-backup bug or error? Disk quota exceeded but that is not true I want to make a backup with rdiff-backup.
I have a backup VPS and I want to get the datas from remote host.
Here it is my command what I used:
rdiff-backup root@**RemoteIP**::/remotesourcefolder/ /targetlocalfolder/

After some seconds, they throw some error and stopped with this;
OSError: [Errno 122] Disk quota exceeded: '/demo/rdiff-backup.tmp.5'
[root@mn6 ~]# Fatal Error: Lost connection to the remote system

.
Before you write anything, I have a bounch of free space, and the source folder under 50 MB...
df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs      1.0T  137G  888G  14% /
none            512M  4.0K  512M   1% /dev
none            512M     0  512M   0% /dev/shm

What I'm doing wrong? (Python version: 2.6.6, rdiff-backup: 1.2.8)
Here is the full raw output: http://pastebin.com/raw/Bs4VRdwX

A: OK, there is some space on the server (I'm assuming your "df -h" was executed on the backup server, not on the client) but maybe you have no free inode on the server (i.e. the maximum number of files has been reached on this FS). This is unlikely but you can check this with:
df -i

Else, have you checked your quotas on the server?
quota

An other reason could be that your rdiff-backup command, on the server side, is limited, especially if this server is shared with several users. It can be limited with the number of open files. Check this with:
ulimit -a

There may be other limitations you don't see on a shared platform (e.g. cgroup). But first try the above commands.
[edit] As a last resort, you should contact your provider. See this answer (your provinder is using simfs too).


text:
Q: Why am I getting 950 Mbps up but only 360 Mbps down on Gigabit Ethernet? I got two desktop computers talking to each other directly. They both have Gigabit Ethernet capable network adapters. That's 1 Gbps or 1000 Mbps. I have them connected with a brand new 10 meter long Cat6 UTP straight cable and I get pretty close to that theoretical maximum. The Windows Task Manager (Network tab) shows 844 - 946 Mbps in one direction. But in the other direction, it only shows about 326 - 365 Mbps.
Local: 192.168.100.152
Remote: 192.168.100.151

The local computer runs Windows 8.1 Pro, and I have it connected remotely to the other computer which runs Windows Vista Ultimate.
Iperf results
I used Iperf to do some testing. I ran the test for 60 seconds each time. I ran the test 10 times for each direction of communication. I have then put together this table with test results to get an average.
192.168.100.152 -> 192.168.100.151          106 MB/s
192.168.100.152 -> 192.168.100.151          107 MB/s
192.168.100.152 -> 192.168.100.151          108 MB/s
192.168.100.152 -> 192.168.100.151          107 MB/s
192.168.100.152 -> 192.168.100.151          107 MB/s
192.168.100.152 -> 192.168.100.151          104 MB/s
192.168.100.152 -> 192.168.100.151          101 MB/s
192.168.100.152 -> 192.168.100.151          108 MB/s
192.168.100.152 -> 192.168.100.151          108 MB/s
192.168.100.152 -> 192.168.100.151          108 MB/s
----------------------------------------------------
Min: 101 MB/s    Max: 108 MB/s    Avg: 106.4 MB/s (851.2 Mbps)

192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.0 MB/s
192.168.100.152 <- 192.168.100.151          41.0 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.0 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
192.168.100.152 <- 192.168.100.151          41.1 MB/s
-----------------------------------------------------
Min: 41.0 MB/s    Max: 41.1 MB/s    Avg: 41.07 MB/s (328.56 Mbps)

My question is, why is it so much slower in the other direction?
Windows Task Manager
This is the network diagram as seen while performing the tests in Iperf.

Pay attention to the diagram in the following two screenshots!

Did you notice how it changed from "1 Gbps" to "500 Mbps" in the upper right corner as I switched from sending data to receiving data. Why did it do that? Is it somehow sensing the other network port as half of 1 Gbps when going one way, but yet full when going the other way around?
File transfer test
I did some more testing with a data file, to get some more realistic disk to disk readings. I created a 1 GB file for this purpose. I used only default Windows file sharing facilities. From the local computer, I connected to the C$ share on the remote computer and dragged and dropped the file back and forth (rope skipping) between them, changing the file name each time. I timed everything to the best of my abilities and this is what I got.
192.168.100.152 -> 192.168.0.151    1073741824 Byte    25 s    40,96 MB/s
192.168.100.152 -> 192.168.0.151    1073741824 Byte    20 s    51.2 MB/s
192.168.100.152 -> 192.168.0.151    1073741824 Byte    16 s    64 MB/s
192.168.100.152 -> 192.168.0.151    1073741824 Byte    16 s    64 MB/s
192.168.100.152 <- 192.168.0.151    1073741824 Byte    11 s    93.091 MB/s
192.168.100.152 <- 192.168.0.151    1073741824 Byte    34 s    30.118 MB/s
192.168.100.152 <- 192.168.0.151    1073741824 Byte    11 s    93.091 MB/s
192.168.100.152 <- 192.168.0.151    1073741824 Byte    11 s    93.091 MB/s

The throughput indicated by the Windows file copy diagram is telling a different story. Here I am downloading two files, one after the other to two different locations on the same disk. The first copy indicated 107 MB/s sustained up to 41%, and the second one indicated 98.9 MB/s sustained up to 87%.

So this is in line with the results I got with the Iperf tool. Now, here is what it looks like when I upload to the remote computer.

It sustains 103 MB/s up to 73%, and then it poops down to stinking 27.3 MB/s at 82% and then goes up a notch to reach 49.1 MB/s at 93%.
Here are two more funny looking "roller coaster" diagrams.

Update 1 - Link speed
I tried disabling the Wifi adapter on the remote computer. (The Wifi adapter was already disabled on the local computer.) I think this is what Timtech meant by that comment. I had the same thought - that having both wired and wireless adapters enabled at the same time limited the throughput on the wired adapter to the level of the Wifi adapter (adapting to the slowest adapter for compatibility). Because the Wifi adapter (DWA-160 Wireless N in this case) is usually detected as a "52 Mbps" - "104 Mbps" link by the Vista computer.
In the following screenshot, the remote computer is set up as a server and the local computer is set up as a client (192.168.100.152 <- 192.168.100.151).

But disconnecting the Wifi adapter on the remote computer did not help my low throughput on my wired connection.
Not only that! In Windows Task Manager on the remote computer, the link speed for the wired adapter (LAN 1) appears as "1 Gbps". If you refer to the screenshots above you can see that it is detected as a "500 Gbps" link on the local computer. So for the same wired connection, Windows Vista says it's a 1 Gbps link, while at the same time, Windows 8.1 Pro says it's a 500 Gbps link... which one is right then?
Here's what it looks like on the remote computer when I set it up as a client and the local computer as a server (192.168.100.152 -> 192.168.100.151).

As you can see here, about 95% of the 1 Gbps link is being utilized. That translates to 950 Mbps. It's exactly what I got in the test above. But going the other way around is a whole different story.
Update 2 - Duplexing and MDI-X
As suggested by some of you I had a look at the duplex settings. Both local and remote computer were set to auto negotiation mode, as you can see by the screenshots below.

I tried changing to "1.0 Gbps Full duplex" on both computers. I then did the same type of tests as I did before, using Iperf. With local computer as server and remote computer as client I get around 950 Mbps max. With local computer as client and remote computer as server I get around 360 Mbps.
Here, have a look at these screenshots.

What you see here is the diagram for when I upload and download between the two computers. The higher graph (95 - 98% utilization) is local to remote (upstream 192.168.100.152 -> 192.168.100.151). The lower graph (~ 33% utilization) is remote to local (downstream 192.168.100.152 <- 192.168.100.151).
To try to rule out any Auto MDI-X issues, I had one of those crossover adapters attached to one end of the cable (the local computer).

That would certainly make the cable a crossover cable. Hell, I even had it tested with a network tester! It is indeed crossed now (pins 1/3, 2/6)!
So now I have true crossover cable connection between the two computers, and I have manually set "1.0 Gbps Full duplex". Yet I still have the same problem. Any more ideas? Besides upgrading the Vista computer (or reinstalling the 8.1 computer)?
Update 3 - Software or Hardware limitation?
My best guess is that I have two operating systems that are not compatible with each other. They are both Windows systems, but not all Windows systems are made equal. I will have to try using Vista on both, or 8.1 Pro on both and see what kind of throughput I get. That means buying an upgrade. Damn you Microsoft.
Both computers are custom built by the way. Here are some specs.
Local
-----
Gigabyte GA-EP45-UD3R
Intel Core 2 Quad Q9650
Intel P45
Corsair XMS2 DHX TwinX DDR2 PC6400/800MHz 4 GB
Realtek 8111C chips (10/100/1000 Mbit)
WD Caviar Black WD1002FAEX
Windows 8.1 Pro 64-bit

Remote
------
Gigabyte GA-X38-DQ6
Intel Core 2 Duo E4500
Intel X38
Corsair XMS2 DHX TwinX DDR2 PC6400/800MHz 4 GB
Dual Realtek 8111B chip (10/100/1000 Mbit)
WD Caviar Black WD1002FAEX
Windows Vista Ultimate 64-bit

Tonny suggested that the Vista machine might be using a bad Realtek chip. So I dug up these specs. I see now that the Vista machine uses a B revision of 8111 while the local machine uses a C revision of the same chip. Does this mean anything? They are both clearly specified for 1000 Mbit (see above) by the manufacturer. Could it be that 8111B underperforms that much (360 Mbps)?
These particular drives reach 107 MB/s burst rate. That's exactly the number I've seen in the test on the local computer. But even the sustained sequential or random read/write of maybe 55 MB/s does NOT translate to 360 Mbps. That should give me somewhere around 440 Mbps, and not the 360 Mbps I'm getting. So I don't suspect that to be the bottleneck, especially since they both use the same drive model. And besides, file copy operation is one thing, but Iperf is not using disks at all, it only uses RAM memory for the tests.
Update 4 - TCP Checksum Offload
As suggested by Tonny, I tried switching off TCP checksum offloading (for IPv4  and IPv6).

I also switched "Speed & Duplex" back to auto for both computers. But this did not help. I still have the low throughput in one direction, and high in the other direction.
Update 5 - New driver version
I tried updating the driver version on both local and remote to the latest version downloaded from Gigabyte website and Realtek website.
Update path...

On local (RTL8111C):
8.1.510.2013 (2013-05-10, Microsoft)
8.20.815.2013 (2013-08-15, Realtek)

On remote (RTL8111B):
6.241.623.2010 (2010-06-23, Realtek)
6.250.908.2011 (2011-09-08, Realtek)
6.252.1109.2012 (2012-11-09, Realtek)

I still got the same lousy throughput in one direction.
Update 6 - CPU utilization
I checked CPU utilization. This should not be an issue. Here are my findings.
On local...

Download: 4 - 10 %
Upload:   4 - 10 %
Idle:     0 -  4 %

On remote...

Download: 24 - 38 %
Upload:   10 - 25 %
Idle:      1 -  6 %

Local (download, upload, idle)...

Remote (download, upload, idle)...

The remote uses much more CPU power, but this is also the one with the slower Core 2 Duo. But it never exceeded the 38 % point during my tests. What's particularly interesting here is that it uses so much more CPU power when downloading (local -> remote) than when uploading (local <- remote).
So with a throughput of 950 Mbps it uses 38% and at 360 Mbps it uses 25 %. Also the core utilization is not balanced, it uses one core more than the other. I'm not sure what conclusion to draw from this. The local computer doesn't display core utilization, so I can't compare it. But CPU utilization is even on the local computer (10 % on download/upload).
Update 7 - New Intel Gigabit network adapter
I have now installed a brand new PCI-Express Gigabit network adapter from Intel as a replacement for the built-in Realtek RTL8111B on the remote computer, which is supposedly too slow on upload. The product number of the Intel adapter is EXPI9301CT. This adapter is supposed to be very good according to reviews I've read. I just want to rule this out as a possible bottleneck.

I've done some testing now with Iperf for Windows and here are the results.
Local (download, upload)...

Remote (download, upload)...

On average, this adapter is actually a little bit slower than the Realtek adapter. I think it has a smaller overhead than the Realtek and as a result of that a more stable continuous throughput. But I still get only around 360 Mbps in one direction, and 950 Mbps in the other, even with this Intel adapter.
local: 192.168.100.152 (win 8, realtek 8111c)
remote: 192.168.100.154 (vista, intel desktop ct)

192.168.100.152 -> 192.168.100.154    113 MB/s
192.168.100.152 -> 192.168.100.154    104 MB/s
192.168.100.152 -> 192.168.100.154    103 MB/s
192.168.100.152 -> 192.168.100.154    104 MB/s
192.168.100.152 -> 192.168.100.154    102 MB/s
192.168.100.152 -> 192.168.100.154    104 MB/s
192.168.100.152 -> 192.168.100.154    101 MB/s
192.168.100.152 -> 192.168.100.154    102 MB/s
192.168.100.152 -> 192.168.100.154    101 MB/s
192.168.100.152 -> 192.168.100.154    104 MB/s
----------------------------------------------
Max: 113 MB/s    Min: 101 MB/s    Avg: 103.8 MB/s

192.168.100.152 <- 192.168.100.154    42.2 MB/s
192.168.100.152 <- 192.168.100.154    41.2 MB/s
192.168.100.152 <- 192.168.100.154    41.1 MB/s
192.168.100.152 <- 192.168.100.154    43.0 MB/s
192.168.100.152 <- 192.168.100.154    42.3 MB/s
192.168.100.152 <- 192.168.100.154    42.3 MB/s
192.168.100.152 <- 192.168.100.154    40.2 MB/s
192.168.100.152 <- 192.168.100.154    40.9 MB/s
192.168.100.152 <- 192.168.100.154    41.3 MB/s
192.168.100.152 <- 192.168.100.154    42.0 MB/s
-----------------------------------------------
Max: 43.0 MB/s    Min: 40.2 MB/s    Avg: 41.65 MB/s

I have no idea why it peaked up at 113 MB/s in the first test run, local to remote. It kept that speed throughout the test run, the graph was almost flat at 113 MB/s. As before, I used a 60 seconds interval for each run. On the next run however it dropped to 104 MB/s.
As you can tell by these values, I still have the same throughput with this Intel adapter as with the built-in Realtek adapter. So I think it's safe to say that it has nothing to do with the adapter itself. So we can stop blaming RTL8111B as being an inferior/lesser chip than the RTL8111C found on the other motherboard. This looks more and more like a software/OS/configuration issue, or all three things at once.
Update 8 - Great results with Ubuntu LINUX
After exhausting all other options I finally decided to run some tests with Linux, and I got great results. I used a Ubuntu Linux 13.10 Live system and Iperf for Linux (version 2.0.5-3) on both local and remote machine. Here are the results.
=======================================================
REALTEK 8111C <-> REALTEK 8111B | IPERF ON UBUNTU LINUX
=======================================================

local: 192.168.100.152
remote: 192.168.100.151

192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
192.168.100.152 -> 192.168.100.151    112 MB/s
----------------------------------------------
Max: 112 MB/s    Min: 112 MB/s    Avg: 112 MB/s

192.168.100.152 <- 192.168.100.151    110 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    110 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
192.168.100.152 <- 192.168.100.151    111 MB/s
----------------------------------------------
Max: 111 MB/s    Min: 110 MB/s    Avg: 110.8 MB/s

Local (download, upload, idle)...

As you can see I get the same throughput in both directions when using Ubuntu. Is it because I use the same OS on both machines, or is this something else? Would I get the same throughput if I had the same Windows versions set up on both machines? I don't understand why it would matter if I use a slightly outdated Windows version, namely Vista, on one machine and the latest version on the other?... I mean Vista is still a current and supported OS and backed up by Microsoft. Windows XP is a different story.
But I know they are doing everything they can to kill off Vista. For instance, the latest Office 2013 is intentionally not supported on Windows Vista. I'm sure Microsoft wishes that Vista never happened. Just like they will be wishing that Windows 8.0 never had happened. But I'm usually just as persistent as they are, and I don't upgrade my Windows installs until I absolutely must.
So the question is how to get the same throughput in both directions with two different Windows versions. Windows Vista should be capable of Gigabit speed - it's not a 20 year old OS or something, it's not Windows 95 we're talking about. Vista is a modern OS. I haven't tested running the same Windows version on both machines yet. There might be a difference in TCP implementation or something between the two OS versions. If so, then I will probably be forced to upgrade the Vista machine. Either that or switch to Linux. I'm not prepared to pay more for less. Why would I have to upgrade Windows just to get Gigabit throughput in both directions?...
Update 9...
Cable
I tried reversing the cable. I got the same results as before. I also got a new Cat 6 patch cable and tried that one. The throughput test results were the same. So the cable is not the issue here. I only used pre-terminated/molded patch cables. So the wiring should be correct. But I plan to terminate my own installation cables later on.
FW and AV
As for firewall (FW) and anti-virus (AV), I don't use any third-party FW or AV software. I only have the Windows Firewall and the Security Essentials. I have disabled them both on both machines. The throughput test results were the same as before.

LAN Speed Test
I have installed LAN Speed Test Lite 1.3 on the local machine. I believe the test is performed between the memory on local and the disk drive on remote machine. I'm not sure. But it asks for a share path on the remote machine. I used o$ share on remote.

Upload: 427 Mbps
Download: 420 Mbps

I don't trust these results too much. If you look at the graph you can see that it varies very much throughout the test. The test was a "successive" test, that is: write (upload) test first, and then read (download) test. Obviously if you do a simultaneous upload/download test the overall throughput will be lower. But I'm not interested in such tests. So far I have only been doing "successive" tests with both file transfer tests in Windows (file sharing/smb) and in Iperf.
I haven't done any memory to memory tests with LAN Speed Test because it requires the use of a program called LST Server on the remote, and this program requires registration in order to use it.
Update 10...
Disk drive tests
I used Crystal Disk Mark 3.0.3 to test the disk drives. Here are the results.
Local disk: 118 MB/s read, 113 MB/s write
Remote disk: 70 MB/s read, 69 MB/s write

These are sequential read and write speeds based on 5 runs and a 1000 MB load.
This is the local disk (disk mark, read, write)...

And this is the remote disk...

But I don't get this... these results seem contradictory.
Okey, the local disk can read at 118 MB/s, so that would allow for the reported upload of about 100 MB/s. But the remote disk would not be able to receive it if it is only capable of 69 MB/s write. But by some magic twist I still get little over 100 MB/s upload on average.
Going the other way around makes more sense. If remote disk can read at 70 MB/s, and the local disk can write at 113 MB/s, then the download should not be any faster than 70 MB/s. I get about 40 MB/s download on average. That would seem reasonable.
So I can't conclude anything from these results. I mean the disk drive on the local computer is barely used. It is also the disk that holds the OS, and it is the only partition on that system. While the remote disk is almost full, and it is also partitioned with several partitions. However, it is not used for the OS. I chose drive letter O: for the test here, because this is the partition with most free space.
(Note that I used drive letter C: in the previous tests which is on a completely separate Seagate disk drive that holds the OS on the remote machine. So those readings are not comparable.)
Write caching
With disk write caching enabled I got these results.
Local to remote: 106 MB/s
Remote to local: 42.2 MB/s

I then disabled write caching on all drives on the remote and on the local drive.

I did not reboot because no reboot was requested for the changes to take effect. I then got following results.
Local to remote: 106 MB/s
Remote to local: 42.1 MB/s

There was practically no change at all. No reboot, and no reboot was requested.
QOS packet
I then went on to disabling QOS Packet Scheduler for the appropriate adapter on the remote machine, and then on the local machine.

Local to remote: 107 MB/s
Remote to local: 41.9 MB/s

No significant change here. Again, no reboot and no reboot was requested.
Jumbo packets
I then went on to enable jumbo packets I used the 4 GB setting because 4 KB is the largest MTU size that's supported on both machines.

Local to remote: 105 MB/s
Remote to local: 33.3 MB/s

Now here, the upload (local to remote) was not affected, but the download throughput was reduced significantly. No reboot was requested, but I decided to reboot both machines anyway, just for good measure. I then performed the same tests again and got these results.
Local to remote: 117 MB/s
Remote to local: 33.2 MB/s

So the upload is now even faster, but download is still slower than it was before I made these changes, even after the reboot. I would have expected them both to go up a little. What does this mean?

A: Based on your response:

@ewhac The TCP window size on the local machine usually differs from
  the window size on the remote machine. The default value is 0.06 MB on
  local (win 8) and 0.01 MB on remote (vista). Do they have to be the
  same value? How do I ask it to guess the MSS? Would that be the -m
  switch ("print maximum segment size")? I usually don't set any of
  that. Why would I have to? – Sammy Nov 30 at 21:39

The TCP window size represents the maximum amount of data the TCP stack will squirt down the wire blind before stopping and waiting to receive acknowledgements from the remote machine -- in other words, the maximum amount of unacknowledged traffic on the wire.  The fact that the TCP window on the Vista machine is much smaller than on the Windows Se7en machine supports the theory that you're not filling the pipe enough before stalling and waiting for ACKs.
Therefore, the first thing I would try is increasing the TCP window size on the Vista machine using the -w argument.  0.01MB is a somewhat unhelpful unit; I'm guessing it's 16KiB.  So start with 16KiB and run a test:
iperf -c -w 16K ...

Double the window size and repeat the test:
iperf -c -w 32K ...

Hopefully you should observe a speed increase.  Continue doubling the window size until you no longer see significant speed increases.

A: As previously stated, you will need to modify the TCP Window size in iperf to get higher throughput over low latency high speed links.  Different versions of Windows (or iPerf) may have different default window sizes.  Try "-w 256k" to start with on both the client and server.
Can you confirm the arrow direction of your charts?  In iPerf, data is pushed from the client to the server (opposite of what I usually think).
You can rule out the hard drives as the cause since iPerf does not touch the hard drives.
I think you already verified that you are running the latest NIC drivers. There should be no need to muck around with manually setting the speed/duplex. Same with jumbo frames -- they are not worth the hassle with modern hardware.
Verify that Large Send Offload (LSO) and Large Receive Offload (LRO) are enabled on both NICs.  Some NIC drivers use different names (or multiple options that control this behavior) so you may have to hunt around.  Usually the default is to have them all enabled.

A: I think u need to read a little bit more about how iperf works. If you don't set the correct tcp window size your results will vary a lot. I believe its the -w switch. This website will assist with calculating the optimal TCP window size. You need to know the RTT and bandwith to calculate it. http://www.kehlet.cx/docs/tcpwin.php
Also try other tools like "LAN Speed test" lite which will just do up and down transfers between shares at either end. Its results are quite close in the testing ive done with it. Also make sure u check what your hard drives max r/w speeds are.

A: A couple of point which may help you out..
TCP IP stack is now implemented differently in post Windows 7 releases.
I would look closely at my TCP optimisations, there may not be much in it between your two boxes but still worth tweaking some settings on your vista Box.
The use of netsh int tcp set global congestionprovider=ctcp has been depreciated.  In order to set or change the congestionprovider the following command must be used:
read the article here:
http://forums.speedguide.net/showthread.php?280646-When-will-TCP-Optimizer-support-Windows-8-amp-Windows-Server-2012
netsh int tcp set supplemental custom 300 10 ctcp disabled 50
Then type:
netsh int tcp set supplemental custom
For further details about the above command simply type:
netsh int set supplemental
To check which congestionprovider your currently using use the following:
netsh int tcp show supplemental
But only Win Server 2012 can create custom templates CTCP maybe an issue.
Also Auto-Scaling could be a factor.
Maybe worth taking a look at your drivers maybe in need of upgrade/downgrade. see which ones work best.
Another thought is packet-sizes being written to HDD.. What size are your HDD sectors formatted to 512b ~ 64K it could be caching bottleneck.. Worth consideration when using GBit speeds - or test with SSD disk instead!
Have you looked at enabling Jumbo Packets (if this apply's to your NIC's)

A:
Great results with Ubuntu LINUX

This sounds quite familiar... you get inexplicably bad iperf performance in Windows, but the same hardware works fine with Linux.
After fighting this battle over and over, I have come to the conclusion that iperf in Windows is flaky.  I don't know why... honestly, I've quit caring because I know I can always get sane results from linux.
So if you want to know why you're getting such bad performance, look no farther than the application.

A: Something to try is to stop the MMCSS service.  Yes, you will lose your audio temporarily, but it could be that something is activating it, causing the network activity to be throttled so that the network activity doesn't drown out other activity.
See here for some info about MMCSS and network throttling: http://blogs.technet.com/b/markrussinovich/archive/2007/08/27/1833290.aspx
It can be tweaked as per these instructions:
http://support.microsoft.com/kb/948066
I doubt it's the cause in this case, as throughput would probably be lower, but after banging my head against the wall for a long time with my own throughput problems on Vista, I discovered this was the cause.  I set NetworkThrottlingIndex to 70 and I finally got the throughput I expected.

A: One thing you have not tried is removing Remote Differential Compression on Vista.
My thinking is motivated by the extensive CPU use on Vista.
It might be that the Vista network driver does not know how to offload this to the network card, while Windows 8 does it much more efficiently.
For full details see the article :
Prevent slow file copying over the network in Vista by disabling Remote Differential Compression.
But in a nutshell, just uncheck Remote Differential Compression in
Control Panel -> Programs and Features -> Turn Windows features on and off,
then reboot.

A: Previously I chase my tail with exactly the same problem for a while! Slow transfer speeds in one direction, in my case outbound (uplink).
Windows 7 Pro, Celeron J1800 with Realtek Gigabit 8111C builtin lan card. QNAP 453a and MacBook Pro on the other end.
When measured via Iperf3 I was getting 112 mbps with the my Windows 7 set as a client (CPU usage at 25-30%). And only 39-41 Mbps when set as a server, with heavy CPU usage between 50-100%. So bad that the PC would freeze at times of bandwidth testing.
Regular file transfer capped at 45mbps max no matter if I was uploading or downloading files to my NAS or my MAC.
I was getting nothing more than 35-45 megabytes per second. Pretty frustrating!
Ended up being a bad lan card driver. I was obsessed with updating drivers and always updated my drivers when new one become available. Guess what, after several updates my lan card slowed down.
Some of you might say, just delete the old driver and install the new one. Simple, ah? I tried and tried, It did not work for me.
Here is my solution:
Installed windows from scratch with OEM drivers from the manufacturer's website. As well I did the following:
Under Device Manager / Lan card / Advanced settings / Disable everything except FLOW CONTROL.
Under Windows Features, Disable Remote Differential Compression.
Now average speed is between 80-100 Mbps.
Sorry for the poor quality pics.

A: Linus from Linus Tech Tips on Youtube had the same problem, and I apologize but I have forgotten what the solution was. It is a recent (as of 4/20/2016) video,  and I may be wrong but I think it ended up being a case where a single thread on a processor is the limiting factor, so if you have older hardware and you are trying to hit 1 Gbps, it is actually the CPU that is the problem, if it offloads the bulk of the work to the CPU, which most on-board NICs do these days. I could be mistaken, it is a recent video of his, I highly encourage you to check his stream. For what it is worth I am running into the same problem on my gigabit internet connection.


text:
Q: ngChange not Triggered on ngModel change UI bootstrap demonstrates a select dropdown using a button and a unordered list.  This is all fine and dandy, however, I am trying to get the same functionality as a select tag in HTML.  Functionality like selecting an option and changing the value of the model then firing a ng-change function.
I thought that an ngChange event fires when the ngModel attached to the input changes, however, this is not the case.  I have attached a plunker with my problem, which demonstrates the selection of the list item that changes the user.group's ng-model, which should call the ng-change="alert('blah')", but it doesnt.  Am I missing some kind of semantics with ngChange?
http://plnkr.co/edit/oZo7xGEVKvB0ntwiNFMp?p=info

A: As official docs said about ngChange directive:

Evaluate the given expression when the user changes the input

https://docs.angularjs.org/api/ng/directive/ngChange
So the directive has nothing with model changes, it deals with user interaction with form elemment.
More from the angular docs:

It will not be evaluated:

*

*if the value returned from the $parsers transformation pipeline has    not changed

*if the input has continued to be invalid since the model will stay    null

*if the model is changed programmatically and not by a    change to    the input value

A: I see that you are using ng-model directive on a button tag. That is not going to work since you can only use ng-model on html form input elements. Your button is not an input type. Check angularjs docs: https://docs.angularjs.org/api/ng/directive/ngModel

The ngModel directive binds an input,select, textarea (or custom form
  control) to a property on the scope using NgModelController, which is
  created and exposed by this directive.


text:
Q: accessing mapinfo data without using mapinfo api I need to be able to access various mapinfo layers but without using the mapinfo api.
I have found that I can convert the mapinfo layers to an access database to get the attribution and I can use sharpMap to load and view the layer.
The problem is now I'm not sure how to get a location shown in sharpmap and then query the objects to get to the attributes, or if its even possible.
It seems that mapinfo might keep this kind of link internaly perhaps

A: I looked at SharpMap and it suggests you need a 3rd party to view MapInfo files.
if you want to use MapInfo tab format files, you need an OgrProvider. For SharpMap v0.9 it is in the SharpMap.Extensions project. For SharpMap v2.0 there is one in the branches/initialgdalintegration branch.
If you get this extension, you'll be able to view MapInfo files; Geography and attribution
EDIT
from the SharpMap web site
I've added the patch with the GetFeatureInfo request possibility.
I've made the following changes.
ICanQueryLayer .cs: Added a boolean in ICanQueryLayer to set layers queryable for the WMS
VectorLayer.cs, GdalRasterLayer.cs, Layergroup.cs: implemented this boolean of ICanQueryLayer
WmsServer.cs: added the getFeatureInfo thing
capabilities.cs: added the required getfeature information for the capabilities
The code added to wmsserver works as follows:
A getfeatureinfo request is received
Checks on all necessary parameters
The map size and boundingbox are set according to the settings of the client and the point clicked in the map of the client is translated to the coordinates of the projection using this new map size and bbox
The optional parameter FEATURES_COUNT is checked whether the client requests one or more features per layer
For each requested layer, it is checked whether the layer is queryable. When true, the layer is queried and all found features are placed in the featuredataset.
This featuredataset is then sorted on area size, because when the client requests a limited number of features, the user is more likely to be interested in the feature with the smallest bbox (imagine a very curved polygon like the character C and a small polygon within the bbox of the 'C' polygon. If the user clicks the small polygon, both the 'C' polygon bbox and the small polygon bbox will be returned. When the FEATURES_COUNT is set to 1, only the feature attributes of the 'C' polygon might be send back, instead of the small polygon attributes the user wanted to see. By sorting on bboxarea from small to large, the small polygon attribute information will be send back. If the user wants to see attribute information of the 'C' polygon, he will click the 'C' polygon and the click will only be within the 'C' polygon bbox and not within the small polygon bbox (hope this is clear to you;-))
Then for each feature that will be returned to the user (as set by FEATURES_COUNT) all the ItemArrays from the featuredataset are placed in the string.
I've added exceptions where necessary. I should have added an exception for quering layers which are set WMSQueryable= false, but I forgot ;-)
A difference between the WMS1.1.1 spec and the WMS 1.3.0 spec is the parameter name of the point clicked by the user. It used to be X and Y in 1.1.1, but this has changed to I and J in 1.3.0. In order to make life a little bit easy for myself in OpenLayers and for others which might not know about this change, I added support for X and Y as well. If both are within the Request, the I and J will overwrite values set by X and Y. Including neither X&Y nor I&J will result in an exception.
These are the major changes.

A: I would not be surprised at your findings/experience.
Any company who creates a proprietary format will always keep the links hidden, else people like us (no pun intended!) will always reverse engineer it.
The same is the case with Geodatabase from ESRI...though you can access the SDE schema and relate a few of the links/logic, you can never wholly de-crypt the way ArcSDE works with these tables/schema.
Cheers!


text:
Q: How to convert seconds per degree to degrees per second? This may be super simple, but I am lost and clueless.
Here is my real world example:
I am trying to calculate the Degrees per Second a satellite orbits around a parent body. To simplify this immensely, imagine the satellite is in a perfectly circular orbit, body is in a 2D universe, not 3D (body is a circle, not a sphere, no axial tilt, satellite is perfectly equatorial) and the parent body is not rotating. I can deal with body rotation later if I get this right.
This satellite orbits the parent body in exactly 2206.8 seconds. I'm doing this in a simulator, so the simulator gives me the exact orbital period without me having to calculate it.
So, since the satellite takes 2206.8 seconds to travel 360 degrees around the body, if I divide seconds by 360, I get Seconds per Degree. Am I correct so far?
If I have this value, how do I now convert it do Degrees per Second? (Is it possible?)
Before you say there are better ways to do this, I have gotten a different equation from someone else:
v / r = rad/s
where
v = velocity (2038 m/s, for example)
r = radius (body radius + altitude, so 600,000m + 165,000m for example)
Which gives me radians per second, which I can then convert to deg/s.
I will also use a sanity check method, where I measure the satellite's longitude, wait exactly 1 second, then measure its longitude again. Sample2 - Sample1 = deg/s, correct? If I wait exactly 5 seconds, then I can do (Sample2 - Sample1) / 5, and have an average deg/s over 5 seconds.
Am I on the right track here? My accuracy is still way off and deg/s is the single most important value for all the rest of my calculations. I feel like there must be more than one method to solve for it, and I don't like v/r because there are many different ways to measure velocity: orbital, surface, ground speed, air speed. Too many variables.
I never took calculus or any advanced math in high school and I'm kicking myself for it now. I barely passed algebra because I thought I didn't like math at the time and my head was filled with other things. So please, explain as you would to a child. :)


text:
Q: Storing startdate and enddate values from a function to an array Can someone help me in storing startdate and enddate from a function to an array for further processing.
Below php code will give start and end dates of each month for a given period. But I am unable to put these values into an array from the function.
PHP code:
    <?php
    //Function to return out start and end dates of all months in a date range given

    function rent_range($start_date, $end_date)
    {
        $start_date = date("m/d/Y", strtotime($start_date));
        $end_date   = date("m/d/Y", strtotime($end_date));
        $start = strtotime($start_date);
        $end = strtotime($end_date);

        $month = $start;
        $months[] = date('Y-m', $start);
        while($month < $end) {
          $month = strtotime("+1 month", $month);
          $months[] = date('Y-m', $month);
        }

        foreach($months as $mon)
        {
            $mon_arr = explode( "-", $mon);
            $y = $mon_arr[0];
            $m = $mon_arr[1];
            $start_dates_arr[] = date("m/d/Y", strtotime($m.'/01/'.$y.' 00:00:00'));
            $end_dates_arr[] = date("m/d/Y", strtotime('-1 minute', strtotime('+1 month',strtotime($m.'/01/'.$y.' 00:00:00'))));
        }

        //to remove first month in start date and add our start date as first date
        array_shift($start_dates_arr);
        array_pop($start_dates_arr);
        array_unshift($start_dates_arr, $start_date);

        //To remove last month in end date and add our end date as last date
        array_pop($end_dates_arr);
        array_pop($end_dates_arr);
        array_push($end_dates_arr, $end_date);

        $result['start_dates'] = $start_dates_arr;
        $result['end_dates'] = $end_dates_arr;
        return $result;
    }

    $start_date = '2013-04-01';
    $end_date = '2014-03-31';
    $res = rent_range($start_date, $end_date);
    echo "
";
    print_r($res);
    echo "
";

    for($i=0; $i<11; $i++)
    {
    echo $res[$i]."
";
    }
    ?>

I need the output of the above function to be in an array like this:
Desired output:
    $res[0]='04/01/2013'
    $res[1]='05/01/2013'
    -
    -
    -
    -
    -
    -
    $res[11]='03/01/2014'

    $res[12]='04/30/2013'
    $res[13]='05/31/2013'
    -
    -
    -
    -
    $res[24]='03/31/2014'

A: Please use below scripts in the function
$result = array_merge($start_dates_arr, $end_dates_arr);
//$result['start_dates'][] = $end_dates_arr;
return $result;

A: From your comment you want is to merge both your array,
$new_res = array_merge($res['start_dates'],$res['end_dates']);
print_r($new_res);

Demo.


text:
Q: Union Streams in Java I think this question is useless, but i can`t find how i can union this code to one line
I have List of active Couriers.
I am trying to find all free couriers in this list and after that find courier with min distance
List<Courier> afterCheckIsFree = activeCouriers.stream().filter(Courier::isFree).collect(Collectors.toList());
final Optional<Courier> courierWithMinDistance = afterCheckIsFree.stream()
                .filter(n -> n.getId().equals(CourierFinder.minDistanceUsingCourier(Point.ZERO_POINT, afterCheckIsFree).getId())).findFirst();

Thanks a lot!

A: Change the minDistanceUsingCourier method to return the distance for a single courier (instead of the minimum distance of a list of couriers) then:
final Optional<Courier> courierWithMinDistance = activeCouriers.stream()
  .filter(Courier::isFree)
  .min(comparing(c -> minDistanceUsingCourier(Point.ZERO_POINT, c)));

A: You should apply 2 criterias on your stream: firstly, checking if courier is free, secondly, sort remaining couriers by distance and take first.
It will look like:
list.stream().filter(Courier::isFree).sorted((c1, c2)->c1.getDistance().
                               compareTo(c2.getDistance())).
                               findFirst();

A: Assuming that the actual aim is to find the courier that is both free and has the minimum distance...
Your code will run the minDistance algorithm for every courier, so it is incredibly inefficient. It can be done in one go:
Optional<Courier> = activeCouriers.stream()
  .filter(Courier::isFree)
  .min((c1, c2) -> c1.getDistanceFrom(ZERO_POINT) - c2.getDistanceFrom(ZERO_POINT));

min can find the minimum thing in the stream based on whatever function you want, which is what is used here.


text:
Q: The aggregation output disappeared but the database size was doubled The aggregation output is disappear.
I ran a aggregation task.
It should write the result to another collection.
The data size is really large, about 1TB
Now, I checked the DB status, it show me the current DB size is 2TB
And the tmp.agg_out.1 is not exsisting anymore, so the task is supposely done
tw_weather  2296.832GB

somehow the output collection's count is ZERO
> db.result.count()
0

Where is the result ? If there is no output, why the DB size is doubled ?
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1105 mongodb   20   0  4.495t 9.368g 771684 S   0.3 63.8 488:26.99 mongod

Is there anyway to let me know what's going on now ?
~$ mongostat
insert query update delete getmore command flushes  mapped   vsize  res faults idx miss % qr|qw ar|aw netIn netOut conn     time
    *0    *0     *0     *0       0     1|0       0 2296.9G 4602.7G 9.4G      0          0   0|0   0|0   79b    10k    2 02:41:29
    *0    *0     *0     *0       0     1|0       0 2296.9G 4602.7G 9.4G      0          0   0|0   0|0   79b    10k    2 02:41:30
    *0    *0     *0     *0       0     1|0       0 2296.9G 4602.7G 9.4G      0          0   0|0   0|0   79b    10k    2 02:41:31
    *0    *0     *0     *0       0     1|0       0 2296.9G 4602.7G 9.4G      0          0   0|0   0|0   79b    10k    2 02:41:32

~$ mongotop
2015-05-08T02:42:37.117+0000    connected to: 127.0.0.1

                                              ns    total    read    write    2015-05-08T02:42:38Z
                              admin.system.roles      0ms     0ms      0ms
                            admin.system.version      0ms     0ms      0ms
                               local.startup_log      0ms     0ms      0ms
                            local.system.indexes      0ms     0ms      0ms
                         local.system.namespaces      0ms     0ms      0ms
                            local.system.replset      0ms     0ms      0ms
           weather.cds      0ms     0ms      0ms
 weather.import_errors      0ms     0ms      0ms
      weather.result      0ms     0ms      0ms
weather.system.indexes      0ms     0ms      0ms

Here is the aggregate snippet
It works on sample data (about 10million but failed on whole data about 1billion size)
source_collection = "cds"
output_collection = "result"
db[output_collection].drop()
db[output_collection].createIndex({symptom_history:1});
pipeline = [
    { "$project": {
        "doc": "$$ROOT",
        "id": "$$ROOT.ID",
        "weathers": "$$ROOT.weathers"
    }},
    {"$unwind": '$weathers'},
    {"$group":{'_id': "$id",
              'records': {'$push': '$doc'},
              'weather_history': {'$addToSet': '$weathers'},
              'count': {"$sum": 1}
              }
    },
    {
        "$project": {
            "id": "$id",
            "weather_history": "$weather_history",
            "count": "$count",
            "records": "$records",
        }
    },
    { "$out" : output_collection }
]

cur = db[source_collection].runCommand('aggregate',
    {pipeline: pipeline,allowDiskUse: true})


text:
Q: How to use INT 3 to execute code backward in DOS I read from a blog post saying that back in the DOS days (not sure if it's possible under NT), there was a technique to execute code in backwards. It then went on to say that the idea was to execute say operation N, then use INT 3 to modify the instruction pointer to go backwards.
I'm trying to find more information regarding this but Googling so far didn't bring up anything close, and a lot of assembly code seems to target 32-bit and 64-bit architectures so I'm not sure if that's useful. I did find what INT 3 does:

Debuggers use this interrupt to establish breakpoints in a program
that is being debugged.  This is normally done by substituting an INT
3 instruction, which is one byte long, for a byte in the actual
program.  The original byte from the program is restored by the
debugger after it receives control through INT 3.

So my guess is, this "original byte" could be a JUMP instruction, and the second byte is the offset of the instruction (another post). The program maybe somehow modify the "stored" original byte and replaced it with a different offset. Does this make any sense?


text:
Q: Push SwifuUIscreen from AppDelegate How can i push a SwiftUI screen from AppDelegate, e.x. when i click on a Remote notification in willPresent Method, i want the user to redirect to my TabBarView() with tab notification selected. I also need to have initialized my rootViewModel since i have logic there.
MainApp:
@main
struct MainApp: App {

@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

private var rootViewModel: MainViewModel

init() {
    self.rootViewModel = MainViewModel()
}

var body: some Scene {
    WindowGroup {
        if authenticated {
            Tabbar()
                .environmentObject(rootViewModel)
        } else {
            SecondScreen()
                .environmentObject(rootViewModel)
        }
    }
}

}
AppDelegate:
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
        print("willPresent notification")
        let info = notification.request.content.userInfo
        completionHandler([.badge, .sound, .banner])
    }

A: If you want to control the tab selection programmatically from AppDelegate:

*

*You have to use the TabBar initializer that takes a Binding to the selected tab, and

*You have to be able to set the binding's value from AppDelegate.

Here's one solution.
First, define an enum representing the tab selection:
enum TabSelection: Hashable {
    case firstTab
    case secondTab
    case thirdTab
}

Then, make your AppDelegate conform to ObservableObject and give it a Published property that holds the tab selection:
class AppDelegate: NSObject, UIApplicationDelegate, ObservableObject {
    @Published var tabSelection: TabSelection = .firstTab
}

Finally, update your view to use tabSelection to control the selected tab:

*

*Get a Binding<TabSelection> from appDelegate,

*pass it to the TabView initializer, and

*use the tag modifier on each tab subview.

struct MainApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

    private var rootViewModel: MainViewModel

    init() {
        self.rootViewModel = MainViewModel()
    }

    var body: some Scene {
        WindowGroup {
            if rootViewModel.authenticated {
                TabView(selection: _appDelegate.projectedValue.tabSelection) {
                    FirstTab()
                        .tag(TabSelection.firstTab)
                    SecondTab()
                        .tag(TabSelection.secondTab)
                    ThirdTab()
                        .tag(TabSelection.thirdTab)
                }
                    .environmentObject(rootViewModel)
            } else {
                SecondScreen()
                    .environmentObject(rootViewModel)
            }
        }
    }
}

You should be able to say $appDelegate.tabSelection to get the Binding. But I'm writing this answer on my iPad and the Swift Playgrounds app is complaining about $appDelegate, so I'm using _appDelegate.projectedValue.tabSelection to get the Binding.


text:
Q: python 2.7 xrange too big argument error random.sample(xrange(lb), it)

when lb is larger it throws

OverflowError: Python int too large to convert to C long

since xrange does need that in Python 2.7!
Is there a workout  around to this?
I tried from a different post this:
import itertools
xrange = lambda stop: iter(itertools.count().next, stop)

But random doesn't like that:

TypeError: object of type 'callable-iterator' has no len()


text: Q: Using session in wcf for security after authentication I have a WCF service which checks for user authentication before it actually leads to other [OperationContracts] ie. methods. But I am afraid that anybody can consume my methods remotely bypassing the authentication method. Hence I need something like Session that we use in ASP.NET. What's the best solution for this?


text:
Q: How to get nice arrowheads in logarithmic r plot using IDPmisc? I would like to draw filled arrowheads in a logarithmic r plot with IDPmisc or another library. The arrowheads are stretched logarithmically.
A simple example (the documentation example slightly modified) is:
library(IDPmisc)

plot(c(4,10), c(0,10), type="n",log = "x")
Arrows(5, 5, 5,10, size=3,
   sh.lwd=5, sh.lty=2,
   h.lwd=5)
Arrows(5, 5, 7.5, 9, size=3, open=TRUE,
   sh.adj=0.7, sh.lwd=5, sh.lty=2,
   h.col.bo="red",h.lwd=5)
Arrows(5, 5, 9, 7.5, size=3, open=FALSE,
   sh.adj=1, sh.lwd=5, sh.col="blue",
   h.col.bo="red",h.lwd=2)
Arrows(5, 5, 10, 5, size=2.5, width=1.5, open=FALSE,
   sh.adj=1, sh.lwd=7, sh.col="blue")

I tried to define a new Arrows.log (like it was done here) and change the angles:
deg.arr <- c(atan2(y.arr, exp(x.arr)), NA)
theta <- atan2((y2 - y1) * uin[2], exp((x2 - x1)) * uin[1])

But it didn't work (I didn't understand the Arrows function completely) and already had problems with the xyinch() function used in Arrows.
If you suggest an easy method to draw nice arrows with filled heads in a logarithmic plot without redefining the IDPmisc Arrows, I would be happy.

A: Have you tried something like the following
plot(log10(c(4,10)), c(0,10), type="n")
Arrows(log10(5), 5, log10(5),10, size=3,
   sh.lwd=5, sh.lty=2,
   h.lwd=5)
Arrows(log10(5), 5, log10(7.5), 9, size=3, open=TRUE,
      sh.adj=0.7, sh.lwd=5, sh.lty=2,
      h.col.bo="red",h.lwd=5)
Arrows(log10(5), 5, log10(9), 7.5, size=3, open=FALSE,
      sh.adj=1, sh.lwd=5, sh.col="blue",
      h.col.bo="red",h.lwd=2)
Arrows(log10(5), 5, log10(10), 5, size=2.5, width=1.5, open=FALSE,
      sh.adj=1, sh.lwd=7, sh.col="blue")

It seemed to work.  It may not be the best way to do it though.
Output


text:
Q: Implement a java UDF and call it from pyspark I need to create a UDF to be used in pyspark python which uses a java object for its internal calculations.
If it were a simple python I would do something like:
def f(x):
    return 7
fudf = pyspark.sql.functions.udf(f,pyspark.sql.types.IntegerType())

and call it using:
df = sqlContext.range(0,5)
df2 = df.withColumn("a",fudf(df.id)).show()

However, the implementation of the function I need is in java and not in python. I need to wrap it somehow so I can call it in a similar way from python.
My first try was to do implement the java object, then wrap it in python in pyspark and convert that to UDF. That failed with serialization error.
Java code:
package com.test1.test2;

public class TestClass1 {
    Integer internalVal;
    public TestClass1(Integer val1) {
        internalVal = val1;
    }
    public Integer do_something(Integer val) {
        return internalVal;
    }
}

pyspark code:
from py4j.java_gateway import java_import
from pyspark.sql.functions import udf
from pyspark.sql.types import IntegerType
java_import(sc._gateway.jvm, "com.test1.test2.TestClass1")
a = sc._gateway.jvm.com.test1.test2.TestClass1(7)
audf = udf(a,IntegerType())

error:
---------------------------------------------------------------------------
Py4JError                                 Traceback (most recent call last)
<ipython-input-2-9756772ab14f> in <module>()
      4 java_import(sc._gateway.jvm, "com.test1.test2.TestClass1")
      5 a = sc._gateway.jvm.com.test1.test2.TestClass1(7)
----> 6 audf = udf(a,IntegerType())

/usr/local/spark/python/pyspark/sql/functions.py in udf(f, returnType)
   1595     [Row(slen=5), Row(slen=3)]
   1596     """
-> 1597     return UserDefinedFunction(f, returnType)
   1598
   1599 blacklist = ['map', 'since', 'ignore_unicode_prefix']

/usr/local/spark/python/pyspark/sql/functions.py in __init__(self, func, returnType, name)
   1556         self.returnType = returnType
   1557         self._broadcast = None
-> 1558         self._judf = self._create_judf(name)
   1559
   1560     def _create_judf(self, name):

/usr/local/spark/python/pyspark/sql/functions.py in _create_judf(self, name)
   1565         command = (func, None, ser, ser)
   1566         sc = SparkContext.getOrCreate()
-> 1567         pickled_command, broadcast_vars, env, includes = _prepare_for_python_RDD(sc, command, self)
   1568         ctx = SQLContext.getOrCreate(sc)
   1569         jdt = ctx._ssql_ctx.parseDataType(self.returnType.json())

/usr/local/spark/python/pyspark/rdd.py in _prepare_for_python_RDD(sc, command, obj)
   2297     # the serialized command will be compressed by broadcast
   2298     ser = CloudPickleSerializer()
-> 2299     pickled_command = ser.dumps(command)
   2300     if len(pickled_command) > (1 << 20):  # 1M
   2301         # The broadcast will have same life cycle as created PythonRDD

/usr/local/spark/python/pyspark/serializers.py in dumps(self, obj)
    426
    427     def dumps(self, obj):
--> 428         return cloudpickle.dumps(obj, 2)
    429
    430

/usr/local/spark/python/pyspark/cloudpickle.py in dumps(obj, protocol)
    644
    645     cp = CloudPickler(file,protocol)
--> 646     cp.dump(obj)
    647
    648     return file.getvalue()

/usr/local/spark/python/pyspark/cloudpickle.py in dump(self, obj)
    105         self.inject_addons()
    106         try:
--> 107             return Pickler.dump(self, obj)
    108         except RuntimeError as e:
    109             if 'recursion' in e.args[0]:

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in dump(self, obj)
    222         if self.proto >= 2:
    223             self.write(PROTO + chr(self.proto))
--> 224         self.save(obj)
    225         self.write(STOP)
    226

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save(self, obj)
    284         f = self.dispatch.get(t)
    285         if f:
--> 286             f(self, obj) # Call unbound method with explicit self
    287             return
    288

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save_tuple(self, obj)
    566         write(MARK)
    567         for element in obj:
--> 568             save(element)
    569
    570         if id(obj) in memo:

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save(self, obj)
    284         f = self.dispatch.get(t)
    285         if f:
--> 286             f(self, obj) # Call unbound method with explicit self
    287             return
    288

/usr/local/spark/python/pyspark/cloudpickle.py in save_function(self, obj, name)
    191         if islambda(obj) or obj.__code__.co_filename == '<stdin>' or themodule is None:
    192             #print("save global", islambda(obj), obj.__code__.co_filename, modname, themodule)
--> 193             self.save_function_tuple(obj)
    194             return
    195         else:

/usr/local/spark/python/pyspark/cloudpickle.py in save_function_tuple(self, func)
    234         # create a skeleton function object and memoize it
    235         save(_make_skel_func)
--> 236         save((code, closure, base_globals))
    237         write(pickle.REDUCE)
    238         self.memoize(func)

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save(self, obj)
    284         f = self.dispatch.get(t)
    285         if f:
--> 286             f(self, obj) # Call unbound method with explicit self
    287             return
    288

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save_tuple(self, obj)
    552         if n <= 3 and proto >= 2:
    553             for element in obj:
--> 554                 save(element)
    555             # Subtle.  Same as in the big comment below.
    556             if id(obj) in memo:

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save(self, obj)
    284         f = self.dispatch.get(t)
    285         if f:
--> 286             f(self, obj) # Call unbound method with explicit self
    287             return
    288

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save_list(self, obj)
    604
    605         self.memoize(obj)
--> 606         self._batch_appends(iter(obj))
    607
    608     dispatch[ListType] = save_list

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in _batch_appends(self, items)
    637                 write(MARK)
    638                 for x in tmp:
--> 639                     save(x)
    640                 write(APPENDS)
    641             elif n:

/home/mendea3/anaconda2/lib/python2.7/pickle.pyc in save(self, obj)
    304             reduce = getattr(obj, "__reduce_ex__", None)
    305             if reduce:
--> 306                 rv = reduce(self.proto)
    307             else:
    308                 reduce = getattr(obj, "__reduce__", None)

/usr/local/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py in __call__(self, *args)
    811         answer = self.gateway_client.send_command(command)
    812         return_value = get_return_value(
--> 813             answer, self.gateway_client, self.target_id, self.name)
    814
    815         for temp_arg in temp_args:

/usr/local/spark/python/pyspark/sql/utils.py in deco(*a, **kw)
     43     def deco(*a, **kw):
     44         try:
---> 45             return f(*a, **kw)
     46         except py4j.protocol.Py4JJavaError as e:
     47             s = e.java_exception.toString()

/usr/local/spark/python/lib/py4j-0.9-src.zip/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
    310                 raise Py4JError(
    311                     "An error occurred while calling {0}{1}{2}. Trace:\n{3}\n".
--> 312                     format(target_id, ".", name, value))
    313         else:
    314             raise Py4JError(

Py4JError: An error occurred while calling o18.__getnewargs__. Trace:
py4j.Py4JException: Method __getnewargs__([]) does not exist
    at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:335)
    at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:344)
    at py4j.Gateway.invoke(Gateway.java:252)
    at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
    at py4j.commands.CallCommand.execute(CallCommand.java:79)
    at py4j.GatewayConnection.run(GatewayConnection.java:209)
    at java.lang.Thread.run(Thread.java:745)

EDIT: I also tried to make the java class serializable but to no avail.
My second attempt was to define the UDF in java to begin with but that failed as I am not sure how to correctly wrap it:
java code:
    package com.test1.test2;
import org.apache.spark.sql.api.java.UDF1;

public class TestClassUdf implements UDF1<Integer, Integer> {

    Integer retval;

    public TestClassUdf(Integer val) {
        retval = val;
    }

    @Override
    public Integer call(Integer arg0) throws Exception {
        return retval;
    }
}

but how would I use it?
I tried:
from py4j.java_gateway import java_import
java_import(sc._gateway.jvm, "com.test1.test2.TestClassUdf")
a = sc._gateway.jvm.com.test1.test2.TestClassUdf(7)
dfint = sqlContext.range(0,15)
df = dfint.withColumn("a",a(dfint.id))

but I get:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-514811090b5f> in <module>()
      3 a = sc._gateway.jvm.com.test1.test2.TestClassUdf(7)
      4 dfint = sqlContext.range(0,15)
----> 5 df = dfint.withColumn("a",a(dfint.id))

TypeError: 'JavaObject' object is not callable

and I tried to use a.call instead of a:
df = dfint.withColumn("a",a.call(dfint.id))

but got:
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
     in ()
          3 a = sc._gateway.jvm.com.test1.test2.TestClassUdf(7)
          4 dfint = sqlContext.range(0,15)
    ----> 5 df = dfint.withColumn("a",a.call(dfint.id))
/usr/local/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py in __call__(self, *args)
    796     def __call__(self, *args):
    797         if self.converters is not None and len(self.converters) > 0:
--> 798             (new_args, temp_args) = self._get_args(args)
    799         else:
    800             new_args = args

/usr/local/spark/python/lib/py4j-0.9-src.zip/py4j/java_gateway.py in _get_args(self, args)
    783                 for converter in self.gateway_client.converters:
    784                     if converter.can_convert(arg):
--> 785                         temp_arg = converter.convert(arg, self.gateway_client)
    786                         temp_args.append(temp_arg)
    787                         new_args.append(temp_arg)

/usr/local/spark/python/lib/py4j-0.9-src.zip/py4j/java_collections.py in convert(self, object, gateway_client)
    510         HashMap = JavaClass("java.util.HashMap", gateway_client)
    511         java_map = HashMap()
--> 512         for key in object.keys():
    513             java_map[key] = object[key]
    514         return java_map

TypeError: 'Column' object is not callable

Any help would be appriciated.

A: In lines with https://dzone.com/articles/pyspark-java-udf-integration-1 you could define UDF1 with in Java using
public class AddNumber implements UDF1<Long, Long> {

@Override
public Long call(Long num) throws Exception {
      return (num + 5);
   }
}

And then after adding the jar to your pyspark with --package <your-jar>
you can use it in pyspark as:
from pyspark.sql import functions as F
from pyspark.sql.types import LongType

>>> df = spark.createDataFrame([float(i) for i in range(100)], FloatType()).toDF("a")
>>> spark.udf.registerJavaFunction("addNumber", "com.example.spark.AddNumber", LongType())
>>> df.withColumn("b", F.expr("addNumber(a)")).show(5)
+---+---+
|  a|  b|
+---+---+
|0.0|  5|
|1.0|  6|
|2.0|  7|
|3.0|  8|
|4.0|  8|
+---+---+
only showing top 5 rows

A: I got this working with the help of another question (and answer) of your own about UDAFs.
Spark provides a udf() method for wrapping Scala FunctionN, so we can wrap the Java function in Scala and use that. Your Java method needs to be static or on a class that implements Serializable.
package com.example

import org.apache.spark.sql.UserDefinedFunction
import org.apache.spark.sql.functions.udf

class MyUdf extends Serializable {
  def getUdf: UserDefinedFunction = udf(() => MyJavaClass.MyJavaMethod())
}

Usage in PySpark:
def my_udf():
    from pyspark.sql.column import Column, _to_java_column, _to_seq
    pcls = "com.example.MyUdf"
    jc = sc._jvm.java.lang.Thread.currentThread() \
        .getContextClassLoader().loadClass(pcls).newInstance().getUdf().apply
    return Column(jc(_to_seq(sc, [], _to_java_column)))

rdd1 = sc.parallelize([{'c1': 'a'}, {'c1': 'b'}, {'c1': 'c'}])
df1 = rdd1.toDF()
df2 = df1.withColumn('mycol', my_udf())

As with the UDAF in your other question and answer, we can pass columns into it with return Column(jc(_to_seq(sc, ["col1", "col2"], _to_java_column)))


text:
Q: Is negation distributive? Take a proposition like $\neg(\forall x \in S, P(x))$. If negation is not distributive, how does one determine which connective to be negated? Here are the options I've seen:
$$\neg(\forall x \in S, P(x)) \iff \neg\forall x \in S, P(x) \iff \exists x \in S, \neg P(x)\tag1$$
$$\neg(\forall x \in S, P(x)) \iff \forall x \not \in S, P(x)  \tag2 $$
$$\neg(\forall x \in S, P(x)) \iff \forall x \in S, \neg P(x) \tag3$$
$$\neg(\forall x \in S, P(x)) \iff \neg\forall x \not \in S, \neg P(x) \iff \exists x \in S^c, P(x) \tag4$$
Here, $(4)$ is the version in which negation is distributive. If $(4)$ is not correct, how does one determine what is to be negated in cases like the LHS above?
EDIT:
All even numbers are divisible by three: $\forall n \in \Bbb N, n | 3$
Obviously not true. What is true? Following the Law of Excluded Middle, $P \lor \neg P$. Since $P$ is false, its negation must be true. The following RHS expressions are true:
$\neg(\forall n \in \Bbb N, n | 3) \iff (\neg \forall n \in \Bbb N, n | 3 ) \iff (\exists n \in \Bbb N, \displaystyle \frac n3 \not \in \Bbb N)$
However, it is also true that there exists a number outside of the naturals that is divisible by three, tagged as $(4)$ here. So, if we assume LEM, my above list is shortened:
$$\neg(\forall x \in S, P(x)) \iff \neg\forall x \in S, P(x) \iff \exists x \in S, \neg P(x)\tag1$$
$$\neg(\forall x \in S, P(x)) \iff \neg\forall x \not \in S, \neg P(x) \iff \exists x \in S^c, P(x) \tag4$$
It is not the case that all naturals are disivisble by three. It is the case that there exists naturals that aren't divisble by three. It is also the case there exists non-natural numbers that are divisible by three. Both $(1)$ and $(4)$ satisfy LEM in the given example, and both of them seem like ways of negating the example proposition. Which one is correct? When not assuming LEM, which is correct then?

A:
$$\neg(\forall x \in S, P(x)) \iff \neg\forall x \in S, P(x) \iff \exists x \in S, \neg P(x)\tag1$$

Only option $(1)$ is correct:
\begin{align}&\neg\,\forall x {\in}S \; P(x)
\\\equiv{}&\neg\,\forall x\; \Big(x \in S \to P(x)\Big)
\\\equiv{}&\exists x\; \neg\Big(x \in S \to P(x)\Big)
\\\equiv{}&\exists x\; \neg\Big(x \notin S \:\lor\: P(x)\Big)
\\\equiv{}&\exists x\; \Big(x \in S \:\land\: \neg P(x)\Big)
\\\equiv{}&\exists x{\in}S\; \neg P(x).
\end{align}
(Please refer to Quantifier notational shorthand.)
And so, $$\neg\,\exists x{\in}S\; Q(x)\equiv\ \forall x {\in}S \; \neg Q(x).$$

EDIT:
All even numbers are divisible by three: $$\forall n \in 2\Bbb N, n|3$$
Obviously not true. What is true?

Some even number is indivisible by three: $$\exists n {\in} 2\Bbb N\quad n\not|\,\:3.$$
This makes sense, since you would negate

*

*Every person has a mother  (T)

not with (option 4)

*

*Some non-person has a mother  (T)

but with (option 1)

*

*Some person has no mother.  (F)

Is negation distributive?

No, negation is not straightforwardly "distributive",  but it can be—using De Morgan's laws—if we first convert every conditional $\Big(A(x)\to B(x)\Big)$ to $\Big(\lnot A(x) \lor B(x)\Big).$

A: Hint: Expand the restricted quantifiers as follows:
$\forall x (x\in S \Rightarrow P(x))$ and $\exists x(x\in S\wedge P(x))$.
Moreover, $\exists x$ corresponds to $\neg \forall x (\neg ...)$ and $\forall x$ corresponds to $\neg \exists x (\neg ...)$.


text:
Q: Ger error when trying to run parallel builds on maven release prepare and perform task? I've found some ways to increase the speed of our standard maven builds such as only building modules that have changed and utilising parallel builds. For the task:
clean release:prepare release:perform
It takes a while and I'd like to speed up. It seems the parallel builds doesn't work I get an error.
The error I get when running parallel builds is:
[ERROR] NullPointerException
[ERROR] java.util.concurrent.ExecutionException: java.lang.NullPointerException

when running command:
clean -T 1C release:prepare release:perform

This seems to be the only error I get - not sure why? This isn't a problem when I run a normal build with this flag.
Also any suggestions on how else to speed up this process? I assume I could skip tests and they're already being done on the builds on the dev branch before it's merged with master?
edit: Have added below error message with debug flag:
[INFO] Final Memory: 42M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] NullPointerException
java.lang.NullPointerException
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.calcImports (DefaultMavenPluginManager.java:470)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm (DefaultMavenPluginManager.java:355)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm (DefaultBuildPluginManager.java:231)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:102)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:200)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:196)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
[ERROR] java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report (FutureTask.java:122)
    at java.util.concurrent.FutureTask.get (FutureTask.java:192)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.multiThreadedProjectTaskSegmentBuild (MultiThreadedBuilder.java:140)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder.build (MultiThreadedBuilder.java:101)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: java.lang.NullPointerException
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.calcImports (DefaultMavenPluginManager.java:470)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.setupPluginRealm (DefaultMavenPluginManager.java:355)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getPluginRealm (DefaultBuildPluginManager.java:231)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:102)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:200)
    at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:196)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
[ERROR]

A: Thanks @khmarbaise for suggesting the fix. This can be solved with latest maven version and can be seen described in the release notes for version 3.6.1
http://maven.apache.org/docs/3.6.1/release-notes.html


text:
Q: jQuery slideshow - Images after the first one are not showing up I am trying to create an image slideshow. I have managed to develop the following code so far.  The problem is the following code displays the first image only. After the page loading is complete, the first image shows up perfectly from left and fades away after few seconds and then rest of the images just do not show up.
Could you please tell me how to show the rest of the images one after another?

CSS

A: See if this is what you are looking for:-
Fiddle
   $(function () {
    var imgArr = $('img').get(); // get the images in an array
    slide(); // invoke slide initially

    function slide() {

        var img = imgArr.shift(); //get the first image from the array
        imgArr.push(img); //push it back to the array for the cycle to happen
        $(img).show('slide', {
            direction: 'right'
        }, 1000, function () { //give image slide in in the call back of show
            $(this).delay(500).hide("slide", {
                direction: 'left'
            }, 1000, function () { // in the call back of hide call slide again.
                window.setTimeout(slide, 10);
            });
        });
    }
});

A: So it sounds like you're trying to show the images in sequence. There are a few ways you could do that. Here's one:
$(document).ready(function() {
    var images = $('.slider img').hide();
    var current = 1;

    setInterval(function() {
       images.eq(current).hide("slide", {direction:'left'}, 1000);
       current = (current + 1) % images.length;
       images.eq(current).show("slide", {direction:'right'}, 1000);
    }, 5500);

    images.first().show();
});


text:
Q: How to build with multiple cores in Ubuntu 16.04 and TexStudio? I would like to speed up the building of my latex documents, and I'm curious if it's possible to use all four of my processor cores when building documents.
There are instructions for windows users, but I haven't found any for linux users.

A: TeX engines are one-threaded, so they cannot distribute the load to multiple cores.  TeX processing often require running external programs (biber, bibtex, makeindex), but since they need files produced by TeX and send their results to TeX as files, you cannot do much here either.
Still, there is an advantage of having a multicore machine:  if your editor (or TeXStudio) runs on one core, and a TeX engine on another one, this will speed things up.  However, this is usually automatically done by your OS, and is transparent to you.
Another situation is processing rnw documents with knitr or Sweave.  While R is also one-threaded, it can parallelize computations using multicore package.  This can speed R parts considerably.

A: The pgf-manual describes a way to process tikzpictures with multiple cores in parallel:  see the entry for /tikz/external/mode for details.
short summary
You first need to externalize the creation of tikzpictures by including the following in your preamble:
\usetikzlibrary{external}
\tikzset{external/mode=list and make}

(see this answer, and also this answer in case you are using AucTeX)
This will create several auxiliary files in your working directory for each tikzpicture.  You may want to keep these auxiliary files in a separate subdirectory like this:
  \tikzexternalize[prefix=figures/]

Note that the subdirectory specified needs to exists.
Now you can compile with the following routine:
%step 1: generate main.makefile:
pdflatex main
% step 2: generate ALL graphics on 2 processors:
make -j 2 -f main.makefile
% step 3: include the graphics:
pdflatex main


text:
Q: Forwarding multipart/form-data using NextJS api I am having a bit of trouble forwarding multipart/form-data using NextJS api.
async function proxy(req: NextApiRequest, res: NextApiResponse): Promise<void> {
    const { body, headers, method, url } = req;

    // Doing some work to handle authentication

    const rewriteUrl = url?.replace('/api/proxy', '');

    const config: AxiosRequestConfig = {
        url: rewriteUrl,
        method: method as Method,
        headers: {
            cookie: '',
            Authorization: token,
        },
        data: body,
    };

    try {
        const { data: originalData, status } = await axiosInstance(config);
        return res.status(status).json(originalData);
    } catch (err) {
        return res.status(err.status).json(err);
    }
}

export default proxy;

When calling the API directly or using non multipart/form-data network calls, no problem whatsoever. However, when proxying a multipart/form-data, I am receiving 413 Payload Too Large

I am have been trying to use
export const config = {
    api: {
        bodyParser: false,
    },
};

but in that case the backend API is responding with 400 telling that the file doesn't exist.
As am I adding an authentication header before forwarding the request, can this be the culprit as the content size change?


text:
Q: Update Screen using JavaScript I am working with JavaScript and have made a cool program to chop up a photo and average the colors. I was adding a progress bar and whatever I did (have it in the loop that averages and have an set interval command) it would not update until the loop completed. I was wondering if anyone knew how to either force update the screen instead of calculating or a different way to solve this problem... thanks in advance.

    <input id="input" type = "file" onchange="changeCanvas()" accept="image*/">
    <input type = "number" min="1" value="1" id="numb" onchange="calculate()">
    <input type="checkbox" id="check" value = "1">
    <input type="button" onclick= "calculate()" value ="Update">
    <input type="checkbox" id="mode" value = "1">
    <!input type="color" id="color" onchange= "addColor()">

    <progress id="bar" value="0"> </progress>

    <canvas id = "canvas"></canvas>

    <canvas id = "canvas2"></canvas>

A: You could try using the meta refresh tag...
 <meta http-equiv="refresh" content="30">

this will refresh it every 30 seconds


text:
Q: Ubuntu 15.10 GRUB menu option disappeared after updating Ubuntu 14.04 I have a computer system with multiple disks.  I have Ubuntu 14.04 LTS installed as my main OS, but I also have Windows 7 installed on a separate disk.  I more recently installed Ubuntu 15.10 on yet another disk and when I did, the installer apparently saw that I had 14.04 installed also and created a boot menu with both 15.10 as the default and 14.04 as an option.  This was not what I intended, I intended to switch between 14.04 and 15.10 via firmare boot options and have the two Ubuntu installs unaware of each other unless I decided to mount the other disk, but whatever, everything was working OK.  I used 15.10 for a while and then booted back into 14.04 after maybe a few months.
Unsurprisingly, the 14.04 install had a large number of updates pending, so I went ahead and updated using the Software Updater as usual.  I think one of the updates was for GRUB.  When I rebooted after the updates were installed, the option to boot into 15.10 was no longer available.  I tried using the boot-repair utility on my live Ubuntu 14.04 USB drive, but it suggested I do something that looked potentially dangerous to me, namely:
sudo chroot "/mnt/boot-sav/sda2" dpkg --configure -a
sudo chroot "/mnt/boot-sav/sda2" apt-get install -fy
sudo chroot "/mnt/boot-sav/sda2" apt-get install -y --force-yes dmraid
sudo chroot "/mnt/boot-sav/sda2" dmraid -ay
sudo chroot "/mnt/boot-sav/sda2" apt-get install -y --force-yes lvm2
sudo chroot "/mnt/boot-sav/sda2" apt-get purge -y --force-yes grub*-common grub-common:i386 shim-signed linux-signed*
so I cancelled that action and had it generate a boot info report which can be found here:
http://paste.ubuntu.com/15146374/
Can anybody help me figure out what went wrong and how I should go about fixing it?  If it is safe to use the boot-repair utility's suggestion I can do that.  I guess I can even reinstall 15.10 if need be, but I think the 15.10 data is still there and I want to understand what happened so I can prevent it from happening in the future.  Thanks very much in advance for any help!

A: If I'm reading your output correctly, Ubuntu 15.10 is installed in an LVM logical volume called /dev/mapper/ubuntu-vg-root; however, the script has been unable to identify the filesystem on that logical volume. This probably means that either:

*

*The script can't detect Ubuntu 15.10 because of a bug or misconfiguration -- This is the more optimistic cause, but it doesn't really help much because it means you're missing data. You might first try ls /dev/mapper/ubuntu-vg-root from Ubuntu 14.04. If the file isn't present, you may need to install some LVM components in Ubuntu 14.04 (try sudo apt-get install lvm2). If that causes /dev/mapper/ubuntu-vg-root to appear, try sudo update-grub and see if that helps. If /dev/mapper/ubuntu-vg-root is already present, then you could try sudo blkid /dev/mapper/ubuntu-vg-root, and/or try mounting it, to verify that the filesystem is intact.

*The filesystem is damaged -- If the filesystem on /dev/mapper/ubuntu-vg-root is damaged, then you're in trouble. If you've got any critical data on that installation, you should first do a low-level backup, as in sudo dd if=/dev/mapper/ubuntu-vg-root of=/path/to/lots/of/space/u1510-backup.img. You can then try sudo fsck /dev/mapper/ubuntu-vg-root to repair it. If the repair is successful, doing a sudo update-grub might bring it back to the boot menu.

An entirely different approach is to try another boot method. In particular, my rEFInd boot manager might help:

*

*Download the USB flash drive or CD-R version of rEFInd from its downloads page.

*Prepare a boot medium from rEFInd.

*If Secure Boot is enabled, disable it. (You can re-enable it later, if you like.)

*Boot to the rEFInd medium. It should show options for both of your Ubuntu installations, although the labels may not be clear. The 14.04 installation will probably refer to booting boot\vmlinuz-3.13-*, whereas the 15.10 installation will probably refer to booting vmlinuz-4.2.0-* (no leading boot\, and a higher kernel version number).

*Highlight the 15.10 entry and hit F2 or Insert twice. This will open a simple text-mode line editor with kernel options.

*Add ro root=/dev/mapper/ubuntu-vg-root to the boot options.

*Hit Enter.

If rEFInd boots Ubuntu 15.10, you can install the rEFInd Debian package or PPA. This will make rEFInd the default boot program. You can do the installation from either distribution, but with different consequences:

*

*From 14.04 -- Both distributions' kernels will show up in the rEFInd menu, so you'll be able to boot either directly; however, you'll need to add kernel options manually when you boot 15.10, at least the first time you do so. (You can run the mkrlconf script, which comes with rEFInd, from 15.10, to create a configuration file that obviates the need to manually modify the boot options. You'll need to copy that script from the 14.04 installation, or at least mount the 14.04 partition in 15.10 so you can access that script.)

*From 15.10 -- The configuration file created by mkrlconf will be created automatically by the package installation, so you'll be able to boot 15.10 without modifying its boot options; however, the EFI filesystem driver needed to access your 14.04 kernel will not be installed. Thus, to boot 14.04, you'll need to do so via GRUB, which should appear as an option. You can manually install the ext4fs driver, or re-install rEFInd from 14.04, if you want to be able to boot the 14.04 kernel directly from rEFInd, without using GRUB.

Note that using rEFInd will probably not work if the filesystem for your 15.10 installation is damaged. At best, it will show an option for the 15.10 kernel, but launching that kernel will fail at some point, perhaps with a message about filesystem damage. rEFInd is most likely to be helpful if the root cause is a lack of LVM support in Ubuntu 14.04 or some other glitch in the GRUB scripts for detecting Ubuntu 15.10.