#current datetime in java
Explore tagged Tumblr posts
Text
top 10 free python programming books pdf online download
link :https://t.co/4a4yPuVZuI?amp=1
python download python dictionary python for loop python snake python tutorial python list python range python coding python programming python array python append python argparse python assert python absolute value python append to list python add to list python anaconda a python keyword a python snake a python keyword quizlet a python interpreter is a python code a python spirit a python eating a human a python ate the president's neighbor python break python basics python bytes to string python boolean python block comment python black python beautifulsoup python built in functions b python regex b python datetime b python to dictionary b python string prefix b' python remove b' python to json b python print b python time python class python certification python compiler python command line arguments python check if file exists python csv python comment c python interface c python extension c python api c python tutor c python.h c python ipc c python download c python difference python datetime python documentation python defaultdict python delete file python data types python decorator d python format d python regex d python meaning d python string formatting d python adalah d python float d python 2 d python date format python enumerate python else if python enum python exit python exception python editor python elif python environment variables e python numpy e python for everyone 3rd edition e python import e python int e python variable e python float python e constant python e-10 python format python function python flask python format string python filter python f string python for beginners f python print f python meaning f python string format f python float f python decimal f python datetime python global python global variables python gui python glob python generator python get current directory python getattr python get current time g python string format g python sleep g python regex g python print g python 3 g python dictionary g python set g python random python hello world python heapq python hash python histogram python http server python hashmap python heap python http request h python string python.h not found python.h' file not found python.h c++ python.h windows python.h download python.h ubuntu python.h not found mac python if python ide python install python input python interview questions python interpreter python isinstance python int to string in python in python 3 in python string in python meaning in python is the exponentiation operator in python list in python what is the result of 2 5 in python what does mean python json python join python join list python jobs python json parser python join list to string python json to dict python json pretty print python j complex python j is not defined python l after number python j imaginary jdoodle python python j-link python j+=1 python j_security_check python kwargs python keyerror python keywords python keyboard python keyword arguments python kafka python keyboard input python kwargs example k python regex python k means python k means clustering python k means example python k nearest neighbor python k fold cross validation python k medoids python k means clustering code python lambda python list comprehension python logging python language python list append python list methods python logo l python number l python array python l-bfgs-b python l.append python l system python l strip python l 1 python map python main python multiprocessing python modules python modulo python max python main function python multithreading m python datetime m python time python m flag python m option python m pip install python m pip python m venv python m http server python not equal python null python not python numpy python namedtuple python next python new line python nan n python 3 n python meaning n python print n python string n python example in python what is the input() feature best described as n python not working in python what is a database cursor most like python online python open python or python open file python online compiler python operator python os python ordereddict no python interpreter configured for the project no python interpreter configured for the module no python at no python 3.8 installation was detected no python frame no python documentation found for no python application found no python at '/usr/bin python.exe' python print python pandas python projects python print format python pickle python pass python print without newline p python re p python datetime p python string while loop in python python p value python p value from z score python p value calculation python p.map python queue python queue example python quit python qt python quiz python questions python quicksort python quantile qpython 3l q python download qpython apk qpython 3l download for pc q python 3 apk qpython ol q python 3 download for pc q python 3 download python random python regex python requests python read file python round python replace python re r python string r python sql r python package r python print r python reticulate r python format r python meaning r python integration python string python set python sort python split python sleep python substring python string replace s python 3 s python string s python regex s python meaning s python format s python sql s python string replacement s python case sensitive python try except python tuple python time python ternary python threading python tutor python throw exception t python 3 t python print .t python numpy t python regex python to_csv t python scipy t python path t python function python unittest python uuid python user input python uppercase python unzip python update python unique python urllib u python string u' python remove u' python json u python3 u python decode u' python unicode u python regex u' python 2 python version python virtualenv python venv python virtual environment python vs java python visualizer python version command python variables vpython download vpython tutorial vpython examples vpython documentation vpython colors vpython vector vpython arrow vpython glowscript python while loop python write to file python with python wait python with open python web scraping python write to text file python write to csv w+ python file w+ python open w+ python write w+ python open file w3 python w pythonie python w vs wb python w r a python xml python xor python xrange python xml parser python xlrd python xml to dict python xlsxwriter python xgboost x python string x-python 2 python.3 x python decode x python 3 x python byte x python remove python x range python yield python yaml python youtube python yaml parser python yield vs return python yfinance python yaml module python yaml load python y axis range python y/n prompt python y limit python y m d python y axis log python y axis label python y axis ticks python y label python zip python zipfile python zip function python zfill python zip two lists python zlib python zeros python zip lists z python regex z python datetime z python strftime python z score python z test python z transform python z score to p value python z table python 0x python 02d python 0 index python 0 is false python 0.2f python 02x python 0 pad number python 0b 0 python meaning 0 python array 0 python list 0 python string 0 python numpy 0 python matrix 0 python index 0 python float python 101 python 1 line if python 1d array python 1 line for loop python 101 pdf python 1.0 python 10 to the power python 101 youtube 1 python path osprey florida 1 python meaning 1 python regex 1 python not found 1 python slicing 1 python 1 cat 1 python list 1 python 3 python 2.7 python 2d array python 2 vs 3 python 2.7 download python 2d list python 2.7 end of life python 2to3 python 2 download 2 python meaning 2 pythons fighting 2 pythons collapse ceiling 2 python versions on windows 2 pythons fall through ceiling 2 python versions on mac 2 pythons australia 2 python list python 3.8 python 3.7 python 3.6 python 3 download python 3.9 python 3.7 download python 3 math module python 3 print 3 python libraries 3 python ide python3 online 3 python functions 3 python matrix 3 python tkinter 3 python dictionary 3 python time python 4.0 python 4 release date python 4k python 4 everyone python 44 mag python 4 loop python 474p remote start instructions python 460hp 4 python colt 4 python automl library python 4 missile python 4 download python 4 roadmap python 4 hours python 5706p python 5e python 50 ft water changer python 5105p python 5305p python 5000 python 5706p manual python 5760p 5 python data types 5 python projects for beginners 5 python libraries 5 python projects 5 python ide with icons 5 python program with output 5 python programs 5 python keywords python 64 bit python 64 bit windows python 64 bit download python 64 bit vs 32 bit python 64 bit integer python 64 bit float python 6 decimal places python 660xp 6 python projects for beginners 6 python holster 6 python modules 6 python 357 python 6 missile python 6 malware encryption python 6 hours python 7zip python 7145p python 7754p python 7756p python 7145p manual python 7145p remote start python 7756p manual python 7154p programming 7 python tricks python3 7 tensorflow python 7 days ago python 7 segment display python 7-zip python2 7 python3 7 ssl certificate_verify_failed python3 7 install pip ubuntu python 8 bit integer python 881xp python 8601 python 80 character limit python 8 ball python 871xp python 837 parser python 8.0.20 8 python iteration skills 8 python street dakabin python3 8 tensorflow python 8 puzzle python 8 download python 8 queens python 95 confidence interval python 95 percentile python 990 python 991 python 99 bottles of beer python 90th percentile python 98-381 python 9mm python 9//2 python 9 to 09 python 3 9 python 9 subplots pythonrdd 9 at rdd at pythonrdd.scala python 9 line neural network python 2.9 killed 9 python

