Shubham Ankit

Shubham Ankit

1566360211

10 docker-compose and docker commands that are useful for active development

Originally published by Lina Rudashevski at dev.to

Sure you might need other ones but I've found over time that these are the only ones I need or use on a regular basis, and I use Docker and docker-compose regularly for various projects.

1. terminal into the docker container

docker exec -it :container_id bash

You may need to terminal into a container to do things like run tests or apply migrations.

[13:54:41] (master) selfies
🙋 docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
b5e87b73f6f6        selfies_web            "python manage.py ru…"   2 seconds ago       Up 1 second         0.0.0.0:8000->8000/tcp   selfies_web_1
d8e636ad4805        postgres:10.1-alpine   "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        0.0.0.0:5432->5432/tcp   selfies_db_1
aeb5cba5a482        redis:latest           "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        6379/tcp                 selfies_redis_1
[13:54:43] (master) selfies
🙋 docker exec -it b5e87b73f6f6 bash
root@b5e87b73f6f6:/selfies# python manage.py makemigrations
No changes detected
root@b5e87b73f6f6:/selfies# 

2. run the docker container in debug mode

docker-compose run --service-ports web

If you want to debug your server, this command will let you do it. Otherwise you may get an error if you put a debugger in your code.

[13:56:59] (master) selfies
🙋 docker-compose run --service-ports web
Creating network "selfies_default" with the default driver
Creating selfies_redis_1 ... done
Creating selfies_db_1    ... done
Performing system checks...

System check identified no issues (0 silenced).
July 24, 2019 - 17:57:11
Django version 2.1.7, using settings ‘selfies.settings’
Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Performing system checks…

System check identified no issues (0 silenced).
July 24, 2019 - 18:12:29
Django version 2.1.7, using settings ‘selfies.settings’
Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
HTTP OPTIONS /app/users/ 200 [0.01, 172.25.0.1:60046]
> /selfies/app/views/account_views.py(48)post()
-> try:
(Pdb)

3. build the docker container

docker-compose build

This runs everything in the Dockerfile. I usually run this the first time to build the project, and after that only if I add dependencies to my requirements.txt file or change anything within my Dockerfile.

[18:59:42] (master) selfies
// ♥ docker-compose build
db uses an image, skipping
redis uses an image, skipping
Building web
Step 1/7 : FROM python:3.6-stretch
—> 9167692c277e
Step 2/7 : ENV PYTHONUNBUFFERED 1
—> Using cache
—> 0533dfe1c141
Step 3/7 : ENV REDIS_HOST “redis”
—> Using cache
—> c01adb015773
Step 4/7 : RUN mkdir /selfies
—> Using cache
—> e60377d4e9ee
Step 5/7 : WORKDIR /selfies
—> Using cache
—> 9018fb3984b0
Step 6/7 : ADD . /selfies/
—> Using cache
—> 8c6d291d99a7
Step 7/7 : RUN pip install -r requirements.txt
—> Using cache
—> 7caa2f3bf2ac
Successfully built 7caa2f3bf2ac
Successfully tagged selfies_web:latest

4. start the docker container

docker-compose up

This will run your container/s in the terminal and will show the server output

[13:39:32] (master) selfies
🙋 docker-compose up
Creating network “selfies_default” with the default driver
Creating selfies_redis_1 … done
Creating selfies_db_1 … done
Creating selfies_web_1 … done
Attaching to selfies_db_1, selfies_redis_1, selfies_web_1
db_1 | 2019-07-24 17:40:36.069 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
db_1 | 2019-07-24 17:40:36.069 UTC [1] LOG: listening on IPv6 address “::”, port 5432
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 24 Jul 2019 17:40:36.086 * Running mode=standalone, port=6379.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # Server initialized
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 * Ready to accept connections
db_1 | 2019-07-24 17:40:36.072 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
db_1 | 2019-07-24 17:40:36.086 UTC [18] LOG: database system was shut down at 2019-07-24 17:39:28 UTC
db_1 | 2019-07-24 17:40:36.090 UTC [1] LOG: database system is ready to accept connections
web_1 | Performing system checks…
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | July 24, 2019 - 17:40:38
web_1 | Django version 2.1.7, using settings ‘selfies.settings’
web_1 | Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
web_1 | Quit the server with CONTROL-C.

5. start the docker container in the background

docker-compose up -d

This will run the container but in the background so you can continue to type in the terminal. I usually run it this way if I don’t really need to see what the server is returning.

[13:31:03] (master) selfies
🙋 docker-compose up -d
Creating network “selfies_default” with the default driver
Creating selfies_db_1 … done
Creating selfies_redis_1 … done
Creating selfies_web_1 … done

6. see all of the docker containers currently running

List of active docker containers which is useful for the CONTAINER ID and to know what you have running.

docker ps

[13:31:10] (master) selfies
🙋 docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2b93a900c36 selfies_web “python manage.py ru…” 2 seconds ago Up 1 second 0.0.0.0:8000->8000/tcp selfies_web_1
2d39a1161aa2 postgres:10.1-alpine “docker-entrypoint.s…” 4 seconds ago Up 2 seconds 0.0.0.0:5432->5432/tcp selfies_db_1
62a6f364860e redis:latest “docker-entrypoint.s…” 4 seconds ago Up 2 seconds 6379/tcp selfies_redis_1

7. remove all docker containers in the repository

docker-compose down

I almost always follow this command with docker ps to make sure the containers were successfully removed, out of habit.

