teleren/devto huggingface dataset:
How to unmarshall xml string to java object with JAXB
Tags: java, xml, jaxb, codever
Published: 2022-08-29 12:30:00

Given the following `Superhero` class:

```java
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.Getter;
import lombok.Setter;

@XmlRootElement(name = "super-hero")
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
class SuperHero {
  @XmlElement(name = "name")
  String name;

  @XmlElement(name = "super-power")
  String superPower;
}
```

You can convert an XML String to a `SuperHero` instance with the following code:


```java
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.StringReader;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;

import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

@RunWith(JUnitPlatform.class)
class TestXmlStringToObjectUnmarshalling {

  static final String superHeroXml =
      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
          + "<super-hero>"
          + "  <name>Superman</name>"
          + "  <super-power>Flight</super-power>"
          + "</super-hero>";

  @Test
  void testXmlUnmarshalling() throws JAXBException {
    JAXBContext jaxbContext = JAXBContext.newInstance(SuperHero.class);
    Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

    StringReader reader = new StringReader(superHeroXml);
    SuperHero superHero = (SuperHero) unmarshaller.unmarshal(reader);

    assertEquals("Flight", superHero.getSuperPower());
  }
}

```

**Note**:
- create a `JAXBContext`  which includes the `SuperHero` class - `JAXBContext.newInstance(SuperHero.class)`
- create a JAXB `Unmarshaller` and apply the `unmarshal` method to a `StringReader` wrapping the text (it could be also a `FileReader` or any other `Reader` for that matter)



<hr/>

