Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Charles Bradley

Ranch Hand
+ Follow
since Oct 04, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Charles Bradley

Thanks. I picked client side operations for this part, since that seemed simpler.. Soon I will start the database portion, so I suspect I will be asking server side questions. I'm glad Java Ranch exists. Many thanks to all the crew there.
Thank you.

The process is called redirect, and the function to do it is called header. I don't feel as dumb as I was expecting to feel for not being able to discover this on my own.

While I was looking I discovered the action can be done with window.location.assign() in javascript. Is there a reason to prefer one method over the other?

Thanks again.
7 years ago
PHP
I'm trying to write my first PHP code and can't find how to send a pre-existing page to the browser. I've been through the PHP doc and several collections of scripts without finding it. I expect the capability exists and I just need to know the correct search term to find it. In other words, simulate the effect of the user clicking on a link. Thanks.
7 years ago
PHP
I don't yet know what the server side software will be. I'm hoping for good advice. I don't care about where the work is done, server or browser.

The requirements are simple. Maintain some data for a long time. A relational database seems ideal, but I'm willing to use flat files, a spreadsheet, or maybe something else. Produce a few simple reports from the database based on parameters supplied by the user. Plus there is one fairly complicated requirement. Based on parameters supplied by the user, visit a bunch of web sites, one at a time. While there, do some exploring, follow links, and perhaps find some information that should be used to update the database.. This operation might take several hours. This requirement led me to think that the user interface could be a tabbed browser and it would save me the trouble of building much of the user interface. I could build the system as standalone programs and create the list of websites in one window, do the database updates in another window, and use the browser in another window, but browser and server seems more natural, and I might have the fun of learning something new.

I started on the server side because of the database. I started with PHP, not as an informed choice, but because it was the first thing I encountered and it seemed to be popular. I could not find how to make it deliver the page I wanted, after searching the docs and several collections of scripts. I expect there is a way, but I did not find it.

I don't mind a mixture of languages. I will be the sole developer and the sole user, and the client and server will run on the same computer, the one under my desk. What language or languages do you recommend. If it is PHP, please tell me the equivalent of window.location.assign().

Sorry this is such a long explanation, and thanks again.
Thank you for the quick reply. I had not looked at javascript since I was thinking serverside and I thought javascript was browser only. I found a tutorial about javascript and found the answer I need. I can get to the proper form with a small amount of browserside javascript code. The key is window.location.assign(). Is there a generic term that would help me find the equivalent capability in other languages? Thanks again.
I suspect this is the wrong forum, but I looked at others and they did not seem any more right. Moderator, please feel free to move this.

I'm an experienced programmer trying to create my first web application. The user will be presented a page with a group of n radio buttons and a group of m radio buttons. Depending on the choices made, one of n times m pages will be presented when the user submits the form. The logic to do it is easy in any language. but the implementation seems messy in every language. I seem to have the choice:
1. embed HTML in the programming language with special coding (escape codes).
2. embed the programming language in the HTML with different special coding (escape codes).

What language(s) make it easy to do something like "if condition a display page A, else if ..."? Here, display means return to the client browser.

I really think there is a good chance I have a huge blind spot, so the best answer might be "hey, stupid, look at web page ..."
I keep a list of less than 100 web sites that I visit a few times a year.
While there I look around, generally viewing 2 to 10 pages,
looking for statements about dates in the future.
Occasionally, I make notes about what I find.
Most of the time, I find that nothing has changed since my last visit.

It eventually dawned on me that much of this could be automated, if I kept some extra data
with the URL, such as the date I last visited the site, the latest date at the site,
the date when the site was last updated, and the date I last found anything worth noting at the site.

This suggests a flat file, a spreadsheet, or a relational database.
The information I gather fits a database nicely, about six relations, a few hundred to a few thousand
records in total, so performance is not an issue.

I get information from other sources as well, so I need a way to update the database independently.
While at one of the web sites I occasionally get two or many facts that should change the database.
None change the set of sites I am visiting.

Occasionally, I want some summary of the information in the database. Examples:
Who says anything about July or August, and what do they say?
Who says anything X next year, and when?
What topics are mentioned my most sites with dates next year?

The query to visit web sites will be flexible, but a common one might be to
skip sites skip sites with the farthest out date more than two months in the future.
The usual behavior of these sites is to look further into the future when they make a change.
Very rarely, they will change an earlier date. My approach might not detect such changes immediately.
I accept the slight risk.

All this leads me to consider a web based application using a browser with tabs and Java to do
the date manipulation and database operations. I think frame IDs can limit the proliferation of
tabs during maintenance and web scanning.

Is this a reasonable approach? If I am heading for a disaster, please warn me.
I'm happy to get some experience with Java and HTML, so I don't mind if this is not the
perfect way. There is not much Java in this request. If it is too little, just say so.

Also, the application is not secret. I figured almost nobody would be interested in it, so I
tried to make the description abstract and general. If you want/need the details to reply,
just ask. There will only be one user at a time, me, so the atomicity of the DB is not needed.
Actually there will probably be only one user ever, me, the developer, so error handling,
security, recovery procedures, and other factors will be less important than for most systems

