teleren/devto huggingface dataset:
Compatibilty problem
Tags: openpyxl, excel, pyhotn, msexcel
Published: 2023-06-20 06:16:45

I am creating the excel file with the help of openpyxl and pandas after downloading the file i am not able to open in ms-excel,its opening one dialoge box with text "We found a problem with some content in 'Location.xlsx". Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes" but with other platform like gsheet i am not getting any problem. i am using ms-excel 2019
Optimise your performance with memoization
Tags: javascript
Published: 2023-06-20 06:02:00

---
title: Optimise your performance with memoization
published: true
description: Brief explanation of the memoization concept
tags: javascript
published_at: 2023-06-20 06:02 +0000
---

Memoization allows us to increase the performance of a function by caching its previously computed results.
Since JavaScript objects behave like associative arrays, they are ideal for use as caches. Whenever a memoised function is called, its parameters are used to index the cache. If data is present, then it can be returned, without executing the entire function. However, if the data is not in the cache, then the function is executed and the result is added to the cache.

```js
const fancyMemo = () => {
        let cacheStore = {};
        return (value) => {
            if (value in cacheStore) {
                console.log('Retriving from cache');
                return cacheStore[value];
            } else {
                console.log('Calculating...');
                let result = [...new Array(value).keys()]
                cacheStore[value] = result
                return result;
            }
        }
}

const newMemo = fancyMemo();
console.time('First call')
newMemo(100000) // The first time all the calculation will be done...
console.timeEnd('First call')
console.time('Second call')
newMemo(100000) // The second time the value stored in the cache will be returned
console.timeEnd('Second call')
```

As you can see in the example, the first execution takes
7.97607421875 ms, while the second one takes much less time to execute because it is making use of the cache.

Memorization is a programming technique widely used in the most used frameworks and libraries, so it is advisable to know it from its basic and native implementation.

I hope you found it useful.
Miracle Watt - Results, Benefits, Pros, Cons, Uses, Scam Or Legit?
Tags: python, webdev, javascript, beginners
Published: 2023-06-20 05:59:32

