text:
# Self-signed SSL certificates and Certificate Authorities

**NOTE: You should not take this as some end-all best practices guide! Instead, familiarize yourself with the subject before actually following any advice given here. All of this information is based on my personal knowledge at the time of writing.**

Heavily based on these wonderful instructions: https://jamielinux.com/docs/openssl-certificate-authority/index.html

You should also check out this wiki-page by Mozilla on Server Side TLS: https://wiki.mozilla.org/Security/Server_Side_TLS

## Info

Root CA is the one you should add as your trusted Root CA in e.g. your browser.

One level below the Root CA, is the Intermediate CA. This certificate is the one used to sign all server and user certificates. You can add this certificate as a trusted intermediate authority to your browser, but it is usually not necessary, as long as the final authority (i.e. Root CA) is trusted by your browser.

Servers should have their own server certificates for HTTPS-connections, that are signed by the Intermediate CA. These certificates cannot and should not be used to sign any further certificates.

Client certificates can be created for users that need automatic client authentication. Client certificates are signed by the Intermediate CA.

Basic structure of the generated certificates:
```
                 +-----------+
                 |  Root CA  |
                 +-----------+
                       |
                       |
          +------------v-------------+
      +---+     Intermediate CA      +--+
      |   +--------------------------+  |
      |                                 |
      |                                 |
+-----v---------+         +-------------v-----+
|    Servers    |         |       Users       |
+---------------+         +-------------------+
|               |         |                   |
|    ServerA    |         |       UserA       |
|               |         |                   |
|     ...       |         |      ...          |
+---------------+         +-------------------+
```

### Directory structure

```shell
[me@machine dir]$ ls -lR
.:
drwxr-xr-x. 7 me me 4096 31.5. 16:21 CA        <== Root CA & Intermediate CA
drwxr-xr-x. 2 me me 4096 31.5. 16:07 server    <== Server certs
drwxr-xr-x. 6 me me   89 31.5. 11:17 user      <== User certs
```

## Create an unsecure server certificate

### Notes

**This method is not recommended for any serious use, as it strips out the pass phrase from the private key and does not use any Certificate Authority, removing your ability to revoke the certificate!**

Only use this for things like testing HTTPS on your demo web server. Or if your really know what you are doing, update the script to not remove the pass phrase and pass it to your web server in some secure manner.

### Steps

#### By script

```shell
./createSimplifiedServerCert.sh
```

and follow any instructions given. **Remember to set a valid Common Name (e.g. matching the address you will be connecting to your web server).**

#### Manually

Generate a private key
```shell
openssl genrsa -aes256 -out server.key.pem 2048
```

**OPTIONAL AND NOT RECOMMENDED**: Strip out the passphrase to use it in your web server. **It is highly recommended that you DO NOT do this, and instead find a method to input the pass phrase into your web server!**
```shell
cp server.key.pem server.key.pem.orig
openssl rsa -in server.key.pem.orig -out server.key.pem
```

Make the private key only readable by you
```shell
chmod 400 server.key.pem*
```

Generate a Certificate Signing Request
```shell
openssl req -new -sha256 -key server.key.pem -out server.csr
```

Generate the actual certificate
```shell
openssl x509 -req -days 365 -in server.csr -signkey server.key.pem -out server.crt
```

And use it in nginx, for example:
```
ssl_certificate		/path/to/certs/server.crt
ssl_certificate_key	/path/to/certs/server.key.pem
```

## Create a Root Certificate Authority (CA)

### Notes

The root certificate will be signed to be valid until 2026 (i.e. for 10 years), and when it needs to be renewed,
you should only have to create a new certificate file by signing it with the existing private key.

As this is the topmost trusted certificate in the chain, it should have proper security.
That's why the private key is so large (4096 bits).
It also uses AES256 for its encryption.
**Preferably, you should create this certificate in some air-gapped machine or something similar.**

### With scripts

1. Create a new directory in a secure machine where you want to store your Root CA certificate
2. Copy `createRootCA.sh` into that directory
3. Create a sub-directory `CA` and copy `openssl.cnf` under that
4. **IMPORTANT!** Update at least the row `dir` and match it to your current directory, and preferably update the defaults
5. Run `./createRootCA.sh` and follow any instructions given
6. **Done!**

### Manually

Create necessary folders:
```
mkdir CA
cd CA/
mkdir certs crl newcerts private
chmod 700 private
```

The `index.txt` and `serial` files act as a flat file database to keep track of signed certificates.
```
touch index.txt
echo 1000 > serial
```

Copy `openssl.cnf` to `CA` from this repo and update the default values for Country Names, Locations and directories.

Generate a private key:
```
openssl genrsa -aes256 -out private/CA.key.pem 4096
chmod 400 private/CA.key.pem
```

Next, create the actual certificate and sign it with the created private key.
`-days` sets the amount of days the certificate will be valid, here we set it to 3650 (~10 years).
`-extensions` sets the extension definition to use from the configuration file;
here we give this certificate the rights to sign certificates, i.e. CA extensions.
**NOTE:** `[string]` shows the default value for a field, if left empty, like below.
```
openssl req -config openssl.cnf -key private/CA.key.pem -new -x509 -days 3650 -sha256 -extensions v3_ca -out certs/CA.cert.pem
Country Name (2 letter code) [FI]:
State or Province Name [Uusimaa]:
Locality Name [Helsinki]:
Organization Name [MyOrganisation]:
Organizational Unit Name [MyUnit]:
Common Name []:MyOrganisation Root CA
Email Address []:
chmod 444 certs/CA.cert.pem
```

The certificate should be able to be read by anyone, but not written over by anyone, hence `chmod 444`.

## Intermediate Certificate Authority

### Create an Intermediate Certificate Authority

#### Steps

##### With scripts

1. Copy `createIntermediateCA.sh` into the same certificate directory you copied the previous script
2. Create a sub-directory `CA/intermediate` and copy `openssl.intermediate.cnf` as `openssl.cnf` under that
3. **IMPORTANT!** Update at least the row `dir` and match it to your current directory, and preferably update the defaults
4. Run `./createIntermediateCA.sh` and follow any instructions given
5. **Done!**

##### Manually method

Create a directory for the intermediate CA under the directory you created for the Root CA, and create the database files like with the Root CA:
```
mkdir intermediate
cd intermediate/
mkdir certs crl csr newcerts private
chmod 700 private
touch index.txt
echo 1000 > serial
```

Next create another `openssl.cnf` file under the current directory (`intermediate`).

Generate a private key for the intermediate CA, again with decent security as this key is mostly used to sign things => no performance loss anywhere:
```
cd ..
openssl genrsa -aes256 -out intermediate/private/intermediateCA.key.pem 4096
chmod 400 intermediate/private/intermediateCA.key.pem
```

Create a Certificate Signing Request (CSR) with the new private key:

**NOTE:** Common Name here is "MyOrganisation Intermediate CA".
```
openssl req -config intermediate/openssl.cnf -new -sha256 -key intermediate/private/intermediateCA.key.pem -out intermediate/csr/intermediateCA.csr.pem
Country Name (2 letter code) [FI]:
State or Province Name [Uusimaa]:
Locality Name [Helsinki]:
Organization Name [MyOrganisation]:
Organizational Unit Name [MyUnit]:
Common Name []:MyOrganisation Intermediate CA
Email Address []:
```

