Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
raminasi
Jan 25, 2005

a last drink with no ice
Thanks for the suggestions. I'll certainly look into H2. I was concerned that doing database migrations might be overkill for my little toy project, but maybe not.

Adbot
ADBOT LOVES YOU

Sjonkel
Jan 31, 2012
I've recently started working on some new projects at work, and I have some questions regarding it. For the last few years, since I graduated, I've mostly worked with SOA, database-stuff and testing. A few weeks ago I started a new project, where I'm doing much more Java programming, which I haven't really looked much at since university. This makes me struggle a whole lot with things that I feel shouldn't take a whole lot of time, and it makes me less productive that I should be. Can anyone recommend any books or websites that can be useful for quickly refreshing my Java knowledge, as well as give me a better understanding of Java in a "professional" setting?

Mr. Crow
May 22, 2008

Snap City mayor for life
Maybe this is more appropriate in the web thread, but figure it has universal impact. How do you fix the Microsoft special character encodings and convert them to UTF-8? Are there any already made parsers out there that can do this? I'm aware of demoroniser, which is basically what I'm doing, but with character encodings.

Bonus points if it can parse it to other character sets.

omeg
Sep 3, 2012

Mr. Crow posted:

Maybe this is more appropriate in the web thread, but figure it has universal impact. How do you fix the Microsoft special character encodings and convert them to UTF-8? Are there any already made parsers out there that can do this? I'm aware of demoroniser, which is basically what I'm doing, but with character encodings.

Bonus points if it can parse it to other character sets.

What do you mean by "Microsoft special character encodings"? If you want to convert Windows-specific UTF-16 code pages (ANSI) into UTF-8, WideCharToMultiByte API does exactly that.

Mr. Crow
May 22, 2008

Snap City mayor for life
Like the '...' character Word adds, the 'smart quotes' characters, the em/en-dash characters etc. Basically having problems with content/designers copy+pasting from word and then some characters are being garbled in the web page.

Peristalsis
Apr 5, 2004
Move along.

Sjonkel posted:

I've recently started working on some new projects at work, and I have some questions regarding it. For the last few years, since I graduated, I've mostly worked with SOA, database-stuff and testing. A few weeks ago I started a new project, where I'm doing much more Java programming, which I haven't really looked much at since university. This makes me struggle a whole lot with things that I feel shouldn't take a whole lot of time, and it makes me less productive that I should be. Can anyone recommend any books or websites that can be useful for quickly refreshing my Java knowledge, as well as give me a better understanding of Java in a "professional" setting?

This really depends on what you mean by "doing Java".

When I took a Java job after a long time in other languages, picking up the core Java syntax again wasn't a problem - learning J2EE, MVC, JSPs, Struts, and other surrounding technologies was the trick. If that's the situation you're in, I suggest focusing on that, and assuming that you'll pick the Java syntax back up as you go along.

On the other hand, if you really just aren't sure how the whole class/object thing works, or haven't ever done much programming at all, I think pretty much any well regarded tutorial or intro book would be fine. I mostly taught myself Java at another job long ago by working through a textbook recommended by a co-worker. Of course, I had been programming for a while at that point, and just needed the new syntax and idioms.

Sorry I haven't recommend specific things, but it really will vary depending on exactly what situation you're in.

You might also ask your boss or coworkers for suggestions. It will let them know that you're struggling a little to get back up to speed, and also show them that you're taking the initiative in trying to remedy that.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Mr. Crow posted:

Like the '...' character Word adds, the 'smart quotes' characters, the em/en-dash characters etc. Basically having problems with content/designers copy+pasting from word and then some characters are being garbled in the web page.
There's two main steps. First, make sure the browser is sending UTF-8. Next, don't gently caress it up on your end. The first step can be done by ensuring that the form data can only be represented by a Unicode encoding (rails uses a hidden "utf8=✓" form field for this). The second step consists of finding what part of your application is loving things up, and fixing it.

Trying to fix corrupted data after the fact is nearly always the wrong approach.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

GrumpyDoctor posted:

Thanks for the suggestions. I'll certainly look into H2. I was concerned that doing database migrations might be overkill for my little toy project, but maybe not.

Or take just the idea and run with it. Could be as simple as a "version" table with a single integer in a single row, and a numbered list of SQL statements.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Mr. Crow posted:

Like the '...' character Word adds, the 'smart quotes' characters, the em/en-dash characters etc.

, , and are all in my Unicode. Maybe you need a better Unicode.

Doctor w-rw-rw-
Jun 24, 2008

Mr. Crow posted:

Like the '...' character Word adds, the 'smart quotes' characters, the em/en-dash characters etc. Basically having problems with content/designers copy+pasting from word and then some characters are being garbled in the web page.

Set a meta tag that explicitly flags the page as UTF-8. Probably set the headers, too. The garbled 'word' encoding happens because of improper encoding guessing, or something like that. I used to have a link to reference that problem and its solution, but I don't have access to it atm as I'm not on my laptop. Check stackoverflow?

Bruce Hussein Daddy
Dec 26, 2005

I testify that there is none worthy of worship except God and I testify that Muhammad is the Messenger of God
I was daydreaming the other day and I came up with a date storage method based on HEX.

code:
64 32 16 8 4 2 1|| 8 4 2 1 || 16 8 4 2 1
 x  x  x x x x x|| x x x x ||  x x x x x
    YEAR        || Month   ||   Day
 x  x  x x|x x x   x|x x x     x|x x x x
    A     |    B    |    C      |    D          
 
     Year (13)     Mon (3)    Day (18)
 0  0  0 1 1 0 1||0 0 1 1 ||  1 0 0 1 0
 
 0001 1010 0111 0010
 1     A     7    2
 
1A72
One of the biggest limitations is 127 for years, but it's better than dd-mm-yy. Can anyone see any usefulness to this or the idea in general or is it just an exercise for college freshmen?

Doctor w-rw-rw-
Jun 24, 2008

Bruce Hussein Daddy posted:

I was daydreaming the other day and I came up with a date storage method based on HEX.

code:

64 32 16 8 4 2 1|| 8 4 2 1 || 16 8 4 2 1
 x  x  x x x x x|| x x x x ||  x x x x x
    YEAR        || Month   ||   Day
 x  x  x x|x x x   x|x x x     x|x x x x
    A     |    B    |    C      |    D          
 
     Year (13)     Mon (3)    Day (18)
 0  0  0 1 1 0 1||0 0 1 1 ||  1 0 0 1 0
 
 0001 1010 0111 0010
 1     A     7    2
 
1A72

One of the biggest limitations is 127 for years, but it's better than dd-mm-yy. Can anyone see any usefulness to this or the idea in general or is it just an exercise for college freshmen?

Nope. More compact to just calculate seconds from 1970, and forget human-readable storage formats because time is complex as gently caress, and human-readable dates are basically complicated enough to be more reasonable for display than for (inexact or occasionally unclear) storage. It also means that as long as you have a number type big enough to store the seconds from 1970, you can store the date. 64 bits should be enough for a looooooooooong time.

Bruce Hussein Daddy
Dec 26, 2005

I testify that there is none worthy of worship except God and I testify that Muhammad is the Messenger of God
Yeah, I figured so. Otherwise someone would have done it already.

Doctor w-rw-rw-
Jun 24, 2008

Bruce Hussein Daddy posted:

Yeah, I figured so. Otherwise someone would have done it already.

Yeah. There's really no other way IMO to have an exact date - given leap years, leap seconds,and time zones, anything other than an exact number of seconds since a reference date is a display format, since it's not an absolute date until you have total and complete knowledge of the conditions in which the time was recorded.

Like, which 1:30 AM are you talking about when the hour leaps backwards? How many hours between midnight and 3am when the time leaps forwards? Look at the tzdata data and you'll see some of the complexities.

nielsm
Jun 1, 2009



Doctor w-rw-rw- posted:

Nope. More compact to just calculate seconds from 1970, and forget human-readable storage formats because time is complex as gently caress, and human-readable dates are basically complicated enough to be more reasonable for display than for (inexact or occasionally unclear) storage. It also means that as long as you have a number type big enough to store the seconds from 1970, you can store the date. 64 bits should be enough for a looooooooooong time.

Or if you really only need to store the date and not the time, store a number of days since some epoch. (Then 16 bit gives you just short of 180 years range, and 32 bit is practically infinite.)

Doctor w-rw-rw-
Jun 24, 2008

nielsm posted:

Or if you really only need to store the date and not the time, store a number of days since some epoch. (Then 16 bit gives you just short of 180 years range, and 32 bit is practically infinite.)

But I bet you'd still have to convert to seconds anyways, since most of the code handling fun date intervals probably deal with seconds and not complete days. At least that's the impression that the APIs give me.

Zhentar
Sep 28, 2003

Brilliant Master Genius
Quick, convert February 12th, 2013 from UTC to EST.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Zhentar posted:

Quick, convert February 12th, 2013 from UTC to EST.

Why?

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?

I think his point is that the date of an event in one time zone might not be the same as in another, so storing only the day and not the hour could cause issues. Or did you get that and you think the issues aren't important?

HappyHippo fucked around with this message at 03:25 on Mar 19, 2013

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I thought Zhentar was pointing to some kind of perfect storm for date conversion. Like maybe February 12, 2013 EST was a simultaneous Daylight Saving Time switch, leap second, 31-bit overflow, Julian new year, and floating-point rounding issue.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

pokeyman posted:

I thought Zhentar was pointing to some kind of perfect storm for date conversion. Like maybe February 12, 2013 EST was a simultaneous Daylight Saving Time switch, leap second, 31-bit overflow, Julian new year, and floating-point rounding issue.

If you wanted one of those, just look at a February 29th that existed in some parts of the world but not others.

Smoking_Dragon
Dec 12, 2001

WOE UNTO THEE
Pillbug
I'm trying to figure out how to write a script that will use robocopy to mirror a networked hard drive to another hard drive on our office server. I know the basic syntax (ROBOCOPY source-drive:\DIR destination-drive:\DIR /MIR) but I have no idea how I would go about making it run automatically every night at 8pm. I have no coding experience whatsoever.

Rottbott
Jul 27, 2006
DMC
Task Scheduler. There's a UI if you're just setting it up once, or if you need to do it in a batch script (e.g. for multiple machines) use schtasks /create.

Gounads
Mar 13, 2013

Where am I?
How did I get here?

Jabor posted:

If you wanted one of those, just look at a February 29th that existed in some parts of the world but not others.

This one is blowing my mind, when does it happen?

Smoking_Dragon
Dec 12, 2001

WOE UNTO THEE
Pillbug

Rottbott posted:

Task Scheduler. There's a UI if you're just setting it up once, or if you need to do it in a batch script (e.g. for multiple machines) use schtasks /create.

From doing a little more research I've found that creating a file in notepad and saving it as a .bat file and then setting that to run everyday at 8pm through task scheduler will get the job done.

Here is the code I intend to put in the file:

code:
::Switches:
::(MIR) Mirrors sourcedrive to destination drive
::(R)etry each copy up to 15 times
::(W)ait 5 seconds between attempts
::(LOG) creates log file
::(NP) do not include progress txt in logfile; this keeps filesize down
::(DCOPY:T) Uses source timestamps on the destination drive

::Source path
set sourcepath="c:\source drive"

::Destination path
set destinationpath="E:\destination drive"

::Log path
set logpath=C:\Logs

:: Log path name, include format yyyy-mm-dd#hh-mm-ss.ms in log filename
set filename=Robocopy_%date:~-4,4%-%date:~-7,2%-%date:~-10,2%#%time::=-%.txt 

::Run command
robocopy %sourcepath% %destinationpath% /MIR /R:15 /W:5 /LOG:%logpath%%filename% /NP /DCOPY:T
Does this look ok?

I've already backed up all the files on the source drive to the destination drive so hopefully it will only have to mirror a couple of files that changed during the day. The source timestamps on the files and folders don't currently match the timestamps on the destination files and folders (which all show today). Is that going to create issues and cause it to backup everything tonight? Lastly, I included the DCOPY:T command so it will mirror the timestamps but I'm not exactly sure if that's what that command does.

