- Be sure to have correct versions of org-netbeans-modules-java-j2seproject-copylibstask.jar. For example, if you are building with JDK6 but the copylibstask.jar is built with JDK7, you will get "Unsupported major.minor version 51.0" error.
- Reference copylibstask.jar in ant.bat runAntNoClasspath section as follows: "-Dlibs.CopyLibs.classpath=%ANT_HOME%\extra\org-netbeans-modules-java-j2seproject-copylibstask.jar". If you don't do this in ant.bat and you have Netbeans installed, ant will look for copylibstask.jar in Netbeans install dir which means your build dependens on having Netbeans installed.
- If you get "Class not found: javac1.8", it means you ant version is too old and not compatible with JDK8.
- If your modules have forms, you need a copy of swing-layout jar file. This jar includes the org.jdesktop.layout.GroupLayout class.
- You have to add dependencies to build.xml. These dependencies are specified in nbproject/project.properties in the javac.classpath section. Example:
Monday, July 30, 2018
Building a NetBeans project on a computer without Netbeans
When building a NetBeans project with ant on a computer without Netbeans, you have to pay attention to the following:
Friday, July 20, 2018
Solving the Monty Hall problem using Bayesian inference
The Monty Hall problem is one of my favorites. I came across How to solve the Monty Hall problem using Bayesian inference, which used my other favorite topic, Bayesian inference. My only criticism of the post is that P(E) is a little confusing. The following formulation with separate P(B*) and P(C*) notation suits me better:
P(B*) = Probability that Monty will open door B (given that the user has chosen door A) = 1/2
P(C*) = Probability that Monty will open door C (given that the user has chosen door A) = 1/2
P(C*/B) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door B) = 1/1
P(C*/A) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door A) = 1/2
P(B*/C) = Probability that Monty will open door B (given that the user has chosen door A and car is behind door C) = 1/1
P(A/B*) = Probability that the car is behind door A, given that Monty has opened door B = P(B*/A) * P(A) / P(B*) = 1/2 * 1/3 * 1/2 = 1/3
P(C/B*) = Probability that the car is behind door C, given that Monty has opened door B = P(B*/C) * P(C) / P(B*) = 1/1 * 1/3 * 1/2 = 2/3
P(A/C*) = Probability that the car is behind door A, given that Monty has opened door C = P(C*/A) * P(A) / P(C*) = 1/2 * 1/3 * 1/2 = 1/3
P(B/C*) = Probability that the car is behind door B, given that Monty has opened door C = P(C*/B) * P(B) / P(C*) = 1/1 * 1/3 * 1/2 = 2/3
As you can see, it is two times better to switch doors, i.e. if Monty has opened door B, switch to door C. If Monty has opened door C, switch to door B. Note that if Monty was truly random, then the probabilities of P(C*/B) and P(B*/C) would not be 1/1 but 1/2 which in turn would cause P(C/B*) and P(B/C*) to be 1/3 and switching doors would make no difference. The probabilities change due to Monty knowing where the car is, i.e. by opening a door, Monty adds non-random information (evidence) into the system and we have to update the initial probabilities which were valid before this information.
Interesting variation of this problem [Think Bayes, p.10]: What if Monty always chooses door B when B does not have a car behind?
P(B*) = Probability that Monty will open door B (given that the user has chosen door A) = 1/2
P(C*) = Probability that Monty will open door C (given that the user has chosen door A) = 1/2
P(C*/B) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door B) = 1/1
P(C*/A) = Probability that Monty will open door C (given that the user has chosen door A and car is behind door A) = 1/2
P(B*/C) = Probability that Monty will open door B (given that the user has chosen door A and car is behind door C) = 1/1
P(C/B*) = Probability that the car is behind door C, given that Monty has opened door B = P(B*/C) * P(C) / P(B*) = 1/1 * 1/3 * 1/2 = 2/3
P(A/C*) = Probability that the car is behind door A, given that Monty has opened door C = P(C*/A) * P(A) / P(C*) = 1/2 * 1/3 * 1/2 = 1/3
P(B/C*) = Probability that the car is behind door B, given that Monty has opened door C = P(C*/B) * P(B) / P(C*) = 1/1 * 1/3 * 1/2 = 2/3
As you can see, it is two times better to switch doors, i.e. if Monty has opened door B, switch to door C. If Monty has opened door C, switch to door B. Note that if Monty was truly random, then the probabilities of P(C*/B) and P(B*/C) would not be 1/1 but 1/2 which in turn would cause P(C/B*) and P(B/C*) to be 1/3 and switching doors would make no difference. The probabilities change due to Monty knowing where the car is, i.e. by opening a door, Monty adds non-random information (evidence) into the system and we have to update the initial probabilities which were valid before this information.
Interesting variation of this problem [Think Bayes, p.10]: What if Monty always chooses door B when B does not have a car behind?
Wednesday, July 18, 2018
Behaviour before intellect
A friend of mine who has a young child asked me whether I had any curriculum in mind for teaching a child. I told him that for my 6 year old, my focus was on making sure that he was behaving properly, i.e. basic discipline, not on any intellectual subjects like mathematics. Behaviour is the foundation on which everything else is built.
Thursday, July 05, 2018
Difference between hub and switch
You can listen to traffic/packets by connecting to a hub but not a switch.
The Difference Between a Router, Switch and Hub: "In a hub, a frame is passed along or "broadcast" to every one of its ports. It doesn't matter that the frame is only destined for one port... A switch, however, keeps a record of the MAC addresses of all the devices connected to it. With this information, a switch can identify which system is sitting on which port. So when a frame is received, it knows exactly which port to send it to..."
How do i capture all traffic on a switch: "A switch will never forward 'other' traffic (traffic that is not directed to your ethernet mac address + broadcast) to your port unless you tell it to do so. So, if you did not configure a mirror port on the switch, you will only see ... your own traffic & traffic to multicast and/or broadcast addresses"
The Difference Between a Router, Switch and Hub: "In a hub, a frame is passed along or "broadcast" to every one of its ports. It doesn't matter that the frame is only destined for one port... A switch, however, keeps a record of the MAC addresses of all the devices connected to it. With this information, a switch can identify which system is sitting on which port. So when a frame is received, it knows exactly which port to send it to..."
How do i capture all traffic on a switch: "A switch will never forward 'other' traffic (traffic that is not directed to your ethernet mac address + broadcast) to your port unless you tell it to do so. So, if you did not configure a mirror port on the switch, you will only see ... your own traffic & traffic to multicast and/or broadcast addresses"
Subscribe to:
Posts (Atom)