[13:37:20] (master) selfies
🙋 docker-compose down
Stopping selfies_web_1 … done
Stopping selfies_db_1 … done
Stopping selfies_redis_1 … done
Removing selfies_web_1 … done
Removing selfies_db_1 … done
Removing selfies_redis_1 … done
Removing network selfies_default

8. remove a specific docker container

docker kill :container_id

The container id is the leftmost column when doing docker ps. I sometimes do this if I need to remove a specific container that I’m not using.

[13:51:43] (master) selfies
🙋 docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
274b1605ca94 selfies_web “python manage.py ru…” 11 minutes ago Up 1 second 0.0.0.0:8000->8000/tcp selfies_web_1
a641f449edfc postgres:10.1-alpine “docker-entrypoint.s…” 11 minutes ago Up 2 seconds 0.0.0.0:5432->5432/tcp selfies_db_1
61b08693e242 redis:latest “docker-entrypoint.s…” 11 minutes ago Up 2 seconds 6379/tcp selfies_redis_1
[13:51:44] (master) selfies
🙋 docker kill 274b1605ca94
274b1605ca94

9. view all of the docker images

You can see all your builds by running this. For me these are either official “images” like redis or python or old builds of my projects. I only occasionally use this, it’s not really a part of my daily development.

docker images

[18:28:17] (master) selfies
// ♥ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
selfies_web latest 4869d063569e 7 days ago 1.32GB
python 3.6-stretch 9167692c277e 11 days ago 936MB
redis latest 598a6f110d01 12 days ago 118MB
<none> <none> 9c4676224e86 2 months ago 1e+03MB
<none> <none> 6c925f68c3a9 2 months ago 929MB
<none> <none> b44ef8ff52f4 2 months ago 929MB
<none> <none> 903b976cd478 2 months ago 1.47GB
<none> <none> f7009c6f0868 2 months ago 1.49GB
<none> <none> 52750c0c3926 2 months ago 1.48GB
<none> <none> 1c509a380925 2 months ago 1.44GB

10. clean out any images, builds, etc., that might be hanging

docker system prune

I only occasionally use this, it’s not really a part of my daily development.

[18:18:35] (master) selfies
// ♥ docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
1f570bbf6828dadfdaa97655165943fd0b93ce6c185df2531f61a82982ec24f2
40f79091bc943c86f5f3ab7bc9d484ac9b576effc686a8a0fdb0031a465b16b4
f3399b0cd4f8c30159b15e1a2027aadeeaf9006efa4b759e4e3586d4589a0004
e0d18cddd40241de3d3b03d695afe667819c884a12fd36465c4c6d584df5aaa6
b7757cef15b49ecfe58ac6a8de3f8fcae91c71d793b7942955ccaf7c266bff92
a8fc94cd1af14f27b0ae22c1728b33fc8cef4090aa7deef1c2549c33755ed114
4de12efd1f88b9ee3541049c9b6fb3df5b1ade3b5787f888f5cf05f2e02c3cec
21d97261412949c06a4fcfb9846a6dee22f92e6a928cd6fb715ee81924917d43
073ca414e8c79e593c82f46f565adbae92a159994699dbbd0fb9df8044b3b1bb
b62f36a4a182479d25c2251e8d90fb7d2b612f31a03e943e83882ab436981879
456510a02d7ad5137dcb907484b2c8d9e07f51946be1103d294e4e253bc0e664
effee0d0a9afa74825f8f820bd363ebe1b7b54948aed38d57e84342482c367fd
5d930ece03ed8a2c2cb9178b81c9b42ef4c7397ef90d29b040ed3b1220f8ba27
a6ccf4f68831a19ab7381354f5643f3afd94cfbe0d066ff9ce4b248b90139a63
1a65f709f9b9c7d9749a04e88d3c4d18539a495160e143337c25025b10f9b24c
e98fbb022cb920dd4550751fdb735c1f73ae1dd6a049b9855bd77db1a2cbb3d1
18cb48bcb6428d4a9d5ca2f4b9c0a2fbedb3ef98c1d1fe6788029d7abea8efe9
97d0ee4625df7d107bc543318b1b45701f17720c41c7bb9614183e2cca0e26c7
5fafd4e2df31a0b84657ce1a0450c9cc8d8caa56ede9b10cddbfa6b6f55f6b50
212dae9eab339a84817b590cceb345d66290fa7f0fd7e347bffda322eb60400e
14cdd7e40ca412e1b091ddf640513ecf3f5f8bfd51cbc826e59b4901b1a0e213
ceeeb46b3aa52660a7080949543654e6436b0c050c865ef6cbed83f43bba8cc3
6c96d28cffed031a8bdd836670401b74eb52fa8f03c1dca83b73b8d0ba8530ec
9c89d36c6ee1f8fbc9d0c542d14d6d5b924817abf47a656941062eed95e607f6
58d212388ac7f15468306e306977661169e8aacdeeaba2fea4fc9cf7ebbb9e46
71963edbfe38d4578ba1338a0d03ed94f81664b202f969acf72d38ceeded5fed
4838aa870e8962e6a1c8c0e679dad8d25f5ad08824bfd45df150d148ae7097ba
abab59a1cd1fcf0a14e1d8f45d03f1787b218233a118af59f604ad890cc64dc1
5375b62e20d2660f8347f5f7355122f9fb528a1b603b1e58ceb7d7b811740410
29d7238e6d81f522f8c98b4d2e478bb304aec7a00892b8339bf1b4a0483e7040

