Hi! My name is João Trindade and this is the web place where I share all of my stuff with the rest of the world.
I am an IT Engineer taking a PhD course at IST, Portugal. My interests in the IT field include Network Management, Project Management, Enterprise Architecture, Free Software and programming in general.
Tagged:  •  

...because it sets you free!

Tagged:  •  

I've been playing with the network simulator ns-3. So it is likely that several post of this simulator show up in this page.

This is the "first" example of the tutorial source code, commented to provide a better help:

  1. #include "ns3/core-module.h"
  2. #include "ns3/simulator-module.h"
  3. #include "ns3/node-module.h"
  4. #include "ns3/helper-module.h"
  5.  
  6. using namespace ns3;
  7.  
  8. NS_LOG_COMPONENT_DEFINE ("FirstScriptExample");
  9.  
  10. int
  11. main (int argc, char *argv[])
  12. {
  13. LogComponentEnable("UdpEchoClientApplication", LOG_LEVEL_INFO);
  14. LogComponentEnable("UdpEchoServerApplication", LOG_LEVEL_INFO);
  15.  
  16. //Creates two nodes (simply creates them and keeps references, nothing more)
  17. NodeContainer nodes;
  18. nodes.Create (2);
  19.  
  20. //This is the helper that will create the CHANNEL and the NET_DEVICE (driver)
  21. PointToPointHelper pointToPoint;
  22. //The data rate for the connection
  23. pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
  24. //The delay associated with the channel
  25. pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
  26.  
  27. /* We now have a node container with two nodes and a PointToPointHelper that
  28.   knows how to PointToPointNetDevices and PointToPointChannels */
  29.  
  30. // Just like a node container, NetDeviceContainer stores all net devices)
  31. NetDeviceContainer devices;
  32.  
  33. //Our helper will create the netdevices for the nodes and also associate them with the channels
  34. devices = pointToPoint.Install (nodes);
  35.  
  36. /* We now have two nodes, connected with channels and the respective point to point devices */
  37.  
  38. // Let's give the IP stack to the nodes. The InternetStackHelper will do that
  39. InternetStackHelper stack;
  40. stack.Install (nodes);
  41.  
  42. //Now we must configure our devices in the nodes to have IP addresses */
  43. // For that we configure the ipv4 helper
  44. Ipv4AddressHelper address;
  45. address.SetBase ("10.1.1.0", "255.255.255.0");
  46.  
  47. // Performs the address assignment (as configured previously) and store the IPV4 addresses in a container
  48. Ipv4InterfaceContainer interfaces = address.Assign (devices);
  49.  
  50. //The UdpEchoServerHelper will create the UdpEchoServer. The parameter is the port used by the application
  51. UdpEchoServerHelper echoServer (9);
  52.  
  53. //Let's put the server in the second node
  54. ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
  55. //All servers applications (only one in this case) will run from second 1 to second 10
  56. serverApps.Start (Seconds (1.0));
  57. serverApps.Stop (Seconds (10.0));
  58.  
  59. //The UdpEchoServerHelper will create UdpEchoServers. The first parameter is the ipv4 address
  60. //of the server, the second is the remote port
  61. Ipv4Address serverAddress = interfaces.GetAddress (1);
  62. UdpEchoClientHelper echoClient (serverAddress, 9);
  63.  
  64. //Configures the Maximun number of packets sent in this simulation (only one)
  65. echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
  66. //Says how long to wait beetween packets
  67. echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
  68. //The name says it all, what is the size of the packet
  69. echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
  70.  
  71. //Install the client in the first node
  72. ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
  73. //All client applications (only one in this case) will generate traffic from second 1 to second 10
  74. clientApps.Start (Seconds (2.0));
  75. clientApps.Stop (Seconds (10.0));
  76.  
  77. Simulator::Run (); //Runs the simulation and the function only returns after the sim is finished
  78. Simulator::Destroy (); //Clean up the objects created for the sim
  79. return 0;
  80. }

To run, copy the example to scratch/first.cc and execute

  1. ./waf --run=scratch/first

Tagged:  •    •    •    •  

If you don't have, first install mercurial:

  1. sudo aptitude install mercurial

Optionally, install bazaar to fetch the PyBindGen:
  1. sudo aptitude install bzr

Now go get ns-3:
  1. hg clone http://code.nsnam.org/ns-3-allinone

Get the latest ns-3 developer version with ns-3 regression traces:
  1. ./download.py -n ns-3-dev -r ns-3-dev-ref-traces

Configure ns-3:
  1. cd ns-3-dev
  2. ./waf configure

Build ns-3 (may take a while):
  1. ./waf build

Run a simple example:
  1. ./waf --run=first

Tagged:  •    •  

Today I was hearing Steve Gibson's podcast, Security Now, which was about the new Internet Explorer 8.

And I'm truly amazed. Finally there is one feature in an IE that I wish to see on Firefox.

The url bar of IE 8 highlights the domain part of the URL. The letters of the top domain are black, while the rest of the URL is a light gray.

This helps the user to identify what is the site that he is visiting, and is a first barrier against phishing attacks.

I've never though I would say this: Good idea Microsoft!

Now it's just wait for Firefox implement it also.

Just a small note: I only have linux so I can't try IE8. The image of the url bar was stolen from this site.

Update: It's already on Firefox. Thanks to Ben McDonald for the comment.

The Locationbar2 extension does exactly this functionality. Checkout out the image:

Hurray for free software!

Tagged:  •    •  

Just a disclaimer: I've never done a "real" web app. My opinion in the following subject is extremely fragile and can be easily refuted.

A long long time ago, my father, while I was studying for the Database Systems course, asked me (ironically) if I could explain him what's the use for Foreign Keys on today's databases.

And the truth, after all these years, I still haven't been able to give him an explanation.

Fourth generation programming languages (I'm talking about SQL) were designed to be usable by non-programmer in a simple way. It was supposed for "clients" of a database to interact directly with the data through a very high level language.

Fortunately this has never happened, and the communication with databases is always wrapped by some kind of code (sometimes with an ORM framework).

Foreign keys are constraints which serve to guarantee data integrity. They are useful in the hypothetical situation where clients could tamper with the data directly. And, as nothing comes free, ensuring this constraints costs important CPU cycles.

Today's applications don't rely on these mechanisms to guarantee database integrity. It is the wrapper around the DB that ensures it.

So the question is: in applications where it is important to optimize database queries why use foreign keys?? And this leads to another question, why don't companies supply DBMS that don't have the foreign keys functionalities??

Can anyone answer this?

ps: In my applications I don't explicitly set foreign keys. Even if the performance is not a requirement. It just seems stupid to use something that shouldn't be there.

ps2: To make my opinion even clearer: I don't believe foreign keys in today's Relational DBMS have any relevance. They are just a performance penalty.

Syndicate content