Grails - Different date between seleted and saved - grails

I have a Grails 2.5.6 app developed with Java 1.8 running in a Docker container. While app was in development I defined time zone in Bootstrap.groovy as follows:
TimeZone.setDefault(TimeZone.getTimeZone("America/La_Paz"))
This is the problem: I select a date in my form, let's say 11/05/2021. Then I checked in the database that the date was saved as 2021-05-11 00:00:00, which is correct. But the show view shows date as 10/05/2021. Date is even retrieved as 10/05/2021 when I call the edit form. So, if I update the record, date is saved as 10/05/2021.
What could be wrong?
PD: I'm using Audit Logging too, could it be the cause?

Running the docker container with the following line solved the problem:
docker run -d -e JAVA_OPTS='-Duser.timezone=America/La_Paz' -p 8091:8080 mycontainer
Sending the JAVA_OPTS parameter did the trick.

Related

My docker container keeps instantly closing when trying to run an image for bigcode-tools

I'm new to Docker, and I'm not sure how to quite deal with this situation.
So I'm trying to run a docker container in order to replicate some results from a research paper, specifically from here: https://github.com/danhper/bigcode-tools/blob/master/doc/tutorial.md
(image link: https://hub.docker.com/r/tuvistavie/bigcode-tools/).
I'm using a windows machine, and every time I try to run the docker image (via: docker run -p 80:80 tuvistavie/bigcode-tools), it instantly closes. I've tried running other images, such as the getting-started, but that image doesn't close instantly.
I've looked at some other potential workarounds, like using -dit, but since the instructions require setting an alias/doskey for a docker run command, using the alias and chaining it with other commands multiple times results in creating a queue for the docker container since the port is tied to the alias.
Like in the instructions from the GitHub link, I'm trying to set an alias/doskey to make api calls to pull data, but I am unable to get any data nor am I getting any errors when performing the calls on the command prompt.
Sorry for the long question, and thank you for your time!
Going in order of the instructions:
0. I can run this, it added the image to my Docker Desktop
1.
Since I'm using a windows machine, I had to use 'set' instead of 'export'
I'm not exactly sure what the $ is meant for in UNIX, and whether or not it has significant meaning, but from my understanding, the whole purpose is to create a directory named 'bigcode-workspace'
Instead of 'alias,' I needed to use doskey.
Since -dit prevented my image from instantly closing, I added that in as well, but I'm not 100% sure what it means. Running docker run (...) resulted in the docker image instantly closing.
When it came to using the doskey alias + another command, I've tried:
(doskey macro) (another command)
(doskey macro) ^& (another command)
(doskey macro) $T (another command)
This also seemed to be using github api call, so I also added a --token=(github_token), but that didn't change anything either
Because the later steps require expected data pulled from here, I am unable to progress any further.
Looks like this image is designed to be used as a command-line utility. So it should not be running continuously, but you run it via alias docker-bigcode for your tasks.
$BIGCODE_WORKSPACE is an environment variable expansion here. So on a Windows machine it's %BIGCODE_WORKSPACE%. You might want to set this variable in Settings->System->About->Advanced System Settings, because variables set with SET command will apply to the current command prompt session only. Or you can specify the path directly, without environment variable.
As for alias then I would just create a batch file with the following content:
docker run -p 6006:6006 -v %BIGCODE_WORKSPACE%:/bigcode-tools/workspace tuvistavie/bigcode-tools %*
This will run the specified command appending the batch file parameters at the end. You might need to add double quotes if BIGCODE_WORKSPACE path contains spaces.

Setting the LOGGING__CONSOLE__FORMATTERNAME in aspnet6.0 image

How do I set this environment variable when I run a .NET 6.0 docker file?
I have a docker image based off aspnet6.0 Docker file. By default the environment variable is set as Json. I want to set it to Simple without changing the code.
The console log formatter is here: https://learn.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter
Can this be done?
I thought it would as simple as:
docker run --env LOGGING__CONSOLE__FORMATTERNAME=Simple <CONTAINER_NAME>
This does set an environment variable with this name. However it does not overwrite the environment variable it results in a duplicate setting. I would expect making the above command to overwrite the setting for: LOGGING__CONSOLE__FORMATTERNAME.
Therefore my console is still formatted as JSON and not in Simple format as I expect.
The reason is it not overriding the setting is the capitalisation should match the existing environment variable: Logging__Console__FormatterName
However the Docker container dotnet/aspnet has now reverted to the behaviour in 5.0 by not overriding the log format to JSON.
https://learn.microsoft.com/en-us/dotnet/core/compatibility/containers/6.0/console-formatter-default

Services There was an error loading data for the Services tab. Please try refreshing your browser and logging in again

Hi after a fresh DreamFactory Docker intallation I run this command:
docker exec -i -t dreamfactory php artisan config:clear
and then my all my DreamFactory Service is unacessible:
I have made more than one fresh installation and I have the same results.
Could you help me to understand which is the problem ?
It seems a bug !!
Please see my screenshots below. Symply canghing uncomment DF_ALWAYS_WRAP_RESOURCES in .env file whithout running artisan config:clear there is a problem in the services tab of dreamfactory.
then if you try to load your services tab you got an error
but your array isn't wrapped
if you put a # at the beginning of the same row DF_ALWAYS_WRAP_RESOURCES
your servies tab is ok
and your array is wrapped
It's a bug that breaks Services tab when you set DF_ALWAYS_WRAP_RESOURCES=true !!

google compute engine instances timezone changed to UTC automatically

I'm a new user of GCE instances.
I created instances a week ago and changed timezone to Asia/Shanghai by commands below:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Then yesterday, I found that my system timezone changed to UTC automatically and /etc/localtime was changed. So I run the command above agina. Until now it's OK.
After that I checked many resources and export TZ='Asia/Shanghai'. But I still not know if it's the root cause or not.
Also I find that someone adds xen.independent_wallclock=1 in sysctl.conf file to maintain independent times. But it's for Xen VM and I'm not sure if it's useful for GCE.
Could anyone please take a look at it ?
I've found a more user friendly approach here
Go root user
sudo -s
and use
dpkg-reconfigure tzdata
This will bring up a GUI which will guide you to change your timezone information
To make the permanent change edit $HOME/.profile or $HOME/.bash_profile appending the line and then log out and log in again:
TZ='Asia/Shanghai'; export TZ
for windows users open powershell as admin and type TZUtil.exe /s "<your new time zone>".
to see a list of all available time zones type TZUtil.exe /l.
for more info type TZUtil.exe /?.

Programmatical register a Postgres Server with pgAdmin using Delphi

Im working on an application using Postgres 9 and Delphi 7 as the front end,
For setting up the database connection to the application we have to do the following steps
1.Register a server in postgres
(i cannot post an image because im new user)
Name:=Localhost
Host:=Localhost
Port:=5432
SSL:=
MaintenanceDB:=myDB
Username:=Admin
password:=******
.
.
Service:=Localhost
2.Create the database and the tables.
Can any one tell me if the step 1.
can be done programatically?
Like for example
"C:\Program Files\PostgreSQL\9.0\bin\psql.exe" -h localhost -p 5432 -d myDB -U Admin Service=Localhost " ?
as of now its done manually by the user.
thanks in advance:)
The registered servers in pgAdmin are stored in the Windows registry under HKEY_CURRENT_USER\Software\pgAdmin III\Servers
The number of registered servers is stored in the Count attribute.
Then each server gets its own entry according to the number. So the first one is stored in HKEY_CURRENT_USER\Software\pgAdmin III\Servers\1, the second one in HKEY_CURRENT_USER\Software\pgAdmin III\Servers\2 and so on.
Have a look into your registry and create an approriate entry from within your Delphi application.

Resources