Deleted Networks:
selfiesh_default

Originally published by Lina Rudashevski at dev.to

========================================

Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter

Learn More

☞ Docker Mastery: The Complete Toolset From a Docker Captain

☞ Docker and Kubernetes: The Complete Guide

☞ Docker for the Absolute Beginner - Hands On - DevOps

☞ Docker Crash Course for busy DevOps and Developers

☞ The Docker for DevOps course: From development to production

☞ Docker for Node.js Projects From a Docker Captain

☞ Docker Certified Associate 2019

☞ Selenium WebDriver with Docker

#docker #web-development

What is GEEK

Buddha Community

10 docker-compose and docker commands that are useful for active development
Chloe  Butler

Chloe Butler

1667425440

Pdf2gerb: Perl Script Converts PDF Files to Gerber format

pdf2gerb

Perl script converts PDF files to Gerber format

Pdf2Gerb generates Gerber 274X photoplotting and Excellon drill files from PDFs of a PCB. Up to three PDFs are used: the top copper layer, the bottom copper layer (for 2-sided PCBs), and an optional silk screen layer. The PDFs can be created directly from any PDF drawing software, or a PDF print driver can be used to capture the Print output if the drawing software does not directly support output to PDF.

The general workflow is as follows:

  1. Design the PCB using your favorite CAD or drawing software.
  2. Print the top and bottom copper and top silk screen layers to a PDF file.
  3. Run Pdf2Gerb on the PDFs to create Gerber and Excellon files.
  4. Use a Gerber viewer to double-check the output against the original PCB design.
  5. Make adjustments as needed.
  6. Submit the files to a PCB manufacturer.

Please note that Pdf2Gerb does NOT perform DRC (Design Rule Checks), as these will vary according to individual PCB manufacturer conventions and capabilities. Also note that Pdf2Gerb is not perfect, so the output files must always be checked before submitting them. As of version 1.6, Pdf2Gerb supports most PCB elements, such as round and square pads, round holes, traces, SMD pads, ground planes, no-fill areas, and panelization. However, because it interprets the graphical output of a Print function, there are limitations in what it can recognize (or there may be bugs).

See docs/Pdf2Gerb.pdf for install/setup, config, usage, and other info.


pdf2gerb_cfg.pm

#Pdf2Gerb config settings:
#Put this file in same folder/directory as pdf2gerb.pl itself (global settings),
#or copy to another folder/directory with PDFs if you want PCB-specific settings.
#There is only one user of this file, so we don't need a custom package or namespace.
#NOTE: all constants defined in here will be added to main namespace.
#package pdf2gerb_cfg;

use strict; #trap undef vars (easier debug)
use warnings; #other useful info (easier debug)


##############################################################################################
#configurable settings:
#change values here instead of in main pfg2gerb.pl file

use constant WANT_COLORS => ($^O !~ m/Win/); #ANSI colors no worky on Windows? this must be set < first DebugPrint() call

#just a little warning; set realistic expectations:
#DebugPrint("${\(CYAN)}Pdf2Gerb.pl ${\(VERSION)}, $^O O/S\n${\(YELLOW)}${\(BOLD)}${\(ITALIC)}This is EXPERIMENTAL software.  \nGerber files MAY CONTAIN ERRORS.  Please CHECK them before fabrication!${\(RESET)}", 0); #if WANT_DEBUG

use constant METRIC => FALSE; #set to TRUE for metric units (only affect final numbers in output files, not internal arithmetic)
use constant APERTURE_LIMIT => 0; #34; #max #apertures to use; generate warnings if too many apertures are used (0 to not check)
use constant DRILL_FMT => '2.4'; #'2.3'; #'2.4' is the default for PCB fab; change to '2.3' for CNC

use constant WANT_DEBUG => 0; #10; #level of debug wanted; higher == more, lower == less, 0 == none
use constant GERBER_DEBUG => 0; #level of debug to include in Gerber file; DON'T USE FOR FABRICATION
use constant WANT_STREAMS => FALSE; #TRUE; #save decompressed streams to files (for debug)
use constant WANT_ALLINPUT => FALSE; #TRUE; #save entire input stream (for debug ONLY)

#DebugPrint(sprintf("${\(CYAN)}DEBUG: stdout %d, gerber %d, want streams? %d, all input? %d, O/S: $^O, Perl: $]${\(RESET)}\n", WANT_DEBUG, GERBER_DEBUG, WANT_STREAMS, WANT_ALLINPUT), 1);
#DebugPrint(sprintf("max int = %d, min int = %d\n", MAXINT, MININT), 1); 

