Snippets Collections
curl \
  -H 'Content-Type: application/json' \
  -d '{"contents":[{"parts":[{"text":"Explain how AI works"}]}]}' \
  -X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY'
const axios = require('axios');

async function fetchDataWithRetry(url, retries = 3) {
  try {
    const response = await axios.get(url);
    console.log('Data fetched:', response.data);
  } catch (err) {
    if (retries > 0) {
      console.log(`Retrying... Attempts left: ${retries}`);
      await new Promise((resolve) => setTimeout(resolve, 1000)); // Wait 1 second before retrying
      return fetchDataWithRetry(url, retries - 1); // Retry the API call
    } else {
      console.error('Failed after retries:', err.message);
    }
  }
}

fetchDataWithRetry('https://jsonplaceholder.typicode.com/posts');
const fs = require('fs');

// Async
fs.writeFile('example.txt', 'Hello, world!', (err) => {
  if (err) {
    console.error('Error writing file:', err.message);
    return;
  }
  console.log('File written successfully');
});

// Sync
try {
  fs.writeFileSync('example.txt', 'Hello, world!');
  console.log('File written successfully');
} catch (err) {
  console.error('Error writing file:', err.message);
}
const fs = require('fs');

// Async
fs.readFile('example.txt', 'utf8', (err, data) => {
  if (err) {
    console.error('Error reading file:', err.message);
    return;
  }
  console.log('File content:', data);
});

// Sync
try {
  const data = fs.readFileSync('example.txt', 'utf8');
  console.log('File content:', data);
} catch (err) {
  console.error('Error reading file:', err.message);
}
const axios = require('axios');

async function fetchData(url) {
  try {
    const response = await axios.get(url); // Make an API call
    console.log('Data fetched successfully:', response.data); // Handle success
  } catch (error) {
    console.error('Error fetching data:', error.message); // Handle error
  }
}
var numWaterBottles = function(numBottles, numExchange) {
    let drinked = 0;
    let empty = 0;
    while (numBottles + empty >= numExchange) {
        drinked += numBottles; 
        empty += numBottles;
        numBottles = Math.floor(empty / numExchange);
        empty -= numBottles * numExchange;
    }
    return drinked + numBottles;
};
class ArrayWrapper {
    nums: number[] = [];
    constructor(nums: number[]) {
        this.nums = nums;
    }
    
    valueOf(): number {
        return this.nums.reduce((s, e) => s += e, 0);
    }
    
    toString(): string {
        return JSON.stringify(this.nums);
    }
};
function productExceptSelf(nums: number[]): number[] {
    const postfix = [];
    const indexLast = nums.length - 1;
    postfix[indexLast] = nums[indexLast];
    for (let i = indexLast - 1; i >= 0; i--) {
        postfix[i] = postfix[i+1] * nums[i];
    }
    const result = [postfix[1]];
    let prefix = nums[0];
    for (let i = 1; i < indexLast; i++) {
        result[i] = prefix * postfix[i+1];
        prefix *= nums[i]
    }
    result[indexLast] = prefix;
    return result;
};
function isSubPath(head: ListNode | null, root: TreeNode | null): boolean {
    if (!head) return true;
    if (!root) return false;
    const dfs = (head: ListNode | null, root: TreeNode | null): boolean => {
        if (!head) return true; 
        if (!root) return false;
        if (root.val === head.val)
            return dfs(head.next, root.left) || dfs(head.next, root.right);
        return false;
    };
    return dfs(head, root) || isSubPath(head, root.left) || isSubPath(head, root.right);
}
function hook_css() {
    ?>
        <style>
            .wp_head_example {
                background-color : #f1f1f1;
            }
        </style>
    <?php
}
add_action('wp_head', 'hook_css');
function* createPeopleIterator() {
  let index = 0;
  while (true) {
    yield people[index++ % people.length];
  }
}

const iterator = createPeopleIterator();

console.log(iterator.next());
.incorrecto {
    text-decoration:line-through;
    color: red;
}
// Define the coordinates of the point or region of interest
var point = ee.Geometry.Point(90.2611485521762, 23.44690280909043);

// Define the date range for the year 2012
var startDate = '2012-01-01';
var endDate = '2012-12-31';

// Create a Landsat 7 Collection 2 Tier 1 image collection for the year 2012
var landsatCollection = ee.ImageCollection('LANDSAT/LE07/C02/T1_TOA')
  .filterBounds(point)
  .filterDate(startDate, endDate)
  .filter(ee.Filter.lt('CLOUD_COVER', 10));  // Filter for images with less than 10% cloud cover

// Get the median image for the year 2012
var medianImage = landsatCollection.median();

// Center the map to the point of interest
Map.centerObject(point, 10);

// Add the median image to the map
Map.addLayer(medianImage, {
  bands: ['B3', 'B2', 'B1'],  // True color composite (RGB)
  min: 0,
  max: 0.3
}, 'Landsat 7 Image (2012, Low Clouds)');

// Pinpoint the coordinates by adding the point to the map
Map.addLayer(point, {color: 'red'}, 'Pinpoint Location');
pip install prowler
prowler -v
async function fetchGET(url: string): Promise<any> {
	try {
		const response = await fetch(url);
		if (!response.ok) {
			throw new Error(
				`Unable to Fetch Data, Please check URL
				or Network connectivity!!`
			);
		}
		const data = await response.json();
		return data.results[0];
	} catch (error) {
		console.error('Some Error Occured:', error);
	}
}
Deal_Details = zoho.crm.getRecordById("Deals",deal_id);
Deal_Name = Deal_Details.get("Deal_Name");
Deal_Number = Deal_Details.get("Deal_Number");
//===================================================================================//
searchParam = {"reference_number":Deal_Number};
related_purchase_orders = zoho.books.getRecords("purchaseorders","689149759",searchParam);
info related_purchase_orders;
count = 0;
Total_of_all = 0.0;
if(related_purchase_orders.get("purchaseorders").size() > 0)
{
	responseXML = "<record>";
	for each  purchase_order in related_purchase_orders.get("purchaseorders")
	{
		purchaseorder_number = purchase_order.get("purchaseorder_number");
		created_date = purchase_order.get("date");
		status = purchase_order.get("status");
		vendor_name = purchase_order.get("vendor_name");
		total = purchase_order.get("total");
		Total_of_all = Total_of_all + total;
		po_id = purchase_order.get("purchaseorder_id");
		html = "<a href='www.google.com'>click here</a>";
		//===================================================================================//
		responseXML = responseXML + "<row no='" + count + "'>";
		responseXML = responseXML + "<FL val='PO Number'>" + purchaseorder_number + "</FL>";
		responseXML = responseXML + "<FL val='Status'>" + status.proper() + "</FL>";
		responseXML = responseXML + "<FL val='Vendor'>" + vendor_name.replaceAll("[\"#%&+;<=>\[\]^`(){}|~]","") + "</FL>";
		responseXML = responseXML + "<FL val='Total'>$ " + total + "</FL>";
		responseXML = responseXML + "<FL val='Created Date'>" + created_date + "</FL>";
		// 				responseXML = responseXML + "<FL val='PO Link'>https://books.zoho.com/app#/purchaseorders/" + po_id + "</FL>";
		responseXML = responseXML + "<FL val='PO Link' link='true' url='https://books.zoho.com/app#/purchaseorders/" + po_id + "'>Open</FL>";
		responseXML = responseXML + "</row>";
		count = count + 1;
	}
	responseXML = responseXML + "</record>";
}
else
{
	responseXML = "";
	responseXML = responseXML + "<record><error>=><message>There are no POs found against this Deal!</message></error></record>";
}
return responseXML;
class MakeRequests {
  private baseURL: string;

  constructor(baseURL: string) {
    this.baseURL = baseURL;
  }

  private async makeRequest<T>(requestInfo: RequestInfo): Promise<T> {
    const jsonResponse: Awaited<T> = await fetch(requestInfo)
      .then((response: Response) => response.json())
      .then((json: T) => json);
    return jsonResponse;
  }

  public async getPosts(): Promise<Record<string, unknown>> {
    const jsonResponse: Record<string, unknown> = await this.makeRequest(
      new Request(`${this.baseURL}posts/1`, {
        headers: new Headers({ "Content-Type": "application/json" }),
      })
    );
    return jsonResponse;
  }
}

const makeRequests: MakeRequests = new MakeRequests(
  "https://jsonplaceholder.typicode.com/"
);
export default makeRequests;
function woosuite_disable_shipping_calc_on_cart( $show_shipping ) {

    if( is_cart() ) {
        return false;
    }
    return $show_shipping;
}

add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'woosuite_disable_shipping_calc_on_cart', 99 );
import dataclasses


@dataclasses.dataclass()
class Parent:
    def __post_init__(self):
        for (name, field_type) in self.__annotations__.items():
            if not isinstance(self.__dict__[name], field_type):
                current_type = type(self.__dict__[name])
                raise TypeError(f"The field `{name}` was assigned by `{current_type}` instead of `{field_type}`")

        print("Check is passed successfully")


@dataclasses.dataclass()
class MyClass(Parent):
    value: str


obj1 = MyClass(value="1")
obj2 = MyClass(value=1)
import React, { useState, useRef, useEffect } from 'react';
import './style.css';

const Chat = () => {
  const [textAreaHeight, setTextAreaHeight] = useState('auto');
  const [overflow, setOverflow] = useState(false);
  const textareaRef = useRef(null);

  const handleInput = (e) => {
    const textarea = textareaRef.current;
    textarea.style.height = 'auto';
    const newHeight = textarea.scrollHeight;

    if (newHeight > 100) {
      textarea.style.height = '100px';
      setOverflow(true);
    } else {
      textarea.style.height = `${newHeight}px`;
      setOverflow(false);
    }
  };

  useEffect(() => {
    const textarea = textareaRef.current;
    textarea.addEventListener('input', handleInput);

    return () => {
      textarea.removeEventListener('input', handleInput);
    };
  }, []);

  return (
    <div className="chat-container">
      <div className="input-wrapper">
        <textarea
          ref={textareaRef}
          className={`chat-textarea ${overflow ? 'overflow' : ''}`}
          placeholder="Type a message..."
          style={{ height: textAreaHeight }}
        />
        {/* Add send and audio icons */}
        <div className="icon-container">
          {/* Audio recording icon */}
          <svg
            xmlns="http://www.w3.org/2000/svg"
            viewBox="0 0 24 24"
            width="24"
            height="24"
            fill="currentColor"
          >
            <path d="M12 14a3.998 3.998 0 0 0 4-4V6a4 4 0 0 0-8 0v4a3.998 3.998 0 0 0 4 4zm7-4a1 1 0 1 0-2 0 5 5 0 0 1-10 0 1 1 0 1 0-2 0 7.002 7.002 0 0 0 6 6.92V20h-3a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2h-3v-3.08A7.002 7.002 0 0 0 19 10z" />
          </svg>

          {/* Send message icon */}
          <svg
            xmlns="http://www.w3.org/2000/svg"
            viewBox="0 0 24 24"
            width="24"
            height="24"
            fill="currentColor"
          >
            <path d="M21.426 2.574a1 1 0 0 0-1.059-.219l-17 7A1 1 0 0 0 3.5 11.5l7.223 2.89 2.89 7.223a1 1 0 0 0 1.15.615 1 1 0 0 0 .71-.698l7-17a1 1 0 0 0-.047-.959zM11.074 13.8 6.057 11.943 18.057 6l-6.825 6.825a.999.999 0 0 0-.158.975z" />
          </svg>
        </div>
      </div>
    </div>
  );
};

export default Chat;
h1,
p {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
.chat-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  max-width: 500px;
  margin: auto;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background-color: #f1f1f1;
  border-radius: 25px;
  padding: 10px;
}

.chat-textarea {
  flex: 1;
  border: none;
  border-radius: 20px;
  padding: 10px;
  resize: none;
  font-size: 16px;
  outline: none;
}

.chat-textarea.overflow {
  overflow-y: auto;
}

.icon-container {
  display: flex;
  align-items: center;
  margin-left: 10px;
}

.icon-container .audio-icon,
.icon-container .send-icon {
  font-size: 24px; /* Adjust size if needed */
  color: #555; /* Default color */
  margin-left: 10px;
  cursor: pointer;
}

.audio-icon {
  color: #128c7e; /* Custom color for audio icon */
}

.send-icon {
  color: #25d366; /* Custom color for send icon */
}
Ride-hailing services operate in a complex regulatory landscape, with varying requirements across different regional jurisdictions. Here are some key regulatory considerations:

1. Licensing and Permits
◦ Operator Licenses: Many jurisdictions require ride-hailing companies to obtain specific licenses or permits to operate.
◦ Driver Licenses: Drivers must have valid driver's licenses and may need additional commercial driver's licenses (CDLs).

2. Vehicle Requirements
◦ Inspection: Vehicles used for ride-hailing must meet specific safety standards and pass regular inspections.
◦ Insurance: Drivers and companies must carry appropriate insurance coverage to protect passengers and third-party liabilities.

3. Driver Background Checks
◦ Thorough Checks: Rigorous background checks are typically required to ensure the safety of passengers.
◦ Criminal Records: Checks for criminal records, driving history, and other relevant information.

4. Fare Regulations
◦ Price Controls: Some jurisdictions may have regulations on pricing, including minimum and maximum fares.
◦ Surge Pricing: Regulations regarding surge pricing and its implementation.

5. Data Privacy
◦ GDPR and Other Data Protection Laws: Adherence to data privacy regulations like GDPR (Europe) or CCPA (California) is essential to protect user data.

6. Consumer Protection
◦ Dispute Resolution: Establish clear dispute resolution mechanisms for passengers and drivers.
◦ Fair Practices: Ensure fair and transparent practices, including clear cancellation policies and pricing information.

Hopefully, these rules and regulations will grasp things and clear out the way for developing your rid-hailing app for your business considering legal compliance. In that sense, Bolt Clone is one of the prominent players in the Middle East region and gets overwhelming responses from users and businessmen. So if entrepreneurs desire to kickstart their business journey with bolt clone script Appticz is the best choice for starting your business entry.
def process_masks_and_save_with_visualization(mask_dir, bump_dir, no_bump_dir, skip=12, threshold=3):
    """
    Przetwarza maski, wykrywa obecność garbu, zapisuje je do odpowiednich folderów 
    i tworzy ich wizualizacje.
    """
    if not os.path.exists(bump_dir):
        os.makedirs(bump_dir)
    if not os.path.exists(no_bump_dir):
        os.makedirs(no_bump_dir)

    for filename in os.listdir(mask_dir):
        file_path = os.path.join(mask_dir, filename)
        if os.path.isfile(file_path) and filename.endswith('.png'):
            mask = Image.open(file_path).convert('L')  # Konwertuj do odcieni szarości
            mask_np = np.array(mask)
       
            # Wykrycie garbu
            bump_present = detect_bump(mask_np, skip, threshold)
            
            # Obliczanie max_diff
            label_bony_roof = 5
            binary_mask = (mask_np == label_bony_roof).astype(np.uint8)
            height, width = binary_mask.shape
            upper_contour = []
 
            for x in range(width):
                column = binary_mask[:, x]
                if np.any(column):
                    y = np.where(column)[0][0]  # Najwyższy piksel w danej kolumnie
                    upper_contour.append(y)
                else:
                    upper_contour.append(height)
 
            upper_contour = np.array(upper_contour)
            min_y = np.min(upper_contour)
            distances = min_y - upper_contour
            differences = pd.Series(distances).diff(periods=skip).fillna(0).abs()
            max_diff = differences.max()
            
            # Wizualizacja maski
            visualized_image = np.zeros((height, width, 3), dtype=np.uint8)
            
            for label, color_info in CLASS_COLORS.items():
                color = color_info['color_rgb']
                visualized_image[mask_np == label] = color
 
            # Zapisanie do odpowiedniego folderu
            if bump_present:
                save_path = os.path.join(bump_dir, filename)
            else:
                save_path = os.path.join(no_bump_dir, filename)
 
            Image.fromarray(visualized_image).save(save_path)
            print(f'Zapisano zwizualizowaną maskę do: {save_path} - max_diff: {max_diff}')
 
 
process_masks_and_save_with_visualization('./Angles/dane/masks_from_txt', './Angles/dane/garb_5_5/garb_obecny','./Angles/dane/garb_5_5/garb_nieobecny')
public class Ticket
{
    public string ExerciseName;     //Name of the Exercise Scene
    public float Duration;
    public int Level;

    public Ticket(string name, float duration, int level)
    {
        this.ExerciseName = name;
        this.Duration = duration;
        this.Level = level;
    }

    public virtual void PrintTicket()
    {
        Debug.Log($"Name: {ExerciseName} " +
                  $"Duration: {Duration} " +
                  $"Level: {Level}");
    }
}

public class PuzzleTicket : Ticket
{
    public int NumberOfPieces;
    public float MemoryPhaseSeconds;
    public bool AllPiecesPlacedMode;

    public PuzzleTicket(string name, float duration, int level, int pieces, float memoryPhase, bool allPieceMode) : base(name, duration, level)
    {
        this.NumberOfPieces = pieces;
        this.MemoryPhaseSeconds = memoryPhase;
        this.AllPiecesPlacedMode = allPieceMode;
    }

    public override void PrintTicket()
    {
        base.PrintTicket();

        Debug.Log($"PieceCount: {NumberOfPieces} " +
                  $"MemoryPhase: {MemoryPhaseSeconds} " +
                  $"Mode: {AllPiecesPlacedMode}");
    }
}

public class NinjaTicket : Ticket
{
    public float minSpawnDelay;
    public float maxSpawnDelay;

    public float fruitSpeed;

    public bool enableSmallFruit;
    public int samllFruitChance;

    public bool enableBomb;
    public int bombChance; 

    public NinjaTicket(string name, float duration, int level, float minSpawn, float maxSpawn, float speed, bool smallFruit, int smallChance, bool bomb, int bombChance) : base(name, duration, level)
    {
        this.minSpawnDelay = minSpawn;
        this.maxSpawnDelay = maxSpawn;

        this.fruitSpeed = speed;

        this.enableSmallFruit = smallFruit;
        this.samllFruitChance = smallChance;

        this.enableBomb = bomb;
        this.bombChance = bombChance;
    }
}
Explore the curated list of amazing apps
   ::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
    background-color: #F5F5F5;
   }   
   ::-webkit-scrollbar {
    width: 7px;
    height: 7px;
    background-color: #F5F5F5;
   }   
   ::-webkit-scrollbar-thumb {
    background-color: #004154;
       border-radius: 50px;
       width: 7px;
   }
flowruntime-repeater-instance .slds-card.card-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

flowruntime-repeater-instance div div.flowruntime-input {
    display: block;
}

flowruntime-repeater-instance div flowruntime-screen-field {
    width: 100%;
}

flowruntime-repeater-instance div flowruntime-flow-screen-input {
    width: 100%;
}

flowruntime-repeater lightning-button button[title="Remove"] {
    font-size: 0px !important;
    background-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQwbpoNpITAwQBMApXNh0jDzbBhCNB2TAfbObDZ8l8cCA&s") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
}


fieldset>flowruntime-screen-field {
    flex-basis: 100%;
}

fieldset>div:has(button[title="Remove"]) {
    margin-top: 0.95rem;
}

fieldset>flowruntime-screen-field:not(:has(.slds-checkbox__label)),
fieldset>div:has(button[title="Remove"]) {
    align-self: start;
}
function  n_of_n_stream(){
    function helper(a,b){
        return b<= 0
               ? helper (a+1, a+1)
               : pair(a, () => helper(a, b-1));
    }
    return helper(1,1)
}


function shorten_stream(s,k){
    if (is_null(0) || k === 0){
        return null;
    } else {
        return pair( head(s), () => shorten_stream(stream_tail(xs), k-1))
    }
}
=LAMBDA(r,4/3*PI()*r^3) // generic lambda
const async = require('async');

//Code for processing the task
var processQueue = function (message, callback) {
    setTimeout(function() {
        console.log(`Task ${message} completed`);
        callback();
    }, 500);
}

//Queue initialization. This queue process 3 tasks at a time
var queue = async.queue(processQueue, 3);

//After all tasks completion queue process this function
queue.drain = function() {
    console.log('Yuppie all tasks completed');
}

//To add tasks to queue we are using this function.
var processTasks = function () {
    for (let index = 1; index <= 10; index++) {
        queue.push(index);
    }
}

processTasks();
Status: connecting to Drive™ servers, please wait... (If nothing happens, please make sure that pop-ups are enabled and try again since authorization is handled via a pop-up)
const API = require('./mock-api');
const EventEmitter = require('events');

module.exports = class Search extends EventEmitter {
    constructor() {
        super();
    }
    async searchCount(term) {
        if (!term) {
            this.emit(
                'SEARCH_ERROR',
                { message: 'INVALID_TERM', term }
            );
            return;
        }
        this.emit('SEARCH_STARTED', term);
        try {
            const count = await API.countMatches(term);
            this.emit('SEARCH_SUCCESS', { term, count });
        } catch (error) {
            this.emit('SEARCH_ERROR', { term, message: error.message });
        }
    }
}

// Disable Gutenberg on the back end.
add_filter('use_block_editor_for_post', '__return_false');

// Disable Gutenberg for widgets.
add_filter('use_widgets_block_editor', '__return_false');

add_action('wp_enqueue_scripts', function () {
    // Remove CSS on the front end.
    wp_dequeue_style('wp-block-library');

    // Remove Gutenberg theme.
    wp_dequeue_style('wp-block-library-theme');

    // Remove inline global CSS on the front end.
    wp_dequeue_style('global-styles');

    // Remove classic-themes CSS for backwards compatibility for button blocks.
    wp_dequeue_style('classic-theme-styles');
}, 20);
The regulatory landscape for hybrid crypto exchanges varies significantly across jurisdictions. Here's a general overview of some key jurisdictions:

1. United States:

◦ State-Level Regulation: Crypto exchanges in the US are primarily regulated at the state level.
◦ BitLicense: New York requires a BitLicense for operating a virtual currency exchange.
◦ Money Transmitter License: Other states might require a money transmitter license or similar authorization.

2. Europe:

◦ MiCA (Markets in Crypto-Assets): The European Union's upcoming regulation (MiCA) will introduce a unified framework for crypto markets.
◦ National Regulations: Individual EU member states might have additional requirements.

3. United Kingdom:

◦ Financial Conduct Authority (FCA): The FCA regulates crypto exchanges in the UK. Registration or authorization might be required depending on the services offered.

4. Singapore:

◦ Payment Services Act (PSA): Crypto exchanges in Singapore need to be licensed under the PSA.

5. Switzerland:
◦ FINMA (Swiss Financial Market Supervisory Authority): Crypto exchanges in Switzerland must register with FINMA.

6. Other Jurisdictions:
◦ Australia: The Australian Securities and Investments Commission (ASIC) regulates crypto exchanges.
◦ Canada: Provincial securities regulators oversee crypto exchanges in Canada.
◦ Japan: The Financial Services Agency (FSA) regulates crypto exchanges in Japan.

The specific regulatory requirements might vary depending on the types of services offered by the hybrid exchange, such as spot trading, derivatives, or custodial services. Suppose you're trying to get through these complicated legal processes and outsource the best solution provider for all your needs. In that case, Appticz is the best option for opting for your hybrid crypto exchange development services for your business. We have longevity experience handling crypto-related products and services.
function wpdocs_js_code_example() {
	?>
	<script type="text/javascript">
		/* add your js code here */
	</script>
	<?php
}
add_action( 'wp_footer', 'wpdocs_js_code_example' );
<?php
    wp_enqueue_style('single-loan-officer', get_stylesheet_directory_uri().'/assets/css/single-loan-officer.css', array(), '1.0.10', 'all');
    wp_enqueue_script( 'fix-me-top', get_stylesheet_directory_uri().'/assets/js/fix-me-top.js', array('jquery'), '1.0.2', true );
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.Statement;

public class JdbcConnectionExample {

	public static void main(String[] args) throws ClassNotFoundException {
		Connection con = null;
		Statement st = null;
		String url = "jdbc:oracle:thin:@//localhost:1521/XE";
		String username = "system";
		String password = "cvr123";

		try {
			// Class.forName("com.mysql.cj.jdbc.Driver");
			con = DriverManager.getConnection(url, username, password);

			System.out.println("Connected!");
			st = con.createStatement();
			System.out.println("Inserting Records into the table");
			// int rowupdate = st.executeUpdate(
			// "insert into book values(33,'Machine Learning through
			// JavaScript','Anderson','Taylor series',2500)");
			ResultSet rs1 = st.executeQuery("Select * from book");
			// Get the values of the record using while loop from result set
			while (rs1.next()) {
				int id = rs1.getInt(1);
				String title = rs1.getString(2);
				String author = rs1.getString(3);
				String publisher = rs1.getString(4);
				int price = rs1.getInt(5);
				// String totalMarks= rs1.getInt(5);
				// store the values which are retrieved using ResultSet and print them
				System.out.println(id + "," + title + "," + author + "," + publisher + "," + price);
			}

		} catch (SQLException ex) {
			throw new Error("Error ", ex);
		} finally {
			try {
				if (con != null) {
					con.close();
				}
			} catch (SQLException ex) {
				System.out.println(ex.getMessage());
			}
		}
	}
}
import java.sql.Connection;
import java.sql.*;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.Statement;

public class JdbcConnectionExample {

    public static void main(String[] args) throws ClassNotFoundException {

        
        Connection con = null;
        Statement st = null;
        String url = "jdbc:oracle:thin:@//localhost:1521/XE";
        String username = "system";
        String password = "1234";

        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            con = DriverManager.getConnection(url, username, password);

            System.out.println("Connected!");
            st = con.createStatement();
            
            ResultSet rs1 = st.executeQuery("Select * from book");
            
            while (rs1.next()) {
                int id = rs1.getInt(1);
                String title = rs1.getString(2);
                String author = rs1.getString(3);
                String publisher = rs1.getString(4);
                int price = rs1.getInt(5);
                
                System.out.println(id + "," + title + "," + author + "," + publisher + "," + price);
            }

        } catch (SQLException ex) {
            throw new Error("Error ", ex);
        } finally {
            try {
                if (con != null) {
                    con.close();
                }
            } catch (SQLException ex) {
                System.out.println(ex.getMessage());
            }
        }
    }
}
// File: UpdateEmployeeSalary.java
import java.sql.*;
import java.util.Scanner;

public class PreparedUpdateex {
    public static void main(String[] args) {
        // Database credentials
        String jdbcURL = "jdbc:mysql://localhost:3306/jdbcdb"; // Replace with your database URL

        //private static final String DB_URL = "jdbc:oracle:thin:@localhost:1521:xe";
   
        String username = "root"; // Replace with your MySQL username
        String password = "ramesh"; // Replace with your MySQL password

        // SQL query to update employee salary by 2% where dept_id matches
        String updateSalaryQuery = "UPDATE employee SET salary = salary * 1.02 WHERE dept_id = ?";
         String query="select * from employee";

        try (Connection connection = DriverManager.getConnection(jdbcURL, username, password);
             PreparedStatement preparedStatement = connection.prepareStatement(updateSalaryQuery);
             Scanner scanner = new Scanner(System.in)) {

            // Get the dept_id from the user
            System.out.print("Enter the department ID to update salaries: ");
            int deptId = scanner.nextInt();

            // Set the dept_id parameter in the query
            preparedStatement.setInt(1, deptId);

            // Execute the update query
            int rowsAffected = preparedStatement.executeUpdate();

            // Output the result
            System.out.println("Salaries updated for department ID: " + deptId);
            System.out.println("Number of rows affected: " + rowsAffected);

            Statement st=connection.createStatement();
            
            ResultSet resultSet = st.executeQuery(query);
             System.out.println("Employee Records:");
            while (resultSet.next()) {
                // Retrieve the record fields using ResultSet
                int empId = resultSet.getInt("emp_id");
                String empName = resultSet.getString("empname");
                Date dob = resultSet.getDate("dob");
                double salary = resultSet.getDouble("salary");
                int dept_Id = resultSet.getInt("dept_id");

                // Print out the retrieved values
                System.out.println("Employee ID: " + empId);
                System.out.println("Employee Name: " + empName);
                System.out.println("Date of Birth: " + dob);
                System.out.println("Salary: " + salary);
                System.out.println("Department ID: " + dept_Id);
                System.out.println("--------------");
            }


        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: Xero Boost Days! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Please see below for what's on this week! "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-30: Monday 30 September",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:xero-hackathon: *Hackathon Lunch *: Provided by *Elixir Sabour* from *12pm* in the All Hands."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-2: Wednesday, 2nd October",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy free coffee and café-style beverages from our partner, *Elixir Sabour*, which used to be called Hungry Bean.\n:breakfast: *Morning Tea*: Provided by *Elixir Sabour* from *9AM - 10AM* in the All Hands.\n:massage:*Wellbeing*: Crossfit class at *Be Athletic* from 11am."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-3: Thursday, 3rd October",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":coffee: *Café Partnership*: Café Partnership: Enjoy coffee and café-style beverages from our partner, *Elixir Sabour*, which used to be called Hungry Bean.\n:late-cake: *Lunch*: Provided by *Elixir Sabour* from *12:30PM - 1:30PM* in the All Hands."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*LATER THIS MONTH:*"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*Thursday, 31st October*\n :blob-party: *Social +*: Drinks, food, and engaging activities bringing everyone together."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0/r?cid=Y185aW90ZWV0cXBiMGZwMnJ0YmtrOXM2cGFiZ0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Sydney Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
getgenv().Music = false
--Setting this to false usually fixes most executors
--also it helps load time a little bit
loadstring(game:HttpGet("https://raw.githubusercontent.com/Reapvitalized/TSB/main/APOPHENIA.lua"))()
SELECT COUNT(*) AS TableCount
FROM information_schema.tables
WHERE table_type = 'BASE TABLE';
number energy_to_pixel(image signal, number energy)
{
    // Get the origin and scale for the X dimension (energy axis)
    number origin = signal.ImageGetDimensionOrigin(0);  // X-axis (dimension 0)
    number scale = signal.ImageGetDimensionScale(0);    // X-axis scale (energy per pixel)
    
    // Calculate the corresponding pixel index for the given energy
    number pixel = (energy - origin) / scale;
    
    // Round to the nearest pixel index
    pixel = round(pixel);
    
    // Ensure the pixel index is within the valid range of the image
    number width = signal.ImageGetDimensionSize(0);  // Get image width (number of pixels)
    if (pixel < 0) pixel = 0;
    if (pixel >= width) pixel = width - 1;
    
    return pixel;
}

// Example usage
image signal := GetFrontImage();  // Assume signal is the current front image
number energy = 783;  // Example energy value
number pixelIndex = energy_to_pixel(signal, energy);
Result("\nPixel corresponding to energy " + energy + " is: " + pixelIndex);
star

Wed Oct 02 2024 01:22:37 GMT+0000 (Coordinated Universal Time) https://aistudio.google.com/app/apikey/AIzaSyA0BlngtbJuJJM4kHOq6i1jXHr9zA7P2rM

@Pythaicoris

star

Tue Oct 01 2024 22:03:32 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 21:58:09 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 21:57:09 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 21:52:51 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 20:22:46 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 20:18:56 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 20:13:18 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 20:04:18 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 17:46:26 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/hooks/wp_head/

@systemsroncal #php

star

Tue Oct 01 2024 17:02:19 GMT+0000 (Coordinated Universal Time)

@destinyChuck #json #vscode

star

Tue Oct 01 2024 16:39:50 GMT+0000 (Coordinated Universal Time) https://desarrolloweb.com/faq/tachado-css

@systemsroncal #css

star

Tue Oct 01 2024 16:26:51 GMT+0000 (Coordinated Universal Time)

@Rehbar #javascript

star

Tue Oct 01 2024 14:35:21 GMT+0000 (Coordinated Universal Time) undefined

@jindrax84

star

Tue Oct 01 2024 14:07:29 GMT+0000 (Coordinated Universal Time)

@underlinegls #bash

star

Tue Oct 01 2024 12:25:03 GMT+0000 (Coordinated Universal Time) https://netschool.edu22.info/app/school/studentdiary/

@A17012012

star

Tue Oct 01 2024 12:22:26 GMT+0000 (Coordinated Universal Time) https://netschool.edu22.info/app/school/announcements/

@A17012012

star

Tue Oct 01 2024 12:17:19 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 12:15:32 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge

star

Tue Oct 01 2024 12:15:15 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Tue Oct 01 2024 11:13:44 GMT+0000 (Coordinated Universal Time) https://aovup.com/woocommerce/hide-shipping-on-cart-page/

@webisko #php

star

Tue Oct 01 2024 11:11:31 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/58992252/how-to-enforce-dataclass-fields-types

@kapkap #python

star

Tue Oct 01 2024 11:06:23 GMT+0000 (Coordinated Universal Time)

@kiran022 #javascriptreact

star

Tue Oct 01 2024 11:05:43 GMT+0000 (Coordinated Universal Time)

@kiran022 #javascriptreact

star

Tue Oct 01 2024 10:30:01 GMT+0000 (Coordinated Universal Time) https://appticz.com/bolt-clone

@aditi_sharma_

star

Tue Oct 01 2024 10:09:05 GMT+0000 (Coordinated Universal Time)

@mateusz021202

star

Tue Oct 01 2024 09:40:04 GMT+0000 (Coordinated Universal Time)

@jakebezz

star

Tue Oct 01 2024 09:22:38 GMT+0000 (Coordinated Universal Time) https://www.sfdcproducthunt.com/

@WayneChung

star

Tue Oct 01 2024 07:54:12 GMT+0000 (Coordinated Universal Time)

@mubashir_aziz

star

Tue Oct 01 2024 06:52:18 GMT+0000 (Coordinated Universal Time) https://salesforcetime.com/2023/11/15/how-to-control-the-css-of-screen-flows/

@WayneChung

star

Tue Oct 01 2024 04:36:21 GMT+0000 (Coordinated Universal Time)

@hkrishn4a

star

Mon Sep 30 2024 22:38:45 GMT+0000 (Coordinated Universal Time) https://developer.chrome.com/docs/css-ui/animate-to-height-auto

@rstringa

star

Mon Sep 30 2024 21:48:00 GMT+0000 (Coordinated Universal Time) https://exceljet.net/functions/lambda-function#example3

@VanLemaime #xls

star

Mon Sep 30 2024 21:44:25 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Mon Sep 30 2024 21:34:21 GMT+0000 (Coordinated Universal Time) https://yasirkula.net/drive/downloadlinkgenerator/?state

@duffboss730

star

Mon Sep 30 2024 21:34:18 GMT+0000 (Coordinated Universal Time) https://yasirkula.net/drive/downloadlinkgenerator/?state

@duffboss730

star

Mon Sep 30 2024 21:34:16 GMT+0000 (Coordinated Universal Time) https://yasirkula.net/drive/downloadlinkgenerator/?state

@duffboss730

star

Mon Sep 30 2024 21:26:17 GMT+0000 (Coordinated Universal Time)

@kanatov

star

Mon Sep 30 2024 14:33:07 GMT+0000 (Coordinated Universal Time)

@shm1ckle #php

star

Mon Sep 30 2024 13:39:16 GMT+0000 (Coordinated Universal Time) https://appticz.com/hybrid-cryptocurrency-exchange-development

@aditi_sharma_

star

Mon Sep 30 2024 10:28:39 GMT+0000 (Coordinated Universal Time) https://br.novibet.com/en/live-betting

@barbarasettings

star

Mon Sep 30 2024 06:49:06 GMT+0000 (Coordinated Universal Time) https://developer.wordpress.org/reference/functions/wp_footer/

@systemsroncal #php

star

Mon Sep 30 2024 05:32:29 GMT+0000 (Coordinated Universal Time)

@omnixima #php

star

Mon Sep 30 2024 03:55:56 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Sep 30 2024 03:51:50 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Sep 30 2024 03:44:34 GMT+0000 (Coordinated Universal Time)

@signup

star

Sun Sep 29 2024 23:51:12 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun Sep 29 2024 16:31:34 GMT+0000 (Coordinated Universal Time) https://pastefy.app/GcOS9Uzy

@utol4ul

star

Sun Sep 29 2024 09:56:09 GMT+0000 (Coordinated Universal Time)

@iamkatmakhafola

star

Sun Sep 29 2024 08:53:31 GMT+0000 (Coordinated Universal Time)

@j2hwank

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension