Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

S Herod

Greenhorn
+ Follow
since Apr 25, 2005
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 S Herod

Checking the 'from ip' is likely to cause issues if the user is coming through a proxy server which load balances as the users from IP address may change between requests.

So I wouldn't do it that way.

On another note

PHP has/had a flaw (apparently) in that its session id's were predictable, so if you visited the site and got a session id, you could use that to predict a future session id and thus hijack another users session.

I don't know if JSP/Java suffers from such a problem, I suppose it has to do with the implmentation by the servlet container (??)
15 years ago
I'd use GETDATE() in the sql, or in oracle SYSDATE (I think mysql uses 'now()')

I wouldn't use a db trigger to insert the date, here's why.

With our current prod db we did use a trigger to update the date to now on insert.

However, we've also had to do a lot of data insertion of old data, and to insert this data and keep the original dates in the old data, you have to turn off the trigger before running the import/insert.

This means a production downtime (because turning off the trigger during normal operation would be bad of course).

In hindsight, we would have stuck with a 'not null' constraint on the date time column and gone with 'sysdate' or the like in the sql.
You can have more indexes than columns..

Oracle allows you to have multi column indexes (indeed, in some situations, they are preferred). So, you could have an index for each column, and indexes for combo's of columns.

Whats the down side? More indexes means longer insert times, but frankly, this is far, far outweighted by the benefits.

Keep in mind, that table size is important, for small tables (and the def of small is open to interpretation , an index may have no affect, or make access ever so slightly slower.
Can i ask why do you want to do this?

As far as I know, serialising objects into a database will cause you issues, esp if your class changes. You won't be able to retrieve serialised objects which use older definitions of the class.
I agress with asirob

Storing blobs in a database leads to pain. If you are using oracle the are all sorts of rules about tables with blobs that stop you from doing things you could otherwise do (like partitioning).

On our production systems, this storing of data in BLOB types has causes us SIGNIFICANT issues as the db scales (250GB and grow, most of it BLOBs)

Store the path to the image on the file system, in the long run you will be better off!
Well, it will depend on your database implementation but..

I believe 'read commited' usually means 'Show me only rows who's changes have been committed to the database'

So, if you try a read a row whilst a write is taking place, you will see the data prior to the write, until the row change is committed.

But really, you don't want JDBC's semantics for this, you want the underlying db's implementation of how it works.
This is just a general musing.

One wonders why anybody teaches the construction of linked lists in a language which has:

1/ A comprehensive collection of inbuilt classes for handling this problem
2/ No concept of pointers and memory allocation in the classic sense.

I mean, I could understand doing it in C or C++, but Java?
15 years ago
Use a setter.



A tool like eclipse makes the rather boring task of generating getters and setters a right-click breeze (of course, its a bit more useful than that).

I wouldn't make 'name' protected because I just never access data directly, always through the getters and setters.

It saves your bum later on, esp if you need to restrict the length of name, or make it upper case always (just throw code into the setter to normalize the data).
15 years ago
Unless you are explicitly trying to retrieve a image from another server, or intending to submit a form to a server other than the one the page was served from, relative paths really are the only way to go.

so



not



yes, you can muck around with obtaining the servers name and paths and all that sort of thing so you can detect the host and all that, but you'll just get into alot of trouble.

So you don't need a special tag, you just need to leave stuff out of the url.
15 years ago
JSP
We have a system that is very file based (hundreds of thousands of files a day arriving by various means) and have a similar issue.

We have three approaches

1/ Monitor for a files with a certain extension, uploading processes upload with a '.tmp' extention and then rename the file at the end.

2/ Monitor the file's size. if its size hasn't changed in a minute then assume the file is complete.

3/ This is a variation of 1/, upload a group of files to a temp directory outside the monitored directory, rename directory when final upload complete.

All three of these options work well for us.
15 years ago