#define standard trace and pad sizes to reduce scaling or PDF rendering errors:
#This avoids weird aperture settings and replaces them with more standardized values.
#(I'm not sure how photoplotters handle strange sizes).
#Fewer choices here gives more accurate mapping in the final Gerber files.
#units are in inches
use constant TOOL_SIZES => #add more as desired
(
#round or square pads (> 0) and drills (< 0):
    .010, -.001,  #tiny pads for SMD; dummy drill size (too small for practical use, but needed so StandardTool will use this entry)
    .031, -.014,  #used for vias
    .041, -.020,  #smallest non-filled plated hole
    .051, -.025,
    .056, -.029,  #useful for IC pins
    .070, -.033,
    .075, -.040,  #heavier leads
#    .090, -.043,  #NOTE: 600 dpi is not high enough resolution to reliably distinguish between .043" and .046", so choose 1 of the 2 here
    .100, -.046,
    .115, -.052,
    .130, -.061,
    .140, -.067,
    .150, -.079,
    .175, -.088,
    .190, -.093,
    .200, -.100,
    .220, -.110,
    .160, -.125,  #useful for mounting holes
#some additional pad sizes without holes (repeat a previous hole size if you just want the pad size):
    .090, -.040,  #want a .090 pad option, but use dummy hole size
    .065, -.040, #.065 x .065 rect pad
    .035, -.040, #.035 x .065 rect pad
#traces:
    .001,  #too thin for real traces; use only for board outlines
    .006,  #minimum real trace width; mainly used for text
    .008,  #mainly used for mid-sized text, not traces
    .010,  #minimum recommended trace width for low-current signals
    .012,
    .015,  #moderate low-voltage current
    .020,  #heavier trace for power, ground (even if a lighter one is adequate)
    .025,
    .030,  #heavy-current traces; be careful with these ones!
    .040,
    .050,
    .060,
    .080,
    .100,
    .120,
);
#Areas larger than the values below will be filled with parallel lines:
#This cuts down on the number of aperture sizes used.
#Set to 0 to always use an aperture or drill, regardless of size.
use constant { MAX_APERTURE => max((TOOL_SIZES)) + .004, MAX_DRILL => -min((TOOL_SIZES)) + .004 }; #max aperture and drill sizes (plus a little tolerance)
#DebugPrint(sprintf("using %d standard tool sizes: %s, max aper %.3f, max drill %.3f\n", scalar((TOOL_SIZES)), join(", ", (TOOL_SIZES)), MAX_APERTURE, MAX_DRILL), 1);

#NOTE: Compare the PDF to the original CAD file to check the accuracy of the PDF rendering and parsing!
#for example, the CAD software I used generated the following circles for holes:
#CAD hole size:   parsed PDF diameter:      error:
#  .014                .016                +.002
#  .020                .02267              +.00267
#  .025                .026                +.001
#  .029                .03167              +.00267
#  .033                .036                +.003
#  .040                .04267              +.00267
#This was usually ~ .002" - .003" too big compared to the hole as displayed in the CAD software.
#To compensate for PDF rendering errors (either during CAD Print function or PDF parsing logic), adjust the values below as needed.
#units are pixels; for example, a value of 2.4 at 600 dpi = .0004 inch, 2 at 600 dpi = .0033"
use constant
{
    HOLE_ADJUST => -0.004 * 600, #-2.6, #holes seemed to be slightly oversized (by .002" - .004"), so shrink them a little
    RNDPAD_ADJUST => -0.003 * 600, #-2, #-2.4, #round pads seemed to be slightly oversized, so shrink them a little
    SQRPAD_ADJUST => +0.001 * 600, #+.5, #square pads are sometimes too small by .00067, so bump them up a little
    RECTPAD_ADJUST => 0, #(pixels) rectangular pads seem to be okay? (not tested much)
    TRACE_ADJUST => 0, #(pixels) traces seemed to be okay?
    REDUCE_TOLERANCE => .001, #(inches) allow this much variation when reducing circles and rects
};

#Also, my CAD's Print function or the PDF print driver I used was a little off for circles, so define some additional adjustment values here:
#Values are added to X/Y coordinates; units are pixels; for example, a value of 1 at 600 dpi would be ~= .002 inch
use constant
{
    CIRCLE_ADJUST_MINX => 0,
    CIRCLE_ADJUST_MINY => -0.001 * 600, #-1, #circles were a little too high, so nudge them a little lower
    CIRCLE_ADJUST_MAXX => +0.001 * 600, #+1, #circles were a little too far to the left, so nudge them a little to the right
    CIRCLE_ADJUST_MAXY => 0,
    SUBST_CIRCLE_CLIPRECT => FALSE, #generate circle and substitute for clip rects (to compensate for the way some CAD software draws circles)
    WANT_CLIPRECT => TRUE, #FALSE, #AI doesn't need clip rect at all? should be on normally?
    RECT_COMPLETION => FALSE, #TRUE, #fill in 4th side of rect when 3 sides found
};

#allow .012 clearance around pads for solder mask:
#This value effectively adjusts pad sizes in the TOOL_SIZES list above (only for solder mask layers).
use constant SOLDER_MARGIN => +.012; #units are inches

#line join/cap styles:
use constant
{
    CAP_NONE => 0, #butt (none); line is exact length
    CAP_ROUND => 1, #round cap/join; line overhangs by a semi-circle at either end
    CAP_SQUARE => 2, #square cap/join; line overhangs by a half square on either end
    CAP_OVERRIDE => FALSE, #cap style overrides drawing logic
};
    
#number of elements in each shape type:
use constant
{
    RECT_SHAPELEN => 6, #x0, y0, x1, y1, count, "rect" (start, end corners)
    LINE_SHAPELEN => 6, #x0, y0, x1, y1, count, "line" (line seg)
    CURVE_SHAPELEN => 10, #xstart, ystart, x0, y0, x1, y1, xend, yend, count, "curve" (bezier 2 points)
    CIRCLE_SHAPELEN => 5, #x, y, 5, count, "circle" (center + radius)
};
#const my %SHAPELEN =
#Readonly my %SHAPELEN =>
our %SHAPELEN =
(
    rect => RECT_SHAPELEN,
    line => LINE_SHAPELEN,
    curve => CURVE_SHAPELEN,
    circle => CIRCLE_SHAPELEN,
);

