Saturday, April 06, 2013
Having set the scope of this article, it is important to address the fact that it is very important to point out that when a baby is conceived, the couple is pregnant not just the mother. The responsibility falls to both the man and the woman. Paying child support is not even near the share of responsibility that the father should take on. It is sad that the justice system makes it seem that by just paying child support, the father is off the hook. The father should be forced by the justice system to have more responsibly such as baby sitting, spending sleepless nights, taking the child places and cleaning diapers. My suggestion is that if the father fails to comply with any of those, he should pay a fine and also be sterilize. This might sound like the government intruding on areas it should not, but I prefer that than having women abort their children because they will not have the support they need. By sterilizing the bad fathers, we as society can ensure that they won't be doing that to another woman.
Sterilizing procedures might sound a little bit extremist, but it can help curve spending on social welfare. I do believe in having some sort of safety net for poor children and poor elderly, however we as society need to be smart about it. Allowing people to have a large amount of children and then ask for welfare assistance sounds really dumb. People might disagree on how many children is too much for families assisted by the government. I suggest that two is enough. If a family has two or more children and they need welfare assistance the government should sterilize the couple to prevent them from having more kids. This will free up more welfare resources for other children, like those with severe health challenges who might otherwise be aborted by couples who believe that abortion is a way to avoid the cost and time associated with taking care of a child challenged with severe health problems.
This bring another excuse people often use to justify abortion. Some people believe is OK to abort a child if the child is going to have severe health problems during his/her life. We don't often see (or even allow) parents to go their child dying of cancer and killing him/her to "spare" him/her from the pain. Many people who are born and live through sever health challenges do not commit suicide, which could mean that even if life is very tough there is either light at the end of the tunnel or there are some aspects in life that are worth living for. The same could be said about the "undesired" children, children who grew in families were they were not loved like they should. Many of them have had a terrible childhood life; but many of them are able to break away and find happiness even if it is at latter point in time or a reason to live for.
If couples are not willing to take care of their children if they are born with severe health problems, then I suggest they don't try to have babies on their own at all. There will always be risks with new babies and many parents are willing to receive their new babies as they are. If some couples are not willing to take that responsibility, then I suggest they sterile themselves to "spare" themselves from that risk. I then suggest they find an orphan toddler who looks healthy and adopt the child. I am not being sarcastic, I think this is a better solution than having the couple abort a child because the child happened to have some health problems.
Unplanned pregnancies can be avoided by abstinence or by using any kind of contraceptive. I truly believe abstinence works 100% of the time, but for people who do not believe in abstinence, contraceptives like condoms should be a no-brainier. There is no excuse for not using one. Thanks to movies, TV shows, schools, peers and the Internet, pretty much everybody knows what they are and how to use them. This responsibility should fall 100% on the man; no condom, no sex. If you are stupid enough to decide not to use them, please do society a favor and have a vasectomy (yes I am suggest this a lot, but it is very effective). Human kind does not need your stupidity genes in our Gene Pool, we have plenty enough.
If a couple do not have money to buy contraceptives, then they have bigger problems than trying to get contraceptives. Instead of spending time having sex, they probably should be spending all their spare time on finding ways of earning more money; like a second job or inventing something everybody needs. Sexual relationships are not unnecessary to human survival like food or medicines, so I do not support the government subsidizing contraceptives. We might as well subsidize video game consoles and music downloads. However, if it really comes down to either using tax money for contraceptives or aborting children, then please take my tax money and spare the babies.
The final excuse that I want to address is probably the most prominent. Women's right to choose what they want for their bodies. I do believe on individuals on having the right to do whatever they want o their bodies. If they want a tattoo or chop the ears, let them do it. Because of biological reasons, women are the ones who host the development of new humans beings in their bodies. Yes, nobody asked them, but that is just reality. So even though women do have the right to do anything they want to their body (arms, ears, liver, lungs, etc), the new human baby developing in their womb is off-limits because anything damaging the baby inside is violating the baby's right to his/her body.
This brings another popular excuse: the baby is not really a person and is just a fetus and equivalent to a liver or to a kidney and therefore has no rights. The baby inside feels pain, moves, has a brain, has a palpitating heart, digests food and breaths. To me, that pretty much shows he is a human child. I really don't understand when people give this excuse since most of that same people would rightly fight tooth-and-nail to protect a child that is outside the womb. One of the excuses is that the baby inside the womb is completely dependent on his/her mother and therefore cannot be classified as a person. This argument is moot if you consider that newborn babies are also 100% dependent on another human being for protection and for food and they are classified as persons. I honestly do not see the difference between a newborn outside the womb and a child developing inside his/her mother. They are both humans and they both depend on their mothers to survive. They should have the same rights, including the most important one: the right to life.
Monday, April 01, 2013
- Click “Database Fields”
- Click “SQL”
- Click “Execute”
Friday, November 02, 2012
The following allows you to use JNDIRealm's LDAP authentication to authenticate users of OpenXava application with Active Directory. The users will be prompt to enter their windows credentials, when entering the usernames they need to avoid entering the domain name; they just need to enter the username.
If you have multiple Active Directory domains to authenticate against, you can use org.apache.catalina.realm.CombinedRealm to allow Tomcat to search on both.
In the web.xml you will need to specify the security-constraint setting. This will force the user to authenticate when they reach any OpenXava module. in role-name, you have to enter the Windows Group name of that is allow to access the application. If you need finer restrictions, you can use OpenXava's Users.getCurrent() to get the username of the current user in your Java code. For example, you could have a validation logic to prevent a certain user from creating a new record.
Please note that you must use a security-constraint setting in web.xml in order to use Users.getCurrent() in your Java code.
web.xml in app folder
<display-name>Example Security Constraint</display-name>
<!-- Define the context-relative URL(s) to be protected -->
<!-- If you list http methods, only those methods are protected -->
<role-name>THE NAME OF A WINDOWS GROUP (NO NEED TO SPECIFY DOMAIN NAME)</role-name>
<role-name>THE NAME OF A WINDOWS GROUP (NO NEED TO SPECIFY DOMAIN NAME)</role-name>
In the server.xml file, you need to add the JNDIRealm that will allow Tomcat to connect to Active Directory via LDAP. The example below uses the CombinedRealm class to combine two Active Directory domains.
server.xml in tomcat's conf folder
<!-- make sure to remove the existing realms –>
<Realm className="org.apache.catalina.realm.CombinedRealm" >
In your OpenXava java code, you can obtain the username (no domain name) of the user visiting the page by calling Users.getCurrent(). The Users class lives in the org.openxava.util package
This approach works inside of a secure Intranet, hence the sending of credentials in plain text (BASIC in auth-method). To improve security, please configure Tomcat to use HTTPS only.
You can use a similar configuration to allow other Java web based application to authenticate users with Active Directory. You would probably have to modify the web.xml of the app and use the same server.xml configuration shown here.
Sunday, July 29, 2012
Tuesday, May 01, 2012
I a few years ago, I posted an article about why I preferred GameMaker over Multimedia Fusion. A lot has happened since then, Clickteam released many exporters for MMF (Flash, IOS and others) and YoYo Games have made HTML5 gaming GameMaker’s new target. Another product has been in the works too, Scirra produced Construct2 as a HTML5 game maker. Just like I reached my conclusion back then through spending time on GameMaker, I have come to the conclusion that Scirra’s Construct2 is a very worthy contender to both by spending some time using it and writing plugins for it.
Construct2’s main target is HTML5 gaming, however, it is straight forward to create exporters for it and I am actually working on a XNA exporter for it. I have also created plugins that allow Construct2 games to create simple 3D games (WebGL via Copperlicht), online multiplayer games (through websockets) and isometric games (through a Z sorter plugin).
The plugin system allows experienced programmers to design their game code in a clean way using separation of concerns (which they should be doing in the first place). You can write your heavy custom logic into plugins and use the event editor to glue the plugins together. If you are just a beginner, you can use the many built in plugins and behaviors (8 dir movement, car movement, physics, Facebook, platform movement, particle system, etc.) or use the many plugins made by the community.
Construct2’s HTML5 game engine is currently faster than GameMaker’s in canvas mode. Construct2 also allows you to use webgl in your game and that makes your game graphics even faster.
It will be exciting to see how MMF and GameMaker will react to the many features that Construct2 brings to the world of beginner’s game making.
Thursday, April 19, 2012
Construct2 can use websockets to send and receive messages between games. By using socket-io, we can use a Node.js script as the server and my modification to the socket-io plugin for Construct2 to allow the games to synchronize data between them in real-time. There are two parts to this design: the Node.js server and the Construct2 clients (the games playing).
The main part of building an online multiplayer HTML5 game is to plan:
- how the clients will communicate
- how often and what to communicate
- how much of the logic will go into the server and how much to the client.
In my sample game, I chose to have each client own a player and have the server just relay messages:
- Use string messages in the form TypeOfMessage, Parameter1, Paremeter2, Parater3, etc to communicate.
- Have the clients send their player position about 16 times a second. Whenever their player shoots, the client needs to send a message immediately.
- Almost all of the game logic will reside in the client
The Server Script
The server runs in Node.js and functions as basically a relay of messages between Construct2 clients. The server needs to run outside of Construct2 because a construct2 game cannot run as a server, i.e. it cannot use your computer to “listen” to messages. It can only connect to a websocket server (in this case Node.js) and sent/receive messages to/from it.
If you look at the source code of the example_server.js file included in my plugin, you will see that the first thing we do is to listen in port 8099:
var io = require("socket.io").listen(8099);
The next thing we do is to staet listing for connections, and if we get one, we send the connecting client an initialization message:
socket.send('I,' + mySelf + ',' + mySelf + ',' + mySelf);
The initialization message simply tells the connecting client (the C2 game) the id of his player and the initial x and y coordinates for his player. Note that the message is just a string. I chose to make my messages sent from the server formatted in the following way:
TypeOfMessage, Parameter1, Paremeter2, Parater3, etc
The parts of the message are separated by commas. Next in the server script, we use a loop to send the connecting client the positions of each of the clients (players) already connected:
socket.send('C,' + entity + ',' + entity + ',' + entity);
This message type is C, which means that the client has to Create a player (in this case the other clients have to create the new player that just connected). We will see later how the Constrcut2 clients interpret those messages. After the positions of the players are sent to the connecting client, we broadcast the to the clients already connected that a new client has arrived and its id and initial position (which was set by this script):
socket.broadcast.emit("message",'C,' + mySelf + ',' + mySelf + ',' + mySelf);
Please note that the initial position is set by the server to the same position always for simplicity, however, in your game, there is no reason why you have to do this. You could have multiple random spots and just let the server assign any of those random spots.
The next part of the server script uses socket.on("message", function (data) to start listening to any messages sent by this newly connected client. This line is different from the previous io.sockets.on("connection", function (socket) in that the later line listens to connections only not messages.
Each message sent by the client can be a UM (update position) or a S message (shoot). The server splits by comma any message sent by the client, detects what kind of message is and then relays the message to all the other clients (players). Note that if th message is a UM (update position), the server will save the position so that it can send the correct position to any new client.
Each client is a Construct2 game that use the modified websocket plugin to send messages to the server (not to the other clients).
On the start of the playing layout, we connect to the Node.js server using its IP address:
Note that the IP address could be public or a LAN address. If public, the server (node.js) must be running in a LAN whose router redirects the 8099 to the computer running the Node.js server script.
Once connected, the client listens to messages from the server. The first message it will receive is an Initialization message:
When this message arrives, C2 will create a player in the coordinates given by the server and assign the owned player the id sent by the server. Note that plugin has a special action “Split Data Received” that splits the message into its parts (element 0 is the type of message, element 1 is the ID of the player, element 2 and 3 are the X and Y positions).
The client will also receive C messages to create the other players:
Finally, the client will receive messages to update the position of the other players or to have the other players shoot:
To update the position of the own player and to notify the shooting of the own player, the Construct2 game will send messages to the Node.js server when the conditions occur:
Note that it sends its player position every 0.07 seconds. Whenever their player shoots, the client also sends a message immediately.
The above picture give you a quick overview of how the parts discussed interact with each other. Please remember that you can make your message represent anything you want, e.g.: player picks up an item, player dies, etc. However keep in mind that you should limit the amount of information flowing. Choose the most basic messages that would allow your game to run parallel. For example in my sample game, I do not have a “Died” message because I am trusting that the clients are synchronized enough that if a bullet hits a player in one client, the same bullet will hit it in the other client because the bullet was created with the same position and velocity in all the clients.
There are some tips here on how to install Node.js and socket-io in your machine.
Online multiplayer takes a lot of discipline and knowledge. I strongly recommend that you start with something basic (like a pong game where you just update positions) and then move from there.
Monday, March 19, 2012
To prevent Visual Studio from using SQLEXPRESS when using Webparts and WebPartManger, you will need to override the "LocalSqlServer" connection string from your machine.config into your web.config file. To do that, add the following to the <connectionstrings> sections in your webconfig file:
<remove name="LocalSqlServer"> <add connectionstring="data source=.\YOURINSTANCENAME;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" name="LocalSqlServer" providername="System.Data.SqlClient"> </add>
Othwerise, if you do not have an instance named SQLEXPRESS in your machine, the page containing your WebPartManager will fail with the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)