teleren/devto huggingface dataset:
New option to set default line caps for Aspose.CAD for .NET
Tags: csharp, cad, convert
Published: 2018-02-26 11:15:41

---
title: New option to set default line caps for Aspose.CAD for .NET
published: true
description: 
tags: csharp,cad,convert
---

Aspose.CAD for .NET is a library that  allows conversion of CAD files, for example, AutoCAD DWG and DXF files, to PDF and Raster images, without use of AutoCAD or any other software.

The 18.2 version of Aspose.CAD for .NET, due to be released on 27 February, 2018, allows setting default line cap style for lines with undefined line cap styles, which makes exported images look better in some cases.

Here is the example code to load a DWG file and save it as PDF with default line cap style set to Flat.


````csharp
using System;
using System.Drawing.Drawing2D;
using Aspose.CAD;
using Aspose.CAD.FileFormats.Cad;
using Aspose.CAD.ImageOptions;

namespace LineCapDemo
{
    class Program
    {
        static void Main()
        {
            string fileName = "TestFile.dwg"; 
            try 
            { 
                CadImage cadImage = (CadImage)Image.Load(fileName); 
                CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); 
                rasterizationOptions.PageWidth = cadImage.Width * 100; 
                rasterizationOptions.PageHeight = cadImage.Height * 100; 

                PdfOptions pdfOptions = new PdfOptions(); 
				
				//This is the new option for setting default line 
                //cap style added in Aspose.CAD for .NET 18.2 
                rasterizationOptions.PenOptions = new PenOptions 
                { 
                    StartCap = LineCap.Flat, 
                    EndCap = LineCap.Flat 
                }; 
				
                pdfOptions.VectorRasterizationOptions = rasterizationOptions; 
                string outPath1 = fileName + "_flat" + ".pdf"; 
                Console.WriteLine("output path: " + outPath1); 
                cadImage.Save(outPath1, pdfOptions); 
            } 
            catch (Exception ex) 
            { 
                Console.WriteLine(ex.Message); 
            } 
        }
    }
}

````

StartCap and EndCap are of System.Drawing.Drawing2D.LineCap Enum type.

Default line cap styles are supported for all output file formats, namely PDF, PNG, BMP, GIF, JPEG2000, JPEG, PSD, TIFF, WMF. If you won't specify a default cap style, the system will use its own default line cap style, which is different for different cases.

The complete Aspose.CAD for .NET API reference is located <a href="https://apireference.aspose.com/net/cad/">here</a>.
On Being New and Getting Good
Tags: sql, beginners, career, introduction
Published: 2018-02-26 10:28:22

---
title: On Being New and Getting Good
published: true
description: My first post, and some thoughts about my being a beginner.
tags: sql, beginner, career, introduction
cover_image: https://thepracticaldev.s3.amazonaws.com/i/j10w6rhlxe5lbs0fp4zi.jpg
---

Premise 1: There’s a lot of data out there.
Premise 2: This data is most usable when organized.
Corollary 1: A lot of data needs to be organized (ideally into related tables).
Premise 3: It behooves me to expand my skillset in needed areas.
Conclusion: I should learn SQL.

This makes sense, right?! It’s too late now anyway. Not only have I never studied formal logic, but I’ve already purchased the book. In fact, I bought it months ago.

### "Why do I care," you ask.

Here’s the thing: I'm not a CS major. I have an MS in computational physics. Why does this matter? Because if you’re in similar shoes and want to do anything in the area of, e.g., data science, analytics, or statistical modeling, _you’re wholly unprepared._

Clearly it’s not that we’re uneducated! In my case, I’m fairly comfortable with Python. I've dealt with and cleaned dirty data. I've applied machine learning algorithms to large datasets. These matter to potential employers, right?

So I browse job boards, as one does. I apply the necessary filters so that I'm staring only at a wall of entry-level positions. OK, so I've got an inkling of Python, lots of MATLAB, and a sliver of C++ experience... but Java? SQL? R? Ruby? SAS? These are **all** on a single entry-level job posting!

### "What's your point, good sir?"
With my own field somewhat saturated, the career option I'm trying to open up _is_ arguably a bit of a sidestep, but I was initially pretty overwhelmed at how underprepared I seem to be. Or else, how overprepared I'm expected to be. But instead of either being stagnant or fretting about what I should do next, I decided to learn something new. 

You know... git gud. 

And if nothing else, it helps my sanity. If you're anything like me, you need to learn, need to press on, need to feel like you're doing _something_ that will help you later on.

**So this is my point.** Even when you're not where you want to be, investing in an otherwise useful skill is never a bad idea. In fact, if you're not pushing forward, you're probably falling behind.

### Back to SQL...
So here I am, learning the ins and outs of DCL. Eh... who am I kidding? I've been fighting with permissions for hours.

### Oh, BTW
I'm new and this is my first post, so hello all!
Refactoring if statements
Tags: softwaredevelopment, class, design, development
Published: 2019-11-28 11:01:55

---
title: Refactoring if statements
published: true
date: 2018-02-26 08:00:32 UTC
tags: Software Development,class,design,development
canonical_url: https://www.funkysi1701.com/2018/02/26/refactoringifstatements/
---

The code base I am working on contains a huge if block. By huge I mean 77 if statements one after the other, each if checks to see what page id you are on and loads different content. This is not easy to maintain and I want to refactor it.

One option would be to replace the if statements with a switch block. However this is just as unmanageable as the huge if block. Lets look at a better option.

**Polymorphism** is where you create a base class and then create sub classes from it. In my case I created an interface IPage with a single method CreateContent.

```
public interface IPage { string CreatePageContent(); }
```

and then create 77 classes for each page which implemented this single method.

Now comes the fun bit how do I call the correct page class from my original code?

I created a dictionary than maps page ids to the class names.

```
public static Dictionary<PageIds, Type> PageIdToClass = new Dictionary<PageIds, Type>() { { PageIds.HomePage, typeof(HomePage) }, { PageIds.ContactPage, typeof(ContactPage) }, //etc }
```

This is the one step I am not 100% happy with as I think it may be possible to remove or simplify this step.

Now I have a way to map ids to classes I can write a class to do this.

```
public class MyPage { IPage \_repo; public MyPage(int pageId) { PageIds p = (PageIds)pageId; Type t = PageIdToClass[p]; ConstructorInfo constructor = t.GetConstructor(new Type[] { }); \_repo = (IPage)constructor.Invoke(null); } public string Create() { return \_repo.CreatePageContent(); } }
```

So in my constructor I take the pageId and pass it to my dictionary to get which subclass to load. I then get its Constructor and invoke it.

Now I can remove the huge if block and replace it with a single line of code.

```
var page = new MyPage(pageId);
```

On the face of it this change might look like a lot of work for not much gain as we started off with one file and now we have the original file, an interface, 77 subclasses and the MyPage class. However the original file is a lot more manageable and each sub class can be altered independently of each other.

This is a big step towards making this code more maintainable, there is always more that can be done but that can wait for another day.
Can we use a good configuration gaming laptop for programming?
Tags: discuss
Published: 2018-02-26 07:56:31

---
title: Can we use a good configuration gaming laptop for programming?
published: true
tags: discuss
---

Currently, I am using an Intel i3- 3rd generation laptop with 4Gb of Ram. Now I am willing to purchase a new laptop for programming purpose (Machine Learning and application development).

I have seen many laptops on the internet with the good configuration in a different price range. But I find this [Apple MacBook Pro MLH32HN/A Laptop 2016](https://www.amazon.in/Apple-MacBook-MLH32HN-Laptop-Graphics/dp/B01N2NJCTJ/ref=pd_cp_147_2/259-2965079-3377937?_encoding=UTF8&psc=1&refRID=1QP73DG6MTMHYFEB02FA) the best laptop in range.

But then my elder brother suggested me to buy this [Dell Inspiron 15 7000 7567](https://www.amazon.in/Dell-15-7567-i7-7700HQ-Backlight/dp/B0759KKWHS/ref=pd_cp_147_3?_encoding=UTF8&psc=1&refRID=8XSQPF0A5J2JPMEJSYDS) because it has better configuration then Macbook pro and price is also less.

Now my question is which laptop should I buy, considering that I don't play computer games and will use the laptop only for programming purpose.
Mutable State is to Software as Moving Parts are to Hardware
Tags: mutablestate, functional
Published: 2020-03-15 11:22:38

---
title: Mutable State is to Software as Moving Parts are to Hardware
published: true
date: 2018-02-26 07:45:29 UTC
tags: mutable-state, functional-programming
canonical_url: 
---

![](https://cdn-images-1.medium.com/max/1024/1*aXBsF84bXpk_xOifUVrE8w.jpeg)<figcaption>Photo by <a href="https://unsplash.com/@bill_oxford?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bill Oxford</a> on <a href="https://unsplash.com/s/photos/gears?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption>

..in that, there are categories of problems that can’t really be solved without it, but as soon as you introduce it, your whole system becomes just a bit more fragile. You get that whole “I can’t stop it right now, it’s in the middle of something”-concern to worry about.

Additionally, there are a problems that you _can_ solve without it, but where the immutable solution will perform poorly. In that case, it is probably best to start out with the immutable solution and make the switch no sooner than the day you realize that you can’t postpone it any more.
Your developer timeline
Tags: discuss
Published: 2018-02-26 00:47:40

---
title: Your developer timeline
published: true
tags: discuss
---

Can you make a small timeline with the stuff you have learned so far? Let's stay with programming languages and frameworks only as things as design patterns and tools probably were being absorbed in the process, here is mine:

| Time | Learned |
|---|---|
| Point 0 | HTML + CSS |
| 6 mo | Stylus and jQuery |
| 1 y/6 mo | Javascript |
| 1 y/8 mo | Ruby and RoR |
| 1 y/10 mo | Angular 2 |
| 2 y | AngularJS |
| 2 y/4 mo | Shopify Liquid |
| 2 y/8 mo | React |

#### It's a small experiment to see how people jumped into languages, specially those self taught
Security Sprint: What I learnt in a CTF
Tags: security, ctf, hacking, tools
Published: 2018-02-25 22:17:11

---
title: "Security Sprint: What I learnt in a CTF"
published: true
description: Learning new tools in a hacking game.
tags: security, ctf, hacking, tools
---

For the ones who are not close to security related slang, **Catch The Flag** is an online hacking game that consist in hacking stego, web, network, etc in order to get passwords (the flags) and catch them all before the rest of the contestants. So through three days, I played one of those organized by my university, with a team mostly dedicated in Network and Forensic study. I won't be explaining all the process here, but I want to point out all the tools I used (most of them brand new for me) for solving the problems. 

![](https://images.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o72F1tCu4fOqwMUk8%2Fgiphy.gif&f=1)

- **tcpdump**: I already [wrote about this tool](https://dev.to/terceranexus6/security-sprint-week-2---choosing-a-nice-point-to-sniff-and-using-tcpdump-for-packet-analysis--e9) but I found it very useful this time too. It's a network scanning and processing tool that allowed me to find out a weird file in a network that actually contained the _flag_ . When other tools were blocked by the system, this one remained. Yay! it's also a command line tool in linux, flexible and handful. 

- **Nikto**: This is a very useful network scanning tool that unfortunately was blocked by the CTF system, but it might be useful in real life or other CTF's. it has a lot of options, including -e that looks for weird files. An example of a host scanning is `nikto -host {host}`

- **nmap**: A classic network scanning tool. For example `nmap -v -sn {host}`

- **Identify**: Helped me giving me information about and image, using a command such as `identify -verbose image.jpg`

- **stegosolve**: As it names indicates, it's a tool that works specially for steganography. Actually what this program does can be done directly using **Gimp**. But it's faster this way. It plays with ganma colors of an image as well as the saturation. It's a java program so an example would be `java -jar stegosolve.jar image.png`

- **Binwalk**: This is also for steganography, this tool can find binary files such as zip files or txt or another image, inside an image. I actually used **ghex** first and saw there was a "PK" in the translated hexadecimal, which means there's a ZIP inside it. But without Binwalk it would have been more difficult to catch it. It's posible using **dd** like `dd if=image.png bs=1 skip=the_line_in_decimal_where_PK_is of=foo.zip` but Binwalk is a better option. `binwalk -e image.png` and it's done. 

- **Volatility**: Last but not least, volatility is like pure magic. Is a powerful forensic tool that allows to look for clues in dump files. 

Depending on the puzzles and the hacker, some other tools could be useful. IN my case these are all framed in Debian jessie linux, and taking advance of the terminal, in which I feel more comfortable. Anyway, CTF's are good options for learning an there are tons of them on the internet but beware! they're highly addictive.
"I Don't Want To Maintain Their Code"
Published: 2018-02-27 19:45:02

---
title: "\"I Don't Want To Maintain Their Code\""
published: true
tags: 
canonical_url: https://blog.professorbeekums.com/i-dont-want-to-maintain-their-code/
---

I recently heard of a situation where a team needs to hire someone since they’re understaffed.  
The reaction from one of the developers was simply:  
**“I don’t want to maintain their code.”**

![](https://blog.professorbeekums.com/img/2018/2/screaming.jpg)

I understand this mentality. The worst code is always other people’s code. For most developers, this is simply fact.

What is also fact is that very little software of significance gets built by the lone wolf.

Building software is a difficult endeavour. It is also a time consuming one. At some point, more developers have to be added in order to get more stuff done. That’s not to say adding new developers to a team is easy. It isn’t.

Yet most of the difficulties of adding a new developer can be mitigated. The fear of maintaining another developer’s code is only justified when a developer with the [wrong skill set is hired.](https://blog.professorbeekums.com/why-i-dont-prepare-for-interviews/) This is not to say that hiring is an easy exercise, but putting effort into it can help a great deal.

The largest difficulty with new developers is actually the ramp up. Every software system has different patterns and naming conventions. These all have to be explained to a new developer. Even when they are explained, the sheer quantity of stuff to know will result in it taking weeks or months before a new developer is at 100%.

This can be mitigated with good software architecture. Good software architecture makes things clearer and more apparent. Instead of a new developer fumbling around, things can make sense just by looking at the code.

Unfortunately, “good” software architecture is extremely subjective. I’ve had multiple devs join a team where some really liked the decisions I made and some really hated those decisions. What “makes sense” depends on how a person thinks and different people think… differently.

Therein lies one of the biggest problems with adding a new developer: the ego of the existing developer. New developers also mean new opinions. New opinions challenge the decisions we have made. At this point, the fear of maintaining another developer’s code is not based on that code being bad. It is based on that code being different from how we would write that code.

In many ways, new opinions are a good thing. New perspectives can help us refine our thinking and make everyone on a team, both existing and new members, much stronger than they were.

That only happens if the ego of the existing members can take it.
About my self
Published: 2018-02-25 20:07:12


title: "About my self"
published: true
description: Hi all,my name is ali rafami and im working in Dr.ashrafi clinic in tehran iran,and im the learning about digital makrketing.This is my sites in persian language, [عمل بینی](http://www.rhinoclinic.ir) | [جراحی بینی](http://www.rhinoclinic.ir) | [کاشت مو](http://www.hairplanting.ir/)
Manage Visual Studio Performance – Hide Source Control Explorer at startup – Visual Studio 2017
Tags: visualstudio, performance, tips, visualstudiotips
Published: 2018-02-26 17:05:24

---
title: "Manage Visual Studio Performance – Hide Source Control Explorer at startup – Visual Studio 2017"
published: true
tags: Visual Studio,performance,tips,visual studio tips
canonical_url: http://blog.mandarbadve.com/2018/02/26/manage-visual-studio-performance-hide-source-control-explorer-at-startup-visual-studio-2017/
---

Finally we get option to manage performance for Visual Studio in 2017 version. You can see it from help menu.

[![Visual Studio Help](https://i0.wp.com/blog.mandarbadve.com/wp-content/uploads/2018/02/Visual-Studio-Help.png?resize=656%2C280)](https://i0.wp.com/blog.mandarbadve.com/wp-content/uploads/2018/02/Visual-Studio-Help.png)

Here are options to manage performance.

[![Visual Studio Help Modal](https://i2.wp.com/blog.mandarbadve.com/wp-content/uploads/2018/02/Visual-Studio-Help-Modal.png?resize=656%2C458)](https://i2.wp.com/blog.mandarbadve.com/wp-content/uploads/2018/02/Visual-Studio-Help-Modal.png)

It says that, if you set it to Use Default Behavior i.e. load source control explorer at startup it might take 4 seconds to load visual studio.

Recommended option is: Do  not show window at startup. This will save up to 4 seconds on visual studio startup.

For more information visit
http://blog.mandarbadve.com/2018/02/26/manage-visual-studio-performance-hide-source-control-explorer-at-startup-visual-studio-2017/
Escaping backticks in a code block block does not work
Tags: meta, markdown, bug
Published: 2018-02-25 18:22:15

---
title: Escaping backticks in a code block block does not work
published: true
description: I found another markdown bug
tags: meta, markdown, bug
---

I swear I'm not trying to find bugs in the markdown parser XD but if you escape backticks while in a code block block then it does not work.

IE what I was trying to do is show someone how to format a code block and this is what happened

- How to reproduce
- did 3 backticks
- new line, 3 backticks escaped with `/` but backslash
- normal code
- 3 more escaped backticks
- 3 actual backticks to close the block

What that looks like when done can be seen below

![alt](https://thepracticaldev.s3.amazonaws.com/i/4g0myzzf0rzg04vspd32.png)

---

```
\`\`\`ruby
require "zlib"

def compress_file(file_name)
  zipped = "#{file_name}.gz"

  Zlib::GzipWriter.open(zipped) do |gz|
    gz.write IO.binread(file_name)
  end
end
\`\`\`
```

---

edit: so it seems that in a post this works in post, but also includes the backticks. the garbled mess that I first encountered was from a comment so I'll post it there too
How are the "must read" stories selected on dev.to?
Tags: meta, discuss
Published: 2018-02-25 18:18:03

---
title: How are the \"must read\" stories selected on dev.to?
published: true
description: 
tags: #meta, #discuss
---
I'd like to increase my chances of making the "must read" list in the weekly emails. 

How are the "must read" stories selected? Are they determined via algorithm? Or is it strictly at the editor's discretion?

What are the cutoff dates for consideration? Are there other considerations I can take into account when writing my posts?

Thanks.
Check your code base is PHP 7 ready with PHP Compatibility
Tags: php
Published: 2018-11-24 14:50:54

---
title: Check your code base is PHP 7 ready with PHP Compatibility
published: true
tags: php
canonical_url: https://matthewdaly.co.uk/blog/2018/02/25/check-your-code-base-is-php-7-ready-with-php-compatibility/
---

I’ve recently started a new job and as part of that I’m working on a rather substantial legacy code base. In fact, it was so legacy that it was still in Subversion - needless to say the very first thing I did was migrate it to Git. One of the jobs on our radar for this code base is to migrate it to from PHP 5.4 to 5.6, and subsequently to PHP 7. I’ve been using it locally in 5.6 without issue so far, but I’ve also been looking around for an automated tool to help catch potential problems.

I recently discovered [PHP Compatibility](https://github.com/wimg/PHPCompatibility) which is a set of sniffs for PHP CodeSniffer that can be used to detect code that will be problematic in a particular PHP version. As I use CodeSniffer extensively already, it’s a good fit for my existing toolset.

To install it, add the following dependencies to your `composer.json`:

```json
    "require-dev": {
        "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3",
        "squizlabs/php_codesniffer": "^2.5",
        "wimg/php-compatibility": "^8.1"
    },
```

Then update your `phpcs.xml` to look something like this:

```xml
<ruleset name="PHP_CodeSniffer">
   <description>The coding standard for my app.</description>
   <file>./</file>
   <arg value="np"/>
   <rule ref="PSR2"/>
   <rule ref="PHPCompatibility"/>
   <config name="testVersion" value="7.2-"/>
</ruleset>
```

As you can see, it’s possible to use it alongside existing coding standards such as PSR2. Note the `testVersion` config key - the value specified is the PHP version we’re testing against. Here we’re specifying PHP 7.2.

Obviously, the very best way to guard against breakages in newer versions of PHP is to have a comprehensive test suite, but legacy code bases by definition tend to have little or no tests. By using PHP Compatibility, you should at least be able to catch syntax problems without having to audit the code base manually.
Is one Technology really better than another?
Tags: php, node, programming
Published: 2018-02-24 19:14:20

---
title: Is one Technology really better than another?
published: true
description: Comparing Languages
tags: php, node, programming
---
Is one Technology really better than another?
https://medium.com/@manukamaduranga/is-one-technology-really-better-than-another-11ef666b685