#panelization:
#This will repeat the entire body the number of times indicated along the X or Y axes (files grow accordingly).
#Display elements that overhang PCB boundary can be squashed or left as-is (typically text or other silk screen markings).
#Set "overhangs" TRUE to allow overhangs, FALSE to truncate them.
#xpad and ypad allow margins to be added around outer edge of panelized PCB.
use constant PANELIZE => {'x' => 1, 'y' => 1, 'xpad' => 0, 'ypad' => 0, 'overhangs' => TRUE}; #number of times to repeat in X and Y directions

# Set this to 1 if you need TurboCAD support.
#$turboCAD = FALSE; #is this still needed as an option?

#CIRCAD pad generation uses an appropriate aperture, then moves it (stroke) "a little" - we use this to find pads and distinguish them from PCB holes. 
use constant PAD_STROKE => 0.3; #0.0005 * 600; #units are pixels
#convert very short traces to pads or holes:
use constant TRACE_MINLEN => .001; #units are inches
#use constant ALWAYS_XY => TRUE; #FALSE; #force XY even if X or Y doesn't change; NOTE: needs to be TRUE for all pads to show in FlatCAM and ViewPlot
use constant REMOVE_POLARITY => FALSE; #TRUE; #set to remove subtractive (negative) polarity; NOTE: must be FALSE for ground planes

#PDF uses "points", each point = 1/72 inch
#combined with a PDF scale factor of .12, this gives 600 dpi resolution (1/72 * .12 = 600 dpi)
use constant INCHES_PER_POINT => 1/72; #0.0138888889; #multiply point-size by this to get inches

# The precision used when computing a bezier curve. Higher numbers are more precise but slower (and generate larger files).
#$bezierPrecision = 100;
use constant BEZIER_PRECISION => 36; #100; #use const; reduced for faster rendering (mainly used for silk screen and thermal pads)

# Ground planes and silk screen or larger copper rectangles or circles are filled line-by-line using this resolution.
use constant FILL_WIDTH => .01; #fill at most 0.01 inch at a time

# The max number of characters to read into memory
use constant MAX_BYTES => 10 * M; #bumped up to 10 MB, use const

use constant DUP_DRILL1 => TRUE; #FALSE; #kludge: ViewPlot doesn't load drill files that are too small so duplicate first tool

my $runtime = time(); #Time::HiRes::gettimeofday(); #measure my execution time

print STDERR "Loaded config settings from '${\(__FILE__)}'.\n";
1; #last value must be truthful to indicate successful load


#############################################################################################
#junk/experiment:

#use Package::Constants;
#use Exporter qw(import); #https://perldoc.perl.org/Exporter.html

#my $caller = "pdf2gerb::";

#sub cfg
#{
#    my $proto = shift;
#    my $class = ref($proto) || $proto;
#    my $settings =
#    {
#        $WANT_DEBUG => 990, #10; #level of debug wanted; higher == more, lower == less, 0 == none
#    };
#    bless($settings, $class);
#    return $settings;
#}

#use constant HELLO => "hi there2"; #"main::HELLO" => "hi there";
#use constant GOODBYE => 14; #"main::GOODBYE" => 12;

#print STDERR "read cfg file\n";

#our @EXPORT_OK = Package::Constants->list(__PACKAGE__); #https://www.perlmonks.org/?node_id=1072691; NOTE: "_OK" skips short/common names

#print STDERR scalar(@EXPORT_OK) . " consts exported:\n";
#foreach(@EXPORT_OK) { print STDERR "$_\n"; }
#my $val = main::thing("xyz");
#print STDERR "caller gave me $val\n";
#foreach my $arg (@ARGV) { print STDERR "arg $arg\n"; }

Download Details:

Author: swannman
Source Code: https://github.com/swannman/pdf2gerb

License: GPL-3.0 license

#perl 

Fredy  Larson

Fredy Larson

1595059664

How long does it take to develop/build an app?

With more of us using smartphones, the popularity of mobile applications has exploded. In the digital era, the number of people looking for products and services online is growing rapidly. Smartphone owners look for mobile applications that give them quick access to companies’ products and services. As a result, mobile apps provide customers with a lot of benefits in just one device.

Likewise, companies use mobile apps to increase customer loyalty and improve their services. Mobile Developers are in high demand as companies use apps not only to create brand awareness but also to gather information. For that reason, mobile apps are used as tools to collect valuable data from customers to help companies improve their offer.

There are many types of mobile applications, each with its own advantages. For example, native apps perform better, while web apps don’t need to be customized for the platform or operating system (OS). Likewise, hybrid apps provide users with comfortable user experience. However, you may be wondering how long it takes to develop an app.

To give you an idea of how long the app development process takes, here’s a short guide.

App Idea & Research

app-idea-research

_Average time spent: two to five weeks _

This is the initial stage and a crucial step in setting the project in the right direction. In this stage, you brainstorm ideas and select the best one. Apart from that, you’ll need to do some research to see if your idea is viable. Remember that coming up with an idea is easy; the hard part is to make it a reality.

All your ideas may seem viable, but you still have to run some tests to keep it as real as possible. For that reason, when Web Developers are building a web app, they analyze the available ideas to see which one is the best match for the targeted audience.

