Three macros that demonstrate the effects of transparency within AVS/Express and how acceptable image quality and performance can be achieved.
Input Ports
Name Type Description in_fld Field Data that should be displayed. transparency float Amount of transparency to use. Output Ports
Name Type Description out_obj GDobject Directly renderable object output.
The rendering of transparent objects can be useful in a number of visualization situations. For instance within a medical visualization it can be very useful to have the surface of the body visible as a transparent object. This can help give context to the rest of the visualization. However due to the way that AVS/Express currently deals with transparent polygons the use of this technique is limited to very simple situations. This project provides a simple technique for rendering transparent objects which overcomes this limitation.
The underlying 3D graphics system that Express uses represents the results of a visualization as a large number of triangles. To generate the image that is seen on screen these triangles are rendered in the order that they were generated. Rendering a triangle involves transforming it from the 3D space of the visualization to the 2D space of the computer screen and then determining if it overlaps any existing triangles. If it does then the graphics system determines if the triangle is in front of or behind the existing triangle. If the triangle does not overlap or if it is in front the triangle is rendered, overwriting what was behind it. If it is behind then it is discarded.
The important things to take from this discussion is that triangles can be rendered in any arbitrary order and that depth sorting is done as the image is rendered. If we consider the case of transparent triangles the situation becomes rather more complex. When a transparent triangle is rendered the colour of the triangle is blended with whatever is behind it to give the illusion that the triangle is partially transparent. This works correctly if the background has already been rendered. However it is possible for the background to be rendered after the foreground. In this case the depth sorting discards the background triangle and does not change the image. This can lead to artifacts in the image where it is possible to see through some triangles but not through others. By default Express suffers from this problem. This can be seen in the Transparency1Pass macro.
To solve this problem we would ideally like to sort the triangles by how far they are from the viewer/camera and then render the most distant triangles first. This is the method normally used when the quality of transparency is vital to the application. Unfortunately implementing this would require changing the core of Express, which is not possible. The Transparency2Pass macro provides an alternative to full depth sorting which does not require internal alterations to Express.
If we consider a simple convex object such as a sphere or a cube we can see that all the nearest surfaces face towards the viewer and all the farthest surfaces face away from the viewer. Express does provide a way to render only those surfaces facing towards or away from the viewer. Originally this was intended as a simple way of reducing the number or triangles that had to be processed. However it can be used as a simple form of depth sorting by making two passes over the object. For a convex object if we first render all the triangles facing away from the viewer and then render all the triangles facing towards the viewer we can be sure that all the background triangles have been drawn first. This is what the Transparency2Pass macro does.
This technique does have 2 major limitations. For more complex concave objects the quality of the results obtained are variable. In a concave object there can be several obscuring surfaces. Hence we cannot state that all surfaces that face towards the viewer are nearer than all surfaces that away from the viewer. Therefore this simple form of depth sorting will not work. However in practical situations we find that many concave objects do appear correct when rendered using this technique. The image quality is certainly much higher then it is when no depth sorting is performed. The TransparencyEg application illustrates this by rendering a transparent teapot object.
The second major limitation is that this technique does not deal with multiple transparent objects. AVS/Express does always render non-transparent objects before transparent objects. Hence non-transparent objects will always be visible through transparent objects. However the order in which transparent objects are rendered is important. In some situations it is possible to know which order objects should be rendered in. For instance if one object is completely enclosed by another the inner object should be rendered first. This is shown in the TransparencyOrderingEg example application. However in general it does not appear to be possible to sort transparent objects with making changes to the core of AVS/Express.
Three user macros are provided with this project:
Tranparency1Pass
Performs standard 1 pass transparency rendering. This is provided to illustrate how AVS/Express performs normally.Tranparency2Pass
Performs 2 pass transparency rendering. This renders backwards facing polygons before forwards facing polygons. In normal situations this user macro should be used.ReverseTranparency2Pass
Performs reversed 2 pass transparency rendering. This renders forwards facing polygons before backwards facing polygons. This user macro can be used if the face normals not facing outwards.
in_fld
Field data that should be be rendered as a transparent object. The input data can be any standard field data.
transparency
Amount of transparency that should be applied to the object. A value of 0 implies that the object should be completely transparent and a value of 1 implies that the object should be completely opaque.
out_obj
Directly renderable output object that can be displayed in a 3D viewer. In the Transparency1Pass macro this output is a link to a single DataObject. In the other 2 pass macros this output is a link to a GroupObject that contains a back DataObject and a front DataObject.
Two utility macros are provided that generate user interfaces for the TransparencyEg and TransparencyOrderingEg example applications.
xp_comm_proj/t_2_pass/t_2pmacs.v contains the V definitions of the TransparencyEgUI and TransparencyOrderingEgUI user interface macros, and the Transparency1Pass, Transparency2Pass and ReverseTransparency2Pass user macros.
xp_comm_proj/t_2_pass/t_2papps.v contains the V definitions of the TransparencyEg and TransparencyOrderingEg example applications.
Two example applications are provided with this project. The TransparencyEg application demonstrates the use of the 3 user macros and the difference between each rendering technique. It does this by loading and rendering a transparent teapot. The TransparencyOrderingEg demonstrates the effect of changing the order of 2 transparent objects.
This project does not contain any procedural code and hence does not require compiling.
Ian Curington, AVS Inc.
Andrew Dodd, IAC


Our goal is to develop bug-free software. As a rule we have declared to fix bugs before we continue developing new features.


Color Mode
default
average
Color By
rank
frequency
groupedFrequency
count
reference
Order By
rank
frequency
groupedFrequency
count
Match On
word
rank
frequency
groupedFrequency
count
Color Scheme
Blue-Yellow Sequential
Red-Blue Diverging
Purple-Orange Diverging
Grey
Ramp Theme
Blue-Yellow Sequential
Red-Blue Diverging
Purple-Orange Diverging
Grey
Inverted Coloring
Reference Ordering
Please Select a Dataset
Simple Test Dataset
Shakespeare Folio (N-Grams)
Shakespeare Folio (Raw Text)
Top 200 Google N-Grams (1660-2009)
Top 1000 Google N-Grams (1660-2009)
Top 5000 Google N-Grams (1660-2009)
My Data:


The class DateTime provides extended functionality for QDateTime. More...
#include <datetime.h>
Public Member Functions | |
| DateTime () | |
| DateTime (const QDateTime &rOther) | |
| DateTime (const QDate &rDate, const QTime &rTime, Qt::TimeSpec timeSpec=Qt::LocalTime) | |
| DateTime & | operator= (const DateTime &rOther) |
| qint64 | toMilliSeconds () const |
| QString | toString (const QString &rFormat) const |
Static Public Member Functions | |
| static DateTime | currentDateTime () |
| static DateTime | fromMilliSeconds (qint64 milliSeconds) |
The class DateTime provides extended functionality for QDateTime.
The class DateTime implements additional formatting options for toString() and provides conversion functions from and to milliseconds.
| Log4Qt::DateTime::DateTime | ( | ) | [inline] |
Constructs a null date time.
Referenced by currentDateTime(), and fromMilliSeconds().
| Log4Qt::DateTime::DateTime | ( | const QDateTime & | rOther | ) | [inline] |
Constructs a copy of another QDateTime.
| Log4Qt::DateTime::DateTime | ( | const QDate & | rDate, | |
| const QTime & | rTime, | |||
| Qt::TimeSpec | timeSpec = Qt::LocalTime | |||
| ) | [inline] |
Constructs a datetime with the given rDate and rTime, using the time specification defined by timeSpec.
| DateTime Log4Qt::DateTime::currentDateTime | ( | ) | [inline, static] |
Returns the current datetime, as reported by the system clock, in the local time zone.
References DateTime().
| DateTime Log4Qt::DateTime::fromMilliSeconds | ( | qint64 | milliSeconds | ) | [inline, static] |
Returns a datetime whose date and time are the number of milliseconds that have passed since 1970-01-01T00:00:00, Coordinated Universal Time (Qt::UTC).
References DateTime().
Assigns rOther to this DateTime and returns a reference to it.
| qint64 Log4Qt::DateTime::toMilliSeconds | ( | ) | const [inline] |
Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00,000, Coordinated Universal Time (Qt::UTC).
| QString Log4Qt::DateTime::toString | ( | const QString & | rFormat | ) | const |
Returns the datetime as a string. The rFormat parameter determines the format of the result string.
In addition to the expressions of QDateTime::toString(const QString &rFormat) the following expression can be used.
| Expression | Output |
|---|---|
| w | the week of the year as number without a leading zero (1 to 53) |
| ww | the week of the year as number with a leading zero (01 to 53) |
Alternatively the rFormat parameter can specify one of the following strings.
| String | Format |
|---|---|
| ABSOLUTE | uses the format HH:mm:ss.zzz |
| DATE | uses the format dd MMM YYYY HH:mm:ss.zzzz |
| ISO8601 | uses the format yyyy-MM-dd hh:mm:ss.zzz |
| NONE | uses an empty string as format |
| RELATIVE | returns the milliseconds since start of the program |


| DOSE: |
|
insufflated |
Cocaine |
(powder / crystals) |
Ah Cocaine... Is there anything on Earth that does me like you do?
I am a 21 year old cocaine user. I began using drugs at the age of 14 during my search for truth. I had studied philosophy extensively, and had found that the so-called 'destructive philosophies' (anarchism, nihilism, destructuralism, etc.) most appealed to me at the time. Drug use fit nicely into my worldview, as using drugs is not the most constructive activity out there. I began smoking marijuana, and was absolutely astounded at the effects that it produced. My normal ponderings took on a character of profundity, I explored avenues of logic that had never occurred to me, in short, cannibis opened my eyes to a whole new world. Basically, the only major drawback to marijuana were the decidedly lethargic symptoms that always afflicted me after a short duration of THC stimulation. Clearly, pot was lacking in its fundamental pharmacology, as far as my preferences go.
Over the course of the next two years, I experimented with LSD, DXM, psilocibin, DMT, mescaline, ketamine, and other sundry substances. The hallucinogens each taught me something about the nature of reality and self-consciousness. Some truths revealed unto me seemed to be the secrets of the universe itself, at the time. But, inevitably, as the drugs lost effect, the mystical character of the 'revelations' wore off as well. Hallucinogens, although VERY interesting substances, simply lacked that glorious sensation of omnipotence which I sought fervently, and was later to know all too well.
I first tried cocaine when I was sixteen. I had attempted to procure some pot or hash, both of which I still smoke occasionally to this day, but was unable to locate any. A friend informed me that while he couldn't get his hands onto any cannabis products, he did have a connection for cheap, reasonably high-quality cocaine. As my inquisitve nature dictated, I jumped in head first with gusto. I had been around cocaine users, and had seen the drug consumed several times before, so I was not apprehensive during the preparation process. The people under the influence of cocaine that I had interacted with in the past universally praised its effects, and I had seen nothing to disabuse myself of that appraisal.
When I finally put the straw to my right nostril and inhaled sharply, I was very surprised to find that the burning sensation of cocaine HCL was nowhere near as intense as that produced by, for example, ketamine. I also found that I rather enjoyed the bitter, acid flavor of cocaine. What really took me by surprise were the effects. I had finally found the ideal drug. My thinking was rapid, yet lucid. The profundity of thought that I had so enjoyed with pot was present, but amplified immeasurably. The best part was the feeling of being all-powerful, and completely uninhibited. With my mental abilities running in high gear, I felt competent to converse at length on any subject, with anyone. In short, I felt like a God.
In the five years since that fateful evening, I have evolved into a semi-regular user of cocaine. I went through a period of intensified usage that began shortly after being introduced to cocaine, and lasted about a year. I was transgressing my personal values in order to acquire cocaine. In simpler terms, I was robbing houses, ripping people off, and doing other things that I never would have dreamt of doing otherwise. I also began selling cocaine. At the height of this period, I was using approximately 2-3 grams a day. Fortunately, I recognized the inherent destructiveness in this course of action before I got into serious trouble. It appears that those long hours of philosophical study were not all for naught. I quit using cocaine altogether, and after those trying times were a distant memory, I became convinced that I could control my intake of cocaine, and with some serious reflection and soul searching, I have found that indeed I can. But my experience is not typical.
These days, four years after I initially quit using cocaine, I only use cocaine to boost my motivation during particularly difficult academic trials, or physical labor. I no longer use cocaine simply to enjoy its effects. I feel truly blessed to possess the degree of self-control which I do. I believe that it has been my disgust with regards to my personal recreational cocaine use which prevented me from becoming addicted. Presently, I use cocaine much as others use caffine, and I intend to keep it that way. My total monthly expenditure on cocaine is less than $20 US. I have been engaged in this pattern of use for roughly two years, and feel confident about my ability to limit myself.
Many of my friends use cocaine, with varying results. There are those who are in much the same situation as I, cocaine users who manage to maintain a semblance of normality. On the other hand, some have become extremely addicted to crack, which I have tried only once, and will never try again. After seeing firsthand the ravages of crack addiction, I am strongly biased against this substance. To be perfectly frank, cocaine is NOT a benevolent substance. It seems that my experience is the exception rather than the rule. I don't think that cocaine should be prohibited outright, but I do feel that were it to be legalized, stringent measures would have to be implemented to prevent major abuse.
All in all, I feel that cocaine use can be both extremely dangerous, and extremely rewarding, for a time anyway. It is that element of uncertainty which should give one pause. You never know if you're going to have an enlightening fling with cocaine, or if it will drag you into the depths of depravity and human misery.
Mojo
P.S. I'm sure you are wondering why I consistently refer to cocaine as cocaine, not coke, blow, yayo, etc. I do this out of respect for a drug that has the power to both corrupt and instruct. It has taught me many valuable life lessons, whether for better or for worse.
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.


1. How many hours do you sleep on average each night?
2. During the past month, how woud you rate your sleep quaity overall?
3. Do you go to bed and wake up at the same time every day. Even on weekends?
4. How likely is it that you would fall asleep during the daytime without intending to or that you would struggle to stay awake while you were doing things?
5. How often do you have trouble going to sleep or staying asleep?
6. During the past 2 weeks, for about how many days did you have loud snoring?
7. During the past 2 weeks, for about how many days did you fall asleep while using you phone?


Reports assignments which can be replaced by an operator assignment.
Example:
a = a + b
After the quick-fix is applied:
a += b
Configure the inspection:
- Use the Ignore conditional operators option to ignore
&&
and ||
operators.
- Use the Ignore obscure operators option to ignore
^
and %
operators.


Usage¶
The base entry point is the AutoReloader
class. Before starting up your main program loop, instantiating an instance of this class will start a separate thread that watches for Python changes:
from some_module.print import announce_double_time
import some_module.math
from time import sleep
from mighty_patcher.watch import AutoReloader
reloader = AutoReloader(
path="/path/to/my/project/src/"
)
while True:
print(double(4))
sleep(10)
By default the reloader will print information related to errors on code reloading, but tries to be tolerant to errors so that your program doesn’t crash because you saved halfway through typing a file.
The reloader path is considered a module root, and the relative path of modified python files are used to determine what module they represent:
For example, here "/path/to/my/project/src/some_module/math.py"
would map to some_module.math
Because of how modules work, this will mostly be what you want. But if your project has various lookup paths set up (for example if some code refers to the math module as src.some_module.math
), then the file might not map over properly.
Changing behaviour on reload¶
If you are working on something that has global state that you don’t want to have thrown away on every reload, you can modify what your code does depending on whether it’s the initial load of the code or whether you are reloading this code:
# some_file.py
from mighty_patcher import currently_reloading
import time
# this dictionary will get reset to an empty state
_my_cache = {}
if not currently_reloading():
# this will get run on the first import of this file, but not on subsequent reloads
program_run_start = time.time()
number_of_restarts = 0
if currently_reloading():
# this block will only run on reloads
number_of_restarts += 1
print("Reloaded!")
Caveats¶
Because of how the reloading works, some primitive data types (notably numeric datatypes) might not always reload in the expected way.
If your code (or a third party library) uses a registry pattern and has some validation to make sure that (for example) you don’t declare two classes as having the same name, you can run into issues when reloading files.
This is notably a problem with Django and its ORM models. This isn’t a problem for the entire Django project, but files containing model definitions likely won’t reload properly.
The main thing to remember is that this is changing stuff out from under CPython, and it’s not the expected execution model. Don’t use this on a long-running production server! Expect crashes and embrace them.
Also the implementation currently has a memory leak proportional to the number of reloads going on in a single session (old versions of objects stick around forever). This problem is solvable but requires a bit of work on the internals


