Virtual Acoustics
Binaural Audio
Binaural audio places virtual sounds in three dimensions using two-channel sound
systems such as headphones. To produce virtual sounds
around a listener's head, we can record sounds
with microphones placed in the left and right ears of a
head and then play back the recording through headphones. However, this approach limits
the binauralization to the particular head and environment used in the recording. Alternatively,
we can determine how sound is filtered by a certain head and then apply that
filter to an audio signal. This filter is known as the head-related transfer function
(HRTF), and it can be used to binauralize sound in any environment.
An HRTF can be measured in a lab or simulated on a computer. Although lab measurements can
produce accurate HRTFs, they are costly to perform. Computer simulations, on the other hand,
are much less expensive. In my research, I focus on improving volumetric HRTF simulations.
Of particular interest are differential geometric methods that accurately and efficiently
model open and closed boundaries encountered in volumetric HRTF simulations. In the image below,
I used a novel geometric method to model open boundaries in an HRTF simulation.
Artificial Reverberation
Artificial reverberation incorporates the sound properties of
a physical space—such as a concert hall, an amphitheater, or an outdoor environment—into an audio signal. To incorporate
these sound properties into an audio signal, we can convolve the signal with the impulse response
of the physical space. In my research, I build volumetric simulations of reverberant environments that
accurately and efficiently compute the impulse response of any space. Specifically, a focus of my PhD research
is on improving boundary condition modeling in these simulations using novel geometric methods. The plots below demonstrate a
geometric technique I developed to model open boundaries in physical spaces with embedded obstacles.


Learn from your home office
We believe that analysis of your company and your customers is key in responding effectively to your promotional needs and we will work with you to fully understand your business.
Check out the libraryLearning made easy via the internet Start today
We believe that analysis of your company and your customers is key in responding effectively to your promotional needs and we will work with you to fully understand your business.
Check out the libraryAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur.
Check out our webappWe believe that analysis of your company and your customers is key in responding effectively to your promotional needs and we will work with you to fully understand your business.
Check out the dashboardAt vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur.
Go to your portalWe are 51,031 creative teachers so far
“This platform is the best idea to teach young people without loosing any time.”
Nicole Kidman (actress)
“Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.”
Leland Orser (actor)
“Curabitur et ligula. Ut molestie a, ultricies porta urna.Lorem ipsum dolor sit amet enim. Etiam ullamcorper.”
Henry Cavill (actor)
“Maecenas malesuada elit lectus felis, malesuada ultricies. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor.”
Andres Gertrudix (actor)
“Ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies.”
Justin Biber (singer)
Customize your tutorials online base
We believe that analysis of your company and your customers is key in responding effectively to your promotional needs and we will work with you to fully understand your business.


class Bundler::RubygemsIntegration::MoreFuture
RubyGems 2.1.0
Public Class Methods
new()
click to toggle source
Calls superclass method
Bundler::RubygemsIntegration.new
# File lib/bundler/rubygems_integration.rb, line 803 def initialize super backport_ext_builder_monitor end
Public Instance Methods
all_specs()
click to toggle source
# File lib/bundler/rubygems_integration.rb, line 808 def all_specs require "bundler/remote_specification" Gem::Specification.stubs.map do |stub| StubSpecification.from_stub(stub) end end
backport_ext_builder_monitor()
click to toggle source
# File lib/bundler/rubygems_integration.rb, line 815 def backport_ext_builder_monitor # So we can avoid requiring "rubygems/ext" in its entirety Gem.module_eval " module Ext end ", __FILE__, __LINE__ + 1 require "rubygems/ext/builder" Gem::Ext::Builder.class_eval do unless const_defined?(:CHDIR_MONITOR) const_set(:CHDIR_MONITOR, EXT_LOCK) end remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX) const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR)) end end
binstubs_call_gem?()
click to toggle source
RubyGems-generated binstubs call Kernel#gem
# File lib/bundler/rubygems_integration.rb, line 857 def binstubs_call_gem? false end
find_name(name)
click to toggle source
# File lib/bundler/rubygems_integration.rb, line 835 def find_name(name) Gem::Specification.stubs_for(name).map(&:to_spec) end
stubs_provide_full_functionality?()
click to toggle source
only 2.5.2+ has all of the stub methods we want to use, and since this is a performance optimization only, we'll restrict ourselves to the most recent RG versions instead of all versions that have stubs
# File lib/bundler/rubygems_integration.rb, line 865 def stubs_provide_full_functionality? true end
use_gemdeps(gemfile)
click to toggle source
# File lib/bundler/rubygems_integration.rb, line 846 def use_gemdeps(gemfile) ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile) require "bundler/gemdeps" runtime = Bundler.setup Bundler.ui = nil activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name) [Gemdeps.new(runtime), activated_spec_names] end


Resume | GitHub | Linkedln | Blogs
Python and Blockchain Developer based in India Currently working on DCS-BBN


Hello!
We are very pleased to invite you to a the beta release for the new ReQLPro app! Thank you for one of our first users.
To download the app and get started, click the link below:
Please note that this app is under active development! We do expect things to break and with your feedback we'll be working hard to fix bugs, implement new features, and make design improvements.
For these early versions, good things to test are:
We look forward to hearing about your experience with the new app. As you find problems or bugs, please use the menu items within the app to send us any feedback!
Thank you!
Code Hangar - ReQLPro Team


Pmw.EntryField() - entry widget with validation
An entry field contains an entry widget with optional validation of various kinds. Built-in validation may be used, such as integer, real, time or date, or an external validation function may be supplied. If valid text is entered, it will be displayed with the normal background. If invalid text is entered, it is not displayed and the previously displayed text is restored. If partially valid text is entered, it will be displayed with a background color to indicate it is in error. An example of partially valid real text is '-.', which may be the first two charactes of the valid string '-.5'. Some validators, such as date, have a relaxed interpretation of partial validity, which allows the user flexibility in how they enter the text.
Validation is performed early, at each keystroke or other event which modifies the text. However, if partially valid text is permitted, the validity of the entered text can be checked just before it is to be used, which is a form of late validation.
Minimum and maximum values may be specified. Some validators also accept other specifications, such as date and time formats and separators.
Validation is performed by a function which takes as its first argument the entered text and returns one of three standard values, indicating whether the text is valid:
invoke()
is called. The default is None.
The validate_function is used to implement the validation and the stringtovalue_function is used to convert the entry input into a value which can be compared with the minimum and maximum limits. These functions are as described for the validate option.
If either of these is not given as a function, it is assumed to be the name of one of the other extra validators or one of the standard validators. The alias search is performed when the validate option is configured, not when the extravalidators option is configured or when the validate function is called.
If the name of one of the extra validators is the same as one of the standard validators, the extra validator takes precedence. The default is {}.
setentry()
. The default
is self.bell.
If None, a label component is not created. The default is None.
setentry()
. The default is None.
The most general way to specify the validate option is as a dictionary. The kind of validation is specified by the 'validator' dictionary field, which may be the name of one of the standard validators described below, the name of a validator supplied by the extravalidators option, a function or None. The default is None.
Any other dictionary fields specify other restrictions on the entered values. For all validators, the following fields may be specified:
If the dictionary contains a 'stringtovalue' field, it overrides the normal stringtovalue function for the validator. The stringtovalue function is described below.
Other fields in the dictionary (apart from the core fields mentioned above) are passed on to the validator and stringtovalue functions as keyword arguments.
If validate is not a dictionary, then it is equivalent to
specifying it as a dictionary with a single 'validator' field.
For example, validate = 'real'
is equivalent to /validate =
{'validator' : 'real'}/ and specifies real numbers without any
minimum or maximum limits and using '.' as the decimal point
character.
The standard validators accepted in the 'validator' field are:
string.atol()
.
string.atol(text, 16)
.
string.atof()
. This
validator accepts a 'separator' argument, which specifies
the character used to represent the decimal point. The
default 'separator' is '.'.
Pmw.timestringtoseconds()
.
This validator accepts a 'separator' argument, which
specifies the character used to separate the three fields.
The default separator is ':'. The time may be negative.
Pmw.datestringtojdn()
. This validator accepts a
'separator' argument, which specifies the character used to
separate the three fields. The default is ':'. This
validator also accepts a 'format' argument, which is passed to
Pmw.datestringtojdn()
to specify the desired ordering of the
fields. The default is 'ymd'.
If 'validator' is a function, then it will be called whenever
the contents of the entry may have changed due to user action or
by a call to setentry()
. The function is called with at least
one argument, the first one being the new text as modified by the
user or setentry()
. The other arguments are keyword arguments
made up of the non-core fields of the validate dictionary.
The validator function should return Pmw.OK, Pmw.ERROR or Pmw.PARTIAL as described above. It should not perform minimum and maximum checking. This is done after the call, if it returns Pmw.OK.
The 'stringtovalue' field in the dictionary may be specified as the name of one of the standard validators, the name of a validator supplied by the extravalidators option, a function or None.
The stringtovalue function is used to convert the entry input
into a value which can then be compared with any minimum or
maximum values specified for the validator. If the 'min' or
'max' fields are specified as strings, they are converted using
the stringtovalue function. The stringtovalue function is
called with the same arguments as the validator function. The
stringtovalue function for the standard number validators
convert the string to a number. Those for the standard alpha
validators return the length of the string. Those for the
standard 'time' and 'date' validators return the number of
seconds and the Julian Day Number, respectively. See
Pmw.stringtoreal()
, Pmw.timestringtoseconds()
and
Pmw.datestringtojdn()
.
If the validator has been specified as a function and no
'stringtovalue' field is given, then it defaults to the standard
python len()
function.
If 'validator' is None, no validation is performed. However, minimum and maximum checking may be performed, according to the stringtovalue function. For example, to limit the entry text to a maximum of five characters:
Pmw.EntryField(validate = {'max' : 5})
The validator functions for each of the standard validators can be accessed as:
Pmw.numericvalidator Pmw.integervalidator Pmw.hexadecimalvalidator Pmw.realvalidator Pmw.alphabeticvalidator Pmw.alphanumericvalidator Pmw.timevalidator Pmw.datevalidator
Whenever the validate option is configured, the text currently displayed in the entry widget is revalidated. If it is not valid, the errorbackground color is set and the invalidcommand function is called. However, the displayed text is not modified.
The default for validate is None.
set()
method of the variable is called. If this
is not done in this case, the entry widget background will not be
set correctly.
setentry('')
.
setvalue()
method.
class Demo: def __init__(self, parent): # Create and pack the EntryFields. self._any = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Any:', validate = None, command = self.execute) self._real = Pmw.EntryField(parent, labelpos = 'w', value = '55.5', label_text = 'Real (10.0 to 99.0):', validate = {'validator' : 'real', 'min' : 10, 'max' : 99, 'minstrict' : 0}, modifiedcommand = self.changed) self._odd = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Odd length:', validate = self.custom_validate, value = 'ABC') self._date = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Date (in 2000):', value = '2000/2/29', validate = {'validator' : 'date', 'min' : '2000/1/1', 'max' : '2000/12/31', 'minstrict' : 0, 'maxstrict' : 0, 'format' : 'ymd'}, ) now = time.localtime(time.time()) self._date2 = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Date (d.m.y):', value = '%d.%d.%d' % (now[2], now[1], now[0]), validate = {'validator' : 'date', 'format' : 'dmy', 'separator' : '.'}, ) self._time = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Time (24hr clock):', value = '8:00:00', validate = {'validator' : 'time', 'min' : '00:00:00', 'max' : '23:59:59', 'minstrict' : 0, 'maxstrict' : 0}, ) self._comma = Pmw.EntryField(parent, labelpos = 'w', label_text = 'Real (with comma):', value = '123,456', validate = {'validator' : 'real', 'separator' : ','}, ) entries = (self._any, self._real, self._odd, self._date, self._date2, self._time, self._comma) for entry in entries: entry.pack(fill='x', expand=1, padx=10, pady=5) Pmw.alignlabels(entries) self._any.component('entry').focus_set() def changed(self): print 'Text changed, value is', self._real.getvalue() def execute(self): print 'Return pressed, value is', self._any.getvalue() # This implements a custom validation routine. It simply checks # if the string is of odd length. def custom_validate(self, text): print 'text:', text if len(text) % 2 == 0: return -1 else: return 1
Pmw 1.2 -
5 Aug 2003
- Home
Manual page last reviewed: 22 May 1998