Targeting the right audience is crucial when you are developing an app. It saves time when shaping the app in the right direction as you have a clear set of objectives. Likewise, analyzing how the app affects the market is essential. During the research process, App Developers must gather information about potential competitors and threats. This helps the app owners develop strategies to tackle difficulties that come up after the launch.

The research process can take several weeks, but it determines how successful your app can be. For that reason, you must take your time to know all the weaknesses and strengths of the competitors, possible app strategies, and targeted audience.

The outcomes of this stage are app prototypes and the minimum feasible product.

#android app #frontend #ios app #minimum viable product (mvp) #mobile app development #web development #android app development #app development #app development for ios and android #app development process #ios and android app development #ios app development #stages in app development

Mitchel  Carter

Mitchel Carter

1602979200

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, I was thinking, “I want to be a team leader. It’s so cool, he’s in charge of everything and gets more money. It’s the next step after a senior.” Back then, no one could tell me how wrong I was. I had to find it out myself.

I Got to Be a Team Leader — Twice

I’m naturally very organized. Whatever I do, I try to put things in order, create systems and processes. So I’ve always been inclined to take on more responsibilities than just coding. My first startup job, let’s call it T, was complete chaos in terms of development processes.

Now I probably wouldn’t work in a place like that, but at the time, I enjoyed the vibe. Just imagine it — numerous clients and a team leader who set tasks to the developers in person (and often privately). We would often miss deadlines and had to work late. Once, my boss called and asked me to come back to work at 8 p.m. to finish one feature — all because the deadline was “the next morning.” But at T, we were a family.

We also did everything ourselves — or at least tried to. I’ll never forget how I had to install Ubuntu on a rack server that we got from one of our investors. When I would turn it on, it sounded like a helicopter taking off!

At T, I became a CTO and managed a team of 10 people. So it was my first experience as a team leader.

Then I came to work at D — as a developer. And it was so different in every way when it came to processes.

They employed classic Scrum with sprints, burndown charts, demos, story points, planning, and backlog grooming. I was amazed by the quality of processes, but at first, I was just coding and minding my own business. Then I became friends with the Scrum master. I would ask him lots of questions, and he would willingly answer them and recommend good books.

My favorite was Scrum and XP from the Trenches by Henrik Kniberg. The process at D was based on its methods. As a result, both managers and sellers knew when to expect the result.

Then I joined Skyeng, also as a developer. Unlike my other jobs, it excels at continuous integration with features shipped every day. Within my team, we used a Kanban-like method.

We were also lucky to have our team leader, Petya. At our F2F meetings, we could discuss anything, from missing deadlines to setting up a task tracker. Sometimes I would just give feedback or he would give me advice.

That’s how Petya got to know I’d had some management experience at T and learned Scrum at D.

So one day, he offered me to host a stand-up.

#software-development #developer #dev-team-leadership #agile-software-development #web-development #mobile-app-development #ios-development #android-development

Shubham Ankit

Shubham Ankit

1566360211

10 docker-compose and docker commands that are useful for active development

Originally published by Lina Rudashevski at dev.to

Sure you might need other ones but I've found over time that these are the only ones I need or use on a regular basis, and I use Docker and docker-compose regularly for various projects.

1. terminal into the docker container

docker exec -it :container_id bash

You may need to terminal into a container to do things like run tests or apply migrations.

[13:54:41] (master) selfies
🙋 docker ps
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                    NAMES
b5e87b73f6f6        selfies_web            "python manage.py ru…"   2 seconds ago       Up 1 second         0.0.0.0:8000->8000/tcp   selfies_web_1
d8e636ad4805        postgres:10.1-alpine   "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        0.0.0.0:5432->5432/tcp   selfies_db_1
aeb5cba5a482        redis:latest           "docker-entrypoint.s…"   3 seconds ago       Up 2 seconds        6379/tcp                 selfies_redis_1
[13:54:43] (master) selfies
🙋 docker exec -it b5e87b73f6f6 bash
root@b5e87b73f6f6:/selfies# python manage.py makemigrations
No changes detected
root@b5e87b73f6f6:/selfies# 

2. run the docker container in debug mode

docker-compose run --service-ports web

If you want to debug your server, this command will let you do it. Otherwise you may get an error if you put a debugger in your code.

[13:56:59] (master) selfies
🙋 docker-compose run --service-ports web
Creating network "selfies_default" with the default driver
Creating selfies_redis_1 ... done
Creating selfies_db_1    ... done
Performing system checks...

System check identified no issues (0 silenced).
July 24, 2019 - 17:57:11
Django version 2.1.7, using settings ‘selfies.settings’
Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Performing system checks…

System check identified no issues (0 silenced).
July 24, 2019 - 18:12:29
Django version 2.1.7, using settings ‘selfies.settings’
Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
HTTP OPTIONS /app/users/ 200 [0.01, 172.25.0.1:60046]
> /selfies/app/views/account_views.py(48)post()
-> try:
(Pdb)

3. build the docker container

docker-compose build

This runs everything in the Dockerfile. I usually run this the first time to build the project, and after that only if I add dependencies to my requirements.txt file or change anything within my Dockerfile.