AVR Mega CPU registers. More...
#include <io.h>
Go to the source code of this file.
Defines | |
| #define | CPUR_RAMPZ 0x5b |
| Extended Z Pointer. | |
| #define | CPUR_EIND 0x5c |
| Extended Indirect. | |
| #define | CPUR_SPL 0x5d |
| Stack Pointer Low. | |
| #define | CPUR_SPH 0x5e |
| Stack Pointer High. | |
| #define | CPUR_SREG 0x5f |
| Status Register. | |
| #define | CPUR_SREG_I (1 << 7) |
| Interrupt Enable. | |
| #define | CPUR_SREG_T (1 << 6) |
| Bit Copy Storage. | |
| #define | CPUR_SREG_H (1 << 5) |
| Half Carry. | |
| #define | CPUR_SREG_S (1 << 4) |
| Sign. | |
| #define | CPUR_SREG_V (1 << 3) |
| Overflow. | |
| #define | CPUR_SREG_N (1 << 2) |
| Negative. | |
| #define | CPUR_SREG_Z (1 << 1) |
| Zero. | |
| #define | CPUR_SREG_C (1 << 0) |
| Carry. | |
| #define | cpu_read_reg8(reg) mmio_read8((void *)(CPUR_##reg)) |
| Read the 8-bit CPU register reg. | |
| #define | cpu_write_reg8(reg, value) mmio_write8((void *)(CPUR_##reg), value) |
| Write value to the 8-bit CPU register reg. |
AVR Mega CPU registers.
Copyright (C) 2009 Atmel Corporation. All rights reserved.
Definition in file regs.h.
| #define cpu_read_reg8 | ( | reg | ) | mmio_read8((void *)(CPUR_##reg)) |
Read the 8-bit CPU register reg.
Definition at line 62 of file regs.h.
Referenced by cpu_irq_save().
| #define cpu_write_reg8 | ( | reg, | |||
| value | ) | mmio_write8((void *)(CPUR_##reg), value) |
Write value to the 8-bit CPU register reg.
Definition at line 68 of file regs.h.
Referenced by cpu_irq_restore().
| #define CPUR_SREG_I (1 << 7) |


THtmlViewer component
property TitleAttr: String;
Read only and run time only. The TitleAttr property returns the string defined by a Title="..." attribute in the HTML tag which relates to the current mouse cursor position. The Title attribute may be added to almost all HTML tags. An OnMouseMove handler can examine TitleAttr and uses its value in a hint window to provide hints or other tooltip information relevant to portions of the HTML document.
Usage Note:
TitleAttr returns the Alt attribute for <img> tags if no Title attribute is present.


What is Docker?
In 2019, “DOCKER” refers to several things. This includes an open source community project which started in 2013; tools from the open source project; Docker Inc., the company that is the primary supporter of that project; and the tools that the company formally supports.
Here’s a quick explanation:
- The IT software “Docker” is containerization technology that enables the creation and use of Linux® containers.
- The open source Docker community works to improve these technologies to benefit all users—freely.
- The company, Docker Inc., builds on the work of the Docker community, makes it more secure, and shares those advancements back to the greater community. It then supports the improved and hardened technologies for enterprise customers.
With DOCKER, you can treat containers like extremely lightweight, modular virtual machines. And you get flexibility with those containers—you can create, deploy, copy, and move them from environment to environment, which helps optimize your apps for the cloud.
In nutshell, Docker is a computer program, command-line tool, a containerization platform, product & a company.
Docker as a Computer program…
Docker is a computer program that performs operating-system-level virtualization, also known as “containerization”. It was first released in 2013 and is developed by Docker, Inc.
Docker as a CLI tool
Docker is a command-line program, a background daemon, and a set of remote services that take a logistical approach to solving common software problems and simplifying your experience installing, running, publishing, and removing software. It accomplishes this using a UNIX technology called containers.
Docker as a Platform
Docker is a containerization platform that packages your application and all its dependencies together in the form of a docker container to ensure that your application works seamlessly in any environment.Docker Container is a standardized unit which can be created on the fly to deploy a particular application or environment. It could be an Ubuntu container, CentOs container, etc. to full-fill the requirement from an operating system point of view. Also, it could be an application oriented container like CakePHP container or a Tomcat-Ubuntu container etc.
Docker as a Product
Docker is the leader in the containerization market, combining an enterprise-grade container platform with world-class services to give developers and IT alike the freedom to build, manage and secure applications without the fear of technology or infrastructure lock-in.
How does Docker work?
The Docker technology uses the Linux kernel and features of the kernel, like Cgroups and namespaces, to segregate processes so they can run independently. This independence is the intention of containers‐the ability to run multiple processes and apps separately from one another to make better use of your infrastructure while retaining the security you would have with separate systems.
Container tools, including Docker, provide an image-based deployment model. This makes it easy to share an application, or set of services, with all of their dependencies across multiple environments. Docker also automates deploying the application (or combined sets of processes that make up an app) inside this container environment.
These tools built on top of Linux containers—what makes Docker user-friendly and unique—gives users unprecedented access to apps, the ability to rapidly deploy, and control over versions and version distribution.
Is Docker technology the same as traditional Linux containers?
No. Docker technology was initially built on top of the LXC technology—what most people associate with “traditional” Linux containers—though it’s since moved away from that dependency. LXC was useful as lightweight virtualization, but it didn’t have a great developer or user experience. The Docker technology brings more than the ability to run containers—it also eases the process of creating and building containers, shipping images, and versioning of images (among other things).
Traditional Linux containers use an init system that can manage multiple processes. This means entire applications can run as one. The Docker technology encourages applications to be broken down into their separate processes and provides the tools to do that. This granular approach has its advantages.
Benefits of Docker containers
Modularity
The Docker approach to containerization is focused on the ability to take down a part of an application, to update or repair, without unnecessarily taking down the whole app. In addition to this microservices-based approach, you can share processes amongst multiple apps in much the same way that service-oriented architecture (SOA) works.
Layers and image version control
Each Docker image file is made up of a series of layers. These layers are combined into a single image. A layer is created when the image changes. Every time a user specifies a command, such as run or copy, a new layer gets created.
Docker reuses these layers for new container builds, which makes the build process much faster. Intermediate changes are shared between images, further improving speed, size, and efficiency. Inherent to layering is version control. Every time there’s a new change, you essentially have a built-in changelog—full control over your container images.
Rollback
Perhaps the best part about layering is the ability to roll back. Every image has layers. Don’t like the current iteration of an image? Roll it back to the previous version. This supports an agile development approach and helps make continuous integration and deployment (CI/CD) a reality from a tools perspective.
Rapid deployment
Getting new hardware up, running, provisioned, and available used to take days. And the level of effort and overhead was burdensome. Docker-based containers can reduce deployment to seconds. By creating a container for each process, you can quickly share those similar processes with new apps. And, since an OS doesn’t need to boot to add or move a container, deployment times are substantially shorter. On top of this, with the speed of deployment, you can easily and cost-effectively create and destroy data created by your containers without concern.
So, Docker technology is a more granular, controllable, microservices-based approach that places greater value on efficiency.


Benchmarking and Profiling Rails
This guide covers the benchmarking and profiling tactics/tools of Rails and Ruby in general. By referring to this guide, you will be able to:
-
Understand the various types of benchmarking and profiling metrics
-
Generate performance/benchmarking tests
-
Use GC patched Ruby binary to measure memory usage and object allocation
-
Understand the information provided by Rails inside the log files
-
Learn about various tools facilitating benchmarking and profiling
1. Why Benchmark and Profile ?
Benchmarking and Profiling is an integral part of the development cycle. It is very important that you don't make your end users wait for too long before the page is completely loaded. Ensuring a plesant browsing experience to the end users and cutting cost of unnecessary hardwares is important for any web application.
1.1. What is the difference between benchmarking and profiling ?
Benchmarking is the process of finding out if a piece of code is slow or not. Whereas profiling is the process of finding out what exactly is slowing down that piece of code.
2. Using and understanding the log files
Rails logs files containt basic but very useful information about the time taken to serve every request. A typical log entry looks something like :
Processing ItemsController#index (for <IP_ADDRESS> at 2008-10-17 00:08:18) [GET] Session ID: BAh7BiIKZmxhc2hJQzonQWN0aHsABjoKQHVzZWR7AA==--83cff4fe0a897074a65335 Parameters: {"action"=>"index", "controller"=>"items"} Rendering template within layouts/items Rendering items/index Completed in 5ms (View: 2, DB: 0) | 200 OK [http://localhost/items]
For this section, we're only interested in the last line from that log entry:
Completed in 5ms (View: 2, DB: 0) | 200 OK [http://localhost/items]
This data is fairly straight forward to understand. Rails uses millisecond(ms) as the metric to measures the time taken. The complete request spent 5 ms inside Rails, out of which 2 ms were spent rendering views and none was spent communication with the database. It's safe to assume that the remaining 3 ms were spent inside the controller.
3. Helper methods
Rails provides various helper methods inside Active Record, Action Controller and Action View to measure the time taken by a specific code. The method is called benchmark() in all three components.
Project.benchmark("Creating project") do project = Project.create("name" => "stuff") project.create_manager("name" => "David") project.milestones << Milestone.find(:all) end
The above code benchmarks the multiple statments enclosed inside Project.benchmark("Creating project") do..end block and prints the results inside log files. The statement inside log files will look like:
Creating projectem (185.3ms)
Please refer to API docs for optional options to benchmark()
Similarly, you could use this helper method inside controllers ( Note that it's a class method here ):
def process_projects self.class.benchmark("Processing projects") do Project.process(params[:project_ids]) Project.update_cached_projects end end
and views:
<% benchmark("Showing projects partial") do %> <%= render :partial => @projects %> <% end %>
4. Performance Test Cases
Rails provides a very easy to write performance test cases, which look just like the regular integration tests.
If you have a look at test/performance/browsing_test.rb in a newly created Rails application:
require 'test_helper' require 'performance_test_help' # Profiling results for each test method are written to tmp/performance. class BrowsingTest < ActionController::PerformanceTest def test_homepage get '/' end end
This is an automatically generated example performance test file, for testing performance of homepage(/) of the application.
4.1. Modes
4.1.1. Benchmarking
4.1.2. Profiling
4.2. Metrics
4.2.1. Process Time
CPU Cycles.
4.2.2. Memory
Memory taken.
4.2.3. Objects
Objects allocated.
4.2.4. GC Runs
Number of times the Ruby GC was run.
4.2.5. GC Time
Time spent running the Ruby GC.
4.3. Preparing Ruby and Ruby-prof
Before we go ahead, Rails performance testing requires you to build a special Ruby binary with some super powers - GC patch for measuring GC Runs/Time. This process is very straight forward. If you've never compiled a Ruby binary before, you can follow the following steps to build a ruby binary inside your home directory:
4.3.1. Compile
[lifo@null ~]$ mkdir rubygc [lifo@null ~]$ wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz [lifo@null ~]$ tar -xzvf ruby-1.8.6-p111.tar.gz [lifo@null ~]$ cd ruby-1.8.6-p111 [lifo@null ruby-1.8.6-p111]$ curl http://rubyforge.org/tracker/download.php/1814/7062/17676/3291/ruby186gc.patch | patch -p0 [lifo@null ruby-1.8.6-p111]$ ./configure --prefix=/Users/lifo/rubygc [lifo@null ruby-1.8.6-p111]$ make && make install
4.3.2. Prepare aliases
Add the following lines in your ~/.profile for convenience:
alias gcruby='/Users/lifo/rubygc/bin/ruby' alias gcrake='/Users/lifo/rubygc/bin/rake' alias gcgem='/Users/lifo/rubygc/bin/gem' alias gcirb='/Users/lifo/rubygc/bin/irb' alias gcrails='/Users/lifo/rubygc/bin/rails'
4.3.3. Install rubygems and some basic gems
[lifo@null ~]$ wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz [lifo@null ~]$ tar -xzvf rubygems-1.2.0.tgz [lifo@null ~]$ cd rubygems-1.2.0 [lifo@null rubygems-1.2.0]$ gcruby setup.rb [lifo@null rubygems-1.2.0]$ cd ~ [lifo@null ~]$ gcgem install rake [lifo@null ~]$ gcgem install rails
4.3.4. Install MySQL gem
[lifo@null ~]$ gcgem install mysql
If this fails, you can try to install it manually:
[lifo@null ~]$ cd /Users/lifo/rubygc/lib/ruby/gems/1.8/gems/mysql-2.7/ [lifo@null mysql-2.7]$ gcruby extconf.rb --with-mysql-config [lifo@null mysql-2.7]$ make && make install
4.4. Installing Jeremy Kemper's ruby-prof
We also need to install Jeremy's ruby-prof gem using our newly built ruby:
[lifo@null ~]$ git clone git://github.com/jeremy/ruby-prof.git [lifo@null ~]$ cd ruby-prof/ [lifo@null ruby-prof (master)]$ gcrake gem [lifo@null ruby-prof (master)]$ gcgem install pkg/ruby-prof-0.6.1.gem
4.5. Generating performance test
Rails provides a simple generator for creating new performance tests:
[lifo@null application (master)]$ script/generate performance_test homepage
This will generate test/performance/homepage_test.rb:
require 'test_helper' require 'performance_test_help' class HomepageTest < ActionController::PerformanceTest # Replace this with your real tests. def test_homepage get '/' end end
Which you can modify to suit your needs.
4.6. Running tests
5. Understanding Performance Tests Outputs
5.1. Our First Performance Test
So how do we profile a request.
One of the things that is important to us is how long it takes to render the home page - so let's make a request to the home page. Once the request is complete, the results will be outputted in the terminal.
In the terminal run
[User profiling_tester]$ gcruby tests/performance/homepage.rb
After the tests runs for a few seconds you should see something like this.
HomepageTest#test_homepage (19 ms warmup) process_time: 26 ms memory: 298.79 KB objects: 1917 Finished in 2.207428 seconds.
Simple but efficient.
-
Process Time refers to amount of time necessary to complete the action.
-
memory is the amount of information loaded into memory
-
object ??? #TODO find a good definition. Is it the amount of objects put into a ruby heap for this process?
In addition we also gain three types of itemized log files for each of these outputs. They can be found in your tmp directory of your application.
The Three types are
-
Flat File - A simple text file with the data laid out in a grid
-
Graphical File - A html colored coded version of the simple text file with hyperlinks between the various methods. Most useful is the bolding of the main processes for each portion of the action.
-
Tree File - A file output that can be use in conjunction with KCachegrind to visualize the process
| KCachegrind is Linux only. For Mac this means you have to do a full KDE install to have it working in your OS. Which is over 3 gigs in size. For windows there is clone called wincachegrind but it is no longer actively being developed. |
Below are examples for Flat Files and Graphical Files
5.2. Flat Files
Thread ID: 2279160 Total: 0.026097
%self total self wait child calls name 6.41 0.06 0.04 0.00 0.02 571 Kernel#=== 3.17 0.00 0.00 0.00 0.00 172 Hash#[] 2.42 0.00 0.00 0.00 0.00 13 MonitorMixin#mon_exit 2.05 0.00 0.00 0.00 0.00 15 Array#each 1.56 0.00 0.00 0.00 0.00 6 Logger#add 1.55 0.00 0.00 0.00 0.00 13 MonitorMixin#mon_enter 1.36 0.03 0.00 0.00 0.03 1 ActionController::Integration::Session#process 1.31 0.00 0.00 0.00 0.00 13 MonitorMixin#mon_release 1.15 0.00 0.00 0.00 0.00 8 MonitorMixin#synchronize-1 1.09 0.00 0.00 0.00 0.00 23 Class#new 1.03 0.01 0.00 0.00 0.01 5 MonitorMixin#synchronize 0.89 0.00 0.00 0.00 0.00 74 Hash#default 0.89 0.00 0.00 0.00 0.00 6 Hodel3000CompliantLogger#format_message 0.80 0.00 0.00 0.00 0.00 9 c 0.80 0.00 0.00 0.00 0.00 11 ActiveRecord::ConnectionAdapters::ConnectionHandler#retrieve_connection_pool 0.79 0.01 0.00 0.00 0.01 1 ActionController::Benchmarking#perform_action_without_rescue 0.18 0.00 0.00 0.00 0.00 17 <Class::Object>#allocate
So what do these columns tell us:
-
%self - The percentage of time spent processing the method. This is derived from self_time/total_time
-
total - The time spent in this method and its children.
-
self - The time spent in this method.
-
wait - Time processed was queued
-
child - The time spent in this method's children.
-
calls - The number of times this method was called.
-
name - The name of the method.
Name can be displayed three seperate ways: #toplevel - The root method that calls all other methods MyObject#method - Example Hash#each, The class Hash is calling the method each * <Object:MyObject>#test - The <> characters indicate a singleton method on a singleton class. Example <Class::Object>#allocate
Methods are sorted based on %self. Hence the ones taking the most time and resources will be at the top.
So for Array#each which is calling each on the class array. We find that it processing time is 2% of the total and was called 15 times. The rest of the information is 0.00 because the process is so fast it isn't recording times less then 100 ms.
Thread ID: 2279160 Total: 509.724609
%self total self wait child calls name 4.62 23.57 23.57 0.00 0.00 34 String#split 3.95 57.66 20.13 0.00 37.53 3 <Module::YAML>#quick_emit 2.82 23.70 14.35 0.00 9.34 2 <Module::YAML>#quick_emit-1 1.37 35.87 6.96 0.00 28.91 1 ActionView::Helpers::FormTagHelper#form_tag 1.35 7.69 6.88 0.00 0.81 1 ActionController::HttpAuthentication::Basic::ControllerMethods#authenticate_with_http_basic 1.06 6.09 5.42 0.00 0.67 90 String#gsub 1.01 5.13 5.13 0.00 0.00 27 Array#-
Very similar to the processing time format. The main difference here is that instead of calculating time we are now concerned with the amount of KB put into memory (or is it strictly into the heap) can I get clarification on this minor point?
So for <Module::YAML>#quick_emit which is singleton method on the class YAML it uses 57.66 KB in total, 23.57 through its own actions, 6.69 from actions it calls itself and that it was called twice.
Thread ID: 2279160 Total: 6537.000000
%self total self wait child calls name 15.16 1096.00 991.00 0.00 105.00 66 Hash#each 5.25 343.00 343.00 0.00 0.00 4 Mysql::Result#each_hash 4.74 2203.00 310.00 0.00 1893.00 42 Array#each 3.75 4529.00 245.00 0.00 4284.00 1 ActionView::Base::CompiledTemplates#_run_erb_47app47views47layouts47application46html46erb 2.00 136.00 131.00 0.00 5.00 90 String#gsub 1.73 113.00 113.00 0.00 0.00 34 String#split 1.44 111.00 94.00 0.00 17.00 31 Array#each-1
#TODO Find correct terminology for how to describe what this is exactly profiling as in are there really 2203 array objects or 2203 pointers to array objects?.
5.3. Graph Files
While the information gleamed from flat files is very useful we still don't know which processes each method is calling. We only know how many. This is not true for a graph file. Below is a text representation of a graph file. The actual graph file is an html entity and an example of which can be found Here
#TODO (Handily the graph file has links both between it many processes and to the files that actually contain them for debugging. )
Thread ID: 21277412
%total %self total self children calls Name /____________________________________________________________________________/ 100.00% 0.00% 8.77 0.00 8.77 1 #toplevel* 8.77 0.00 8.77 1/1 Object#run_primes /____________________________________________________________________________/ 8.77 0.00 8.77 1/1 #toplevel 100.00% 0.00% 8.77 0.00 8.77 1 Object#run_primes* 0.02 0.00 0.02 1/1 Object#make_random_array 2.09 0.00 2.09 1/1 Object#find_largest 6.66 0.00 6.66 1/1 Object#find_primes /____________________________________________________________________________/ 0.02 0.02 0.00 1/1 Object#make_random_array 0.18% 0.18% 0.02 0.02 0.00 1 Array#each_index 0.00 0.00 0.00 500/500 Kernel.rand 0.00 0.00 0.00 500/501 Array#[]= /____________________________________________________________________________/
As you can see the calls have been separated into slices, no longer is the order determined by process time but instead from hierarchy. Each slice profiles a primary entry, with the primary entry's parents being shown above itself and it's children found below. A primary entry can be ascertained by it having values in the %total and %self columns. Here the main entry here have been bolded for connivence.
So if we look at the last slice. The primary entry would be Array#each_index. It takes 0.18% of the total process time and it is only called once. It is called from Object#make_random_array which is only called once. It's children are Kernal.rand which is called by it all 500 its times that it was call in this action and Arry#[]= which was called 500 times by Array#each_index and once by some other entry.
5.4. Tree Files
It's pointless trying to represent a tree file textually so here's a few pretty pictures of it's usefulness
#TODO Add a bit more information to this.
6. Getting to the Point of all of this
Now I know all of this is a bit dry and academic. But it's a very powerful tool when you know how to leverage it properly. Which we are going to take a look at in our next section
7. Real Life Example
7.1. The setup
So I have been building this application for the last month and feel pretty good about the ruby code. I'm readying it for beta testers when I discover to my shock that with less then twenty people it starts to crash. It's a pretty simple Ecommerce site so I'm very confused by what I'm seeing. On running looking through my log files I find to my shock that the lowest time for a page run is running around 240 ms. My database finds aren't the problems so I'm lost as to what is happening to cause all this. Lets run a benchmark.
class HomepageTest < ActionController::PerformanceTest # Replace this with your real tests. def test_homepage get '/' end end
HomepageTest#test_homepage (115 ms warmup) process_time: 591 ms memory: 3052.90 KB objects: 59471
Obviously something is very very wrong here. 3052.90 Kb to load my minimal homepage. For Comparison for another site running well I get this for my homepage test.
HomepageTest#test_homepage (19 ms warmup) process_time: 26 ms memory: 298.79 KB objects: 1917
that over a factor of ten difference. Lets look at our flat process time file to see if anything pops out at us.
20.73 0.39 0.12 0.00 0.27 420 Pathname#cleanpath_aggressive 17.07 0.14 0.10 0.00 0.04 3186 Pathname#chop_basename 6.47 0.06 0.04 0.00 0.02 6571 Kernel#=== 5.04 0.06 0.03 0.00 0.03 840 Pathname#initialize 5.03 0.05 0.03 0.00 0.02 4 ERB::Compiler::ExplicitScanner#scan 4.51 0.03 0.03 0.00 0.00 9504 String#== 2.94 0.46 0.02 0.00 0.44 1393 String#gsub 2.66 0.09 0.02 0.00 0.07 480 Array#each 2.46 0.01 0.01 0.00 0.00 3606 Regexp#to_s
Yes indeed we seem to have found the problem. Pathname#cleanpath_aggressive is taking nearly a quarter our process time and Pathname#chop_basename another 17%. From here I do a few more benchmarks to make sure that these processes are slowing down the other pages. They are so now I know what I must do. If we can get rid of or shorten these processes we can make our pages run much quicker.
Now both of these are main ruby processes so are goal right now is to find out what other process is calling them. Glancing at our Graph file I see that #cleanpath is calling #cleanpath_aggressive. #cleanpath is being called by String#gsub and from there some html template errors. But my page seems to be rendering fine. why would it be calling template errors. I'm decide to check my object flat file to see if I can find any more information.
20.74 34800.00 12324.00 0.00 22476.00 420 Pathname#cleanpath_aggressive 16.79 18696.00 9978.00 0.00 8718.00 3186 Pathname#chop_basename 11.47 13197.00 6813.00 0.00 6384.00 480 Array#each 8.51 41964.00 5059.00 0.00 36905.00 1386 String#gsub 6.07 3606.00 3606.00 0.00 0.00 3606 Regexp#to_s
nope nothing new here. Lets look at memory usage
40.17 1706.80 1223.70 0.00 483.10 3186 Pathname#chop_basename 14.92 454.47 454.47 0.00 0.00 3606 Regexp#to_s 7.09 2381.36 215.99 0.00 2165.37 1386 String#gsub 5.08 231.19 154.73 0.00 76.46 420 Pathname#prepend_prefix 2.34 71.35 71.35 0.00 0.00 1265 String#initialize_copy
Ok so it seems Regexp#to_s is the second costliest process. At this point I try to figure out what could be calling a regular expression cause I very rarely use them. Going over my standard layout I discover at the top.
<%if request.env["HTTP_USER_AGENT"].match(/Opera/)%> <%= stylesheet_link_tag "opera" %> <% end %>
That's wrong. I mistakenly am using a search function for a simple compare function. Lets fix that.
<%if request.env["HTTP_USER_AGENT"] =~ /Opera/%> <%= stylesheet_link_tag "opera" %> <% end %>
I'll now try my test again.
process_time: 75 ms memory: 519.95 KB objects: 6537
Much better. The problem has been solved. Now I should have realized earlier due to the String#gsub that my problem had to be with reqexp serch function but such knowledge comes with time. Looking through the mass output data is a skill.
8. Get Yourself a Game Plan
You end up dealing with a large amount of data whenever you profile an application. It's crucial to use a rigorous approach to analyzing your application's performance else fail miserably in a vortex of numbers. This leads us to -
8.1. The Analysis Process
I’m going to give an example methodology for conducting your benchmarking and profiling on an application. It is based on your typical scientific method.
For something as complex as Benchmarking you need to take any methodology with a grain of salt but there are some basic strictures that you can depend on.
Formulate a question you need to answer which is simple, tests the smallest measurable thing possible, and is exact. This is typically the hardest part of the experiment. From there some steps that you should follow are.
-
Develop a set of variables and processes to measure in order to answer this question!
-
Profile based on the question and variables. Key problems to avoid when designing this experiment are:
-
Confounding: Test one thing at a time, keep everything the same so you don't poison the data with uncontrolled processes.
-
Cross Contamination: Make sure that runs from one test do not harm the other tests.
-
Steady States: If you’re testing long running process. You must take the ramp up time and performance hit into your initial measurements.
-
Sampling Error: Data should perform have a steady variance or range. If you get wild swings or sudden spikes, etc. then you must either account for the reason why or you have a sampling error.
-
Measurement Error: Aka Human error, always go through your calculations at least twice to make sure there are no mathematical errors. .
-
-
Do a small run of the experiment to verify the design.
-
Use the small run to determine a proper sample size.
-
Run the test.
-
Perform the analysis on the results and determine where to go from there.
Note: Even though we are using the typical scientific method; developing a hypothesis is not always useful in terms of profiling.
9. Other Profiling Tools
There are a lot of great profiling tools out there. Some free, some not so free. This is a sort list detailing some of them.
9.1. httperf
A necessary tool in your arsenal. Very useful for load testing your website.
#TODO write and link to a short article on how to use httperf. Anybody have a good tutorial availble.
9.2. Rails Analyzer
The Rails Analyzer project contains a collection of tools for Rails. It's open source and pretty speedy. It's not being actively worked on but is still contains some very useful tools.
-
The Production Log Analyzer examines Rails log files and gives back a report. It also includes action_grep which will give you all log results for a particular action.
-
The Action Profiler similar to Ruby-Prof profiler.
-
rails_stat which gives a live counter of requests per second of a running Rails app.
-
The SQL Dependency Grapher allows you to visualize the frequency of table dependencies in a Rails application.
Their project homepage can be found at http://rails-analyzer.rubyforge.org/
The one major caveat is that it needs your log to be in a different format from how rails sets it up specifically SyslogLogger.
9.2.1. SyslogLogger
SyslogLogger is a Logger work-alike that logs via syslog instead of to a file. You can add SyslogLogger to your Rails production environment to aggregate logs between multiple machines.
More information can be found out at http://rails-analyzer.rubyforge.org/hacks/classes/SyslogLogger.html
If you don't have access to your machines root system or just want something a bit easier to implement there is also a module developed by Geoffrey Grosenbach
9.2.2. A Hodel 3000 Compliant Logger for the Rest of Us
Directions taken from link to module file
Just put the module in your lib directory and add this to your environment.rb in it's config portion.
require 'hodel_3000_compliant_logger' config.logger = Hodel3000CompliantLogger.new(config.log_path)
It's that simple. Your log output on restart should look like this.
Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: Parameters: {"action"=>"shipping", "controller"=>"checkout"} Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;36;1mBook Columns (0.003155)[0m [0;1mSHOW FIELDS FROM `books`[0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;35;1mBook Load (0.000881)[0m [0mSELECT * FROM `books` WHERE (`books`.`id` = 1 AND (`books`.`sold` = 1)) [0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;36;1mShippingAddress Columns (0.002683)[0m [0;1mSHOW FIELDS FROM `shipping_addresses`[0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;35;1mBook Load (0.000362)[0m [0mSELECT ounces FROM `books` WHERE (`books`.`id` = 1) [0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: Rendering template within layouts/application Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: Rendering checkout/shipping Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;36;1mBook Load (0.000548)[0m [0;1mSELECT * FROM `books` WHERE (sold = 0) LIMIT 3[0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;35;1mAuthor Columns (0.002571)[0m [0mSHOW FIELDS FROM `authors`[0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: [4;36;1mAuthor Load (0.000811)[0m [0;1mSELECT * FROM `authors` WHERE (`authors`.`id` = 1) [0m Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: Rendered store/_new_books (0.01358) Jul 15 11:45:43 matthew-bergmans-macbook-pro-15 rails[16207]: Completed in 0.37297 (2 reqs/sec) | Rendering: 0.02971 (7%) | DB: 0.01697 (4%) | 200 OK [https://secure.jeffbooks/checkout/shipping]
9.3. Palmist
An open source mysql query analyzer. Full featured and easy to work with. Also requires Hodel 3000 http://www.flyingmachinestudios.com/projects/
9.4. New Relic
Pretty nifty performance tools, pricey though. They do have a basic free service both for when in development and when you put your application into production. Very simple installation and signup.
#TODO more in-depth without being like an advertisement.
9.4.1. Manage
Like new relic a production monitoring tool.
10. Changelog
-
October 17, 2008: First revision by Pratik
-
September 6, 2008: Initial version by Matthew Bergman <MzbPhoto@gmail.com>


Properties
| Property | Description | Data Type |
|---|---|---|
| data_format | Data format. | < const: PNG > |
| upload_placeholder | A placeholder for when artifact file is being uploaded. | core#upload placeholder |
| artifact_creator | The name of the center that created this artifact. | core#artifact creator |
| uploader | The name of the person uploading the artifact. | core#uploader |
| uuid | UUID of artifact. | core#uuid |
| file_name | The name of the file with extension. | core#file name |
| object_url | URL to artifact within Google Bucket. | core#object url |
| uploaded_timestamp | Timestamp of when artifact was loaded into the system. | core#uploaded timestamp |
| file_size_bytes | File size in bytes. | core#file size bytes |
| md5_hash | MD5 Hash of artifact. Not available for composite GCS objects. | core#md5 hash |
| crc32c_hash | CRC32c Hash of artifact. | core#crc32c hash |
| visible | Indicates if the artifact is visible. If set to false, the artifact is effectively deleted. | core#visible |
| artifact_category | Artifact category. | core#artifact category |
| facet_group | The internal data category for this artifact | core#facet group |


Build Test swarming build
Results:
Build Successful
Build Properties:
| Name | Value | Source |
|---|
Timing:
| Start | Saturday, 02-Jan-16 15:04:05 UTC |
| End | Saturday, 02-Jan-16 15:04:06 UTC |
| Elapsed | 1 secs |
Build Successful
| Name | Value | Source |
|---|
| Start | Saturday, 02-Jan-16 15:04:05 UTC |
| End | Saturday, 02-Jan-16 15:04:06 UTC |
| Elapsed | 1 secs |


There are no inherently bad people. Everyone believes that, myself included. I don’t doubt the existence of virtue. And yet people bare their fangs when it seems they can profit. People will rationalize their own behavior whenever they become tainted with evil; they’re not supposed to be evil. In order to preserve their own twisted integrity, the world becomes twisted. Someone you praised as “cool” until yesterday is “stuck up” today; someone you respected as “smart and knowledgeable” is now scorned as someone who “looks down on bad students”, and “energetic vigor” becomes “annoying and overly carried away”.
Do you know the phrase “enough specks of dust creates a mountain”? Or maybe “three heads are better than one.” In other words, when people gathered together, they become even stronger and more secure. However, we were a group of failures who had gathered to do pointless things.
Conserve Energy
People remember their high school days as the high point of their lives. People say these things because everyone holds fond memories of their time in high school; however, I doubt that every high school student would want to remember their school life that way. For example, if neither studying, nor sports, nor socializing are of interest to someone, what then? What if there are students who prefer to keep a low profile? Though I guess that would be a pretty lonely way to live.
If I don't have to do it, I won't. If I have to do it, I'll make it quick.
Don't care anything and do not do anything that's a waste of energy.
I'm not lazy, I'm just conserving energy.
.


Zack Alien pushed new commit: Fix page load performance issue.
Amaya Hatsumi started new task: Dashboard UI design..
Andy Nouman deployed new version of NodeJS REST Api V3
Are you sure want to do this?


Finding intermittently failing specs with RSpec's bisect
High level takeaways: As of RSpec 3.4 we have a --bisect
flag which is used to find order-dependent spec failures. Using bash, we can run an inconsistent spec until it fails, and using its seed number use an RSpec command of the form rspec spec/some_spec.rb --seed 12345 --bisect
find the minimum number of specs to run in order to recreate the failure. This drastically reduces the amount of code which needs to be reviewed to find the cause of spec failure, which is likely a side effect in the passing spec. This passing spec that causes later failures can be isolated using the documentation formatter.
I work on a large app with thousands of specs of varying quality.
Unfortunately, running our spec suite locally is impractical, and running all the specs in continuous integration can take more than a half an hour. Our specs fail intermittently, and spec failures delay builds from passing while reducing developer trust in the specs.
I recently came across a file which had an intermittently failing spec in my local environment. At the time I didn’t have the attention or the tooling to address the issue. I noted the seed number, which RSpec uses to run the same specs in the same order, and moved on.
A while later a friend tweeted about git bisect. I had a little free time at the end of my work week, so I decided to try out this technique to isolate the minimum reproduction to cause failing specs.
I ran the spec with the seed number I’d recorded a few weeks earlier to confirm the test was still failing in this order, and got the failure I expected. I then tried running the spec with the bisect command, but RSpec failed because it didn’t recognize the --bisect
command flag. Bisect was introduced in RSpec 3.4, and I was using an older version in this project.
I updated RSpec and ran the seeded spec again, and this time it passed. I’m not sure why, but I had a hunch that the spec failure still existed, and perhaps RSpec had changed its seeding algorithm between versions. So I decided to run the spec until it failed. If you don’t know the seed number to reproduce a failing spec, you can run the script below to find it. I ran this script and went to lunch.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
When I came back from lunch I had a new seed number, which then used to bisect my spec with a command resembling bundle exec rspec spec/some_spec.rb --seed 12345 --bisect
. In a few minutes RSpec returned command that looked like rspec './spec/some_spec.rb[1:16:1:2:1,1:31:2:1,1:31:2:2,1:32:4:1,1:35:2]' --seed 12345
. I ran this command, but added the documentation formatter by appending --format documentation
to it. This printed out the expectation message from describe and it blocks associated with the handful of specs this command runs.
In this case, I got one passing spec, and four failing specs. The passing spec was executed before the failures, so I suspected it was causing a side effect in its sibling specs. I used the strings printed out from the documentation to search the spec file for line numbers, and then I ran the specs in pairs, matching the passing spec with each of the failing specs. I usually had to run these a few times to get the passing spec to run before the failing spec, and recorded the seed number to recreate this failure in each case. Then I looked at the code and found there was one line I could comment out which would cause my failing specs to pass. Of course, the previously passing spec now failed, but now I could isolate or remove this side effect, and increase our spec suite’s stability.


Hi, My name is Firman.
I’m a front end developer from Bandung, Indonesia.
I help brands turn their ideas into high quality products.
I have 2 years experience as web developer.
Usually i created web with Javascript programming Language with Angular and React JS.
Also i have some experience as backend developer with node JS and Java Spring boot programming language


Events
Take a look at the various events conducted by our club
GameScript
Snake using Javascript
NOWs first event organised by a team of 5 people, GameScript has now moved on to be the Flasgship event people expect from us.
Teaching people how to make the classic game of Snake in JavaScript and with a code that is less than 100 LOC.
FeelsGreatMan.jpg
View the Source Code
Recruitments
Strength in Numbers
The 28th and 29th of March consisted of the first Recruitment drive where we sought out people with a passion for Open Source.
Needless to say we found quite a lot of people hugry for knowledge, a lot of whom are now proud Mozillians and members of NOW.
Get to know the team
Android Workshop
N.O.W. collaborated with the Department of Computer Engineering to organize the Android Competiton for the students.
With an audience of over 200 students, our skills were put to the test as this was the first major event NOW was a part of.
The team was brilliant and showed amazing coherence.
HacktoberFest'18
A month-long celebration of the Open Web Culture with challenging events and exciting prices for participants. Also a Crash course on how people can contribute to ongoing open-source projects on GitHub.


Golf: Mayakoba Classic rained out on Thursday as Monday finish looms
(Reuters) - The PGA Tour could be headed to its second Monday finish in less than a month after torrential rain prevented play in the scheduled first round at the Mayakoba Classic in Mexico on Thursday.
The first round has been rescheduled to start on Friday morning, but more rain is forecast for the Camaleon course in Playa del Carmen.
“Everything always drains to the mangroves here and there’s no place for it to go with that much rain,” said PGA Tour rules official Slugger White. “Monday’s always in the mix.”
The Mayakoba Classic is the penultimate event on the PGA Tour this year.
Rain on the other side of the world washed out Friday play at the Zozo Championship outside Tokyo on Oct. 25, which led to a Monday finish at the tournament won by Tiger woods.