Who We Are
- A locally owned travel company offering personalized travel services to fit your needs.
- Our team has years of experience working with Portland residents.
- Going above and beyond for our clients is what we do best!
Client Experience
- Let our travel experts guide you through the planning phase of your next big adventure.
- Our talented team will be with you every step of the way.
- Together we will ensure that every trip you take with us - is the trip of a lifetime!
Nifty Tours
we make your travel dreams a reality!


Holiday Flashback: 1980 TV news report explains video games
by WABCNEW YORK (WABC) -- Back in 1980, the hottest gifts in stores were electronic toys you connected to your TV, or handheld games you could take with you!
The biggest concern among parents? That kids might spend too much time playing them.
So innocent --- they had no idea what was coming!
Enter the Eyewitness News Vault and let us know what your first electronic toy was!


{{> header }}
The following diagnostic summary is generated by node-report. For scripting purposes, this URL can be accessed with a Accept: text/plain header to get the report without the HTML wrapper.
Accept: text/plain
{{report}}


Send http GET method
Throw exception if no valid token.
Login by oauth. http://ringcentral-api-docs.readthedocs.io/en/latest/oauth/
The full oauth callback url with parameters returned from RingCentral.
Parse parameters from oauth.
The query part of the RingCentral oauth call back url.
Body can be Blob, FormData, URLSearchParams, String, Buffer or stream.Readable, any other type, plain object or instance of class will stringified as json.
Type of body is the same as post.
Generated using TypeDoc
A wrapper for sending http requests to RingCentralService.


This is where my portfolio is available for you to glaze at. Click the middle button on the blue section in order to see my portfolio.
If you would like a hardcopy, you can download either the PDF or the slideshow presentation.
Below are links to my GrabCAD shared folder and my Github repositories. If you have any questions, please feel free to contact me through email or LinkedIn!


"CEILING "the covering (1 Kings 7:3,7) of the inside roof and walls of a house with planks of wood (2 Chronicles 3:5; Jeremiah 22:14). Ceilings were sometimes adorned with various ornaments in stucco, gold, silver, gems, and ivory. The ceilings of the temple and of Solomon’s palace are described 1 Kings 6:9, 15; 7:3; 2 Chronicles 3:5,9.
"CEILING "the covering (1 Kings 7:3,7) of the inside roof and walls of a house with planks of wood (2 Chronicles 3:5; Jeremiah 22:14). Ceilings were sometimes adorned with various ornaments in stucco, gold, silver, gems, and ivory. The ceilings of the temple and of Solomon’s palace are described 1 Kings 6:9, 15; 7:3; 2 Chronicles 3:5,9.


Index
About
Inspire
Project
Consent Narrative
Design Development
Needs
Gates of the Arctic is a team of five students from Olin College of Engineering.
Learn More!


|
Standard Reference Data Program |
Data Gateway |
Chemistry WebBook |
Go To: Top, References, Notes / Error Report
Data compilation copyright by the U.S. Secretary of Commerce on behalf of the U.S.A. All rights reserved.
Data compiled by: K.P. Huber and G. Herzberg
| State | Te | ωe | ωexe | ωeye | Be | αe | γe | De | βe | re | Trans. | ν00 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| b 1Σ+ | (29050) | [2981] 1 | [16.320] 1 | (0.732) 1 | [19.2E-4] 1 | 1.032 | (b-X) | 29058.8 1 | ||||
| A 3Πi 0- | A → X 2 3 R | 28034.04 4 | ||||||||||
| missing citation; missing citation | ||||||||||||
| A 3Πi 0+ | A → X 2 3 R | 28028.31 4 | ||||||||||
| missing citation; missing citation | ||||||||||||
| A 3Πi 1 | 28438.55 | 2133.65 Z | 79.55 | 13.7916 5 6 | 0.8889 | .01730 | [22.495E-4] 7 | 1.1354 | A → X 2 3 R | 27948.43 4 | ||
| missing citation; missing citation | ||||||||||||
| State | Te | ωe | ωexe | ωeye | Be | αe | γe | De | βe | re | Trans. | ν00 |
| A 3Πi 2 | A → X 2 3 R | 27864.31 4 | ||||||||||
| missing citation; missing citation | ||||||||||||
| a 1Δ | 17660 8 | |||||||||||
| X 2Σ- | 0 | 3113.37 Z | 78.52 | 16.7943 9 | 0.7494 | .01097 | [19.174E-4] 10 | 1.0289 |
| 1 | Constants derived from the perturbations in A 3Π. The b-X transition is not observed. |
| 2 | Lifetime τ(v=0) = 0.89 μs Brzozowski, Elander, et al., 1974; similar results for v=1,3. |
| 3 | Vibrational intensity distribution (branching ratios), variation of the transition moment with r Gerard, Govers, et al., 1976. |
| 4 | Subband origins as defined by Merer, Malm, et al., 1975. From the data for the OD+ A 3Π(v=0) level Merer, Malm, et al., 1975 estimate the true spin-orbit and spin-spin interaction parameters A = -83.83 cm-1 Merer, Malm, et al., 1975 and 2α = -5.92 cm-1 Merer, Malm, et al., 1975. |
| 5 | Λ-doubling constants p0 = -0.251, q0 = +0.0478; for v=1,2 see Merer, Malm, et al., 1975. |
| 6 | Perturbations by b 1Σ+. |
| 7 | H0 = +10.4E-8; other Dv, Hv values for v ≤ 2 in Merer, Malm, et al., 1975. |
| 8 | From the photoelectron spectrum Katsumata and Lloyd, 1977. |
| 9 | Spin-splitting constants for v=0: λ0 = 2.134 cm-1 and γ0 = -0.1478 cm-1; similar results for v=1 and 2. |
| 10 | H0 = 12.39E-8; values for D1, D2 in Merer, Malm, et al., 1975. |
| 11 | D00(OH) + I.P.(H) - I.P.(OH). |
| 12 | A rather complete list and critical assessment of earlier references is given in Merer, Malm, et al., 1975. |
| 13 | From D00(OH+). |
| 14 | Λ-doubling constants p0 = -0.132, q0 = +0.01222 cm-1; for v=1,2,3 see Merer, Malm, et al., 1975. |
| 15 | Perturbations by b 1Σ+ and a 1Δ. |
| 16 | H0 = +2.02E-8; other Dv, Hv values for v ≤ 3 in Merer, Malm, et al., 1975. |
| 17 | Lifetime τ(v=0) = 1.06 μs Brzozowski, Erman, et al., 1975. |
| 18 | This level at 29434 cm-1 is only observed through perturbations in A 3Π(v=1); D6 = 4.8E-4. The v=5 level produces a weak perturbation in A 3Π(v=0). |
| 19 | Spin splitting constants λ0 = +2.141, γ0 = -0.0790 cm-1; similar constants for v=1,2 Merer, Malm, et al., 1975. |
| 20 | H0 = 2.17E-8; values for D1, D2, D3 in Merer, Malm, et al., 1975. |
Go To: Top, Constants of diatomic molecules, Notes / Error Report
Data compilation copyright by the U.S. Secretary of Commerce on behalf of the U.S.A. All rights reserved.
Brzozowski, Elander, et al., 1974
Brzozowski, J.; Elander, N.; Erman, P.; Lyyra, M.,
Lifetimes of excited levels in some important ion-molecules part I: NH+, OH+ and SH+,
Phys. Scr., 1974, 10, 241-243. [all data]
Gerard, Govers, et al., 1976
Gerard, M.; Govers, T.R.; van de Runstraat, C.A.; Marx, R.,
Vibrational branching ratios for the A3Πi → X3Σ- system of OH+ and OD+,
Chem. Phys. Lett., 1976, 44, 1, 154-158. [all data]
Merer, Malm, et al., 1975
Merer, A.J.; Malm, D.N.; Martin, R.W.; Horani, M.; Rostas, J.,
The ultraviolet emission spectra of OH+ and OD+. Rotational structure and perturbations in the A3Πi - X3Σ- transition,
Can. J. Phys., 1975, 53, 251-283. [all data]
Katsumata and Lloyd, 1977
Katsumata, S.; Lloyd, D.R.,
The photoelectron spectra of the OH and OD radicals,
Chem. Phys. Lett., 1977, 45, 519. [all data]
Brzozowski, Erman, et al., 1975
Brzozowski, J.; Erman, P.; Lew, H.,
Lifetimes of excited states in D2O+ and OD+ and relative lifetimes between the normal and deuterated species,
Chem. Phys. Lett., 1975, 34, 2, 267-270. [all data]
Go To: Top, Constants of diatomic molecules, References
Copyright for NIST Standard Reference Data is governed by the Standard Reference Data Act.
|
Standard Reference Data Program |
Data Gateway |
Chemistry WebBook |
If you have comments or questions about this site, please contact us.


Towan
Home
Game
Profile
Settings
Forum
Topic
Number of Entries
Actions
Delete
Add new Subforum
About