[18:59:42] (master) selfies
// ♥ docker-compose build
db uses an image, skipping
redis uses an image, skipping
Building web
Step 1/7 : FROM python:3.6-stretch
—> 9167692c277e
Step 2/7 : ENV PYTHONUNBUFFERED 1
—> Using cache
—> 0533dfe1c141
Step 3/7 : ENV REDIS_HOST “redis”
—> Using cache
—> c01adb015773
Step 4/7 : RUN mkdir /selfies
—> Using cache
—> e60377d4e9ee
Step 5/7 : WORKDIR /selfies
—> Using cache
—> 9018fb3984b0
Step 6/7 : ADD . /selfies/
—> Using cache
—> 8c6d291d99a7
Step 7/7 : RUN pip install -r requirements.txt
—> Using cache
—> 7caa2f3bf2ac
Successfully built 7caa2f3bf2ac
Successfully tagged selfies_web:latest

4. start the docker container

docker-compose up

This will run your container/s in the terminal and will show the server output

[13:39:32] (master) selfies
🙋 docker-compose up
Creating network “selfies_default” with the default driver
Creating selfies_redis_1 … done
Creating selfies_db_1 … done
Creating selfies_web_1 … done
Attaching to selfies_db_1, selfies_redis_1, selfies_web_1
db_1 | 2019-07-24 17:40:36.069 UTC [1] LOG: listening on IPv4 address “0.0.0.0”, port 5432
db_1 | 2019-07-24 17:40:36.069 UTC [1] LOG: listening on IPv6 address “::”, port 5432
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 24 Jul 2019 17:40:36.085 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 24 Jul 2019 17:40:36.086 * Running mode=standalone, port=6379.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # Server initialized
redis_1 | 1:M 24 Jul 2019 17:40:36.086 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 24 Jul 2019 17:40:36.086 * Ready to accept connections
db_1 | 2019-07-24 17:40:36.072 UTC [1] LOG: listening on Unix socket “/var/run/postgresql/.s.PGSQL.5432”
db_1 | 2019-07-24 17:40:36.086 UTC [18] LOG: database system was shut down at 2019-07-24 17:39:28 UTC
db_1 | 2019-07-24 17:40:36.090 UTC [1] LOG: database system is ready to accept connections
web_1 | Performing system checks…
web_1 |
web_1 | System check identified no issues (0 silenced).
web_1 | July 24, 2019 - 17:40:38
web_1 | Django version 2.1.7, using settings ‘selfies.settings’
web_1 | Starting ASGI/Channels version 2.2.0 development server at http://0.0.0.0:8000/
web_1 | Quit the server with CONTROL-C.

5. start the docker container in the background

docker-compose up -d

This will run the container but in the background so you can continue to type in the terminal. I usually run it this way if I don’t really need to see what the server is returning.

[13:31:03] (master) selfies
🙋 docker-compose up -d
Creating network “selfies_default” with the default driver
Creating selfies_db_1 … done
Creating selfies_redis_1 … done
Creating selfies_web_1 … done

6. see all of the docker containers currently running

List of active docker containers which is useful for the CONTAINER ID and to know what you have running.

docker ps

[13:31:10] (master) selfies
🙋 docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
a2b93a900c36 selfies_web “python manage.py ru…” 2 seconds ago Up 1 second 0.0.0.0:8000->8000/tcp selfies_web_1
2d39a1161aa2 postgres:10.1-alpine “docker-entrypoint.s…” 4 seconds ago Up 2 seconds 0.0.0.0:5432->5432/tcp selfies_db_1
62a6f364860e redis:latest “docker-entrypoint.s…” 4 seconds ago Up 2 seconds 6379/tcp selfies_redis_1

7. remove all docker containers in the repository

docker-compose down

I almost always follow this command with docker ps to make sure the containers were successfully removed, out of habit.

[13:37:20] (master) selfies
🙋 docker-compose down
Stopping selfies_web_1 … done
Stopping selfies_db_1 … done
Stopping selfies_redis_1 … done
Removing selfies_web_1 … done
Removing selfies_db_1 … done
Removing selfies_redis_1 … done
Removing network selfies_default

8. remove a specific docker container

docker kill :container_id

The container id is the leftmost column when doing docker ps. I sometimes do this if I need to remove a specific container that I’m not using.

[13:51:43] (master) selfies
🙋 docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
274b1605ca94 selfies_web “python manage.py ru…” 11 minutes ago Up 1 second 0.0.0.0:8000->8000/tcp selfies_web_1
a641f449edfc postgres:10.1-alpine “docker-entrypoint.s…” 11 minutes ago Up 2 seconds 0.0.0.0:5432->5432/tcp selfies_db_1
61b08693e242 redis:latest “docker-entrypoint.s…” 11 minutes ago Up 2 seconds 6379/tcp selfies_redis_1
[13:51:44] (master) selfies
🙋 docker kill 274b1605ca94
274b1605ca94

9. view all of the docker images

You can see all your builds by running this. For me these are either official “images” like redis or python or old builds of my projects. I only occasionally use this, it’s not really a part of my daily development.

docker images

[18:28:17] (master) selfies
// ♥ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
selfies_web latest 4869d063569e 7 days ago 1.32GB
python 3.6-stretch 9167692c277e 11 days ago 936MB
redis latest 598a6f110d01 12 days ago 118MB
<none> <none> 9c4676224e86 2 months ago 1e+03MB
<none> <none> 6c925f68c3a9 2 months ago 929MB
<none> <none> b44ef8ff52f4 2 months ago 929MB
<none> <none> 903b976cd478 2 months ago 1.47GB
<none> <none> f7009c6f0868 2 months ago 1.49GB
<none> <none> 52750c0c3926 2 months ago 1.48GB
<none> <none> 1c509a380925 2 months ago 1.44GB

