teleren/devto huggingface dataset:
Appium automation code structure
Published: 2023-03-19 10:34:43

**Desired Capabilities**: Desired capabilities are a set of key-value pairs that specify the characteristics of the device or emulator to be used for testing. This includes details such as device name, platform version, app package name, and app activity name. These capabilities are used to initialize the driver object.


```
    @BeforeTest
    public void setup() throws Exception {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("deviceName", "Android Emulator");
        caps.setCapability("platformVersion", "11");
        caps.setCapability("appPackage", "com.example.myapp");
        caps.setCapability("appActivity", "com.example.myapp.MainActivity");
        caps.setCapability("automationName", "UiAutomator2");
        caps.setCapability("noReset", true);

        driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), caps);
    }
```

**Page Objects:** Page objects are classes that encapsulate the behavior and properties of the user interface elements of an app. They provide a layer of abstraction between the test code and the app's user interface. Each screen or page of the app can have a corresponding page object class.



**Test Code:** The test code is written to interact with the user interface elements of the app through the page objects. It typically includes the steps that the user takes to navigate through the app, interact with the elements, and perform validations.

```
    @Test
    public void loginTest() {
        LoginPage loginPage = new LoginPage(driver);
        loginPage.enterUsername("myusername");
        loginPage.enterPassword("mypassword");
        loginPage.clickLoginButton();

        HomePage homePage = new HomePage(driver);
        Assert.assertTrue(homePage.isUserLoggedIn());
    }
```

**Test Runner:** The test runner is a program that runs the test code and communicates with the Appium server to automate the app. There are different test runners available for Appium, including TestNG, JUnit, and Appium Studio. The test runner usually handles the configuration, setup, and execution of the tests.

**Supporting files:** These are files that contain additional information or configuration for the tests, such as test data, configuration files, or utility classes. They can be organized in folders for better structure and maintainability.

```
- src
  - main
    - java
      - com
        - example
          - pages
            - LoginPage.java
            - HomePage.java
          - tests
            - LoginTest.java
          - utils
            - AppiumUtils.java
    - resources
      - app
        - MyApp.apk
  - test
    - java
      - com
        - example
          - runners
            - TestRunner.java

```
How to use mixins - Part 1
Published: 2023-03-19 12:42:05

If you've ever checked the source code of a CSS framework, you might have noticed the use of @mixin statements. Have you ever wondered how mixins work, or how you can incorporate them into your code?

To elaborate, mixins are a Sass utility that allows you to encapsulate styles into a single rule. You define a mixin using the @mixin statement, and then include it in your styles using the @include statement.

(Please refer to the following URL to install the sass on your machine https://sass-lang.com/install)

```
//_global.scss
// syntax
@mixin <any valid sass identifier>(optional arguments) {
... properties
}

```

```
//_global.scss
//example
// creating a mixin to reset the anchor tag style, here updating the two properties of the selector in which this is being used.
@mixin reset-anchor-tag {
   text-decoration: none;
   color: $font-clr;
}
// applying the mixin `reset-anchor-tag` on the anchor tag as follow
a {
    @include reset-anchor-tag;
}

```

In the example above, the code updates the provided properties regardless of where it is used. Let's examine another example that specifically resets the style of the anchor tag.

```
//_global.scss
@mixin reset-anchor-tag {
    a {
       text-decoration: none;
       color: $font-clr;
    }
}
// the style will reset, only for the anchor tags inside the p tag
p {
    @include reset-anchor-tag;
}

// to do it globally
@include reset-anchor-tag;

```

Suppose you need to modify only the color and text-decoration of anchor tags that belong to the .container class, instead of resetting the properties to their default values. How can this be achieved?

To accept parameters, we can update the mixin code as follows. We have added an option to provide a default value, that will be used if no values are provided.

```
//_global.scss
// here `none` and `$font-clr` are the default values
@mixin reset-anchor-tag($decoration-type: none, $color: $font-clr) {
    a {
       text-decoration: $decoration-type;
       color: $color;
    }
}

//usage
@include reset-anchor-tag;
.container {
    @include reset-anchor-tag(underline, #3c37ff);
}

```

if we have to change only certain variables, we can pass only those variables instead of passing all of them as follow.

```
// if you wish to update the color of the tag instead of decoration type, the mixin can be used as follow
.container {
    @include reset-anchor-tag($color: #3c37ff);
}
// in this case, the text-decoration property will be set with their default value and the color variable will be used the value provided here.

```

While there is much more to discuss on mixins, let's wrap up this blog here. We can explore this topic further in a future blog post. (A quick playground for this discussed code snippet can be found here: https://codepen.io/sanjusm/pen/OJojzZE)

Thanks for reading and until the next time.
Overcoming Resistance in Software Engineering
Published: 2023-03-19 17:37:18

As software engineers, we face numerous obstacles in our work. From challenging coding problems to demanding deadlines, it can be easy to become overwhelmed and discouraged. But one of the biggest obstacles we face is something that is often internal: Resistance.

Resistance can take many forms, from negative self-talk to self-doubt and fear of failure. It can be paralyzing and prevent us from doing our best work. However, recognizing Resistance for what it is can be the first step in overcoming it. By acknowledging its presence and understanding its impact on our work, we can begin to take action to push through it.

One of the most effective ways to overcome Resistance is to stay disciplined. This means showing up every day and doing the work, even when we don't feel like it. It can be easy to get caught up in distractions or feel overwhelmed by the enormity of a particular project, but by remaining focused and committed to our work, we can make steady progress and ultimately achieve our goals.

Having faith in our abilities is another critical component of overcoming Resistance. As software engineers, we are constantly learning and growing, and it's important to trust in ourselves and our skills. This doesn't mean that we'll always have the answer or that everything will come easily, but it does mean that we have the ability to figure it out.

In conclusion, overcoming Resistance is a natural part of the creative process, but it is not insurmountable. By recognizing Resistance, staying disciplined, and having faith in our abilities, we can push through the obstacles and achieve our goals as software engineers. So the next time you feel Resistance creeping in, take a deep breath, stay focused, and keep pushing forward.
Apache-age: A Powerful and Open Source Graph Database Solution. [Part # 2]
Tags: apacheage, postgresqextension, database, opensource
Published: 2023-03-19 19:38:10




## Querying the Data

Welcome back to our series on building a social network app with apche-age! In our previous blog post, we covered the basics of data modeling, setting up Neo4j, creating the graph, and adding sample data. Now that we have our graph populated with users, posts, comments, and relationships, it's time to start querying the data. In this post, we'll explore some example queries for retrieving useful information from our social network app. If you haven't read our previous post yet, we recommend starting there to get caught up on the basics of building a social network app with apche-age [here](https://dev.to/kamleshmmb45/building-a-social-network-app-with-apache-age-a-beginners-guide-31fj)




## Query to get all posts 
```
SELECT * from cypher('social_network', $$

		MATCH (p:Post)
		RETURN p.title, p.content

$$) as (V agtype, C agtype);
```
This query returns the title and content of all posts in the graph.


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


## Get all posts and their comments

```
SELECT * from cypher('social_network', $$
        MATCH (V)-[R:COMMENTED]-(V2)
        RETURN V,R,V2
$$) as (V agtype, R agtype, V2 agtype);
```
This query returns the title of each post and the content of each comment on that post.

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


## Get all posts and their likes

```
SELECT * from cypher('social_network', $$
       MATCH (p:Post)<-[:LIKED]-(u:User)
	   RETURN p.title, COUNT(u) as likes
$$) as (V agtype, R agtype);

```
This query returns the title of each post and the number of likes it has.


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


## Get all posts and their authors

```
SELECT * from cypher('social_network', $$
	
	MATCH (u:User)-[:POSTED]->(p:Post)
	RETURN p.title, u.name

$$) as (V agtype, R agtype);

```

This query returns the title of each post and the name of its author.


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



## Get all users and the users they follow

```
SELECT * from cypher('social_network', $$
       MATCH (u:User)-[:FOLLOWS]->(f:User)
	   RETURN u.name, COLLECT(f.name) as following
$$) as (V agtype, R agtype);
```
This query returns the name of each user and a list of the names of the users they follow.

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


## References
For further help you can look though the documentation [here](https://age.apache.org/) and Apache-age repo [here](https://github.com/apache/age).
Second check-in for project 2
Published: 2023-04-02 23:54:57

A link to the github repo can be found [here](https://github.com/pjstrauss12/badge-list).  A lot of progress has been made since the last post.  The badge API is wired up and the CSS code is near completion to get it looking like our comp.  We unfortunately have not been able to get the search functions up and running yet, so that will be the main focus in the coming days.  We have a good idea on how we will get the search API working, and that can be shown with the image below.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifpiprlfndy5wxfv4rjo.png)

  

The problem with a monolithic design is that changes to one part of the system have the ability to cause issues with other parts of the system. In a business setting where time equals money having downtime due to glitches would result in the loss of revenue for the company. By implementing a microservice architecture our company could section off many parts of the monolithic design making the micro sections easier to manage and fix when something goes wrong. You can also make changes to specific parts of the service without worrying about the rest of the system. Also, microservices can be developed and deployed independently of each other.

One of the questions that we had is if we could get an idea on where to begin with getting the search API started.  We need a bit more of an idea on how to do it so we can visualize it and get it implemented.
How to monitor an app in production using Discord channels
Tags: tutorial, typescript, programming
Published: 2023-04-03 14:34:05

Observability is an extremely important practice for you having an idea of what is happening in your app and receive updates from new interactions.

We will see how to send new messages to a discord channel, this allows us to monitor interactions in production of our application, such as a new api call, a new login, or even a new record in the database.

In this example we will monitor a route and at each call to it you want to send a message to discord with some data.

If you do not create a project yet, just run `yarn init -y` to create a new.

Install some dependencies:
```bash
yarn add express axios nodemon
```

Create a discord channel that will be used to monitor and receive new updates. After creating it, we need to create a new webhook for this channel. Go to Server Settings > Integrations > Webhooks > New Webhook, then select the created channel and copy the link.

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

Go back to code... create a `config.js` file to define our variables:
```js
export const config = {
  API_PORT: 4000,
  DISCORD_CHANNEL_WEBHOOK: <your discord channel webhook>,
};
```

Create a new express server with a simple route:
```js
// index.js
const express = require('express')
const { config } = require('./config')
const axios = require('axios')

const app = express()

app.get('/observability', async (req, res) => {
  await axios.post(config.DISCORD_CHANNEL_WEBHOOK, { content: 'Hello World' }, {
    headers: {
      Accept: 'application/json',
      'Content-Type': 'application/json',
    }
  })
  res.send('observability done successfully')
})

app.listen(config.API_PORT, () => {
  console.log(`Server listening on port ${config.API_PORT}`)
})
```

Will be made a POST for this discord channel webhook with the content.

Let's run the code, open the terminal and run `nodemon index.js`

Now, if you access this url `localhost:4000/observability` you will see it:

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

And if you check your discord channel it has something like this:

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

And that's it, we have a log and observability system, feel free to run this webhook at any time in your code that you want to follow the status in production.

See the repository using typescript here: [observability-with-discord](https://github.com/vinibgoulart/observability-with-discord)

---

See more in my [zettelkasten](https://vinibgoulart.github.io/zettelkasten/docs/about)

---

Foto de <a href="https://unsplash.com/@laughayette?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Marten Newhall</a> na <a href="https://unsplash.com/pt-br/fotografias/uAFjFsMS3YY?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Project 2 Week 12 Homework
Published: 2023-04-03 03:06:24

**Progression you've made**
CSS is starting to more closely resemble the model. Search function is not completely working but we have looked at other examples on how to get it working and have started to implement that. 

**How did you get the relationship between Searching and rendering results working**
Watched a youtube video and looked at online resources showing html,css,and js examples of a search bar function. 

**Draw a diagram on draw.io for user interaction pattern. What happens from user input, through machine sending value, to re-rendering on the page.** 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4k5tyu7mu7nu4wji7gv.png)

**Think of a real world use-case from industry (Media streaming, youtube, corporate, cable company provider, web platform, etc) where micro-service architecture could fit into their business context. How could we use this approach to solve a real problem at a company currently using a monolithic design architecture?**
This use of micro-service architecture could be used to solve an issue say where a company wants all of their websites or anything else associated with their name that a user interacts with to have the same structure, look, and feel to it. Using this micro-service architecture, they can accomplish this while also styling them to be pleasing to interact with. 

**More questions you have / things your stuck on**
We began this project with the understanding that we could do our own thing, as long as we followed the model and made it look the same. Now we are understanding that we weren't supposed to do our own thing, rather we were just meant to remake the model using our own understanding of how to make a web page. So right now, we are in a little bit of a panic mode as we sort of need to change the entire thing. We thought that this wouldn't be too hard as we could pull from the model webpage but both of us have now lost access to that page.
The Future of Code: When Humans and AI Collaborate
Tags: ai, programming, discuss, news
Published: 2023-04-03 03:52:18

In recent years, there has been a lot of talk about the rise of **artificial intelligence (AI)** and the potential impact it could have on various industries. But what about the future of code? Will AI replace human developers, or will they work together to create even more innovative solutions?

The answer lies in a concept called "**collaborative intelligence**," which is the idea that humans and machines can work together to achieve better outcomes than either could achieve alone. In the case of coding, this means that AI can assist developers in various tasks, such as debugging, optimizing code, and even generating code based on specifications.

However, the real power of collaborative intelligence lies in its ability to **augment human creativity**. AI can generate new ideas and suggest different approaches to problems that human developers may not have thought of. This could lead to new breakthroughs in software development that may not have been possible before.

Of course, there are also concerns about the impact of AI on the job market for human developers. Some experts predict that AI could automate many of the tasks currently performed by developers, leading to job loss. However, others argue that AI will create new opportunities for developers to specialize in areas where machines are not as proficient, such as user experience design or project management.

The future of code is still uncertain, but one thing is clear: the collaboration between humans and AI will be a key factor in shaping it. As AI continues to evolve and become more sophisticated, we can expect to see new tools and platforms emerge that will allow developers to work more closely with machines. And who knows, maybe one day we'll even see AI-generated code winning prestigious programming contests.
Virtual Coffee Lightning Talks
Tags: discuss, javascript, career, speaking
Published: 2023-04-03 14:12:16


Virtual Coffee streamed lightning talks last week. Today our AV team has clipped them from the 3 hour stream to individual talks. So you can watch or re-watch these short videos. 
The talks covered Public speaking, regular expression, story telling, Job hunt, survivor bias and more.

{% embed https://www.youtube.com/watch?v=9XNeuv5W7xE %}
@gant Humorous talk on public speaking.



{% embed https://www.youtube.com/watch?v=RmUhP1Nxqkw %}



{% embed https://www.youtube.com/watch?v=RtASfQrr6YQ %}


I am very proud of all the work the Virtual Coffee members put into presenting these talks. Here is the [Virtual Coffee YouTube page.](https://www.youtube.com/@VirtualCoffeeIO/videos)

Thanks to the speakers and @bekahH, @danieltott, and @virtualcoffee .
#interpreted_language
Tags: webdev, javascript, beginners, programming
Published: 2023-04-03 14:26:16

## Q: What is interpreted language means?
 An interpreted language is a programming language where the code is executed directly, without being compiled into machine code first. In an interpreted language, the source code is read by the interpreter, which then executes the instructions directly.

Interpreted languages are typically easier to learn and use than compiled languages because they do not require the developer to perform a compilation step before running the code. Interpreted languages also tend to have more flexible and dynamic features than compiled languages, making them well-suited for rapid prototyping and scripting.

Some examples of popular interpreted languages include Python, JavaScript, Ruby, and PHP.
Project 2 Update - 4/4
Published: 2023-04-04 10:01:48

# Update 
- Overall in terms of the project we have made progress with setting everything up, we have also got the card working so that the the variables on the card can be changed through the constructor instead of hard coded values, we are working on implementing the search feature, but are facing some difficulties in doing so. 

# Q/A

1. We have not gotten the search function resulting in rendering of the cards setup, however we will get it done in the next couple of days.
2. ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0k68cqgts0nh98jjreu8.png)

3.An example of a micro-frontend being used in the real world could be on YouTube, where you can see the ratio of likes to dislikes on video. The approach with micro-service architecture would allow us to work on different parts of the companies website individually, allowing for the website to be slowly updated and changed. 

# Questions 
- In terms of the search, when a card name is searched, should all other cards except the named one be hidden, or should the card which has been searched only be highlighted?
Türkisches iptv kaufen
Tags: turkey, iptv
Published: 2023-04-04 11:38:36

Sie möchten türkisches IPTV kaufen ?

gehen Sie auf [](https://iptv25.net) dort können Sie sich eine 24 stunden iptv testline für Türkei holen.

Wir haben viele Türkische Sender über IPTV.

Testen Sie heute noch unser IPTV es ist sehr stabil für Türkei, sehr viele auswanderer schauen unser Türkisches IPTV
Ternary Operators in under 200 words!
Tags: java, python, programming, tutorial
Published: 2023-04-10 04:11:19

Have you ever wanted to write an if-else statement in one line? 
Welcome to Ternary Operators! The basic format of a Ternary Operator follows the pseudo code below : 
```
(conditional) ? true-value : false-value
```
This simple concept allows a user to pass a conditional and replace that line of code with either the true or false value. This can either return a function or even a value if needed. 
For example :
```
x = (conditional) ? true-value : false-value
```
This will set the value of x to either the true value if the conditional is true and vice versa if the conditional is false. 

In each language, ternary operators have slightly different syntax in relation to the `?` and `:` but let's review what the syntax looks like in both Python and Java below: 

## Python Implementation
```python
x = 'hello' if val < 4 else 'goodbye'
```
## Java Implementation
```java
String x = (val < 4) ? "hello" : "goodbye";
```

Now go out there and start using Ternary Operators where you see fit! If you are unaware whether your language of choice uses them, please check out this [list](https://en.wikipedia.org/wiki/Ternary_conditional_operator#Programming_languages_without_the_conditional_operator)!