Smoking_Dragon fucked around with this message at 16:59 on Mar 19, 2013

Smoking_Dragon
Dec 12, 2001

WOE UNTO THEE
Pillbug

Smoking_Dragon posted:

From doing a little more research I've found that creating a file in notepad and saving it as a .bat file and then setting that to run everyday at 8pm through task scheduler will get the job done.

Here is the code I intend to put in the file:

code:
::Switches:
::(MIR) Mirrors sourcedrive to destination drive
::(R)etry each copy up to 15 times
::(W)ait 5 seconds between attempts
::(LOG) creates log file
::(NP) do not include progress txt in logfile; this keeps filesize down
::(DCOPY:T) Uses source timestamps on the destination drive

::Source path
set sourcepath="c:\source drive"

::Destination path
set destinationpath="E:\destination drive" /mir

::Log path
set logpath=C:\Logs

:: Log path name, include format yyyy-mm-dd#hh-mm-ss.ms in log filename
set filename=Robocopy_%date:~-4,4%-%date:~-7,2%-%date:~-10,2%#%time::=-%.txt 

::Run command
robocopy %sourcepath% %destinationpath% /MIR /R:15 /W:5 /LOG:%logpath%%filename% /NP /DCOPY:T
Does this look ok?

I've already backed up all the files on the source drive to the destination drive so hopefully it will only have to mirror a couple of files that changed during the day. The source timestamps on the files and folders don't currently match the timestamps on the destination files and folders (which all show today). Is that going to create issues and cause it to backup everything tonight? Lastly, I included the DCOPY:T command so it will mirror the timestamps but I'm not exactly sure if that's what that command does.

When I try to run the .bat file that I created with this it just prints out the commands over and over in a command prompt without actually executing them, can anyone help?

EDIT: This seems to be a problem with it not being run as an adminstrator. It works fine if I right click and select "run as an administrator" in Windows 7. However, on the Windows XP laptop, which will be the one actually running the script, there isn't a "run as administrator" option (I am signed in as an administrator) and the .bat file won't excute properly.

I'm also getting this error when I try to run the robocopy script through the .bat file:


However, when I open a command window and input the exact same robocopy code it works just fine, what am I doing wrong??

Smoking_Dragon fucked around with this message at 20:01 on Mar 19, 2013

1337JiveTurkey
Feb 17, 2005

Gounads posted:

This one is blowing my mind, when does it happen?

That time is past, but it's when the Julian to Gregorian switchover was still going on. Sweden is probably one of the best (most pathological) examples: They decided at first they were going to switch over the course of 40 years, skipped one leap day and then decided to go back. Solution? Add another leap day in 1712, meaning February had 30 days that year. Then in 1753 they just took the plunge and had a 17 day February. This put them in sync with Great Britain and its colonies which switched by chopping out a few days from September the previous year.

code:
server:~ 1337JiveTurkey$ cal 9 1752
   September 1752
Su Mo Tu We Th Fr Sa
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Russia sat on its rear end and didn't move over until the 20th century, leading to the October Revolution starting on The 7th of loving November.

csammis
Aug 26, 2003

Mental Institution

Zhentar posted:

Quick, convert February 12th, 2013 from UTC to EST.

No known time part means no valid TZ conversion is possible. I deal with this frequently at work - a type of metadata is entered by users as just a date, stored as a DATETIME with a time component of 00:00:00, and it's a common bug to see this value being mistakenly interpreted as UTC and converted to local time for display when in fact there is no time information at all. It should be as February 12 2013 no matter where it's used but dates are hard man.

Twitter a few days ago posted:

csammis: Lately whenever I've heard the words "date" or "time" uttered by a software engineer it's been followed by this: :ughh:

Sab669
Sep 24, 2009

