Parameter expansion tokens tokens can be used to inject information about the parameter being processed into the code output stream.
|
Parameter Loop Token |
Description |
|
|
Custom parameter loop expansion tokens allow you to insert content defined by custom expansion tokens defined in a method catalog extensions file. Note that custom expansion token names are not not case sensitive, always being converted to uppercase for comparison, but that the associated values are, being inserted exactly as defined in the extensions file.
|
|
Inserts a Synergy {xfParameter} attribute for the current parameter.
NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak.
|
|
|
Inserts the coercion type associated with the current parameter.
Possible values: None, Boolean, Byte, DateTime, DateTimeNullable, Decimal, DecimalNullable, Double, Float, Int, Long, Sbyte, Short, Uint, Ulong, Ushort
|
|
|
Inserts the collection type of a collection parameter.
Possible values: None, Array, MemoryHandle, ArrayList
|
|
|
The the parameter has an associated comment then this token inserts that text, otherwise nothing is inserted.
|
|
|
Inserts the C# data type that xfNetLink .NET would use to represent the parameter.
|
|
|
Inserts a boolean value indicating whether the current parameter is exposed to .NET clients as a DataTable.
Possible values: True, False
|
|
|
Inserts a string indicating the date format associated with the current date parameter.
Possible values: None, YYYYMMDD, YYMMDD, YYJJJ, YYYYJJJ, HHMM, HHMMSS, YYYYMMDDHHMISS, YYYYMMDDHHMISSUUUUUU
|
|
|
Inserts the parameter data type definition of the current parameter.
Possible values: a<size>, d<size>, d<size>.<precision>, i<size>, [*]a<size>, [*]d<size>, [*]d<size>.<precision>, [*]i<size>, string, D_HANDLE, ENUM_NAME, STRUCTURE_NAME NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak. When specified, structure names will be CamelCased and prefixed with "str". So structure CUSTOMER_ADDRESS will be represented as strCustomerAddress.
|
|
|
Inserts the parameter data type definition of the current parameter, but without any array declaration for array fields.
Possible values: a<size>, d<size>, d<size>.<precision>, i<size>, string, D_HANDLE, ENUM_NAME, STRUCTURE_NAME NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak. When specified, structure names will be CamelCased and prefixed with "str". So structure CUSTOMER_ADDRESS will be represented as strCustomerAddress.
|
|
|
Inserts the data flow direction associated with the current parameter.
Possible values: IN, OUT, INOUT
Alternates: <parameter_direction> |
|
|
Inserts the data flow direction associated with the current parameter. The string output will be right-padded with spaces to a length of 5 characters.
Possible values: IN, OUT, INOUT
Alternate forms: <parameter_direction> |
|
|
If the type of the parameter is defined by an ENUM then this token inserts the name of that ENUM, otherwise nothing is inserted.
|
|
|
Inserts the name of the current parameter.
Alternates: <parameter_name>, <Parameter_Name>, <Parameter_name>, <ParameterName>, <parameterName>
|
|
|
Inserts the 1-based number of the current parameter.
|
|
|
Inserts a string indicating the parameter passing mechanism of the current parameter.
Possible values: DESCRIPTOR, REFERENCE, VALUE
|
|
|
If the parameter type is implied decimal then this token inserts the precision (number of digits after the decimal place) of the parameter, otherwise nothing is inserted.
|
|
|
Inserts a string indicating whether the current parameter is required or optional.
Possible values: OPTIONAL, REQUIRED
Alternates: <parameter_required> |
|
|
Inserts sample date for the parameter. This token is intended to be used for the generation of examples in documentation or API references.
NOTE: This token only currently works with basic field types alpha, decimal, implied decimal, integer and boolean. For other field types nothing is inserted.
Possible Values: "Z", 9, 9.9, "" |
|
|
<PARAMETER_SAMPLE_DATA_ESCAPED>
|
Inserts sample date for the parameter with any double quotes escaped with a backward slash (\). This token is intended to be used for the generation of examples in documentation or API references and is particularly useful when generating data into YAML files.
NOTE: This token only currently works with basic field types alpha, decimal, implied decimal, integer and boolean. For other field types nothing is inserted.
Possible Values: \"Z\", 9, 9.9, \"\" |
|
Inserts the size of the current parameter, if appropriate, or by a blank string if not.
|
|
|
Inserts the name of the STRUCTURE that defines the current parameters type. If the return type is not a structure then a blank string is returned.
Alternates: <parameter_structure>, <Parameter_Structure>, <Parameter_structure>, <ParameterStructure>, <parameterStructure>
NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak. |
|
|
Inserts the name of the STRUCTURE that defines the current parameters type. If the name of the structure does ends with an "S" then it is removed. If the return type is not a structure then a blank string is returned.
Alternates: <parameter_structure_noplural>, <Parameter_Structure_Noplural>, <Parameter_structure_noplural>, <ParameterStructureNoplural>, <parameterStructureNoplural>
NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak. |
|
|
Inserts the name of the STRUCTURE that defines the current parameters type. If the name of the structure does not end with an "S" then one is added. If the return type is not a structure then a blank string is returned.
Alternates: <parameter_structure_plural>, <Parameter_Structure_Plural>, <Parameter_structure_plural>, <ParameterStructurePlural>, <parameterStructurePlural>,
NOTE: The behavior of this token can be altered by the PARAMDEFSTR tweak.
|
|
|
Inserts the TypeScript compatible type of the current parameter.
Possible values: boolean, boolean[], Date, Date[], Nullable<Date>, Nullable<Date>[], number, number[], string, string[], structureName, structureName[]
Structure names will be represented in singular form and in Pascal case.
|
|
|
Inserts the type of the current parameter.
Possible values: Alpha, BinaryHandle, Decimal, ImpliedDecimal, Enumeration, Handle, Integer, String, Structure
|
Copyright © 2021 Synergex International, Inc.


This is a wider card with supporting text below as a natural lead-in to additional content.
This is a wider card with supporting text below as a natural lead-in to additional content.
This is a wider card with supporting text below as a natural lead-in to additional content.
Simply register with any of our training centers, learn fast, gain firsthand experience and be open to job opportunities!


-
Simple API focusing on scalability and low overhead.
-
Reactive and non blocking which able to handle many database connections with a single thread.
-
Ranked #1 in the TechEmpower Benchmark Round 15 Single query benchmark.
Features
-
Event driven
-
Lightweight
-
Built-in connection pooling
-
Prepared queries caching
-
Publish / subscribe using Postgres
LISTEN/NOTIFY
-
Batch and cursor support
-
Row streaming
-
Command pipeling
-
RxJava 1 and RxJava 2 support
-
Direct memory to object without unnecessary copies
-
Java 8 Date and Time support
-
SSL/TLS support
-
HTTP/1.x CONNECT, SOCKS4a or SOCKS5 proxy support
Usage
To use the client, add the following dependency to the dependencies section of your build descriptor:
-
Maven (in your
pom.xml
):
<dependency>
<groupId>com.julienviet</groupId>
<artifactId>reactive-pg-client</artifactId>
<version>0.5.1</version>
</dependency>
-
Gradle (in your
build.gradle
file):
dependencies {
compile 'com.julienviet:reactive-pg-client:0.5.1'
}
Then the code is quite straightforward:
// Pool options
PgPoolOptions options = new PgPoolOptions()
.setPort(5432)
.setHost("the-host")
.setDatabase("the-db")
.setUsername("user")
.setPassword("secret")
.setMaxSize(5);
// Create the client pool
PgPool client = PgClient.pool(options);
// A simple query
client.query("SELECT * FROM users WHERE id='julien'", ar -> {
if (ar.succeeded()) {
PgResult<Row> result = ar.result();
System.out.println("Got " + result.size() + " results ");
} else {
System.out.println("Failure: " + ar.cause().getMessage());
}
// Now close the pool
client.close();
});
Documentations
Supported Data Types
Postgres has two protocols TEXT
and BINARY
to encode/decode data types.
The Reactive Postgres Client currently supports the following data types
| Postgres | Java | TEXT | BINARY |
|---|---|---|---|
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
No |
|
|
Yes |
No |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
Yes |
|
|
Yes |
No |
|
|
Yes |
No |
|
Note
|
The client uses BINARY protocol only for prepared queries PgClient#preparedQuery and PgClient#preparedBatch
|
Snapshots
Snapshots are deploy in Sonatype OSS repository: https://oss.sonatype.org/content/repositories/snapshots/com/julienviet/reactive-pg-client/
License
Apache License - Version 2.0
Publishing docs
-
mvn package -Pdocs
-
cp -r target/docs docs/
-
mv docs/reactive-pg-client docs/guide


