teleren/devto huggingface dataset:
I Wrote a simple Up-time Monitor in Golang for My PHP Server
Tags: php, go, uptime, monitoring
Published: 2022-12-30 13:57:35

Up-time monitors are crucial because they help you keep track of your servers' availability and can help you detect outages quickly. This can help prevent prolonged downtime and ensure that your users are able to access your services as much as possible.

If you want to get started with an up-time monitor, there are plenty of options available like Pingdom, Datadog, and NewRelic. You can also choose to write one yourself if you know how to code.

As I only need a really simple and effective way to oversee my servers, and I already got a PHP server running for my blog, I decided to make one with PHP. 

## One problem: How to make PHP ping a website every x minutes?

As my server was built from an old Windows 7 PC, I decided to write a small Go program to make the website status check and store the data in RAM. The data was never written to disk unless it is required because writing data constantly to an SSD will quickly use up all its R/W count. 

Then you might be wondering, how could I pass information to PHP for displaying then? To access the results by the PHP script, I setup a simple http listener on the Go program and allow php to request the buffered online status from the go program using HTTP request.


![ui](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bgxvp8nbj39es34jd4aj.png)

This up-time monitor is simple to use and easy to integrate to your existing LAMP infrastructure. Simply download the binary and the php script, move them to a suitable location and start the binary. Your php will then show the uptime information of your servers every time you request that script.

I am only using this for my web servers. However, it is designed to be extendable in which different protocols can also be implemented without the need to change anything on the front-end side. If you want to try it out, here is the Github link for the project. Feel free to PR this project if you want more protocols to be supported!

{% embed https://github.com/tobychui/imusutm %}
What is key_buffer_size in MySQL?
Tags: devops, mysql, database, softwaredevelopment
Published: 2022-12-30 13:45:15


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sn7dowznzmu0i8ig46pe.jpg)1️⃣ Description
The key_buffer_size variable, also called the key cache, sets the buffer size for index blocks.

2️⃣ Usage
The key_buffer_size variable is used with the MyISAM storage engine in earlier versions of MySQL. 

When key_buffer_size is increased, more memory is allocated for the MySQL index buffer. More memory means less reliance on disk I/O and improved performance. For server situations still using MyISAM, set this value at 25 to 30% of available memory.

3️⃣ Configuration
key_buffer_size system variable can be configured using:
- the command line
- configuration file

4️⃣ Recommendations
When configuring the key_buffer_size variable, try to keep this value between 25% and 30% of the server's total memory. Be careful not to raise key_buffer_size too high (above 50%), or you will experience significant slowdowns due to paging. 

Ideally, keep the ratio between key_reads to key_read_requests as low as possible. This means that for every key_read from the disk, there are way more key_read_requests from memory.

The original article is in the first comment.
Confusing Company Layoffs
Tags: anonymous, career
Published: 2022-12-30 13:44:22

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment or if you want to ask your own anonymous question._ 

***

At the start of November the company I worked for starting making layoffs. Myself and another guy who were due to go on paternity leave in January were both made redundant...neither of us had been at the company long enough to get redundancy pay but they did cover our notice period whilst terminating us without notice on the spot.

A few days after layoffs I find another guy who started the job the same day as me at the same level for the same role is promoted.

I'd be interested in any thoughts on this (p.s this is the UK)

Thanks!
Mappings in Solidity
Tags: beginners, programming, blockchain, web3
Published: 2022-12-30 13:18:05

**Mappings in Solidity**
Have you ever heard of a hash table? If you've taken one or two computer science courses, chances are you have! If not, don't worry, you're in the right place. Let's jump in… 🛩
A hash table is a data structure that implements an associative array (also referred to as a "dictionary"). In an associative array, data is stored as a collection of key-value pairs. The position of the data within the array is determined by applying a hashing algorithm to the key.
As seen above, a key represents some data to be stored in the hash table data structure. That key is fed into a hash function which produces a hash value. That hash value dictates the index where the data, pertaining to the key, will be stored in the hash table. 🧩
Any time you "look up" (hence why hash tables are referred to as "dictionary" data structures!) a value by key, you will get whatever value is stored in the hash table back. Hash functions are deterministic, so you will always get the same value back as long as you provide the same key.
Hash Table Data Structures Are Efficient 🏎
Hash tables enable very efficient searching, in fact, they enable the "holy grail" O(1) search time. Hash tables do not require a brute force search or a for loop to look up a value thanks to the deterministic nature of hash functions! 🐐 You can just say, gimme whatever value is held at this key and the hash table data structure will comply. ⚡️