Uzbek Folk Music
Music connects the cultures of the world and is a window into the ethos of any country. Likewise, Uzbek music is one of the keys to understanding Uzbek culture. Today in Tashkent and other cities of the country one can hear Uzbek contemporary pop music, folklore music, Uzbek neoclassicism, and special genres of Uzbek music - “shashmakom” and “lazgi”. Besides, uzbek folk music more generally is often associated with dutar and bakhshi. Dutar is a simple instrument with two silk strings and bakhshi is a musician playing this instrument while singing folk songs. Uzbek festive music is performed on a karnay (wind instrument), surnay (flute) and doira, the sounds of which can be heard for hundreds of meters, inviting locals and tourists alike to join in the celebration.
National Uzbek Dances
Uzbek dances are the embodiment of the beauty of the Uzbek people. Uzbek folk dances differ from other oriental dances with a special emphasis on hand movements and facial expressions during performance. At the same time, each region has its own dance schools - in some, sharp movements predominate, in others - flowing, in some schools they use a short step, while others sometimes switch to a kind of running. Today there are three main schools of Uzbek dance - Khorezm, Bukhara and Ferghana. It is quite simple to see Uzbek dances, not a single celebration is complete without them and everyone loves to dance!
Uzbek Fine Art
Oriental masters have always been famous for their special artistic talent, which is fully manifested in the decoration and decoration of majestic palaces, mausoleums and other religious buildings. As a rule, the main motifs of Uzbek creativity are ornament, pattern and calligraphy. Islamic traditions prohibit the depiction of people and animals, so the masters began to develop more abstract directions, bringing them almost to perfection. Later, a new type of fine Uzbek art appeared - a miniature - small bright colorful pictures, varnished, adorned the interiors of palaces and rich houses.
Applied Arts and Decorative Crafts
The decorative and applied art of Uzbekistan is an original and exclusive work of folk craftsmen and artisans who pass on their skills from generation to generation. By investing a piece of soul in every thing, over the centuries they have created unique patterns of products: whether it’s utensils for the home or decoration of the home, a unique fabric for a festive dress or special dishes. The creations of Ferghana, Samarkand, Bukhara, Khiva and other masters have long been famous far beyond the borders of their homeland and continue to cause interest among lovers of beauty from around the world.


We sell users!
- benchmark global paradigms
- unleash customized vortals
- transition user-centric methodologies
- brand plug-and-play vortals
- transition magnetic schemas
- expedite scalable web-readiness
- cultivate interactive action-items
- aggregate user-centric web services
- leverage customized web services
- aggregate sexy applications
- repurpose end-to-end communities


Recently I had work on the project in which I have to scrap data from websites Jabong —– looks easy ….??? No because websites like Jabong are not fixed length websites like IMDB which I have use in my blog, websites like jabong automatically expand when scroll down to bottom and keem on expanding untill all products in category get over.
So for this case, If we use lxml
as I have used in the previous post, lxml
will work but problem is, that it will only scrap the products which are listed on the initial page, around 52 products will be scrapped, but for scraping 20,000 products we have to use some thing extra.
The biggest problem is that how to get scroll the page to bottom. Some here comes selenium
python package. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. It open a web browser and your python program will interact with it. Selenium
contain various browser action keys like scrolling, selecting and Xpath
.
To install Selenium
python package type
pip install selenium
in your terminal.
Import necessary packages
Now you done with imports of necessary packages, now launch webdriver specific for your browser. I am using firefox in this case you can use any browser depends on selenium list of supported browser. It will open the web browser.
Now next thing is that you have to scroll down untill to the end of the page or upto specific number of times depends on how much products you want. I am scrolling 50 times, In each scrolling 52 products are added so for 50 X 52 = 2600 , around 2600 products will scrap. And after each scroll I used to wait for 3 sec so that html page load properly.
After doing this we are having html content for all the products. Now the thing required is to scrap the necessary info from page, so for our case we are scraping product-url for each product. so for this we are using xpath
selector, If in case you want learn about xpath
click here.
###Writing whole code in once.
For any typos and any problem feel free to comment and and mail. Piece :)


Nonparametric unfolding item response theory (IRT) model for dichotomous data (see W.H. Van Schuur (1984). Structure in Political Beliefs: A New Model for Stochastic Unfolding with Application to European Party Activists, and W.J.Post (1992). Nonparametric Unfolding Models: A Latent Structure Approach). The package implements MUDFOLD (Multiple UniDimensional unFOLDing), an iterative item selection algorithm that constructs unfolding scales from dichotomous preferential-choice data without explicitly assuming a parametric form of the item response functions. Scale diagnostics from Post(1992) and estimates for the person locations proposed by Johnson(2006) and Van Schuur(1984) are also available. This model can be seen as the unfolding variant of Mokken(1971) scaling method.
| Version: | 1.1.1 |
| Depends: | R (≥ 3.3.3) |
| Imports: | gtools, boot, zoo, ggplot2, reshape2, stats, utils |
| Published: | 2018-12-10 |
| Author: | Spyros Balafas [aut, cre], Wim Krijnen [aut], Wendy Post [ctb], Ernst Wit [aut] |
| Maintainer: | Spyros Balafas <s.balafas at rug.nl> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| URL: | https://github.com/cran/mudfold |
| NeedsCompilation: | no |
| Materials: | NEWS |
| In views: | Psychometrics |
| CRAN checks: | mudfold results |
| Reference manual: | mudfold.pdf |
| Package source: | mudfold_1.1.1.tar.gz |
| Windows binaries: | r-devel: mudfold_1.1.1.zip, r-release: mudfold_1.1.1.zip, r-oldrel: mudfold_1.1.1.zip |
| OS X binaries: | r-release: mudfold_1.1.1.tgz, r-oldrel: mudfold_1.1.1.tgz |
| Old sources: | mudfold archive |
Please use the canonical form https://CRAN.R-project.org/package=mudfold to link to this page.


Click the button to run the dogescript code through the parser and debug the bundled parser code.
Dogescript
Javascript


Success! Your Voicemail Victim instance is ready and waiting to be hacked.
Simply make a call from any phone to your Twilio number that is pointed at this application.
Need a hint to get started hacking? Click here.
Hint: Checkout Caller ID spoofing and SpoofCard. Be creative and don't be afraid to get your hands dirty!


Only 12 of 16 Knives in the Stats-Knife-List - Better Battlelog Forums #121878
Sitemap
26. June 2014 15:33
Topicstarter
Jarozeb
Hi All,
there are 16 knives in the Weapon-Stats-List.
But there are only 12, when I sort the list to knives only.
These four are missing:
BJ-2
PRECISION
DIVE
TACTICAL
Could you please fix this? :-)
Best regards, Jarozeb
30. June 2014 10:46
BrainFooLong
Administrator
Will be fixed soon.


We can code. We can make art that is better than 63% of painting elephants. We like making games. I don't know, let's just talk about it.
Free snuggles.   You pay the airfaire for snuggles.
Sometimes I like computer. Computer I do good running.
Point and click adventure game available for iOS, Android, and PC.
Ludum Dare XX entry. Go through a series of minigames to live the life of Mr. Wily. For Windows, Mac, and web.
Ludum Dare XX entry. 3rd person adventure game for Windows, Mac, and web.
Point and click adventure game available for iOS, Android, and PC.
Ludum Dare XX entry. Go through a series of minigames to live the life of Mr. Wily. For Windows, Mac, and web.
Ludum Dare XX entry. 3rd person adventure game for Windows, Mac, and web.


T-0.30: Two bowls of Marijuana
T+0.00: 60 mg 10x Salvia
T+0.00.30: 1 Whippet
Iím an 18 year old incoming college freshman. Over the past year I started doing drugs and have tried a pretty decent number of psychedelics since then. I have experience with Shrooms, 4-AcO-DMT, 4-HO-MPT, DPT, DMT, 5-MeO-MiPT, 2C-C, 2C-I, 2C-T-2, DOC, Ketamine, Nitrous, and Salvia. Iím in as good health as you can be without exercising regularly. Iím 6Ē and slender, weighing in at 135 lbs. I can easily walk ten miles, run one, or bike twenty, however I only frequently walk long distances. I smoke weed a few times a week and tripped three times in the week prior to this experience on 2C-T-2, 5-MeO-MiPT, and 2C-C. I last did Nitrous a few days before. Typically when I do Nitrous I do somewhere from 1-3 whippets.
A few nights ago, after a fantastic Flaming Lips concert, I planned on doing Salvia concurrently with Nitrous while high. I hadnít smoked or done anything else at the concert. The reason for this experiment was to see if I could find a more enjoyable way of doing Salvia.  Iíd tried Salvia three times before, once at 30 mg, another at 50 mg, and a last at 100 mg. Nitrous when combined with weed propels me into an empty space where I am incredibly grateful of all the good things in my life. I have done Nitrous at least 20 times. I figured the weed and the Nitrous would be enough to overpower the annoying body high but not too much as to take away from the visual and mental oddities.
I had just split 2 deep bowls with 4 other people, I was pleasantly stoned and looking forward to what I was about to do. A few of my friends hit their whippets and I waited for the spot in the hammock to clear. While doing this I packed a bowl with 10x Salvia, two pinches, around 60 mg. I was using a homemade wooden chillum that burns very hot and cherries very easily.
I got everything ready and moved to the hammock.  I hit the salvia: spark the lighter, put it to the herb, breathe in the harsh earthy smoke and then a small gasp of air. I checked the bowl and saw it was still lit, and took another toke without letting my first one out.  As I reached for my balloon I began to feel the uncomfortable body high that salvia produces in me. It is very prickly, like my skin is too tight or my muscles are segmented like citrus and trying to move. Each part of my body feels as if is tugging on another, whether I move or not. The weed high dulls this some and it is bearable.
I know that in the next 10 seconds Iíll be unable to hit the balloon so I exhale after about 30 seconds total and quickly inhale the entire whippet. I hear a whoosh as Iím propelled into the void. For the first minute the nitrous overpowered the Salvia, I was no longer. Life was no longer. Nothing was or ever was. The concept of nothing didnít exist as there were no concepts of anything at all. The state that was (for I could not be in it) was not anything; there was no fear, no happiness, just emptiness. As I came back I began to remember the people I love and why I should be happy about the life I live.
Then the music hit me. I love the song I was playing, it is one of my favorites. Iím still feeling the pure rush of euphoria from the Nitrous and now the Salvia is regaining some control. I start hearing notes that I know donít actually exists in the song, the song is sparkling and glowing as the music forms into what I would call a music video in my head. I was seeing a quickly moving sunrise made out of different colored images of sunrises in the fashion where certain images make up a larger image. A collage of sorts I guess you would call it.
I felt like I was being pulled through this music video. The pulling sensation was like playing a rail shooter, you can look around but never really control where your body takes you. I saw people I cared about moving in circles like a pin wheel (with tracers of their bodies) while walking upside down on a grassy surface. I know I had other visuals but I canít remember them a few days afterwards. I might have had a visual of people doing flips and leaving tracers of rainbows behind them but that might have been a dream from that night. It was very fractal oriented, due to the Salvia, and also contained many nature aspects.
Nearly four or five minutes after first hitting the salvia I managed to get up off the hammock.  Sitting up and down was one hard motion and I landed on a wooden seat more heavily than expected. I zoned out for a few more minutes feeling great and stupid before telling my friends a bit about what I had experienced. After another 30 minutes I was only feeling the tale end of a weed high.
The combination was great; it was intense, both visually and mentally. The body high from the combination was very pleasant, no prickling noted. I certainly prefer it to Salvia alone because of the abolishment of that annoying body high. Compared to solely Nitrous it was much weirder. When I get visuals from Nitrous it is always very realistic situations. The visuals themselves were realistic and not cartoony but the things I was seeing were not. A few days later I noticed that the Salvia did lead to some extra light alteration in my HPPD.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Home
Lesson
Evaluation
Reports
Skills
Student
Groups
New Lesson
New Evaluation
Reports
Edit Skills
Manage Students
Manage Groups