The signing request can then be used to create the actual certificate for the intermediate CA.
**NOTE:** You should now be in the `CA` directory to reference the *Root CA's* configuration file
instead of the intermediate one (the configuration sets the intermediate certificate to be signed by &
added to the Root CA's certificate database). The `-extensions v3_intermediate_ca` gives this certificate slightly less rights
than the Root CA (see the configuration file for more info).
```
openssl ca -config openssl.cnf -extensions v3_intermediate_ca -days 1825 -notext -md sha256 -in intermediate/csr/intermediateCA.csr.pem -out intermediate/certs/intermediateCA.cert.pem
chmod 444 intermediate/certs/intermediateCA.cert.pem
```

You can the verify that you have a working certificate, CSR and keys with:
```
openssl verify -CAfile certs/CA.cert.pem intermediate/certs/intermediateCA.cert.pem
openssl req -text -noout -verify -in intermediate/csr/intermediateCA.csr.pem
openssl rsa -in intermediate/private/intermediateCA.key.pem -check
```

Finally, you should create a certificate chain file that, as the name suggests, contains the Root CA and the Intermediate CA certificates. This file is then given to e.g. Apache to use as the CA certificate.
```
cat intermediate/certs/intermediateCA.cert.pem certs/CA.cert.pem > intermediate/certs/CA-chain.cert.pem
chmod 444 intermediate/certs/CA-chain.cert.pem
```

### Revoking an Intermediate Certificate

**WARNING!** Revoking a certificate is final! You should only do this if you are certain the certificate (or certificates signed with it) is at risk or is no longer valid.

#### Manual method (generalized)

1. Locate your OpenSSL configuration file (or refer to OpenSSL's manual to set all necessary options for revoking a certificate from a CA)
2. Locate the intermediate CA's certificate you want to revoke
3. Run `openssl ca -config my-openssl.cnf -revoke my-Intermediate.cert.pem`

## Server certificates

### Create a server certificate

#### Notes

These certificates are the lowest level certificates along user certificates.
These certificates cannot be used to further sign any new certificates and should only be used to identify servers
as trusted by their Certificate Authorities, here MyOrganisation Intermediate CA (and Root CA).
These are also the ones given to your web server (e.g. Apache) to use as its server certificate, enabling HTTPS connections.

#### Steps

##### With scripts

1. Copy `createServerCert.sh` into the same certificate directory you copied the previous scripts
2. Run `SERVER_NAME=my-server sh createServerCert.sh` and follow any instructions given
  - The Common Name for the server certificate must match the address that is used to connect to the server (e.g. its domain name or IP)
3. **Done!**

You are now ready to install the certificate into your server.

##### Manually

Private keys:
```
openssl genrsa -aes256 -out intermediate/private/myServer.key.pem 2048
chmod 400 intermediate/private/myServer.key.pem
```

CSR:
```
openssl req -config intermediate/openssl.cnf -key intermediate/private/myServer.key.pem -new -sha256 -out intermediate/csr/myServer.csr.pem
```

Certificate:
```
openssl ca -config intermediate/openssl.cnf -extensions server_cert -days 730 -notext -md sha256 -in intermediate/csr/myServer.csr.pem -out intermediate/certs/myServer.cert.pem
Country Name (2 letter code) [FI]:
State or Province Name [Uusimaa]:
Locality Name [Helsinki]:
Organization Name [MyOrganisation]:
Organizational Unit Name [MyUnit]:
Common Name []:<IP_ADDRESS>
Email Address []:

chmod 444 intermediate/certs/myServer.cert.pem
```

Verify (with the CA chain file):
```
openssl verify -CAfile intermediate/certs/CA-chain.cert.pem intermediate/certs/myServer.cert.pem
intermediate/certs/myServer.cert.pem: OK
```

### Revoking a server certificate

#### Manual method (general)

1. Locate the OpenSSL configuration file for your CA (or refer to OpenSSL documentation for the necessary options)
2. Locate the certificate you want to revoke
3. Run `openssl  ca -config path/to/openssl.cnf -revoke /path/to/file`
4. You can now rename/delete the old certificate file

## User certificates

### Create a new user certificate

#### Notes

These certificates are used to authenticate users and applications into servers that trust the Root CA (e.g. Apache).

#### With scripts

1. Copy `createClientCert.sh` into the same certificate directory you copied the previous scripts
2. Run `CLIENT_NAME=my-client sh createClientCert.sh` and follow any instructions given
  - Set a descriptive Common Name (e.g. User Alpha Beta xyz123)
  - Leave email, challenge password and optional company fields empty for the CSR, unless required
3. **Done!**

#### Manually

1. Private key: `openssl genrsa -aes256 -out user/my-client/my-client.key.pem 2048` & `chmod 400 user/my-client/my-client.key.pem`
2. CSR: `openssl req -config CA/intermediate/openssl.cnf -key user/my-client/my-client.key.pem -new -sha256 -out user/my-client/my-client.csr.pem`
3. Certificate: `openssl ca -config intermediate/openssl.cnf -extensions usr_cert -days 730 -notext -md sha256 -in user/my-client/my-client.csr.pem -out user/my-client/my-client.cert.pem` & `chmod 444 user/my-client/my-client.cert.pem`
4. Verify: `openssl verify -CAfile CA/intermediate/certs/CA-chain.cert.pem user/my-client/my-client.cert.pem`
5. Optionally, create a P12 file for Chrome & Firefox installation: `openssl pkcs12 -export -clcerts -in user/my-client/my-client.cert.pem -inkey user/my-client/my-client.key.pem -out user/my-client/my-client.p12`

### Revoking a user certificate

Refer to the instructions for revoking server certificates: [Revoking a server certificate](Server-certificates#revoking-a-server-certificate)

repository: mikkopiu/knowledge

repo_name: mikkopiu/knowledge


text:
## EtcdMemberSpec v1alpha2 kops

Group        | Version     | Kind
------------ | ---------- | -----------
kops | v1alpha2 | EtcdMemberSpec

EtcdMemberSpec is a specification for a etcd member

Appears In:

EtcdClusterSpec kops/v1alpha2

Field        | Description
------------ | -----------
encryptedVolume
 *boolean*    | EncryptedVolume indicates you want to encrypt the volume
instanceGroup
 *string*    | InstanceGroup is the instanceGroup this volume is associated
kmsKeyId
 *string*    | KmsKeyId is a AWS KMS ID used to encrypt the volume
name
 *string*    | Name is the name of the member within the etcd cluster
volumeIops
 *integer*    | If volume type is io1, then we need to specify the number of Iops.
volumeSize
 *integer*    | VolumeSize is the underlying cloud volume size
volumeType
 *string*    | VolumeType is the underlying cloud storage class

repository: qntfy/kops

branch_name: refs/heads/master

extension: md

license_type: permissive

repo_name: qntfy/kops


text:
## Installation

Do these steps on the node where you have installed Foreman:

1.  `yum install rubygem-nokogiri`

1.  `gem install deface -v 0.7.2 --ignore-dependencies`

1.  `git clone git://github.com/theforeman/foreman_simplify.git /usr/local/foreman_simplify`

1.  Put this into `/usr/share/foreman/bundler.d/foreman_simplify.rb`:

    ```
    gem 'deface', '0.7.2'
    gem 'foreman_simplify', :path => '/usr/local/foreman_simplify'
    ```
1.  Run `bundle` as user `foreman` in the `/usr/share/foreman` directory.


text:
# QR-Code-Generator
Python GUI program that enables the user to generate QR codes,
with simple text input, and export the generated image in png / jpeg formats.

![QR-Code Generator (GUI)](https://user-images.githubusercontent.com/70844165/92326741-f79adb80-f05c-11ea-9aef-5ca9b15a75d5.JPG)

## How to use :

### Generating the QR code.

1. Open the Main.py file.

2. Click on the text field.

3. Write your message.

4. Click the "Generate QR" button.

### How to export the QR code :

1. After generating the QR code, simply press the button below it.

2. Pick a name, path and format.

3. Press save, and enjoy.

## Built With

* [PyQt5](https://pypi.org/project/PyQt5/) - The GUI framework used.

* [qrcode](https://pypi.org/project/qrcode/) - Used to generate QR codes.

license: MIT

repository: edenb-dev/QR-Code-Generator

repo_name: edenb-dev/QR-Code-Generator


text:
---
layout: post
title: "Celery 4 tasks with very long timeout"
permalink: "/python/celery/2018/02/19/celery-4-tasks-with-very-long-timeout/"
date: 2018-02-19 14:30:00 +0200
categories: [development]
tags: [python, celery, queue]
description: >-
  Working with Celery tasks which required very long timeout.
---

Delaying tasks is not obvious and as always when Celery comes in we must
take care about few things.

     INFO

    This article is about Celery 4.0 and 4.1. If you come from the future,
    this may also apply to you.

## Countdown

First and the easiest way for task delaying is to use `countdown` argument.
Countdown takes Int and stands for the delay time expressed in seconds.

```python
my_task.apply_async(countdown=10)
```

### Pros

* easy to use
* readable

### Cons

* doesn't work when `enable_utc` is set to False and timezone is defined

## Estimated Time of Arrival

Second way is to use `eta` argument, which takes exact date and time of execution.
Works perfectly with native datetime object, date as String or even Pendulum instance.

```python
my_task.apply_async(eta=datetime.now(pytz.timezone("Europe/Warsaw"))
my_task.apply_async(eta="2018-02-19 13:41:14+01:00")
my_task.apply_async(eta=pendulum.now("Europe/Warsaw"))
```

### Pros

* readable
* precise
* works with timezones

### Cons

* require more work

## Visibility timeout

Sometimes there is a need for very long timeout for example 8 hours or more.
For such long timeouts Celery require additional configuration.

```python
app = Celery("project_name", broker="redis://localhost:6379", backend="redis://localhost:6379")

max_timeout_in_seconds = 21600  # 6h this is arbitrary
app.conf.broker_transport_options = {"visibility_timeout": max_timeout_in_seconds}
```

Without `visibility_timeout`, tasks with very long timeout may be dropped or will be executed multiple times.
Once or twice for every active worker.

gha_language: CSS


text:
# Steam Shortcut Generator

> Note: This tool is currently Windows-only. But I might take the time to add Linux/macOS support if requested!

> This tool used to use SteamDB to fetch the hi-res .ico file for each game, but scraping was causing some IP-ban issues (sorry). It has been rewritten to use the SteamAPI (in combination with your username) to fetch the icons from the Steam CDN directly. Unfortunately, the quality for each icon is a low-res jpg, as the API does not provide the .ico links - I will investigate this and fix it soon. If successful, I'll be able to remove the Pillow dependency too!

---

**Steam now supports this through selecting multiple library games > Manage > Create Desktop Shortcuts**.
It can't, however, add them to the start menu for you automatically. This tool can!

Ever needed to recreate all of your Steam shortcuts? Maybe you forgot to back them up when reinstalling your OS, or just never created them in the first place...

If you have a large library of installed games and you don't want to manually create the shortcut for each one, then this is the tool for you!

[Here's a demo!](https://www.youtube.com/watch?v=eH-ouDx1Y68)

## Usage

> Note: the shortcuts created are .url links, just like the ones Steam creates - this is because I can't tell which .exe is the one that launches the game, plus Steam sometimes likes to give you launch dialogues

1. You need [Python 3.6 or newer](https://www.python.org/downloads/) installed.
2. Your Steam profile must have game library set to publicly visible.
3. You will need to run `[your python3 alias] -m pip install pillow urllib3`
4. From the command-line, PowerShell or equivialent terminal, run `[your python3 alias] steam_shortcuts.py`.
5. Follow the prompts to create shortcuts with or without icons. You'll need to enter your Steam name, this is just used to cross reference the games you own for their icon file.
6. The shortcuts will be created in `./shortcuts`, relative to wherever the script was run from

## What it does

1. Checks your registry for the Steam install folder
2. Reads `steamapps/libraryfolders.vdf` to find out where all your Steam libraries are located
3. For each library, parse all the `appmanifest_xxx.acf` files for game names and install locations, where xxx is the appid of an installed game
4. For each game, check if an icon already exists in the game's installation folder - the icon is downloaded by this tool, so it won't exist if you haven't run it before
5. For all missing icons, download them if the user requests
6. For each game, now create the URL shortcuts to `steam://rungameid/{appid}`, set the icon if it exists, or blank if the user asks for icon-less shortcuts
7. Done! No tidying up is done since the icons are kept in the game folders for use by each shortcut. I guess things might break if you uninstall the game, but they're just shortcuts :)

## Warnings
- The icons are currently LOW res due to the SteamAPI not providing a high quality link, like scraping SteamDB used to.
- Your Steam account must own the games for the tool to fetch the icons. It can still create icon-less shortcuts if you want though.
- It will try to use your username to retrieve your Steam profile & ID. If you set a custom profile URL you should enter that (the end ID-part) as your username.
- It only supports Windows, and does simple checks for sanity like current folder etc. - if you don't follow the usage instructions (or if you do) and it breaks something, don't blame me. (P.S. All it does is write icon files and create shortcuts, but who knows, this is software)
- Not all icons created may be usable, like Steamworks Redist, Proton, etc.

repository: DoBYaH/steam-shortcut-generator

repo_name: DoBYaH/steam-shortcut-generator


text:
---
layout: post
title:      "Understanding Relationships with Active Record/ Rack/ HTML & CSS/ Sinatra"
date:       2018-07-29 18:26:20 -0400
permalink:  understanding_relationships_active_record_rack_html_and_css_sinatra
---

After learning Ruby, the LearnCo curriculum quickly jumped into a diverse amount of languages that carried very specific roles accomplishing different tasks. I wanted to compile my thoughts from these lessons to concisely and *simply* understand the roles of each language within the Sinatra Project application, and why they're necessary.

To begin in this blog, I'll dive into an overview of each language, and the last piece will analyze how each language plays a part in the overall application.

**SQL/Active Record **

To put it simply, SQL is a language that manages data, and only data. It sole role is to speak to other databases and as a result it's often referred to as a Domain Specific Language. It is used to interact with the database that powers it, these might be MySQL, SQLlite, PostgreSQL. Why do we need data? Every time we login to a website the database takes that information and stores it so you can access your account.

So where does ActiveRecord come in?

ActiveRecord is the bridge between Ruby and SQL, in fact, it's a Ruby gem. If you're creating a model like I have done in my Sinatra project where a user has many gifts, and a gift belongs to a user, you will need to find a way to map this relationship within your application. If you've already created your class models for Gift and User, you need to find a way for these two models to read as tables in your application so you can add in data (i.e. username and password for the User model).  To do this you would use ActiveRecord. ActiveRecord maps your database tables to Ruby classes and database rows to Ruby instances. To set the has many and belongs to relationships you would specify in each model that a User has_many gifts and a Gift belongs_to a User via Active Record Associations in Sinatra. Easy.

So SQL and ActiveRecord mainly work with data and mapping Ruby in an organized manner into your application.

**Rack**

Rack is a gem that allows you to spin up a web server easily. Rack is the tool you use to get what you're creating onto the web. We will be replacing Rack with Rails soon in the curriculum (which I'm very much looking forward to! ) but it is required to use in my Sinatra Project as a way to view my application. Additionally, Rack is what Rails is built off of, and the underlying language is *Ruby*. See a pattern here?

**HTML & CSS**

HTML is the backbone to what you're website will look like to a user. HTML will hold all of the content and some formatting but the majority of styling and formatting will be done by CSS.  This is front-end and solely caters to the client or user viewing the site.

**Sinatra**

Sinatra is a Domain Specific Language implemented in *Ruby* that's used for writing web applications or in other words, Sinatra is a *lightweight* framework.

What is a framework?

> A web application framework (WAF) is a software framework that is designed to support the development of dynamic websites, web applications, web services and web resources. The framework aims to alleviate the overhead associated with common activities performed in web development.
>

In other words, frameworks take routine and common requirements of any web application and abstract them into code so that you can spend less time creating the platform to run your application,  Frameworks allow you to focus on actually writing the code to run your application vs spending time on set up.

 Sinatra is a lightweight framework because it doesn't provide much upfront in setup. Sinatra essentially provides the bare minimum requirements to be able to run a simply Ruby based application, the rest you implement manually.

 **A couple key pieces before we tie everything together **

 MVC

 The reason this curriculum asks you to use Sinatra is because they want us to learn how to construct a Model View Controller (MVC) based application. MVC is a system for building web applications that governs 90% of the worlds' apps.

 Essentially MVC is an *understood* way to develop applications, as it delegates who is responsible for what and when.

*  Model - is the underlying logic, the brains of the operation. In my Sinatra Project, the model was a Gift and a User.  Aka Ruby in the Sinatra Project.

*  View - is what the client or user sees, it's purely front-end, and the only part of the MVC that the user interacts with. AKA HTML/CSS/Javascript

* Controller - it's what communicates between the Model and the View.  It's how the logic or the brains arrives to the user/client. The controller takes each request from the User/client via the view and requests whatever necessary information from the Model.  Once the Model receives this request it sends back that necessary data to the Controller and the Controller communicates it to the View and ultimately to the User/client. In Sinatra Controllers use Ruby and routes to allow the User/client to see specific views.

Active Record *within* Sinatra

We learned in Active Record how to manipulate data.  In Active Record within Sinatra you learn similar methods in with CRUD (Create, Read, Update, Delete). These methods show you how your application will be able to create a user account, find or read the user account so that the user can log in once signing up to an account, update or edit their account information, and lastly how to delete their account. Sinatra provides you with the format and syntax to do this.

**Now, we tie it all together**

So, the MVC incorporates Ruby in the Model, HTML & CSS in the view and Sinatra as the entire framework to build the application. Rack is the method in which the views are able to be seen to the User/client in the browser, and ActiveRecord is the avenue for which the developer is able to direct the Controller to write CRUD actions.

And now, to Rails!

extension: markdown


text:
# ChiNRF
Arduino library for NRF24L01+ clones: RFM73, RFM75, LCX24G, XN297

This library is an attempt to make the NRF24L01+ and its clones understand each other.
## Simple example: buttons and LEDs
3 different radio modules connected to 3 Arduinos. You press a button on any of them, and the pin13 LED of the other 2 will light up. You release the button, and the LEDs will turn off.
https://github.com/roboremo/ChiNRF/tree/master/ChiNRF%20v1.0/Examples

## Interesting facts
LCX24G and XN297/KSL297 seem to be identical
It seems that RFM73 is not produced anymore, and was replaced by RFM75
I have a RFM73 that works if initialized with register values from the RFM75 datasheet, but not with those from RFM73 datasheet.

## Limitations
In order to be able to communicate with each other, the radio modules are set to fixed payload size, no CRC, no ACK.
Some chips use preamble [0x55], others use [0x71 0x0F 0x55]. In order to understand each other, the chips that use [0x55] have set the TX address to [0x00 0x00 0x00 0x00 0x00] and are emulating the 3-Byte preamble by writing it (and the actual TX address) at the beginning of the data message, so the maximum message length gets smaller.
Tested only with 5-Byte address.
There are still many things to test.

## Credits:
Big thanks to the guys from www.deviationtx.com/forum for revealing the scrambling algorithm of the XN297.
https://www.deviationtx.com/forum/protocol-development/3368-jd-395-cx-10?screenMode=none&start=180

## Things used for developing this library:
https://github.com/roboremo/NRF24-total-control
https://github.com/roboremo/NRF24-demodulator


text:
# Dicoding Submission: Belajar Fundamental Aplikasi Android
 [![Platform](https://img.shields.io/badge/platform-Android-green.svg)](http://developer.android.com/index.html) [![Kotlin](https://img.shields.io/badge/kotlin-1.3.72-blue.svg)](http://kotlinlang.org) [![Gradle](https://img.shields.io/badge/gradle-4.0.0-%2366DCB8.svg)](https://developer.android.com/studio/releases/gradle-plugin)

This repository is the result of my submission in [Dicoding](https://www.dicoding.com) class [Learn Fundamental Android Application](https://www.dicoding.com/academies/14) that implements MVVM(Model View ViewModel) architecture using the components ViewModel, LiveData, Dagger2, Room, RxJava, etc.
*Hopefully my repository can be useful to be used as a reference all friends.*

## Installation
Clone this repository and import into Android Studio
```
    https://github.com/dimas-nur/dicoding-bfaa.git
```
> **NOTE :**  This repository have 4 branch
> 1. Master - consists of a combination of branches 1, 2 and 3
> 2. Submission1 - contains tasks from submission 1 ( **Get 5 Star** )
> 3. Submission2 - contains tasks from submission 2 ( **Get 5 Star** )
> 4. Submission3 - contains tasks from submission 3 ( **Get 5 Star** )

## Demo

 Search Screen

Notification Reminder

Profile Screen

Favorite Screen

Setting Screen

Widget

  Consumer App

## Feature :
- Using MVVM (Model-View-ViewModel) Architecture
- Using Dagger2 as dependency injection
- Using Single activity and using navigation component to manage fragment operations
- Using localization for support Indonesian and English Language
- Using Room Persistence for local database
- Using ViewBinding & DataBinding
- Using RxJava2 to handle data flow
- Using Retrofit to request api network
- Using Glide for load and caching image from url
- There is an explanatory comment on each function, making it easier to understand the flow of the application

## Dependencies :
- [Lifecycle & Livedata](https://developer.android.com/jetpack/androidx/releases/lifecycle)
- [Navigation Component](https://developer.android.com/jetpack/androidx/releases/navigation)
- [Dagger 2](https://github.com/google/dagger)
- [Retrofit 2](https://square.github.io/retrofit/)
- [OkHttp 3](https://square.github.io/okhttp/)
- [RxJava2](https://github.com/ReactiveX/RxJava)
- [RxKotlin2](https://github.com/ReactiveX/RxKotlin)
- [RxAndroid](https://github.com/ReactiveX/RxAndroid)
- [Glide](https://github.com/bumptech/glide)
- [AndroidX](https://mvnrepository.com/artifact/androidx)
- [Sweet Alert](https://github.com/F0RIS/sweet-alert-dialog)
- [Fancy Toast](https://github.com/Shashank02051997/FancyToast-Android)

## Pull Requests
I encourage all the developers out there to contribute to the repository and help me to expand it. To contribute just think up of an example which could be a feature or some demo to how to use a library. Develop the demo and create a pull request and you are in.

## Support me
> Just  **star** or  **fork** this repository, and follow my github. You have *supported* me!

## Author
[**Dimas Nur Alif Rochmadtulloh**](https://www.linkedin.com/in/dimasnur/) -<EMAIL_ADDRESS>
## License
```

   Copyright © 2020 Dimas Nur Alif Rochmadtulloh

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

```


text:
Node.js API Starter
=======================

A boilerplate for Node.js API starter using Express, MongoDB and Passport

You can easily start a project, just pick a web framework and plug it on this API.

**Note:** This project was created from [Hackaton Starter](https://github.com/sahat/hackathon-starter)

Table of Contents
-----------------

- [Features](#features)
- [Prerequisites](#prerequisites)
- [Getting Started](#getting-started)
- [Obtaining API Keys](#obtaining-api-keys)
- [Project Structure](#project-structure)
- [List of Packages](#list-of-packages)
- [FAQ](#faq)
- [Contributing](#contributing)
- [License](#license)

Features
--------

- **Local Authentication** using Email and Password
- **OAuth 2.0 Authentication** via Facebook, Google
- Forgot Password with email via [Nodemailer](https://github.com/nodemailer/nodemailer)
- Reset Password

Prerequisites
-------------

- [MongoDB](https://www.mongodb.org/downloads) or a distant MongoDB ([mLab](https://mlab.com/) or [Compose](https://www.compose.io/))
- [Node.js 8.0+](http://nodejs.org)
- Command Line Tools
- Text Editor (ex: [Visual Studio Code](https://code.visualstudio.com) or [Atom](https://atom.io/))

Getting Started
---------------

The easiest way to get started is to clone the repository:

```bash
# Get the latest snapshot
git clone https://github.com/vinigg2/thechecker-api myproject

# Change directory
cd myproject

# Install NPM dependencies
npm install

# Then simply start your app
node app.js
```

**Note:** I highly recommend installing [Nodemon](https://github.com/remy/nodemon).
It watches for any changes in your  node.js app and automatically restarts the
server. Once installed, instead of `node app.js` use `nodemon app.js`. It will
save you a lot of time in the long run, because you won't need to manually
restart the server each time you make a small change in code. To install, run
`sudo npm install -g nodemon`.

Obtaining API Keys
------------------

To use any of the included APIs or OAuth authentication methods, you will need
to obtain appropriate credentials: Client ID, Client Secret, API Key, or
Username & Password. You will need to go through each provider to generate new
credentials.

I have included dummy keys and passwords for all API examples to get you up and running even faster. But don't forget to update them with *your credentials* when you are ready to deploy an app.

- Visit Google Cloud Console
- Click on the **Create Project** button
- Enter *Project Name*, then click on **Create** button
- Then click on **APIs & Services** in the sidebar
- Click on **Enabled APIs and services** button
- Now search **Google+ API**, click on it and then click on **Enable** button
- Go back to home by clicking on **Google Cloud Platform logo**
- Next, under *APIs & Services* in the sidebar click on **Credentials** tab
- Before creating credentials, go to tabs **OAuth Consent Screen*, fill *Application name* and click on **Save** button at the bottom
- Then, click on **Create credentials > OAuth client ID**
- Select *Web Application*
- Now, fill out the required fields:
    - **Name**: The name you want
    - **Authorized Javascript origins**: http://localhost:8080
    - **Authorized redirect URI**: http://localhost:8080/auth/google/callback
- Click on **Create** button
- Copy and paste *Client ID* and *Client secret* keys into `.env`

**Warning:** Facebook api need https to work *(for Facebook Login OAuth Redirect URIs)*.

You're going to use **Ngrok** ! Install it from [here](https://ngrok.com/) or with `npm install ngrok -g`
You must start ngrok after starting the project.

```bash
# start ngrok to intercept the data exchanged on port 8080
ngrok http 8080
```

Next, you must update **FRONTEND_URL** in .env file using the https url defined by ngrok, for example `https://71fbdd1a.ngrok.io`.

If you already have configured Google with `http://localhost:8080`, Google login won't work until you replace the **FRONTEND_URL** in .env to localhost.

- Visit Facebook Developers
- Click **My Apps**, then select *Add a New App* from the dropdown menu
- Enter a new name for your app
- Click on the **Create App ID** button
- Find the Facebook Login Product and click on **Set up**
- Instead of going through their Quickstart, go to your App Settings. Click on **Settings > Basic** in the left nav
- Copy and paste *App ID* and *App Secret* keys into `.env`
- **Note:** *App ID* is **FACEBOOK_ID**, *App Secret* is **FACEBOOK_SECRET** in `.env`
- Enter `localhost` under *App Domains*
- Choose a **Category** that best describes your app
- Click on **+ Add Platform** and select **Website**
- Enter `http://localhost:8080` under *Site URL*
- Click on **Facebook Login** tab in the left nav and choose *Settings*
- Enter `https://xxxxx.ngrok.io/auth/facebook/callback` under Valid OAuth redirect URIs *(you need to create this route on your frontend application)*

- Go to https://sendgrid.com/user/signup
- Sign up and **confirm** your account via the *activation email*
- Then enter your SendGrid *Username* and *Password* into `.env` file

- Go to http://www.mailgun.com
- Sign up and add your *Domain Name*
- From the domain overview, copy and paste the default SMTP *Login* and *Password* into `.env` file

Project Structure
-----------------

| Name                               | Description                                                  |
| ---------------------------------- | ------------------------------------------------------------ |
| **config**/passport.js             | Passport Local and OAuth strategies, plus login middleware.  |
| **models**/user.model.js           | Mongoose schema and model for User.                          |
| **controllers**/auth.controller.js | Controller for authentication.                               |
| **controllers**/users.controller.js| Controller for users.                                        |
| **routes**/index.js                | Routes management with main routes.                          |
| **routes**/auth.routes.js          | Routes for /auth.                                            |
| **routes**/users.routes.js         | Routes for /users.                                           |
| .env.example                       | Your API keys, tokens, passwords and database URI.           |
| .gitignore                         | Folder and files ignored by git.                             |
| app.js                             | The main application file.                                   |
| package.json                       | NPM dependencies.                                            |

List of Packages
----------------

| Package                         | Description                                                             |
| ------------------------------- | ------------------------------------------------------------------------|
| bcrypt                          | Library for hashing and salting user passwords.                         |
| body-parser                     | Node.js body parsing middleware.                                        |
| chalk                           | Terminal string styling done right.                                     |
| connect-mongo                   | MongoDB session store for Express.                                      |
| cors                            | CORS Management.                                                        |
| dotenv                          | Loads environment variables from .env file.                             |
| express                         | Node.js web framework.                                                  |
| express-session                 | Simple session middleware for Express.                                  |
| express-validator               | Easy form validation for Express.                                       |
| mongoose                        | MongoDB ODM.                                                            |
| nodemailer                      | Node.js library for sending emails.                                     |
| passport                        | Simple and elegant authentication library for node.js.                  |
| passport-facebook               | Sign-in with Facebook plugin.                                           |
| passport-google-oauth           | Sign-in with Google plugin.                                             |
| passport-local                  | Sign-in with Username and Password plugin.                              |

FAQ
---

### I am getting MongoDB Connection Error, how do I fix it?
That's a custom error message defined in `app.js` to indicate that there was a
problem connecting to MongoDB:

```js
mongoose.connection.on('error', (err) => {
  console.error(err);
  console.log('%s MongoDB connection error. Please make sure MongoDB is running.', chalk.red('✗'));
  process.exit();
});
```
You need to have a MongoDB server running before launching `app.js`. You can
download MongoDB [here](http://mongodb.org/downloads), or install it via a package manager.

Windows users, read [Install MongoDB on Windows](https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/).

**Tip:** If you are always connected to the internet, you could just use
[mLab](https://mlab.com/) or [Compose](https://www.compose.io/) instead
of downloading and installing MongoDB locally. You will only need to update database credentials
in `.env` file.

### I get an error when I deploy my app, why?
Chances are you haven't changed the *Database URI* in `.env`. If `MONGODB` is
set to `localhost`, it will only work on your machine as long as MongoDB is
running. When you deploy to Heroku, OpenShift or some other provider, you will not have MongoDB
running on `localhost`. You need to create an account with [mLab](https://mongolab.com/)
or [Compose](https://www.compose.io/), then create a free tier database.

### How do I switch SendGrid for another email delivery service, like Mailgun or SparkPost?
Inside the `nodemailer.createTransport` method arguments, simply change the service from `'Sendgrid'` to some other email service. Also, be sure to update both username and password below that. See the [list of all supported services](https://github.com/nodemailer/nodemailer-wellknown#supported-services) by Nodemailer.

Set up online database *(not required)*
----------

- Open [mlab.com](https://mlab.com) website
- Click the yellow **Sign up** button
- Fill in your user information then hit **Create account**
- From the dashboard, click on **:zap:Create new** button
- Select **any** cloud provider (I usually go with AWS)
- Under *Plan* click on **Single-node (development)** tab and select **Sandbox** (it's free)
 - *Leave MongoDB version as is - `2.4.x`*
- Enter *Database name** for your web app
- Then click on **:zap:Create new MongoDB deployment** button
- Now, to access your database you need to create a DB user
- Click to the recently created database
- You should see the following message:
 - *A database user is required to connect to this database.* **Click here** *to create a new one.*
- Click the link and fill in **DB Username** and **DB Password** fields
- Finally, in `.env` instead of `mongodb://localhost:27017/test`, use the following URI with your credentials:
 - `db: 'mongodb://USERNAME:PASSWORD@ds027479.mongolab.com:27479/DATABASE_NAME'`

**Note:** As an alternative to mLab, there is also [Compose](https://www.compose.io/).

Contributing
------------

If something is unclear, confusing, or needs to be refactored, please let me know.
Pull requests are always welcome !

License
-------

The MIT License (MIT)

Copyright (c) 2018 Flavio Paroli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

gha_language: JavaScript

gha_license_id: MIT


text:
this petclinic application is java project
-----------------------------------------

to build use tool called maven
petclinic will connect with the database(mysql)
database information is in pom.xml and schema.sql

build command:  mvn clean package -P MySQL

this petclinic application deployed in the kubernetes(k8s) eks(aws cluster)

we need code + dockerfile

jenkins--maven--petclinic
job:getting the war file
/var/lib/jenkins/workspace/petclinic/target

pre-req: RDS
-------------
1)create the RDS in the eks vpc
   public
   private--create the RDS in the private subnet
2) allow the RDS-SG in eks worker node-sg
3) allow the jenkins-sg in rds-sg

branch_name: refs/heads/main


text:
# osb-credential-agent

Secure Service Delivery API

1. [Introduction](#introduction)
4. [Configuration](#configuration)
5. [Supported Services](#supported_services)
6. [Endpoints](#endpoints)

### Introduction
This project is small REST-API meant to be deployed with a service in a service broker ecosystem.
It creates credentials, sets them up in a service and saves them in Credhub for credhub interpolation.
Read [here](https://github.com/cloudfoundry-incubator/credhub/blob/master/docs/secure-service-credentials.md)
for more information in secure service delivery.

### Configuration

For usage configure a UAA-endpoint and a Credhub instance in a config.yml file.
Set the path to the config file as an argument to the config file.

```yaml
uaa:
  uaa_endpoint: "https://<IP_ADDRESS>:8443"
  client_name: "credhub_client"
  client_secret: "secret"
credhub_endpoint: "https://localhost:9000"
skip_ssl_validation: true
client_identifier: osb-service-broker
service_identifier: service-id

port: 8082

service_handler: mongoDB

mongodb:
  username: admin
  password: adminPassword
  hosts:
    - localhost:27017
  database: serviceIdentifier
```

### Endpoints

To create a binding your Service Broker needs to fire the following REST call.
```
 curl 'http://path/credentials' -i -X PUT \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer [some-token]' \
-d '{
"binding-id": "your-id"
}'
```
The agent will create the credentials like implemented in the selected service_handler
and save them in credhub. The agent will respond with:
```json
{"credhub-ref":"/c/osb-service-broker/service-id/your-id/credentials-json"}
```

To delete a binding call
```curl http://path/credentials?binding-id=your-id -i -X DELETE```

The agent will remove the credentials from your service and credhub.

repository: AdaptiveThinking/osb-credential-agent

repo_name: AdaptiveThinking/osb-credential-agent


text:
# E-Commerce-Back-End

## This GitHub repository contains back-end code and database schema for an E-Commerce application.

---

### This application provides a database schema and seed files for the back-end of an E-Commerce application. The seed files contain a suitable database schema and sample data to demonstrate how data is stored within the database. Code for a basic API is also included, which allows for API calls to view, update or delete data from the database.

---

## Table of Contents

* [Installation and Usage](#installation-and-usage)
  * [Installation](#installation)
  * [Usage and Testing](#usage-and-testing)
* [Motivation and Research](#motivation-and-research)
* [Development](#development)
  * [Web development technologies](#web-development-technologies)
  * [Challenges](#challenges)
  * [Future Development Opportunities](#future-development-opportunities)
* [License](#license)
* [Contributing](#contributing)
* [Questions](#questions)
* [Repository Link](#repository-link)
* [Walkthrough Video](#walkthrough-video)

---

## Installation and Usage

### Installation

Clone the repository and then run this command within the repo directory:

```npm install```

You need to have MySQL installed and running on your local machine to create and use the database.

Use MySQL Workbench to view and manipulate the database and it's information. Alternatively you can install the MySQL extension in Visual Studio Code.

### Usage and Testing

Ensure you are running the terminal from the root path of the directory and that your MySQL server is running.

Run the SQL provided in `schema.sql` to create the database.

To seed the data to the database use:

`npm run seed`

To start the application use:

`npm start`
*or*
`node server.js`

---

## Motivation and Research

The motivation behind this project was to begin working with the concepts of routes and developing a basic API which was capable of accepting and processing requests, allowing for API calls to be made that would display and modify the data stored within the SQL database.

The application is designed to provide the basis for an E-Commerce website backend, with data being stored within the database for use with a future front end interface. Updates to the data can be performed using the provided API, allowing for Products, Product Categories and Product Tags to be created, modified, viewed or deleted.

The application is command line driven, and simple to use.

Routing in web development is a mechanism where HTTP requests are routed to the code that handles them. To put simply, Routing allows us to determine what should happen when a user makes a certain request via a HTML request, for instance to view a particular item on a shopping website, and how that data should be displayed to the user.

---

## Development

### Web development technologies

Development of the project was centered around using Express and MySQL/Sequelize, back end web applications for Node.js that are installed using the node package manager (NPM).

Node.js, an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.

Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.

MySQL is the world's most popular open source database, and provides a database to contain data used by the application.

Sequelize is a promise-based, Node.js ORM (Object-relational mapping) for MySQL. It features solid transaction support, relations, eager and lazy loading, read replication, and other features.

Links to the languages and tools used to build this project are included below:

* Javascript ES6
* Node.js :
    * https://nodejs.org/
* NPM :
    * https://www.npmjs.com/
* NPM Packages :
    * Dotenv :
        * https://www.npmjs.com/package/dotenv
    * Express :
        * https://expressjs.com/
    * Jest :
        * https://jestjs.io/
    * MySQL2
      * https://www.npmjs.com/package/mysql2
    * Sequelize
        * https://sequelize.org/

### Challenges

The development of this application required the use of several NPM packages, including the installation of Dotenv, Express, MySQL2 and Sequelize.

Using MySQL and Sequelize provided a suitable database to contain the data for the application.  The provided seed files populated the database with sample data and a suitable schema for the application while Sequelize defined the various objects such as tables and other contents within the SQL database.

Developing a API using routing to control how the HTTP requests were processed was a new area of learning and required trial and error and research to understand how to best utilise the various API commands (GET, POST, PUT and DEL) and the associated formatting required to make API calls that had the correct syntax.

Using Insomnia Core to test functionality and develop a working application was also new for me. I built API request tests in Insomnia Core to become familiar around the concepts of planning testing as part of the development process, and to ensure that the API performed as expected when modifying the underlying database.

### Future Development Opportunities

Future development opportunities for the application can be focused primarily on the front end.

Development of a front end web interface using a combination of HTML, CSS and technologies such as Tailwind (a CSS framework) or React would provide a usable design for an E-Commerce based website, allowing for a visual presentation of the data stored within the database.

Development of a user interface would also allow for data to be filtered or displayed in a more targeted way by utilizing data such as category or tag to define the relationships between the data, and then allow for the display of data to be filtered by using these relationships.

Developing the front end interface with a consistent branding experience for the UI and other presentation based artifacts that is aligned to my other applications is also planned, reflecting my professional brand and providing a consistent UI experience across all of my developed applications.

---

## License

This repository is licensed under the MIT license.

---

## Contributing

No contributions at this time.

---

## Questions

If you have any questions, check out my GitHub or email me <a<EMAIL_ADDRESS>
---

**Thank you for visiting.**

---

### Repository Link

* https://github.com/blmccavanagh/E-Commerce-Back-End

---

### Walkthrough Video

*E-Commerce Back End Application Walkthrough Video*

Click here to watch the video!

---

repository: blmccavanagh/E-Commerce-Back-End

repo_name: blmccavanagh/E-Commerce-Back-End


text:
One of our users was nice enough to document the steps they took to create a runbook to set up their Go environments in Windows, and they offered to share this information with the community. We hope this is helpful to our users!

##GO System Administration

###1 GO SERVER
####1.1 PREREQUISITES
   * Java 1.7 64-bit
   * Git for Windows
   * OpenSSL – for SSL certs
   * Minimum system requirements: http://www.go.cd/documentation/user/current/installation/system_requirements.html

####1.2 INSTALL AND INITIAL CONFIGURATION STEPS
   1. Download GO Server setup from http://www.go.cd/download/
   2. Accept default destination setting but choose your own Java and browse to where 64-bit Java is installed (ex: C:\Program Files\Java\jre7).
   3. Upon completion of install, GO server service will automatically start. Open services and stop it.
   4. Open text editor program and place the following two lines in the document:
      ```
      wrapper.java.additional.1=-Xms4g
      wrapper.java.additional.2=-Xmx6g
      ```

     * Note: Xms4g specifies that the minimum memory allocated to Java is 4GBs.
     * Xmx6g specifies that the maximum memory allocated to Java is 6GBs.
   5. Save the file as wrapper-properties.conf in the GO Server config folder.
     * (ex: C:\Program Files (x86)\Go Server\config)
   6. Install custom plugins by copying "*.jar" files to plugins\external folder
     * (ex: C:\Program Files (x86)\Go Server\plugins\external)
   7. Grant modify rights to Domain\GoServerSrvcAccount for the GO server install
     * (ex: C\Program Files (x86)\GO Server)
   8. Open Services and change the Log On account to Domain\GoServerSrvcAccount.
   9. Run Git Credential Manager for Windows installer.
      * Download can be found here: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/download/v0.9-beta.2/Setup.exe
   10. Add Java home to system path variable. (ex: C:\Program Files\Java\jre7\bin).
      * This will make the keytool commands outlined later run.

####1.3 GIT CREDENTIAL MANAGER FOR WINDOWS SETUP
    * Note: The GoAgent and the GoServer BOTH have to be configured to use Git Credential Manager for Windows.
   1. RDP into GO Server box as Domain\GoServerSrvcAccount.
   2. Open Control Panel > User Accounts > Credential Manager.
   3. Add the following to Windows Credential Store- ex: git://https://bitbucket.org, username and password
   4. Open Git Bash window and type git clone *URL* where *URL* is the path to the repo (ex: git clone https://bitbucket.org/somerepo.git)
   5. Clone should start. No prompt for username or password should occur.
   6. Log out of RDP session.

####1.4 FINAL SETUP STEPS
   1. Start the GO Server service.
     * Note: If the services fails to start, review go-serverwrapper.txt found in C:\Program Files (x86)\Go Server
   2. Verify GO Server is online by opening web browser on the server and browse to http://localhost:8153/go
   3. Navigate to Admin menu and specify the site and secure site URL (ex: https://localmachinename:8154/go)
   4. Create default.htm page that redirects to https://localmachinename:8154/go

####1.5 UPGRADE STEPS
    * Important note: If you upgrade the GO Server to a new version, the GO Agents needs to be updated to new version as well.
   1. Login as administration to GO portal and select Backup from Admin menu.
   2. Click the Perform Backup button.
     * Backup folder with today’s date will be created in C:\Program Files (x86)\Go Server\artifacts\serverBackups.
     * Copy folder to safe location.
   3. Download the new version from http://www.go.cd/download/
   4. Run installer. Click yes on prompt asking if you want to continue with the upgrade.
   5. Click through installer.
   6. Wait a few minutes then verify GO Server is online by opening web browser on the server and browse to http://localhost:8153/go.
   7. Scroll all the way to the bottom of the page and verify the Go Version matches the version installed.

####1.6 SSL CERT STEPS
   1. Work with IT department to get .pfx certificate created.
      * (Or create your own. If you create your own, make sure that you make the private key exportable).
      * Whatever names may be associated to the server, should be listed in the alternate names field (ex: machine name, go, go.domain.org)
   2. RDP into GO server and copy .pfx certificate to local folder.
   3. Open an administrator command prompt and type the following command (if your certificate is named Go.domain.org.pfx. IMPORTANT- private key password and keystore password must be serverKeystorepa55w0rd):
      *  `keytool -importkeystore - srckeystore Go.domain.org.pfx -destkeystore keystore -srcstoretype pkcs12 - deststoretype jks -srcstorepass serverKeystorepa55w0rd -deststorepass serverKeystorepa55w0rd -v`
   4. The previous command imports the certificate and private key into the java keystore named keystore.
   5. Stop the GO Server service
   6. Navigate to C:\Program Files (x86)\Go Server\config
   7. Rename keystore to keystore.backup
   8. Copy the keystore from step 3 to C:\Program Files (x86)\Go Server\config
   9. Start Go Server service and verify HTTPS access by going to https://localhost:8154.

###2 GO AGENT
####2.1 PREREQUISITES
   * GO Server
   * Git for Windows
   * Java 1.7 64-bit
   * Minimum system requirements: http://www.go.cd/documentation/user/current/installation/system_requirements.html

####2.2 INSTALL AND INITIAL CONFIGURATION STEPS
   1. Download GO agent setup from http://www.go.cd/download/
   2. Choose destination setting then choose your own Java and browse to where 64-bit Java is installed (ex: C:\Program Files\Java\jre7).
   3. Upon completion of install, GO Agent service will automatically start. Open Services and stop it.
   4. Grant modify rights to Domain\GoAgentSrvcAccount where GO Agent was installed (ex: K:\Go Agent)
   5. Open Services and change the Log On account to Domain\GoServerSrvcAccount.

####2.3 GIT CREDENTIAL MANAGER FOR WINDOWS SETUP
    * Note: The GoAgent and the GoServer BOTH have to be configured to use Git Credential Manager for Windows.
   1. RDP into GO Server box as Domain\GoAgentSrvcAccount account.
   2. Open Control Panel > User Accounts > Credential Manager.
   3. Add the following to Windows Credential Store- ex: git://https://bitbucket.org, username and password
   4. Open Git Bash window and type git clone *URL* where *URL* is the path to the repo (ex: git clone https://bitbucket.org/somerepo.git)
   5. Clone should start. No prompt for username or password should occur.
   6. Log out of RDP session.

####2.4 FINAL SETUP STEPS
   1. Install and configure the applications needed.
     * Example: Visual Studio 2015 Enterprise.
   2. Copy any custom scripts or tools folders to the root drive. Grant Domain\GoAgentSrvcAccount write permissions custom folders.
   3. Start the GO Agent service.
     * Note: If the services fails to start, review go-serverwrapper.txt found in C:\Program Files (x86)\Go Server

####2.5 SSL CERT STEPS
   1. RDP into GO agent and down corporate root .pfx certificate to local folder.
   2. Navigate to Java install location (ex: C:\Program Files\Java\jre7\lib\security) and copy cacerts file.
   3. Run the following command assuming you named the cert companycorp.cer in Step 1: `keytool -import -trustcacerts -alias CompanyCorporateRootCA -file companycorp.cer - keystore cacerts`
   4. Verify cert imported by running following command: `keytool –list –v –keystore cacerts>cacerts.txt`
   5. Search the resulting .txt for CompanyCorporate cert. If found, import succeeded.
   6. This cacerts file can be copied to all other GO agent build boxes. Copy should be placed into source control as well.

####2.6 UPGRADE STEPS
   1. Login as administration to GO portal and select Backup from Admin menu.
   2. Click the Perform Backup button. Backup folder with today’s date will be created in C:\Program Files (x86)\Go Server\artifacts\serverBackups.
     * Copy folder to safe location.
   3. Download the new version from http://www.go.cd/download/
   4. Run installer. Click yes on prompt asking if you want to continue with the upgrade.
   5. Click through installer.
   6. Wait a few minutes then verify GO Server is online by opening web browser on the server and browse to http://localhost:8153/go.
   7. Scroll all the way to the bottom of the page and verify the Go Version matches the version installed.

####2.7 REFERENCES
   * ThoughtWorks documentation
     * http://www.go.cd/2014/06/05/using-go-cd-with-custom-certificates.html
     * http://www.go.cd/documentation/user/current/advanced_usage/admin_install_multiple_agents.html

###3 POSTGRES DB SERVER
####3.1 PREREQUISITES
   * GO Server
   * Minimum system requirements: http://www.postgresql.org/message-id/A1CAC7DD8FA84B0BB16F0636EA957D41@gab
   * Postgres client
   * Ruby – for New Relic PostgreSQL plugin
   * NSSM – for New Relic PostgreSQL plugin

####3.2 INSTALL AND INITIAL CONFIGURATION STEPS
   1. Install Postgres. Make sure to save super user password somewhere secure.
   2. Add C:\Program Files\PostgreSQL\9.3\bin added to path

####3.3 MIGRATE EXISTING GO DATABASE TO POSTGRESQL
   1. Create new database via pgAdmin III by right clicking on Database and selecting New Database.
   2. Provide name of the database and make postgres owner
   3. modify pg_hba.conf file to include details about GO server connecting to postgres
     * ex:(host cruise postgres <IP_ADDRESS>/32 md5)
     * Complete the next steps on the GO server
   4. Install Postgress client
     * (recommended: pgIII - http://www.pgadmin.org/download/windows.php)
   5. Add client to path
     * (ex: C:\Program Files (x86)\pgAdmin III\1.20)
   6. Create backup of database and system.
   7. Stop GO Server service.
   8. Create migration folder
     * (ex: C:\migration)
   9. Copy cruise.h2.db from backup location to migration folder
     * (ex: C:\migration)
   10. Copy GO postgres plugin into migration folder
     * (current version: go-postgresql-15.2.0- 978.jar)
   11. Create subfolder called conf under migration folder
     * (ex: C:\migration\config)
   12. Create file titled "postgresqldb.properties".
     * In this file, place connection details.
     * Example configuration follows:
      ```
      db.host=hostname
      db.port=5432
      db.name=cruise
      db.user=postgres
      db.password=[retracted]
      ```
   13. Navigate to the migration folder and execute the following from administrator command prompt: java -jar go-postgresql-VERSION.jar
     * (ex: java -jar go-postgresql-15.2.0-978.jar)
   14. If this succeeded, you will the following message in the command window: Migration finished successfully
     * Complete the next step on the PostgreSQL server
   15. Verify data was imported into system by opening SQL Editor and run following query: `select * from pipelines`.
     * Data should return
     * Complete the next steps on the GO server
   16. If query from the previous step returned data, copy the postgres.properties from the migration folder to the \Go Server\config folder
     * (ex: C:\Program Files (x86)\Go Server\config)
   17. Create an addons folder and copy the .jar file from step 13 into this new folder
     * (ex: C:\Program Files (x86)\Go Server\addons)
   18. Add an overproperty by adding the following line to wrapper-properties.conf file: `wrapper.java.additional.16=- Dgo.database.provider=com.thoughtworks.go.postgresql.PostgresqlDatabase`
   19. Start GO Server service.
     * Look into the go-server.log and verify [DB]
     * Using connection configuration jdbc:postgresql is found.

####3.4 INSTALL/CONFIGURE POSTGRESQL NEWRELIC PLUGIN
   1. Install Ruby for Windows.
   2. Install this gem: gem install newrelic_postgres_plugin.
   3. Install this gem: gem install bundler.
   4. Create install directory (ex: C:\NewRelicPlugins\Postgres).
   5. Navigate to install directory and run this command: `pg_monitor install -l LICENSE_KEY` (replace LICENSE_KEY with your key value)
   6. Edit the config/newrelic_plugin.yml file generated by adding in your database configuration options.
     * Make host <IP_ADDRESS>
    * Add the following line after license_key: `endpoint: 'http://platform-api.newrelic.com'`
   7. In postgresql.conf file (found under PostgreSQL\9.3\data), uncomment shared_preload_libraries and enter pg_stat_statements between ''
   8. Restart PostgreSQL server. (Restart is required to enable pg_stat_statement shared library)

####3.5 CONFIGURE POSTGRESQL NEWRELIC PLUGIN AS WINDOWS SERVICE
   1. Download and unzip nssm (ex: C:\NSSM)
   2. Add path to environment variables
   3. Open admin command prompt and type nssm install “serviceName” where serviceName is the name of the service
     * (ex: “PostgreSQL Plugin Monitor”)
   4. In the pop-up window, specify C:\Ruby22-x64\bin\pg_monitor.bat as the application, C:\NewRelicPlugins\Postgres as the location to start in, run as an argument and put the serviceName as the display name and description.
   5. Click install. Should say successfully created.
   6. Start newly created service.

####3.6 UPGRADE STEPS
   1. Stop GO Server service
   2. Perform Backup
   3. Download new version of postgresql.VERSION.jar
   4. Archive/remove old postgresql.VERSION.jar and place new .jar
   5. Upgrade GO server. Perform any manual steps.

####3.7 REFERENCES
  * ThoughtWorks Documentation - https://www.thoughtworks.com/go/help/addon_postgres/#configuration


text:
---
layout: book_post
title: Effective Java, 2nd Edition
date: 2018-04-18 05:01
categories:
tags: [book, nonfiction, technical, programming]
author: Joshua Bloch
rating: 3
length_pages: 350
length_loc: 7500
date_started: 2018-02-02
date_finished: 2018-04-12
goodreads_url: "https://www.goodreads.com/book/show/105099.Effective_Java_Programming_Language_Guide"
image: /books/effective-java.jpg
summary: "Very good grab bag of tips and tricks for Java. Many were immediately applicable. Explained at the perfect level of abstraction for me."
---

*TL;DR*: Very good grab bag of tips and tricks for Java. Many were
immediately applicable. Explained at the perfect level of abstraction
for me.

## Notes

Note: skipped over Ch 10 (Concurrency) and Ch 11 (Serialization)

* Looking forward to picking up Core Java after this

### 2: Creating and Destroying Objects

* Avoid memory leaks by nulling out references once they become
  obsolete...but don't do it all the time!

### 3: Methods Common to All Objects

* Override `Object.equals` when a class has a notion of _logical
  equality_ separate from object identity
* Provide programmatic access to all of the information contained in the
  return value of `toString()`
* Override clone judiciously
  * The clone method functions as another constructor; you must ensure
    that it does no harm to the original object and that it properly
    establishes invariants on the clone.

### 4: Classes and Interfaces

* **Minimize the accessibility of classes and members**
  * Well-designed module hides all of its implementation details,
    seaprating API from implementation. Modules communicate with each
    other only through their APIs
  * **Information hiding** or **encapsulation**
  * Do not use public static final array fields in classes. These are
    accessible and mutable.
* To make a class immutable:
  * Don't provide any methods that modify the object's state
  * Ensure that the class can't be extended (make it final)
  * Make all fields final
  * Make all fields private
  * Ensure exclusive access to any mutable components (don't allow
    chained access to them)
* **Classes should be immutable unless there's a very good reason to
  make them mutable.**
* **Favor composition over inheritance**
  * Inheritance violated encapsulation
  * Instead of extending an existing class, give new class a private
    field that references an instance of the existing class (the new
    class is composed of the existing class)
  * If you declare a member class that does not require access to
    enclosing instance, make it static

### 5: Generics

* Class with **type parameters** in declaration is a **generic**
  * Each generic type defines **parameterized types** (`List<String>`)
    and a **raw type** (`List<E>`)
    * Don't use raw types tho. You lose safety and expressiveness
* If you eliminate all warnings, you are assured typesafe code.
* Arrays are not generic
  * Arrays are **covariant**: `Sub[]` is a subtype of `Super[]`.
    Generics are **invariant** (`Sub[]` is not a subtype of `Super[]`)
  * Arrays are **reified**. They know and enforce their types at
    runtime. Generics are **erasure**, check these at compile time.
  * **Non-reifiable type** has a runtime representation with less
    information than compile-time representation.
* Generic methods are safer and easier to use than methods that require
  their clients to cast input parameters and return values.

### 6: Enums and Annotations

* Use enums!!
* Associate a different behavior with each enum constant: declare an
  abstract apply method in the enum type, and override it with a
  concrete method for each constant in a **constant-specific class
  body**:
  * `PLUS { double apply(double x, double y) {return x + y;} }`
* **Prefer annotations to naming patterns**
  * First-class support, better semantics, less brittle
* **Use marker interfaces to define types**
  * Interface with no method declarations that designates a class that
    implements that interface as having some property
  * Use marker annotations if you want to allow for possibility of
    adding more information to marker in the future

### 7: Methods

* Every time you write a method, think about the restrictionos that
  exist on its parameters. Document and enforce these descriptions; the
  work it takes will pay for itself many times over.
  * Use `assert` statements to check parameters in non-public methods
* Defensively copy mutable components that you get or return to clients
  to ensure they aren't messed with.
* Method signatures:
  * **When in doubt, leave it out.**
  * Shorten long parameter lists by creating **helper classes** (e.g.
    Card class instead of suit/value parameters to everything)
  * **Favor interfaces over classes** for parameter types
  * **Prefer two-element enum types to boolean parameters**. They are
    more expressive
* Try not to overload. It's confusing and error-prone.
* JavaDoc comments should be considered mandatory for all exported API
  elements.

### 8: General Programming

* **Minimize the scope of local variables**
* **Know and use the standard libraries**
* **Don't use float/double for money**. Use BigDecimal
* Differences between primitives and boxed primitives:
  * Boxed primitives can be null
  * Primitives are more space-efficient
  * Primitives can only have their values, boxed primitives have
    distinct object identities
    * **Never use == with boxed primitives**
* **Avoid strings where other types are more appropriate**
  * Write a class to represent the aggregate (private static member)
* **Refer to objects by their interfaces** (generalization of Item 40)
  * Much more flexible
  * `List<Subscriber> subscribers = new Vector<Subscriber>();`
* Mantras for optimization:
  * _More computing sins are committed in the name of optimization
    (without necessarily achieving it) than for any other single reason
    -- including blind stupidity._ (Wulf, 72)
  * _We should forget about small inefficiencies, say about 97% of the
    time; premature optimization is the root of all evil._ (Knuth, 74)
  * _Two rules in the matter of optimization: Rule 1. Don't do it. Rule
    2 (for experts only). Don't do it yet -- that is, not until you have
    a perfectly clear and unoptimized solution._ (Jackson, 75)
  * **Strive to write good programs rather than fast ones.**
  * **Strive to avoid design decisions that limit performance.**
* Type parameter names:
  * **T**: arbitrary type
  * **E**: element type of a collection
  * **K**: key type of a map
  * **V**: value type of a map
  * **X**: exception

### 9: Exceptions

* **Use exceptions only for exceptional conditions.**
* **Use checked exceptions for recoverable conditions and runtime
  exceptions for programming errors.**
  * Checked exception: must be caught or declared in the method in which
    it is thrown
  * Make sure checked exception contains enough info for programmer to
    recover
* A **failure atomic** method leaves object in the state it was prior to
  invocation when the method fails. Strive for this.
  * Check parameters for validity before performing operation
* Implement Serializable judiciously; it drastically reduces portability
  and flexibility of the class.


text:
# Scraper
Node.js based scraper using headless chrome

[![version](https://img.shields.io/npm/v/@jonstuebe/scraper.svg?style=flat-square)](https://www.npmjs.com/package/@jonstuebe/scraper) [![dependecies](https://david-dm.org/jonstuebe/scraper.svg)](https://www.npmjs.com/package/@jonstuebe/scraper) [![build](https://travis-ci.org/jonstuebe/scraper.svg?branch=master)](https://www.npmjs.com/package/@jonstuebe/scraper)

## Installation

```bash
$ npm install @jonstuebe/scraper
```

## Features

  * Scrape top ecommerce sites (Amazon, Walmart, Target, BestBuy)
  * Return basic product information (title, price, image, description)
  * Easy to use API

## API
Simply require the package and initialize with a url and pass a callback function to receive the data.

#### es5
```js
const Scraper = require("@jonstuebe/scraper");

// run inside of an async function
(async () => {
  const data = await Scraper.scrapeAndDetect("http://www.amazon.com/gp/product/B00X4WHP5E/");
  console.log(data);
})();
```

#### es6
```js
import Scraper from "@jonstuebe/scraper";

// run inside of an async function
(async () => {
  const data = await Scraper('http://www.amazon.com/gp/product/B00X4WHP5E/');
  console.log(data);
})();
```

#### with promises
```js
import Scraper from "@jonstuebe/scraper";

Scraper('http://www.amazon.com/gp/product/B00X4WHP5E/').then(data => {
  console.log(data)
});
```

#### custom scrapers

```js
const Scraper = require("@jonstuebe/scraper");

(async () => {
  const site = {
    name: "npm",
    hosts: ["www.npmjs.com"],
    scrape: async page => {
      const name = await Scraper.getText("div.content-column > h1 > a", page);
      const version = await Scraper.getText(
        "div.sidebar > ul:nth-child(2) > li:nth-child(2) > strong",
        page
      );
      const author = await Scraper.getText(
        "div.sidebar > ul:nth-child(2) > li.last-publisher > a > span",
        page
      );

      return {
        name,
        version,
        author
      };
    }
  };

  const data = await Scraper.scrape(
    "https://www.npmjs.com/package/lodash",
    site
  );
  console.log(data);
})();

```

## Todos

  * Need to add ability to run a test to see if markup has changed, and if so disable the store selectors and fallback to the generic scraper.

## Contributing
If you want to add any sites, or just have an idea or feature, go ahead and fork [this repo](https://github.com/jonstuebe/scraper/) and send me a pull request. I'll be happy to take a look when I can and get back to you.

## Issues

For any and all issues/bugs, please post a description and code sample to reproduce the problem on the [issues page](https://github.com/jonstuebe/scraper/issues).

## License

  [MIT](LICENSE)

repository: pham/scraper

repo_name: pham/scraper


text:
Name : Irakli Nadareishvili

Email<EMAIL_ADDRESS>
MIME media type name : Application

MIME subtype name : Vendor Tree - vnd.hyper+json

Required parameters : n/a

Optional parameters : n/a

Encoding considerations : binary

Security considerations : Hyper shares security issues common to all JSON
content types. See RFC4627 Section #6
(http://tools.ietf.org/html/rfc4627#section-6) for additional information.
Hyper does not provide executable content. Information contained in
Hyper documents do not require privacy or integrity services.

Interoperability considerations : None

Published specification : http://hyperjson.io/spec.html

Applications which use this media : Various

Fragment identifier considerations :

Hyper follows RFC6901 for implementing URI Fragment Identification standard
to JSON content types.

Restrictions on usage : None

Provisional registration? (standards tree only) :
Registration is for vendor tree

Additional information :

1. Deprecated alias names for this type : n/a
2. Magic number(s) : n/a
3. File extension(s) : .json
4. Macintosh file type code : TEXT
5. Object Identifiers: n/a

Person to contact for further information :

1. Name : Irakli Nadareishvili
2. Email<EMAIL_ADDRESS>
Intended usage : Hyper is a fully-featured hypermedia media type, designed to
serve as the base media type for facilitating conversions between various
hypermedia types as described in the Representor
(https://github.com/the-hypermedia-project/charter#representor-pattern) pattern,
and can also be used as an independent, fully-featured hypermedia type.

Author/Change controller : Irakli Nadareishvili.

repository: dret/hyper

repo_name: dret/hyper


text:
---
title: Deployment Promotion
layout: document
parent: ['Guides', '../../guides.html']
toc: true
---

# Overview

[Deployments](../../docs/topic-concepts/#deployment) in Radix are portable, which makes it possible to use them in several scenarios.

Usually deployments are created by a `build-deploy` [job](../../docs/topic-concepts/#job) and deployed into an [environment](../../docs/topic-concepts/#environment). Older deployments remain accessible under the "Deployments" section of the Web Console.

![Web Console deployments](web-console-deployments.png)

A deployment can be *promoted* into any environment. In effect this creates a new, duplicate deployment, which becomes the *active deployment* in the target environment. The new deployment uses the same component images (Docker images) as the original deployment. The original deployment remains unchanged.

> Careful: Deployments do not encapsulate [environment variables](../../docs/topic-concepts/#environment-variable). When a deployment is promoted from one environment to another, environment variables are read from the **current** settings in `radixconfig.yaml` for the target environment.
>
> The same is true for an old deployment promoted to the same environment: the values of environment variables are those defined in `radixconfig.yaml` at the moment of promotion, not what they were when the original deployment was created.

To promote a deployment you must create a new Job of type `promote`. There are some ways to do this in the Web Console:

- In an environment page, a "promote" button is next to the active deployment
- In the page for a deployment (Deployments → Deployment) there is a "promote" button
- The jobs page has a "new job" button, where "promote" can be selected

# Promote to another environment

Taking the current active deployment from one environment into another is an effective workflow; it can be used as a manual "deploy-to-production" step if you prefer to not map the production environment to a git branch for deployment. The [workflows](../workflows/) guide has an example of how to use this.

# Promote an old deployment/rollback

You can promote an old deployment to become the active deployment within the same environment.

For instance, in case the current active deployment exhibits unwanted behaviour, you can quickly promote a previous deployment to the same environment without rebuilding. Since a new (copied) deployment is created by promotion, the faulty deployment will remain available for promotion (e.g. into another environment for debugging).

The previous deployments of an environment are listed in the respective Web Console's environment page.

Note that if you have a git branch mapped to build and deploy to this environment, Radix will continue to react to new commits and will override the promoted deployment with a new one.

repository: sholaj/radix-platform

repo_name: sholaj/radix-platform


text:
OracleEditor.php
================

![OracleEditor.php screenshot](screenshot_update.jpg)

**OracleEditor.php** is a standalone PHP script which allows you to **browse your Oracle database tables and insert, update and delete rows in any table**. It requires **no installation** and **no configuration**. It's from 2006 but can still be useful.

I wrote it for situations where you quickly need to do some small data manipulation and don’t have a better tool available. OracleEditor.php is free and Open Source. Feel free to contact me with questions/comments specific to this script. For general information on using PHP with Oracle, please refer to the [Oracle Technology Network](http://www.oracle.com/technetwork/topics/php/whatsnew/index.html) or the [PHP manual](http://www.php.net/manual/en/ref.oci8.php).

Disclaimer
----------

Use this software at your own risk. I won’t guarantee that it works, and I won’t be held liable for any damage caused by it! Please make sure to **protect this script with a .htaccess password or the like** - never ever allow public access to it. Anyone capable of guessing your database login will be able to cause severe damage to your database.

Download
--------

Simply download the OracleEditor.php file and copy it on your web server.

Requirements
------------

You need a webserver running PHP 5 or PHP 7 with Session and OCI8 support. OracleEditor.php works fine with the php.ini setting register_globals=off.

Features

* Connects to any Oracle database (local databases, aliases from tnsnames.ora, or complete connection strings)
* Lists all tables and views owned by the user, and those owned by other users where access has been granted
* Simply select a table or view to display (SELECT) its records
* Modify the list of fields to select (optional)
* Add a WHERE clause (optional)
* Records are displayed in sets, allowing you to browse huge tables
* Foreign key values are linked to the master record: Simply click on the value to display the master record
* Fields which are used as foreign keys in other tables have links allowing you to browse all child records with one click
* Last 25 SELECT statements are in the History popup
* Exports your result set as an HTML, XML or CSV file
* UPDATE, DELETE, and INSERT rows in any table
* When updating or inserting, field values can either be strings or function names (allowing you to insert sequencer values, function calls, or NULL)
* String values are sent to Oracle as bound variables, so that you don’t have to escape single quotes
* When inserting, nullable fields are pre-set to NULL so that you know which fields can be left blank
* Optional free SQL statement entry
* Debug mode logs all SQL statements in the PHP error_log
* Oracle error messages are displayed so that you know what went wrong
* Works with register_globals=off, and with both magic_quotes_gpc=on or magic_quotes_gpc=off

repository: tistre/oracleeditor

repo_name: tistre/oracleeditor


text:
---
title: "Bugging Out"
author: glennji
originalDate: Aug 29, 2016 @ 07:09
date: 2016-08-29T07:09:42+10:00
draft: false
type: note
categories: [Bugout]
crosslink: "true"
---
>A bug-out bag is a bag that contains food, tools, and other things for use in a disaster or other type of emergency.  Often times when a disaster occurs, the infrastructure that we normally take for granted becomes bogged down or completely unavailable.  Electricity may be out for days or even weeks, the supermarkets we buy our food and water from may be low or out of stock, hospitals may be extremely over capacity, and even the roads we use everyday may be closed.
> -- from ultimatebugoutbaglist

I'm not at all convinced that there will be an infrastructure-destroying calamity anytime soon, but I do like the idea of a grab-bag (or three) for a weekend away -- whether at a hotel, Airbnb or campsite. Seems like a good idea, to support spontaneous "bug out" and keep us sane during the week. I also like the idea of a few "role-specific" pre-packed bags, ready to go, ensuring I have essentials e.g. on the bike, daily commute, in the car.
These lists are my evolving thoughts around what such "bags" should contain. (Oh, and in case it wasn't obvious by now, I also love lists.)

## Categorising

While browsing some of the many, many "prepper" websites, I came across Grey Wolf - a lot of very sound advice, with decent helpings of practicality and humor - who suggests categorising your "carry" as a way of thinking about it. Here I've taken his general categories and tweaked them for my own brain, just a little. I'll try to make sure each "bag" is organised in this way..

#### Essentials

Water

Food

Shelter

Fire

Comms

#### Survival

Medkit

Navigation/orienteering

Cooking

Tools/Equipment

Light

#### Role-specific

Electronics

Hygiene

Clothing

Money

### The Bags

  - EDC (everyday carry)
  - Get Back Home
  - I'm Never Coming Home (INCH)
  - weekend bugout & beach bag
  - camping
  - motorcycle escape

repository: glennji/website

gha_language: HTML

repo_name: glennji/website


text:
# weather-service
A simple weather service app demo

## Server
Inside the api directory, you can run some built-in commands:

Run API: `./gradlew bootRun or gradlew.bat bootRun`

Run Unit Tests: `./gradlew test`

I create `config`, `controller`, `service`, `model` and `exception` folders in `weatherservice` folder.

1. `config` folder contains file to all request CORS

2. `controller` folder contains file to set api route, handle request and return response. It will call functions in service file.

3. `service` folder contains file to fetch json file and convert them to java object.

4. `model` folder contains all DAO classes.

5. `exception` folder contains files to handle exceptions.

6. Create unit tests for both controller and service.

## Client
Inside the client directory, you can run some built-in commands:

Install all dependencies: `npm install`

Run App: `npm start`

Run Test: `npm test`

Runs the app in development mode. Open http://localhost:3000 to view it in the browser.

1. Create Weather and City two components. Weather is parent view component which uses
City.js as child component to show all city temperature.

2. Using redux to fetch data. Create one action named `loadWeather` which calls backend api to get weather data.
If successful, trigger LOAD_WEATHER and save data in state. If failed, trigger LOAD_WEATHER_FAIL and save error.

3. Weather.js shows weather table if state has weather data. Otherwise, show cannot find data message.

4. Create unit test for Weather component, City component, weather reducer and weather actions.


text:
# REST API

### Clusters Resource

* **GET /clusters**
    * Expected query parameters: *None*
    * Returns a list of all clusters' autoscaling settings and latest events.
* **GET /clusters/logs**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
    * Returns a list of the cluster's latest resize events.
* **POST /clusters**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
        * *minNodes*: Minimum number of nodes. The autoscaler will not try to set the number of nodes below this number.
        * *maxNodes*: Maximum number of nodes. The autoscaler will not try to set the number of nodes above this number.
        * *cpuTarget*: Target CPU utilization. The autoscaler will try to set the number of nodes in order to have this CPU utilization.
        * *enabled* (default=true): Whether to have autoscaling enabled or disabled for the cluster.
        * *storageTarget* (optional): Target storage utilization. The autoscaler will try to set the number of nodes in order to be below this storage utilization.
        * *overloadStep* (optional): In case the cluster is hitting 90% CPU utilization we don't really know how big the resize should be. With this parameter you can set how aggressive the resize step should be in that case. This is an additive factor, not a multiplier to the number of nodes.
        * *extra_enabled_algorithms* (optional): This field is a comma separated class name,
                which should implement the interface Algorithm. This is to inject possible new Algorithm
                strategies for the autoscaler without affecting this open-source project.
    * Adds a Bigtable cluster to be managed by the autoscaler.
* **PUT /clusters**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
        * *minNodes*: Minimum number of nodes. The autoscaler will not try to set the number of nodes below this number.
        * *maxNodes*: Maximum number of nodes. The autoscaler will not try to set the number of nodes above this number.
        * *cpuTarget*: Target CPU utilization. The autoscaler will try to set the number of nodes in order to have this CPU utilization.
        * *enabled* (default=true): Whether to have autoscaling enabled or disabled for the cluster.
        * *storageTarget* (optional): Target storage utilization. The autoscaler will try to set the number of nodes in order to be below this storage utilization.
        * *overloadStep* (optional): In case the cluster is hitting 90% CPU utilization we don't really know how big the resize should be. With this parameter you can set how aggressive the resize step should be in that case. This is an additive factor, not a multiplier to the number of nodes.
        * *extra_enabled_algorithms* (optional): This field is a comma separated class name,
        which should implement the interface Algorithm. This is to inject possible new Algorithm
        strategies for the autoscaler without affecting this open-source project.
    * Updates all of the autoscaler settings for a Bigtable cluster.
* **PUT /clusters/override-min-nodes**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
        * *minNodesOverride*: Overrides the configured `minNodes`. The autoscaler will not allow less than `max(minNodes, minNodesOverride)` nodes.
    * Set the `minNodesOverride` setting for a Bigtable cluster. Intended use is short-lived needs for a substantially higher node minimum than `minNodes`.
* **GET /clusters/enabled**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
    * Returns whether autoscaler is enabled for the given cluster.
* **DELETE /clusters**
    * Expected query parameters:
        * *projectId*: The cluster's Project ID.
        * *instanceId*: The cluster's Instance ID.
        * *clusterId*: The cluster's Cluster ID.
    * Deletes a Bigtable cluster from being managed by the autoscaler.

### Health Resource

* **GET /health**
    * Expected query parameters: *None*
    * Returns *Nothing*
    * Responds with a 5xx HTTP code if the Bigtable autoscaler is not able to autoscale. For example if it can't communicate with the database.

## Security
Vanilla bigtable-autoscaler does not provide any security mechanism. However, you can implement your custom [filter](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/container/ContainerRequestFilter.html) to perform the
desired security checks and [plug it in](README.md#registering-jersey-resources-and-providers-dynamically).

repository: spotify/bigtable-autoscaler

gha_language: Java

repo_name: spotify/bigtable-autoscaler


text:
---
title: Export Numeric Value
page_title: Export Numeric Value
description: Learn how to handle the ElementExporting event in Telerik's {{ site.framework_name }} DataGrid in order to parse an exported value back to a numeric type.
slug: gridview-export-numeric-value
tags: export,string,value
published: True
position: 4
---

# Export Numeric Value

__PROBLEM__

When exporting a RadGridView to Excel using __ExportFormat.ExcelML__, if you have applied a DataFormatString for a certain column of type integer, the values are exported as strings.

__CAUSE__

The content of each cell within the column is treated as string due to the formatting that was applied.

__SOLUTION__

You need to parse the value back to a numeric type by utilizing the __ElementExporting__ event.

Here is a small sample code:

#### __[C#]Example 1: Handling the ElementExporting event:__

{{region cs-gridview-export-troubleshooting-export-string_0}}
	private void clubsGrid_ElementExporting(object sender, GridViewElementExportingEventArgs e)
	{
	    if (e.Element == ExportElement.Cell)
	    {
	        var column = e.Context as GridViewDataColumn;
	        if (column.Header.ToString() == "My String Column")
	        {
	            e.Value = string.Format(@"=T(""{0}"")", e.Value);
	        }
	    }
	}
{{endregion}}

#### __[VB.NET]Example 2: Handling the ElementExporting event:__

{{region vb-gridview-export-troubleshooting-export-string_1}}
	Private Sub clubsGrid_ElementExporting(sender As Object, e As GridViewElementExportingEventArgs)
	    Dim column = TryCast(e.Context, GridViewDataColumn)
	    If e.Element = ExportElement.Cell Then
	        If column.Header.ToString() = "My String Column" Then
	            e.Value = String.Format("=T(""{0}"")", e.Value)
	        End If
	    End If
	End Sub
{{endregion}}

gha_license_id: NOASSERTION