teleren/devto huggingface dataset:
Basic codes in java.
Tags: beginners, programming, productivity
Published: 2022-07-06 16:51:56

## print

public class hk{
public static void main(String[] agrs){
System.out.println("hello people");
}
}

## String

<u>length.</u>
public class bm{
    public static void main(String[] agrs){
        String name = "khushi thakuri";
        System.out.println(name.length());
    }
}
result= 14


<u>Replace</u>

public class fk{
    public static void main(String[] agrs){
        String name = "khannal";
        String name2 = name.replace('k','t');
        System.out.println(name2);
result=thannal

<u>Substring</u>
public class hk{
public static void main(String[] agrs) {
String name = "khusi and khanaa";
System.out.println(name.substring(0,5));
}
}
result=khusi

<u>Concatenate</u>
public class main{
public static void main(String[] agrs){
String name1 = "baba";
String name2 = "mama";
String name3 = name1 +"and" + name2;
System.out.println(name3);
}
}
result= baba and mama

<u>charAt</u>
 public class ss{
public static void main(String[] agrs){
String name = "khusi";
System.out.println(name.charAt(1));
}
}
result = h
My First 5 Certifications on Kaggle
Tags: datascience, machinelearning, beginners, deeplearning
Published: 2022-07-06 16:46:23

Dear, Everyone. Thank you being with my AI journey.

I mentioned that I had already start to learn on Kaggle Courses before and I keep learning everyday. By today, I completed 5 tutorials on Kaggle and earns 5 certifications.

1. Intro to Programming
2. Python
3. Intro to Machine Learning
4. Pandas
5. Intermediate to Machine Learning

You can find all my work on my Github repository.
https://github.com/levintech/kaggle-courses

Thanks for reading my first post carefully.
To encourage me continue work, please follow me on Dev.to and Github.

https://dev.to/levintech
https://github.com/levintech

Best Regards.
5 Sites for HTML/CSS templates
Tags: html, css, webdev, beginners
Published: 2022-07-06 16:32:27

I thought you might enjoy some free HTML/CSS templates.
Looking forward to see your creations!

- [Free CSS](https://www.free-css.com/) - You can even see [demos of templates](https://www.free-css.com/free-css-templates/page279/grad-school)
- [HTML5 templates](https://html5-templates.com/) - Some of these are not great to be honest wtf??
- [Mashup Template](http://www.mashup-template.com/) - Nice [preview on different devices](http://www.mashup-template.com/preview.html?template=energy)
- [UICookies](https://uicookies.com/demo/#primex) 
- [W3layouts](https://w3layouts.com/)

What's your go-to templates website?
Do you simply create a website from scratch every time?
Kaedim | Made with Next JS
Published: 2022-07-06 16:23:38

![Kaedim | Made with Javascript | Next JS](https://res.cloudinary.com/madewithjavascript/image/upload/v1656359141/large_kaedim_made_with_next_js_3a6cc08644.png "Kaedim | Made with Javascript | Next JS")


### API for turning image to 3D model and integrating User Generated Content into 3D games.

> ### Turning 2D images into 3D content
> Create quickly in 3D with zero 3D modeling knowledge
> 
> Within your app, enable your end-users to upload their 2D inspiration and easily create their own 3D content for customising and populating the game.


Read More here about Kaedim and find the link to view the showcased website

[Kaedim | Made with Javascript | Next JS](https://madewithjavascript.club/posts/kaedim-made-with-next-js)

## Check out more such amazing projects on our website

[Made with Javascript](https://madewithjavascript.club)

## Want us to feature your project

[Submit your Project to Made with Javascript](https://madewithjavascript.club/submit-project)


You can also write to us for any of your queries at:

[Email Made with Javascript](mailto:madewithjavascript@gmail.com)

## Project already shared on our social media handles.

| SocialMedia | SharedLink |
| ----------- | ---------- |
| Twitter | [Kaedim on Twitter](https://twitter.com/withjavascript/status/1544717588739117057?s=20&t=-JBhGG9xSrHxJ0jy_KsKXw)
 |
| Medium | [Kaedim on Medium](https://medium.com/@madewithjavascript/kaedim-made-with-next-js-7317216909aa)
 |
| Facebook | [Kaedim on Facebook](https://www.facebook.com/madewithjavascript/posts/pfbid02wxpPUeEEwstJhLdM5drZaTCyjTbqY89f7qMFHqUU6FpwgnYChstYnkzfGH1ydVDHl)
 |
| Tumblr | [Kaedim on Tumblr](https://www.tumblr.com/blog/view/madewithjavascript/689045057511309312?source=share)
 |
| LinkedIn | [Kaedim on LinkedIn](https://www.linkedin.com/feed/update/urn:li:activity:6950483454346104833)
 |
| Pinterest | [Kaedim on Pinterest](https://pin.it/2j5bQgu)
 |


Filled Under:


 - [Made with Javascript](https://madewithjavascript.club)
 - [Made with Next JS](https://madewithjavascript.club/categories/next-js)

Make sure to give this post ❤ 50 ❤ hearts, click the 🦄 unicorns 🦄 and follow 👉 @madewithjavascript 👈 for more such awesome showcases. Show you love for the people who have worked so hard!
How I did a turbo mode system in GCP for cheap
Published: 2022-07-06 16:07:24

Cloud instances are very useful when you need compute power but don't want to buy machines and deal with the maintenance burden of maintaining physical machines, or just don't need them long enough to make it worth buying hardware. The idea is basically rent a remote machine for the time you need them and pay exactly for what you used.

This can be a pretty simple concept but can be very hard to implement. There are literally hundreds, or even thousands, of combinations and use cases that cloud providers support. Our focus on this article is the most basic use case ever: you rent a VM and pay for how much time and space it uses.

This article is focused on the Google Cloud Platform quirks, and my specific project is a NixOS VPS to use GPUs in the cloud for cheap.

# The strategy
Now (6/7/2022) there are some resources that are free forever, like:
- 30GB of total balanced storage
- A e2-micro (0.5VCPU burstable to 2VCPU) instance for the whole month
- 1GB of egress network in almost all continents
- Free egress network for Google services

The idea is to use Terraform to migrate one instance to TURBO MODE to do the beefy stuff, and use the same system in an e2-micro for configuration, preparation, uploads, maintenance and so on. 

The turbo instance can be a spot instance for extra cheap. Spot instances are cheaper because these can be interrupted at any time.

My OS of choice is NixOS because of the code based construction and, in my opinion, is more convenient to setup and replicate. I can replicate the same setup as many times as I want doing specific customizations for one specific deployment if I want.

# The code
The code I used in this experiment is stored in my [dotfiles repo](https://github.com/lucasew/nixcfg).

The Terraform file I am using for this experiment is stored in `infra/gcp.tf`. The Terraform state is stored in Terraform cloud.

The NixOS machine that I run in GCP is defined in `nodes/vps`.

There are some CUDA specific stuff in the file `nvidia.nix`. Tesla K80 doesn't support the latest driver so I had to use legacy 470. Tested with some Blender renders and it's working fine with CUDA and works correctly for what I need.

# How to deploy
To deploy the instance in normal mode I run the following command in the infra folder:
```bash
terraform apply
```

And if I want to migrate it to the turbo instance I run the following command in the infra folder:
```bash
terraform apply -var 'modo_turbo=true'
```

# Final thoughs
It was a pretty challenging project, and I though I would spend much more money in this. I did this tiering stuff in two days. I took a lot of time to figure out how to configure CUDA then I realized that `hardware.opengl.enable` must be enabled to allow software to find the CUDA driver 🤡.

# Future work
I need to find a way to automatically turn off the turboed machine when the job is over, automatically. I might do some wizardry with systemd units. I will not probably update this post. The code that will be changed for that project is in the VPS folder or some common module that I could use in any of my machines.
Are you a function or a problem solver?
Tags: management, productivity
Published: 2022-07-06 15:59:06

These quotes from Great Work Great Career by Covey, served as a paradigm shift for me and how I manage software development teams effectively.  

First Covey tells a story about a 30 year old man who had tremendous potential after graduating from college.  

> I asked him several questions.
> “What is your company’s highest strategic priority right now?’ He couldn’t say.  
> “I make out a report once a week for my boss…but I don’t think he reads it.”
> This young man looked crestfallen.  I felt deeply for him - his energy had drained out of him, his vigor was gone, his dreams of making a great contribution had shrunk down to fulfilling a mere job description.  He had allowed himself to be reduced to a ‘job description with legs’

Then Covey explains Peter Drucker’s concept of a Knowledge worker:

> In the Industrial Age, people simply asked, “What’s my job description?” Now, according to Peter Drucker, “Knowledge Age workers must learn to ask, ‘What should my contribution be?’ … If you have an Industrial Age paradigm, you see yourself as a tool used by others.  On the other hand, if you have a Knowledge Age paradigm, you see yourself as a solution provider who brings a singular set of tools to solving significant problems.  

> Industrial Age Paradigm - I am my function.  I’m a job seeker. I’m a gear in an organizational machine.
> Knowledge Age Paradigm - I make a significant contribution.  I’m a problem solver.  I am a human being with a portfolio of unique strengths - talents, passion and a conscience.”

> Times of London reports, “Many workers are so ill at ease in the office that they spend a large part of the day simulating work.  That generates more negative stress than excessive working.  The result is serious but hidden depression in the office.”
> You are a knowledgeable, skilled, proactive, thinking and creative human being with unlimited potential; and you can leverage that portfolio of strengths to make your own unique contribution.


Another takeaway here is how this relates to *burnout*.  Working on a software development team with an Industrial Age Paradigm is a great way to burnout.  


Great articles diving into the concept of a knowledge worker:
[Peter Drucker – The Focus on Contribution](https://www.linkedin.com/pulse/peter-drucker-focus-contribution-umar-iqbal#:~:text=In%20his%20book%2C%20The%20Effective,it%20comes%20to%20being%20effective.)
[Knowledge Workers - Who They Are and What They Do](https://corporatefinanceinstitute.com/resources/knowledge/other/knowledge-workers/)
[Making Knowledge Workers More Productive: Insights from the Works of Peter F. Drucker | by Frank J. Wyatt | On Business Process Management and Workflow Automation | Medium](https://medium.com/business-process-management-software-comparisons/making-knowledge-workers-more-productive-insights-from-the-works-of-peter-f-drucker-e3fe6ef91df9)
Ball Catcher : Have you seen part 1?
Tags: opensource, microservices, tutorial, luos
Published: 2022-07-06 15:55:55

A few days ago we showed you how to create a hard real-time system through multiple electronic boards with Luos.

{% embed https://www.youtube.com/embed/BtMSTrTEqqs %}

Viktoria invites you to watch or rewatch this video and don't worry, the sequel is already being edited 🙂
Parse Server starter in TypeScript (FR)
Published: 2022-07-06 15:51:53

Hello à tous,

Petite contribution de ma part, j'espère que ça aidera plus d'un.

Il s'agit d'un petit projet de base pour démarrer votre application mobile.

Il vous permettra de deployer rapidement un Backend As a Service (BaaS) comme Firebase sur votre machine locale, vps ou instance cloud.

Fonctionnalité disponible:

- Authentification

- Mode de passe oublié

- Notification Push

- Temps réel

- Calcule de coordonnée GPS ...



Détails technique:

- Node Js

- Parse Server

- Express

- MongoDB oou PostgreSQL

- FCM

- SendGrid



Je vous laisse un sondage pour mettre à votre disposition un projet de prêt entièrement.



Lien: https://github.com/lordkkjmix/parse-server-starter-ts

#ParseServer #nodejs #Express #Geek4Africa #openSource
create generic BaseService working with TypeORM
Published: 2022-07-06 15:47:34

In this post I will show you a way to create a base domain service to obtain less code result when working with [TypeORM](https://typeorm.io/).

# Requirements
* Typescript knowledge
* TypeORM knowledge
* [Javascript's Mixin](https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/) 

# Base Service Design
```typescript
import { EntityTarget, Repository, DataSource } from 'typeorm';

export const BaseDomainService = <T>(entity: EntityTarget<T>) => {
  class DomainServiceMixin {
     protected repository: Repository<T>;
     
     constructor(ds: DataSource) {
       this.repository = ds.getRepository(entity);
     }
  };

  return DomainServiceMixin;
}
```

Make sure your tsconfig.json do not turn on `declaration` option.

# Inherit from Domains
for example you have User & Post domains in your sources, so I can simple to create service for each domains as below explain.

## UserSerivce
```typescript
import { BaseDomainService } from 'basedomainservicepath';
import { User } from 'typeorm user entity paths';

export class UserService extends BaseDomainService(User) {
    async getAllUser(): Promise<User[]> {
       return await this.repository.find();
    }

    //...
}
```

## PostService
```typescript
import { BaseDomainService } from 'basedomainservicepath';
import { Post } from 'typeorm post entity paths';

export class PostService extends BaseDomainService(Post) {
    async deletePostById(id: number): Promise<boolean> {
       const result = await this.repository.delete(id);

       return !!result.affected;
    }

    //...
}
```

# Conclusion
By implementing Base Service in this way you can prevent repeating implement construct for each domain service.

In next post I will show you how to using with other DI package like [awilix](https://github.com/jeffijoe/awilix) , [tsyringe](https://github.com/microsoft/tsyringe), etc...
GNOME Night Light Keyboard Shortcut
Tags: linux, gnome, trick, beginners
Published: 2022-07-06 15:26:13

As we all know, our electronic devices screens emits blue light which is bad for our eyes.

Nowadays almost every operating system ships with built in protection against blue light.

In this guide I will show you how to make the *night light filter* of GNOME DE super accessible.



## How to Setup the Night Light Keyboard Shortcut in GNOME?
1. Open your systems **Settings** application. Either press the `SUPER` key and type `settings` or press `SUPER + A` and look for the **Settings** application.
2. Now scroll through the left sidebar of your **Settings** application until you see a list item named **Keyboard**. Click on it. ![](https://i.ibb.co/tmBgqwD/e9827b710888.png)
3. Scroll down and you'll find a section named **Keyboard Shortcuts**. Click on the button that says **View and Customize Shortcuts**. Click on it. ![](https://i.ibb.co/3YCFTgH/524aa13b3b1e.png)
4. Scroll to the very bottom of the new modal screen that popped up after your last action. ![](https://i.ibb.co/yQG9n07/5faf96a1f745.png)
5. You'll see an item named **Custom Shortcuts**. Click on it.
6. Click on the **plus icon button** on the new screen and a new modal titled **Add Custom Shortcut** will show up.
7. Enter an appropriate name for the shortcut in **Name** input field. *Example: Turn Night Light On*. ![](https://i.ibb.co/PrRzLnJ/ffa662006942.png)
8. Now in the **Command** input field, enter this command:
```bash
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
```
9. Set a keyboard shortcut by clicking on the **Set Shortcut** button. For example: `SUPER + N`.
10. Now that we are able to turn on our night light with our keyboard, we should repeat the steps 1 to 7 and then follow the remaining steps to setup a turn off method using our keyboard. 
11. Add this command in input:
```bash
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled false
```
12. And finally add the keyboard shortcut. For example: `SUPER + SHIFT + N`

## It's Not Working!
It may not work when you try out the shortcut you just set. Well, this is because by default GNOME set's the *Night Light Preference* to work from sundown till sunrise. So where you're from, the sun probably hasn't sat yet.

You need to manually override this preference, to do that, open **Settings** again, but this time look for the **Display** item in the left sidebar. Once you click it, you'll see two different tabs in the main pan; One of them reads **Night Light**! Click that and the night light configurations will appear.
Here, select the night light **schedule** to be **manual** and set the time range to be `8PM` to `8PM`, doing this will ensure that your night light is always active!

Now whenever you press `SUPER + N` (or the shortcut that you set) the night light will turn on. And to turn it off press `SUPER + SHIFT + N` (or the shortcut that you set to turn it off).
1900. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-06 15:08:44

```
class Solution {
 public:
  vector<int> earliestAndLatest(int n, int firstPlayer, int secondPlayer) {
    dp.resize(n + 1, vector<vector<P>>(n + 1, vector<P>(n + 1)));
    const auto [a, b] = solve(firstPlayer, n - secondPlayer + 1, n);
    return {a, b};
  }

 private:
  typedef pair<int, int> P;
  // dp[i][j][k] := (earliest, latest) pair w/ firstPlayer is i-th player from
  // front, secondPlayer is j-th player from end, and there're k people
  vector<vector<vector<P>>> dp;

  P solve(int l, int r, int k) {
    if (l == r)
      return {1, 1};
    if (l > r)
      swap(l, r);
    if (dp[l][r][k] != pair<int, int>(0, 0))
      return dp[l][r][k];

    int a = INT_MAX;
    int b = INT_MIN;

    // enumerate all possible positions
    for (int i = 1; i <= l; ++i)
      for (int j = l - i + 1; j <= r - i; ++j) {
        if (i + j > (k + 1) / 2 || i + j < l + r - k / 2)
          continue;
        const auto [x, y] = solve(i, j, (k + 1) / 2);
        a = min(a, x + 1);
        b = max(b, y + 1);
      }

    return dp[l][r][k] = {a, b};
  }
};

```


#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/the-earliest-and-latest-rounds-where-players-compete/
¿Sabes cuanto mide un "CSS Pixel"?
Tags: webdev, digitalart, javascript, html
Published: 2022-06-23 00:38:49

A traves de las pantallas, existe una medida virtual, que es el Pixel CSS,  es compleja su definición, dejo unas ligas sobre mi investigación, luego escribo mas a detalle algo sobre el concepto, por que es muy necesario entenderlo bien cuando nos piden algun proyecto en html canvas.  

https://drafts.csswg.org/css-values/#absolute-lengths

> The term CSS pixel is synonymous with the CSS unit of absolute length px — which is normatively defined as being exactly 1/96th of 1 inch.

Sin embargo, esta norma no se aplica estrictamente, por eso mejor no la compruebes con tu regla, pero tranquilo no te vuelvas loco por eso, simplemente relajate y dejalo ser. 

https://riptutorial.com/html5-canvas/example/7515/canvas-size-and-resolution

https://www.w3.org/TR/css3-values/#reference-pixel

https://hacks.mozilla.org/2013/09/css-length-explained/

https://stackoverflow.com/questions/21680629/getting-the-physical-screen-dimensions-dpi-pixel-density-in-chrome-on-androi

https://stackoverflow.com/questions/53233096/how-to-set-html5-canvas-size-to-match-display-size-in-device-pixels
2218. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-06 15:06:15

```
class Solution {
public:
    int maxValueOfCoins(vector<vector<int>>& A, int k) {
        int N = A.size(), m[1001][2001] = {};
        memset(m, -1, sizeof(m));
        function<int(int, int)> dp =[&](int i, int j) {
            if (i == N) return 0;
            if (m[i][j] != -1) return m[i][j];
            int ans = dp(i + 1, j), sum = 0;
            for (int t = 1; t <= j && t <= A[i].size(); ++t) {
                sum += A[i][t - 1];
                ans = max(ans, dp(i + 1, j - t) + sum);
            }
            return m[i][j] = ans;
        };
        return dp(0, k);
    }
};
```

#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/maximum-value-of-k-coins-from-piles/
1840. Leetcode Solution in CPP
Tags: cpp
Published: 2022-07-06 15:03:19

```
class Solution {
 public:
  int maxBuilding(int n, vector<vector<int>>& restrictions) {
    vector<vector<int>> A(restrictions);

    A.push_back({1, 0});
    A.push_back({n, n - 1});
    sort(begin(A), end(A));

    for (int i = 1; i < A.size(); ++i) {
      const int dist = A[i][0] - A[i - 1][0];
      A[i][1] = min(A[i][1], A[i - 1][1] + dist);
    }

    for (int i = A.size() - 2; i >= 0; --i) {
      const int dist = A[i + 1][0] - A[i][0];
      A[i][1] = min(A[i][1], A[i + 1][1] + dist);
    }

    int ans = 0;

    for (int i = 1; i < A.size(); ++i) {
      const int l = A[i - 1][0];
      const int r = A[i][0];
      const int hL = A[i - 1][1];
      const int hR = A[i][1];
      ans = max(ans, max(hL, hR) + (r - l - abs(hL - hR)) / 2);
    }

    return ans;
  }
};

```
#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/maximum-building-height/
1819. Leetcode Solution in Java
Tags: java
Published: 2022-07-06 15:01:17

```
class Solution {
    public int countDifferentSubsequenceGCDs(int[] nums) {
        Set<Integer> set = new HashSet<Integer>();
        int max = 0;
        for (int num : nums) {
            set.add(num);
            max = Math.max(max, num);
        }
        int[] counts = new int[max + 1];
        for (int num : set) {
            for (int i = 1; i * i <= num; i++) {
                if (num % i == 0) {
                    counts[i]++;
                    if (i * i != num)
                        counts[num / i]++;
                }
            }
        }
        int count = 0;
        for (int i = 1; i <= max; i++) {
            if (set.contains(i))
                count++;
            else if (counts[i] > 0) {
                boolean flag = true;
                for (int j = i * 2; j <= max; j += i) {
                    if (counts[j] == counts[i]) {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                    count++;
            }
        }
        return count;
    }
}
```

#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/number-of-different-subsequences-gcds/
1787. Leetcode Solution in Java
Tags: java
Published: 2022-07-06 14:55:12

```
class Solution {
    public int minChanges(int[] nums, int k) {
        final int INF = 0x3f3f3f3f;
        final int MAX = 1 << 10;
        int length = nums.length;
        Map<Integer, Integer>[] groups = new Map[k];
        for (int i = 0; i < k; i++)
            groups[i] = new HashMap<Integer, Integer>();
        int[] size = new int[k];
        for (int i = 0; i < k; i++) {
            for (int j = i; j < length; j += k) {
                groups[i].put(nums[j], groups[i].getOrDefault(nums[j], 0) + 1);
                size[i]++;
            }
        }
        int[][] dp = new int[k + 1][MAX];
        Arrays.fill(dp[0], INF);
        dp[0][0] = 0;
        for (int i = 0; i < k; i++) {
            int low = Arrays.stream(dp[i]).min().getAsInt();
            Arrays.fill(dp[i + 1], low + size[i]);
            for (int j = 0; j < MAX; j++) {
                if (dp[i][j] != INF) {
                    for (Map.Entry<Integer, Integer> entry : groups[i].entrySet()) {
                        int key = entry.getKey(), value = entry.getValue();
                        int next = key ^ j;
                        dp[i + 1][next] = Math.min(dp[i + 1][next], dp[i][j] + size[i] - value);
                    }
                }
            }
        }
        return dp[k][0];
    }
}
```

#leetcode
#challenge
here is the link for the problem:
https://leetcode.com/problems/make-the-xor-of-all-segments-equal-to-zero/