ABOUT US
CONSULTING
TRAINING
CONTACT
GET IN TOUCH
NEED EMBER.JS CONSULTING? A TRAINING TO SCHEDULE? JUST WANT TO SAY HULLO? WE'RE LISTENING!
ADDRESS
823 Gervais st. Columbia, SC 29201
Get directions
EMAIL
<EMAIL_ADDRESS>PHONE
803.135.2468
HOW CAN WE HELP?


|
Little Heroes
|
Input field makes it possible to enter custom information within the UI. More...
Public Types | |
| enum | InputType { InputType.Standard, InputType.AutoCorrect, InputType.Password } |
| enum | Validation { Validation.None, Validation.Integer, Validation.Float, Validation.Alphanumeric, Validation.Username, Validation.Name } |
| enum | KeyboardType { KeyboardType.Default = 0, KeyboardType.ASCIICapable = 1, KeyboardType.NumbersAndPunctuation = 2, KeyboardType.URL = 3, KeyboardType.NumberPad = 4, KeyboardType.PhonePad = 5, KeyboardType.NamePhonePad = 6, KeyboardType.EmailAddress = 7 } |
| enum | OnReturnKey { OnReturnKey.Default, OnReturnKey.Submit, OnReturnKey.NewLine } |
Public Member Functions | |
| delegate char | OnValidate (string text, int charIndex, char addedChar) |
| string | Validate (string val) |
| Validate the specified text, returning the validated version. More... | |
| virtual bool | ProcessEvent (Event ev) |
| Handle the specified event. More... | |
| void | Submit () |
| Submit the input field's text. More... | |
| void | UpdateLabel () |
| Update the visual text label. More... | |
| void | RemoveFocus () |
| Convenience function to be used as a callback that will clear the input field's focus. More... | |
| void | SaveValue () |
| Convenience function that can be used as a callback for On Change notification. More... | |
| void | LoadValue () |
| Convenience function that can forcefully reset the input field's value to what was saved earlier. More... | |
Public Attributes | |
| UILabel | label |
| Text label used to display the input's value. More... | |
| InputType | inputType = InputType.Standard |
| Type of data expected by the input field. More... | |
| OnReturnKey | onReturnKey = OnReturnKey.Default |
| What to do when the Return key is pressed on the keyboard. More... | |
| KeyboardType | keyboardType = KeyboardType.Default |
| Keyboard type applies to mobile keyboards that get shown. More... | |
| bool | hideInput = false |
| Whether the input will be hidden on mobile platforms. More... | |
| bool | selectAllTextOnFocus = true |
| Whether all text will be selected when the input field gains focus. More... | |
| Validation | validation = Validation.None |
| What kind of validation to use with the input field's data. More... | |
| int | characterLimit = 0 |
| Maximum number of characters allowed before input no longer works. More... | |
| string | savedAs |
| Field in player prefs used to automatically save the value. More... | |
| Color | activeTextColor = Color.white |
| Color of the label when the input field has focus. More... | |
| Color | caretColor = new Color(1f, 1f, 1f, 0.8f) |
| Color used by the caret symbol. More... | |
| Color | selectionColor = new Color(1f, 223f / 255f, 141f / 255f, 0.5f) |
| Color used by the selection rectangle. More... | |
| List< EventDelegate > | onSubmit = new List<EventDelegate>() |
| Event delegates triggered when the input field submits its data. More... | |
| List< EventDelegate > | onChange = new List<EventDelegate>() |
| Event delegates triggered when the input field's text changes for any reason. More... | |
| OnValidate | onValidate |
| Custom validation callback. More... | |
Static Public Attributes | |
| static UIInput | current |
| Currently active input field. More... | |
| static UIInput | selection |
| Currently selected input field, if any. More... | |
Protected Member Functions | |
| void | Init () |
| Labels used for input shouldn't support rich text. More... | |
| void | SaveToPlayerPrefs (string val) |
| Save the specified value to player prefs. More... | |
| virtual void | OnSelect (bool isSelected) |
| Selection event, sent by the EventSystem. More... | |
| void | OnSelectEvent () |
| Notification of the input field gaining selection. More... | |
| void | OnDeselectEvent () |
| Notification of the input field losing selection. More... | |
| virtual void | Update () |
| Update the text based on input. More... | |
| void | DoBackspace () |
| Perform a backspace operation. More... | |
| virtual void | Insert (string text) |
| Insert the specified text string into the current input value, respecting selection and validation. More... | |
| string | GetLeftText () |
| Get the text to the left of the selection. More... | |
| string | GetRightText () |
| Get the text to the right of the selection. More... | |
| string | GetSelection () |
| Get currently selected text. More... | |
| int | GetCharUnderMouse () |
| Helper function that retrieves the index of the character under the mouse. More... | |
| virtual void | OnPress (bool isPressed) |
| Move the caret on press. More... | |
| virtual void | OnDrag (Vector2 delta) |
| Drag selection. More... | |
| virtual void | Cleanup () |
| Cleanup. More... | |
| void | SetPivotToLeft () |
| Set the label's pivot to the left. More... | |
| void | SetPivotToRight () |
| Set the label's pivot to the right. More... | |
| void | RestoreLabelPivot () |
| Restore the input label's pivot point. More... | |
| char | Validate (string text, int pos, char ch) |
| Validate the specified input. More... | |
| void | ExecuteOnChange () |
| Execute the OnChange callback. More... | |
Protected Attributes | |
| string | mValue |
| Input field's value. More... | |
| string | mDefaultText = "" |
| Color | mDefaultColor = Color.white |
| float | mPosition = 0f |
| bool | mDoInit = true |
| UIWidget.Pivot | mPivot = UIWidget.Pivot.TopLeft |
| bool | mLoadSavedValue = true |
| int | mSelectionStart = 0 |
| int | mSelectionEnd = 0 |
| UITexture | mHighlight = null |
| UITexture | mCaret = null |
| Texture2D | mBlankTex = null |
| float | mNextBlink = 0f |
| float | mLastAlpha = 0f |
| string | mCached = "" |
| int | mSelectMe = -1 |
Static Protected Attributes | |
| static int | mDrawStart = 0 |
| static string | mLastIME = "" |
Properties | |
| string | defaultText [get, set] |
| Default text used by the input's label. More... | |
| bool | inputShouldBeHidden [get] |
| Should the input be hidden? More... | |
| string | text [get, set] |
| string | value [get, set] |
| Input field's current text value. More... | |
| bool | selected [get, set] |
| bool | isSelected [get, set] |
| Whether the input is currently selected. More... | |
| int | cursorPosition [get, set] |
| Current position of the cursor. More... | |
| int | selectionStart [get, set] |
| Index of the character where selection begins. More... | |
| int | selectionEnd [get, set] |
| Index of the character where selection ends. More... | |
| UITexture | caret [get] |
| Caret, in case it's needed. More... | |
Input field makes it possible to enter custom information within the UI.
| enum UIInput.InputType |
| enum UIInput.KeyboardType |
| enum UIInput.OnReturnKey |
| enum UIInput.Validation |
|
protectedvirtual |
Cleanup.
|
protected |
Perform a backspace operation.
|
protected |
Execute the OnChange callback.
|
protected |
Helper function that retrieves the index of the character under the mouse.
|
protected |
Get the text to the left of the selection.
|
protected |
Get the text to the right of the selection.
|
protected |
Get currently selected text.
|
protected |
Labels used for input shouldn't support rich text.
|
protectedvirtual |
Insert the specified text string into the current input value, respecting selection and validation.
| void UIInput.LoadValue | ( | ) |
Convenience function that can forcefully reset the input field's value to what was saved earlier.
|
protected |
Notification of the input field losing selection.
|
protectedvirtual |
Drag selection.
|
protectedvirtual |
Move the caret on press.
|
protectedvirtual |
Selection event, sent by the EventSystem.
|
protected |
Notification of the input field gaining selection.
| delegate char UIInput.OnValidate | ( | string | text, |
| int | charIndex, | ||
| char | addedChar | ||
| ) |
|
virtual |
Handle the specified event.
| void UIInput.RemoveFocus | ( | ) |
Convenience function to be used as a callback that will clear the input field's focus.
|
protected |
Restore the input label's pivot point.
|
protected |
Save the specified value to player prefs.
| void UIInput.SaveValue | ( | ) |
Convenience function that can be used as a callback for On Change notification.
|
protected |
Set the label's pivot to the left.
|
protected |
Set the label's pivot to the right.
| void UIInput.Submit | ( | ) |
Submit the input field's text.
|
protectedvirtual |
Update the text based on input.
| void UIInput.UpdateLabel | ( | ) |
Update the visual text label.
| string UIInput.Validate | ( | string | val | ) |
Validate the specified text, returning the validated version.
|
protected |
Validate the specified input.
| Color UIInput.activeTextColor = Color.white |
Color of the label when the input field has focus.
| Color UIInput.caretColor = new Color(1f, 1f, 1f, 0.8f) |
Color used by the caret symbol.
| int UIInput.characterLimit = 0 |
Maximum number of characters allowed before input no longer works.
|
static |
Currently active input field.
Only valid during callbacks.
| bool UIInput.hideInput = false |
Whether the input will be hidden on mobile platforms.
| InputType UIInput.inputType = InputType.Standard |
Type of data expected by the input field.
| KeyboardType UIInput.keyboardType = KeyboardType.Default |
Keyboard type applies to mobile keyboards that get shown.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Input field's value.
| List<EventDelegate> UIInput.onChange = new List<EventDelegate>() |
Event delegates triggered when the input field's text changes for any reason.
| OnReturnKey UIInput.onReturnKey = OnReturnKey.Default |
What to do when the Return key is pressed on the keyboard.
| List<EventDelegate> UIInput.onSubmit = new List<EventDelegate>() |
Event delegates triggered when the input field submits its data.
| OnValidate UIInput.onValidate |
Custom validation callback.
| string UIInput.savedAs |
Field in player prefs used to automatically save the value.
| bool UIInput.selectAllTextOnFocus = true |
Whether all text will be selected when the input field gains focus.
|
static |
Currently selected input field, if any.
| Color UIInput.selectionColor = new Color(1f, 223f / 255f, 141f / 255f, 0.5f) |
Color used by the selection rectangle.
| Validation UIInput.validation = Validation.None |
What kind of validation to use with the input field's data.
|
get |
Caret, in case it's needed.
|
getset |
Current position of the cursor.
|
getset |
Default text used by the input's label.
|
get |
Should the input be hidden?
|
getset |
Whether the input is currently selected.
|
getset |
|
getset |
Index of the character where selection ends.
|
getset |
Index of the character where selection begins.
|
getset |
|
getset |
Input field's current text value.