Thanks.
7 years ago
Thanks for the information. It is nice to know that at least some of the IDEs play nicely together. I'll install some and start comparing. The title of this thread seems general enough that some of you might want to keep it open and discuss how to use multiple IDEs at the same time. Thanks again.
Thank you all. The tips about how to run a project are helpful. Mark came closest to answering my particular question. Do you have all those IDEs on the same system at the same time and can switch between them with no problems? No reboot? No command procedures to run? The same Java machine and standard libraries? Thanks.
To what extent is it safe to use different IDEs on the same system, either simultaneously or one after the other. In my case I want to try several before deciding on one for a project. Someone else might work on several projects, each of which uses a different IDE. I can imagine conflicting symbol values, incompatible extensions to libraries, and so on, and there are probably many other ways that I have no idea of. If there are problems, which IDEs are best at playing nice with the competition? Thanks.
My request is not related to a homework assignment, but I agree with the approach usually taken at Java Ranch to help students work out the solution on their own so they learn from the experience. I'm a retired software engineer that started programming digital computers in 1960. As part of my "mind rot delay project" I've been taking courses at a local University, mostly graduate math courses, but last year I tried Java. I'm not really comfortable with Java yet; the "greenhorn" label fits for Java, and for OO topics. The simulators I'm considering are for very old machines, most do not have interrupts, some do not even have index registers, some had vacuum tubes. The few that had disk storage provided 5 to 10 megabytes in a package the size of a washing machine. If all goes well, I'll put the simulators on a web site I expected to call "Ancient Computer Lab". Based on my age and the fact that I've not even seen a tab card in the wild in over 30 years, "ancient" is a reasonable adjective, but I'm willing to change to any more politically correct term if it will encourage participation. I'll post a possible class hierarchy as soon as I can. Please resist any temptation to suggest the minimum of changes that will make it barely adequate. Thanks.

I searched around the ranch, and this seems like the right place to ask this. If not, please feel free to move or delete it.

I want to write some simulators of old computers. Some of those old computers used punched cards, sometimes called tab cards, tabulating cards, IBM cards, Hollerith cards, or unit records. Below, I provide some of what I know about such cards, including many areas that I suspect there are important things I do not know now, and might have to know before a particular system can be simulated. How do you recommend the classes and interfaces be organized? I'm particularly interested in the reasons for your recommendation, and in alternative suggestions from different people.

The most common punched card is the size of a US dollar bill before the new deal and 140 cards to the inch thick. It has 80 columns, and each column has 12 positions for rectangular holes to be punched. Cards come in many different colors, with many thousands of printed designs. Additional printing can be added by a machine called an interpreter, printing a symbol that represents the data in a particular column, or is a generated value. The interpreter characters are wider than a column on the card so they can not line up with the columns. Smaller printed representations of the data can be provided by a keypunch machine when the card is first punched. For extra confusion, cards from the keypunch machine with the print feature turned on are also called interpreted. A corner was usually cut off to assist in efforts to have all the cards in a collection face the same way. Some cards had an additional notch to indicate they had been checked or
verified. Some cards could be separated into two parts, and at least the larger part read as a turn-around document. These were commonly used for billing, sent whole; the customer kept the smaller part as a receipt and returned the larger part with payment. IBM had a standard punched card code, essentially defined by their keypunch machines. Computers differed in how a given character was represented in memory. The code defined numerals, upper case letters, and a few special symbols. There was also column binary, where three columns of twelve bits made a 36 bit word for the mainframes of the era. With the introduction of the IBM System/360 in
1964, the card code was expanded to 256 defined codes, many without a corresponding graphic representation.

Remington Rand had a similar card, probably on the same card stock. It had round holes and 90 characters of data. I do not know anything about the codes used. In the late 1960s. IBM introduced a new card design. It was about the size of a credit card, used eight tiny holes for each character and had room for 96 characters.

Once a card was punched, it was usually added to a file or deck of cards. The deck of cards was often converted to a magnetic tape file by an auxiliary machine or small computer.

So, how should I represent this bit of ancient history in Java? Thanks for your ideas.
Round adds .5 and then truncates. 8.1 + 0.5 = 8.6 -> 8, but 8.6 + 0.5 = 9.1 -> 9 so round rounds to the closest integer.

Actually x.5 is half way between x and x.1, so it is equally close to x and x+1. Every floating point implementation that I have ever seen has x.5 round to x+1. That way, exactly half of the bit patterns for the y part of x.y round to x and half round to x+1.

This description only applies to floating point numbers that actually have the integer and fractional parts. For example, 12345678901234567890.6 has no information about the .6 when in float format.
12 years ago
I worked on some early CRT screen layout software. All of the previous replies apply, but there is more. Screens scroll, and not all screens had the same number of lines. The difference from the normal mathematics convention is a small negative factor, more than offset by several positive factors.
12 years ago
I agree, you should figure out how many characters to remove and then make a new string by omitting the correct number of terminal characters. Be careful about the criterion for what should be removed. Do you want to omit letters only, or do you perhaps want to omit everything except digits. Methods in Class Character, such as isDigit() and isLetter(), can be a help. Also, be aware of limiting cases. Will your code work if there is only digits? If there is only letters? If the string is empty?
12 years ago