So my company still uses Visual FoxPro... We're working on some new big system for a customer who has a ton of poo poo in Access, and I need to rip all that data out and throw it into VFP tables. I primarily develop for C# and am very unfamiliar with both VFP and Access. To my understanding, it's not possible to do a simple "Import Wizard" or anything to pull from Access.

I was able to set set up a little environment in .NET to interface with the VFP tables, I was wondering if there's some way to automatically run through 2 of the Access tables and throw all of its contents into 1 VFP table? Best part is, the VFP table and Access ones don't have the same structure, so I'll just be looping through looking for certain column names looking for a few 'key' columns in each table.

Gounads
Mar 13, 2013

Where am I?
How did I get here?
I remember driving myself insane when I was fresh out of college. Adding 24 hours to increment a date field. And for one certain day, it wasn't working. I even went so far as to file a bug! Turned out to be the day to switch over daylight savings.

qntm
Jun 17, 2009

csammis posted:

It should be as February 12 2013 no matter where it's used but dates are hard man.

Nope

Gounads posted:

This one is blowing my mind, when does it happen?

Samoa and Tokelau skipped 30 December 2011.

Illusive Fuck Man
Jul 5, 2004
RIP John McCain feel better xoxo 💋 🙏
Taco Defender
Not exactly a programming question, but how do people go about getting their head around large open source projects? Is there an IDE that can help me somehow? It's a little difficult when I just want to find out where a function is called from, or where a function/variable/constant is declared/defined and it seems like the only way is to either debug it and look at the call stack in gdb, or to open every single #include and 'find in all open files'

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I use grep.

Well actually I use ack.

Except when I use ag. Which is always.

So I suggest getting The Silver Searcher.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slgt skal flge slgters gang



I switch it up, but generally I just use ack and XCode's builtin search.

Zhentar
Sep 28, 2003

Brilliant Master Genius

Illusive gently caress Man posted:

Is there an IDE that can help me somehow?

Any IDE worth using has a 'Go To Definition' action that will (usually) take you right to the appropriate place. Visual Studio and XCode have this; I assume plenty of others do as well.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
Even customizable editors that aren't strictly IDEs like Vim have stuff like this as addon scripts if you choose to go down that route. Also, if there's any reasonable documentation you should possibly pull that offline if you're referring to it heavily, so you can browse through it quickly.

covener
Jan 10, 2004

You know, for kids!

Illusive gently caress Man posted:

Not exactly a programming question, but how do people go about getting their head around large open source projects? Is there an IDE that can help me somehow? It's a little difficult when I just want to find out where a function is called from, or where a function/variable/constant is declared/defined and it seems like the only way is to either debug it and look at the call stack in gdb, or to open every single #include and 'find in all open files'

I'd suggest checking out a a quick cscope howto.

Turkeybone
Dec 9, 2006

:chef: :eng99:
What the gently caress is Spring MVC? A friend and I are making a new website for our school organization, and she is all "ok well I'll put it on git and I want to use spring mvc and etc etc," and even after reading some of the wiki and some tutorials, I still have no idea what the gently caress it is or does. I have some knowledge of java, databases, and web programming.. nothing beyond some college classes.

Can someone explain it to me as if I were an idiot, or point me to a website that may do so? Thanks in advance.

tarepanda
Mar 26, 2011

Living the Dream
Does anyone have experience with NI LabVIEW? I have to make a serial driver for a thermometer and really have no clue what the gently caress I'm doing.

Adbot
ADBOT LOVES YOU

baquerd
Jul 2, 2007

by FactsAreUseless

Turkeybone posted:

What the gently caress is Spring MVC? A friend and I are making a new website for our school organization, and she is all "ok well I'll put it on git and I want to use spring mvc and etc etc," and even after reading some of the wiki and some tutorials, I still have no idea what the gently caress it is or does. I have some knowledge of java, databases, and web programming.. nothing beyond some college classes.

Can someone explain it to me as if I were an idiot, or point me to a website that may do so? Thanks in advance.

Spring MVC is one package of the Spring Java framework. By itself it doesn't really do much, but it has classes laid out in a structure that is intended to make it easier for you to design an MVC based web site/service by using, extending, and/or implementing their code structure with your own code.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply