how to create user preference in JavaScript on webpage click

<button id="themeToggle">Toggle Theme</button>
<p>Hello! This text will change theme.</p>
<style>
body {
  background: white;
  color: black;
}
body.dark {
  background: black;
  color: white;
}

</style>
<script>
// Get saved preference (if any)
let userPref = localStorage.getItem("theme");
 document.cookie = "theme=light; path=/";
// Apply saved preference
if (userPref === "dark") {
  document.body.classList.add("dark");
  document.cookie = "theme=dark; path=/";
}

// Button click event
document.getElementById("themeToggle").addEventListener("click", () => {
  document.body.classList.toggle("dark");

  // Save user preference
  if (document.body.classList.contains("dark")) {
    localStorage.setItem("theme", "dark");
    document.cookie = "theme=dark; path=/";
  } else {
    localStorage.setItem("theme", "light");
    document.cookie = "theme=light; path=/";
  }
});

</script>

text message in centre in whatsapp

No, you cannot truly center a text message on WhatsApp. The app’s built-in formatting options, which are based on the Markdown language, do not include a “center” or “align” function. All messages will appear left-aligned. 

However, you can create the visual illusion of a centered message by adding spaces and new lines. This method is most effective for short, one or two-word messages. 

How to “center” text manually

  1. Compose your message. Type out the word or phrase you want to center.
  2. Add spaces. Before your text, add spaces to manually push the message toward the middle of the chat bubble.
  3. Use multiple lines (optional). To make the message stand out even more, you can include multiple line breaks by pressing the “Enter” or “Return” key on your keyboard before and after your text. 

Example

For a simple word like “Hello,” you can create the illusion of a centered message by arranging it like this:

`

Hello

`

Alternative formatting options

While centering isn’t possible, WhatsApp does offer other ways to format text to make it stand out: 

  • Bold: Place an asterisk on both sides of the text (*text*).
  • Italic: Place an underscore on both sides of the text (_text_).
  • Strikethrough: Place a tilde on both sides of the text (~text~).
  • Monospace: Place three backticks on both sides of the text (`text`).
  • Block quote: Start a new line with a greater-than symbol and a space (> text). 

main dart js too large

A large main.dart.js file in a Flutter web application can impact loading times and user experience. Several strategies can be employed to reduce its size:

1. Optimization during Build:

  • Build in Release Mode:Always build your Flutter web application in release mode using flutter build web --release. This enables optimizations like tree-shaking and minification, which remove unused code and reduce file sizes.
  • Tree Shaking:Ensure that unused code and packages are effectively removed during the build process. Review your dependencies and remove any that are not actively used.
  • Dart Obfuscation:While primarily for security, obfuscation can also slightly reduce the size of the generated JavaScript by shortening variable and function names.

2. Code and Asset Management:

  • Compress and Optimize Assets:Large images, fonts, and other assets can significantly contribute to the overall size. Compress and optimize these assets before bundling them with your application.
  • Remove Unused Packages:Unused packages add unnecessary code to your application. Regularly audit your pubspec.yaml file and remove any packages that are no longer needed.
  • Use SizedBox for Whitespace:Instead of Container widgets for simple spacing, use SizedBox as it is a lighter widget and can contribute to a smaller bundle size.

3. Server-Side Optimization:

  • Enable Compression:Configure your web server to serve the main.dart.js file with compression (e.g., Gzip or Brotli). This significantly reduces the file size during transmission to the user’s browser.
  • Implement Caching:Set appropriate caching headers for static assets, including main.dart.js, to allow browsers to cache the file and avoid re-downloading it on subsequent visits.
  • Use a CDN:Content Delivery Networks (CDNs) can distribute your static assets globally, reducing latency and improving loading times for users in different geographical locations.

4. Advanced Techniques:

  • Deferred Loading (Code Splitting):For very large applications, consider implementing deferred loading (also known as code splitting) to load parts of your application only when they are needed. This can be achieved using packages like qlevar_router for route-based splitting.
  • Analyze main.js:Inspect the generated main.js file (both minified and unminified versions) to identify any large or repeated functions that might indicate areas for optimization.

why flutter web release load take time

Why Flutter Web Release Loads Slowly

  1. Big JS Bundle
    • Flutter compiles your Dart code into JavaScript (main.dart.js).
    • This file can be 5–10 MB (or more if you use many packages).
    • First-time users must download this entire file.
  2. CanvasKit Rendering
    • By default, Flutter Web uses CanvasKit (a WebAssembly engine for drawing).
    • The CanvasKit WASM + fonts + JS adds a few MB extra.
    • First load = slow, but cached later.
  3. Fonts & Assets
    • Custom fonts and images increase load time.
    • Flutter embeds fonts into the app.
  4. No Code-Splitting
    • Unlike React/Angular, Flutter bundles everything into one big JS file.
    • Even if you only need a small page, the whole app must load.
  5. Hosting/Server Speed
    • If you’re hosting on slow servers (or no CDN), the download is slower.
    • On free hosting (like GitHub Pages), initial load may be 5–10 sec.

How to Improve Load Speed

  1. Use --release build (already does optimizations) flutter build web --release
  2. Enable Tree Shaking for Icons
    If you use material icons: flutter build web --release --pwa-strategy=offline-first Or add to pubspec.yaml: flutter: uses-material-design: true This removes unused icons.
  3. Use WebRenderer = html (lighter but less accurate graphics) flutter build web --release --web-renderer html
    • html: smaller, faster load, but less accurate animations.
    • canvaskit: better quality, heavier.
  4. Compress Assets & Fonts
    • Use only required fonts.
    • Convert PNG → WebP.
    • Remove unused assets.
  5. Enable GZIP/Brotli Compression on Server
    • If hosting on Nginx/Apache/Cloudflare, enable compression.
    • Reduces JS size by 70%+.
  6. Host on a CDN (Firebase Hosting, Vercel, Netlify)
    • Faster delivery worldwide.
    • Built-in caching.
  7. Use Service Worker (PWA)
    • Offline-first caching makes subsequent loads instant.

First-time load will always be slower (user must download ~2–6 MB).
But with compression + html renderer + caching, you can make it 2–3 sec even on average internet.

flutter web taking too long to load

Optimizing the loading time of a Flutter web application involves several strategies aimed at reducing the initial bundle size, leveraging browser features, and optimizing asset delivery.

Bundle Size Reduction:

  • Minimize Dependencies:Review and remove any unused or unnecessary packages to reduce the overall application size.
  • Asset Compression:Compress images and other assets using efficient formats like WebP or by optimizing existing formats (JPEG, PNG) for web delivery.
  • Code Minification:Ensure the application is built in release mode (flutter build web --release) to minify JavaScript and CSS files. 

Browser and Server-Side Optimization:

  • Caching:Implement effective browser caching strategies using HTTP headers like Cache-Control to store static assets locally on the user’s device, reducing subsequent load times.
  • Compression:Enable server-side compression (e.g., Gzip or Brotli) to reduce the size of transferred data.
  • CDN Usage:Utilize a Content Delivery Network (CDN) to serve assets from geographically closer servers, reducing latency and improving delivery speed.
  • Preloading and Deferring Scripts:
    • Use preload for essential assets like main.dart.js to instruct the browser to fetch them early.
    • Use defer with script tags in index.html to allow scripts to be downloaded in parallel without blocking HTML parsing.

Perceived Performance and User Experience:

  • Custom Loader/Splash Screen:Add a custom loader or splash screen in index.html to provide visual feedback during the initial loading phase, improving perceived performance.
  • Lazy Loading:Implement lazy loading for images, fonts, and other non-critical assets to load them only when needed, reducing the initial load burden.
  • WebAssembly (Wasm):Explore and enable WebAssembly rendering mode in Flutter web, as it can offer performance improvements compared to CanvasKit for certain scenarios.

By implementing these optimizations, the initial loading time of a Flutter web application can be significantly reduced, leading to a better user experience.

If you park your car in the parking lot, it is important to keep the tyres straight. I have made a complete list of the disadvantages of this.

आप गाड़ी पार्किंग में खड़ी करते हैं तो टायर सीधे रखना जरूरी होता है, इससे होने वाले नुकसान क्या-क्या है मैने पूरे लिस्ट बना ली है

सस्पेंशन और स्टीयरिंग पर दबाव कम पड़ता है – अगर टायर तिरछे रहेंगे तो स्टीयरिंग रॉड, बॉल जॉइंट और टाई रॉड पर अतिरिक्त दबाव बना रहेगा, जिससे समय से पहले घिसाव (wear) हो सकता है।

दोस्तों गाड़ी बाहर निकालना आसान होता है – सीधा टायर होने पर गाड़ी आसानी से सीधी दिशा में निकलती है, बार-बार मोड़ने की जरूरत नहीं पड़ती।

साथ में टायर का संतुलन सही रहता है – अगर लंबे समय तक टायर तिरछे रखे जाएं तो एक तरफ का रबर ज्यादा दबाव में आकर घिस सकता है।

सुरक्षा कारण – अगर गाड़ी ढलान पर खड़ी है और हैंडब्रेक सही से काम न करे तो सीधे टायर वाली गाड़ी को नियंत्रित करना आसान होता है।

नोट: केवल ढलान (ऊphill या downhill) पर गाड़ी पार्क करते समय ही टायर को थोड़ा मोड़कर रखना चाहिए ताकि गाड़ी लुढ़के तो फुटपाथ/कर्ब से टकराकर रुक जाए।

अगर गाड़ी 2–3 दिन या हफ्तेभर टेढ़े टायर के साथ खड़ी है तो लगभग कोई बड़ा नुकसान नहीं होगा।
लेकिन अगर महीनों तक ऐसे ही खड़ी रहे तो ऊपर बताए गए असर धीरे-धीरे दिख सकते हैं।

इसलिए आदत डालें कि गाड़ी पार्क करते समय हमेशा टायर सीधे रखें (सिवाय ढलान पर, जहां सुरक्षा के लिए मोड़ना जरूरी होता है)।

There is less pressure on the suspension and steering – If the tyres are tilted, there will be extra pressure on the steering rod, ball joint and tie rod, which can cause premature wear.

Friends, it is easy to take the car out – If the tyres are straight, the car easily moves in the straight direction, there is no need to turn it again and again.

Along with this, the balance of the tyre remains correct – If the tyres are kept tilted for a long time, then the rubber on one side can wear out due to excessive pressure.

Safety reasons – If the vehicle is parked on a slope and the handbrake does not work properly, then it is easier to control the vehicle with straight tyres.

Note: Only when parking on a slope (uphill or downhill) should the tires be kept slightly bent so that if the car rolls, it hits the pavement/curb and stops.

If the car is parked with bent tires for 2–3 days or a week, then there will be almost no major damage.

But if it is parked like this for months, then the above-mentioned effects can gradually appear.

So make it a habit to always keep the tires straight while parking the car (except on slopes, where turning is necessary for safety).

The difference between Intel and AMD processors mainly comes down to performance, power efficiency, price, and target usage.

The difference between Intel and AMD processors mainly comes down to performance, power efficiency, price, and target usage. Here’s a clear comparison for you:


1. Performance

  • Intel:
    • Traditionally strong in single-core performance (better for tasks like gaming, where high clock speed matters).
    • Newer Intel chips (12th, 13th, 14th Gen) use a hybrid architecture (Performance + Efficiency cores) for better multitasking.
  • AMD (Ryzen series):
    • Strong in multi-core performance (great for video editing, 3D rendering, multitasking).
    • AMD Ryzen CPUs usually offer more cores/threads at the same price point compared to Intel.

2. Price-to-Performance Ratio

  • Intel:
    • Usually a bit more expensive for similar performance.
    • Best for users who want top single-core speeds (gamers, high FPS).
  • AMD:
    • Often cheaper with better value for money.
    • Provides more cores/threads at the same price range.

3. Integrated Graphics

  • Intel:
    • Most processors (non-F versions) come with Intel UHD or Iris Xe integrated graphics, so you don’t always need a graphics card.
  • AMD:
    • Most Ryzen CPUs don’t have integrated graphics (unless they’re “G” series like Ryzen 5600G).
    • But AMD’s integrated Vega graphics (in G models) are better than Intel’s basic UHD graphics.

4. Power Efficiency & Heat

  • Intel:
    • Newer Intel CPUs (especially i7/i9) can be power-hungry and run hotter, requiring good cooling.
    • Hybrid cores help improve efficiency in laptops.
  • AMD:
    • Ryzen CPUs are generally more power-efficient and run cooler.
    • Good for compact systems and laptops.

5. Overclocking

  • Intel:
    • Only K-series CPUs (like i5-13600K, i7-13700K) support full overclocking.
    • Requires Z-series motherboards for overclocking.
  • AMD:
    • Almost all Ryzen CPUs are unlocked for overclocking.
    • Overclocking is simpler and works on most motherboards.

6. Best Use Cases

  • Intel:
    • Best for gaming (higher FPS due to single-core speed).
    • Best for people needing strong laptop performance.
  • AMD:
    • Best for multitasking, video editing, 3D rendering, and productivity.
    • Best if you want budget-friendly builds with more cores.

In Short:

  • Choose Intel if you want top gaming performance & strong single-core speed.
  • Choose AMD if you want better multi-core performance, more value for money, and efficiency.

difference between intel and amd processor

Intel processors typically offer higher clock speeds, stronger integrated graphics (iGPUs), and better power efficiency, making them suitable for general tasks and some gaming. AMD processors excel in multi-core performance and value, offering superior multi-threaded performance for content creation and often provide higher core counts at a lower cost. The choice between them depends on whether you prioritize high single-core speed (Intel) or more cores for heavy multitasking (AMD) and your overall budget.
 

Key Differences at a Glance

  • Performance:
    • Intel: Generally known for strong single-threaded performance and high clock speeds, which is beneficial for tasks that don’t heavily utilize multiple cores, like some gaming scenarios. 
    • AMD: Excels in multi-core performance due to higher core and thread counts, making it ideal for content creation, video editing, and heavy multitasking. 
  • Integrated Graphics (iGPU):
    • Intel: Almost all Intel processors include integrated graphics (except for the “F” series), providing capable performance for general use and light gaming. 
    • AMD: Only AMD’s Accelerated Processing Units (APUs) include integrated graphics, but these are generally superior to Intel’s iGPUs, especially for light gaming. 
  • Power Efficiency & Heat:
    • Intel: Traditionally known for better power efficiency and lower heat output, leading to better battery life in laptops. 
    • AMD: Historically, AMD processors required more power and generated more heat, although this has improved with their newer chip architectures. 
  • Value & Price:
    • Intel: Tends to be more expensive, especially at the high end, but offers strong performance across the board. 
    • AMD: Often provides better value for money, offering more cores and threads for a lower price, which is a significant advantage for budget-conscious users. 
  • Architecture:
    • Intel: Uses a more traditional monolithic design, focusing on high performance. 
    • AMD: Employs a modular chiplet design, emphasizing multithreading and scalability. 

Who Should Buy Which?

  • Choose Intel if:You need high single-core performance for certain applications or gaming, and power efficiency is a priority for a laptop, or if you prefer their integrated graphics for general tasks. 
  • Choose AMD if:You are looking for a better value, need strong multi-core performance for content creation or heavy multitasking, or want superior integrated graphics in an affordable package. 

chkdsk /f /r means

chkdsk /f /r is a Windows command that performs a comprehensive disk check, first to fix file system errors with the /f parameter and then to scan for and recover data from bad sectors on the hard drive with the /r parameter. Running this command requires administrative privileges in the Command Prompt and may prompt to schedule the scan for a system restart if checking the active operating system drive. 

Understanding the Parameters

  • /f (Fix Errors):This parameter tells chkdsk to check the disk’s file system for logical errors and attempt to fix them. 
  • /r (Recover Bad Sectors):This parameter is a more thorough command that implies /f. It locates bad sectors on the disk, attempts to recover readable information from them, and marks the sectors as unusable so that data isn’t written to them in the future. 

How to Use chkdsk /f /r

  1. 1. Open Command Prompt as Administrator:Search for “cmd” in the Start menu, right-click on Command Prompt, and select “Run as administrator”. 
  2. 2. Enter the Command:In the Administrator Command Prompt window, type chkdsk [drive letter]: /f /r (e.g., chkdsk C: /f /r) and press Enter. 
  3. 3. Schedule the Scan:If the command is run on the operating system’s drive (usually C:), you will be asked to schedule the scan for the next restart. Type “Y” and press Enter. 
  4. 4. Restart Your Computer:The scan will begin automatically when you restart your computer. 
  5. 5. Be Patient:The scan, especially with the /r parameter, can take several hours to complete. 

Important Considerations 

  • Backup Your Data:Always back up important data before running chkdsk /f /r as there is a risk of data loss, especially if the disk has severe errors.
  • Do Not Interrupt:Do not interrupt the chkdsk process, as this can lead to further disk corruption.

