teleren/devto huggingface dataset:
What should you do after you fail the technical interview?
Tags: discuss, career, job
Published: 2019-02-10 01:53:33

---
title: What should you do after you fail the technical interview?
published: true
description: 
tags: discuss, career, job
---
<img src="https://media1.tenor.com/images/134fca67c61685d8deeba3b7e2d5ddad/tenor.gif?itemid=4469319">

<i>Asking for a friend, of course...</i>

But really. I'm not currently interviewing, but I've failed plenty of technical interviews before and I still shudder thinking of my very first one. 

I bombed it. 

After, I didn't know what to do. I wondered if I should just give up.

Doing poorly in a technical interview meant I wasn't cut out to be a developer. At least, that's what I believed at the time. 

Fast forward to today and I know that isn't true. But I often hear aspiring developers talk about how failing technical interviews shook their confidence afterwards and made them question if they could really become devs. 

So here's a question that I'd love to hear the answer to from other developers--how do you bounce back after a technical interview? What do you tell yourself? What do you do next?

One thing that's been helpul for me:

<u>Always figure out the answer later.</u> At the end of the interview, it seems like I'll <i>never</i> understand what the solution to the technical problem presented to me was. But later, when I learn as I go over it, I see that I can. That helps rebuild my confidence as I identify the knowledge gap that preventing me from understanding the problem, and I close that gap.

But I wish I would have known this sooner. That's why I created this thread.

<b>In your experience, what should you do after you fail the technical interview to ensure that you'll learn and grow as a developer <i>because</i> of the experience, not in spite of it?
</b>
the easiest way to make an animated flip card using html & css
Tags: html, css, begginers
Published: 2019-02-09 22:56:41

---
title: the easiest way to make an animated flip card using html & css
published: true
description: a tutorial
tags: html,css,begginers
---
<img src="https://thepracticaldev.s3.amazonaws.com/i/ojjgin3yyeyd5hknyvas.gif">

this is for me the most simple and easiest way to make an animated flip card using HTML5 & CSS3 
https://doctorcodetutorial.blogspot.com/2019/02/how-to-make-flip-card-effect-using.html
What's your favorite algorithm?
Tags: computerscience, discuss
Published: 2019-02-09 22:21:43

This is my favorite question to ask for technical recruiters - everyone has a unique story, you can have a better understanding of the company and the person, and of course, a conversation can easily follow afterward. I heard various shuffle algorithms, bloom filters, HyperLogLog and etc.

Mine is more of a technique, but I really liked it because of its simplicity. 
Including a mini explanation below *(for the curious)*.

What's your favorite algorithm? :)


```javascript
/* 
 * Question:
 * Given an array of integers from 1 <= A[i] <= n, 
 * some elements repeat twice and others only once.
 *
 * Your task is to find the elements which repeat twice.
 * Without using any extra space and in O(n) time.
 */

/*
 * The key here is not to use a hashmap, O(N) space, 
 * but to flip the numbers from positive to negative.
 *
 * When you traverse the array you can map the number 5 to index 4 
 * (we will check by sign and not value for duplicates) and if it is not negative 
 * - meaning it has not repeated - negate it. If it is negative, you know it has been 
 * already encountered. 
 * 
*/

const A = [5,2,1,4,2,1,7];

function findDuplicates(A) {

 const oldLength = A.length;
 for (let i = 0; i < oldLength; ++i) {
   const value = Math.abs(A[i]) - 1; // ignoring the sign and get the value

   if (A[value] > 0) A[value] *= -1;
   else A.push(value + 1);
 }

 return A.slice(oldLength);
}

```
How To Improve OCR Accuracy?
Tags: android, tesseract, ocr, help
Published: 2019-02-09 11:10:49

---
title: How To Improve OCR Accuracy?
published: true
description: Using tesseract library to OCR English text on Android smartphones.
tags: Android, tesseract, OCR, help
---