[Miracle Watt](https://www.outlookindia.com/business-spotlight/miracle-watt-buyers-alert-miraclewatt-complaints-and-results-news-240676) when are the particular carbs. I see low carb advocates eating low carb but nonetheless eating processed food that will likely them mass. The Miracle Watt reviews will let you why each system perfect for though and most people that follow any sort of structure for 3-4 weeks will suffer some weight so it looks like to work.
[https://www.outlookindia.com/business-spotlight/miracle-watt-buyers-alert-miraclewatt-complaints-and-results-news-240676](https://www.outlookindia.com/business-spotlight/miracle-watt-buyers-alert-miraclewatt-complaints-and-results-news-240676)
https://www.outlookindia.com/outlook-spotlight/liberty-cbd-gummies-you-must-know-customer-feedback-before-buying-news-223571
https://www.outlookindia.com/outlook-spotlight/prime-male-reviews-2023-scam-or-legit-primemale-ingredients-and-fake-complaints-exposed--news-258281
https://www.outlookindia.com/outlook-spotlight/-alert-2023-synogut-gut-health-formula-hidden-dangers-exposed-you-must-see-this-news-248374/
https://soundcloud.com/miracle-watt-421659497/miraclewattprice
https://www.linkedin.com/events/miraclewatt7076784507927896065/
https://www.scoop.it/topic/miracle-watt-by-miracle-watt-9
https://www.instagram.com/gdsakhuva/
https://www.sportsblog.com/miraclewattfact/miracle-watt-benefits-price-pros-cons-warnings-complaints/
https://medium.com/@miraclewattinfo/about
https://hashnode.com/@miraclewattfact
https://www.sympla.com.br/produtor/miraclewattbenefits
https://fixr.co/event/miracle-watt-results-benefits-pros-cons-tickets-671794560
https://sway.office.com/mMFeLbr5k7TtNaOw
https://djpod.com/miraclewattbenefits
https://jobs.blognone.com/company/miracle-watt/job/miracle-watt-resul-T88a
https://www.bonfire.com/store/miracle-watt-results/ 
https://miraclewattprice.blogspot.com/2023/06/blog-post.html 
https://twitter.com/MiracleWat58097
Making the MOD player available
Tags: webaudio, javascript, retrocomputing, demoscene
Published: 2023-06-20 05:45:00

The MOD player is now available publicly for anyone to use, without having to clone a repository and include any JavaScript files manually. To include the MOD player in your own web site, you can now simply add the following line to your HTML:

```html
<script type="module">
    import { ModPlayer } from 'https://atornblad.se/files/js-mod-player/player.js';
    const player = new ModPlayer(new AudioContext());
    await player.load(URL_OF_YOUR_MOD_FILE);
    window.addEventListener('click', () => player.play());
</script>
```

## Content Security Policy and the browser security model

If you encounter any problems with including the MOD player in your web site, it might be because of Content Security Policy (CSP). Some web sites use a strict CSP that prevents pages from loading JavaScript files from other domains. If you are the owner of the web site, you can add the following HTTP header to allow the MOD player to load:

```http
Content-Security-Policy: script-src 'self' https://atornblad.se
```

If you cannot add HTTP headers, you can instead add the following line to the `head` of your HTML:

```html
<meta http-equiv="Content-Security-Policy" content="script-src 'self' https://atornblad.se">
```

Another thing I discovered when making the MOD player available was that the browser security model prevents external scripts from creating an `AudioContext`. To work around this, the MOD player now accepts an AudioContext as a parameter to the constructor. This is the reason why the example above passes `new AudioContext` as an argument to the `ModPlayer` constructor. 

I highly recommend that you use the player by importing it from `atornblad.se/files/js-mod-player/player.js` instead of copying the JavaScript files to your own web site. This way, you will always get the latest version of the MOD player, and you will not have to worry about the browser security model or the Content Security Policy of your web site. The example above is a good starting point, and the full documentation of the `ModPlayer` class can be found on [atornblad.se/js-mod-player](https://atornblad.se/js-mod-player/).

The player should work from any web site, on any modern browser. As a small proof of concept, I have also created [a pen](https://codepen.io/atornblad/pen/wvXEPNY) for you.

{% codepen https://codepen.io/atornblad/pen/wvXEPNY %}

You can try this solution at [atornblad.github.io/js-mod-player](https://atornblad.github.io/js-mod-player).

The latest version of the code is always available in [the GitHub repository](https://github.com/atornblad/js-mod-player).
if you count the website link clicks
Published: 2023-06-20 05:42:14

In Django, you can count the number of times a link has been clicked by implementing a click tracking system. Here's a general outline of how you can achieve this:

1. Create a model to represent the link clicks:
   ```python
   from django.db import models

   class LinkClick(models.Model):
       link = models.URLField()
       clicked_at = models.DateTimeField(auto_now_add=True)
   ```

2. Create a view function or class-based view to handle the link clicks:
   ```python
   from django.shortcuts import redirect
   from .models import LinkClick

   def track_link_click(request):
       # Extract the link from the request parameters
       link = request.GET.get('link')

       # Save the link click in the database
       LinkClick.objects.create(link=link)

       # Redirect the user to the intended destination
       return redirect(link)
   ```

3. Set up a URL pattern to map the tracking view:
   ```python
   from django.urls import path
   from .views import track_link_click

   urlpatterns = [
       path('track/', track_link_click, name='track_link_click'),
   ]
   ```

4. Modify your original link to point to the tracking URL:
   ```html
   <a href="/track/?link=www.anjoktechnologies.in">Click me!</a>
   ```

With this setup, when a user clicks on the link, the `track_link_click` view will be called. It saves the clicked link in the `LinkClick` model and then redirects the user to the original destination.

To retrieve the total number of clicks for a specific link, you can use the Django ORM to query the `LinkClick` model:
```python
from .models import LinkClick

def get_link_click_count(link):
    return LinkClick.objects.filter(link=link).count()
```

This example provides a basic implementation of tracking link clicks in Django. You can extend and customize it based on your specific requirements, such as capturing additional data, implementing authentication, or associating clicks with users.
Logger Service
Published: 2023-06-20 05:37:00

This is a simple example of how you can create a service that logs the date and time every 5 seconds. This service will also log when it's created and when it's stopped.

This example uses a Handler and Runnable to schedule the logging task every 5 seconds.

Please note that this is a simple example and doesn't handle all edge cases. For example, it doesn't handle the case where the device is rebooted or the app is force stopped.

`import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class LoggingService extends Service {
    private static final String TAG = "LoggingService";
    private Handler handler;
    private Runnable runnable;
    private SimpleDateFormat dateFormat;

    @Override
    public void onCreate() {
        super.onCreate();
        Log.d(TAG, "Service created");

        handler = new Handler();
        runnable = new Runnable() {
            @Override
            public void run() {
                logTime();
                handler.postDelayed(this, 5000);
            }
        };

        dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());

        logToFile("Service created at " + dateFormat.format(new Date()));
        handler.post(runnable);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return START_STICKY;
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        handler.removeCallbacks(runnable);
        logToFile("Service stopped at " + dateFormat.format(new Date()));
        Log.d(TAG, "Service stopped");
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    private void logTime() {
        String currentTime = dateFormat.format(new Date());
        logToFile("Current time: " + currentTime);
        Log.d(TAG, "Current time: " + currentTime);
    }

    private void logToFile(String message) {
        File file = new File(getFilesDir(), "log.txt");
        try (FileOutputStream fos = new FileOutputStream(file, true)) {
            fos.write((message + "\n").getBytes());
        } catch (IOException e) {
            Log.e(TAG, "Error writing to file", e);
        }
    }
}`
To start the service, you can use the following code in your activity:


`Intent intent = new Intent(this, LoggingService.class);
startService(intent);`

To stop the service, you can use the following code:


`Intent intent = new Intent(this, LoggingService.class);
stopService(intent);`

Remember to declare the service in your AndroidManifest.xml:


`<service android:name=".LoggingService" />
`
Please note that starting from Android Oreo (API level 26), the system imposes restrictions on running background services when the app itself is not in the foreground. In such cases, you should consider using a foreground service.
Natural Vue defineProps
Tags: vue, javascript, frontend, discuss
Published: 2023-06-20 05:35:26

What if we have something like this?

```js
const props = defineProps(
  /**
   * @param {{
   *   foo: boolean,
   *   bar: number,
   * }} props
   */
  (
    props = {
      foo: false,
      bar: 0,
    }
  ) => props
)
```

in typescript
```ts
const props = defineProps(
  (
    props: {
      foo: boolean,
      bar: number,
    } = {
      foo: false,
      bar: 0,
    }
  ) => props
)
```
PDF SDK Product: ComPDFKit
Tags: pdf, sdk, conversion, api
Published: 2023-06-20 05:31:53

PDF Technologies has focused on PDF for years. The PDF solution ComPDFKit includes PDF SDK, Conversion SDK, Web Viewer, API Tools, Free Online Converter, and Document AI. We can also provide Software, SDK, and API solutions for industries like education, government, Construction, Aviation, etc.

ComPDFKit is the SDK and API product we provided that allows developers or companies to integrate PDF editing, annotating, converting, form filling, digital signing, comparing, measuring, and redacting into any device.


- Free Trial: https://www.compdf.com/contact-sales

## Contact:
[Website EN](https://www.compdf.com/?utm_source=platform_article_dev.to&utm_medium=platform_article_dev.to&utm_campaign=outer_chain): https://www.compdf.com/
Website CN: https://www.compdf.com/zh-cn
Free Trial: https://www.compdf.com/contact-sales
Linkedin: https://www.linkedin.com/company/pdf-technologies-pte-ltd/
Twitter: https://twitter.com/compdfkit
Facebook: https://www.facebook.com/profile.php?id=100085132077341

## Solutions:
- Solutions for Aviation: https://www.compdf.com/solutions-aviation-industry
- Solutions for Education: https://www.compdf.com/solutions-education-industry
- Solutions for Government: https://www.compdf.com/solutions-government-industry
- Solutions for Construction: https://www.compdf.com/solutions-construction-industry

 
 
## ComPDFKit Products Include:

**ComPDFKit API:** Make API requests and streamline your workflows with secure and reliable PDF API. It's easy to integrate PDF editing, PDF conversion, watermark, OCR, and more features.

**ComPDFKit SDK:** ﻿ComPDFKit allows companies, organizations, small businesses, and developers to integrate viewing, annotating, editing, converting (PDF to/from Office, Images, HTML, RTF, CSV, PDF/A, etc.), filling, encrypting, merging, comparing, redacting, OCR, and signing PDF documents in their applications or products.﻿

### We Can Provide:﻿﻿
-  First-rate PDF SDK Solutions:
Generate the functions of creating, modifying, converting, merging, and splitting PDF files with Objective-C, C#, C++, Swift, Kotlin, JavaScript, and Java PDF libraries in your applications.

-  Advanced PDF Conversion SDK:
High-quality PDF Conversion SDK supports converting PDF from or to MS Office (Word, PowerPoint, Excel) and other formats like HTML, Text, CSV, RTF, PDF/A, Images, and more.
 
-  ComPDFKit API Tools:
ComPDFKit API allows you efficiently process PDF documents. Fast and easy integration enables you to reduce development and support costs.
web3.js vs ether.js
Published: 2023-06-20 04:50:55

`
Both web3.js and ethers.js are popular JavaScript libraries used for interacting with the Ethereum blockchain and developing decentralized applications (dApps). While they serve similar purposes, there are some differences in their design and usage.

## Complexity
In terms of complexity, web3.js tends to have a steeper learning curve compared to ethers.js. This is partly because web3.js is more feature-rich and supports multiple Ethereum standards like ERC-20 and ERC-721, whereas ethers.js focuses primarily on providing a simpler and more intuitive API for interacting with Ethereum.

## API Design
Ethers.js is known for its clean and straightforward API design, making it easier to understand and work with. It provides a more object-oriented approach and aims to have a consistent and intuitive interface for interacting with Ethereum. Web3.js, on the other hand, has a larger API surface and can sometimes be more verbose and complex to work with.

## Modularity
Ethers.js is built with modularity in mind, allowing developers to pick and choose the specific components they need. This can make it more lightweight and efficient for certain use cases. Web3.js, while also modular to some extent, tends to be more monolithic in its architecture.

## Community Support
Web3.js has been around for longer and has a larger community due to its early adoption and association with the Ethereum ecosystem. As a result, you may find more resources, tutorials, and community support available for web3.js. However, ethers.js has been gaining popularity and community support as well, and its community is growing.

**Ultimately, the choice between web3.js and ethers.js depends on your specific use case and preferences. If you prefer a more feature-rich library with extensive Ethereum standard support, and you are willing to invest more time in learning its intricacies, web3.js may be a better fit. On the other hand, if you value simplicity, clean API design, and modularity, ethers.js could be a more suitable choice.**
Here is how ChatGPT helped me to fix my piece of code.
Tags: chatgpt, javascript, beginners, tutorial
Published: 2023-06-20 04:48:25

hey correct my javascript code which i need in es6 version


Of course! I'll be happy to help you convert your JavaScript code to the ES6 version. Please provide me with the code you'd like me to assist you with.

```
'use strict';

class Car {
  constructor(make, speed) {
    this.make = make;
    this.speed = speed;
  }

  accelerate() {
    this.speed += 10;
    console.log(`${this.make} is going at ${this.speed} km/h`);
  }
  brake() {
    this.speed -= 5;
    console.log(`${this.make} is going at ${this.speed} km/h`);
  }
  car1 = Car('BMW', 120);
  car2 = Car('Mercedes', 95);
}
accelerate();
```
Sure! I have made some corrections to your code to align it with ES6 syntax. Here's the corrected code:

```javascript
'use strict';

class Car {
  constructor(make, speed) {
    this.make = make;
    this.speed = speed;
  }

  accelerate() {
    this.speed += 10;
    console.log(`${this.make} is going at ${this.speed} km/h`);
  }

  brake() {
    this.speed -= 5;
    console.log(`${this.make} is going at ${this.speed} km/h`);
  }
}

const car1 = new Car('BMW', 120);
const car2 = new Car('Mercedes', 95);

car1.accelerate();
```

Here's what has changed:

1. Removed the `car1` and `car2` assignments from within the class definition as they should be separate instances outside the class.
2. Created `car1` and `car2` instances using the `new` keyword and the `Car` constructor.
3. Called the `accelerate` method on the `car1` instance outside the class.

Now, you can run the code and it should work as expected. Let me know if you need any further assistance!
[Next.js] User authentication using Cookies with JWT vs NextAuth
Tags: nextjs, cookies, jwt, nextauth
Published: 2023-06-20 04:40:42


## Which Auth Do I Use For My Next.js App?

---

### Motivation

During the development of my web app "Project Managed," which I built following a tutorial on Frontend Masters, I came across an interesting question: **Why did the tutorial use cookies for user authentication instead of NextAuth?** This sparked my curiosity, and I began researching to find an answer.

### Comparison: Cookies with JWT vs NextAuth for User Authentication

|  | Cookies with JWT | NextAuth |
| --- | --- | --- |
| Implementation | Manual handling of JWT and cookies | Leveraging NextAuth library |
| JWT Management | Custom implementation required | Handled by NextAuth |
| Authentication | Custom server-side validation | NextAuth handles validation |
| Authorization | Custom implementation required | NextAuth provides solutions |
| Session Management | Manual handling of sessions | NextAuth handles sessions |
| Security | Can set HttpOnly flag for cookies | Provides built-in security |
| Token Inclusion | Manual inclusion in each request | Automatic inclusion with cookies |
| Scalability | Requires custom scaling and management | Simplified scalability and management |
| Ecosystem | Works with any server-side framework or technology | Built for Next.js ecosystem |
| Complexity | Moderate complexity, requires understanding of JWT handling | Simplifies authentication implementation |
| Flexibility | Provides more control over token management and customisation | Offers predefined solutions and flexibility within NextAuth |
| Development Time | Requires additional development time for implementation | Can save development time with built-in functionality |
| Community Support | Wider community support and resources available | Active community and support for NextAuth |
- **Cookies with JWT**: Provides manual handling of JWT and cookies, requires custom implementation for token management and session handling, offers security benefits with the ability to set HttpOnly flag, and allows for more control and flexibility at the cost of moderate complexity and additional development time.
- **NextAuth**: Simplifies authentication implementation with built-in solutions for token validation, session management, and security, offers automatic token inclusion with cookies, provides scalability and ecosystem compatibility within the Next.js framework, and saves development time with predefined functionality and active community support.


### Conclusion

Through my exploration, I discovered that the **choice between cookies and NextAuth is more a matter of preference rather than one being inherently better than the other.** It’ll depend on individual preferences, project requirements, familiarity with the technologies involved, and the desired level of control, customisation, and simplicity in authentication implementation.