teleren/devto huggingface dataset:
Static in C# - Part 2
Tags: csharp, beginners, programming
Published: 2024-06-24 19:22:31

In a [previous article](https://dev.to/locnguyenpv/static-in-c-part-1-51h1), I wrote about static definition, now we will go deeply - where, when and how to use it.

## Where can use `static`?
We can use it in following items:
- Variable
- Field
- Method
- Function 
- Class
- Constructor
Take a look at the example below to get more info

### Static function

![static func](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gw4cu15f5nzyltkiag0m.png)


In the following picture, we can include some things:
- With **variable**:
	- **Global**: require `static` type
	- **Local**: not require `static` type
- It can be call by other function (**static / non-static**)
- It can't call other **non-static** function

### Static class

![static class](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ne92r7ahjytvj19fgvp.png)

When we apply static to class, **everything of class (even the constructor)**, I repeat **everything** must be static

### Static constructor

![static constructor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kq36ohzavgg2ffpfkf20.png)


Some things we can take notes on here:
- Can use for both **static / non-static** class
- Don't have parameter 
- Will be call when the class is accessed for the first time.
- With **non-static class**, it can have **both two types of constructor**

## Best Practise
In my opinion, I usually use `static` in two cases:
- **Utility** (useful function I write for myself - ex: GetValueByKey, GetNameByStatus)
- Extension method (extend function for specific class - ex: GetUserId)

### Example - Utility
![util func](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qayhxqakgywyj6p6l5ch.png)

Here is the utility function I use to get value in `web.config`, when I want get any value in config file, just call

![use util](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wnixg2xg9noakhgqz4y.png)

### Example - Extension
Here are some extension method I wrote for `ASP.NET Identity`

![extension method](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r3a6y3gziefn2j7vzycc.png)

For a short explanation, two methods above would return **Access Level** and **Product Segment** in User Claims. It can be used like build-in function for `Identity`

![use extension](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9lhmg9ybdlrh7yogerof.png)

**P/s:** The pain point of `static` type is management. It declare one at run time and exists until the program finish, it can make exceptions if we don't manage access carefully. That's why **Singleton pattern** was born to cure it.
Events and Event Sources
Tags: java, programming, learning, beginners
Published: 2024-06-24 19:18:08

An event is an object created from an event source. Firing an event means to create an event and delegate the handler to handle the event.

When you run a Java GUI program, the program interacts with the user, and the events drive its execution. This is called _event-driven programming_. An _event_ can be defined as a signal to the program that something has happened. Events are triggered by external user actions, such as mouse movements, mouse clicks, and keystrokes. The program can choose to respond to or ignore an event. The example in the preceding section gave you a taste of event-driven programming.

The component that creates an event and fires it is called the _event source_ object, or simply _source object_ or _source component_. For example, a button is the source object for a buttonclicking action event. An event is an instance of an event class. The root class of the Java event classes is **java.util.EventObject**. The root class of the JavaFX event classes is **javafx.event.Event**. The hierarchical relationships of some event classes are shown in Figure below.

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

An _event object_ contains whatever properties are pertinent to the event. You can identify the source object of an event using the **getSource()** instance method in the **EventObject** class. The subclasses of **EventObject** deal with specific types of events, such as action events, window events, mouse events, and key events. The first three columns in Table below list some external user actions, source objects, and event types fired. For example, when clicking a button, the button creates and fires an **ActionEvent**, as indicated in the first line of this table. Here, the button is an event source object, and an **ActionEvent** is the event object fired by the source object, as shown in Figure below.

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


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

If a component can fire an event, any subclass of the component can fire the same type of event. For example, every JavaFX shape, layout pane, and control can fire **MouseEvent** and **KeyEvent** since **Node** is the superclass for shapes, layout panes, and controls.
TempCache ColdFusion UDF
Tags: coldfusion
Published: 2024-06-24 19:17:20

There's been many occasions where a user-specific payload has been generated (shopping cart, check out, config settings, processing results) and the user needs to be directed to a new destination with the data, but I want to avoid non-securely passing data as URL or form parameters or having to enable and/or leverage session variables.

We've encountered issues where the content could be blocked due to complex WAF rules that are beyond our editable control... especially if there's anything that resembles HTML or contains certain sequences. There's also abuse issues as automated software can scan the form, fuzz the parameters in order to blindly auto-post to the final script. We experienced this in the form of [carding](https://owasp.org/www-project-automated-threats-to-web-applications/assets/oats/EN/OAT-001_Carding) (aka credit card stuffing) on some non-profit donation forms.

To prevent abuse, we've added [hCaptcha](https://www.hcaptcha.com/), [CSRF](https://owasp.org/www-community/attacks/csrf), fingerprinting, IP reputation and some other countermeasures, but there's been some sophisticated abuses where everything (remote IP, form payload, browser) is completely different, but it's obvious that it's the same abuser due to the automated schedule and occurrence of failures.

The most impactful workflow has been to:
- display a verification page
- Create an object with data unique to the order (IP, email, total amount) , temporarily cache it server-side and generate a token to add to the form
- Upon submission, and prior to performing any transaction, use the UUID to perform a look-up of cached data. If the look-up data doesn't exist or doesn't match the form/CGI data, reject the attempt.
- Added bonus: If no cached data exists, sleep for a second or two and then return a bogus "credit card is invalid" message.

We've also used this script on Contact & "Thank you" pages. On some older applications, the response is displayed on the same page without redirecting or using `history.pushState(null, null, "/myUrl");` to prevent accidental POST resubmission, but some app-based browsers seem to be blindly retriggering the form post when reopening the app.  We haven't been able to determine the actual cause, but capturing the response message, adding it to an object, caching and redirecting to a new page with the UUID to display the content has prevented the form report/replay issues from reoccurring.

Here's the TempCache UDF.  A simple cfml example has been included:

https://gist.github.com/JamoCA/fd43c189379196b6a52884affea3ad51

## Source code

{% gist https://gist.github.com/JamoCA/fd43c189379196b6a52884affea3ad51 %}
Feel energetic the whole day with Workday Nutrition's Energy Powder
Published: 2024-06-24 19:13:53

"Feeling like your afternoons are a snooze fest? Don't let fatigue drag you down!

Workday Nutrition's [Energy Powder](https://workdaynutrition.com/product/better-morning-subscription-test/?utm_source=organic&utm_medium=SEO&utm_campaign=Backlink) is your secret weapon for sustained, all-day energy. Our delicious, easy-to-mix powder is packed with:

Natural ingredients: No jitters, just a clean and healthy boost.
Essential vitamins: Support your body's natural energy production.
Zero sugar: Avoid the crash and experience long-lasting focus.
Simply mix it with water, and get ready to tackle your to-do list with renewed . Workday Nutrition's Energy Powder is perfect for:

Busy professionals
Students on the go
Athletes seeking a natural edge
Don't settle for sluggish afternoons! Take control of your energy with Workday Nutrition. Visit our website."
NaN is neither greater than nor less than any value
Tags: javascript, webdev, beginners, programming
Published: 2024-06-24 19:13:15

Have you ever been in a situation where you're expecting something and you get something unexpected in return?
Well, I'm not talking about "the mysteries of life" but "the mysteries of Javascript".

Consider we've something like this below:

```javascript
let x = 9;
let y = "11";
let z = "14";

```

```javascript
x < y; // true
y < z; // true
z < x; // false
```

`x < y`
So, what's exactly happening here is, if either of the values or both are strings i.e, when x < y, then both the values are coerced to be numbers and a typical numerical comparison happens.

`y < z`
But if both the values in the < comparison are strings, the comparison is made lexicographically same as the order you find in any dictionary.

Let's look at another case when one of the values can't be made into a valid number.

```javascript
let x = 11;
let y = 'z';
```

```javascript
x < y; // false
x > y; // false
x == y; // false
```

Most of us should be confused, how all the three comparisons be false? but it's okay to be confused here. The thing to catch here is value y is being coerced to 'Not a Number' (NaN) in the equality comparisons and **NaN is neither greater than nor less than any other value**.



Ref: YDKJS
Building Fintech Payment Solutions with Java
Tags: javascript, tutorial, fintech, java
Published: 2024-06-24 18:52:02

Introduction to Fintech Payment Systems Developing fintech payment systems requires a robust, secure, and scalable approach to handle financial transactions efficiently. Java, with its platform independence and extensive libraries, is a prime choice for this task.
Why Choose Java for Fintech? Java provides several benefits:
1.	Security: Java's built-in security features are critical for protecting financial data.
2.	Scalability: It supports scalable solutions, handling a growing user base and increasing transaction volumes.
3.	Cross-platform Compatibility: Java applications run on various platforms without modification.
Key Steps in Development
1.	Requirement Analysis: Understand the specific needs of the payment system, including security, transaction volume, and user interface requirements.
2.	Designing Architecture: Plan a modular and scalable architecture that can handle the load and ensure data security.
3.	Implementing Security Measures: Use Java's security APIs to implement encryption, secure communication, and user authentication.
4.	Developing Core Modules: Code the core functionalities such as transaction processing, user management, and reporting using Java frameworks.
5.	Testing and Quality Assurance: Perform rigorous testing to identify and fix vulnerabilities and ensure the system's reliability.
6.	Deployment and Maintenance: Deploy the system in a controlled environment and provide ongoing support to address any issues and implement updates.
Case Study: Peer-to-Peer Payment Platform A detailed case study illustrates the implementation of a peer-to-peer payment platform using Java. Key aspects include:
•	User Authentication: Implementing secure login mechanisms and user verification.
•	Transaction Management: Ensuring accurate and efficient processing of transactions.
•	Integration with Banking Systems: Facilitating seamless integration with existing banking infrastructure.
Conclusion Java's capabilities make it an ideal choice for developing fintech payment systems. Its security features, scalability, and cross-platform support ensure that the resulting systems are robust and efficient.
Convenient Visa Services in Mumbai
Published: 2024-06-24 18:51:38

Explore seamless visa processing and passport management at Mumbai Visa Application Center or [visa agents in Mumbai](https://thailandvisacentermumbai.dudigitalglobal.com/contact-us/), located in Prathamesh Tower-B, Lower Parel. Expert services from Monday to Saturday. Contact +91-7289000071 or visit us online for more details. #VisaServices #Mumbai
Java: The WHORE Without The H
Tags: java, programming, oop
Published: 2024-06-24 18:37:24

After a hard fast thrust, comes Sun's 1995 release, Java. People's love for Java is abound. This is because of the Java Virtual Machine, which ensures the same Java code can be run on different operating systems and platforms. This made  Sun Microsystems’ slogan for Java was “Write Once, Run Everywhere”. The WhORE, 
Java, runs on different platforms, but programmers write it the same way.

## Which other programming language is a WORE?
Stay Updated with Python/FastAPI/Django: Weekly News Summary (17/06/2024–23/06/2024)
Tags: python, django, flask, fastapi
Published: 2024-06-24 18:30:00

Dive into the latest tech buzz with this weekly news summary, focusing on Python, FastAPI, and Django updates from June 17th to June 23rd, 2024. Stay ahead in the tech game with insights curated just for you!

This summary offers a concise overview of recent advancements in the Python/FastAPI/Django framework, providing valuable insights for developers and enthusiasts alike. Explore the full post for more in-depth coverage and stay updated on the latest in Python/FastAPI/Django development.

Check out the complete article here [https://poovarasu.dev/python-fastapi-django-weekly-news-summary-17-06-2024-to-23-06-2024/](https://poovarasu.dev/python-fastapi-django-weekly-news-summary-17-06-2024-to-23-06-2024/)
Ducky Fog - Puzzle game
Tags: codepen
Published: 2024-06-24 18:23:04

In this 50+ level puzzle game a rubber duck wants to travel around the world! With fullscreen mode, refresh button, level selection menu and more!

Use arrow keys or arrow buttons to rotate the level and change the water depth. 

Done fully in HTML, SCSS and Vanilla Js. 3D styles are all done in CSS.

You can share your record in the comments! :D (just visible if you start from level 0).

{% codepen https://codepen.io/Pedro-Ondiviela/pen/JjqKWNp %}
Understanding Visual Noise in UI/UX Design
Published: 2024-06-24 18:10:12

Day 6: Learning UI/UX Design

👋 Hello, Dev Community!



I'm Prince Chouhan, a B.Tech CSE student with a passion for UI/UX design. Today, I learned about Visual Noise in design.



---



📚 Today's Learning Highlights:



Concept Overview:

Visual noise refers to unnecessary or distracting elements that hinder focus on important content, degrading the user experience.



Forms of Visual Noise:

1. Cluttered Layout: Overcrowded elements confuse users. (Example: Too many buttons/links in one area)

2. Excessive Typography: Too many fonts/styles create chaos. (Example: Mixing serif and sans-serif fonts excessively)

3. Distracting Animations: Overuse can divert attention. (Example: Too frequent/elaborate animations)

4. Busy Backgrounds: Complex backgrounds compete for attention. (Example: Highly detailed images interfering with text)



---



Importance of Clear Visual Hierarchy:

- Use of White Space: Reduces clutter, highlights content.

- Consistent Styling: Cohesive look and feel.

- Good Alignment: Structured and orderly layout.



---



Benefits of Reducing Visual Noise:

- Enhanced user experience.

- Increased usability.

- Better readability.



---



By minimizing visual noise, designers create aesthetically pleasing and functional interfaces, leading to a more satisfying user experience.



📢 Community Engagement:

How do you ensure your designs are clean and user-friendly? Share your tips in the comments!



---



💬 Quote of the Day:

"Simplicity is the ultimate sophistication." - Leonardo da Vinci

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



Thank you for reading! Stay tuned for more updates on my UI/UX design journey.



#UIUXDesign #LearningJourney #DesignThinking #PrinceChouhan #VisualNoise #LinkedInLearning
From Novice to Ninja: Embarking on the Full Stack Developer Journey with Project-Based Learning
Published: 2024-06-24 18:08:12

Hello community... Recently i decided to take the software engineering path and want to be a full stack developer,ambitious right?
But i am determined to this and be one great and innovative software developer.Now i want to learn by starting out from web development and i want my learning to be project based for my understanding as well as develop proper development skills and would like to ask for assistance and tips from the pro guys on this space to help me grow from an amateur shy noobie to a proclaimed and expert in the field.
All help will certainly be welcomed as well as constructive criticism paired with collaborations
Interactive Resume, Yes?
Tags: resume, css, animation, interactive
Published: 2024-06-24 18:01:05


![Top of Resume](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w1m4oef19bex65gkkmh.png)

Hey guys, i'm working on a resume idea to help me land my first programming job. Coming from an artist background, I have this urge to make it fun and exciting. How do we feel about an interactive cube that displays samples of my work? Or what about my profile pic that tumbles down the side of the page as you scroll along? 


![Tumbling profile pic](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c9svcnx8bzaja3nom7tp.png)

The tumbling pic says "i'm coming with!" for some added subconscious encouragement to a perspective employer. LOL. I love it. Do you love it? I think a digital resume is a great way to give an example of your skills. Am I a crazy artist lady or is this a great idea? What awesome stuff have you done with your resume? I'd love additional inspiration. A work in progress, not finished.
HOW TO CREATE AND CONNECT TO A LINUX VM USING A PUBLIC KEY.
Tags: linux, cloudcomputing, virtualmachine
Published: 2024-06-24 17:59:48

Azure Virtual Machines (VMs) can be easily created using the Azure portal, a browser-based interface for managing Azure resources. This guide will show you how to deploy a Linux VM running Ubuntu Server 22.04 LTS and connect to it via SSH to install the NGINX web server.

## Step 1: Sign in to Azure
Sign in to the https://portal.azure.com/

## Step 2: Create virtual machine

- Search for Virtual machine

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

- Select the subscription and resource group

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

- Select the virtual machine name, region, availability options, security type. Image should be Ubuntu

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

- Size

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

- 
Under Administrator account, select SSH public key.

In Username enter azureuser.

For SSH public key source, leave the default of Generate new key pair, and then enter VirtualVM2_key for the Key pair name.

Review and create

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

- On the Create a virtual machine page, you can see the details about the VM you are about to create. When you are ready, select Create.

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

- Click on download private key and create resource. The file will be download as VirtualVM2_Key.pem. Go ahead and copy the key for the next step

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

Your 
When the deployment is finished, select Go to resource.

On the page for your new VM, select the public IP address and copy it to your clipboard.

## Step 3: Connect to Virtual Machine

- When the deployment is finished, select Go to resource.

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

- On the page for your new VM, select the public IP address and copy it to your clipboard.

- Create an SSH connection with the VM on your power shell using the following command prompt

The pem key and the public IP address

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

Respond with a yes

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

sudo apt-get -y update
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7i1pcep319byvyhtwsi3.png)

sudo apt-get -y install nginx

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

## Step 4: Open your IP address on your computer


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgaulelhz1hkzmsxwtu3.png)
Level Up Your Professional Skills with Be10x's Online Workshops
Tags: ai, be10x, workshop
Published: 2024-06-24 17:49:43

Feeling stuck in your career? Want to impress your boss and land that promotion? Be10x can help! We offer high-quality, affordable [online workshop](https://be10x.in/ai-tool-workshop/?utm_source=Organic&utm_medium=SEO&utm_campaign=backlink) designed to give you the in-demand skills you need to succeed in today's job market.


**Here's what sets Be10x apart:
**

**Expert-Led Training:** Learn from industry professionals, including IIT Kharagpur alumni.
**Actionable Skills:** Gain practical knowledge you can immediately apply to your work.
**Wide Range of Topics:** Choose from workshops in AI tools, MS Office mastery, data visualization (Power BI), and more!
**Boost Your Resume:** Earn a completion certificate to showcase your newfound skills.
**Supercharge Your Productivity:** Discover time-saving hacks and become an office efficiency expert.
Don't wait! Invest in yourself today. Workshops start at just ₹9!

Visit our website to learn more and register for your workshop!
zsh: command not found ui5 tooling.
Tags: openui5, sapui5, mac, command
Published: 2024-06-24 17:47:24

To solve the "zsh: command not found: ui5" error when using UI5 tools locally installed in your project's node_modules on a Mac, you can try the following approaches:

Use npx to run the UI5 CLI:

Instead of calling ui5 directly, use npx ui5. This will look for the UI5 CLI in your project's node_modules and execute it.

`npx ui5 <command>`

Use the full path to the UI5 CLI:
You can run the UI5 CLI by specifying its full path in the node_modules folder:

`./node_modules/.bin/ui5 <command>`

Add node_modules/.bin to your PATH:
You can temporarily add the node_modules/.bin directory to your PATH for the current session:

`export PATH=$PATH:./node_modules/.bin`


After running this command, you should be able to use ui5 directly in that terminal session.


Use npm scripts:
Define scripts in your package.json file that use the locally installed UI5 CLI:

```

{
  "scripts": {
    "start": "ui5 serve",
    "build": "ui5 build"
  }
}
```

Then you can run these scripts using npm:

```
npm run start
npm run build
```