**Mappings**
In Solidity, hash tables are called mappings. They function pretty much the exact same as hash tables. 🤷
Mappings act as hash tables which consist of key types and corresponding value type pairs.
They are defined like any other variable type in Solidity:
**
mapping(_KeyType => _ValueType) public mappingName;**
**mapping(_KeyType => _ValueType) public mappingName;**
**
Useful for address Association
**Solidity mappings are particularly useful for address association.**
Thanks to mappings, you can associate an Ethereum address to a specific value. Here are a few examples we could use address association for:
Keeping track of how many sodas a user has purchased from a vending machine smart contract:
**mapping(address => uint) public sodasPurchased;.**
Flatlogic Platform Now Supports Microsoft SQL Server 2019!
Tags: webdev, microservices, programming, beginners
Published: 2022-12-30 12:45:45


We’re happy to announce that users can now select Microsoft SQL Server 2019 when creating a project on the  [Flatlogic Platform](https://flatlogic.com/crud-app). Right now this new database option is only available with NodeJS Sequelize.

![](https://b1694534.smushcdn.com/1694534/wp-content/uploads/2022/12/Screenshot-2022-12-30-at-14.30.18-1024x958.png?lossy=1&strip=1&webp=1)

Microsoft SQL Server 2019 is a relational database management system that provides a comprehensive set of tools for managing data. This new database option allows developers to take advantage of the latest features, including scalability, support for the latest versions of Windows and Linux, and more.

## About Flatlogic Platform

[Flatlogic Platform](https://flatlogic.com/blog/chatgpt-flatlogic-generate-fully-functioning-web-apps-based-on-description/)  is the perfect tool for creating a unified, secure, and intuitive user experience. Our platform offers a comprehensive suite of tools to help you build, customize, and manage your  [web](https://flatlogic.com/generator)  and mobile applications. From robust authentication to powerful APIs to intuitive analytics, Flatlogic Platform has all the features you need to create a stunning user experience. With our platform, you can build custom web and mobile applications faster and more efficiently so you can focus on growing your business.

We have spent a lot of time and effort on improving our Platform. It is a pleasure to create something new for our customers and always be in touch with you. Don’t waste time, check out our new feature, and see how rapid and straightforward it is! If you face difficulties, please, feel free to leave us a message on our  [forum](https://flatlogic.com/forum/),  [Twitter](https://twitter.com/flatlogic/)  or  [Facebook](https://www.facebook.com/flatlogic). We will respond to your inquiry as quickly as possible!
Custom i18n library
Tags: typescript, javascript, i18n
Published: 2022-12-30 12:45:38

Some months ago, I was working on a project which had been developed by vanilla.js and webpack.
it was a multiple-language project, and I needed to develop a function for resolving language. it was developed by typescript then I decided to convert it to an independent library for myself for use in other projects.

It will be my pleasure to me if you use it and give me feedback and also contribute to reforming it.

  [NPM](https://www.npmjs.com/package/i18n-vanilla)
  [Github-Repository](https://github.com/reza-nazari/i18n-vanilla)
Type-safe use of css custom-property in Vite
Tags: css, typescript, custom, property
Published: 2022-12-30 12:45:27

## Introduce
When staring with css modules in react, I often encounter situations where custom properties are used.
When staring with css modules in react, I often encounter situations where custom properties are used.
We have released a tool that solves those problems, and we would like to introduce it to you.
If you are using [Vite](https://ja.vitejs.dev/), you can read and use [css-preprocessoroptions](https://ja.vitejs.dev/config/shared-options.html#css-preprocessoroptions).

## Repo
https://github.com/activeguild/css-custom-property-extractor

## Usage
- Install the package.

```bash
npm i -D css-custom-property-extractor
```

- For example. Parsing [bootstrap.scss](https://github.com/activeguild/css-custom-property-extractor/blob/main/samples/scss/bootstrap.scss) outputs the following typescript file.

```
npx ccpe -i ./samples/scss/bootstrap.scss
```

output.

```
/**
 *  #0d6efd;
 */
export const bsBlue = "var(--bs-blue)"
/**
 *  #6610f2;
 */
export const bsIndigo = "var(--bs-indigo)"
/**
 *  #6f42c1;
 */
export const bsPurple = "var(--bs-purple)"
...
```

- Import and use the output typescript file.

## At the end
We have shown how to bring custom properties into the TS world and use them in type safety.
In addition to this, please read on to find out how to load styles and use classes in a type-safe manner.
https://dev.to/activeguild/i-made-a-typescript-plugin-for-css-modules-that-can-be-used-with-vite-3ofg
https://dev.to/activeguild/type-safe-development-with-vite-x-react-x-css-modules-x-typescript-1ebc
How to code an Android app that shows CPU and battery temperatures?
Tags: beginners, tutorial, android, programming
Published: 2022-12-30 12:18:04

To create an [Android app](https://quokkalabs.com/mobile-app-development) that displays the CPU and battery temperatures, you can use the Android Debug Bridge (ADB) and the "cat" command to read the temperature values from the system files.

Here is some sample code that demonstrates how to use the ADB and "cat" command to display the CPU temperature in an Android app:

```
TextView tv = (TextView) findViewById(R.id.textview);

try {
    Process process = Runtime.getRuntime().exec("adb shell cat /sys/class/thermal/thermal_zone0/temp");
    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String line = reader.readLine();
    tv.setText(line + "°C");
} catch (IOException e) {
    e.printStackTrace();
}

```

This code reads the temperature value from the "/sys/class/thermal/thermal_zone0/temp" file and displays it in a TextView with the unit "°C" (degrees Celsius). Note that you will need to have the ADB tool installed and configured on your computer, and the device must be connected to the computer via USB in order for the command to work.

To display the battery temperature, you can use the following code:

```
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = getApplicationContext().registerReceiver(null, ifilter);

int temperature = batteryStatus.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, -1);
tv.setText(temperature / 10.0 + "°C");

```

This code uses the Intent.ACTION_BATTERY_CHANGED intent to get the battery temperature value, which is then divided by 10.0 and displayed in the TextView with the unit "°C".

I hope this helps! Let me know if you have any questions, you can [reach me here](https://quokkalabs.com/android-app-development).
JavaScript Proxies allow you to intercept and customize operations performed on objects
Tags: javascript, webdev, programming, testing
Published: 2022-12-30 12:12:43

JavaScript Proxies allow you to intercept and customize operations performed on objects. They are a powerful tool for implementing design patterns such as the observer pattern, extending object behavior, and creating objects with a consistent interface for a wide range of use cases.

Here are some examples of how you can use JavaScript Proxies:

Observability: You can use a Proxy to monitor the access and modification of an object's properties and trigger a callback function when these operations occur. This is useful for implementing data binding, reactive programming, and other observability-based design patterns.

Extensible chaining: You can use a Proxy to extend the behavior of an object by intercepting operations and modifying their arguments or return values before or after the original operation is performed. This is useful for creating fluent interfaces and other chainable APIs.

Callable objects: You can use a Proxy to create an object that acts like a function, allowing you to define a custom behavior for the object's "call" and "construct" trap. This is useful for creating objects that behave like functions but have additional functionality or a more intuitive interface.

Here is an example of how you might use a Proxy to create an observable object in JavaScript:



```javascript
const observableObject = new Proxy({}, {
  set: (target, key, value) => {
    console.log(`Setting property "${key}" to "${value}"`);
    target[key] = value;
  },
  get: (target, key) => {
    console.log(`Getting property "${key}"`);
    return target[key];
  }
});

observableObject.foo = 'bar';
console.log(observableObject.foo);

```

This code will output the following:

```javascript
Setting property "foo" to "bar"
Getting property "foo"

```
I hope this helps! Let me know if you have any questions or need further clarification.
How to Unit Test a Smart Contract.
Tags: blockchain, testing, productivity, programming
Published: 2022-12-30 12:11:47

**Guide Requirements**
Hardhat: Hardhat is an Ethereum development platform that provides all the tools needed to build, debug and deploy smart contracts.


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

**Useful JS + Solidity Testing Resources**
We will use these resources throughout this guide but bookmark these for any other testing you do!
**
ChaiJS**
**Chai BDD Styled**
**Chai Assert**
**Mocha Hooks**
**Solidity Chai Matchers**

**Step 1: Hardhat Project Structure Setup**

In a directory of your choice, run npm init -y
Run npm install --save-dev hardhat
Run npx hardhat and you will get the following UI on your terminal:

*Select Create a JavaScript project
*Select YES to all of these options!

**Your project should now contain the following:**

Files: node_modules, package.json, hardhat.config.js, package-lock.json, README.md
Folders: scripts, contracts, test

**Run npx hardhat test in your terminal 
**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdpxjdyelh6gs2g8elnh.png)
How to code an Android app that shows CPU states?
Published: 2022-12-30 12:11:01

To create an [Android app](https://quokkalabs.com/mobile-app-development) that displays information about the CPU states, you will need to use the Android Device Monitor tool and the Android Debug Bridge (ADB).

- First, open the Android Device Monitor by going to the "Tools" menu in Android Studio and selecting "Android Device Monitor."
- In the Android Device Monitor, select the device you want to monitor from the "Device" dropdown menu.
- In the "Monitor" tab, click on the "File Explorer" button.
- Navigate to the "/sys/devices/system/cpu" directory and select the "cpu0" directory.
- In the "cpu0" directory, you will find a number of files that contain information about the CPU states, such as "cpuinfo_max_freq" and "cpuinfo_min_freq".
- To access these files from your app, use the ADB shell to run the following command: "adb shell cat /sys/devices/system/cpu/cpu0/cpuinfo_max_freq". This will display the maximum frequency of the CPU.
- To display the information in your app, you will need to use a TextView and set its text to the output of the ADB command.

Here is some sample code that demonstrates how to display the maximum frequency of the CPU in an Android app:

```
TextView tv = (TextView) findViewById(R.id.textview);

try {
    Process process = Runtime.getRuntime().exec("adb shell cat /sys/devices/system/cpu/cpu0/cpuinfo_max_freq");
    BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String line = reader.readLine();
    tv.setText(line);
} catch (IOException e) {
    e.printStackTrace();
}

```

Note that this code assumes that you have a TextView with an ID of "textview" in your layout file.

I hope this helps! Let me know if you have any questions. You can [reach me here](https://quokkalabs.com/android-app-development).
How to get Remote jobs
Tags: remotejobs, jobs, freshers, it
Published: 2022-12-30 12:09:21

**All about Remote jobs** 

Getting a job these days is very tough. The recession impacted every job seeker very badly especially for the fresher’s. Big Tech Giants like Amazon , Meta , Google , Twitter and so many big to small companies have laid off thousands of employees and due to less hiring there is a tough competition in the IT job sector market . I talked to many fresher’s and they have told me that though they have skills for the job roles they are applying for,they are not getting shortlisted or getting replies from the companies. 

One of the remedies for this problem  are remote jobs , companies from around the globe are offering thousands of fully remote jobs in different domains. You can work from home and you can save your expenditure on rent , transport and on food items. If you get bored while working from home you can plan for a trip with your savings so it’s a win win game and once the market is in a good condition then you can switch for a regular office based jobs or hybrid mode.

**Some remote job websites**

1. - Jobgether    -      https://jobgether.com/
2. - Turing       -      https://www.turing.com/
3. - RemoteHub    -      https://www.remotehub.com/
4. - Remote.co    -      https://remote.co/job
5. - FlexJobs     -      https://www.flexjobs.com/
6. - JustRemote   -      https://justremote.co/

**Some tips to prepare for remote jobs.**

1. Update your resume with relevant skills , projects and experience according to the job description.
2. Improve your linkedin profile , this is the best platform to showcase your skills.
3. Optimize your github profile, upload your projects and add links to your resume.


If you need any help related to Resume , Github or LinkedIn then reach out to me , I will help you in optimizing your profile . 


If you find this helpful then please like❤ and share it with your friends , follow me on [LinkedIn](https://www.linkedin.com/in/avinash-singh-071b79175/) for more helpful resources.

Follow our [Linkedin page ](https://www.linkedin.com/company/lets-code-forever/) and subscribe our [Youtube channel](https://www.youtube.com/channel/UC8yrWVx-ezAW0jh8hlFUFUQ) for regular job updates.
Krishn.ai - Your Spiritual Mentor
Published: 2022-12-30 12:05:30

Have you ever thought that you could use artificial intelligence to unlock spiritual guidance?

<img width="100%" style="width:100%" src="https://media.giphy.com/media/dcScHZPUskMOJwyqjj/giphy.gif">

Presenting you [Krishn.ai](https://krishn.ai/), a personal AI mentor that solves your questions in seconds. Krishn.ai is your personal mentor that solves your questions in seconds, using an AI-powered approach to help users discover the answers they need.

It is a bot that uses Artificial Intelligence to help you solve all your personal and professional issues within seconds. It's like having your own personal guru at the click of a button!

With Krishn.ai, you'll always have access to the knowledge that's been waiting for you since day one of your life—and it will always be there for when you need it most!

## How does Krishn.ai works?

<img width="100%" style="width:100%" src="https://media.giphy.com/media/xT1R9XWlRXt08xfDX2/giphy.gif">

Kirhn.ai is a chatbot that generates responses to given inputs based on the context of the conversation. It uses a deep learning algorithm to understand the sentiment, meaning and context of the input text and then predicts the best possible response using its vast repository of conversations.

## A Quick Glance On The Features Of Krishn.ai

- Users can  simply log in with Google Sign in or create an account using their mail.
- The web app has a user-friendly interface and  and a simple navigation system that allows users to easily navigate through the entire application.
- KRISHN.AI uses context-based chats, in which a bot learns from its interactions with users and adapts the way it responds to them.
- It also contains a soothing voice in the background, which enhances the user experience.
- krishn.ai has two different Message limits for non-logged in users. The first limit is 1X, and it is only applicable to non-logged in users. The second limit applies to logged in users and is 10X.
- A user that is Subscribed to us has unlimited access.
- It enables you to find answers to your problems effortlessly by getting the proper guidance from experts who are available online 24x7.
- At the end of the process, we have a feature that lets you share the generated text to social media.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tn3ozsljsnm7xfml1bvv.jpeg)


## An Easy Check 
I did a quick test check and I asked the bot a few questions and it was able to answer them all.


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


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


Hence , there is no doubt that krishn.ai will be useful to all users.

Hope you enjoyed this blog! We'd love it if you'd join us in following Krishn.ai and reading our future posts.
Instagram - https://instagram.com/krishn.ai
Twitter - https://twitter.com/krishn_ai
Skills required for a React Native Developer
Tags: reactnative, mobile, mobileapplicationdevelope, android
Published: 2022-12-30 11:59:39


become a React Native Developer u must know about this skills

React Native is Framework for build Mobile application for Android and iOS


1. React
2. JavaScript 
3. Git
4. Bitbucket/GITLAB/GITHUB
5. React Native
6. Native Android iOS development Environment

7. NPM Library integration 
8. Figma
9. React Native Stylesheets 
10. React Native PAPER 
11. Firebase 
12. Realm Db
13. Typescript
14. ES6
15. React Navigations
16. API Integration 



## Tools For React Native 

Visual Studio Code
Android Studio
Xcode
git
GitHub
Postman