David McCombs

Ranch Hand
+ Follow
since Oct 17, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by David McCombs

The double quotes is telling Ruby that it is a string so what you are probably getting for src is literally "<% @movie.trailer %>". Try "#{<% @movie.trailer %>}" and make sure that @movie.trailer is returning a string, or just remove the double quotes. You could also place a method in the helper module to generate the string in the correct format.

edit:

If you want the results of the code to display you need <%= %>, but I don't think that takes care of the string concatenation.
13 years ago

Originally posted by Shivit Agarwal:
Say,

Class XYZ
{....}

Class ABC
{
public static void MAIN(String[] args)
{ ............}
}

See here the MAIN is in Uppercase not main. Since Java is case sensitive the program should flag an error but it doesn't. This mean class ABC doesn't get compiled. And two files are formed -
1. XYZ.class(this is okay as it is compiled) but
2. ABC.class if this class doesn't get compiled then how come ABC.class is formed.




A class doesn't need a main method to be compiled, like was already said it is just another method.

Try to start execution with the class that has MAIN. That is where the error will occur.
16 years ago

Originally posted by Gaurav Ram:
Thanks all for replying. Like Kevin said:


We can do one thing that we can make reference of particular class and access its method/instance variables, like if we want to access instance variable PlayerName, we can write.... and same for other class also.

Will this solution does not work?




That would work because you have two references to two different objects. There is no ambiguity and no inheritance involved in doing so.
16 years ago
One key is that e1 and e2 point to the same object.

x=0

e1.count=e2.count = 0 //we will just call e1.count and e2.count, count from here on out

count = count + 1 //(0+1=1)
count = count + count //(1+1=2)
x=1
//end of first loop

count = count + 1//(2+1=3)
count = count + count//(3+3=6)
x=2
//end of second loop
count = count + 1//(6+1=7)
x == 2 so the if block does not execute
x=3
//end of third loop
//while block exits

walking through the code on paper is usually helpful. Adding in print statements to print out the value at certain points is also helpful.
16 years ago

Originally posted by Arman Sharif:


A base class should not be aware of its subclasses. If it is, then you should consider refactoring your design.



That was my point and the Packet class and its children are not my design. It is essentially a simple, useful PCAP wrapper.

Thanks for all the replies, it was helpful!
16 years ago
Thank you for responding.

I wasn't very specific but a packet is an object, a base class in fact. To parse TCP header information in the Packet object, the base class would have to know about its child.

I will look into the Visitor pattern and your last idea seems off the mark for my project. Once the needed information from a Packet is obtained, the Packet is discarded.

Here is the API that I am using: http://netresearch.ics.uci.edu/kfujii/jpcap/doc/javadoc/index.html
[ February 26, 2008: Message edited by: David McCombs ]
16 years ago
I am working on a project that receives an object of the base class. There are several inherted class(es). There are timing issues(this is a packet sniffer) that necessitate collecting the objects as its base class.

Is there a good way to cast the object types. Right now I just have a method for each subclass type that casts it and then parses the data according to the packet type. It works, but is there a more elegant way to go about it?
16 years ago
My program which uses the Jpcap library needs root access to gain access to the network interfaces. Is there a way to do this in code, so the program can drop root access when it doesn't need it?
16 years ago
From mysql.com: " Please note that at this point only the Windows Beta version is available. Linux and OS X releases will be available in 2008."

If you look n the GUI tools section there are GUI tools to manage a database at least in a rudimentary way, http://dev.mysql.com/downloads/gui-tools/5.0.html


I was able to download the alpha version of workbench through openSuSe's package manager.
16 years ago

Originally posted by Fred Rosenberger:


I disagree. interface 1 says "you will have a method called THIS that takes THESE parameters"

interface 2 says "you will have a method called THIS that takes THESE parameters"

Where is the conflict? the problem with the DDD is that it's hard to know which of the two implemented methods to actually run. but with interfaces, the method is only implemented once, so there is no ambiguity.




I am not saying this is good programming, but it is possible to have 2 interfaces that do different things, with the same method(s) signature.

The method is implemented once, but if the contracts are different, you don't exactly have the DDD, but you have just as big of a mess.

It is a moot point given that the odds of it happening are low, and it would mean that one(or both) of the interfaces haven't been thought through well enough.
16 years ago

Originally posted by Prad Dip:


Wasn't Rails the first framework to come up with it. Others followed it ?



I don't think that really matters. I seriously doubt convention over configuration didn't exist before Rails.

There may be Java based frameworks that have this philosophy, but since they are based on Java, they will not have the flexibility of Rails because of Ruby.
16 years ago
The web site from the books publisher doesn't say much, but has sample code. There wasn't many rails app in the code, just ruby files that leverage the rails API. In other words, the ruby files were not controllers or models. So perhaps it doesn't matter that much.

One of the rails app had this line: RAILS_GEM_VERSION = '1.2.5' unless defined? RAILS_GEM_VERSION

That leads me to believe that the material is not as tied to the underlying rails version.

Hopefully the author will respond.
16 years ago
I have this project for a class of mine, where I need to develop a plug in system for it. This is for a independent studies masters course not an assignment.

The purpose of the program is to try and fill the gaps between networking books and network simulators for beginning students. The simulators I have used, create a network based on certain parameters and spit out statistics after it has been run. What happens during the simulation is almost always a black box.

That has its uses, but is not that useful to beginning computer science networking students. My program will hopefully open that black box so the students can see how the protocols work and interact. An example is run an ARP simulator(either on a real network(via Jpcap), or a simulated one). The ARP simulator should be a plug in.

Ideally, the undergrad student should be able to write his/her own plug in and run it in my program. Therefore it needs to be very simple.

What I am thinking of is creating GUI/networking/Jpcap wrappers that the plug in writer will use, and then using convention over configuration, be able to load these plug-ins at runtime just by scanning what is in the plug in folder. By having a set convention, I am hoping that the plug-ins will be very simple to write.

Does this sound like I am on the right path? I haven't found very much useful information online, and any relevant links or pointers are greatly appreciated.
16 years ago

Originally posted by Gavin Tranter:
I think, and this is my personal view, that thinking of interfaces as a method of multiple inheritance is "wrong".



I agree. It is possible for a class to implement 2 interfaces with the same method signature, so the chances of the DDD is still possible.
16 years ago

Originally posted by Prad Dip:
I like the scaffloding feature of RoR.It is really cool.

I think developers have to test more when they are usinf Ruby.



Scaffolding, while quite neat and a great example of how flexible this framework is, really isn't that useful once you get past the basics. But is great for banging out a proof of concept in short order.
16 years ago