Calculator for weighted means
Add entry
Import
Export
Label
Weight
Value
Actions
{{entry.label || 'empty'}}
{{entry.weight}}
{{entry.value}}
Enable
Disable
Delete
No data found.
Results
Sum of weights: {{dataset.sumOfWeights()}}
Sum of weighted values: {{dataset.sumOfWeightedValues()}}
Weigthed average: {{dataset.weightedMean()}}


As an extension to the Full Lighting Integrator,
R3 can handle scenes with homogenous volumes.
Ray marching was the primary technique used to solve
for the volume in the scene. I detailed more about
my implementation on my blog.
Handles the three set operations, intersection, union, and subtraction.
You can read more about my implementation here.
WolframAlpha
provides a lot of different equations that produce solid geometries.
Ray marching was used to find the intersections of the solids. Given a point on the ray,
we can plug in the (x, y, z) values into the equation for the solid. If the equation
evaluates to 0, or whatever was specified for the shape, the intersection test returns
true and the point gets rendered.
You can read more about my implementation here.


All Files (67.74% covered at 0.82 hits/line)
28 files in total.
186 relevant lines.
126 lines covered and
60 lines missed
- 1
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
- 1
protect_from_forgery with: :exception
- 1
include SessionHelper
end
- 1
class RantsController < ApplicationController
- 1
def index #get all rants
@rants = Rant.all.to_a.sort_by(&:vote_count).reverse
end
- 1
def show #get particular rant
- 7
@rant = Rant.find(params[:id])
- 7
@responses = @rant.responses[0..-1].sort_by(&:id)
- 7
@response = @rant.responses.build
end
- 1
def new #get page to create new rant
@rant = Rant.new
end
- 1
def create #post new rant and redirect to show
@rant = Rant.new(rant_params)
if session[:user_id]
@rant.user = User.find(session[:user_id])
end
if @rant.save
@response = Response.new
render :show
else
@errors = @rant.errors.full_messages
redirect_to action: 'create'
end
end
- 1
def edit #get edit page
@rant = Rant.find(params[:id])
unless session[:user_id] == @rant.user_id
redirect_to action: 'show'
end
end
- 1
def update #put edits and redirects to show
rant = Rant.find(params[:id]) #make form have a hidden field ID!
rant.update(rant_params)
rant.save
redirect_to action: 'show'
end
- 1
def up_vote
up_rant = Rant.find(params[:id])
up_rant.vote_count += 1
if up_rant.save
respond_to do |format|
format.html
format.json { render :json => { vote_count: up_rant.vote_count }}
end
end
end
- 1
def down_vote
down_rant = Rant.find(params[:id])
down_rant.vote_count -= 1
if down_rant.save
respond_to do |format|
format.html
format.json { render :json => { vote_count: down_rant.vote_count }}
end
end
end
- 1
def destroy #delete goes to index
Rant.destroy(params[:id])
redirect_to action: 'index'
end
- 1
private
- 1
def rant_params
params.require(:rant).permit(:title, :body)
end
end
- 1
class ResponsesController < ApplicationController
- 1
before_filter :load_rant, :load_response
- 1
def create
@response = @rant.responses.build(response_param)
if @response.save
redirect_to rant_url(@rant)
else
render text: "Response body cannot be blank", :status => :unprocessable_entity
end
end
- 1
def edit
- 1
render :partial => 'form', :locals => { rant: @rant, response: @response }
end
- 1
def update
- 1
if @response.update_attributes(response_param)
- 1
redirect_to rant_url(@rant)
end
end
- 1
def up_vote
- 1
@response.vote_count += 1
- 1
@response.save
- 1
redirect_to rant_path(@rant)
end
- 1
def down_vote
@response.vote_count -= 1
@response.save
redirect_to rant_path(@rant)
end
- 1
private
- 1
def response_param
- 1
params.require(:response).permit!
end
- 1
def load_rant
- 5
@rant = Rant.find(params[:rant_id])
end
- 1
def load_response
- 5
@response = Response.find(params[:id])
end
end
- 1
module ApplicationHelper
- 1
def current_user
return nil if session[:user_id].nil?
return User.find(session[:user_id])
end
end
- 1
module RantHelper
end
- 1
module RantsHelper
end
- 1
module ResponseHelper
end
- 1
module SessionHelper
- 1
def sign_in(user)
session[:user_id] = user.id
self.current_user = user
end
- 1
def signed_in?
!current_user.nil?
end
- 1
def current_user=(user)
@current_user = user
end
- 1
def current_user
- 7
@current_user ||= User.find_by(id: session[:user_id])
end
- 1
def sign_out
session.clear
self.current_user = nil
end
- 1
def signed_in_user
unless signed_in?
flash[:notice] = "Please sign in."
redirect_to signin_url
end
end
end
- 1
module UserHelper
end
- 1
class Rant < ActiveRecord::Base
- 1
validates :title, :presence => true
- 1
validates :body, :presence => true
- 1
has_many :responses
- 1
belongs_to :user
end
- 1
class Response < ActiveRecord::Base
- 1
validates :body, :presence => true
- 1
belongs_to :rant
- 1
belongs_to :user
end
- 1
class User < ActiveRecord::Base
- 1
validates :email, presence: true,
uniqueness: true,
format: { with<EMAIL_ADDRESS>message: "must be a valid email"}
- 1
validates :password, :presence => true
- 1
has_many :rants
- 1
has_many :responses
- 1
def self.authenticate(email, password)
this_user = User.where(email: email).first
return nil if this_user.nil?
if this_user.password == password
return this_user
else
return nil
end
end
end
- 1
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
- 1
require "active_model/railtie"
- 1
require "active_record/railtie"
- 1
require "action_controller/railtie"
- 1
require "action_mailer/railtie"
- 1
require "action_view/railtie"
- 1
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
- 1
Bundler.require(*Rails.groups)
- 1
module RantOverflow
- 1
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
# Set up gems listed in the Gemfile.
- 1
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
- 1
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
# Load the Rails application.
- 1
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
- 1
Rails.application.initialize!
- 1
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
- 1
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
- 1
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
- 1
config.serve_static_assets = true
- 1
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
- 1
config.consider_all_requests_local = true
- 1
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
- 1
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
- 1
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
- 1
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
- 1
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
- 1
Rails.application.config.action_dispatch.cookies_serializer = :json
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
- 1
Rails.application.config.filter_parameters += [:password]
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Be sure to restart your server when you modify this file.
- 1
Rails.application.config.session_store :cookie_store, key: '_rant-overflow_session'
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
- 1
ActiveSupport.on_load(:action_controller) do
- 1
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
- 1
Rails.application.routes.draw do
- 1
root :to => 'rants#index'
- 1
resources :users
- 1
resources :rants do
- 1
resources :responses
end
#=============================================
# User Custom Routes
- 1
get 'sign-up', to: 'users#new'
- 1
get 'login', to: 'sessions#new'
- 1
get 'logout', to: 'sessions#destroy'
- 1
get 'profile', to: 'users#profile', as: 'user_profile'
- 1
resources :sessions, only: [:new, :create, :destroy]
# /User
#---------------------------------------------
#=============================================
# Rant Custom Routes
- 1
post 'rants/up_vote', to: 'rants#up_vote'
- 1
post 'rants/down_vote', to: 'rants#down_vote'
# /Rant
#---------------------------------------------
#=============================================
# Response Custom Routes
- 1
post 'responses/up_vote', to: 'responses#up_vote'
- 1
post 'responses/down_vote', to: 'responses#down_vote'
# /Response
#---------------------------------------------
end
- 1
FactoryGirl.define do
- 1
factory :rant do
- 1
title Faker::Lorem.word
- 1
body Faker::Lorem.sentence
end
end
- 1
FactoryGirl.define do
- 1
factory :response do
- 1
body Faker::Lorem.words
end
end
- 1
FactoryGirl.define do
- 1
factory :user do
- 1
email Faker::Internet.email
- 1
password Faker::Name.name
end
end
- 1
module CapybaraHelpers
- 1
def wait_for_ajax_to_finish
page.document.synchronize do
raise AjaxStillWorking unless page.evaluate_script('jQuery.active == 0')
end
end
- 1
def sign_in_user
visit new_session_path
fill_in "Email", with: user.email
fill_in "Password", with: user.password
click_button "Sign In"
end
end
- 1
class AjaxStillWorking < Capybara::ElementNotFound;end


Page Header
Item 1
Item 2
Item 3
Content 1
Content 2
Content 3
Content 1
Content 2
Content 3
Title of My Content
Here is some
text.
Title of My Content
Name
Age
Hair Color
Chris
23
Brown
Ganesh
23
Black
Person Count: 2
First Name:
Breathing Person:
Highest Education Achieved
BS
MS
PhD
Favorite Sports Team
Chennai Super Kings
Manchester United
Green Bay Packers
Bio
Send


Artists
So while browsing Twitter I see more and more tweets about artists wanting some credit for their work in one way or another. Even though I’m far from an artist, I can totally understand that. But it’s still a matter of how much.
Most democratic countries protect their artists by giving them the right to decide what happens to their works. They own their work and as such can decide who can use it and who doesn’t. However, this has its limits. Since others have the right to modify works of others to create their own kind of work.
It gets even more messy if someone directly uses their work. If you use someone’s work commercially, you should of course ask them and if neccessary offer some sort of payment, that goes without saying. Also put their name on it to let others know. Simple enough, but that’s easy to forget.
But the real problem is if you like an art and kinda want to “keep” it. Say you see it on any of the dozens social media sites or a site specifically for artists. Sure you can probably like it and keep it in mind. You can share it with others by reblogging it usually. But say you find it on Google without source, then what? The easiest way is to save it on your computer. That way you can categorize it how you want and it’s easy to find through folder structures, names or tags. Later if say you have the urge to show it to others, you can easily access it. The main problem here is, that the artist won’t see much reward. The only thing he receives by this process is advertisement. That however is pretty important if you ask me.
I understand that artists want some sort of payment for their works, but that’s pretty difficult in and on itself. Realistically speaking it’s pretty much impossible to restrict to not use one’s work freely. If you upload a picture on the internet, it’s there and easy for everyone to access. Even if you kinda protect it so others can’t download it directly, there’s probably always a simple way around it. It’s also problematic for others to go back to your works if they can only like and reblog it. It’s not like every artist uses the same website. And as users seperate from certain websites after a while, they easily forget. Say someone wants to dig up a picture on the internet but forgot where he found it. Sure he can dig through 10 sites before he found the correct one. But if he saved it, that’d be way easier. That probably sounds harsh from an artist’s perspective, but I think that’s how it is realistically speaking.
Other personal use is pretty diffcult too. In Germany for example, it’s technically legal to download and watch movies. It’s kinda a grey zone, but still not made illegal as far as I know. You can also watch it with friends. You just can’t stream it publically or commercially. So technically it’d be perfectly legal to use any work of art from the internet as a wallpaper for your home. The only thing artists can do is ask others for some kind of compensation. I don’t know how this changes for the digital appearence of someone through the use of works of others. I think it’s more in the artist’s hand then.
In my opinion the best solutions for now are still signatures on the pictures or on the file itself. I don’t even know if the later one is possible, but it’d be nice.
It’s really a difficult topic for me, because I rarely think about it. Even now it was hard to get my thoughts in order. There’s so much to think about first. Like the technical limitations or different rights for people. Musicians already have spotify to profit from the fast internet and its impulsive users. Unlike other artists who can only hope to get money for their works through donations like patreon. (Wait, did I just find a market gap?)
Lastly dear artists, keep in mind that sharing is also some kind of advertisement. Companies pay money for that and the fast moving and free to use social media sites are more a joy to small artists. If your skills are good, this is exactly what you need to gather fans.


