teleren/devto huggingface dataset:
Ruby on Rails event invitation add to calendar using icalendar gem
Tags: ruby, rails, calendar, coding
Published: 2022-01-22 19:13:17

In rails sending an event invitation is simple, But getting an invite recognized by Gmail for easy "add to calendar" feature is tricky. After experimenting with it for a while, this simple config does the trick.



```ruby
require 'icalendar/tzinfo'
class EventMailer < ApplicationMailer
 def send_invitation(_user, _event)

  # initialize a new icalendar class
  ical = Icalendar::Calendar.new

  # Define default time
  time_zone = 'UTC'
  cal_tz = TZInfo::Timezone.get time_zone

  # add timezone to icalendar 
  ical.add_timezone cal_tz

  # new icalendar event 
  event = Icalendar::Event.new
  
  # event start date
  event.dtstart = Icalendar::Values::DateTime.new _event.start_time, 'tzid' => cal_tz

  # event end date
  event.dtend = Icalendar::Values::DateTime.new _event.end_time, 'tzid' => cal_tz


  # event organizer
  event.organizer = Icalendar::Values::CalAddress.new("mailto:" + _user.email)

  # event created date
  event.created = DateTime.now

  # event location
  event.location =  _event.venue

  # if there's an external link e.g, google meet
  event.uid = event.url = _event.meeting_link


  # event title
  event.summary = _event.title


  # event description
  event.description = _event.description


  # attach the configured event to icalendar class
  ical.add_event(event)
  

  # protocol
  ical.append_custom_property("METHOD", "REQUEST")

  # this add's an attachment name `event.ics`, 
  # when clicked, the event gets added to the calendar. 

  mail.attachments['event.ics'] = { mime_type: 'application/ics', content: ical.to_ical }


  # send mail
  mail(to: _user.email, subject:  "#{_event.title} - #{_event.summary} ")
 end
end
```

enjoy!
Loopple - Change your dashboard colors
Tags: html, developers, javascript, webdev
Published: 2022-01-22 18:53:32

Hi,

Loopple is a Low Code Dashboard Builder that aims to help developers to speed up their development process.

Today we just published the newest release that updates our dashboard with the theme color editor.

Currently, you can edit the following colors: Body Color, Primary Color, Info Color, Success Color, Warning Color and Danger Color.