Those using Zoom are at risk of cyber attack

जूम का उपयोग करने वालों पर साइबर हमले का खतरा

नई दिल्ली, एजेंसी। विंडोज पर जूम का उपयोग कर रहे यूजर्स पर साइबर हमले का खतरा है। भारत सरकार के इलेक्ट्रॉनिक्स और सूचना प्रौद्योगिकी मंत्रालय की एजेंसी इंडियन कंप्यूटर इमरजेंसी रिस्पांस टीम (सीईआरटी-इन) ने मंगलवार को विंडोज पर चलने वाले जूम के कई प्रोडक्टस में सुरक्षा खामियों को लेकर अलर्ट जारी किया है।

सीईआरटी ने कहा है कि इस खामी से हैकर्स बिना आपकी जानकारी के आपके कंप्यूटर से छेड़छाड़ कर सकते हैं, और आपके सिस्टम की गोपनीय जानकारी चुरा सकते हैं। जूम नेइस खतरे को देखते हुए विंडोज यूजर्स से तुरंत अपने एप्लिकेशन को सरत करने की अपील की है ताकि वे सुरक्षित रह सकें।

खतरा काफी गंभीरः

सीईआरटी के अनुसार जूम के प्रोडक्ट्स में यह सुरक्षा खामी अधिक गंभीर है। इससे जो भी व्यक्ति या संस्थान जूम का उपयोग कर रहे हैं, उन्हें दिक्कतों का सामना करना पड़ता है। इस खामी की सूचना सबसे पहले जूम अऑर्फिसिव सिक्योरिटी ने दी थी।

जूम के सॉफ्टवेयर में क्या दिक्कतें हैं?

असुरक्षित खोज पथ का इस्तेमाल सीईआरटी के अनुसार जूम का सॉफ्टवेयर कुछ महत्वपूर्ण फाइलों को वहां ढूंढ़ता है जहां कोई भी व्यक्ति आसानी से बदलाव कर सकता है। अगर कोई हैकर इस रास्ते का फायदा उठा ले, तो वह जूम सॉफ्टवेयर को धोखा देकर गलत कोड सिस्टम में डाल सकता है। रेस कंडीशन: यह एक ऐसी समस्या है जो तब होती है जब दो या दो से ज्यादा प्रक्रियाएं एक समय में एक ही काम को करने की कोशिश करती हैं। हैकर इसका फायदा उठाकर गलत समय पर अपना कोड डाल सकता है।

जेरॉक्स फ्रीफ्लो और गिट लैब के लिए अलर्ट

सीईआरटी ने जेरॉक्स फ्रीफ्लो कोर और गिटलैब कम्युनिटी एडिशन तथा एंटरप्राइज संस्करण के लिए भी अलर्ट जारी किया है। जेरॉक्स फ्रीफ्लो कोर सॉफ्टवेयर प्रिंटिंग के काम को आसान बनाता है। इसमें समस्या यह है कि सॉफ्टवेयर XML इनपुट को सही तरीके से संभाल नहीं पाता।

New Delhi, Agency. Users using Zoom on Windows are at risk of cyber attack. Indian Computer Emergency Response Team (CERT-In), an agency of the Ministry of Electronics and Information Technology, Government of India, on Tuesday issued an alert regarding security flaws in many products of Zoom running on Windows.

CERT has said that due to this flaw, hackers can tamper with your computer without your knowledge, and can steal confidential information of your system. In view of this threat, Zoom has appealed to Windows users to immediately secure their application so that they can stay safe.

The threat is very serious:

According to CERT, this security flaw in Zoom’s products is more serious. Due to this, any person or institution using Zoom has to face problems. This flaw was first reported by Zoom’s Oversight Security.

What are the problems in Zoom’s software?

Use of unsafe search path According to CERT, Zoom’s software searches for some important files where anyone can easily make changes. If a hacker takes advantage of this path, he can deceive the Zoom software and insert the wrong code into the system. Race condition: This is a problem that occurs when two or more processes try to do the same task at the same time. The hacker can take advantage of this and insert his code at the wrong time.

Alert for Xerox FreeFlow and Git Lab

CERT has also issued an alert for Xerox FreeFlow Core and GitLab Community Edition and Enterprise Edition. Xerox FreeFlow Core software makes printing work easy. The problem in this is that the software does not handle XML input correctly.