> Shared with :heart: from [Codever](https://www.codever.dev/snippets/620fb164e102f148ceba0188/details). Use :point_right: [**copy to mine**](https://www.codever.dev/snippets/620fb164e102f148ceba0188/details) functionality to add it to your personal snippets collection.
How to execute delete statements with jpa query
Tags: java, jpa, jpql, javascript
Published: 2022-08-29 12:24:00

Use the `executeUpdate` method of the `Query` interface. It will return the number of deleted entries:

```java
public int deleteOldMessages(int daysBack) {
  var query = em.createQuery("delete from Message m where createdAt < :givenTimestamp");
  query.setParameter(Message.GIVEN_TIMESTAMP, LocalDateTime.now().minusDays(daysBack));

  return query.executeUpdate();
}
```

<hr/>

> Shared with :heart: from [Codever](https://www.codever.dev/snippets/620f73f0390f044e75ba6ff9/details). Use :point_right: [**copy to mine**](https://www.codever.dev/snippets/620f73f0390f044e75ba6ff9/details) functionality to add it to your personal snippets collection.
10 Best CSS Animation Libraries For Designers and developer
Tags: html, tutorial, css, beginners
Published: 2022-08-29 12:11:29

---
title: 10 Best CSS Animation Libraries For Designers and developer
published: TRUE
description: There are many great CSS animation libraries available that can help you add impressive animations to your web projects. Many of these libraries are open source, so they're free to use. They're also easy to use, so you don't need to be a coding expert to get started. Some of the most popular CSS animation libraries include 
tags: #html #tutorial #css #beginners


# cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1c3bia9n1eaditvzxhb0.jpg

# Use a ratio of 100:42 for best results.
---
## 1. animate.style

 Animate.css is a library of ready-to-use, cross-browser animations for use in your web projects. Great for emphasis, home pages, sliders, and attention-guiding hints. 

![animate.style](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1pugsw2isldmyyqb9bxt.png)

## 2. tilomitra.github.io/infinite
Useful infinite CSS animations that you can drop into your project.

 ![Infinite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6a3skghupf26v6fy665f.png)

## 3. jonsuh.com/hamburgers
Tasty CSS-animated hamburgers
![jonsuh](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i1g6p0jk1q7y27rnidqn.png)

## 4. animxyz.com
AnimXYZ helps you create, customize, and compose animations for your website. Powered by CSS variables to allow a nearly limitless number of unique animations without writing a single keyframe. Save time and have complete control over how your elements move. Built for Vue, React, SCSS, and CSS, AnimXYZ will bring your website to life.
![animxyz](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qzlua50ftqbklmj7pbda.png)

## 5. animista.net
![animista.net](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgfjhg5bleuq763bh6kn.png)

## 6. animation.kaustubhmenon.com
![animation.kaustubhmenon](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ahw9imijwkqcn1qqnw1y.png)

 
## 7. github.com/oliver-gomes/csswand
Easy copy-paste beautiful CSS. That can be easily customized further at your own choice.

![oliver-gomes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j68wukxcqjjeub03wgb9.png)

## 8. github.com/yesiamrocks/cssanimation.io
In modern web concept, cssanimation.io is the best controlling animation library for CSS 
![cssanimation.io](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ssktkbs7h346vgmmq21b.png)
## 9. kristofferandreasen.github.io/wickedCSS
A library for CSS3 animations.

![kristofferandreasen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bq0lxhfvurx5v2rs7blx.png)

## 10. ianlunn.github.io/Hover
A collection of CSS3 powered hover effects to be applied to links,
 buttons, logos, SVG, featured images and so on

![ianlunn.github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2qyo10jlcvy0i7psego.png)
Visit my [Blog](https://gscode.in/) for more articles like this
Convert Epoch to Timestamps in Apache Flink with TO_TIMESTAMP_LTZ
Tags: apacheflink, timestamps, convert
Published: 2022-08-29 12:00:00

---
title: Convert Epoch to Timestamps in Apache Flink with TO_TIMESTAMP_LTZ
published: true
date: 2022-08-29 14:00:00 CEST
tags: ApacheFlink, timestamps, convert
canonical_url: https://ftisiot.net/posts/apache-flink-to-timestamp-ltz/
---

Sometimes when defining an Apache Flink® table using SQL we need to map an [epoch timestamp](https://en.wikipedia.org/wiki/Unix_time) and use it as record/message timestamp. 

Doing it properly is not complex, but some attention needs to be paid since small changes can have huge impact (ask me how I know... lost a good hour on it today).

## The ``TO_TIMESTAMP_LTZ`` function

When dealing with epoch timestamps, Flink offers the ``TO_TIMESTAMP_LTZ`` function, with a good set of [documentation](https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/timezone/) around it. Basically the function can be used with epoch timestamps in either seconds or milliseconds.

* For epoch timestamp in **seconds** use: ``TO_TIMESTAMP_LTZ(timestamp_column, 0)``
* For epoch timestamp in **milliseconds** use: ``TO_TIMESTAMP_LTZ(timestamp_column, 3)``

## What about the ``timestamp_column`` definition?

Ok, ok, that works! What about the definition of the ``timestamp_column``? You need to pay attention to it as well!

If the epoch timestamps in **seconds** you can have it working also by declaring the column as `INT`.
But if you do the same when dealing with epoch timestamps in **milliseconds** you'll face an error like 

```
Caused by: java.lang.NumberFormatException: For input string: "1661760207278"
```

This is because the number is greater than the `INT` range (`-2,147,483,648` to `2,147,483,647`). Therefore is better to have the column declared as `BIGINT`, like the following 

```
ts BIGINT,
name string,
ts_ltz AS TO_TIMESTAMP_LTZ(ts, 3),
WATERMARK FOR ts_ltz AS ts_ltz - INTERVAL '10' SECOND
```
Building a service for Redis Hackaton
Tags: redishackathon
Published: 2022-08-29 11:51:00

### Overview of My Submission
This project is a small service whose purpose is to provide stats about GitHub repositories. It pulls info about the commits and draw some conclusions. It's intended to be integrated in a micro-service architecture.
I didn't provide any UI since I knew about this hackaton lately.


### Submission Category: 
Wacky Wildcards

### Language Used
Python


### Link to Code

{% embed https://github.com/tobihans/gitlytics/ %}

* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._
Save yourself from frustration(The white Screen #cause1)
Tags: intermediate, react, webdev
Published: 2022-08-29 11:47:00

**React useState bugs series Part II**

The white-blank screen in React is a common scenario for many developers and it doesn't only come from the useState hook but rather many errors.

With useState it can also come from many scenarios but today we are going to talk about giving your initial state value a blue- print .

**What do I actually mean let's take an example of an application**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9oo6cmeukcpvjvjcugrk.png)

So basically that's a very simple app with the result on the right side and you can see that I initialez user in the state and in useState brackets I put nothing and if you can see if I try to access the user's name I get an error:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqbufaa6vo7iww0ourg0.png)

So this means when you initialize a value with useState and put nothing it is considered undefined and **JavaScript** tolerates many things but not _accessing a property of an undefined object_.

So let's make a small change and initialize the user as an empty object:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e3i0ohnlucvsb9cq33q.png)

You can certainly see that we still have a blank screen but no error let's add some text in the div
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ag61sts01lly10x4xbx.png)

You see it's a small fix and it would be better if you really gave a clear template.

Thanks save yourself from some bugs and frustration.

See you in the next one.
Print The Second Largest Element of The Array For Beginners logic....
Tags: web3, java, ds, productivity
Published: 2022-08-29 11:43:35

To print Second largest Element form an array you need to have basic understanding of the array data structure to learn more about array data structure you can refer this article 

To find second largest Element in an arrat follow below steps mentioned

**Step 1**   Store First largst Number and second largest number  in Integer.MIN_VALUE (_is a constant in the Integer class of java.lang package that specifies that stores the minimum possible value for any integer variable in Java. The actual value of this is -2^31 = -2147483648_ ) 

**for e.g** int FirstlargestNumber = Integer.MIN_VALUE;
            int SecondlargestNumber = Integer.MIN_VALUE;

**Step 2** Traverse through an array using for loop.
For e.g `for(int i = 0; i<a.length; i++)`

**Step 3** compare values in the array with FirstlargestNumber  using if statements

**For e.g :** `if(a[i] > FirstlargestNumber )
           FirstlargestNumber  = arr[i];`

**Step 4 :**  Now again run a loop for SecondlargestNumber 
for e.g: for(int i = 0; i<a.length; i++);

**Step 5:** And then comparing using if statement

**for eg :** ` if (a[i] > secondlargest && a[i] < firstlargest)
            {
                second_largest = a[i];
            }
        }
        System.out.print(second_largest );`



**Now read complete code below line by line to get clarify**

`class Test {
 public static void main(String args[]){
int firstlargestNumber  = Integer.MIN_VALUE;
int secondLargestNumber = Integer.MIN_VALUE;
for(int i = 0; i<a.length; i++) {
 if(a[i] > firstlargestNumber) {
  firstlargestNumber = a[i];
}
}
for(int i = 0; i<a.length; i++) {
 if(a[i] > secondLargestNumber  && a[i]< firstlargestNumber) {
  a[i] = secondLargestNumber;
}
}
 System.out.println(secondLargestNumber);
}
}
`
Lost to Found - Redis Hackathon
Tags: redishackathon, redis, nextjs, node
Published: 2022-08-29 11:41:00

### Overview of My Submission
Lost to found is a web app where users can search for lost or found items. Users also can submit items they have lost or found. Users can search for a lost/found item by category or full-text search. Users can provide images and geolocation in their submissions.
It is built using Next js (fronend), Node js (backend) and Redis Stack (database). 

![Lost to found - How it works](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abgmc63aj6n41jcnuikt.png)

### Submission Category: 
MEAN/MERN Mavericks
 - Redis Stack is used as primary database
 - Next js (React framework) is used for frontend
 - So it's RENN

### Language Used
JS/TS/Node.js

### Link to Code
More detail about how to run the full program is available on the project's GitHub repo below.
- Backend
{% embed https://github.com/sakshamgurung/lost-to-found-api %}
- Frontend
{% embed https://github.com/sakshamgurung/lost--to--found %}

### Additional Resources/Info
- Screenshot
![Adding New Submission](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcekshy6bcz31mea3jyf.png)

* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._
Introducing Ideao - A web portal of exploring ideas.
Tags: redishackathon
Published: 2022-08-29 11:38:00


### Overview of My Submission
Ideao is a web platform of exploring, sharing the creativeness in the form of idea. It allows to search the idea which helps you to make awesome things.

The idea behind this was to built a web portal which makes easy connection for idea seeker and idea provider. This project is built especially for the developer who are eagerly searching for ideas for hackathon or some other works.

This project is crafted using 
- ReactJs (For Frontend)
- Custom css (For styling)
- ViteJs (For Development tool)
- Redis Modules (Redis Om)
 - RedisJson (For database)
 - RedisSearch (For searching)

Apart from that, I was just roaming around the internet and saw the announcement of Redis Hackathon Organized by dev.to. I was so excited to participate on it but my excitement went down when I can't think of awesome idea which can won the case prize (Just kidding🤣).Thinking of idea wasted my 2 3 days. But after the huge brainstorming I converted my problem into my idea called as [Ideao](https://ideao.netlify.app/).         


### Submission Category: 
This project is built upon on MEAN/MERN Mavericks

### Video

{% youtube YvnL2nkzs0A %}

### Architecture

![Pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zseph001i9awp9rcjqcb.jpeg)

### Language Used
This project is built using 
- Js/React
- NodeJs/ExpressJs

In general, This project is made up using RERN (Redis, Express, React, Node.js)

### Link to Code

{% embed https://github.com/utsavbhattarai007/ideao %}

### Website
Visit it: [Ideao](https://ideao.netlify.app/)


### Additional Resources / Info

Home page
![Home Pic ](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fxy18nva8e7f95zjogyi.png)

Main App

![Main Dashboard](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/suidttmwxdpvxclo1x2q.png)

Search page

![Search page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lau5xs1ztchdkn0wvslp.png)

Mobile view

![Mob view](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f799fly6k3nib2m3go2z.png)



- - - 

* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._
NetSuite Development Services
Tags: netsuite, erp, business
Published: 2022-08-29 11:18:33

We provide expert-driven [NetSuite development services](https://www.vnmtsolutions.com/netsuite-development/) that are perfectly suited to advance company possibilities and enable business process automation in accordance with enterprise- and industry-specific needs and limitations.

#NetSuite #NetSuiteDevelopment #ERPsolutions #technologies #enterprise
I am speed, I can be Javascript
Published: 2022-08-29 11:11:00

Hello,

We will see what we have (at https://pixa.pics) found in order to have a suitable user experience, fluid enough, and best designed to enable anyone to create pixel arts that scales which can be NFTs or paintings...


## Computing thumbnails or filter previews

Thumbnails are small part of the image which are computed for each layer as they change... Web Worker enable us to let the main thread be available to respond to critical task while workers being off-thread do the work in parallel!

But wait!? Why was it so slow to work with url being encoded in base64... because they need to be encoded! Bitmap are much "dumb" they work very very fast yet you better render it on a canvas which can be a bit annoying.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5428q1nev92ftg18qgru.png)

- [createImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap) Available in worker + canvas [CanvasRenderingContext2D.drawImage](CanvasRenderingContext2D.drawImage) to render thumbnails shown

## Knowing what has changed when drawing/undo/redo

When we change the state of the painting the algorithm named below (very lightweight, blazing fast) know how to and execute a very fast mathematical operation which sum up the whole state of every pixel. (Here in my chosen baseWTF text string of about 5 char. it can be a-z also A-Z also 0-9 and has 5 of length) Very cool for filename and not saving twice the same history state in any present or past timeline.

 - XXHash! [xxhashjs + xxhashwasm](https://github.com/pixa-pics/pixa-pics.github.io/blob/main/src/js/components/canvaspixels/utils/XXHash.js)

## Color Computing (Low-Level JavaScript and our module)

It is simply for blending layer of our canvas which are virtualized and not having the need to sum-up canvas naturally which can be very messy, good challenge thought.

We first need to call the function of our module which is update in order to create an array which is defined in terms of entity in it and in terms of length, an array buffer that we can convert from 32 bits colors (Just like html colors but inside an integer) to 4x8bits colors (red, green, blue, alpha) very fast! See [fast color conversion](https://dev.to/vipertechofficial/fastest-color-conversion-in-js-with-typed-arrays-abf)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afd35p5eavv0ylue3kru.png) https://github.com/pixa-pics/pixa-pics.github.io/blob/main/src/js/components/canvaspixels/utils/SuperBlend.js

And then we also used more precise instruction which can speed up to 175% by luck the algorithms as all variables are scoped intelligently and also typed using "| 0" for integer (entire) and so on...  [LLJS](https://mbebenita.github.io/LLJS/)

Enjoy those speed hacks!
22 Steps to Protect WordPress: Anti-Hacker Security
Tags: wordpress, security, webdev, cybersecurity
Published: 2022-08-29 10:57:14

We have made a compilation of recommendations to protect your WordPress as much as possible. Being the most used content manager in the world, it is quite common for you to receive attacks from hackers, brute force, and robots. If you have all the options marked by default, you could have a security problem that leaves you without a web page or that includes malicious code. See which of these actions you can take to be much more protected.

[https://techplanet.today/post/22-steps-to-protect-wordpress-anti-hacker-security](https://techplanet.today/post/22-steps-to-protect-wordpress-anti-hacker-security)
dbForge Studio for MySQL: Why I Switched to This Easy, All-Rounder GUI Tool
Tags: mysql, mysqlgui, database, sql
Published: 2022-08-29 10:50:52

Technical review of main features of one of the popular MySQL GUI tool - dbForge Studio for MySQL. Let's look at the advantages and disadvantages of the product

[https://techplanet.today/post/dbforge-studio-for-mysql-why-i-switched-to-this-easy-all-rounder-gui-tool](https://techplanet.today/post/dbforge-studio-for-mysql-why-i-switched-to-this-easy-all-rounder-gui-tool)
What is a repository that you think every developer should know about?
Tags: opensource, discuss, programming, github
Published: 2022-08-29 10:43:12

GitHub, among other Git providers, is full of hidden gems that are very helpful to all developers. Some of them are well known, but a lot of them are considered underrated even though they're valuable?

What's a repository that you think developers should know about? It can be an underrated repository with not many stars, or it can be a popular one that you still think more developers should know about.

P.S: 👀 Make sure to check out [Medusa](https://github.com/medusajs/medusa), the open source Shopify alternative!
Podcast Recommendation System.
Tags: redishackathon
Published: 2022-08-29 10:30:34

[Instructions]: # (To submit to the Redis Hackathon on DEV, please fill out all sections. DELETE ALL NOTES, reminders, and guidelines before publishing.)


### Built a podcasts recommendation system. The Redis DB holds data of podcasts take from APPLE itunes and gathers data as user searches for podcasts.
Used REdisJSON and RedisGraph to store data of podcasts.
Also built the knowledge graph  in redis graph by connecting similar podcasts apply NLP on description of podcasts and connecting them. The suggestion is also given from fuzzy search of redis search applied on redis json.


### Submission Category: MERN

### [Optional: Video Explainer of My Project]


### Language Used Node.js


### Link to Code https://github.com/Aaditya-shukla/podcast-recommendations/tree/master


### Additional Resources / Info  Used spacy-nlp library for text processing.  



### Collaborators  Aaditya-shukla 



* _Check out [Redis OM](https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries), client libraries for working with Redis as a multi-model database._
* _Use [RedisInsight](https://redis.info/redisinsight) to visualize your data in Redis._
* _Sign up for a [free Redis database](https://redis.info/try-free-dev-to)._