{% extends "education/deo/deo_dashboard.html" %} {% block content %}
| Districts | No meetings were held | 1 meetings was held | 2 meetings were held | 3 meetings were held |
| Kabarole | 25% | 70% | 1% | 0% |
| Kyegegwa | 45% | 20% | 2% | 0.5% |
| Kotido | 12% | 60% | 1% | 0% |
| Kaabongo | 23% | 30% | 3% | 0% |


Fill in all steps for completing resubmit process.
{{item.label}}
Please upload all files in pdf format,upload only A4 Size, portrait orientation and file size should be less than 4 MB.
For registration of individuals as Company Secretaries :Rs 10,000.00
Follow the guidelines to payment process.
If yes, you will not be able to revert back.


public class DotUnstuffingInputStream
extends java.io.FilterInputStream
| Modifier and Type | Field and Description |
|---|---|
protected int[] |
last
An array to hold the last two bytes read off the stream.
|
| Constructor and Description |
|---|
DotUnstuffingInputStream(java.io.InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
java.io.InputStream |
getBaseStream()
Provide access to the base input stream.
|
int |
read()
Read through the stream, checking for '\r\n.'
|
int |
read(byte[] b,
int off,
int len)
Read through the stream, checking for '\r\n.'
|
protected int[] last
public int read() throws java.io.IOException
read
in class java.io.FilterInputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.FilterInputStream
b
- the byte array into which the bytes will be readoff
- the offset into the byte array where the bytes will be insertedlen
- the maximum number of bytes to be read off the streamjava.io.IOException
public java.io.InputStream getBaseStream()
Copyright © 2012 SubEthaSMTP. All Rights Reserved. Build version: 3.1.7


Rabeprazole is used to treat several gastrointestinal (GI) conditions. These conditions are caused by high levels of acid produced by the stomach.
headache, pain in the abdomen (stomach area), sore throat, gas, infection, constipation, diarrhea
Lipitor is used along with a proper diet to help lower "bad" cholesterol and fats
Many people using this medication do not have serious side effects.
Nexium is used to treat certain stomach and esophagus problems.
Headache or abdominal pain may occur. If any of these effects persist or worsen, tell your doctor or pharmacist promptly.
Plavix is a prescription medicine used to treat the symptoms of acute coronary syndrome such as a stroke, blood clot or serious heart problem after a heart attack, severe chest pain or circulation problems.
pale skin, easy bruising, purple spots under your skin or in your mouth, fever, etc.
This product is used to control and prevent symptoms (wheezing and shortness of breath) caused by asthma or ongoing lung disease (chronic obstructive pulmonary disease-COPD, which includes chronic bronchitis and emphysema).
Hoarseness, throat irritation, headache, or stomach upset may occur. If any of these effects persist or worsen, tell your doctor promptly.
Abilify is used to treat certain mental/mood disorders (such as bipolar disorder, schizophrenia, Tourette's syndrome, and irritability associated with autistic disorder).
Dizziness, lightheadedness, drowsiness, nausea, vomiting, tiredness, excess saliva/drooling, blurred vision, weight gain, constipation, headache, and trouble sleeping may occur.


Just Nearest
Show Female only
Show Male only
Both Male & Female
How many people do you want to see at a time?
Zipcode


‘Benni Is Qualified To Do The Job For Bafana...’
by Soccer LadumaBafana Bafana head coach, Molefi Ntseki revealed that once the plans are in action to have scouts overseas, Benni McCarthy will be considered for the job.
The Bafana legend recently parted ways with Cape Town City after just over two seasons at the helm of the club.
Now as McCarthy looks for the next step in his professional career, there has been talk about whether or not he has a future at the South African national team as possibly a scout abroad.
“When you look at the program, the plan that I have presented to the president and technical committee, we need to have a scout overseas. Basically we are saying that we must have two, they will help each other for the senior players and for all the junior players because if we are to have one scout overseas, it will be very difficult for them to be all over and give us a technical report of the players that we have overseas,” Ntseki told the media.
“It is just unfortunate that Coach Benni had to lose his job at Cape Town City but I think that doesn’t mean anything bad about him, he’s a good coach, he’s a legend of the game and he is qualified to do the job for us. When that time comes, we will be able to consider him,” he added.
Download The Soccer Laduma Social Media App & Earn Airtime for Selfies!


First you have to learn JavaScript, HTML(5) and CSS. This are basic web languages and structures and you really need to understand that before you can make a plugin.
At next, just take a look at existing plugins to see how the things work.
http://getbblog.com/en/board/forum/1353/1/Custom-Plugins


Duration
15 minutes
Goals
The primary goal of this exercise is to create a custom table view cell programmatically.
Required assets
The provided Exercise 2 folder contains a starter solution as well as a completed solution you can use to check your work. Please make sure you have this folder before you begin.
Challenge
You'll start with an existing application that has a UITableViewController
created using the Xamarin designer.
Currently it's using the default cell style to display a single line of text.
You're going to create a custom cell and use it to display the weather data within the table view.
- Inspect the starter solution in the Exercise 2 folder.
- Create a custom table view cell class.
- Add child views to display an image and three labels.
- Layout the child views to mimic the image shown above.
- Pass the weather data to the custom cell class.
- Display the custom cell.
Steps
Below are the step-by-step instructions to implement the exercise.
Inspect the starter solution
- Open the starter solution in the Exercise 2 folder and run the application. It works but it's not very visually appealing.
Create a custom table view cell class
Create a new class that derives from UITableViewCell
.
- Add a new class to the weather project and name it WeatherCell.cs
- Open the WeatherCell.cs class and change the class definition to inherit from
UITableViewCell
. - We need to change the constructor in order to use the new cell with the table view created in the designer.
Change the constructor to accept an
IntPtr
named ptr and pass it to the base constructor.
Add child views to display an image and three labels
To display the weather data we're going to use a UIImageView
and three UILabels
.
- Add the child views to the custom cell.
Specifically, create a
UIImageView
named imgWeather and threeUILabels
; lblCity, lblHigh, and lblLow. - Instantiate the four child views in the constructor, customize the fonts and colors as you like, and add the views to the
ContentView
of the cell.
Layout the child views
To align the child views, we're going to override the LayoutSubviews
method.
- Override the
LayoutSubviews
method. - Set the size and position of the four child views from within the method.
Pass the weather data to the custom cell
We'll create a public method that accepts a Weather object and then updates our child views.
- Create a public method called
UpdateData
that accepts aWeather
object. - Set the
Text
properties on the threeUILabel
s. - Set the
Image
property of theUIImageView
.
Use the custom cell
Update the Table View code-behind to use the custom cell and pass it the weather data.
- Open WeatherTVC.cs
- In order to implement cell re-use for our custom cell, we'll register the cell from within the table view class. In the constuctor of WeatherTVC, register the custom cell using the cell ID.
- Scroll down to the
GetCell
method. - Update the
GetCell
method. Because the cell is registered with the table view, you no longer need to manually instantiate the cells. But we will need to cast the returned cell toWeatherCell
so we can use theUpdateData
method. - Finally, call
UpdateData
on the cell, and pass it the appropriate weather data.
- Run the app!
Summary
Congratulations! You have sucessfully created and utilized a custom table view cell.


Find new music through Soundcloud! Use the search bar above to find an artist on Soundcloud and create your station, leave Soundora running in the background, and enjoy! As tracks finish, you will find them listed here.
Soundora is built using the Soundcloud API and AngularJS. Feel free to add a pull request with new features to the GitHub repo, or e-mail me at<EMAIL_ADDRESS>with any comments.


Carjacker in crash that killed boy sentenced to 10 years
ST. LOUIS (AP) - A 19-year-old has been sentenced to 10 years in prison for a pair of carjackings, including one that led to a St. Louis-area crash that killed a 9-year-old boy and injured three relatives as they returned from a trip to Disney World in Florida.
The St. Louis Post-Dispatch reports that Darian Cummings was sentenced Monday for two counts of first-degree robbery. He also faces a second-degree murder charge in the death of Caleb Lee.
Both carjackings happened in April 2017. In the second heist, Cummings sped away from a police officer, ran a red light near St. Louis Lambert International Airport and crashed into the car in which Caleb was riding with his mother, aunt and 5-year-old brother.
Cumming was 16 at the time but was tried as an adult.
Information from: St. Louis Post-Dispatch, http://www.stltoday.com
Sign up for Daily Newsletters
Copyright © 2019 The Washington Times, LLC.
Please read our comment policy before commenting.


{% extends 'base.html' %} {% block content %} {% include 'nav.html' %}
Stop the Excel sheets madness to keep track of everyone's attendance. There's a better way!


This plugin provides a generator which continuously reads from stdin (non-blocking on POSIX and blocking on windows) as well as a callback that writes to stdout.
class NetcatPluginOutput(AbstractNetcatPlugin):
"""Implement basic input/output plugin.
This plugin provides a generator which continuously reads from stdin
(non-blocking on POSIX and blocking on windows) as well as a
callback that writes to stdout.
"""
# Replace '\n' linefeeds (if they exist) with CRLF ('\r\n')?
crlf = False
# Non-blocking read from stdin achieved via timeout.
# Specify timeout in seconds.
input_timeout = None
# ------------------------------------------------------------------------------
# Constructor / Destructor
# ------------------------------------------------------------------------------
def __init__(self, options={}):
"""Set specific options for this plugin."""
super(AbstractNetcatPlugin, self).__init__()
assert "encoder" in options
assert "input_timeout" in options
assert "crlf" in options
self.log = logging.getLogger(__name__)
self.enc = options["encoder"]
if "input_timeout" in options:
self.input_timeout = options["input_timeout"]
if "crlf" in options:
self.crlf = options["crlf"]
# ------------------------------------------------------------------------------
# Private Functions
# ------------------------------------------------------------------------------
def __use_linefeeds(self, data):
"""Ensure the user input has the desired linefeeds --crlf or not."""
# No replacement requested or already CRLF
if not self.crlf or data.endswith("\r\n"):
return data
# Replace current newline character with CRLF
if data.endswith("\n"):
self.log.debug("Replacing LF with CRLF")
return data[:-1] + "\r\n"
# Otherwise just return as it is
return data
def __set_input_timeout(self):
"""Throws a catchable BaseException for sys.stdin after timeout (Linux only)."""
i, o, e = select.select([sys.stdin], [], [], self.input_timeout)
if not i:
raise BaseException("timed out")
# ------------------------------------------------------------------------------
# Public Functions
# ------------------------------------------------------------------------------
def producer(self, ssig):
"""Constantly ask for user input."""
# https://stackoverflow.com/questions/1450393/#38670261
# while True: line = sys.stdin.readline() <- reads a whole line (faster)
# for line in sys.stdin.readlin(): <- reads one byte at a time
while True:
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-1")
return
try:
# TODO: select() does not work for windows on stdin/stdout
if os.name != "nt":
self.__set_input_timeout()
line = sys.stdin.readline()
except BaseException:
# When using select() with timeout, we don't have any input
# at this point and simply continue the loop or quit if
# a terminate request has been made by other threads.
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-2")
return
continue
if line:
self.log.debug("Received {} bytes from STDIN".format(len(line)))
self.log.trace("Received: {}".format(repr(line)))
yield self.__use_linefeeds(line)
# EOF or +
else:
# DO NOT RETURN HERE BLINDLY, THE UPSTREAM CONNECTION MUST GO FIRST!
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-3")
return
def consumer(self, data):
"""Print received data to stdout."""
print(data, end="")
sys.stdout.flush() # TODO:Is this required? What does this do? Test this!
def interrupt(self):
"""Empty interrupt."""
pass
Ancestors (in MRO)
Class variables
var crlf
var input_timeout
Static methods
def __init__(
self, options={})
Set specific options for this plugin.
def __init__(self, options={}):
"""Set specific options for this plugin."""
super(AbstractNetcatPlugin, self).__init__()
assert "encoder" in options
assert "input_timeout" in options
assert "crlf" in options
self.log = logging.getLogger(__name__)
self.enc = options["encoder"]
if "input_timeout" in options:
self.input_timeout = options["input_timeout"]
if "crlf" in options:
self.crlf = options["crlf"]
def consumer(
self, data)
Print received data to stdout.
def consumer(self, data):
"""Print received data to stdout."""
print(data, end="")
sys.stdout.flush() # TODO:Is this required? What does this do? Test this!
def producer(
self, ssig)
Constantly ask for user input.
def producer(self, ssig):
"""Constantly ask for user input."""
# https://stackoverflow.com/questions/1450393/#38670261
# while True: line = sys.stdin.readline() <- reads a whole line (faster)
# for line in sys.stdin.readlin(): <- reads one byte at a time
while True:
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-1")
return
try:
# TODO: select() does not work for windows on stdin/stdout
if os.name != "nt":
self.__set_input_timeout()
line = sys.stdin.readline()
except BaseException:
# When using select() with timeout, we don't have any input
# at this point and simply continue the loop or quit if
# a terminate request has been made by other threads.
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-2")
return
continue
if line:
self.log.debug("Received {} bytes from STDIN".format(len(line)))
self.log.trace("Received: {}".format(repr(line)))
yield self.__use_linefeeds(line)
# EOF or +
else:
# DO NOT RETURN HERE BLINDLY, THE UPSTREAM CONNECTION MUST GO FIRST!
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for reading STDIN-3")
return
Instance variables
var enc
var log
class NetcatServer
Netcat Server implementation.
class NetcatServer(AbstractSocket):
"""Netcat Server implementation."""
def __init__(self, encoder, host, port, recv_timeout, recv_timeout_retry, options={}):
"""Construct a listening server."""
super(NetcatServer, self).__init__(
encoder, "server", recv_timeout, recv_timeout_retry, options
)
# Listen on <IP_ADDRESS> by default
addr = "<IP_ADDRESS>"
if host is not None:
addr = self.gethostbyname(host, port, socket.AF_INET)
# Setup server
self.create_socket()
self.bind(addr, port)
if self.options["udp"]:
self.conn = self.sock
self.log.info(
"Listening on {} (family {}/UDP, port {})".format(addr, socket.AF_INET, port)
)
else:
self.listen()
self.log.info(
"Listening on {} (family {}/TCP, port {})".format(addr, socket.AF_INET, port)
)
self.accept()
Ancestors (in MRO)
Class variables
var conn
var options
var recv_timeout
var recv_timeout_retry
var remote_addr
var remote_port
var role
var sock
Static methods
def __init__(
self, encoder, host, port, recv_timeout, recv_timeout_retry, options={})
Inheritance:
AbstractSocket
.__init__
Construct a listening server.
def __init__(self, encoder, host, port, recv_timeout, recv_timeout_retry, options={}):
"""Construct a listening server."""
super(NetcatServer, self).__init__(
encoder, "server", recv_timeout, recv_timeout_retry, options
)
# Listen on <IP_ADDRESS> by default
addr = "<IP_ADDRESS>"
if host is not None:
addr = self.gethostbyname(host, port, socket.AF_INET)
# Setup server
self.create_socket()
self.bind(addr, port)
if self.options["udp"]:
self.conn = self.sock
self.log.info(
"Listening on {} (family {}/UDP, port {})".format(addr, socket.AF_INET, port)
)
else:
self.listen()
self.log.info(
"Listening on {} (family {}/TCP, port {})".format(addr, socket.AF_INET, port)
)
self.accept()
def accept(
self)
Accept a connection.
def accept(self):
"""Accept a connection."""
try:
self.log.debug("Waiting for TCP client")
self.conn, client = self.sock.accept()
addr, port = client
self.remote_addr = addr
self.remote_port = port
self.log.info("Client connected from {}:{}".format(addr, port))
except (socket.gaierror, socket.error) as error:
self.log.error("Accept failed: {}".format(error))
sys.exit(1)
def bind(
self, addr, port)
Bind the socket to an address.
def bind(self, addr, port):
"""Bind the socket to an address."""
try:
self.log.debug("Binding socket to {}:{}".format(addr, port))
self.sock.bind((addr, port))
except (OverflowError, OSError, socket.error) as error:
self.log.error("Binding socket to {}:{} failed: {}".format(addr, port, error))
sys.exit(1)
def connect(
self)
Connect to a remote socket at given address and port (TCP-only).
def connect(self):
"""Connect to a remote socket at given address and port (TCP-only)."""
try:
self.log.debug("Connecting to {}:{}".format(self.remote_addr, self.remote_port))
self.sock.connect((self.remote_addr, self.remote_port))
return True
except socket.error as error:
self.log.error(
"Connecting to {}:{} failed: {}".format(self.remote_addr, self.remote_port, error)
)
return False
def create_socket(
self)
Create TCP or UDP socket.
def create_socket(self):
"""Create TCP or UDP socket."""
try:
if self.options["udp"]:
self.log.debug("Creating UDP socket")
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
else:
self.log.debug("Creating TCP socket")
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error as error:
self.log.error("Failed to create the socket: {}".format(error))
sys.exit(1)
# Get around the "[Errno 98] Address already in use" error, if the socket is still in wait
# we instruct it to reuse the address anyway.
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
def gethostbyname(
self, host, port, family)
Translate hostname into IP address.
def gethostbyname(self, host, port, family):
"""Translate hostname into IP address."""
socktype = socket.SOCK_DGRAM if self.options["udp"] else socket.SOCK_STREAM
flags = 0
if self.options["nodns"]:
flags = socket.AI_NUMERICHOST
try:
self.log.debug("Resolving hostname: {}".format(host))
(family, socktype, proto, canonname, sockaddr) = socket.getaddrinfo(
host, port, socket.AF_INET, socktype, flags
)[0]
except socket.gaierror as error:
self.log.error("Resolve Error: {}".format(error))
sys.exit(1)
self.log.debug("Resolved hostname: {}".format(sockaddr[0]))
return sockaddr[0]
def listen(
self)
Listen for connections made to the socket.
def listen(self):
"""Listen for connections made to the socket."""
try:
self.log.debug("Listening with backlog={}".format(self.options["backlog"]))
self.sock.listen(self.options["backlog"])
except socket.error as error:
self.log.error("Listening failed: {}".format(error))
sys.exit(1)
def receive(
self, ssig)
Generator function to receive data endlessly by yielding it.
:param function interrupter: A Func that returns True/False to tell us to stop or not.
def receive(self, ssig):
"""
Generator function to receive data endlessly by yielding it.
:param function interrupter: A Func that returns True/False to tell us to stop or not.
"""
# Set current receive timeout
self.conn.settimeout(self.recv_timeout)
self.log.trace("Socket Timeout: {}".format(self.recv_timeout))
# Counts how many times we had a ready timeout for later to decide
# if we exceeded maximum retires
curr_recv_timeout_retry = 0
while True:
# Ensure to signal that we do not stop receiving data
# if ssig.has_stop():
# self.log.debug("Interrupt has been requested for receive()")
# return
if self.conn is None:
self.log.error("Exit. Socket is gone in receive()")
ssig.raise_stop()
return
# Non-blocking socket with timeout. If the timeout threshold is hit,
# it will throw an socket.timeout exception. This is required to see if other
# threads have been terminated already.
try:
# https://manpages.debian.org/buster/manpages-dev/recv.2.en.html
(byte, addr) = self.conn.recvfrom(self.options["bufsize"])
# [1/5] Finished receiving all data
# NOTE: This is the place where we can do any checks in between reads as the
# socket has been changed from blocking to time-out based.
# NOTE: This is also the place, where we quit in case --wait was specified.
except socket.timeout:
# Let's ask the interrupter() function if we should terminate?
if not ssig.has_stop():
# No action required, continue the loop and read again.
continue
self.log.debug("Interrupt has been requested for receive()")
# Other threads are done. Let's try to read a few more times before
# returning and ending this function (might be data left)
if curr_recv_timeout_retry < self.recv_timeout_retry:
self.log.trace(
"Final socket read: {}/{} before quitting.".format(
curr_recv_timeout_retry, self.recv_timeout_retry
)
)
curr_recv_timeout_retry += 1
continue
ssig.raise_stop()
return
# [2/5] Connection was forcibly closed
# [Errno 10054] An existing connection was forcibly closed by the remote host
# [WinError 10054] An existing connection was forcibly closed by the remote host
# So we will just warn (instead of error our), ignore (don't return here) and
# let the bottom of this function decide whether we should just quit or
# reconnect/bind (if the user specified this.
except socket.error as error:
# Also ensure we reset the 'byte' value to none so that the below check can kick in.
byte = None
self.log.warning("Socket Receive: {}".format(error))
# [3/5] TODO: Still need to figure out what this error is and when it is thrown
except AttributeError as error:
self.log.error("TODO: What happens here?Attribute Receive Error: {}".format(error))
ssig.raise_stop()
return
# We're receiving data again, so let's reset the retry/terminate counter
# The counter is incremented in 'except socket.timeout' above.
curr_recv_timeout_retry = 0
# If we're receiving data from a UDP client
# we can firstly/finally set its addr/port in order
# to send data back to it (see send() function)
if self.options["udp"]:
self.remote_addr, self.remote_port = addr
self.log.debug("Client connected: {}:{}".format(self.remote_addr, self.remote_port))
# [4/5] Upstream (server or client) is gone. Do we reconnect or quit?
if not byte:
self.log.trace("Socket: Empty data received.")
self.log.info("Upstream connection closed.")
if self.role == "server":
# Yay, we want to continue and allow new clients
if self.__reaccept_from_client():
self.log.trace("Server can continue, because of --keep-open")
continue
if self.role == "client":
# Yay, we want to continue and our client will re-connect upstream again
if self.__reconnect_to_server():
self.log.trace("Client can continue, because of --reconn")
continue
ssig.raise_stop()
return
# [5/5] We have data to process
data = self.enc.decode(byte)
self.log.debug(
"Received {} bytes from {}:{}".format(len(data), self.remote_addr, self.remote_port)
)
self.log.trace("Received: {}".format(repr(data)))
yield data
def send(
self, data)
Send data.
def send(self, data):
"""Send data."""
# In case of sending data back to an udp client we need to wait
# until the client has first connected and told us its addr/port
if self.options["udp"] and self.remote_addr is None and self.remote_port is None:
self.log.warning("UDP client has not yet connected. Queueing message")
while self.remote_addr is None and self.remote_port is None:
time.sleep(0.1) # Less wastefull than using 'pass'
curr = 0 # bytes send during one loop iteration
send = 0 # total bytes send
size = len(data) # bytes of data that needs to be send
data = self.enc.encode(data)
assert size == len(data), "Encoding messed up string length, might need to do len() after."
# Loop until all bytes have been send
while send < size:
try:
self.log.debug(
"Trying to send {} bytes to {}:{}".format(
size - send, self.remote_addr, self.remote_port
)
)
self.log.trace("Trying to send: {}".format(repr(data)))
if self.options["udp"]:
curr = self.conn.sendto(data, (self.remote_addr, self.remote_port))
send += curr
else:
curr = self.conn.send(data)
send += curr
if curr == 0:
self.log.error("No bytes send during loop round.")
return
# Remove 'curr' many bytes from data for the next round
data = data[curr:]
self.log.debug(
"Sent {} bytes to {}:{} ({} bytes remaining)".format(
curr, self.remote_addr, self.remote_port, size - send
)
)
except socket.error as error:
if error.errno == socket.errno.EPIPE:
self.log.error("TODO:Add desc. Socket error({}): {}".format(error.errno, error))
return
# Most likely nothing to see here??
# FIXME: TODO: Need to re-accepd new client
self.log.error("TODO:Add desc. Socket Error: {}".format(error))
if self.role == "server":
if self.__reaccept_from_client():
continue
self.log.warning("Shutdown")
return
except (OSError) as error:
self.log.error("Socket OS Error: {}".format(error))
return
class Runner
Runner class that takes care about putting everything into threads.
class Runner(object):
"""Runner class that takes care about putting everything into threads."""
# Dict of producer/consumer action to run in a thread.
# Each list item will be run in its own thread
# {
# "name": {
# {
# "producer": "function", # A func which yields data
# "consumer": "function", # A callback func to process the data
# "signal": "StopSignal", # An instance providing has_stop() and raise_stop()
# "interrupt": "function", # A interrupt func to be called outside the thread to stop it
# }
# }
__actions = {}
# Dict of timed function definition to run in a thread.
# Each list item will be run in its own thread.
# {
# "name": {
# {
# "action": "function", # A func which does any action
# "intvl": "function", # The action func will be called at this intervall
# "args": "function", # args for the action func
# "kwargs": "function", # kwargs for the action func
# "signal": "StopSignal", # An instance providing has_stop() and raise_stop()
# }
# }
__timers = {}
# A dict which holds the threads created from actions.
# The name is based on the __actions name
# {"name": ""}
__threads = {}
# ------------------------------------------------------------------------------
# Constructor / Destructor
# ------------------------------------------------------------------------------
def __init__(self):
"""Constructor."""
self.log = logging.getLogger(__name__)
# ------------------------------------------------------------------------------
# Public Functions
# ------------------------------------------------------------------------------
def add_action(self, action):
"""
Enables a function to run threaded by the producer/consumer runner.
:param str name: Name for logging output
:param function producer: A generator function which yields data
:param function consumer: A callback which consumes data from the generator
:param function interrupter: A func that signals a stop event to the producer
"""
assert "name" in action
assert "producer" in action
assert "consumer" in action
assert "signal" in action
assert "interrupt" in action
self.__actions[action["name"]] = {
"name": action["name"],
"producer": action["producer"],
"consumer": action["consumer"],
"signal": action["signal"],
"interrupt": action["interrupt"],
}
def add_timer(self, timer):
self.__timers[timer["name"]] = {
"action": timer["action"],
"intvl": timer["intvl"],
"args": timer["args"] if "args" in timer else None,
"kwargs": timer["kwargs"] if "kwargs" in timer else {},
"signal": timer["signal"],
}
def run(self):
"""Run threaded NetCat."""
def run_action(name, producer, consumer, ssig):
"""
Receive data (network, user-input, shell-output) and process it (send, output).
:param str name: Name for logging output
:param function producer: A generator function which yields data
:param function consumer: A callback which consumes data from the generator
:param StopSignal ssig: Providing has_stop() and raise_stop()
"""
self.log.trace("[{}] Producer Start".format(name))
for data in producer(ssig):
self.log.trace("[{}] Producer received: {}".format(name, repr(data)))
consumer(data)
self.log.trace("[{}] Producer Stop".format(name))
def run_timer(name, action, intvl, ssig, *args, **kwargs):
"""Execute periodic tasks by an optional provided time_action."""
self.log.trace("[{}] Timer Start (exec every {} sec)".format(name, intvl))
time_last = int(time.time())
while True:
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for timer {}".format(name))
return
time_now = int(time.time())
if time_now > time_last + intvl:
self.log.debug("[{}] Executing timed function".format(time_now))
# TODO: The following if/else could probably be simplified somehow
if args is not None:
if kwargs:
action(*args, **kwargs)
else:
action(*args)
else:
if kwargs:
action(**kwargs)
else:
action()
time_last = time_now # Reset previous time
time.sleep(0.1)
# Start available action in a thread
for key in self.__actions:
# Create Thread object
thread = threading.Thread(
target=run_action,
name=key,
args=(
key,
self.__actions[key]["producer"],
self.__actions[key]["consumer"],
self.__actions[key]["signal"],
),
)
thread.daemon = False
thread.start()
self.__threads[key] = thread
# Start available timers in a thread
for key in self.__timers:
# Create Thread object
thread = threading.Thread(
target=run_timer,
name=key,
args=(
key,
self.__timers[key]["action"],
self.__timers[key]["intvl"],
self.__timers[key]["signal"],
self.__timers[key]["args"],
),
kwargs=self.__timers[key]["kwargs"],
)
thread.daemon = False
thread.start()
def stop(force):
"""Stop threads."""
for key in self.__threads:
if not self.__threads[key].is_alive() or force:
self.log.trace("Raise stop signal for {}".format(self.__threads[key].getName()))
self.__actions[key]["signal"].raise_stop()
self.log.trace("Call interrupt for {}".format(self.__threads[key].getName()))
self.__actions[key]["interrupt"]()
self.log.trace("Joining {}".format(self.__threads[key].getName()))
self.__threads[key].join(timeout=0.1)
# If all threads have died, exit
if not all([self.__threads[key].is_alive() for key in self.__threads]) or force:
if force:
sys.exit(1)
else:
sys.exit(0)
try:
while True:
stop(False)
# Need a timeout to not skyrocket the CPU
time.sleep(0.1)
except KeyboardInterrupt:
print()
stop(True)
Ancestors (in MRO)
Static methods
def __init__(
self)
Constructor.
def __init__(self):
"""Constructor."""
self.log = logging.getLogger(__name__)
def add_action(
self, action)
Enables a function to run threaded by the producer/consumer runner.
:param str name: Name for logging output :param function producer: A generator function which yields data :param function consumer: A callback which consumes data from the generator :param function interrupter: A func that signals a stop event to the producer
def add_action(self, action):
"""
Enables a function to run threaded by the producer/consumer runner.
:param str name: Name for logging output
:param function producer: A generator function which yields data
:param function consumer: A callback which consumes data from the generator
:param function interrupter: A func that signals a stop event to the producer
"""
assert "name" in action
assert "producer" in action
assert "consumer" in action
assert "signal" in action
assert "interrupt" in action
self.__actions[action["name"]] = {
"name": action["name"],
"producer": action["producer"],
"consumer": action["consumer"],
"signal": action["signal"],
"interrupt": action["interrupt"],
}
def add_timer(
self, timer)
def add_timer(self, timer):
self.__timers[timer["name"]] = {
"action": timer["action"],
"intvl": timer["intvl"],
"args": timer["args"] if "args" in timer else None,
"kwargs": timer["kwargs"] if "kwargs" in timer else {},
"signal": timer["signal"],
}
def run(
self)
Run threaded NetCat.
def run(self):
"""Run threaded NetCat."""
def run_action(name, producer, consumer, ssig):
"""
Receive data (network, user-input, shell-output) and process it (send, output).
:param str name: Name for logging output
:param function producer: A generator function which yields data
:param function consumer: A callback which consumes data from the generator
:param StopSignal ssig: Providing has_stop() and raise_stop()
"""
self.log.trace("[{}] Producer Start".format(name))
for data in producer(ssig):
self.log.trace("[{}] Producer received: {}".format(name, repr(data)))
consumer(data)
self.log.trace("[{}] Producer Stop".format(name))
def run_timer(name, action, intvl, ssig, *args, **kwargs):
"""Execute periodic tasks by an optional provided time_action."""
self.log.trace("[{}] Timer Start (exec every {} sec)".format(name, intvl))
time_last = int(time.time())
while True:
if ssig.has_stop():
self.log.trace("Stop signal acknowledged for timer {}".format(name))
return
time_now = int(time.time())
if time_now > time_last + intvl:
self.log.debug("[{}] Executing timed function".format(time_now))
# TODO: The following if/else could probably be simplified somehow
if args is not None:
if kwargs:
action(*args, **kwargs)
else:
action(*args)
else:
if kwargs:
action(**kwargs)
else:
action()
time_last = time_now # Reset previous time
time.sleep(0.1)
# Start available action in a thread
for key in self.__actions:
# Create Thread object
thread = threading.Thread(
target=run_action,
name=key,
args=(
key,
self.__actions[key]["producer"],
self.__actions[key]["consumer"],
self.__actions[key]["signal"],
),
)
thread.daemon = False
thread.start()
self.__threads[key] = thread
# Start available timers in a thread
for key in self.__timers:
# Create Thread object
thread = threading.Thread(
target=run_timer,
name=key,
args=(
key,
self.__timers[key]["action"],
self.__timers[key]["intvl"],
self.__timers[key]["signal"],
self.__timers[key]["args"],
),
kwargs=self.__timers[key]["kwargs"],
)
thread.daemon = False
thread.start()
def stop(force):
"""Stop threads."""
for key in self.__threads:
if not self.__threads[key].is_alive() or force:
self.log.trace("Raise stop signal for {}".format(self.__threads[key].getName()))
self.__actions[key]["signal"].raise_stop()
self.log.trace("Call interrupt for {}".format(self.__threads[key].getName()))
self.__actions[key]["interrupt"]()
self.log.trace("Joining {}".format(self.__threads[key].getName()))
self.__threads[key].join(timeout=0.1)
# If all threads have died, exit
if not all([self.__threads[key].is_alive() for key in self.__threads]) or force:
if force:
sys.exit(1)
else:
sys.exit(0)
try:
while True:
stop(False)
# Need a timeout to not skyrocket the CPU
time.sleep(0.1)
except KeyboardInterrupt:
print()
stop(True)
Instance variables
var log
class StopSignal
class StopSignal(object):
__stop = False
def has_stop(self):
return self.__stop
def raise_stop(self):
self.__stop = True
Ancestors (in MRO)
Static methods
def has_stop(
self)
def has_stop(self):
return self.__stop
def raise_stop(
self)
def raise_stop(self):
self.__stop = True
class StringEncoder
Takes care about Python 2/3 string encoding/decoding.
This allows to parse all string/byte values internally between all classes or functions as strings to keep full Python 2/3 compat.
class StringEncoder(object):
"""
Takes care about Python 2/3 string encoding/decoding.
This allows to parse all string/byte values internally between all
classes or functions as strings to keep full Python 2/3 compat.
"""
# https://stackoverflow.com/questions/606191/27527728#27527728
codec = "cp437"
def __init__(self):
self.py3 = sys.version_info >= (3, 0)
def encode(self, data):
"""Convert string into a byte type for Python3."""
if self.py3:
data = data.encode(self.codec)
return data
def decode(self, data):
"""Convert bytes into a string type for Python3."""
if self.py3:
data = data.decode(self.codec)
return data
Ancestors (in MRO)
Class variables
var codec
Static methods
def __init__(
self)
Initialize self. See help(type(self)) for accurate signature.
def __init__(self):
self.py3 = sys.version_info >= (3, 0)
def decode(
self, data)
Convert bytes into a string type for Python3.
def decode(self, data):
"""Convert bytes into a string type for Python3."""
if self.py3:
data = data.decode(self.codec)
return data
def encode(
self, data)
Convert string into a byte type for Python3.
def encode(self, data):
"""Convert string into a byte type for Python3."""
if self.py3:
data = data.encode(self.codec)
return data
Instance variables
var py3
class TraceLogger
Logger class with additional TRACE level logging.
class TraceLogger(logging.Logger):
"""Logger class with additional TRACE level logging."""
LEVEL_NUM = 9
LEVEL_NAME = "TRACE"
def __init__(self, name, level=logging.NOTSET):
super(TraceLogger, self).__init__(name, level)
logging.addLevelName(self.LEVEL_NUM, self.LEVEL_NAME)
def trace(self, msg, *args, **kwargs):
"""Set custom log level for TRACE."""
if self.isEnabledFor(self.LEVEL_NUM):
self._log(self.LEVEL_NUM, msg, args, **kwargs)
Ancestors (in MRO)
Class variables
var LEVEL_NAME
var LEVEL_NUM
var manager
var root
Static methods
def __init__(
self, name, level=0)
Initialize the logger with a name and an optional level.
def __init__(self, name, level=logging.NOTSET):
super(TraceLogger, self).__init__(name, level)
logging.addLevelName(self.LEVEL_NUM, self.LEVEL_NAME)
def addFilter(
self, filter)
Add the specified filter to this handler.
def addFilter(self, filter):
"""
Add the specified filter to this handler.
"""
if not (filter in self.filters):
self.filters.append(filter)
def addHandler(
self, hdlr)
Add the specified handler to this logger.
def addHandler(self, hdlr):
"""
Add the specified handler to this logger.
"""
_acquireLock()
try:
if not (hdlr in self.handlers):
self.handlers.append(hdlr)
finally:
_releaseLock()
def callHandlers(
self, record)
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the logger hierarchy. If no handler was found, output a one-off error message to sys.stderr. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last logger whose handlers are called.
def callHandlers(self, record):
"""
Pass a record to all relevant handlers.
Loop through all handlers for this logger and its parents in the
logger hierarchy. If no handler was found, output a one-off error
message to sys.stderr. Stop searching up the hierarchy whenever a
logger with the "propagate" attribute set to zero is found - that
will be the last logger whose handlers are called.
"""
c = self
found = 0
while c:
for hdlr in c.handlers:
found = found + 1
if record.levelno >= hdlr.level:
hdlr.handle(record)
if not c.propagate:
c = None #break out
else:
c = c.parent
if (found == 0):
if lastResort:
if record.levelno >= lastResort.level:
lastResort.handle(record)
elif raiseExceptions and not self.manager.emittedNoHandlerWarning:
sys.stderr.write("No handlers could be found for logger"
" \"%s\"\n" % self.name)
self.manager.emittedNoHandlerWarning = True
def critical(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
def critical(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
"""
if self.isEnabledFor(CRITICAL):
self._log(CRITICAL, msg, args, **kwargs)
def debug(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
def debug(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'DEBUG'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
"""
if self.isEnabledFor(DEBUG):
self._log(DEBUG, msg, args, **kwargs)
def error(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'ERROR'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.error("Houston, we have a %s", "major problem", exc_info=1)
def error(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'ERROR'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.error("Houston, we have a %s", "major problem", exc_info=1)
"""
if self.isEnabledFor(ERROR):
self._log(ERROR, msg, args, **kwargs)
def exception(
self, msg, *args, **kwargs)
Convenience method for logging an ERROR with exception information.
def exception(self, msg, *args, exc_info=True, **kwargs):
"""
Convenience method for logging an ERROR with exception information.
"""
self.error(msg, *args, exc_info=exc_info, **kwargs)
def fatal(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
def critical(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'CRITICAL'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.critical("Houston, we have a %s", "major disaster", exc_info=1)
"""
if self.isEnabledFor(CRITICAL):
self._log(CRITICAL, msg, args, **kwargs)
def filter(
self, record)
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero.
.. versionchanged:: 3.2
Allow filters to be just callables.
def filter(self, record):
"""
Determine if a record is loggable by consulting all the filters.
The default is to allow the record to be logged; any filter can veto
this and the record is then dropped. Returns a zero value if a record
is to be dropped, else non-zero.
.. versionchanged:: 3.2
Allow filters to be just callables.
"""
rv = True
for f in self.filters:
if hasattr(f, 'filter'):
result = f.filter(record)
else:
result = f(record) # assume callable - will raise if not
if not result:
rv = False
break
return rv
def findCaller(
self, stack_info=False, stacklevel=1)
Find the stack frame of the caller so that we can note the source file name, line number and function name.
def findCaller(self, stack_info=False, stacklevel=1):
"""
Find the stack frame of the caller so that we can note the source
file name, line number and function name.
"""
f = currentframe()
#On some versions of IronPython, currentframe() returns None if
#IronPython isn't run with -X:Frames.
if f is not None:
f = f.f_back
orig_f = f
while f and stacklevel > 1:
f = f.f_back
stacklevel -= 1
if not f:
f = orig_f
rv = "(unknown file)", 0, "(unknown function)", None
while hasattr(f, "f_code"):
co = f.f_code
filename = os.path.normcase(co.co_filename)
if filename == _srcfile:
f = f.f_back
continue
sinfo = None
if stack_info:
sio = io.StringIO()
sio.write('Stack (most recent call last):\n')
traceback.print_stack(f, file=sio)
sinfo = sio.getvalue()
if sinfo[-1] == '\n':
sinfo = sinfo[:-1]
sio.close()
rv = (co.co_filename, f.f_lineno, co.co_name, sinfo)
break
return rv
def getChild(
self, suffix)
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logger is named using name rather than a literal string.
def getChild(self, suffix):
"""
Get a logger which is a descendant to this one.
This is a convenience method, such that
logging.getLogger('abc').getChild('def.ghi')
is the same as
logging.getLogger('abc.def.ghi')
It's useful, for example, when the parent logger is named using
__name__ rather than a literal string.
"""
if self.root is not self:
suffix = '.'.join((self.name, suffix))
return self.manager.getLogger(suffix)
def getEffectiveLevel(
self)
Get the effective level for this logger.
Loop through this logger and its parents in the logger hierarchy, looking for a non-zero logging level. Return the first one found.
def getEffectiveLevel(self):
"""
Get the effective level for this logger.
Loop through this logger and its parents in the logger hierarchy,
looking for a non-zero logging level. Return the first one found.
"""
logger = self
while logger:
if logger.level:
return logger.level
logger = logger.parent
return NOTSET
def handle(
self, record)
Call the handlers for the specified record.
This method is used for unpickled records received from a socket, as well as those created locally. Logger-level filtering is applied.
def handle(self, record):
"""
Call the handlers for the specified record.
This method is used for unpickled records received from a socket, as
well as those created locally. Logger-level filtering is applied.
"""
if (not self.disabled) and self.filter(record):
self.callHandlers(record)
def hasHandlers(
self)
See if this logger has any handlers configured.
Loop through all handlers for this logger and its parents in the logger hierarchy. Return True if a handler was found, else False. Stop searching up the hierarchy whenever a logger with the "propagate" attribute set to zero is found - that will be the last logger which is checked for the existence of handlers.
def hasHandlers(self):
"""
See if this logger has any handlers configured.
Loop through all handlers for this logger and its parents in the
logger hierarchy. Return True if a handler was found, else False.
Stop searching up the hierarchy whenever a logger with the "propagate"
attribute set to zero is found - that will be the last logger which
is checked for the existence of handlers.
"""
c = self
rv = False
while c:
if c.handlers:
rv = True
break
if not c.propagate:
break
else:
c = c.parent
return rv
def info(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
def info(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'INFO'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.info("Houston, we have a %s", "interesting problem", exc_info=1)
"""
if self.isEnabledFor(INFO):
self._log(INFO, msg, args, **kwargs)
def isEnabledFor(
self, level)
Is this logger enabled for level 'level'?
def isEnabledFor(self, level):
"""
Is this logger enabled for level 'level'?
"""
if self.disabled:
return False
try:
return self._cache[level]
except KeyError:
_acquireLock()
try:
if self.manager.disable >= level:
is_enabled = self._cache[level] = False
else:
is_enabled = self._cache[level] = (
level >= self.getEffectiveLevel()
)
finally:
_releaseLock()
return is_enabled
def log(
self, level, msg, *args, **kwargs)
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
def log(self, level, msg, *args, **kwargs):
"""
Log 'msg % args' with the integer severity 'level'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.log(level, "We have a %s", "mysterious problem", exc_info=1)
"""
if not isinstance(level, int):
if raiseExceptions:
raise TypeError("level must be an integer")
else:
return
if self.isEnabledFor(level):
self._log(level, msg, args, **kwargs)
def makeRecord(
self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None, sinfo=None)
A factory method which can be overridden in subclasses to create specialized LogRecords.
def makeRecord(self, name, level, fn, lno, msg, args, exc_info,
func=None, extra=None, sinfo=None):
"""
A factory method which can be overridden in subclasses to create
specialized LogRecords.
"""
rv = _logRecordFactory(name, level, fn, lno, msg, args, exc_info, func,
sinfo)
if extra is not None:
for key in extra:
if (key in ["message", "asctime"]) or (key in rv.__dict__):
raise KeyError("Attempt to overwrite %r in LogRecord" % key)
rv.__dict__[key] = extra[key]
return rv
def removeFilter(
self, filter)
Remove the specified filter from this handler.
def removeFilter(self, filter):
"""
Remove the specified filter from this handler.
"""
if filter in self.filters:
self.filters.remove(filter)
def removeHandler(
self, hdlr)
Remove the specified handler from this logger.
def removeHandler(self, hdlr):
"""
Remove the specified handler from this logger.
"""
_acquireLock()
try:
if hdlr in self.handlers:
self.handlers.remove(hdlr)
finally:
_releaseLock()
def setLevel(
self, level)
Set the logging level of this logger. level must be an int or a str.
def setLevel(self, level):
"""
Set the logging level of this logger. level must be an int or a str.
"""
self.level = _checkLevel(level)
self.manager._clear_cache()
def trace(
self, msg, *args, **kwargs)
Set custom log level for TRACE.
def trace(self, msg, *args, **kwargs):
"""Set custom log level for TRACE."""
if self.isEnabledFor(self.LEVEL_NUM):
self._log(self.LEVEL_NUM, msg, args, **kwargs)
def warn(
self, msg, *args, **kwargs)
def warn(self, msg, *args, **kwargs):
warnings.warn("The 'warn' method is deprecated, "
"use 'warning' instead", DeprecationWarning, 2)
self.warning(msg, *args, **kwargs)
def warning(
self, msg, *args, **kwargs)
Log 'msg % args' with severity 'WARNING'.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
def warning(self, msg, *args, **kwargs):
"""
Log 'msg % args' with severity 'WARNING'.
To pass exception information, use the keyword argument exc_info with
a true value, e.g.
logger.warning("Houston, we have a %s", "bit of a problem", exc_info=1)
"""
if self.isEnabledFor(WARNING):
self._log(WARNING, msg, args, **kwargs)


--- layout: post title: Rails 3 Beginner to Builder 2011 (Final) Week 8 date: '2011-08-08T10:56:00-05:00' tags: - Rails-3-beginner-to-builder-2011 - rails - ruby - memcache - cache - view - cells - partials - acceptance testing - capybara - rspec - factory girl - rails.cache permalink: /post/8645603022/rails-3-beginner-to-builder-2011-final-week-8 ---
This is final part of my Rails 3: Beginner to Builder series. https://www.schneems.com/beginner-to-builder-2011
Closing assignment:
Rails 3 Beginner to Builder 2011 Week 8 from richard schneeman on Vimeo.
Rails 3 Beginner to Builder 2011 Week 8 View more presentations from Richard Schneeman
Topics:
It was a pleasure teaching, hope you enjoyed the class as much as I enjoyed teaching it.


pros
Businessmodel of PROS
Customer Segments
PROS provides a range of enterprise revenue and profit realisation software solutions to commercial and institutional clients across multiple industries. The Company organises its customers into the following categories:
- Automotive and Industrial, comprising various automotive manufacturers and service providers, as well as other industrial manufacturers and operators;
- Consumer Goods, comprising manufacturers, distributors, and retailers of various consumer goods products;
- Insurance, comprising small, medium, and large insurance providers;
- Business-to-Business Services, comprising business-to-business service providers, and general and specialist consulting firms;
- Food and Beverage, comprising food and beverage producers and distributors;
- Travel, comprising travel operators and agencies, travel service providers, and transportation companies;
- Cargo, Freight and Logistics, comprising various logistics, courier, and delivery service providers;
- Chemicals and Energy, comprising chemical processing and production companies, oil and gas production and distribution companies, and energy producers;
- Healthcare, comprising healthcare organisations and healthcare service companies, as well as pharmaceutical and life science companies; and
- Technology, comprising technology companies, and electronics manufacturers and distributors. PROS includes a number of well-known companies among its clients, including household names such as Qantas, Honeywell, Hertz, Hewlett Packard, Etihad Airways, and BASF. In 2015 no single customer accounted for 10% or more of the Company’s total revenue.
PROS’s largest market is its native US. The Company also serves a large global client base, with significant operations across Europe.
Value Propositions
PROS provides value to its clients in the following ways:
- Its industry standing and reputation, with the Company established as a leading provider of enterprise revenue and profit realisation software, serving a range of high-profile companies and having a positive track record;
- Its international sales reach, with the Company providing products globally, serving an extensive client base in its native US, as well as a substantial number of customers across Europe and further afield;
- Its proprietary technologies, with the Company utilising a range of proprietary technologies in the development and implementation of its solutions, committing a substantial portion of its resources to innovation and research operations; and
- Its industry expertise and experience, with the Company employing specialist technical personnel across its enterprise, enabling it to provide specific technical services, as well as a team of experienced industry executives. ### Channels
PROS operates a website at www.pros.com, through which it provides information on its various products, services, target industries, and partners. While the Company provides details of its various products, and offers a tool by which customers can identify the most appropriate solutions, it does not operate an online sales channel.
The Company’s solutions are delivered principally under a cloud-based software-as-a-service model, enabling customers to implement, access and use our software on the PROS cloud via an internet connection.
PROS markets and sells its products directly through its international direct sales force, which is organised into four target markets: manufacturing, distribution, services, and travel.
The Company’s sales operations are also organised geographically, with the sales personnel operating out of the Company’s principal offices in London, Paris, Toulouse, Munich, San Francisco, Skokie, and Austin. PROS’s sales force works in conjunction with its solutions personnel for selling and providing solution demonstrations to new customers.
Additionally, PROS sell and markets its software solutions indirectly through a network of channel partners, including authorised value added resellers and systems integrators.
Customer Relationships
Despite its online presence, PROS does not make sales to its customers on a self-service basis. The Company does, however, provide tools through its website that can be accessed independently and allows clients to arrange demonstrations online. Once purchased, the Company’s cloud-based solutions can be accessed by clients at any time, without any additional interaction with sales or service personnel.
PROS makes the bulk of its sales through its direct sales force, the members of which consult directly with clients over a period of time and provide software demonstrations, in order to ensure customers are provided the most appropriate solutions. The Company seeks to tailor its offerings where possible and establish long-term customer relationships.
PROS provides ongoing support to its customers, who can access personalised technical assistance from dedicated service personnel, across all the Company’s operating jurisdictions, either over the phone or by email. The Company makes a range of online resources available through its website, including white papers, data sheets, and on-demand webinars, which can be accessed independently.
Additionally, PROS operates social media accounts with Facebook, Twitter, LinkedIn, Google+, and YouTube, through which it provides company updates and interacts directly with customers. It also provides information on its various upcoming events, enabling clients to attend and interact with company representatives in person.
Key Activities
PROS provides a range of enterprise revenue and profit realisation software solutions that are designed to support the operations of business-to-business and business-to-consumer companies.
The Company also provides certain professional services regarding the implementation of its various software applications. PROS serves a broad range of industries – including the manufacturing, distribution, services and travel, consumer goods, insurance, chemicals and energy, and healthcare sectors – as well as a range of global markets, notably across North America and Europe.
PROS provides ongoing support services to its clients, including product maintenance and technical assistance, upgrades, maintenance releases and bug fixes. PROS’s solutions are provided on a software-as-a-service basis under fixed-term subscriptions.
Key Partners
PROS works closely with a broad network of partner companies and organisations that ensure the Company is able to provide effective and reliable solutions. These partners can be organised broadly into the following categories:
- Technology Partners, comprising technology companies, software developers, and application developers that assist in the development and maintenance of the Company’s software solutions;
- Advisory and Consulting, comprising various general and corporate consulting firms, as well as specialist technical advisory firms that provide ongoing support and advisory services concerning the Company’s various activities;
- Channel and Distribution Partners, comprising a network of third party channel partners, such as value added resellers and systems integrators, that support the distribution, delivery, and implementation of the Company’s products; and
- Strategic and Alliance Partners, comprising market leading companies across multiple sectors with which the Company collaborates on various joint projects, including marketing, branding, and other projects. PROS has a number of key strategic partnerships in place. The Company lists many of its partners on its website, including technology partners Microsoft, Salesforce, and SAP; systems integrator partners Accenture, Deloitte, and Capgemini; and advisory partners Novus CPQ Consulting, Akribis Exact, and Beanstalk Revenue Management.
Key Resources
PROS’s key resources are its proprietary technologies and intellectual properties, its software solutions and platform, its IT and communications infrastructure, its network of sales and distribution channels, its partnerships, and its personnel.
PROS’s ability to develop and implement innovative solutions is dependent on the protection of its proprietary technologies and intellectual properties. The Company relies principally on trade secrets and unpatented proprietary know-how, rather than patent and trademark protection, to secure these properties. Searches of records published by the US Patent and Trademark Office identified no patent applications filed in PROS’s name.
PROS also owns and or leases a number of physical properties around the world that utilises as its office network, including locations across the US, the UK, France, and Germany.
Cost Structure
PROS incurs costs in relation to the development of its technologies and solutions, the maintenance of its IT and communications infrastructure, the procurement of professional services, the operation of its sales and marketing channels, the management of its partnerships, and the retention of its personnel.
In 2015 PROS recorded total operating expenses in the amount of $24.14 million, comprising selling and marketing expenses in the amount of $8.54 million, general and administrative expenses in the amount of $10.29 million, and research and development expenses in the amount of $5.32 million.
Revenue Streams
PROS generates revenue through the provision of various enterprise revenue and profit realisation software solutions. The Company derives its revenue primarily under a software-as-a-service model, typically via-three year subscriptions with pricing based on the number of users, data volume and revenue managed by the software.
In 2015 PROS generated revenue for the year of $168.25 million, down on the $185.83 million recorded by the Company in 2014.