Consider, if .
Now, prove that .
It is provided that
The above equation states that is divisible by . It can be represented as follows:
There exists some integer where is said to be the quotient such that,
From the above statement, it concludes that divides.
It is provided that and are relatively prime. So, cannot divides . That is,
Therefore, divides
Hence, the equation whenever is proved.
The counter example to prove is necessary and it is provided as follows:
Assume that and .
Now, calculate the greatest common divisor of and as below:
It is known that 2 is greater than 1 and it satisfies that the given condition.
Put the value of and n in equation.
Therefore,
It can be said that, divides that is .
Now, from the property of division and GCD, divides and also divides which will be depend on the value of which may be true or not.
But if , then must divides.
Therefore, it is necessary that for to imply.
Hence given statement is proved.
The procedure MODULAR–LINEAR–EQUATION–SOLVER (a, b, n) is used to solve the modular linear equation. Refer chapter 31, section 31.4 of the text book for the complete algorithm.
Consider the line 3 of the procedure MODULAR–LINEAR–EQUATION–SOLVER (a, b, n) is replaced with the following line:
3
The procedure MODULAR–LINEAR–EQUATION–SOLVER(a, b, n) still works even if the line 3 is replaced with the above line.
The for loop in line 5 helps in maintaining the consistency of the procedure. It will neutralize the effect of changing the line 3 and iterate till the required solution. The iterative step finds the actual solution.
For example, consider the following equation:
The procedure MODULAR–LINEAR–EQUATION–SOLVER(10, 35, 50) will generate the numbers 46, 6, 16, 26, 36 as output, before replacing the line 3.
Now, consider the procedure MODULAR–LINEAR–EQUATION–SOLVER(10, 35, 50) after replacing the line 3.
The procedure EXTENDED–EUCLID (50, 35) in line 1 returns 5, -2, and 3 and they will be stored in respectively. That is, .
The value of in line 3 is calculated as follows:
The for loop in line 4 iterates 5 times from . It computes and prints the value of .
The calculations are performed and output is generated as follows:
Hence, the procedure after replacing line 3 in the procedure MODULAR–LINEAR–EQUATION–SOLVER(10, 35, 50) generates 6, 16, 26, 36, 46 as output.
Therefore, the output generated by the procedure before and after replacing the line 3 is the same.
Polynomial congruence:
Consideris prime and a polynomial of degree t. The polynomial is given below:
The coefficients is obtained from the and satisfies the condition is equal to zero of if.
Consider p is not a prime.
Then the prime factorization of p is possible. The polynomial should be solved for following cases:
In the cases given above, are the factors of prime numbers and represents their respective powers. Suppose the value of p is 175, then the factors will be 5, 5 and 7. This leads to finding solutions for 5, 7 and 25.
Now prove that if a is a zero of f , then
for some polynomial of degree .
Since a is a zero of f
.
also,
.
Calculate .
also,
Thus,
where
That is, is a polynomial of degree .
Now, use mathematical induction on t.
Base step:
Consider , then polynomial will be of the following form:
.
To find the solution of above polynomial of degree one, use
Since p is a prime, . It is because only 1 will be single number which is a multiple of f1 and p.
If , then the linear congruence always has a unique solution, otherwise the number of solutions are determined with the use of g|b for equation , where g is gcd(a, n).
Hence, the result holds for .
Assumption step:
Assume that this result is true for the polynomial of degree t – 1.
Induction step:
Now use the above result for t – 1 to prove this result for polynomial of degree t.
The following congruence either has no solution or at least one solution.
If it has no solution then there is nothing to prove.
From the above result, if a is a zero of f , then
for some polynomial of degree .
If b is another solution out of the incongruent solutions of , then
Since b is incongruent to a.
So,
Thus, any solution of which is different from a also satisfy
where g(x) is a polynomial of degree t – 1
By assumption, the polynomial of degree t – 1 has at most t – 1 incongruent solution.
So, the congruence has at most t – 1 incongruent solution.
Hence, the congruence has at most n incongruent solutions.
Therefore, if p is prime, then a polynomial of degree t can have at most t distinct zeros modulo p.