teleren/devto huggingface dataset:
Ruby/GTK3 - RaddioButton
Tags: ruby
Published: 2020-02-25 14:32:12

---
title: Ruby/GTK3 - RaddioButton
published: true
description: making radio button with ruby/gtk3
tags: ruby
---

`gem install gtk3`

# RadioButton

Radio button allows the user to choose only one option.

![raddio button](https://dev-to-uploads.s3.amazonaws.com/i/170mi17zo3q42l59v7v6.png)


```ruby
require 'gtk3'

class RadioButtonWindow < Gtk::Window
  def initialize
    super
    set_title 'RadioButton Demo'
    set_border_width 10

    hbox = Gtk::Box.new(:horizontal, 6)
    add hbox

    button1 = Gtk::RadioButton.new(label: 'Button 1')
    button1.signal_connect('toggled') { |b| on_button_toggled b, 1 }
    hbox.pack_start(button1)

    button2 = Gtk::RadioButton.new(member: button1, label: 'Button 2')
    button2.signal_connect('toggled') { |b| on_button_toggled b, 2 }
    hbox.pack_start(button2)

    button3 = Gtk::RadioButton.new(member: button1, label: 'B_utton 3',
                                   use_underline: true)
    button3.signal_connect('toggled') { |b| on_button_toggled b, 3 }
    hbox.pack_start(button3)
  end

  def on_button_toggled(button, name)
    state = button.active? ? 'on' : 'off'
    puts "Button #{name} was turned #{state}"
  end
end

win = RadioButtonWindow.new
win.signal_connect('destroy') { Gtk.main_quit }
win.show_all
Gtk.main
```

output
> Button 1 was turned off
> Button 2 was turned on
> Button 2 was turned off
> Button 1 was turned on
> Button 1 was turned off
> Button 3 was turned on

The options `member` and `use_underline` are defined [here](https://github.com/ruby-gnome/ruby-gnome/blob/master/gtk3/lib/gtk3/radio-button.rb).


* [Python version](https://python-gtk-3-tutorial.readthedocs.io/en/latest/button_widgets.html#id2)
Fixing "sgen.exe" filename or extension is too long
Tags: visualstudio, csharp, sgen
Published: 2020-02-25 14:20:12

When you build a C# project in Visual Studio and get the error `Error MSB6003 The specified task executable "sgen.exe" could not be run. System.ComponentModel.Win32Exception (0x80004005): The filename or extension is too long` you can fix it by going to the properties of the C# project, and on the **Build** tab set the **Generate serialization assembly** to **off**. 

Apply this setting to both the **Debug** and **Release** configuration, otherwise it works locally (**Debug**), but fails on your build server (**Release**).

See [XML Serializer Generator Tool (Sgen.exe)](https://docs.microsoft.com/en-us/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe) for more information on the tooling.
Using SQLite's fsdir to effect a quick search index
Tags: sqlite, search
Published: 2020-02-25 14:08:02

---
title: Using SQLite's fsdir to effect a quick search index
published: true
description: Use two commands to build a search index that understands the nuances of English better than grep -R!
tags: #sqlite #search
---

_Originally published at https://hoelz.ro/blog/using-sqlites-fsdir-to-effect-a-quick-search-index_

At [work](https://www.ziprecruiter.com/hiring/technology), we have a wiki we use for knowledge sharing.  It's implemented on top of [gitit](https://github.com/jgm/gitit), which works pretty well for our purposes, but sometimes I find the search functionality lacking.  What I'd like is something that has more advanced full text search-like features - things like stemming (so that searching for "databases" finds documents that mention "database") and ranking by query relevance (so that documents that mention "database" many times are ranked higher than those that just mention "database" once).

Well, SQLite happens to have two pieces of functionality that can help in this regard: the [FTS extension](https://www.sqlite.org/fts5.html), which implements those features I just mentioned, and the [fsdir table-valued function](https://sqlite.org/src/file/ext/misc/fileio.c), which we can use to treat the filesystem like a table.  Since gitit stores its pages in a Git repository, all we need to do is clone the repository and run a few SQL snippets to build our search index:

```shell
$ git clone work:wiki
$ sqlite3 wiki-search.db "create virtual table page_search using fts5 (path, page, tokenize='porter unicode61')"
$ sqlite3 wiki-search.db "insert into page_search select name, data from fsdir('wiki')"
```

Now we can search the wiki and benefit from those features: `select path, snippet(page_search, 1, '', '', '...', 30) from page_search where page_search match 'my query' order by rank`

Granted, it would be nice to do things like extract the front matter for each page, along with things like edit dates, but this works well enough.
A Complete Overview Of The Services Provided By A Mobile Marketing Agency
Tags: android, ios, startup
Published: 2020-02-25 13:50:28

Due to technological advancements, apps are being created for several purposes, including grocery shopping, dating, healthcare, renting vehicles, logistics, and the list goes on. Amidst this ocean of mobile applications, how do you make your app top the charts? That doesn’t sound very easy! But, there are no problems without solutions. Now, getting your app all the attention it deserves is not so difficult if you incorporate sound marketing strategies. 

Mobile App Marketing is the process of familiarizing people with your app, thereby maximizing its popularity factor. Owing to the massive demand for mobile applications, entrepreneurs are continuously engaging themselves in mobile app development. But for several reasons, they are not able to promote their app themselves, and they hire a marketing agency to share their workload. 

By reading further, you can understand all about mobile marketing agencies, including what services they offer, the benefits of collaborating with a mobile app marketing agency, and how to choose the right agency that would meet all your business requirements. 

Read Full Article: https://www.inoru.com/blog/a-complete-overview-of-the-services-provided-by-a-mobile-marketing-agency/
2048 Game 🕹 using Flutter - Work in Progress 🚧
Tags: dart, flutter, app, learntocode
Published: 2020-02-25 13:32:28

# Building classic 2048 game from Scratch

While browsing through algorithms to practice I came across a challenge which was to implement 'swipe left' on a given list of numbers.

So for instance, if you have a row like this:

`var numbers = [2, 0, 2, 4, 4, 8]`

and if you call `leftSwipe(numbers)` it should return

`[4, 8, 8, 0, 0, 0]`

I implemented it and thought of taking it to the next level and implement whole game logic.

So for the 2048 game, there are basically two components, (Which app doesn't have these two components 🤷🏻‍♂️)
- Logic
- UI

So I implemented logic in pure #Dart
It basically has these components:
- Left, Right, Up and Down swipe
- Add 2 randomly at empty spaces (0 in the list)
- Check if the board is full (no zeroes left)
- Check if the user has won (if 2048 is present)

You can go ahead and have a look at the code for these [steps here](https://github.com/ArnavPuri/game_2048_flutter/blob/master/lib/board_controller.dart). I know, I know, I can refactor it. I will do it later. Eventually. Promise.

I have got the basic UI working which also you can check out on [Github here](https://github.com/ArnavPuri/game_2048_flutter)

Things to add:
- Game Over and You Win notification 🎯
- Undo feature (It's not cheating if it is a feature) 😜
- Animations 🤩

As of now, this is how app looks like:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iknfx8q2b9qfioojnajf.png)


Feel free to give stars to the repo, fork it, or send me some bitcoins. 

Let me know what you think and if you would like future progress updates 😉
Azure event grid advanced filter limit
Tags: azure, eventgrid
Published: 2020-02-25 13:29:09


The azure event grid advanced filter limit is 25 filter values on a single event grid subscription, so this can be across one or more advanced filters within that single event grid subscription.

If you just have one advanced filter in an event grid subscription you can still have 25 filter values in that.

However, the azure portal will only allow us to create 5 filter values within an advanced filter (even if you just have one advanced filter!). But programmatically (CLI, PowerShell etc...) you can add more than 5 filter values. I use Azure CLI here to create an azure event grid subscription.

```
az eventgrid event-subscription create  --name "egsub-test" `
    --source-resource-id $source_resource_id `
    --endpoint-type "storagequeue" `
    --endpoint $endpoint `
    --advanced-filter data.api StringIn PutBlob PutBlockList FlushWithClose `
    --advanced-filter subject StringContains $test_objects `
    --subject-begins-with "$($generic_blob_prefix)/source/blobs/testpath/" `
    --subject-ends-with ".csv"
```

In the example I have 2 advanced filters "data.api" and "subject"

* The "data.api" contains 3 filter values "PutBlob" "PutBlockList" "FlushWithClose"

So I can have 22 more filter values in this event grid subscription.

* The $test_objects variable within "subject" contains 22 filter values (note: I have hidden the 22 filter values in a variable for brevity). 

Once executed, this is how it looks in the portal. The event grid subscription was tested and it filters as expected.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3dq3zaz94luf4hfckl0h.png)


If I increase $test_objects variable to 23, the CLI script will throw following error,

*The total number of AdvancedFilter values allowed on a single event subscription is 25.*


At the time of writing this post I found the document and portal UI slightly misleading and hence sharing this post.
https://docs.microsoft.com/en-us/azure/event-grid/event-filtering#advanced-filtering
Reducing The Friction Of Embedded Software Development With PlatformIO
Published: 2020-02-25 13:05:50

<p>Embedded software development is a challenging endeavor due to a fragmented ecosystem of tools. Ivan Kravets experienced the pain of programming for different hardware platforms when embroiled in a home automation project. As a result he built the PlatformIO ecosystem to reduce the friction encountered by engineers working with multiple microcontroller architectures. In this episode he describes the complexities associated with targeting multiple platforms, the tools that PlatformIO offers to simplify the workflow, and how it fits into the development process. If you are feeling the pain of working with different editing environments and build toolchains for various microcontroller vendors then give this interview a listen and then try it out for yourself.</p><p><a href='https://www.pythonpodcast.com/platformio-embedded-software-devleopment-episode-251/'>Listen Now!</a></p>
Easy-GateWay: The fastest way to setup a Proxy Server
Tags: proxy, gateway
Published: 2020-02-25 13:12:13

---
title: Easy-GateWay: The fastest way to setup a Proxy Server
published: true
description: When you want to debug a private service on another server, you do not need to change any code of your project by using Easy-GateWay.
tags: Proxy, GateWay
---

You may run a private service on your remote server, however, one day, you want to debug something, and do not want to change your project code. You can use Easy-GateWay to setup a proxy server to serve your private service as public.

Environment required: NodeJS 10.x

```
npm i -g easy-gateway
```

Now, for example, you want to serve your private http://127.0.0.1:6000, you can do like this:

```
egw start --port=8080 --target=http://localhost:6000 --token=asdfjw982ng98f902jofa
```

Now, some other people can visit your service by using `http://yourip:8080?token=asdfjw982ng98f902jofa`. Isn't is easy?

To stop it, you should run in current directory:

```
egw stop
```

If you want to learn more about Easy-GateWay, visit [git repo](https://gitee.com/frustigor/easy-gateway).
Learn CSS positions by coding an Airplane
Tags: webdev, css, tutorial, beginners
Published: 2020-02-25 13:11:05

CSS position initial, relative and absolute is used all over the web for designing headers, menus and more.

I tackle how the property of position and its different attributes work by designing an airplane and explaining how you can apply different offsets depending on your tag elements.
{% youtube Q_1k-h9IA4s%}
**Included in this video:**
* Introduction into CSS position
* Constructing a plane using CSS positioning (body, wings, etc)
* Position: relative versus position: absolute
* How the two positioning attributes influence each other
* What is position: fixed and how it's used

![GIF](https://adriantwarog.com/wp-content/uploads/2020/02/example-7.gif)

## Follow and support me: 
Special thanks if you subscribe to my channel :)
* [Youtube](https://www.youtube.com/channel/UCvM5YYWwfLwpcQgbRr68JLQ?sub_confirmation=1)
* [Patreon](https://www.patreon.com/adriantwarog)
* [Twitter](https://twitter.com/twarogadrian)
* [Discord](https://discord.gg/nGdThpE)

## Want to see more:
I will try to post new great content every day. Here are the latest items:
* [Adobe XD to Fully Responsive WordPress Site](https://dev.to/adriantwarog/adobe-xd-to-fully-responsive-wordpress-site-16e0)
* [Adobe XD to HTML Full Process](https://dev.to/adriantwarog/adobe-xd-to-html-full-process-ao6)
* [Full Tutorial on how to use SASS to improve your CSS](https://dev.to/adriantwarog/full-tutorial-on-how-to-use-sass-to-improve-your-css-57on)
* [Creating a Mobile Design and Developing it](https://dev.to/adriantwarog/creating-a-mobile-design-and-developing-it-5c4o)
Shining A Light on Shadow IT In Data And Analytics - Episode 121
Published: 2020-02-25 13:04:30

<p>Misaligned priorities across business units can lead to tensions that drive members of the organization to build data and analytics projects without the guidance or support of engineering or IT staff. The availability of cloud platforms and managed services makes this a viable option, but can lead to downstream challenges. In this episode Sean Knapp and Charlie Crocker share their experiences of working in and with companies that have dealt with shadow IT projects and the importance of enabling and empowering the use and exploration of data and analytics. If you have ever been frustrated by seemingly draconian policies or struggled to align everyone on your supported platform, then this episode will help you gain some perspective and set you on a path to productive collaboration.</p><p><a href='https://www.dataengineeringpodcast.com/shadow-it-data-analytics-episode-121/'>Listen Now!</a></p>
Daily Developer Jokes - Tuesday, Feb 25, 2020
Tags: jokes, dailydeveloperjokes
Published: 2020-02-25 13:00:21

---
title: "Daily Developer Jokes - Tuesday, Feb 25, 2020"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
cover_image: "https://private.xtrp.io/projects/DailyDeveloperJokes/thumbnail_generator/?date=Tuesday%2C%20Feb%2025%2C%202020"
published: true
tags: #jokes, #dailydeveloperjokes
---

Generated by Daily Developer Jokes, a project by [Fred Adams](https://xtrp.io/) ([@xtrp](https://dev.to/xtrp) on DEV)

___Read about Daily Developer Jokes on [this blog post](https://xtrp.io/blog/2020/01/12/daily-jokes-bot-release/), and check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/).___
### Today's Joke is...
![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e12593f93b65.png)

---
*Have a joke idea for a future post? Email ___[xtrp@xtrp.io](mailto:xtrp@xtrp.io)___ with your suggestions!*

*This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit.*

<!-- 
Joke text:
___Q:___ I love you and I only love you. Does that turn you on?

___AND GATE:___ No.
 -->
The wall of technical debt
Tags: todayilearned, programming, startup, career
Published: 2020-02-25 13:00:11

*TL;DR notes from articles I read today.*

### [The wall of technical debt](http://bit.ly/2ViyO3J)

A method to make technical debt visible and negotiable:
- Use a physical wall to visualize your tech debt on sticky notes. It is easy to start and maintain, yet it can usefully impact choices that add, payback or ignore the technical debt. Pick a central location with high visibility. Make the display dramatic.
- Decide on some sort of tally mark to represent costs (time or money), so it is not a matter of opinion only. Conversely, if it does not have a cost but only looks awkward, don’t log it as debt.
- Build a working habit and stay honest  
- Keep your notes short but easy to understand - what made code difficult to understand, what slowed it down, why a bug was hard to find, what should have been better documented or tested. Estimate the opportunity cost as well as time to fix the issues. If your team is using an issue tracker, add the ID to the sticky notes. 
- Negotiate tradeoffs based on this visualization. Discuss as a team whenever someone needs to add a note or time notation whether it is faster or cheaper to fix the debt. If it is, fix it right there and then. If not, add it to the wall. Give away control to managers to decide what to focus on.
- Beware of starting with a complete debt audit - it can become its own bottleneck as it calls for buy-in and tends to get put off indefinitely. 

*[Full post here](http://bit.ly/2ViyO3J), 7 mins read*

---

### [Scaling to 100k users](http://bit.ly/2Vm2jC2)

- When you first build an application, API, DB and client may reside on one machine/server. As you scale up, you can split out the DB layer into a managed service. 
- Consider the client as a separate entity from the API as you grow further and build for multiple platforms: web, mobile web, Android, iOS, desktop apps, third-party services, etc.
- As you grow to about 1000 users, you might add a load balancer in front of the API to allow for horizontal scaling.
- As serving and uploading resources start overloading servers, at say 10,000 users, move to a CDN, which you can get with a cloud storage service for static content so the API no longer needs to handle this load. 
- Finally, you might scale out the data layer at 100,000 users, with relational database systems such as PostgreSQL, MySQL, etc.
- You might also add a cache layer using an in-memory key-value store like Redis or Memcached so that multiple hits to the DB can be served by cached data. Cache services are also easier to scale out than DBs themselves.
- Finally, you might split out services to scale them independently, with say a load balancer exclusively for the web socket service; or you might need to partition and shard the DB, depending on your service; you might also want to install monitoring services. 

*[Full post here](http://bit.ly/2Vm2jC2), 8 mins read*

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
Do You Hoist
Tags: javascript, webdev, discuss
Published: 2020-02-25 14:00:15

---
title: Do You Hoist
published: true
date: 2020-02-25 12:52:00 UTC
tags: javascript, webdev, discuss
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/bp6uqnt5ey7mse8u1ouc.png
canonical_url: https://waylonwalker.com/blog/do-you-hoist/
---

I am working through Wes Bos's [beginnerjavascript.com/](http://beginnerjavascript.com/) I just hit module 18 on hoisting. It's something that I always knew was there, Its not something I typically see used or use myself.

# Do you Hoist?

Do you have any use cases that you use hoising? Why? It seems like a really cool feature in any language that uses it, but I dont really notice it in use.

# What is Hoising

There are many articles that cover this in far more depth, but its the idea that variable declarations and functions are defined before they are executed. This means that it doesnt matter if you call a function before or after it is defined.

# Hoisting

``` javascript
console.log(`Hello ${getUser()}`)

function getUser() {
  return 'Waylon'
}
```

Running this code will log out "Waylon"

# What about variable hoisting

I am most familiar with python which does not variable hoist so this one kinda confused me at first. It only hoists the variable declaration not the value of the variable. It defines whether the variable is going to be `var`, `let`, or `const` and sets it to undefined.

> It only hoists the variable declaration not the value of the variable.

``` javascript
console.log('name: ', name)
console.log('firstName: ', firstName)

const name = "Waylon"
```

This code will log out `name: undefined` followed by an `Uncaught ReferenceError: firstName is not defined` since `name` has been decalared and `firstName` has not been decalred.

# I don't Hoist, should I?

Really it feels weird to call function definitions before using them. I really dont have a better reason. It just feels more natural to do so.

# Is hoisting more readable?

I kinda like the idea of putting the 🥩 meat of the file up at the top so that someone reading it will see the good stuff first, then can optionally dig into the weeds if they need to.

# I started a newsletter

I recently started a newsletter, [join in](https://waylonwalker.com/newsletter) and let me know what you want to hear about.
A place for African side hustles
Published: 2020-02-25 12:48:55

I put together a small site that will tell the stories of Africans with side hustles:

https://sidehustler.africa

If you're interested in having your platform/site covered, fill in the form here:
https://forms.gle/sCmqaByj9LMo6EtTA

Tech Notes:
Built with Hugo Static Site Generator and hosted free on Github Pages.
The quickest way to move your flask app to production with Docker (In 5 minutes)
Published: 2020-02-25 12:48:05


# Features:
It uses a uWSGI server for the flask app and uses nginx to reverse proxy the requests. 

# Steps:
* Use this [template](https://github.com/ST2-EV/simple-flask-production-server) on Github to make your flask application.
* Add all your code in the app/views.py file.
* ` docker-compose build ` to build the docker containers.
* ` docker-compose up ` to run the containers on port 5000.


### [Link to github](https://github.com/ST2-EV/simple-flask-production-server)


### [link to blog](https://danklabs.tech/blog/quickest-way-to-move-your-flask-app-to-production-with-docker-in-5-minutes/)
Pokemon API and React
Tags: pokemon, react
Published: 2020-02-25 12:45:43

Hi all.

I have a couple of questions.
I have Pokemon guessing game and pokedex. I can play it on localhost and I want to make some changes, for which I need your help.

1.) I want to have option to answer question in first capital letter if I want, now only time when I write answer in lowercase, it's correct, but I want it no matter what type of letter I wrote.
2.) Count of correct answer doesn't work. I get JS response that answer is correct but counter is still on 0.
3.) When counter is right, I want progress bar for answers, number of x/151 and percentage
4.) Also I have pokedex, and I want only to see Pokemon that I guess in guessing game.

Can someone please help me with that issues? What data do you need? Link to git repo or specific file?