#pythonprogramming #pythoncode #pythonlearning #pythons #pythona #pythonadvanceprojects #pythonarms #pythonautomation #pythonanchietae #apython #apythonisforever #apythonpc #apythonskin #apythons #pythonbrasil #bpython #bpythons #bpython8 #bpythonshed #pythoncodesnippets #pythoncowboy #pythoncurtus #cpython #cpythonian #cpythons #cpython3 #pythondjango #pythondev #pythondevelopers #pythondatascience #pythone #pythonexhaust #pythoneğitimi #pythoneggs #pythonessgrp #epython #epythonguru #pythonflask #pythonfordatascience #pythonforbeginners #pythonforkids #pythonfloripa #fpython #fpythons #fpythondeveloper #pythongui #pythongreen #pythongame #pythongang #pythong #gpython #pythonhub #pythonhackers #pythonhacking #pythonhd #hpythonn #hpythonn✔️ #hpython #pythonista #pythoninterview #pythoninterviewquestion #pythoninternship #ipython #ipythonnotebook #ipython_notebook #ipythonblocks #ipythondeveloper #pythonjobs #pythonjokes #pythonjobsupport #pythonjackets #jpython #jpythonreptiles #pythonkivy #pythonkeeper #pythonkz #pythonkodlama #pythonkeywords #pythonlanguage #pythonlipkit #lpython #lpythonlaque #lpythonbags #lpythonbag #lpythonprint #pythonmemes #pythonmolurusbivittatus #pythonmorphs #mpython #mpythonprogramming #mpythonrefftw #mpythontotherescue #mpython09 #pythonnalchik #pythonnotlari #pythonnails #pythonnetworking #pythonnation #pythonopencv #pythonoop #pythononline #pythononlinecourse #pythonprogrammers #ppython #ppythonwallet #ppython😘😘 #ppython3 #pythonquiz #pythonquestions #pythonquizzes #pythonquestion #pythonquizapp #qpython3 #qpython #qpythonconsole #pythonregiusmorphs #rpython #rpythonstudio #rpythonsql #pythonshawl #spython #spythoniade #spythonred #spythonredbackpack #spythonblack #pythontutorial #pythontricks #pythontips #pythontraining #pythontattoo #tpythoncreationz #tpython #pythonukraine #pythonusa #pythonuser #pythonuz #pythonurbex #üpython #upython #upythontf #pythonvl #pythonvert #pythonvertarboricole #pythonvsjava #pythonvideo #vpython #vpythonart #vpythony #pythonworld #pythonwebdevelopment #pythonweb #pythonworkshop #pythonx #pythonxmen #pythonxlanayrct #pythonxmathindo #pythonxmath #xpython #xpython2 #xpythonx #xpythonwarriorx #xpythonshq #pythonyazılım #pythonyellow #pythonyacht #pythony #pythonyerevan #ypython #ypythonproject #pythonz #pythonzena #pythonzucht #pythonzen #pythonzbasketball #python0 #python001 #python079 #python0007 #python08 #python101 #python1 #python1k #python1krc #python129 #1python #python2 #python2020 #python2018 #python2019 #python27 #2python #2pythons #2pythonsescapedfromthezoo #2pythons1gardensnake #2pythons👀 #python357 #python357magnum #python38 #python36 #3pythons #3pythonsinatree #python4kdtiys #python4 #python4climate #python4you #python4life #4python #4pythons #python50 #python5 #python500 #python500contest #python5k #5pythons #5pythonsnow #5pythonprojects #python6 #python6s #python69 #python609 #python6ft #6python #6pythonmassage #python7 #python734 #python72 #python777 #python79 #python8 #python823 #python8s #python823it #python800cc #8python #python99 #python9 #python90 #python90s #python9798
1 note
·
View note
Text
MySQL Connector/J 8.0.24 has been released
Dear MySQL users, MySQL Connector/J 8.0.24 is the latest General Availability release of the MySQL Connector/J 8.0 series. It is suitable for use with MySQL Server versions 8.0 and 5.7. It supports the Java Database Connectivity (JDBC) 4.2 API, and implements the X DevAPI. This release includes the following new features and changes, also described in more detail on https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/news-8-0-24.htmlAs always, we recommend that you check the “CHANGES” file in the download archive to be aware of changes in behavior that might affect your application. To download MySQL Connector/J 8.0.24 GA, see the “General Availability (GA) Releases” tab at http://dev.mysql.com/downloads/connector/j/Enjoy! Changes in MySQL Connector/J 8.0.24 (2021-04-20, General Availability) * Functionality Added or Changed * Bugs Fixed Functionality Added or Changed * X DevAPI: For X Protocol connections, the Server now provides three new kinds of notifications for disconnections: + Server shutdown: This is due to a server shutdown. It causes Connector/J to terminate all active and idle sessions connected to the server in the connection pool with the error message “Server shutdown in progress”. + Connection idle: This is due to the connection idling for longer than the relevant timeout settings. It causes Connector/J to close the current connection with the error message “IO Read error: read_timeout exceeded”. + Connection killed: This is due to the connection being killed by another client session. It causes Connector/J to close the connection in the current session with the error message “Session was killed”. * A new connection property, scrollTolerantForwardOnly, has been introduced, which preserved the legacy behavior of Connector/J 8.0.17 and earlier by tolerating backward and absolute cursor movements on result sets of type ResultSet.TYPE_FORWARD_ONLY. This is for maintaining compatibility with legacy code that took advantage of the old behavior. See the description for scrollTolerantForwardOnly for details. (Bug #31747910) References: See also: Bug #30474158. * Connector/J now supports “userless” authentication for JDBC connections: When the user for the connection is unspecified, Connector/J uses the name of the OS user who runs the application for authentication with the MySQL server. See Connector/J: Obtaining a connection from the DriverManager (https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-usagenotes-connect-drivermanager.html#connector-j-examples-connection-drivermanager) for more details. * Starting from this release, whenever an authentication plugin is explicitly set for the connection property defaultAuthenticationPlugin (https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-connection.html#cj-conn-prop_defaultAuthenticationPlugin), the specified plugin takes precedence over the server’s default when Connector/J negotiates a plugin with the server. There is no behavioral change for Connector/J if no value is explicitly set for the property, in which case the server’s choice of default plugin takes precedence over the implicit default of mysql_native_password for Connector/J. See the description of defaultAuthenticationPlugin (https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-connection.html#cj-conn-prop_defaultAuthenticationPlugin) for details. * In the past, for JDBC connections, when the server closed a session because a client was idling beyond the period specified by the server’s wait_timeout system variable, Connector/J returned a generic IO error. Connector/J now relays a clearer error message from the server. Bugs Fixed * X DevAPI: Concurrently getting and closing multiple sessions from the same X DevAPI Client object might result in a ConcurrentModificationException thrown by Connector/J at the closing of a session. (Bug #31699993) * X DevAPI: Under some specific conditions, when using Deflate as the algorithm for compression of X Protocol connections, Connector/J threw an AssertionFailedException (ASSERTION FAILED: Unknown message type: 57). It was because when a compressed packet was just a few bytes longer than the size of some internal buffer used by a Java InflaterInputStream, the leftover bytes from the inflate procedure were being discarded by Connector/J, causing inflation of subsequent packets to fail. With this fix, no data bytes are discarded, and the inflation works as expected. (Bug #31510398, Bug #99708) * When a SecurityManager was in place, connections to a MySQL Server could not be established unless the client had been properly configured to use SASL-based LDAP authentication. It was because the AuthenticationLdapSaslClientPlugin in Connector/J requires a special permission to load the provider MySQLScramShaSasl when a SecurityManager is in place; but since the provider was loaded by a static initializer during initialization for the plugin, the lack of the permission was causing an error and then failures for all connections, even if the plugin was never used or enabled. This fix changes how the provider is loaded: the loading now happens only at the plugin instance’s initialization and the initialization was deferred to the time when the plugin is actually needed, so that connections that do not use SASL-based LDAP authentication are unaffected by security settings regarding the plugin. (Bug #32526663, Bug #102188) * When using Connector/J 8.0.23, ResultSetMetaData.getColumnClassName() did not return the correct class name corresponding to DATETIME columns. (Bug #32405590, Bug #102321) * Creation of an UpdatableResultSet failed with a NullPointerException when it was generated by querying a view with a derived value. (Bug #32338451, Bug #102131) * Using getLong() on the CHAR_OCTET_LENGTH column of the ResultSet for DatabaseMetaData.getProcedureColumns() (or getFunctionColumns()) resulted in a NumberOutOfRange exception when the column’s value exceeded 2^32 − 1. With this patch, the value of 2^32 − 1 is returned in the situation. (Bug #32329915, Bug #102076) * Connections to a server could not be established when the user supplied an implementation of the ConnectionPropertiesTransform interface using the connection property propertiesTransform. This was because Connector/J called PropertyKey.PORT.getKeyName() instead of PropertyKey.HOST.getKeyName() for getting the host name, and that has been corrected by this fix. (Bug #32151143, Bug #101596) * A NullPointerException was returned when a statement that could not be used as a ServerPreparedStatement was executed and the connection property useUsageAdvisor (https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-debugging-profiling.html#cj-conn-prop_useUsageAdvisor) was set to true. With this fix, a SQLException is returned instead. (Bug #32141210, Bug #101558) * Using the setSessionMaxRows() method on a closed connection resulted in a NullPointerException. With this fix, a SQLNonTransientConnectionException is thrown instead, with the error message “No operations allowed after connection closed.” (Bug #22508715) * Using the setObject() method for a target type of Types.TIME resulted in a SQLException when the value to be set had a fractional part, or when the value did not fit any pattern described in Date and Time Literals (https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html). This patch introduced a new logic that can handle fractional parts; also, it performs the conversion according to the patterns of the literals and, when needed, the target data type. (Bug #20391832) Enjoy and thanks for the support! On Behalf of the MySQL Engineering Team, Nawaz Nazeer Ahamed https://insidemysql.com/mysql-connector-j-8-0-24/
0 notes
Text
How to Build a Blog with Gatsby and Netlify CMS – A Complete Guide
In this article, we are going to build a blog with Gatsby and Netlify CMS. You will learn how to install Gatsby on your computer and use it to quickly develop a super fast blog site.
You are also going to learn how to add Netlify CMS to your site by creating and configuring files, then connecting the CMS to your site through user authentication.
And finally, you'll learn how to access the CMS admin so that you can write your first blog post.
The complete code for this project can be found here.
Here's a brief introduction to these tools.
What is Gatsby?
Gatsby is a free and open-source framework based on React that helps you build fast websites and web apps. It is also a static site generator like Next.js, Hugo, and Jekyll.
It includes SEO (Search Engine Optimization), accessibility, and performance optimization from the get-go. This means that it will take you less time to build production-ready web apps than if you were building with React alone.
What is Netlify CMS?
Netlify CMS is a CMS (Content Management System) for static site generators. It is built by the same people who made Netlify. It allows you to create and edit content as if it was WordPress, but it's a much simpler and user-friendly interface.
The main benefit of Netlify CMS is you don't have to create markdown files every time you want to write a post. This is useful for content writers who don't want to deal with code, text editors, repositories, and anything to do with tech - they can just focus on writing articles.
Alright, without any further ado, let's start building the blog!
But before we get going, a quick heads up: This guide requires prior knowledge of JavaScript and React. If you are not comfortable with these tools yet, I've linked the resources at the end of the article to help you brush up on those skills.
Even if you're new to those technologies, I tried to make this guide as simple as I was able so you can follow along.
How to set up the environment
Before we can build Gatsby sites, we have to make sure that we have installed all the right software required for the blog.
Install Node.js
Node.js is an environment that can run JavaScript code outside of a web browser.
It is a tool that allows you to write backend server code instead of using other programming languages such as Python, Java, or PHP. Gatsby is built with Node.js and that's why we need to install it on our computer.
To install Node.js, go to the download page and download it based on your operating system.
When you are done following the installation prompts, open the terminal and run node -v to check if it was installed correctly. Currently, the version should be 12.18.4 and above.
Install Git
Git is a free and open-source distributed version control system that helps you manage your coding projects efficiently.
Gatsby starter uses Git to download and install its required files and that's why you need to have Git on your computer.
To install Git, follow the instructions based on your operating system:
Install Gatsby CLI
Gatsby CLI (Command Line Interface) is the tool that lets you build Gatsby-powered sites. By running this command, we can install any Gatsby sites and the plugins we want.
To install Gatsby CLI, open the terminal and run this command:
npm install -g gatsby-cli
Once everything is set up successfully then we are ready to build our first Gatsby site.
How to build a Gatsby site
In this guide, we're going to use the default Gatsby starter theme, but you're free to choose any themes on the Gatsby starter library. I personally use the Lekoart theme because the design is minimalist and beautiful, and it has a dark mode.
In the terminal, run this command to install the new Gatsby blog:
gatsby new foodblog https://github.com/gatsbyjs/gatsby-starter-blog
Note for Windows users: If you encounter "Error: Command failed with exit code 1: yarnpkg" while creating Gatsby site, see this page to troubleshoot it. You may have to clean up dependencies of old yarn installations or follow the Gatsby on Windows instructions.
What's does this command line mean exactly? Let me explain.
new - This is the command line that creates a new Gatsby project
foodblog - This is the name of the project. You can name it whatever you want here. I named this project foodblog as an example only.
The URL (https://github.com/gatsbyjs/gatsby-starter-blog) - This URL specified points to a code repository that holds the starter code you want to use. In other words, I picked the theme for the project.
Once the installation is complete, we'll run the cd foodblog command which will take us to the location of our project file.
cd foodblog
Then we'll run gatsby develop that will start running on the local machine. Depending on the specs of your computer, it will take a little while before it is fully started.
gatsby develop
Open a new tab in your browser and go to http://localhost:8000/. You should now see your new Gatsby site!
How a Gatsby starter blog homepage looks
Now that we've created the blog, the next step is to add Netlify CMS to make writing blog posts easier.
How to add Netlify CMS to your site
Adding Netlify CMS to your Gatsby site involves 4 major steps:
app file structure,
configuration,
authentication, and
accessing the CMS.
Let's tackle each of these stages one at a time.
How to set up the app's file structure
This section deals with the file structure of your project. We are going to create files that will contain all Netlify CMS codes.
When you open your text editor, you will see a lot of files. You can read this article if you are curious about what each of these files does.
├── node_modules ├── src ├── static ├── .gitignore ├── .prettierrc ├── gatsby-browser.js ├── gatsby-config.js ├── gatsby-node.js ├── gatsby-ssr.js ├── LICENSE ├── package-lock.json ├── package.json └── README.md
Do not worry about all these files — we are going to use very few of them here.
What we are looking for is the static folder. This is the folder where it will form the main structure of the Netlify CMS.
If your project does not have Static folder, then create the folder at the root directory of your project.
Inside the static folder, create an admin folder. Inside this folder, create two files index.html and config.yml:
admin ├ index.html └ config.yml
The first file, index.html, is the entry point to your CMS admin. This is where Netlify CMS lives. You don't need to do styling or anything as it is already done for you with the script tag in the example below:
<!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Content Manager</title> </head> <body> <script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script> </body> </html>
The second file, config.yml, is the main core of the Netlify CMS. It's going to be a bit complicated as we are going to write backend code. We'll talk more about it in the configuration section.
How to configure the back end
In this guide, we are using Netlify for hosting and authentication and so the backend configuration process should be relatively straightforward. Add all the code snippets in this section to your admin/config.yml file.
We'll begin by adding the following codes:
backend: name: git-gateway branch: master
Heads up: This code above works for GitHub and GitLab repositories. If you're using Bitbucket to host your repository, follow these instructions instead.
The code we just wrote specifies your backend protocol and your publication branch (which is branch: master). Git Gateway is an open-source API that acts as a proxy between authenticated users of your site and your site repository. I'll explain more what this does in the authentication section.
Next up, we will write media_folder: "images/uploads". This will allow you to add media files like photos directly to your CMS. Then you won't need to use a text editor to manually add media and all that.
media_folder: "images/uploads"
Make sure you created a folder called images in the admin folder. Inside the images folder, create an uploads folder as this is the place where you'll host your images.
Configure Collections
The collections will define the structure for the different content types on your static site. As every site can be different, how you configure the collection's settings will differ from one site to another.
Let's just say your site has a blog, with the posts stored in content/blog, and files saved in a date-title format, like 2020-09-26-how-to-make-sandwiches-like-a-pro.md. Each post begins with settings in the YAML-formatted front matter in this way:
--- layout: blog title: "How to make sandwiches like a pro" date: 2020-09-26 11:59:59 thumbnail: "/images/sandwich.jpg" --- This is the post body where I write about how to make a sandwich so good that will impress Gordon Ramsay.
With this example above, this is how you will add collections settings to your Netlify CMS config.yml file:
collections: - name: "blog" label: "Blog" folder: "content/blog" create: true slug: "---" fields: - {label: "Layout", name: "layout", widget: "hidden", default: "blog"} - {label: "Title", name: "title", widget: "string"} - {label: "Publish Date", name: "date", widget: "datetime"} - {label: "Body", name: "body", widget: "markdown"}
Let's examine what each of these fields does:
name: This one is used in routes like /admin/collections/blog
label: This one is used in the UI (User Interface). When you are in the admin page, you will see a big word "Blog" on the top of the screen. That big word "Blog" is the label.
folder: This one points to the file path where your blog posts are stored.
create: This one lets the user (you or whoever has admin access) create new documents (blog posts in this case) in these collections.
slug: This one is the template for filenames. , , and which are pulled from the post's date field or save date. is a URL-safe version of the post's title. By default it is .
The fields are where you can customize the content editor (the page where you write the blog post). You can add stuff like ratings (1-5), featured images, meta descriptions, and so on.
For instance, in this particular code, we add curly braces {}. Inside them we write label with the value "Publish Date" which will be the label in the editor UI.
The name field is the name of the field in the front matter and we name it "date" since the purpose of this field is to enter the date input.
And lastly, the widget determines how the UI style will look and the type of data we can enter. In this case, we wrote "datetime" which means we can only enter the date and time.
- {label: "Publish Date", name: "date", widget: "datetime"}
You can check the list right here to see what exactly you can add. If you want, you can even create your own widgets, too. For the sake of brevity, we'll try to keep things simple here.
Enable Authentication
At this point, we are nearly done with the installation and configuration of Netlify CMS. Now it's time to connect your Gatsby site to the CMS by enabling authentication.
We'll add some HTML code and then activate some features from Netlify. After that, you are on the way to creating your first blog post.
We are going to need a way to connect a front end interface to the backend so that we can handle authentication. To do that, add this HTML script tag to two files:
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
The first file to add this script tag is the admin/index.html file. Place it between the <head> tags. And the second file to add the tag is the public/index.html file. This one also goes in between the <head> tags.
When a user logs in with the Netlify Identity widget, an access token directs them to the site homepage. In order to complete the login and get back to the CMS, redirect the user back to the /admin/ path.
To do this, add the following code before the closing body tag of the public/index.html file:
<script> if (window.netlifyIdentity) { window.netlifyIdentity.on("init", user => { if (!user) { window.netlifyIdentity.on("login", () => { document.location.href = "/admin/"; }); } }); } </script>
With this, we are now done writing the code and it's time to visit Netlify to activate authentication.
Before we move on, you should Git commit your changes and push them to the repository. Plus, you will have to deploy your site live so you can access the features in the Enable Identity and Git Gateway section.
Deploy your site live with Netlify
We are going to use Netlify to deploy our Gatsby site live. The deployment process is pretty straightforward, quick, and most importantly, it comes with a free SSL (Secure Sockets Layer). This means your site is protected (you can tell by looking at the green lock on the browser search).
If you haven't signed up for the platform, you can do it right here. When you've finished signing up, you can begin the deployment process by following these 3 steps.
Click the "New site from Git" button to create a new site to be deployed. Choose the Git provider where your site is hosted. My site is hosted on GitHub so that's what I will choose.
Choose the repository you want to connect to Netlify. The name of my Gatsby site is "foodblog" but you have to pick your own project name.
The last one asks how you would like Netlify to adjust your builds and deploy your site. We are going to leave everything as it is and we will click the "Deploy site" button. This will begin deploying your site to live.
Once the deployment is complete, you can visit your live site by clicking the green link that has been generated for you on the top left of the screen. Example: https://random_characters.netlify.app.
With this, the world can now view your site. You can replace the weird URL with your custom domain by reading this documentation.
How to enable Identity and Git Gateway
Netlify's Identity and Git Gateway services help you manage CMS admin users for your site without needing them to have an account with your Git host (Like GitHub) or commit access on your repository.
To activate these services, head to your site dashboard on Netlify and follow these steps:
Go to Settings > Identity, and select Enable Identity service.
In the Overview page of your site, click the "Settings" link.
After clicking "Settings", scroll down the left sidebar and click the "Identity" link.
Click the "Enable Identity" button to activate the Identity feature.
2. Under Registration preferences, select Open or Invite only. Most of the time, you want only invited users to access your CMS. But if you are just experimenting, you can leave it open for convenience.
Under the Identity submenu, click the "Registration" link and you'll be taken to the registration preferences.
3. Scroll down to Services > Git Gateway, and click Enable Git Gateway. This authenticates with your Git host and generates an API access token.
In this case, we're leaving the Roles field blank, which means any logged-in user may access the CMS.
Under the Identity submenu, click the "Services" link.
Click the "Enable Git Gateway" button to activate the Git Gateway feature.
With this, your Gatsby site has been connected with Netlify CMS. All that is left is to access the CMS admin and write blog posts.
How to access the CMS
All right, you are now ready to write your first blog post!
There are two ways to access your CMS admin, depending on what accessing options you chose from the Identity.
If you selected Invite only, you can invite yourself and other users by clicking the Invite user button. Then an email message will be sent with an invitation link to login to your CMS admin. Click the confirmation link and you'll be taken to the login page.
Alternatively, if you selected Open, you can access your site's CMS directly at yoursite.com/admin/. You will be prompted to create a new account. When you submit it, a confirmation link will be sent to your email. Click the confirmation link to complete the signup process and you'll be taken to the CMS page.
Note: If you cannot access your CMS admin after clicking the link from the email, the solution is to copy the link in the browser starting with #confirmation_token=random_characters and paste the link after the hashtag "#", like this: https://yoursite.com/admin/#confirmation_token=random_characters. This should fix the problem.
If everything goes well, you should see your site's admin dashboard:
Netlify CMS admin.
You can create your new post by clicking the "New post" button.
When you're ready to publish your post, you can click the "Publish Now" button to publish it immediately.
When you hit the publish button, the post file is automatically created. Then it will add to the changes with the commit message based on the name of the post along with the date and time of publishing. Finally, it will be pushed to the host repository, and from there your post will be seen live.
You can view the changes by looking at the commit message in your host repository.
After waiting for a few minutes, your new post should be live.
One more thing
The last thing to do is clean up the sample articles. To delete these posts, go to the blog files in your text editor and delete them one by one. Make sure you check your terminal when deleting them so that there will be no issues on your site.
Once all the sample posts are cleared out, commit these changes and push them to the repository.
And now, you are all done! You can now create your new posts from the comfortable CMS dashboard and share your stories to the world.
Summary
In this guide you have learned how to:
Create a Gatsby blog site
Added the Netlify CMS to your Gatsby site by creating and configuring files
Enable user authentication by activating Identity and Git Gateway
Access your site's CMS admin
Publish your first post powered by Gatsby and Netlify CMS
By the end of this guide, you should now be able to enjoy writing blog posts with a fast website and simple content editor. And you probably don't have to touch the code unless it needs further customization.
There is still more to cover about Gatsby and Netlify CMS. One of the best ways to learn about them is to go through their documentation.
I hope you found this guide beneficial, and happy posting!
Check out my blog to learn more tips, tricks, and tutorials about web development.
Cover photo by NeONBRAND on Unsplash.
Resources for JavaScript and React
Here are some resources that may help you to learn JavaScript and React:
JavaScript
React
0 notes
Photo

Refresher on how to get the current date and time in Python, Java, JavaScript, C, and PHP. Follow @initialcommit for more programming content. Check out our website https://initialcommit.io for programming articles, books, live sessions, and how to create your own code-oriented website. #initialcommit #datetime #python #pythonprogramming #java #javaprogramming #javascript #cprogramming #php #programming #coding #learnprogramming #learncoding #softwaredevelopment https://www.instagram.com/p/CAVL93wFWko/?igshid=2l8rmd6gmhju
#initialcommit#datetime#python#pythonprogramming#java#javaprogramming#javascript#cprogramming#php#programming#coding#learnprogramming#learncoding#softwaredevelopment
0 notes
Text
Robot Framework With Python: An Open Source Framework For RPA

Robot Framework is one of the most useful open source automation software available in the market for acceptance testing, Robotic Process Automation (RPA), and Automation Test-Driven Development (ATDD). The syntax used is accessible in the tabular data form. Also, it uses the keyword-driven approach for testing purposes.
The testing capabilities of the Robot Framework can be extended when it is used with Python and Java. An efficient user can create new and higher-level keywords from the already existing keywords by using the same approach and syntax.
The framework has a prosperous system of libraries, both internal and external having useful keywords. These keywords can be re-used as per the requirement. The core Robot Framework is implemented using Python and also runs on IronPython (JVM) and Jython (.NET).
Libraries in Robot Framework
Testing libraries are the source of actual capabilities for Robot Framework as they provide keywords. Many standard libraries come along with the framework, whereas some other separately developed libraries can be installed as per the needs. However, there is a scope of creating the library.
Check out the list and manage the libraries accordingly:
Standard Libraries - We have categorized the standard libraries in eleven sets as follows:
Builtin - It provides a set of keywords that are generic and are often needed. The library is always available automatically without any imports.
Dialogs - This library provides means for pausing the execution of the test and getting the user’s input.
Operating System - The Operating System library enables various operating system related tasks that are performed on the system, correctly where the framework is running.
Remote - It is a unique library that acts as a proxy between the Robot frameworks and the testing libraries.
Collections - It provides a set of keywords that helps in handling Python lists and dictionaries.
Screenshot - This library has the keywords for capturing a screenshot of the current screen running on the desktop.
String - This library is meant to generate, modify, and verify strings.
Telnet - With the help of the Telnet library, one can establish a connection with Telnet servers and execute commands.
XML - With XML one can generate, modify, and verify XML files.
Process - The process is for running processes in the system and is latest in Robot version 2.8
DateTime - Used for Date and Time conversion. New in Robot version 2.8.5
External Libraries - There are plenty of external libraries, some of them have been mentioned here for reference:
Android Library - It is the library for all the Android automation needs. The library uses the Calabash Android internally.
AnyWhere Library - This library is used for testing single-page applications. The library uses Selenium Webdriver and Appium internally.
DataDriver Library - This library is meant for data-driven testing with external data tables.
Database Library (Python) - It is a python based library used for data testing. It can work with any Python interpreter including Jython.
White library - This is the library for automating Windows GUI. The library is based on the White framework support technologies that include WinForms, WPF, and Win32.
Tools for Robot Framework
The tools linked with Robot Framework are used to ease things that are linked with editing, running, building, and so on. Many of the tools used are developed for separate projects, but there are some built-in frameworks as well. Some of the tools are characterized and mentioned below:
Built-In Tools - These are the tools that are initially available in the Framework:
Rebot - These are the tools for generating reports and logs based on XML. It is also used to combine various outputs.
Libdoc - It is a tool used for generating keywords documentation for resource files and test libraries.
Tidy - This tool is used for cleaning up and changing the formats of Robot Framework test data files.
TestDoc - This tool generates a high level of HTML documentation based on the test cases.
Editors Tools - The tools under this category are:
Atom Plugin - This is a Robot Framework plugin for Atom.
Debugger for Visual Studio Code - It is a Visual Studio Code extension that helps in debugging files with breakpoints, call stacks, etc.
RIDE - Standalone Robot Framework test data editor.
To summarize, Robot makes generation easier. As you learn you will understand that how opening a browser with Robot requires only a one-line code. Also, logs and reports are created automatically while the execution of the tests and that too without writing any code. So, you can consider the Robot framework to be among the easiest and the best framework worthwhile for testing nowadays.
**************************************************************************************
QACult Best Software Testing Courses in Chandigarh tricity.- We love to enhance your knowledge.
QACult is the premier institute catering to the requirements of experienced and fresh pass-out that gives leaders like you a new way to experience Quality engineering—while you work and giving you the flexibility to both advance your career. Our faculty have 12+ years of industrial experience and have developed many automation testing frameworks in java using TestNG or BDD (cucumber) methodology. We expertise in developing automation testing frameworks in java, python, javascript, php, ruby(WATIR-webdriver & Capybara) and Appium. please subscribe our channel for more such updates:
https://www.youtube.com/channel/UC0xat537YITJbN_9GSMUALA And visit our website: www.qacult.com for various blogs and Upcoming Events.
0 notes
Text
90% off #Java 8 New Features – $10
Learn ALL New Features with live Examples
All Levels, – 2 hours, 19 lectures
Average rating 2.9/5 (2.9 (35 ratings) Instead of using a simple lifetime average, Udemy calculates a course’s star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.)
Course requirements:
You should be familiar with Core Java and Eclipse (Or any other IDE).Installation should be done before taking this course.
Course description:
Course Description
Learn all new features of Java 8. It makes code more concise and more readable.
Increase your programming speed and reduce execution time of program.
Anyone who is aware about core Java , can take this course. Each and every point is explained with live programming from vary scratch. So the course is easy to follow for any programmer or learner.
All videos are downloadable so just learn whenever you want to learn !
Content and overview
This course is going to cover all the new features. All yet not completed. Will be completed very soon.
With the help of Default methods, you can add methods in a published interface and it is not going to give any compile time error! Lambda expression allows you to make your code more concise and readable. To understand Lambda expression, Anonymous class and functional Interfaces can help you. So all this points are covered with live examples. Stream API is a great feature available in Java 8.It allows you to do map-filter-reduce processing faster and easily. Date Time API has changes the way of working with date time in Java.So come on , use the features available. Nashorn and Java Script Engine also explained with examples. Oh, that’s not finish yet, inbuilt collections like map are also having so many new methods to work on !
Full details Understand Default Methods Understand and Use Lambda Expression in Real Life Use Method Reference In real Programming Habit Make faster processing with Stream API Use Date Time API for better and faster way Understand Nashorn And Java Script Engine All other small points like of Java 8
Full details This Java 8 course is for all the programmers who want to learn and use new features Of Java 8. Prior knowledge of Core Java is must.
Reviews:
“1.It looks like you are reading paragraphs from the book and presenting it to us. There were many instances where you narrated long paragraphs and it was more of theoritical concepts. The course could have been done in a much better way 2. The DateTime API section has been recorded on a very small screen.Have you ever tried looking at the videos you recorded? Its damn hard to understand anything” (Gagan Gupta)
“Awesome Course with nice explanation and content. very useful. Thank you.” (Developer)
“Good course, gave a detailed explanation of important concepts with examples helped me.” (Sreenivasulu Reddy Chelikam)
About Instructor:
Chandani Thacker
I am having 4+ Years of IT Experience. After Engineering in IT, I joined as Developer. And then moved to Trainings and Academics. And currently working as Corporate Java Trainer. Training is passion for me and luckily Source of Income too
And I am also Certified Technical Writer. I have experience of so many different types of Open source Technologies.
Instructor Other Courses:
Introduction of GIT Chandani Thacker, Corporate Java Trainer (24) $10 $20 …………………………………………………………… Chandani Thacker coupons Development course coupon Udemy Development course coupon Programming Languages course coupon Udemy Programming Languages course coupon Java 8 New Features Java 8 New Features course coupon Java 8 New Features coupon coupons
The post 90% off #Java 8 New Features – $10 appeared first on Course Tag.
from Course Tag http://coursetag.com/udemy/coupon/90-off-java-8-new-features-10/ from Course Tag https://coursetagcom.tumblr.com/post/158221998903
0 notes
Quote
When you develop some software you may not think about timezones at first. Unless you live in a country which has to deal with multiple time zones, such as the United States or Russia. I recently came across an issue involving timezones. There were some unit tests making assertions about dates that used to work at my office in France but weren't working in Morocco for new members on our team. Here is the unit test working in France but not in Morocco This was an opportunity for me to learn how to correctly handle dates and times for international software. In this article, I’ll introduce time zone issues and share some rules to follow. Quick introduction to time zones As the earth is kind of a sphere, the sun is rising in Japan while it's setting in America. If everyone used global time, let’s say 09:00 would be sunrise in Japan, but for Americans it would be sunset. Not very handy. To make sure the time is coordinated with the sun for everyone, it’s necessary to shift from global time according to your location. As a result, the globe gets split into time zones and each gets an offset. This offset is a number of minutes to add to the global time to get your time zone time. It can be either positive or negative. Standard world time zones — Illustration by Hellerick from Wikimedia Commons Global time is called UTC, it stands for Coordinated Universal Time. You may also heard about GMT which is a time zone without any offset. For instance, when it’s 10:50 at UTC, it’s also 03:50 in San Francisco with a -0700 offset and 18:50 in Beijing with a +0800 offset. Yet, the shift isn’t only in whole hours: Nepal's offset is +0545. You can check it out on Wikipedia. In addition of this offset, which comes with the time zone, some countries also shift clocks twice a year. DST or summer time adds one hour to the time zone offset before summer. Then, the clock is reset to the time zone time in winter. The goal is to make the daytime longer. The most common way to figure out a time zone is by using the IANA Time Zone Database. You end up with a string such as Europe/Paris following the Area/City pattern. Besides, Microsoft maintains its own Microsoft Time Zone Database used on its operating systems. But this can cause issues when running cross-platform .NET Core apps. IANA is still the go-to. The Microsoft database isn't updated often, it contains less history, fairly curious time zone names (eg: Romantic Standard Time) and is error prone. For example, try to not mix up Arab , Arabic and Arabian Standard Time. For more details on each database and their differences, check out this article. One last thing: there are plenty of ways to write a date. Fortunately, the ISO 8601 specification sets a common rule for date formatting. November 11, 2018 at 12:51:43 AM (in a time zone at UTC+00:00) 2018-11-05T12:51:43Z
http://damianfallon.blogspot.com/2020/04/how-to-handle-timezones-and-synchronize_63.html
0 notes
Text
Original Post from Amazon Security Author: Sepehr Samiei
AWS Secrets Manager now has a client-side caching library for.NET that makes it easier to access secrets from .NET applications. This is in addition to client-side caching libraries for Java, JDBC, Python, and Go. These libraries help you improve availability, reduce latency, and reduce the cost of retrieving your secrets. Secrets Manager cache library does this by serving secrets out of a local cache and eliminating frequent Secrets Manager API calls.
AWS Secrets Manager enables you to automatically rotate, manage, and retrieve secrets throughout their lifecycle. Users and applications can access secrets through a call to Secrets Manager APIs, eliminating the need to hardcode sensitive information in plain text. It offers secret rotation with built-in integration for AWS services such as Amazon Relational Database Service (Amazon RDS) and Amazon Redshift, and it’s also extensible to other types of secrets. Secrets Manager enables you to control access to secrets using fine-grained permissions, and all actions on secrets, including retrievals, are traceable and auditable through AWS CloudTrail.
AWS Secrets Manager client-side caching for .NET extends benefits of the AWS Secrets Manager to wider use cases in .NET applications. These extra benefits are now available without having to spend precious time and effort on developing your own caching solution.
In this post, I’ll discuss the following topics:
The benefits offered by Secrets Manager client-side caching library for .NET
How Secrets Manager client-side caching library for .NET works
How to use Secrets Manager client-side library in .NET applications
How to extend Secrets Manager client-side library with your own custom logic
The benefits offered by Secrets Manager client-side caching library for .NET
Client-side caching is benefitial in following ways:
Availability: Network links sometimes suffer slowdowns or intermittent breaks. Client-side caching can significantly improve availability by eliminating a large number of API calls.
Latency: Retrieving secrets through API calls includes the network latency. Retrieving secrets from the local cache eliminates that latency and, therefore, improves performance.
Cost: Each API call to a Secrets Manager endpoint encounters a small charge. Using a local cache saves costs associated with API calls.
Using a client-side cache is a best practice; however, in the same way that you don’t want to reinvent the wheel everytime you need one, crafting your own client-side caching solution is suboptimal. The Secrets Manager client-side caching library relieves you from writing your own client-side caching solution while still giving you its benefits. Furthermore, it includes best practices such as:
Automatically refreshing cached secrets: the library periodically updates secrets to ensure your application gets the most recent version of a secret. You can control and change refresh intervals using configuration properties.
Integration with your applications: To use this library, just add the dependency to your .NET project and provide the identifier to the secret you want to access in your code.
How Secrets Manager client-side caching library for .NET works
The library is implemented in .NET Standard. This means you can reuse the same library in projects of all flavors of .NET, including .NET Framework, .NET Core, and Xamarin.
Note: Because the AWS Secrets Manager client-side caching library depends on Microsoft.Extensions.caching.memory, make sure you add it to your project dependencies.
As an extension to Secrets Manager .NET SDK, the cache library provides you an alternative to direct invocation of Secrets Manager API methods. You invoke cache library methods, and if the value doesn’t exist in the cache, the cache library invokes Secrets Manager methods on your behalf.
The default refresh interval for “current” version of secrets (the latest value stored in Secrets Manager for that secret) is 1 hour. This is because latest version may change from time to time. The library allows you to configure this frequency to higher or lower per your specific application requirements.
If you request a specific version of a secret by specifying both secret ID and secret version parameters, by default the library sets refresh interval to 48 hours. Since each version of a secret is immutable, there is no need to refresh them frequently.
You can also enable “Last known good value caching” to provide some protection in cases of transient network issues or service outages. If this is enabled, the cache will keep track of the last known good secret value, and in the event of an error occurring while refreshing a secret value from the service, the cache will return the last known good value. This feature is disabled by default, and can be enabled by setting the EnableLastKnownGoodValueCaching property of SecretsManagerCacheOptions class to true. You can pass your instance of SecretsManagerCacheOptions to SecretsManagerCache constructor.
The cache library provides a thread-safe implementation for both cache-check as well as entry populations. Therefore, simultaneous requests for a secret that is not available in the cache will result in a single API request to SecretsManager.
How to use Secrets Manager client-side caching library in .NET applications
You can add Secrets Manager client-side caching library to your projects either directly or through dependency injection. The dependency package is also available through NuGet. In this example, I use NuGet to add the library to my project. Open the NuGet Package Manager console and browse for AWSSDK.SecretsManager.Caching. Select the library and install it.
Figure 1: Select the AWSSDK.SecretsManager.Caching library
Before using the cache, you need to have at least one secret stored in your account using AWS Secrets Manager. To create a test secret:
Go to the AWS Console, and then select AWS Secrets Manager.
Select Store a new secret.
For secret type, select Other type of secret, and then add three key/value pairs as shown here:
{ "Domain": "", "UserName": "", "Password": "" }
Next, create a cache object, and then invoke its methods with appropriate parameters. Below is a code snippet using AWS Secrets Manager client-side cache library to access our secret. Notice this snippet assumes you’ve added Newtonsoft.Json library to your project:
public MyClass : IDisposable { private readonly IAmazonSecretsManager secretsManager; private readonly ISecretsManagerCache cache; public MyClass() { this.secretsManager = new AmazonSecretsManagerClient(); this.cache = new SecretsManagerCache(this.secretsManager); } public void Dispose() { this.secretsManager.Dispose(); this.cache.Dispose(); } public async Task GetNetworkCredential(string secretId) { var sec = await this.cache.GetSecretAsync(secretId); var jo = Newtonsoft.Json.Linq.JObject.Parse(sec.SecretString); return new NetworkCredential( domain: jo["Domain"].ToObject<string>(), userName: jo["Username"].ToObject<string>(), password: jojo["Password"].ToObject<string>()); } }
For ASP.NET projects, you can use the library with dependency-injection. To do this, you first have to register Secrets Manager caching to the dependency injection service collection in the Startup class of your ASP.NET project:
public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddSecretsManagerCaching(); } }
Then, you’ll be able to consume the cache using constructor injection in your classes.
public MyClass : IDisposable { private readonly ISecretsManagerCache cache; public MyClass(ISecretsManagerCache cache) { this.cache = cache; } public async Task GetNetworkCredential(string secretId) { var sec = await this.cache.GetSecretAsync(secretId); var jo = Newtonsoft.Json.Linq.JObject.Parse(sec.SecretString); return new NetworkCredential( domain: jo["Domain"].ToObject<string>(), userName: jo["Username"].ToObject<string>(), password: jojo["Password"].ToObject<string>()); } }
How to add in-memory encryption and other custom extensions
The Secrets Manager caching library is designed to be extendable with your own custom logic. One possibility is to extend its implementation to include in-memory encryption of cached secrets to add another layer of protection on your retrieved secrets. For this purpose, you have to manually implement two of the interfaces included in the library. The library includes SecretCacheEntry class, implementing the interface ISecretCacheEntry. This is the object that stores secrets in memory. You could create another class implementing the same ISecretCacheEntry interface to add in-memory encryption/decryption.
public class EncryptedSecretCacheEntry : ISecretCacheEntry { public EncryptedSecretCacheEntry(GetSecretValueResponse response, TimeSpan expiry) { this.VersionId = response.VersionId; this.LastRetreived = DateTime.UtcNow; this.Name = response.Name; this.Expires = this.LastRetreived.Add(expiry); if (response.SecretBinary != null && response.SecretBinary.Length > 0) { using (var ms = response.SecretBinary) { this.SecretBinary = ms.ToArray(); } } else { this.SecretString = response.SecretString; } } private byte[] _EncryptedSecretString; public string SecretString { get { return MyCustomCipherService.DecryptString(_EncryptedSecretString); } set { _EncryptedSecretString = MyCustomCipherService.EncryptString(value); } } private byte[] _EncryptedSecretBinary; public byte[] SecretBinary { get { return MyCustomCipherService.Decrypt(_EncryptedSecretBinary); } set { _EncryptedSecretBinary = MyCustomCipherService.Encrypt(value); } } public string VersionId { get; private set; } public string Name { get; private set; } public string LocalId => $"{this.Name}:{this.VersionId}"; public DateTime LastRetreived { get; private set; } public DateTime Expires { get; private set; } }
The second step is to implement the ISecretCacheEntryFactory class:
public class EncryptedSecretCacheEntryFactory : ISecretCacheEntryFactory { public ISecretCacheEntry CreateEntry(GetSecretValueResponse response, TimeSpan expiry) { return new EncryptedSecretCacheEntry(response, expiry); } }
Having these two classes, I can now modify the constructor of my SecretsUserClass to add my custom encryption logic to Secrets Manager cache library:
public SecretsUserClass() { this.secretsManager = new AmazonSecretsManagerClient(); this.cache = new SecretsManagerCache(this.secretsManager, new EncryptedSecretCacheEntryFactory(), new SecretsManagerCacheOptions(), null); }
You could even go further and fully customize the cache by implementing ISecretsManagerCache or implementing a child class that inherits functionality of SecretsManagerCache and adds new methods to it.
Conclusion
It’s critical for enterprises to protect secrets from unauthorized access and adhere to various industry or legislative compliance requirements. Mitigating the risk of compromise often involves complex techniques, significant effort, and costs, such as applying encryption, managing vaults and HSM modules, rotating secrets, audit access, and so on. Because the level of effort is high, many developers tend to use the much simpler, but substantially riskier, alternative of hard-coding secrets in application code, or simply storing secrets in plain-text format. These practices are problematic from the security and compliance point of view, but they need to be understood as symptoms of the more fundamental problem of complexity in the systems enterprises have built. To address the problem of weak security and compliance practices, you have to address the problem of complexity. Complex systems can be simplified and made more secure when they are reusable, accessible, and are automated, needing no human interaction.
In this post, I’ve shown how you can improve availability, reduce latency, and reduce the cost of using your secrets by using the Secrets Manager client-side caching library for .NET. I also showed how to extend it by implementing your own custom logic for more advanced use-cases, such as in-memory encryption of secrets.
To get started managing secrets, open the Secrets Manager console. To learn more, read How to Store, Distribute, and Rotate Credentials Securely with Secret Manager or refer to the Secrets Manager documentation. See AWS Region Table for the list of AWS regions where Secrets Manager is available.
If you have feedback about this blog post, submit comments in the Comments section below. If you have questions about this blog post, start a new thread in the Secrets Manager forum.
Want more AWS Security how-to content, news, and feature announcements? Follow us on Twitter.
Sepehr Samiei
Sepehr is currently a Senior Solutions Architect at AWS. He started his professional career as a .Net developer, which continued for more than 10 years. Early on, he quickly became a fan of cloud computing and loves to help customers utilise the power of Microsoft tech on AWS. His wife and daughter are the most precious parts of his life, and he and his wife expect to have a son soon!
#gallery-0-5 { margin: auto; } #gallery-0-5 .gallery-item { float: left; margin-top: 10px; text-align: center; width: 33%; } #gallery-0-5 img { border: 2px solid #cfcfcf; } #gallery-0-5 .gallery-caption { margin-left: 0; } /* see gallery_shortcode() in wp-includes/media.php */
Go to Source Author: Sepehr Samiei How to use AWS Secrets Manager client-side caching in .NET Original Post from Amazon Security Author: Sepehr Samiei AWS Secrets Manager now has a client-side caching library for.NET…
0 notes
Text
How to use java.time.LocalDateTime in your JAXB Bindings
I recently had a issue with some code that was using java 1.7 and I moved it over to java 1.8. Basically the issue was that the code was still binding the dateTime element to java “Calendar” class. Java 1.8 introduced java.time.* classes which I used to write POJO code interfacing with the JAXB classes.
What I like about the java.time.* classes is that they conform with ISO-8601 formats, a requirement I added to a current project I am working on.
So I had to do two things
1. Create a custom adapter for java.time.<time_implementation> 2. Update my global.xjb to create the binding to the xml element
Here is my custom adapter, debug statements were for me to verify everything was working properly in the system:
package com.jaysfables.xmlutils;
import java.time.LocalDateTime; import java.time.format.DateTimeFormatter;
import javax.xml.bind.annotation.adapters.XmlAdapter;
@SuppressWarnings({ "rawtypes", "restriction" }) public class LocalDateTimeAdapter extends XmlAdapter{
@Override public LocalDateTime unmarshal(Object v) throws Exception { System.out.println("DEBUG: unmarshal localdatetime: " + (String) v);
return LocalDateTime.parse((String) v); }
@Override public Object marshal(Object v) throws Exception { System.out.println("DEBUG: marshal localdatetime: " + ((LocalDateTime)v).toString());
if (v != null) { return ((LocalDateTime)v).toString(); } else { return null; } } }
Next was to update the global.xjb file to point to the custom adapter:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <jaxb:bindings version="2.0" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:extensionBindingPrefixes="xjc">
<jaxb:globalBindings> <xjc:simple /> <xjc:serializable uid="-1" /> <xjc:javaType adapter="com.jaysfables.xmlutils.LocalDateTimeAdapter" name="java.time.LocalDateTime" xmlType="xs:dateTime" />
</jaxb:globalBindings> </jaxb:bindings>
did a maven rebuild and everything worked flawlessly.
0 notes
Link
Introduction
There is a maxim that comes from the world of Python programming: “There should be one – and preferably only one – obvious way to do it.” (See The Zen of Python) in the references. While that is a good goal for any language, it is a difficult goal to achieve. T-SQL is no exception here!
Consider a simple problem: You have a customer transaction table with dated rows. You are asked to produce a list of the top transactions per day. “Top” could be defined as the one with the most items, the highest value, the most important customer or a variety of other criteria. However, you define it, at some point, you will want the maximum (or minimum) value of one of the columns. Then you will want to output the entire row (or rows, in the case of a tie) matching that value. Sounds simple, right? Well, it actually is simple, but the number of ways to do it may surprise you!
This article will look at the various ways to construct such a query and analyze each one for its performance characteristics. The goal is not so much about picking a winner as it is to learn how to analyze queries using a tool like ApexSQL Plan.
The transaction table
Let’s consider a simple transaction table. In all likelihood yours will be more complicated than this one, but it will suffice for the examples and analysis that follows.
CREATE TABLE [dbo].[Transactions] ( [TransactionID] [bigint] IDENTITY(1, 1) NOT NULL ,[CustomerID] [bigint] NOT NULL ,[Transactiontype] [tinyint] NOT NULL ,[TransactionTime] [datetime] NOT NULL ,[TransactionAmount] [money] NOT NULL ) ON [PRIMARY] CREATE CLUSTERED INDEX [IX_Transactions_TransactionID] ON [dbo].[Transactions] ([TransactionID] ASC)
I’ll use ApexSQL Generate to populate this table with 100,000 rows, choosing random values except for the identity column, which is assigned by SQL Server.
The problem
For this exercise, let’s assume that the problem is stated like this:
“For each day, select the row containing the greatest value in the TransactionAmount column. Now that means that we need to find the greatest amount for each day and use that to get to the rest of the columns. Selecting the greatest amount for each day is a simple query with GROUP BY:
SELECT CAST(t.TransactionTime AS DATE) AS DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount GROUP BY CAST(t.TransactionTime AS DATE) ORDER BY CAST(t.TransactionTime AS DATE);
This [Grab your reader’s attention with a great quote from the document or use this space to emphasize a key point. To place this text box anywhere on the page, just drag it.] works just fine, but I’m troubled by something. Three times in this query we have the expression:
CAST(t.TransactionTime AS DATE)
The way this is written, I need the expression in at least two places, the SELECT statement and the HAVING clause. I could change the ORDER BY to use the column alias DateOfTransaction, since column aliases are available after the SELECT portion of a query, but I’d really like to get rid of the repetition altogether. I can use CROSS APPLY for that:
SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) GROUP BY dt.DateOfTransaction ORDER BY dt.DateOfTransaction;
Now, I bet you’re wondering how this change affects the performance of the query. To answer briefly, not at all! To prove it, let’s fire up ApexSQL Plan.
If we just look at the estimated plan for each query, we can see that they are the same:
The CROSS APPLY version is a little longer to type but eases maintenance since the original column name is now referenced only once. The query is DRY-er.
“Well,” you say, “an estimated plan is all well and good, but what happens when you run it?” Good question! Let’s do that!
The I/O reads are identical, so I only pasted one copy. If you dig into the execution plan XML you won’t see any effect of the CROSS APPLY either, other than in the StatementText attribute. Since the CROSS APPLY only references columns in the current row in the input buffer, it has no effect other than making the query easier to read. Note that if the CROSS APPLY referenced another table, this would not be the case; it would function like a JOIN and the execution plan, CPU usage and I/O counts would reflect that.
First attempt: use a cursor
Many developers coming from a non-declarative language such as Java or C or Python might think in terms of writing a loop. In T-SQL, that would be a cursor. We can use the query above in just such a loop to produce the desired results:
-- Get maximum amount by day DECLARE MaxAmtCur CURSOR LOCAL FORWARD_ONLY FAST_FORWARD READ_ONLY FOR SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) GROUP BY dt.DateOfTransaction ORDER BY dt.DateOfTransaction; OPEN MaxAmtCur -- Create a table variable to hold the results DECLARE @DateOfTransaction DATE ,@MaxTransactionAmount MONEY DECLARE @Results TABLE ( [TransactionID] [BIGINT] ,[CustomerID] [BIGINT] NOT NULL ,[TransactionType] [TINYINT] NOT NULL ,[TransactionTime] [DATETIME] NOT NULL ,[TransactionAmount] [MONEY] NOT NULL ); -- Loop through the maximum amounts to find matching transactions WHILE 1 = 1 BEGIN FETCH NEXT FROM MaxAmtCur INTO @DateOfTransaction ,@MaxTransactionAmount; IF @@FETCH_STATUS <> 0 BREAK; -- Insert matching rows into the results table INSERT INTO @Results ( TransactionID ,CustomerID ,TransactionType ,TransactionTime ,TransactionAmount ) SELECT t.* FROM dbo.Transactions t WHERE CAST(t.TransactionTime AS DATE) = @DateOfTransaction AND t.TransactionAmount = @MaxTransactionAmount; END;
This script inserts the results in to a table variable. This lets me focus on the query and ignore the intermediate results. As for this one, well it certainly works but I didn’t have the patience to wait for it to complete. Here’s why: After the initial query to find the maximum amounts by day, the loop inserts one row at a time (RBAR = Row By Agonizing Row – an acronym created by Jeff Moden, long-time SQL Server MVP.) Now, the table of maximum values by day has over 2100 rows. How does the INSERT perform inside the loop? The plan diagram will show us!
It does a clustered index scan! Recall that there are 100,000 rows in the transactions table. That means 2100 iterations * 100000 rows to read all the rows to complete the job. I’ll let you do the math. The result is not pretty.
There is an ABC lesson here: Anything But Cursors! If you can do it any other way, it will perform better than a cursor-based approach. Keep in mind that a relational database is based on relational algebra, which combines set theory with predicate calculus. Think in sets, not rows!
Second attempt: Use an inner join
Here is a join-based query:
SELECT TransactionID ,CustomerID ,TransactionType ,TransactionTime ,TransactionAmount FROM dbo.Transactions t INNER JOIN ( SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) GROUP BY dt.DateOfTransaction ) t1 ON CAST(t.TransactionTime AS DATE) = t1.DateOfTransaction AND t.TransactionAmount = t1.MaxTransactionAmount ORDER BY t1.DateOfTransaction
This is an enormous improvement! According to ApexSQL Plan, the query above runs in
The execution plan is a little complicated though:
And has two clustered index scans of the transactions table. What about the I/Os?
Quite respectable, really!
Alternatives to inner join
There are a few different alternatives to using an inner join. Perhaps you wondered if I could use CROSS APPLY? Indeed:
SELECT TransactionID ,CustomerID ,TransactionType ,TransactionTime ,TransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) CROSS APPLY ( SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) GROUP BY dt.DateOfTransaction ) t1 WHERE CAST(t.TransactionTime AS DATE) = t1.DateOfTransaction AND t.TransactionAmount = t1.MaxTransactionAmount ORDER BY t1.DateOfTransaction;
This query produces the same plan and statistics as the INNER JOIN variant, so I won’t waste space here showing it. Changing the join operation to a CROSS APPLY (and the ON clause to a WHERE Clause) changes nothing on the inside. Note that in this case, the second CROSS APPLY performs the aggregating sub query and is not an intra-row operation as is the first one.
A more interesting alternative would be this:
WITH MaxAmts ( TransactionDate ,TransactionAmount ) AS ( SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) GROUP BY dt.DateOfTransaction ) SELECT t.TransactionID ,t.CustomerID ,t.TransactionType ,t.TransactionTime ,t.TransactionAmount FROM dbo.Transactions t WHERE EXISTS ( SELECT 1 FROM MaxAmts m WHERE m.TransactionDate = CAST(t.TransactionTime AS DATE) AND m.TransactionAmount = t.TransactionAmount )
The Common Table Expression (CTE) used in this example doesn’t change the plan. Recall that, except for the recursive variety, a CTE is just a way to write a sub query before the main query instead of after it. Used in this way, CTEs can make for more readable code. If you thought the correlated sub query in the WHERE EXISTS clause would change the plan, you’d be mistaken! The plan and performance characteristics are identical to the previous two queries. So, which one do I prefer to use? In general, when given a choice, I like queries that are easy to read. While I admit that that is subjective, for me it generally means opting for fewer subqueries and shallower levels of parentheses and indentation. With that in mind, I like this, hybrid version best:
WITH MaxAmts ( TransactionDate ,TransactionAmount ) AS ( SELECT dt.DateOfTransaction ,MAX(TransactionAmount) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(TransactionDate) GROUP BY dt.TransactionAmount ) SELECT t.TransactionID ,t.CustomerID ,t.TransactionType ,t.TransactionTime ,t.TransactionAmount FROM dbo.Transactions t INNER JOIN MaxAmts m ON CAST(t.TransactionTime AS DATE) = m.TransactionDate AND t.TransactionAmount = m.TransactionAmount ORDER BY m.TransactionDate
This has the same execution plan and run characteristics as the first three and is – from my perspective at least – the easiest one to read.
There is one other thing these three variants have in common: All report a missing index.
I’ll come back to the problem of the missing index a bit later. For now, let’s continue with a different approach:
Third attempt: using window functions
Starting with SQL Server 2005, Microsoft began introducing window functions. These are not Microsoft’s invention but rather their implementation of the ANSI/ISO Standard SQL:2003 which was later extended in ANSI/ISO Standard SQL:2008
Since we want to find the maximum/minimum value of some column, the MAX() OVER() and MIN() OVER() functions come to mind. Let’s start there!
SELECT t.TransactionID ,t.CustomerID ,t.TransactionType ,t.TransactionTime ,t.TransactionAmount FROM ( SELECT * ,MAX(TransactionAmount) OVER (PARTITION BY dt.DateOfTransaction) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) ) t WHERE t.TransactionAmount = t.MaxTransactionAmount ORDER BY t.TransactionTime;
This query produces a complicated plan:
With two nested loop joins and three table spools! The I/O counts reflect this:
Just look at those worktable reads! I think we can discard this version out of hand.
Using FIRST_VALUE
The FIRST_VALUE() window function takes the first value from each partition based on some ordering. For the working example, this should do the trick:
SELECT t.TransactionID ,t.CustomerID ,t.TransactionType ,t.TransactionTime ,t.TransactionAmount FROM ( SELECT * ,FIRST_VALUE(TransactionAmount) OVER ( PARTITION BY dt.DateOfTransaction ORDER BY TransactionAmount DESC ) AS MaxTransactionAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) ) t WHERE t.TransactionAmount = t.MaxTransactionAmount ORDER BY t.TransactionTime;
How does this one compare? Here’s the execution plan, split onto two lines for readability:
This plan is a straight line. There are no joins of any type. What about the I/Os? (Hint: There is a Window Spool operator in there.)
Even worse! Rule that one out, too.
Using RANK
The RANK() function seems like a possible good fit here. The query would look like this:
SELECT t.TransactionID ,t.CustomerID ,t.TransactionType ,t.TransactionTime ,t.TransactionAmount FROM ( SELECT * ,-- OK, I'm lazy! Don't use SELECT * in production code! RANK() OVER ( PARTITION BY dt.DateOfTransaction ORDER BY TransactionAmount DESC ) AS RankAmount FROM dbo.Transactions t CROSS APPLY ( SELECT CAST(t.TransactionTime AS DATE) ) dt(DateOfTransaction) ) t WHERE t.RankAmount = 1 ORDER BY t.TransactionTime;
This query yields the execution plan:
This plan is also a straight line and the spool operations are gone. The I/O picture looks like this:
No worktable I/O and a linear execution plan! This is half the number of I/Os of my preferred JOIN-based query. We have a winner!
To me, one interesting thing is that the windowing queries using MAX() and FIRST_VALUE() have such different characteristics. When you think about the problem I’m solving, they are just alternate ways of stating the solution. Seeing this means that you should always look at a few variants before deciding on the query to use. Using MAX() here seems the closest to the problem statement but if performance matters, you may want to use RANK() instead.
Note that I said, “if performance matters”. Well, doesn’t it always matter? Sometimes, not as much as you might think. If the result sets are on the small side (for various values of “small”) and the query is infrequently used (that is, not hundreds of times a second), I would use MAX() since it produces readable code that reproduces the problem statement in SQL.
What about that index?
ApexSQL Plan told me there is a missing index. What happens if I actually implement it? ApexSQL Plan will show you the suggested index if you right click on the missing index message:
Using the highlighted Copy button, I can copy this to another session (or SSMS) and actually create the index. How does this change things? My favorite JOIN-based query, above, now has a new plan:
Notice that it now reads from the new index (highlighted) to get the maximum amount values per day. Then it joins back to the same index to get the other columns.
The I/O reads though, actually went up, from 1748 to 3924. For this particular query, the index did not help. Also, I wonder if a new, covering index is really the right idea? It has to be maintained, after all and it contains the same data as the clustered index. At the very least, this means that you should not accept the missing indexes at face value. Take time to consider the consequences.
How about the query using RANK()? No difference! It did not even use the new index and really, it doesn’t need it. SQL has to read every row in the table any way, to compute the maximum transaction amount per day.
Summary
Given a simple problem, I’ve shown several approaches to solving that it in SQL. The JOIN-based solutions perform respectably, but are completely blown away by the RANK-based window function query. However, that doesn’t mean that all your queries for similar problems should use RANK. It means that you do need to consider alternatives and test them. There is no one-size-fits-all solution. Take the time to look at the execution plans of various queries before deciding on one. Using ApexSQL Plan I was able to try many variants and compare their results, both with and without the reported missing index. This makes ApexSQL Plan a great tool for every SQL developer!
References
The Zen of Python
DRY: Don’t Repeat Yourself
Using the APPLY operator
Window functions in SQL Server
See also
SQL query performance tuning with I/O statistics and execution plans
How to identify and solve SQL Server index scan problems
T-SQL commands performance comparison – NOT IN vs NOT EXISTS vs LEFT JOIN vs EXCEPT
The post How to analyze query performance characteristics in SQL Server appeared first on Solution center.
0 notes
Text
JAVA Applications and Benefits:
Java is an abnormal state programming language and a recording stage created by Sun Microsystems in 1995. From then on, the dialect was frequently updated with the Java SE 8.0 format being the most recent adaptation downloaded in March 2014
In light of the advantages of Java, increased awareness has increased and different configurations have been used to handle different types of steps, including Java SE for Macintosh, Windows and UNIX, Java ME for mobile applications and Java EE for Enterprise Application
With the development of the meaning of applications based on electronic and portable devices, Java is today the framework for most organized applications and is considered valuable for scripts, online products, enterprise programming, leisure and versatile applications.
Experience in the field:
• Spatial information that increases the value of the development of the profession is essential. There are a number of areas, such as HealthCare, Telecom and, increasingly, require special attention to space.
• There are several Java Training courses in Bangalore so you can study further in this angle. Anyway, only a few sites offer the best preparation.
Java Applications:
Every company uses Java in one way or another. According to Oracle, more than 3 billion gadgets are running composite applications at the improvement stage. Its good way to learn java in java training in Bangalore.
Java is used to plan the following applications:
• Office GUI Applications
• Integrated systems
• Web applications, including e-commerce applications, front and back e-commerce systems, settlement and confirmation systems, data processing projects and more.
• Web servers and application servers
• Mobile applications, including Android applications
• Business applications
• Scientific applications
• Middleware products
Why learn java?
There is no conclusion for the reasons why you should choose an outstanding contrast with other Java Training in Bangalore
• You can make an irresistible salary. There is no shortage of job openings in this area.
Advantages of Java:
• Java offers greater transmission and transmission capacity, since projects written in one step can run on desktops, mobile phones, and installed structures.
• Java is free, direct, organized, appropriate, supports multithreading, and provides multimedia and system support.
• Unlike C and C ++, Java programs are organized autonomously from the bytecode dialect stage that allows a similar program to continue running on any machine with a JVM.
• Java has robust enhancement tools such as Eclipse SDK and NetBeans, which have search capabilities and offer built-in progress conditions.
• Increase the variety of the decent dialect, confirm by the similarity of Java with Scala, Groovy, JRuby and Clojure.
• A relatively constant similarity in front, starting with one form and then the next. Overall, as early as 20 years after its creation, Java continues to give an important incentive to the universe of innovative programming
• Java 8, the truth is told, offers new highlights, for example, a versatile and adaptable scenario for Internet of Things, less standard code, new library and datetime API, toolkit for relaunched projects, coordination with JavaScript and d 'other.
The best place to learn:
• There is a separate open Java training, as shown in the current illustration. Enter, the most perfect state of Java training in Bangalore to shine in your business.
�?�"
0 notes
Text
How to get current date time (today's date) in Java
How to get current date time (today’s date) in Java
In this article, we will discuss how to get current date and time using the legacy Date and Calendar apis alongwith the Java 8 LocalDate, LocalTime, LocalDateTime and ZonedDateTime apis. Current date using java.util.Date instance Date d1 = new Date(); System.out.println(d1); // Tue Mar 06 22:50:37 EST 2018 If you are looking to format the current date in a specific format, use the…
View On WordPress
#current date time in java#current date using calendar#current date using localdate#current date using localdatetime#current datetime in java#current time in java#How to get Current Date and Time in Java with Example#java current date#java current date example#java current date time#java current date Using java.util.Date instance#java now#java today#java today&039;s date
0 notes
Quote
When you develop some software you may not think about timezones at first. Unless you live in a country which has to deal with multiple time zones, such as the United States or Russia. I recently came across an issue involving timezones. There were some unit tests making assertions about dates that used to work at my office in France but weren't working in Morocco for new members on our team. Here is the unit test working in France but not in Morocco This was an opportunity for me to learn how to correctly handle dates and times for international software. In this article, I’ll introduce time zone issues and share some rules to follow. Quick introduction to time zones As the earth is kind of a sphere, the sun is rising in Japan while it's setting in America. If everyone used global time, let’s say 09:00 would be sunrise in Japan, but for Americans it would be sunset. Not very handy. To make sure the time is coordinated with the sun for everyone, it’s necessary to shift from global time according to your location. As a result, the globe gets split into time zones and each gets an offset. This offset is a number of minutes to add to the global time to get your time zone time. It can be either positive or negative. Standard world time zones — Illustration by Hellerick from Wikimedia Commons Global time is called UTC, it stands for Coordinated Universal Time. You may also heard about GMT which is a time zone without any offset. For instance, when it’s 10:50 at UTC, it’s also 03:50 in San Francisco with a -0700 offset and 18:50 in Beijing with a +0800 offset. Yet, the shift isn’t only in whole hours: Nepal's offset is +0545. You can check it out on Wikipedia. In addition of this offset, which comes with the time zone, some countries also shift clocks twice a year. DST or summer time adds one hour to the time zone offset before summer. Then, the clock is reset to the time zone time in winter. The goal is to make the daytime longer. The most common way to figure out a time zone is by using the IANA Time Zone Database. You end up with a string such as Europe/Paris following the Area/City pattern. Besides, Microsoft maintains its own Microsoft Time Zone Database used on its operating systems. But this can cause issues when running cross-platform .NET Core apps. IANA is still the go-to. The Microsoft database isn't updated often, it contains less history, fairly curious time zone names (eg: Romantic Standard Time) and is error prone. For example, try to not mix up Arab , Arabic and Arabian Standard Time. For more details on each database and their differences, check out this article. One last thing: there are plenty of ways to write a date. Fortunately, the ISO 8601 specification sets a common rule for date formatting. November 11, 2018 at 12:51:43 AM (in a time zone at UTC+00:00) 2018-11-05T12:51:43Z
http://damianfallon.blogspot.com/2020/04/how-to-handle-timezones-and-synchronize_7.html
0 notes
Quote
When you develop some software you may not think about timezones at first. Unless you live in a country which has to deal with multiple time zones, such as the United States or Russia. I recently came across an issue involving timezones. There were some unit tests making assertions about dates that used to work at my office in France but weren't working in Morocco for new members on our team. Here is the unit test working in France but not in Morocco This was an opportunity for me to learn how to correctly handle dates and times for international software. In this article, I’ll introduce time zone issues and share some rules to follow. Quick introduction to time zones As the earth is kind of a sphere, the sun is rising in Japan while it's setting in America. If everyone used global time, let’s say 09:00 would be sunrise in Japan, but for Americans it would be sunset. Not very handy. To make sure the time is coordinated with the sun for everyone, it’s necessary to shift from global time according to your location. As a result, the globe gets split into time zones and each gets an offset. This offset is a number of minutes to add to the global time to get your time zone time. It can be either positive or negative. Standard world time zones — Illustration by Hellerick from Wikimedia Commons Global time is called UTC, it stands for Coordinated Universal Time. You may also heard about GMT which is a time zone without any offset. For instance, when it’s 10:50 at UTC, it’s also 03:50 in San Francisco with a -0700 offset and 18:50 in Beijing with a +0800 offset. Yet, the shift isn’t only in whole hours: Nepal's offset is +0545. You can check it out on Wikipedia. In addition of this offset, which comes with the time zone, some countries also shift clocks twice a year. DST or summer time adds one hour to the time zone offset before summer. Then, the clock is reset to the time zone time in winter. The goal is to make the daytime longer. The most common way to figure out a time zone is by using the IANA Time Zone Database. You end up with a string such as Europe/Paris following the Area/City pattern. Besides, Microsoft maintains its own Microsoft Time Zone Database used on its operating systems. But this can cause issues when running cross-platform .NET Core apps. IANA is still the go-to. The Microsoft database isn't updated often, it contains less history, fairly curious time zone names (eg: Romantic Standard Time) and is error prone. For example, try to not mix up Arab , Arabic and Arabian Standard Time. For more details on each database and their differences, check out this article. One last thing: there are plenty of ways to write a date. Fortunately, the ISO 8601 specification sets a common rule for date formatting. November 11, 2018 at 12:51:43 AM (in a time zone at UTC+00:00) 2018-11-05T12:51:43Z
http://damianfallon.blogspot.com/2020/04/how-to-handle-timezones-and-synchronize.html
0 notes