You can also see how it works [here](https://www.youtube.com/watch?v=2jYJsCvMN0Q).

Links:
- Loopple - [Loopple website](https://www.loopple.com/)
- Github - [Loopple Github Repo](https://github.com/Loopple/loopple)
- Discord - [Loopple Discord](https://bit.ly/3FTaFEP)

More colors to the color editor and features will be available soon!

Please let me know what you think.

Thank you!
Apple iPhone 13 User Guide for Beginners
Published: 2022-01-22 17:10:21

Considering the new iPhone 13, it is natural to be curious about how to use the device. A user guide is a good place to get the information you need to use your new smartphone. This Apple iPhone user manual will walk you through the different features of this latest iPhone and explain how to use them. The user guide for the iPhone 13 is available for download from Apple's website as well as from other sources. You can start by looking for a function you want to use. Next, you should choose the appropriate menu, then search for the sub-menu you'd like to access.


![iPhone 13 user guide](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvsctyfvgbzxce4y2xi1.jpg)

Once you've downloaded the iPhone 13 user guide, it's time to start using it. You can read about the different features of this smartphone and get the most out of it. A great thing about this new phone is that it comes with a photo section, so you'll be able to easily see how each function works. Another benefit is that this user guide covers all of the different functions that are available on the device, so you'll be able to understand how they work without having to ask a tech support employee.

If you're upgrading from an old iPhone or Android device to the iPhone 13, you can use the iPhone 13 user guide to migrate your data and apps to the new phone. The user guide will provide instructions on how to do this. The user guide will also show you how to use the new Apple Quick Start feature, which will help you wirelessly transfer your contacts, apps, settings, and other data to the new model. You can even download the iPhone 13 user guide and compare the features of the two phones to make sure they match.

If you're not sure how to use the iPhone 13 or if you're unsure how to use it, you can look at Apple's user guide. It'll teach you how to do all of the new functions of your new smartphone. It'll also teach you how to use the camera, change the wallpaper, set Live Photo as your wallpaper, and organize your apps into folders and move them around the Home Screen. You can multi-task with Picture in Picture, send items through AirDrop, and more.

The iPhone 13 user guide can be downloaded from [this website](https://iphone13userguide.com/). The manual can be viewed on a PC, mobile phone, or both. You'll need to have a working internet connection before you can use the iPhone 13 user guide. You can use a Wi-Fi connection or a modem to connect to the internet, depending on your preference. Then, open your web browser and look up the manual.
How To Build Docker Images With Custom Dockerfile Names
Tags: docker, dockerfile, howto, beginners
Published: 2022-01-22 18:25:39

Most of the time we use the conventional file name, `Dockerfile` to build Docker images. But there can be situations where we need to build multiple image variations for development, testing, production, architecture and many more. Of course, as you might guess we can create multiple Dockefiles. The problem is, when we build a Docker image using the below-mentioned `docker build` command, by default it does only recognize a Docker file which has the file name as `Dockerfile`.

```
docker build -t <tag-name> .
```

## How To Use Custom Dockerfile Names

The `docker build` command accepts custom Dockerfile names. You can mention your custom Dockerfile name using the `-f` flag of the `docker build` command like below.

```
docker build -t <tag-name> . -f <file-name>
```

Build separate Docker images for every Dockerfile according to your requirements.

```
docker build -t dev-image . -f dev.Dockerfile
```

```
docker build -t test-image . -f test.Dockerfile
```

```
docker build -t prod-image . -f prod.Dockerfile
```

## Custom Dockerfile Names In Subdirectories

Placing a lot of Dockerfiles in the root directory of your project can make your project quite look unorganized and messy, so we can even place them all in a subdirectory (Ex: “docker”). Mention the paths of custom Dockerfiles using the `-f` flag like below. You can add the `./` part to the path of `-f` flag to indicate the current directory, so you or your team members will not have to mention the full paths to Dockerfiles.

```
docker build -t amd64-image . -f ./docker/amd64.Dockerfile
```

```
docker build -t i386-image . -f ./docker/i386.Dockerfile
```

Feel free to visit [devtonight.com](https://devtonight.com/tags/docker?utm_source=dev&utm_medium=questions&utm_campaign=how-to-build-docker-images-with-custom-dockerfile-names) for more related content.
Topic of the week - Ruby
Tags: ruby, interviewquestions, interview, programminglanguage
Published: 2022-01-22 18:22:09

---
title: Topic of the week - Ruby
published: true
description: Ruby interview questions and answers
tags: #ruby #interviewQuestions #interview #programmingLanguage
//cover_image: ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mah0m5be6uqs9ng7fc9s.png)
---

1. What is Ruby programming language?
Ruby is a dynamic, reflective, general purpose, open source programming language that focuses on simplicity and productivity. Ruby has mixed features of Perl, small talk, Eiffel, Ada, and Lisp. Ruby was designed to create a new language that makes a balance with the functionality of Imperative languages.

2. What are rubygems?
rubygems is package manager software for ruby libraries (i.e. gems). The package manager has basic CRUD operations, dependency trees, and supports asynchronous communication between multiple gem servers.

3. What is a DSL and how does it pertain to Ruby?
A Domain Specific Language is an API that allows a developer to solve a problem or represent data more naturally than they might otherwise. The flexible nature of Ruby's syntax and the ability to alias and alter existing methods and classes makes it conducive to creating rich DSL's.

4. What is duck typing and how does it pertain to Ruby?
This is an object that may be acted upon even if it isn't the expected type as long as it looks and behaves like the expected object. This is a characteristic of Ruby because the lack of type checking of parameters makes this an effective programming technique.

5. What is the difference between an instance variable and a class variable?
A class variable is evaluated in reference to the class object created by the enclosing class definition while an instance variable is evaluated in reference to self. Instance variables cannot be referenced outside of instance methods.

To read more questions and answer download our Interview questions app from play store. We updated 75 Ruby interview questions and answers with clear code examples.

https://play.google.com/store/apps/details?id=com.vigowebs.interviewquestions
Day 14 of 100 - Java: basic examples and Java RMI example
Published: 2022-01-22 17:16:18

> Journal note: 📝
I have started asking for referrals for a programming job, from my friends. And also actively applying for jobs. :)

### Check for Palindrome

String

```java
String str = "rar", reverseStr = "";

int strLength = str.length();
for(int i=(length-1); i > 0; i--) {
  reverseStr = reverseStr + str.CharAt(i);
}

if (str.equals(reverseStr))
  System.out.print("The string is Palindrome");
```

Number

```java
int num = 1001, reverseNum = 0;

if (num != 0) {
  reverseNum = num%10 + reverseNum * 10;
  num  = num / 10;
}

```

### Transpose of a matrix

```java
int row=2, column=3;
int[][] matrix = {{1,2,3}, {4,5,6}};

int[][] transpose = new int[column][row];
for (int i=0; i < row; i++) {
  for (int j=0; j < column; j++) {
    transpose[j][i] = matrix[i][j];
  } 
}
```

### Java RMI

https://github.com/j143/java-rmi-example
Glowing Neon Button Effect
Tags: css, ux, webdev, tutorial
Published: 2022-01-22 17:49:51

In this (S)CSS tutorial we will be creating a purple and green "glowing" neon hover effect for buttons. SCSS (and the mixin in this example) is not required, pure CSS would be just as valid.

{% youtube rDJWoGFOGrw %}
how to block ads in hotstar
Tags: hotstar, javascript, netwo, devtools
Published: 2022-01-22 17:04:53


Solution - 01 :-
----------------

1. open dev tools. Go to network tab
2. select urls containing preroll ads/ midroll ads. 
3. right click on url and select block `service.hotstar.com`

Solution - 02 :-
-----------------
1. Download http request blocker extension 
2. add new pattern `*://service.hotstar.com/*` and click on save


That's it. Enjoy
How to create database MySQL with Docker
Tags: docker, mysql, database
Published: 2022-01-22 17:03:43


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

I'll to show how  to create an local database MySQL with Docker, in yours Windows. It is necessary has the last version Docker intalladed in your machine.


**1st step: Dowload the MySQL image**

Let's download the latest MySQL image to the Docker hub, type the following command below:


*docker pull mysql/mysql-server*



**2st step: Execute the container**

Let´s execute the container for an image that we did download. At first, we don´t configure environment variables, at moment just execute the MySQL for default users without a password. Before executing the command, you can create a directory with the name **mysql**. Write the command below in your terminal.

*Note: create only the directory C:/mysql for default, the MySQL to need has folder */var/lib/mysql*, this directory the MySQL will save your database.*

Write the command below

*docker ryn -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -v C:/mysql/var/lib/mysql mysql*


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


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




**3st step: Getting the container's IP**

For discovery the container IP, write command *docker container ls* for verify the containers that running and copy the ID the container, using the command  *docker container inpect ID_CONTAINER*.


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


**4st step: Acess database from container**

To access the database through the container, we need to go inside the container, so write the command below

*docker exec -it ID_CONTAINER*


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

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

Already. We have a datbase MySQL in container Docker. Now you can create your database and tables.

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

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

  
**Conslusion**

This is a sample example for you create database with docker. Of course this example I created the sample database, but you can configure user and password in your database. 

Write for don´t forget.
The importance of reviewing code properly, and managing a project repo
Tags: opensource
Published: 2022-01-22 16:35:15

Btw, I seem to have lost my Hacktoberfest shirt. I'll need to find that since we need pics of these.

With the semester over, I feel like it's the perfect time to reflect on what I did outside of my courses rather than inside, because to be honest, this semester wasn't one that I enjoyed a lot. Not that my courses were difficult, but that they felt like they had no place at this point in my program.

So onto what you really want to read. With a lighter school schedule, I got an opportunity to continue working with Telescope, something not many of my peers appear to be doing. But wait Abdul, you're not doing the open source courses this time. Why bother? 

Open-source is a lot like the web in that it evolves as time passes by. A great example of this was the recent switch to `pnpm` from `npm`. Installing and running scripts has been so fast. I specifically remember researching about this around February last year, however, never got to look into this further since the microservice wave came crashing down.

So as a result, I ended up slowly taking over the role of reviewing PRs and less developing actual code for Telescope. In the last 2 months, I think I only committed about 2-4 PRs in total, including this [recent one adding a .dockerignore file to our search service](https://github.com/Seneca-CDOT/telescope/commit/5b6dbcfc439f5fa4657e27d0936b8d147219a761). Reviewing code is important since any little mistake means that the entire codebase breaks down. 

As a result, I tried to pick PRs that didn't do much coding or did minimal editing. Smaller PRs are always easier to review than larger ones. Of course, there were times this couldn't be avoided. The main culprit being all the status service PRs and search related PRs. 

As the term goes by, I'll end up stuck at my co-op doing work with spring/camel and have to shift my focus away from Telescope. Naturally, this meant I had to focus on a few less PRs while also spending time mainly reviewing code. Ofc, there's stuff I miss whenever I review code, and Search ended up breaking again (As if me breaking it once wasn't enough). The group this time is much bigger than the 10 I was apart of so that means more progress maybe. I like the ideal of overseeing a repo's evolution and my unique status as a Telescope alumni gives me a chance to sort of help out as a senior developer. Always gotta get that resume stacked.

My goal aside from my co-op though, is to continue looking into Supabase and search related content along with JWT related issues I never got to look into. If React Native stuff gets going, I'll work on that stuff too. But the main idea is to be a sort of extra eyes since there's more students working on Telescope than ever before. Wish them luck, they'll need it.
Simple Java Scanner Tutorial
Tags: tutorial, java, vscode, beginners
Published: 2022-01-22 16:33:57

---
title: Simple Java Scanner Tutorial
published: true
description: A simple tutorial using Java Scanner
tags: tutorial, java, vscode, beginners
//cover_image: https://direct_url_to_image.jpg
---

## Introduction

This is a simple tutorial on using the _Scanner_ class in Java. The Scanner class lets you accept input from the console. The user types on the keyboard and passes that data to the program.

## Prerequisites

* Install Java and Visual Studio (VS) Code. Here is a tutorial: [Tutorial: Visual Studio Code and Java](https://dev.to/realedwintorres/tutorial-visual-studio-code-and-java-icm).
* Start VS Code.
* Create a new Java project as specified in the tutorial.
* In the left sidebar, right-click the `src` folder and select _New File_. Create a file named `Example.java`.
* Continue to the tutorial below.

## Code

In the left sidebar in VS Code, click the `Example.java` file to show it in the main editor window. Enter this initial code:

```Java
public class Example {
  public static void main(String[] args) {
    

  }
}
```

To use the Scanner class, import it at the top of the program:

```java
import java.util.Scanner; // NEW

public class Example {
  public static void main(String[] args) {


  }
}
```

Next, create a Scanner object to read from standard input (i.e., the console):

```java
import java.util.Scanner;

public class Example {
  public static void main(String[] args) {

    Scanner s = new Scanner(System.in); // NEW

  }
}
```

Now prompt the user to enter some data from the keyboard:

```java
import java.util.Scanner;

public class Example {
  public static void main(String[] args) {

    Scanner s = new Scanner(System.in);

    System.out.print("What is your favorite number? "); // NEW

  }
}
```

Use the Scanner object to accept an integer value from standard input and assign it to a variable:

```java
import java.util.Scanner;

public class Example {
  public static void main(String[] args) {

    Scanner s = new Scanner(System.in);

    System.out.print("What is your favorite number? ");

    int num = s.nextInt(); // NEW

  }
}
```

The `num` variable holds the input data. Output the `num` variable to verify:

```java
import java.util.Scanner;

public class Example {
  public static void main(String[] args) {

    Scanner s = new Scanner(System.in);

    System.out.print("What is your favorite number? ");

    int num = s.nextInt();

    System.out.println("Your favorite number is: " + num); // NEW

  }
}
```

Here is a sample run of the program from the terminal:

```bash
What is your favorite number? 44
Your favorite number is: 44
```

## Additional Exercise

* Modify the program to ask the user for an _age_ and _day of the month_.
* Output the _age_ and _day of the month_.

Thanks for reading.

Follow me on Twitter [`@realEdwinTorres`](https://twitter.com/realEdwinTorres) for more programming tips. 😀
Setting up SSH key for Bitbucket account on macOS
Tags: programming, ssh, beginners
Published: 2022-01-22 16:14:05


Hi all, today I want to share how to generate a SSH key and set it for the Bitbucket repository.

###Introduction
An SSH key is an access credential for the SSH (secure shell) network protocol. This authenticated and encrypted secure network protocol is used for remote communication between machines on an unsecured open network. SSH key is used for remote file transfer, network management, and remote operating system access.

###Generate SSH key
Open your terminal and paste the below command in the root directory.
```javascript
ssh-keygen -t rsa
```
Then it will ask where to save the key file. You can press enter to save it on the default location.

###Set Passphrase
Next, it will ask you to set Passphrase for that file. You can keep it empty but it is recommended to set the Passphrase because the SSH key without a Passphrase can be used by anyone to access the system or repository.

###Copy SSH key
Now paste the below command to get the public access key you just created
```javascript
cat ~/.ssh/id_rsa.pub
```
*Note: Here `id_rsa.pub` is SSH key file name.*

###Set it on Bitbucket
* Open your Bitbucket account and go to Personal settings.
* Select SSH keys under the Security tab.
* Press Add key button. It will open the below-mentioned dialog box for you.
![bitbucket img](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nz7vgubyeg4fmjcfxpzp.png)
* Here paste that copied key type the label and press Add key button to save it on your Bitbucket settings.

Now you can access the repository with a secure connection. Thank you for reading!
Selecting Folders using QT5 QTFileDialog
Published: 2022-01-22 16:07:45

---
title: Selecting Folders using QT5 QTFileDialog
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

Following the [documentation](https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory) here we see that it is pretty easy for us to select a folder and return a string of the selected file. This is the easiest way to collect folders and print the value into a textfield:


```cpp
QString fileName = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
                                                    QDir::currentPath(),
                                                    QFileDialog::ShowDirsOnly
                                                    | QFileDialog::DontResolveSymlinks);

    ui->textEdit->setText(fileName);
```
Copier Tasks | Python templating post run task
Tags: python, cli, linux
Published: 2022-01-22 16:06:00

---
canonical_url: https://waylonwalker.com/til/copier-tasks/
published: true
tags:
- python
- cli
- linux
title: Copier Tasks | Python templating post run task
series: til
---

Copier allows you to run post render tasks, just like cookiecutter. These are defined as a list of `tasks` in your `copier.yml`.  They are simply shell commands to run.

The example I have below runs an `update-gratitude` bash script after the copier template has been rendered.

``` yaml
# copier.yml
num: 128
_answers_file: .gratitude-copier-answers.yml
_tasks:
  - "update-gratitude"
```

I have put the script in `~/.local/bin` so that I know it's always on my
`$PATH`.  It will reach back into the `copier.yml` and update the default
number.


``` bash
#!/bin/bash
# ~/.local/bin/update-gratitude
current=`awk '{print $2}' ~/.copier-templates/gratitude/copier.yml | head -n 1` new=`expr $current + 1` echo $current echo $new sed -i "s/$current/$new/g" ~/.copier-templates/gratitude/copier.yml
```