I spend the past few days on developing Android app to recognize English text on images to let the user copy/share text easily. I published a [testing release of the app on Google Play](https://play.google.com/store/apps/details?id=com.softwarepharaoh.img2txt).

The UI is awful but I want to improve accuracy of the app first. I am thinking of two methods:

1. improve tesseract __traineddata__ file for better recognition of text.
2. use a false recognition dictionary which replace a word like `boxmg` to `boxing` as the `in` is false detected as `m`.

Let me know if you have any further improvements and suggestions for this Text OCR app.

THANKS FOR YOUR EFFORTS!
Template design pattern in Ruby. Any reason not to use a module instead of a superclass?
Tags: ruby, oop, discuss
Published: 2019-02-09 21:13:53

---
title: Template design pattern in Ruby. Any reason not to use a module instead of a superclass?
published: true
description: 
tags: ruby, OOP, discuss
---

The classic template design pattern uses inheritance to declare which methods its subclasses must define, like so:

```ruby
class Template
  ABSTRACT_METHOD_ERROR = 'You forgot to define that method.'

  def method_defined_in_class
    raise ABSTRACT_METHOD_ERROR
  end

  def method_not_defined_in_class
    raise ABSTRACT_METHOD_ERROR
  end
end

class ObjectFromTemplate < Template
  def method_defined_in_class
    'You remembered! No errors here.'
  end
end

obj = ObjectFromTemplate.new

obj.method_defined_in_class # => 'You remembered! No errors here.'

obj.method_not_defined_in_class # => RuntimeError (You forgot to define that method.)
```

I have been wondering if there is a reason not to use a module for the template instead.

```ruby
Module Template
  ABSTRACT_METHOD_ERROR = 'You forgot to define that method.'

  def method_defined_in_class
    raise ABSTRACT_METHOD_ERROR
  end

  def method_not_defined_in_class
    raise ABSTRACT_METHOD_ERROR
  end
end

class ObjectWithTemplate
  include Template

  def method_defined_in_class
    'You remembered! No errors here.'
  end
end

obj = ObjectWithTemplate.new

obj.method_defined_in_class # => 'You remembered! No errors here.'

obj.method_not_defined_in_class # => RuntimeError (You forgot to define that method.)
```

The second way seems obviously better to me (for all the reasons that composition is generally to be favored over inheritance), but I've never seen it done this way. Any thoughts or experiences to share?
Clickjacking on Google CSE. Is this Important?
Tags: security, testing
Published: 2019-02-09 21:06:01

While i was testing i found that cse.google.com is vulnerable to clickjacking so i checked if the settings page is vulnerable or not and it was vulnerable so now this has a risk! The attacker could delete someone's CSE.

{% twitter 1094333150086320130%}

Summary: Attacker can delete victim's CSE.

Steps to reproduce:
  1. Go to https://cse.google.com/
  2. It can be embedded into any webpage.
  3. Attacker may manipulate HTML template so it can delete victim's CSE.

I wrote an exploit code for clickjacking and here is the exploit code:
```html
<center>
<div style="position: absolute; left: 100px; top: 10px;"><h3>Let's consider this is a game!</h3></div>
<div style="position: absolute; left: 100px; top: 40px;"><h3>To finish it, you have to press the keys in sequence.</h3></div>
<div style="position: absolute; left: 205px; top: 278px; color: red;"><button>1</button></div>
<div style="position: absolute; left: 300px; top: 178px; color: red;"><button>2</button></div>
<div style="position: absolute; left: 400px; top: 475px; color: red;"><button>3</button></div>
<iframe style="opacity: 1; border: 0; position: fixed; top: 0px; left: 0px;" src="https://cse.google.com/" width="100%" height="100%"></iframe>
```


By using Clickjacking technique, an attacker can make someone unconsciously delete their CSE.

About how attacker can make someone unconsciously delete their CSE, you can check my video PoC here:
{% youtube Fkzm8ZUFZ0E%}
Enough about the explanation.

Okay, the problem has just begun. My findings above, in my opinion are valid bugs. Why? Because the attacker can delete someone's data (CSE), isn't this a bug? But the response I got was very surprising.

![Google's response about my report](https://i.imgur.com/Yw3bqsn.png)
![Google's response about my report](https://i.imgur.com/AlYR7FV.png)

The part that makes me confused is, how is this not a bug? Because in my head it is clear that I can delete other people's data.

What do you think? Is this a bug? Or is it just me who overestimates this as a bug?
Can You Find The Bug in This Code?
Tags: javascript, debugging, programming
Published: 2019-04-03 02:42:25

---
title: Can You Find The Bug in This Code?
published: true
tags: javascript, debugging, programming
canonical_url: https://victorzhou.com/blog/a-javascript-bug-i-had-once/
---

Here’s a bit of Javascript that prints “Hello World!” on two lines:

```javascript
(function() {
  (function() {
    console.log('Hello')
  })()

  (function() {
    console.log('World!')
  })()
})()
```

…except it fails with a runtime error. Can you spot the bug without running the code?

Scroll down for a hint.

  
 
---

---

---  

---  

---  
  
  
  
  

## Hint

Here’s the text of the error:

```
TypeError: (intermediate value)(...) is not a function
```

What’s going on?

Scroll down for the solution.

  
  
  
 
---

---

---  

---  

---  
  
  
  
  
  
  

## Solution

One character fixes this code:

```javascript
(function() {
  (function() {
    console.log('Hello')
  })();
  (function() {
    console.log('World!')
  })()
})()
```

Without that semicolon, the last function is interpreted as an argument to a function call. Here’s a rewrite that demonstrates what’s going on when the code is run without the semicolon:

```javascript
const f1 = function() { console.log('Hello'); };
const f2 = function() { console.log('World!'); };

f1()(f2)();
```

There are 3 function invocations in that last line:

- `f1` is called with no arguments
- The return value of `f1()` is called with `f2` as its only argument
- The return value of `f1()(f2)` is called with no arguments

Since the return value of `f1()` is not a function, the runtime throws a `TypeError` during the second invocation.

With the semicolon added, this becomes:

```javascript
const f1 = function() { console.log('Hello'); };
const f2 = function() { console.log('World!'); };

f1();(f2)();
```

Which runs as expected.

## Wait, you had this bug once?

Yup.

## Why would you ever write code with so many Immediately Invoked Function Expressions ([IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE))?

It’s a long story - [this post](https://victorzhou.com/blog/why-you-should-use-webpack/) explains how I wrote bad enough code to have this bug.

## The Lesson

**Always use semicolons**. This specific case was a bit contrived, but something similar could happen to you. Here’s another Hello World program that fails for a related reason:

```javascript
const a = 'Hello'
const b = 'World' + '!'
[a, b].forEach(s => console.log(s))
```

I’ll leave figuring this one out as an exercise for you.

Most Javascript style guides require semicolons, including [Google’s](https://google.github.io/styleguide/jsguide.html#formatting-semicolons-are-required), [Airbnb’s](https://github.com/airbnb/javascript#semicolons), and [jQuery’s](https://contribute.jquery.org/style-guide/js/#semicolons). To summarize: **always use semicolons**.
Interaction Rust with Julia
Tags: rust, julia
Published: 2018-11-03 07:34:10

---
title: Interaction Rust with Julia
published: true
description: 
tags: Rust, Julia
---
 
Rust and Julia are two promising languages focusing on speed, integrating them will help achieving great results.

Let's say we have the below Julia code, and we want to cal it from Rust code:

```julia
# __precompile__()   # If required to be kept precompiled for faster execution
# name = isempty(ARGS) ? "name" : ARGS[1] # To check input arguments
println("hello from Julia function")
```

Then we can call it using the below:

```rust
use std::process::Command;

fn main() {
    println!("Hello from Rust");
    let mut cmd = Command::new("Julia");
    cmd.arg("main.jl");
    // cmd.args(&["main.jl", "arg1", "arg2"]);
    match cmd.output() {
        Ok(o) => unsafe {
            println!("Output: {}", String::from_utf8_unchecked(o.stdout));
        },
        Err(e) => {
            println!("There was an error {}", e);
        }
    }
}
```

Then, the rust file can be executed by running `cargo run`:

From the other other hand, let's say we have the below rust file:

```rust
#[no_mangle]
pub extern fn double_input(input: i32) -> i32 {
    println!("Hello from Rust");
    input * 2
}
```

First we need to define proper cargo file to create the library, and calling `cargo build`:

```cargo
[package]
name = "julia_call_rust"
version = "1.0.0"
authors = ["hasan yousef]

[lib]
name = "my_rust_lib"
crate-type = ["dylib"]
```

Then the the functions in this lib can be called from Julia code as:

```julia
println("Hello from Julia")
input = 10 #Int32(10)
output =  ccall(   #(:function or "function", "library"), Return type, (Input types,), arguments if any)
                (:double_input,
                "target/debug/libmy_rust_lib"),
                Int32,          # Return type
                (Int32,),       # (Input types,)
                input)          # Arguments if any
println("As result of $input * 2 is: $output")
```

Then, by running `cargo build` to get the rust library built, and by running `julia main.jl` you'll get the required output.
Few Tips When You Are Building A Chat On Website
Tags: productivity
Published: 2019-02-09 18:53:50

I just posted this on twitter and thought to provide some personal observation when I encounter a chat feature on some website.

{% twitter 1094300485727723521 %}


I love using the chat feature on any site that it offers, because I just find it more personal and get my questions answered faster than calling or emailing.

A few days ago I had some questions for my bank, usually, I call them, however, this time I wanted to chat with them as I had some other work to do + the question was pretty generic. 

**Story:** Popped open the chat, asked the questions and hit submit button. The next thing I know is that I was 6th in line with 12 minutes of wait time. So I set a reminder for 10 minutes. After 10 minutes I pop open separate little window and found out that the rep was asking me for response 5 minutes after I submitted my request. 

**Problem:** I thought the chat had sound enabled or sound feature, meaning that when rep connects with your session and says "Hello" I get the sound on my laptop. 

**Solution:** I think it's self-explanatory, enable the sound feature.

While ago, there were few sites I was on and encountered mildly infuriating issues. 

**Story:** I was looking into this tech product, and wanted to know more about it. Saw in left corner a chat with "ONLINE" tag, so I thought to give it a try. 

I put my name in, fake email (because I do not want to be subscribed to their mailing list) and I entered my question. 

```Hi, my name is Joe and I really like the demo that you have on the website, would you mind telling me how does product X integrate with product Z? ENTER```

Right after I hit enter, it said: 

_Thank you for contacting our support, your ticket has been sent to our support team, one of our representatives will reach out to you via phone or email_

**Problem:** Don't have a chat feature enabled if it serves a purpose just so you can get my email, phone or company I work for. If it says Online I expect that a representative on the other end will connect to the session and be able to answer my question right on the spot.

**Solution:** Either disable that chat future or tag it as OFFLINE when there is nobody to answer questions at that moment. If a site in the story above would have OFFLINE chat and said something like: Open ticket, you would get my Name and my Email address. 


**Story:** "AI" Chatbots. And chats that for most questions lead you to call the company rep anyways.

**Problem:** It's not "AI" Chat, it is you who generated most F.A.Q, and provided answers to those quetions. 

**Solution:** Either don't call it AI or add the ability to talk to a real person via chat. 


I hope some of these stories I've encountered, help some of you to think about how your future or current clients think about chat experience.
Setting up a 'Recent Posts' section using Twig
Tags: php, productivity, beginners, webdev
Published: 2019-02-09 18:27:55

I'm embarrassed to admit that when I initially setup my Grav blog, I did so without much forethought. My entire home page was coded directly into the WYSIWYG. It was pretty simple so I got away with it for a bit.

![](https://thepracticaldev.s3.amazonaws.com/i/2ppbc8z8em5nhx27cqqz.png)

It wasn't until I went to update my "Recent Essays" section today that I realized how poorly I had setup my homepage. So I spun up my local environment and got to work on a quick fix.

### Auto pull the five most recent posts

Using <a href="https://learn.getgrav.org/cookbook/twig-recipes">this post</a> I found in the Grav documentation, I was able to take the first example and tailor it to my needs with ease. I came up with the following:

![](https://thepracticaldev.s3.amazonaws.com/i/w4gcdhaeedpi9uhu3iv6.png)

And with that, I no longer have to worry about manually updating my homepage every time I write a new blog post. I simply write, publish, and call it a day.
Is it just my phone or Dev.to is heavy?
Tags: questions, chrome, android, discuss
Published: 2019-02-09 18:21:55

---
title: Is it just my phone or Dev.to is heavy? 
published: true
description: 
tags: questions,chrome,android,discuss
---

I have A Samsung Galaxy S5 Mini with the latest official update (6.0.1) and latest version of Chrome and Android Web View. I notice that Dev.to behaves good on the browser except when I swipe to open the sidebar (each one). The page starts to lag until I close the sidebar. 

This feature works good with other websites that I have visited. I want to learn about PWA and want to know if this is something related to my hardware limitation or something else. 

Thank you in advance for reading :)
Help with some C#.Net
Tags: help, csharp
Published: 2019-02-09 17:14:38

---
title: Help with some C#.Net
published: true
tags: help, Csharp
---

I am hoping someone can lend a hand here since I am by no means a C# developer. I tried to post on SO but get massacred off the bat. But that's another story.

I have no build errors, but when I go to debug I get the following in the browser.

> Compiler Error Message: CS0234: The type or namespace name 'StoreUsersDataTable' does not exist in the namespace 'VirtualManager' (are you missing an assembly reference?)

> Source Error:


> Line 166:
> Line 167:         VirtualManagerWAP.VirtualManagerTableAdapters.StoreUsersTableAdapter storeUsersTA = new VirtualManagerWAP.VirtualManagerTableAdapters.StoreUsersTableAdapter();
> Line 168:        VirtualManager.StoreUsersDataTable storeUserTbl = storeUsersTA.GetStoreUsersByUserId(StoreId.ToString(),ParentId);
> Line 169:        foreach (VirtualManager.StoreUsersRow row in storeUserTbl)
> Line 170:        {


https://thepracticaldev.s3.amazonaws.com/i/5vqzbda0gjv6h08whggn.png

It also shows I have 2 contexts I assume they are called, with the same name. BTW, this was all inherited.

Anyway, I hope someone can help me out and not get chastised. :) peace and love, peace and love.
Deploy it right! Use tools to automate Integration and Delivery
Tags: cicd, teamcity, azure, visualstudio
Published: 2020-01-12 20:13:37

---
title: Deploy it right! Use tools to automate Integration and Delivery
published: true
date: 2019-02-09 16:56:57 UTC
tags: CI/CD,TeamCity,Azure,Visual Studio
canonical_url: https://christophweigert.com/deploy-it-right-use-tools-to-automate-ci-and-cd/
---

 ![Deploy it right! Use tools to automate Integration and Delivery](https://christophweigert.com/content/images/2019/02/devops-3148393_1280.png)

How often did you right-click in your solution and hit deploy? How often did your colleagues asked you what they have to do when deploying? **Automate it!** Simply as that. There are many wrong ways of "publishing":

- Copy & Paste your release folder
- Provided files by Mail/FTP
- Every Person follows their own release process
- Right-click \> publish

![Deploy it right! Use tools to automate Integration and Delivery](https://christophweigert.com/content/images/2019/02/Rightclickpublish.gif)

All the above steps are right in the initial phase of a new project. Like first and second deployment. But as seen as it's in production or you have many developers working on the same project you should immediately stop this behavior!  
You may think, why the heck should I do this? Here are some excellent reasons:

- Are you sure, you are using the latest Source Code?
- Did all Tests succeed? What about specific tests that pass on your machine but not in production? 
- Was your last merge successful, have all commits been resolved?
- Are you following the defined release process?

## The goal is predictability

Wouldn't it be nice always to have the same, standardized way of publishing and deploying? No more error-prone environment configurations like app settings or connection strings. Manual database setup, missing libraries, and so on. You can even roll back to a previous version if you found a critical flaw.

## Save time and money

But what's the RoI? Let's do quick math. If every release costs you 15 minutes and every deployment to each tenant another 10 minutes. On the other side, it takes you 8 hours to set up your Continuous Integration and Continuous Delivery pipeline. How many releases until you recovered that time?

At least if you have one test target, you'll get that time back really quickly. Think about how long it takes to do all the required steps it takes (merge, compile, run tests, deploy to Q&A \> Test \> Production.

Can you use right-click publish to go to production? Sure, you can, but you shouldn't.

## Start today

I'll cover CI/CD in the upcoming weeks. But here are some fundamental links:

- [TeamCity](https://www.jetbrains.com/teamcity/): Great to set up a basic, automated Builds and Publish process
- [Azure Pipelines](https://azure.microsoft.com/de-de/services/devops/pipelines/): Alternative to TeamCity
- [AppCenter](https://AppCenter.ms): Build and deploy mobile apps with ease!
- [Jenkins](https://jenkins.io/): An open-source automation server for build and deployment
- [Octopus Deploy](https://octopus.com/): Send your release to Q&A, staging, and production. Scheduled and automated!