- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
it then produces the similar behavior of writing to 2014020300.avi; brillant!
Of course some questions that might help clear things up: At what time does the camera determine a given hour's video file's filename? At what time does this file become available in the place where the monitoring software can examine it?
The cameras' software was developed by the company that made the camera, so we can assume that there is no changing the logic. It seems reasonable to assume from the context that the time that the camera determines the file name is the beginning of the hour (when it starts recording that hour's video), but the time that this file becomes available is the end of the hour (after the recording software has switched to the new hour's file, after the beginning of the next hour). So the monitor has to check for the previous hour's file thus addHours(-1) is entirely accurate.
Admin
Besides in this case the video file names aren't up for modification since they are produced by the camera's software which was developed by the company that makes the cameras.
Admin
Admin
You use that word ("metadata") but you do not know what it means.
The date and time of the video is metadata, not "data". That's about as clear an example of "metadata" as I can think of. The compressed images and keyframes are the "data".
And you completely missed the point: the OS already keeps track of metadata like what time the file was created. Storing that metadata twice only leads to possible inconsistencies, e.g. the OS says it was created at 1pm but the filename indicates it was created at 2pm. Who wins?
If you really want to index a large dataset by time (so that it's efficient to find files that cover certain ranges of days and hours), you should use a real index instead of relying on file metadata.
Admin
I agree with you in general, but in this specific scenerio, using file names with formatted date makes sense. With the monitor program working so close to the actual time of creation, it also makes sense. For 24-hour video capture that act as an network appliance, this is a good fit.
Admin
TRWTF is that they need a separate nanny process to see that the primary process is turning its homework in on time.
Admin
Admin
The reasoning goes like this: Ted thinks c#'s utcNow.Hour() returns a 1-based integer (in a.m./p.m. you don't have 0:42 a.m. if I'm right).
So he automatically decreases the number by one in much the same way that you have to increase utcNow.getMonth() by one in Javascript because it's zero-based.
Would he really wanted to get the previous hour of utcNow, he would have created a second variable like utcNowMinusOne, since by just decreasing the hour part, he misses the rollover at midnight.
True, his attempt to fix it could be read as an attempt to create a filename based on now minus one hour, but then Eric's initial reaction, telling him that Hour returns a zero-based number, for me at least is a strong indication that this really is just a off-by-one wtf.
Admin
One may think that using dates in file name is "overkill", since files already have this "metadata" already. Please don't do this. The simple fact that the file was copied/moved to another location, or (more subtle, archived), this meta data can change and it isn't that visable to the common user unless they dig for it.
So, yes having the date in the file name is a "good thing" since you can do all sorts of things. Most (if not all) file systems access files by their name, not their meta data, and it is this name that is reported in a simple directory walk.
Of course given that, sometimes my camera weirds out and doesn't get the time correct, and then starts in December of 1969 (I'm the USA), and I do need to change the file name to something based on the metadata, but I do this quite quickly and all is well in the world.
Quick moral: While it may seem simple, Time isn't when you consider all the variables/operators that can be done to timestamps. Even sorting on month names can be a bit troublesome. Your system should have proper time functions. USE THEM and avoid the WTF moment!
Admin
Am I the only one that thinks that the person that created the format Date("now -1h") probably eats paste?
Admin
/trout Geoff
Semantic information in the filename is a really, really good idea. Not having it would be the anti-pattern. No, not an anti-pattern, it'd be more of a WTF.
Admin
I certainly wouldn't prefer "now -1h"... for common use cases, that means converting numbers to a string for the desired operation, which then internally has to be parsed back into numbers. I'd go with Date.now().subtract(1, TimeUnit.HOUR).("YYYYMMDDHH")... something like that.
Admin
The real TRWTF is Americans trying to sing Auld Lang Syne.
Admin
TRWTF is you incorrectly inferring that this story takes place in America.
Admin
I think if you reread my original post (yes that's me) that I clearly do know and understand what metadata is. As you can see, I was pointing out that in THIS case, that datetime metadata is not just metadata but is also an appropriate part of the title of the video document.
If these videos were "fun stuff I did on my holiday" then I would grant you that datetime stuff was just metadata.
But the point of these videos is that they ate footage of a location during a specific time period therefore the metadata ceases to be merely metadata about when something happened to occur, because it is in addition now a primary descriptor of the data.
OS concerns are basically irrelevant, except to note that specialist hardware may have delayed transmission of the video to the storage medium, thereby potentially introducing a systematic error into the metadata stored by the OS.
Addendum (2014-02-04 17:17): ^you'll see that
*are
Admin
Admin
Actually, my vote goes to "The TOTAL WTF".
Admin
The Terrible WTF?
Like a ninja in the night.... etc.
Admin
Admin
If you want an hourly file that starts at time X:00 you simply truncate the minutes.
Admin
Admin
This is not as strange as it looks.
In Javascript, the date object methods return year and date as the correct number, but month as a zero based counter, 0-11.
So new Date(2014, 1, 5) gives the date February 5th 2014, not January.
And if that pattern is reused in another language where months are returned as 1-12, you get your error.
;)
Admin
Not only are there plenty of cities where a ball drops, but there is absolutely zero indication that the article occurs in the same city that the ball dropped in.
It's possible, but nowhere near conclusive.
Admin
Did you see the article a few days ago? "Thanks Bill!" That's what she said.
Admin
For the ball drop thing to be true (which, of course, it almost certainly isn't), the ball would need to be in the UTC/GMT timezone. That reduces the set of possible cities where the ball was, does it not?
Admin
If it was in the US, the time format would be MMDDYYYYHH.
Admin
CBNC -- it would be: HHamMMMDDYYYY or HHpmMMMDDYYYY
Admin
So Cuba, Columbia, Chile, etc...?
Admin
Admin
If it is C#, then the code would me even more wrong.
HINT: Take a look at the "". IF it was C#, it should read "\" or @"". Else, you'd just be escaping the second ", which I think doesn't make a lot of sense in this context (plus, the rest of the code would just be seen as a string).
Admin
But although the code wouldn't compile as it stands, it probably is C# nevertheless - the ConfigurationManager class used in the building of the string is a very strong indicator.
Admin
Astralia or Austria?
Admin
The anti-pattern is that the code is dependent on the file naming pattern, which is totally irrelevant. All we want to do is verify that files are being added in a timely manner. We should not be concerning ourselves with date formats or file extensions or structure whatsoever. Just reserve a folder for the camera and verify that it's being updated.
Admin
Even if you assume that "the ball had just dropped" is literally referring to the movement of the ball in Times Square, it still could be anywhere in that time zone, not necessarily New York City.
And even if you assume that it literally meant that they were in New York City, that's undoubtedly part of the anonymization process anyway.
Admin
As opposed to being dependent on some arbitrary counter? You have to name it something. I agree with other people, the date isn't superfluous nonsense here. It's the primary/perfect descriptor of what the video is. This way when Eric's boss wants the copy of the video from 4am 2 months ago sent somewhere there's no worrying about the date being lost. If you pull a backup, copy them around, and so on and so forth, there's no risk of losing the only piece of information that actually identifies what the hell v34900930.avi is because your whole operation is now dependent on a date the OS made up.
On top of all of that, there's no reason NOT to name it with dates either. Yeah, he efed it up, but he could have effed up anything. A counter can reset too (a la the 12/1969 date "problem"), or even worse, you could actually check what files are in the folder and increment the last one, so every time they're archived you get 000000.avi again.
Admin
In other words... metadata.
Admin
I never said it wasn't metadata, I said that it was more than just metadata... It is of elevated importance in this case.
Also, "in the words" suggest that a primary descriptor and metadata are synonymous. Which is clearly false. One is a superset containing the other.
Admin
THE FILENAME IS METADATA.
Admin
Not sure why they didn't swap hours and minutes as well.
Admin
Admin
FWIW, networks will replay the ball dropping in NYC in other time zones. I get to see it here on the left coast 3 hours after it actually happened.
Admin
I think you are in the minority here. Why add complexity to a solution by adding a separate set of meta data in a database/csv file if you can just look at the directory? It seems so unecessary
Admin
Most of you guys don't understand the word nuance, do you?
Admin
Admin
You're the first to bring up such a nuance.
Admin
Instead of tedious discussions about using date formats in filenames (all these problems were solved eons ago, do some googling if you need to do it to avoid all this stuff), how come nobody has noticed the really real WTF?
WTF were you doing spending New Year's Eve IN THE OFFICE AT WORK??!!!
Admin
Admin
Admin
If it was the forum software swallowing the second , then this would be TRWTF, right?
Admin
If they were handing out Cohibas, it would definitely be NYC.