10. clean out any images, builds, etc., that might be hanging

docker system prune

I only occasionally use this, it’s not really a part of my daily development.

[18:18:35] (master) selfies
// ♥ docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
Deleted Containers:
1f570bbf6828dadfdaa97655165943fd0b93ce6c185df2531f61a82982ec24f2
40f79091bc943c86f5f3ab7bc9d484ac9b576effc686a8a0fdb0031a465b16b4
f3399b0cd4f8c30159b15e1a2027aadeeaf9006efa4b759e4e3586d4589a0004
e0d18cddd40241de3d3b03d695afe667819c884a12fd36465c4c6d584df5aaa6
b7757cef15b49ecfe58ac6a8de3f8fcae91c71d793b7942955ccaf7c266bff92
a8fc94cd1af14f27b0ae22c1728b33fc8cef4090aa7deef1c2549c33755ed114
4de12efd1f88b9ee3541049c9b6fb3df5b1ade3b5787f888f5cf05f2e02c3cec
21d97261412949c06a4fcfb9846a6dee22f92e6a928cd6fb715ee81924917d43
073ca414e8c79e593c82f46f565adbae92a159994699dbbd0fb9df8044b3b1bb
b62f36a4a182479d25c2251e8d90fb7d2b612f31a03e943e83882ab436981879
456510a02d7ad5137dcb907484b2c8d9e07f51946be1103d294e4e253bc0e664
effee0d0a9afa74825f8f820bd363ebe1b7b54948aed38d57e84342482c367fd
5d930ece03ed8a2c2cb9178b81c9b42ef4c7397ef90d29b040ed3b1220f8ba27
a6ccf4f68831a19ab7381354f5643f3afd94cfbe0d066ff9ce4b248b90139a63
1a65f709f9b9c7d9749a04e88d3c4d18539a495160e143337c25025b10f9b24c
e98fbb022cb920dd4550751fdb735c1f73ae1dd6a049b9855bd77db1a2cbb3d1
18cb48bcb6428d4a9d5ca2f4b9c0a2fbedb3ef98c1d1fe6788029d7abea8efe9
97d0ee4625df7d107bc543318b1b45701f17720c41c7bb9614183e2cca0e26c7
5fafd4e2df31a0b84657ce1a0450c9cc8d8caa56ede9b10cddbfa6b6f55f6b50
212dae9eab339a84817b590cceb345d66290fa7f0fd7e347bffda322eb60400e
14cdd7e40ca412e1b091ddf640513ecf3f5f8bfd51cbc826e59b4901b1a0e213
ceeeb46b3aa52660a7080949543654e6436b0c050c865ef6cbed83f43bba8cc3
6c96d28cffed031a8bdd836670401b74eb52fa8f03c1dca83b73b8d0ba8530ec
9c89d36c6ee1f8fbc9d0c542d14d6d5b924817abf47a656941062eed95e607f6
58d212388ac7f15468306e306977661169e8aacdeeaba2fea4fc9cf7ebbb9e46
71963edbfe38d4578ba1338a0d03ed94f81664b202f969acf72d38ceeded5fed
4838aa870e8962e6a1c8c0e679dad8d25f5ad08824bfd45df150d148ae7097ba
abab59a1cd1fcf0a14e1d8f45d03f1787b218233a118af59f604ad890cc64dc1
5375b62e20d2660f8347f5f7355122f9fb528a1b603b1e58ceb7d7b811740410
29d7238e6d81f522f8c98b4d2e478bb304aec7a00892b8339bf1b4a0483e7040

Deleted Networks:
selfiesh_default

Originally published by Lina Rudashevski at dev.to

========================================

Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter

Learn More

☞ Docker Mastery: The Complete Toolset From a Docker Captain

☞ Docker and Kubernetes: The Complete Guide

☞ Docker for the Absolute Beginner - Hands On - DevOps

☞ Docker Crash Course for busy DevOps and Developers

☞ The Docker for DevOps course: From development to production

☞ Docker for Node.js Projects From a Docker Captain

☞ Docker Certified Associate 2019

☞ Selenium WebDriver with Docker

#docker #web-development

August  Murray

August Murray

1615008840

Top 24 Docker Commands Explained with Examples

In my previous blog post, I have explained in detail how you can Install Docker and Docker-compose on Ubuntu

In this guide, I have explained the Top 24 Docker Commands with examples.

Make sure you have sudo or root privileges to the system.

Docker Commands

  1. The command to check the version of Docker installed.
  2. To look/search for available docker images from the Docker registry.
  3. To pull docker images from the Docker registry.
  4. Listing all the docker images
  5. Creating / Running docker container from Docker image.
  6. To list the actively running docker containers.
  7. To list all the docker containers
  8. To stop a Container
  9. To start a Container
  10. To restart a Docker container
  11. To login to running Docker container
  12. To delete the stopped Docker containers
  13. To delete Docker images from the Local system
  14. To check logs of a running Docker container
  15. Killing docker containers
  16. Log in to Docker Hub registry (hub.docker.com)
  17. Removing docker hub registry login from the system.
  18. Check active resource usage by each containers
  19. Rename a Docker container
  20. To display system wide information of Docker
  21. Inspecting a Docker container
  22. Building docker images from Docker file
  23. Creating new docker images from a Container
  24. Pushing Docker images from Local to Docker registry.

#docker #docker-command #containers #docker-compose #docker-image