--- layout: post title: "Branching tests" description: "Is it ever okay to branch and loop in a unit test?" date: 2020-12-07 6:25 UTC tags: [Unit Testing, Code] --- {% include JB/setup %}
{{ page.description }}
When I coach development organisations about unit testing and test-driven development, there's often a sizeable group of developers who don't see the value of unit testing. Some of the arguments they typically use are worth considering.
A common complaint is that it's difficult to see the wisdom in writing code to prevent defects in code. That's not an unreasonable objection.
We have scant scientific knowledge about software engineering, but the little we know suggests that the number of defects is proportional to lines of code. The more lines of code, the more defects.
If that's true, adding more code - even when it's test code - seems like a bad idea.
First, we should consider the possibility that the correlation between lines of code and defects doesn't mean that defects are evenly distributed. As Adam Tornhill argues in Your Code as a Crime Scene, defects tend to cluster in hotspots.
You can have a large proportion of your code base which is, for all intents and purpose, bug-free, and hotspots where defects keep spawning.
If this is true, adding test code isn't a problem if you can keep it bug-free.
That, however, sounds like a chicken-and-the-egg kind of problem. How can you know that test code is bug-free without tests?
I've previously answered that question. In short, you can trust a test for two reasons:
That's what this article is actually about.
I was working with an online restaurant reservation system (example code), and had written this test:
[Theory] [InlineData("2023-11-24 19:00"<EMAIL_ADDRESS>"Julia Domna", 5)] [InlineData("2024-02-13 18:15"<EMAIL_ADDRESS>"Xenia Ng", 9)] public async Task PostValidReservationWhenDatabaseIsEmpty( string at, string email, string name, int quantity) { var db = new FakeDatabase(); var sut = new ReservationsController(db); var dto = new ReservationDto { At = at, Email = email, Name = name, Quantity = quantity }; await sut.Post(dto); var expected = new Reservation( DateTime.Parse(dto.At, CultureInfo.InvariantCulture), dto.Email, dto.Name, dto.Quantity); Assert.Contains(expected, db); }
This is a state-based test that verifies that a valid reservation makes it to the database. The test has a cyclomatic complexity of 1, and I've seen it fail, so all is good. (It may, in fact, contain a future maintenance problem, but that's a topic for another article.)
The code shown here is part of the sample code base that accompanies my book Code That Fits in Your Head.
What constitutes a valid reservation? At the very least, we should demand that At
is a valid date and time, and that Quantity
is a positive number. The restaurant would like to be able to email a confirmation to the user, so an email address is also required. Email addresses are notoriously difficult to validate, so we'll just require that the the string isn't null.
What about the Name
? I thought about this a bit and decided that, according to Postel's law, the system should accept null names. The name is only a convenience; the system doesn't need it, it's just there so that when you arrive at the restaurant, you can say "I have a reservation for Julia" instead of giving an email address to the maître d'hôtel. But then, if you didn't supply a name when you made the reservation, you can always state your email address when you arrive. To summarise, the name is just a convenience, not a requirement.
This decision meant that I ought to write a test case with a null name.
That turned out to present a problem. I'd defined the Reservation
class so that it didn't accept null
arguments, and I think that's the appropriate design.
That's not a problem in itself. In this case, I think it's acceptable to convert a null name to the empty string.
Allow me to summarise. If you consider the above unit test, I needed a third test case with a null name
. In that case, expected
should be a Reservation
value with the name ""
. Not null
, but ""
.
As far as I can tell, you can't easily express that in PostValidReservationWhenDatabaseIsEmpty
without increasing its cyclomatic complexity. Based on the above introduction, that seems like a no-no.
What's the alternative? Should I copy the test and adjust the single line of code that differs? If I did, it would look like this:
[Theory] [InlineData("2023-08-23 16:55"<EMAIL_ADDRESS>null, 2)] public async Task PostValidReservationWithNullNameWhenDatabaseIsEmpty( string at, string email, string name, int quantity) { var db = new FakeDatabase(); var sut = new ReservationsController(db); var dto = new ReservationDto { At = at, Email = email, Name = name, Quantity = quantity }; await sut.Post(dto); var expected = new Reservation( DateTime.Parse(dto.At, CultureInfo.InvariantCulture), dto.Email, "", dto.Quantity); Assert.Contains(expected, db); }
Apart from the values in the [InlineData]
attribute and the method name, the only difference from PostValidReservationWhenDatabaseIsEmpty
is that expected
has a hard-coded name of ""
.
This is not acceptable.
There's a common misconception that the DRY principle doesn't apply to unit tests. I don't see why this should be true. The DRY principle exists because copy-and-paste code is difficult to maintain. Unit test code is also code that you have to maintain. All the rules about writing maintainable code also apply to unit test code.
What's the alternative? One option (that shouldn't be easily dismissed) is to introduce a Test Helper to perform the conversion from a nullable name to a non-nullable name. Such a helper would have a cyclomatic complexity of 2, but could be unit tested in isolation. It might even turn out that it'd be useful in the production code.
Still, that seems like overkill, so I instead made the taboo move and added branching logic to the existing test to see how it'd look:
[Theory] [InlineData("2023-11-24 19:00"<EMAIL_ADDRESS>"Julia Domna", 5)] [InlineData("2024-02-13 18:15"<EMAIL_ADDRESS>"Xenia Ng", 9)] [InlineData("2023-08-23 16:55"<EMAIL_ADDRESS>null, 2)] public async Task PostValidReservationWhenDatabaseIsEmpty( string at, string email, string name, int quantity) { var db = new FakeDatabase(); var sut = new ReservationsController(db); var dto = new ReservationDto { At = at, Email = email, Name = name, Quantity = quantity }; await sut.Post(dto); var expected = new Reservation( DateTime.Parse(dto.At, CultureInfo.InvariantCulture), dto.Email, dto.Name ?? "", dto.Quantity); Assert.Contains(expected, db); }
Notice that the expected
name is now computed as dto.Name ?? ""
. Perhaps you think about branching instructions as relating exclusively to keywords such as if
or switch
, but the ??
operator is also a branching instruction. The test now has a cyclomatic complexity of 2
.
Is that okay?
I think that in this case, it's okay to slightly increase the cyclomatic complexity of the test. It's not something I just pull out of my hat, though. I think it's possible to adjust the above heuristics to embrace this sort of variation.
To be clear, I consider this an advanced practice. If you're just getting started with unit testing, try to keep tests simple. Keep the cyclomatic complexity at 1.
Had I been in the above situation a couple of years ago, I might not have considered this option. About a year ago, though, I watched John Hughes' presentation Building on developers' intuitions to create effective property-based tests. When he, about 15 minutes in, wrote a test with a branching instruction, I remember becoming quite uncomfortable. This lasted for a while until I understood where he was going with it. It's truly an inspiring and illuminating talk; I highly recommend it.
How it relates to the problem presented here is through coverage. While the PostValidReservationWhenDatabaseIsEmpty
test now has a cyclomatic complexity of 2, it's a parametrised test with three test cases. Two of these cover one branch, and the third covers the other.
What's more important is the process that produced the test. I added one test case at a time, and for each case, I saw the test fail.
Specifically, when I added the third test case with the null name, I first added the branching expression dto.Name ?? ""
and ran the two existing tests. They still both passed, which bolstered my belief that they both exercised the left branch of that expression. I then added the third case and saw that it (and only it) failed. This supported my belief that the third case exercised the right branch of ??
.
Branching in unit tests isn't something I do lightly. I still believe that it could make the test more vulnerable to future changes. I'm particularly worried about making a future change that might shift one or more of these test cases into false negatives in the form of tautological assertions.
As you can tell, when I feel that I'm moving onto thin ice, I move deliberately. If there's one thing I've learned from decades of professional programming it's that my brain loves jumping to conclusions.  I believe that it enables me to go faster in the long run.
I don't think that branching in unit tests should be common, but I believe that it may be occasionally valid. The key, I think, is to guarantee that each branch in the test is covered by a test case. The implication is that there must be at least as many test cases as the cyclomatic complexity. In other words, the test must be a parametrised test.
Comments
Hi Mark, I guess there is implicit cyclomatic complexity in the testing framework itself (For example, it loops through the
InlineData
records). That feels fine though, does this somehow have less cost than cyclomatic complexity in the test code itself? I guess, as you mentioned, it's acceptable because the alternative is violation of DRY.With this in mind, I wonder how you feel about adding an
expectedName
parameter to theInlineData
attributes, instead of the conditional in the test code? Maybe it's harder to read though when the test data includes input and output.James, thank you for writing. I consider the cyclomatic complexity of a method call to be 1, and Visual Studio code metrics agree with me. Whatever happens in a framework should, in my opinion, likewise be considered as encapsulated abstraction that's none of our business.
Adding an
expectedName
parameter to the method is definitely an option. I sometimes do that, and I could have done that here, too. In this situation, I think it's a toss-up. It'd make it harder for a later reader of the code to parse the test cases, but would simplify the test code itself, so that alternative comes with both advantages and disadvantages.Hi Mark. To build up on the additional
expectedName
parameter, instead of keeping a single test with the 3 cases but the last being a edge case, I prefer introduce a specific test for the last case.Then, to remove the duplication, we can extract a common method which will take this additional
expectedName
parameter:Romain, thank you for writing. There are, indeed, many ways to skin that cat. If you're comfortable with distributing a test over more than one method, I instead prefer to use another data source for the
[Theory]
attribute:Whether you prefer one over the other is, I think, subjective. I like my alternative, using a
[ClassData]
source, better, because I find it a bit more principled and 'pattern-based', if you will. I also like how small the actual test method becomes.Your solution, on the other hand, is more portable, in the sense that you could also apply it in a testing framework that doesn't have the sort of capability that xUnit.net has. That's a definite benefit with your suggestion.


erodr is private mobile social networking for the local college student community.
It creates a geo-fenced social Forum around the local campus. For the first time
since Facebook was college-students only, erodr provides an open social platform for the student community
that is private from the rest of the world. On erodr you can meet new students around you. Validate your student email address to see posts to erodr by other students around campusWhen you post in the local forum, it is seen by other students nearby
not already in your other social networks. Those students can leave private likes and comments, remarks seen only by you, which is how other
students introduce themselves if interested in you or what you post. You can ignore or block them, or request to Connect to enable 1:1 private messaging.
erodr has better privacy. - You are invisible until you like someone's post or comment, and only they can see that you did...or post something yourself to appear publicly and collect likes and comments.
- All posts to the erodr streamer expire in hours, and aren't kept on our servers after expiration.
- You can post with limits on duration (down to 30 minutes), range (down to 100 feet),
and limit the audience (connections only, men or women only).
- Users can post anonymously once every other day.
erodr is community moderated: likes, dislikes, and flags determine each post's duration and viewable range. Posts can expire in minutes if disliked by other students.
erodr is an addictive hyperlocal
crowd-sourced entertainment feed
where the
student
community
mingles and meets.
With your Connections on erodr, you can use our Radar feature, which lets you share your current location on campus with Connections only, and only when each of you has turned Radar ON.


Toggle navigation
Project name
Home
About
Contact
Dropdown
Action
Another action
Something else here
Nav header
Separated link
One more separated link
Default
Static top
Fixed top
Not Found
Sorry, but the page you were trying to view does not exist.
Search for:
Search


The DisseminationC component is the top-level interface to the dissemination protocol. StdControl controls all of the trickle timers used for all of the keys. See TEP118 - Dissemination for details.


Preparation time
1-2 hours
Cooking time
30 mins to 1 hour
Serves
Serves 6
A wholesome tart with a creamy salmon and spinach filling. Try substituting the spinach with asparagus when it's in season.
Preheat the oven to 200C/400F/Gas 6 and grease a 28cm/11in pie dish with butter.
For the pastry, mix both flours and the salt together in a large bowl, then rub in the butter with your fingers. Mix in the quark or fromage frais. Knead the dough lightly with your hands just until the ingredients come together (alternatively, put all the ingredients in a food processor and pulse). If the dough does not bind together, add a little water and briefly mix again.
 Line the dish with the pastry, then leave it to rest in the refrigerator for an hour.
Cover the pastry case with baking parchment and fill with baking beans or uncooked rice to weigh it down. Bake for 15 minutes. Remove the paper and beans and bake for five minutes more, or until the base looks dry.
To make the filling, rinse the spinach in cold water, then place in a saucepan over a medium heat and allow to wilt. When it’s just wilted, drain really well in a sieve.
Gently fry the shallot in butter for 3-4 minutes without browning. Turn off the heat and add the spinach to the pan.
Beat the eggs in a large bowl, then add the crème fraîche, cottage cheese, nutmeg, salt and pepper and mix well with a wooden spoon. Now add the salmon and spinach mixture and mix again. Season again, to taste, with salt and pepper.
Pour the mixture into the pastry case and bake for 30-35 minutes, or until the filling has set but retains a slight wobble in the centre.
For the kale and pomegranate salad, put the kale in a large bowl with the pomegranate seeds. In a small bowl, whisk together the lime juice, oil, salt and pepper to make a dressing. Pour the dressing over the salad and mix.
Serve the warm tart in slices with the salad alongside.


Dear Friend, I am delighted to write this letter, hoping you will understand my predicament and answer back without hesitation since I am convince you must be an honest and God fearing fellow who will help save my life and my only son,hence our country has been frustrating us since the death of my husband. I am MRS M. MBEki, the wife of the late DR.MARTIN MBEKI,the former Chief Excutive and Group Director of PACIFIC BANK OF SOUTH AFRICA. I am in possession of $6,500,000.00 (SIX MILLION,FIVE HUNDRED THOUSAND U.S DOLLARS)which I want to invest in your country. For your clarification and understanding, this money in a security company, which I deposited as a family effect since 6th of Febuary 2000 after the death of my husband, is not an ill gotten wealth rather it was generated by my late husband from over twenty years of his Banking Service and business relationship. On your acceptance to render this assistance to me,I will contact my son to instruct the Clearing House to effect a change of ownership of this fund in your name as the bonafide owner/my next of kin to enable you retrieve the fund on behalf of me and my family to your country to make good arrangement for any profitble joint business investment pending my arrival with my son to your country after you have transferred this fund. Bear in mind that this transaction demands absolute confidentiality because properties, assets and bank accounts bearing the MBEKI'S family name, are being ordered to be confiscated by the newly elected civilian President of South Africa. hence I will not want to be exposed for security reasons. I am only revealing this to you with believing in God that you will not let me and my only son down now or in future if this money gets to you because this is the only hope of our future survival since our bread winner is no more. For your knowledge, 1 % of this total amount has been set aside for all the expenses you might incure during the process of securing this fund. Example: TELEPHONE BILLS, HOTEL BILLS, FLIGHT BILLS,and other miscellenous expenses. Try and negotiate for some profitable blue chip investment opportunities which is risky free which I think we can invest with part of this money when it is transferred.Personally I am interested in estate management and hotel business,please contact my son (SODINDO M MBEKI) who was lucky to escape from South Africa to Lome-Togo with the Certificate of the claim Deposit, where he is now staying as a refugee on his email address<EMAIL_ADDRESS>for detailed procedure. Thanks for your anticipated co-operation. Yours sincerely, MRS M MBEKI<EMAIL_ADDRESS>NB: FOR CONFIDENTIAL REASONS,OUR COMMUNICATION SHOULD ONLY BE TRANSACTED THROUGH ELECTRONIC MAIL BECAUSE I'M NOT IN GOOD POSITION TO RECEIVE TELEPHONE CALLS FOR SECURITY OF THE FUND.


Authentication failed: please verify your url and private token
Token to authenticate you against GitLab. Click here to get your private token.


{# Import the theme's layout. #} {% extends "!layout.html" %} {%- block footer_wrapper %} {{ super() }}
Privacy: Usage of this site follows EMBL’s Privacy Policy. In accordance with that policy, we use Matomo to collect anonymised data on visits to, downloads from, and searches of this site. Contact<EMAIL_ADDRESS>{%- endblock %}


Instruction:
Sidebar on the left is the lesson's category.
Click the menu icon on the top left to view the lesson's category.
When a lesson is opened, try clicking on any links to listen.
This is an English learning web app for technical interview


Stacks a list of rank-R
tensors into one rank-(R+1)
tensor in parallel.
tf.compat.v1.parallel_stack
tf.compat.v2.parallel_stack
tf.parallel_stack( values, name='parallel_stack' )
Requires that the shape of inputs be known at graph construction time.
Packs the list of tensors in values
into a tensor with rank one higher than
each tensor in values
, by packing them along the first dimension.
Given a list of length N
of tensors of shape (A, B, C)
; the output
tensor will have the shape (N, A, B, C)
.
x = tf.constant([1, 4]) y = tf.constant([2, 5]) z = tf.constant([3, 6]) tf.parallel_stack([x, y, z]) # [[1, 4], [2, 5], [3, 6]]
The difference between stack
and parallel_stack
is that stack
requires
all the inputs be computed before the operation will begin but doesn't require
that the input shapes be known during graph construction.
parallel_stack
will copy pieces of the input into the output as they become
available, in some situations this can provide a performance benefit.
Unlike stack
, parallel_stack
does NOT support backpropagation.
This is the opposite of unstack. The numpy equivalent is
tf.parallel_stack([x, y, z]) = np.asarray([x, y, z])
values
: A list of Tensor
objects with the same shape and type.name
: A name for this operation (optional).output
: A stacked Tensor
with the same type as values
.


Choose the Course
Our Courses
See What we do
About Testing Shastra
Pune's first ever training institute who believes in Hans-On Training..
Our Success Story
Our Achievement
Enroll Now
Further and higher education colleges
These colleges offer courses and qualifications in a wide range of vocational and academic subjects at many levels.
Our Students are
Placed at


Logs:
This application demonstrates how to perform application launching from an different application.
This application (Tizen App to App Caller) will launch different app (Tizen App to App Callee). Depending on the action chosen by user, application can communicate between themselves or not.
While in Tizen App to App Callee application, press:
Press 1 to launch Tizen App to App Callee app. In this scenario there will be no communication between apps. Tizen App to App Caller will simply launch the Tizen App to App Callee without sending any data. Tizen App to App Callee will not send back any data.
If Tizen App to App Callee was already running before, it will be brought back from background instead of creating a new instance.
Press 2 to launch Tizen App to App Callee with arguments. Arguments will be sent directly to Tizen App to App Callee. Arguments will be
['apples', 'bananas']
.
As soon, as Tizen App to App Callee receives the arguments, it will send back an message. The message will be handled by the replyHandler
object. If received successful message, it will print it. It should be something like Thank you for the fruits!
.
If Tizen App to App Callee was already running in background, it will be killed. A new instance of application will be launched with params provided by Tizen App to App Caller.


Formica example using default template
This page demonstrates Formica capabilities with default templates and a ready to use stylesheet that you can incorporate in your project or application.
Have a look at this template's source to see how such a form can be created. No witchcraft, only some template tags and variables.


HSTC
(current)
Home
(current)
Customers
Vendors
Disabled
Add Customer
Number
Name
1
Bharath
2
Asis
3
Mani


Gunman who fled to Dubai after shooting man dead in street GUILTY of murder
Keanu Bedward, 24, dumped the revolver in a reservoir after killing victim Remal Hunt in Church Street, Erdington
by Ross McCarthy, https://www.birminghammail.co.uk/authors/ross-mccarthy/A gunman who fled to Dubai after shooting a man dead on a Birmingham street has been convicted of murder.
Keanu Bedward dumped the revolver in a reservoir after he shot Remal Hunt in the chest in Church Road, Erdington, on April 18 this year.
Bedward, 24, of Norfolk Road, Erdington, was convicted of murder by a jury at Birmingham Crown Court this afternoon, Thursday, November 14.
Both men had been in cars and after the shooting Bedward sped off in a Volkswagen Golf.
Paramedics went to the scene but Mr Hunt was pronounced dead shortly afterwards.
Police later found the Golf parked in Stonechat Drive. It had a laundry bag bearing the initials KB in the boot and a balaclava and gloves.
Bedward was captured on CCTV walking away from the car with a female and later that day she bought a one-way ticket to Dubai from Manchester Airport.
The defendant got on the flight and stayed there for ten days but was arrested on his return to the UK.
West Midlands Fire Service crews found a black Nike bag filled with stones as they conducted a training exercise near Bartley Green Reservoir a few days before Bedward returned to Britain.
Also inside was a pair of gloves, two cigarette ends and the revolver used in the shooting, which had four bullets still in the chamber.


 Screenplay: Ron Osborn & Jeff Reno and Kevin Wade and Bo Goldman. Producer: Martin Brest. Director: Martin Brest.  Reviewed by Scott Renshaw.
Death (Brad Pitt), in the nattily-attired, bleach-blond human form of Joe Black, is ready for a holiday. Having spent eternity in the isolation of his never-ending task, the Reaper has decided he wants to sample mortal pleasures, with aging communications tycoon Bill Parrish (Anthony Hopkins) as his somewhat reluctant guide. You may feel that Death has made up for plenty of lost time by the time MEET JOE BLACK finally winds its way to a conclusion -- not because his love of Parrish's daughter Susan (Claire Forlani) is so transforming, but because the three hours of the film begin to feel something like eternity. In his attempt to make an epic of the human experience, director Martin Brest has overburdened a simple story with an entire film's worth of pregnant pauses, portentous glances and flabby plotting.
The real shame is that there's two hours of solid material trying to escape from this lengthy remake of DEATH TAKES A HOLIDAY. The relationship between Susan and Joe is given a neat twist at the start as the emotionally confused Susan meets and falls for the guy whose body Death takes (in one of the most startling screen deaths you'll see). Hopkins, meanwhile, does nice work as the businessman taking stock of his legacy, drawing on the understated physical acting which has always marked his best performances. Brest finds both comedy and creepiness in the early stages of Joe and Parrish's interaction, with the mogul's mysterious new confidante inspiring curiosity among his family and business associates, as well as confusion over the gentleman's unusual affinity for peanut butter.
Between every shred of interesting material, however, there are several patience-threatening minutes. It's astonishing to note that two editors are credited on MEET JOE BLACK, since virtually nothing seems to have been left on the cutting room floor. The scene in which Forlani and Pitt make their lingering departure from one another at the coffee shop could qualify as a short subject; it takes so long for them to undress one another when they finally make love you suspect they're sizing each other for wardrobe. Superfluous sub-plots drag the film down, including one which requires Pitt to adopt an embarrassing West Indian accent. Even the entire storyline involving an attempted coup by Parrish's top lieutenant (Jake Weber, oozing yuppie sleaze) seems to exist for the sole purpose of one big punch line at the 160 minute mark.
That consistent lack of narrative economy ultimately dooms MEET JOE BLACK in spite of its strengths. Pitt brings a surprising undercurrent of menace to the role of Joe Black, while still finding the humanity Death discovers. There are also some supporting moments which do work quite well, including Marcia Gay Harden as Parrish's oldest daughter making a heartbreaking admission of love for her father. MEET JOE BLACK is a truly gorgeous film, with Emmanuel Lubezki providing luminous photography of Dante Ferretti's production design. It's also a case of ever-diminishing returns, with so many emotional confrontations and false endings you may forget whom you were supposed to care about.
1998 has already seen one film about an immortal who risks life on earth for love, the Nicolas Cage/Meg Ryan vehicle CITY OF ANGELS. That film was smart enough to treat the story as grand melodrama -- a weepy transcendental tragedy rather than an Oscar-season Message Movie. MEET JOE BLACK sprinkles its moments of insight so intermittently throughout its three hours that they start to get lost. Life on earth certainly could have seemed more vibrant, and less like an endurance test.
On the Renshaw scale of 0 to 10 lingering Deaths: 5.
Visit Scott Renshaw's MoviePage http://www.inconnect.com/~renshaw/ *** Subscribe to receive new reviews directly by email! See the MoviePage for details, or reply to this message with subject line "Subscribe".
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


class Builder<U> : ComponentLoaderBuilder<DefaultOperationLoader<U>>
Builds an instance of DefaultOperationLoader.
U
- Type of the operations to be loaded.
Builder()
Builds an instance of DefaultOperationLoader. |
lateinit var operationNames: List<String> |
fun build(): DefaultOperationLoader<U>
Builds an instance of DefaultOperationLoader with the configuration information given to the builder. |
|
fun operations(names: List<String>): DefaultOperationLoader.Builder<U>
Sets the names of the operations to load. |


--- permalink: /download/index.html title: "Download - Godot Engine" description: "Download the latest stable version of the Godot Engine for Linux, macOS, Windows, or Android" layout: default ---
If you are not being redirected automatically, click here.


Teams
Sophists
How to Contribute
Team Adhwithiya
🛡House: Vikramshila
Team Arghya
🛡House: Vikramshila
Team Avyakt
🛡House: Takshashila
Team Chetak
🛡House: Takshashila
Team Kshitij
🛡House: Mithila
Team Lakshy
🛡House: Vikramshila
Team Navikaran
🛡House: Takshashila
Team Ojas
🛡House: Nalanda
Team Prakhyath
🛡House: Nalanda
Team Sadhbhav
🛡House: Nalanda
Team Saksham
🛡House: Takshashila
Team Siddhanth
🛡House: Mithila
Team Udbhav
🛡House: Mithila
Team Udvikaas
🛡House: Vikramshila
Team Vikalp
🛡House: Mithila
Team Vivaan
🛡House: Nalanda
Team Sushiksha
🛡House: WKC


Registration
Home Page
View Applicants
Education Details
Degree Name
Major
University Name
Start Date
Complete Date
GPA
Register


{ CAMS CSC }
{ About }
What is CAMS CSC
CAMS CSC stands for CAMS Computer Science and Cyber Security Club. We are committed to inspiring and teaching students about computers, hacking, forensics, software, hardware, and most importantly, how to have fun with the knowledge and skills that you develop.
Our Philosophy
At CAMS CSC, we believe that learning about computers should not be a mundane task. While this club will eventually convert most of the social time currently available to you into social time with your computer, the knowledge you will gain far supersedes the satisfaction of communicating with humans. We will have frequent and rewarding challenges that follow lessons. In addition, we will not force you to show up to every meeting. However, showing up does benefit you because it will give you an opportunity to interact with other humans who have similar interests.
{ CTF }
Capture the Flag
We make learning fun by uncovering the scientific, competitive, legislative, and mischievous nature of students. Command your team of up to 3 members as you fervently battle your way into the top of the scoreboard in the an all year long CTF game. The top teams will get glory, fame, and prizes too! However, this isn't the usual game of capture the flag where you run around trying to steal other teams' flags. This is the CTF of the digital world. Teams will be given intimidating challenges to solve. Every challenge contains a special string of text which is the "flag." Upon discovering a flag, your team can submit it for points. Along the way, you will solve cryptographic puzzles, attack flaws on the CTF server, reverse engineer binaries, write simple algorithms, and maybe even learn a thing or two.
{ Learn }
We Educate
If learning is much more than regurgitation, then teaching is much more than telling. Teaching is explaining, demonstrating, and ultimately inspiring. We do not expect anyone to magically understand concepts regarding computers simply from experimentation. Sometimes, it is necessary to understand conceptual and abstract things before one can proceed to apply them in a more advanced way. When we first began as a club, we taught with PowerPoint presentations. However, such methods of teaching turned out to be ineffective because everyone learned at his/her own pace and PowerPoints lose their value without a presenter. CSC has evolved to use a truly integrated online lesson system. We have combined an interactive and mobile capable web interface with comprehensive lessons that are easy enough for everyone to understand. Some lessons even have a sprinkle of humor. Check it out for yourself!
{ Join }
Our Location
Latitude: 33.8614052172° | Longitude: -118.2551897198°
In other words, we meet in Ms. Barnett's computer programming room, room 6014.
Meeting Times
Start: 0 16 * * 4 | End: 0 17 * * 4
In other words, we meet once every week on Thursdays from 4:00 pm - 5:00 pm.
Optional Paraphernalia
- A laptop
- Your brain
Procedure for Joining
- Show up at any meeting!


A Contesting Decision
问题描述 :
Judging a programming contest is hard work, with demanding contestants, tedious decisions,and monotonous work. Not to mention the nutritional problems of spending 12 hours with only donuts, pizza, and soda for food. Still, it can be a lot of fun.
Software that automates the judging process is a great help, but the notorious unreliability of some contest software makes people wish that something better were available. You are part of a group trying to develop better, open source, contest management software, based on the principle of modular design.
Your component is to be used for calculating the scores of programming contest teams and determining a winner. You will be given the results from several teams and must determine the winner.
Scoring
There are two components to a team’s score. The first is the number of problems solved. The second is penalty points, which reflects the amount of time and incorrect submissions made before the problem is solved. For each problem solved correctly, penalty points are charged equal to the time at which the problem was solved plus 20 minutes for each incorrect submission. No penalty points are added for problems that are never solved.
So if a team solved problem one on their second submission at twenty minutes, they are charged 40 penalty points. If they submit problem 2 three times, but do not solve it, they are charged no penalty points. If they submit problem 3 once and solve it at 120 minutes, they are charged 120 penalty points. Their total score is two problems solved with 160 penalty points.
The winner is the team that solves the most problems. If teams tie for solving the most problems,then the winner is the team with the fewest penalty points.
Software that automates the judging process is a great help, but the notorious unreliability of some contest software makes people wish that something better were available. You are part of a group trying to develop better, open source, contest management software, based on the principle of modular design.
Your component is to be used for calculating the scores of programming contest teams and determining a winner. You will be given the results from several teams and must determine the winner.
Scoring
There are two components to a team’s score. The first is the number of problems solved. The second is penalty points, which reflects the amount of time and incorrect submissions made before the problem is solved. For each problem solved correctly, penalty points are charged equal to the time at which the problem was solved plus 20 minutes for each incorrect submission. No penalty points are added for problems that are never solved.
So if a team solved problem one on their second submission at twenty minutes, they are charged 40 penalty points. If they submit problem 2 three times, but do not solve it, they are charged no penalty points. If they submit problem 3 once and solve it at 120 minutes, they are charged 120 penalty points. Their total score is two problems solved with 160 penalty points.
The winner is the team that solves the most problems. If teams tie for solving the most problems,then the winner is the team with the fewest penalty points.
输入:
For the programming contest your program is judging, there are four problems. You are guaranteed that the input will not result in a tie between teams after counting penalty points.
Line 1 < nTeams >
Line 2 – n+1 < Name > < p1Sub > < p1Time > < p2Sub > < p2Time > … < p4Time >
Line 1 < nTeams >
Line 2 – n+1 < Name > < p1Sub > < p1Time > < p2Sub > < p2Time > … < p4Time >
The first element on the line is the team name, which contains no whitespace.Following that, for each of the four problems, is the number of times the team submitted a run for that problem and the time at which it was solved correctly (both integers). If a team did not solve a problem, the time will be zero. The number of submissions will be at least one if the problem was solved.
输出:
The output consists of a single line listing the name of the team that won, the number of problems they solved, and their penalty points.
样例输入:
4 Stars 2 20 5 0 4 190 3 220 Rockets 5 180 1 0 2 0 3 100 Penguins 1 15 3 120 1 300 4 0 Marsupials 9 0 3 100 2 220 3 80
样例输出:
Penguins 3 475
解题代码:
//* @author<EMAIL_ADDRESS>import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); int n=new Integer(stdin.readLine()); String nombre="",winner=""; int sub,pena,solved,time; int maxsolved=0,mintime=0; StringTokenizer tokens; for(int i=0;i< n;i++){ tokens=new StringTokenizer(stdin.readLine()); nombre=tokens.nextToken(); solved=0; time=0; for(int j=0;j< 4;j++){ sub=new Integer(tokens.nextToken()); pena=new Integer(tokens.nextToken()); if(pena!=0){ solved++; time+=(sub-1)*20+pena; } } if(solved>maxsolved||(solved==maxsolved&&time< mintime)||i==0){ winner=nombre; maxsolved=solved; mintime=time; } } System.out.println(winner+" "+maxsolved+" "+mintime); } }
(adsbygoogle = window.adsbygoogle || []).push({});
写的好····· Pollard Rh
正在学习搜索，很好
很好的题，还是能做出几道的，嘿嘿
有些说不通吧，只有1个孩子肯定是男孩了
什么破题，题意好难懂啊
其实就是DFS搜索，数据量较小，穷举了所有情况
好厉害～
这个还不错
第15行代码，/n/n，应该改为nn
不错
很好的思路，可以借鉴
这是什么编译器啊，不通过
后面的是python代码啊
有意思，有难度


--- title: flow-view event hooks layout: page codepen: VeoRaw --- {% include try-it-on-codepen.html %}
{% include jscode/event-log.js %}


|
CUDNN Frontend API
8.3.0
|
exception indicating other library errors More...
#include <json.hpp>
Static Public Member Functions | |
| template<typename BasicJsonType > | |
| static other_error | create (int id_, const std::string &what_arg, const BasicJsonType &context) |
Private Member Functions | |
| other_error (int id_, const char *what_arg) | |
Additional Inherited Members | |
| Public Member Functions inherited from nlohmann::detail::exception | |
| const char * | what () const noexcept override |
| returns the explanatory string More... | |
| Public Attributes inherited from nlohmann::detail::exception | |
| const int | id |
| the id of the exception More... | |
| Protected Member Functions inherited from nlohmann::detail::exception | |
| exception (int id_, const char *what_arg) | |
| Static Protected Member Functions inherited from nlohmann::detail::exception | |
| static std::string | name (const std::string &ename, int id_) |
| template<typename BasicJsonType > | |
| static std::string | diagnostics (const BasicJsonType &leaf_element) |
exception indicating other library errors
This exception is thrown in case of errors that cannot be classified with the other exception types.
Exceptions have ids 5xx.
| name / id | example message | description |
|---|---|---|
| json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. |
{The following code shows how an other_error
exception can be caught.,other_error}
|
inlineprivate |
|
inlinestatic |
Definition at line 3003 of file json.hpp.
References nlohmann::detail::exception::diagnostics(), JSON_HEDLEY_NON_NULL, nlohmann::detail::exception::name(), and nlohmann::detail::string.
Referenced by nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::json_value(), and nlohmann::basic_json< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType >::patch().


BlobMetrics¶
This class is used for quantitative evaluation of detected results
-
class
src.BlobMetrics.
BlobMetrics
(ground_truth_coords, predicted_coords, euclidean_distance_threshold=0)¶ Bases:
object
BlobMetrics class can be instantiated with the following args
- parameters, types, return and return types:
Parameters: - ground_truth_coords (list [z,y,x]) – full path to the CSV file having annotations
- predicted_coords (list [z,y,x]) – full path to the CSV file having the predictions
- euclidean_distance_threshold (integer) – (optional) euclidean distance in voxels, within which a ground truth and prediction are considered as a hit
-
accuracy
()¶ True positives / Number of ground truth labels
-
f_measure
()¶ (2 x precision x recall)/(precision + recall)
-
g_measure
()¶ sqrt(precision x recall)
-
get_region_based_count
(ontology_file, registered_brain_tif)¶ Given a region ontology file and a registered annotated brain, this method returns the number of predicted cells in each region
-
mean_square_error
(edist=None)¶ Sum of euclidean distances between predicted and ground truth labels
-
plot_accuracy_sensitivity
()¶ Plots change of accuracy with euclidean_distance_threshold
-
plot_fmeasure_sensitivity
()¶ Plots change of F-Measure with euclidean_distance_threshold
-
plot_ground_truths_per_prediction
(fname=None)¶ Plots a bar graph of number of ground truth labels for each prediction
-
plot_intensity_mapping
(region_intensities, reg_atlas_tif, id2name, fig_path=None)¶ Plots intensity sum of each region
-
plot_mean_square_error_sensitivity
()¶ Plots change of mean square error with euclidean_distance_threshold
-
plot_predictions_per_ground_truth
(fname=None)¶ Plots a bar graph of number of predictions for each ground truth
-
plot_predictions_with_ground_truth
(fname=None)¶ Plots a visualization of predictions with ground truth labels
-
plot_region_based_count
(count_statistics=None, fig_path=None)¶ Plots a number of cells in each region
-
precision
()¶ True positives / true positives + false positives
-
recall
()¶ True positives / true positives + false negatives


Our page is currently undergoing maintenance and should be back in a bit. Please try again later.
Stay secure,deSEC Team


VSL // A Mediterranean State Of Mind
* I brought back Ca'Vè Caffè beans from Cafe Venezia as last minute gifts three years ago. I didn’t know anything about it, other than that the café was cute and I wanted something that could only be found in Venice. To my surprise, it turned out to be the most delicious coffee, with an incredible story behind its beans
today’s Very Short List:
style 16 Jan 2015
Alison Ragusa blended her expertise in holistic health, gastronomy, and fashion to create Bogavia Beauty
Subscribe
* All three times that I’ve lived in Florence I’ve found Via Porta Rossa to be the most enchanting. A stay at the ancient Hotel Porta Rossa
* I always search for the best Pilates studio in every city I travel to. Maiden Lane Studios
http://link.nyobserver.com/516ca68465217dc6e1b9a3a626i0e.258e/TvnrKi0WTdwTHwxwC68f5
delightful e-mail that shares
cultural gems from a
different curator every day.
If you have any problems reading this e-mail, click here
http://link.nyobserver.com/516ca68465217dc6e1b9a3a626i0e.258e/UHyHCJsf7NZSKXrPC2cb6
Subscribe
Forward
My Account
Unsubscribe
culture 14 Jan 2015
Shannon Bahrke takes us skiing!
culture 12 Jan 2015
John Oseid just got back from Haiti, and can’t wait to visit again.
design 9 Jan 2015
Pamela Bell has a passion for change.
Editorial Policy
Privacy Policy
Contact Us
Press
Terms + Conditions
very fine print: ©2015
Observer VSL LLC.
321 West 44th Street, 6th Floor
New York, NY 10036 USA
All rights reserved.
Questions?<PHONE_NUMBER>.
This message was intended for<EMAIL_ADDRESS>If you believe this has been sent to you in error, please safely unsubscribe


Steve Aiken refuses to confirm George Hamilton North Down candidate approach
ULSTER Unionist leader Steve Aiken has declined to state categorically whether or not he approached former chief constable Sir George Hamilton to stand as a Westminster candidate in North Down.
It has been claimed the "top-tier of the UUP" and others approached the former PSNI head to explore the possibility of him contesting the seat.
The approaches are said to have taken place before Lady Sylvia Hermon, North Down MP since 2001, withdrew from the Westminster race earlier this month.
The claims came from veteran journalist Brian Rowan, who himself stood in the constituency as an independent in the 2007 assembly election.
Mr Rowan said his claims have not been not been challenged by Sir George.
Quizzed about the approach on BBC's The View, Mr Aiken said he had known the former chief constable for a "long time" and that the two had had "many private conversations" in which the pair had discussed a "range of issues".
"There was only ever one candidate in the frame for North Down and that was Alan Chambers," the UUP leader said.
Mr Aiken also defended his criticism of Queen's University academic Professor Colin Harvey, who has carried out research on constitutional change.
The South Antrim MLA claimed that there was an absence unionist academics at the university countering nationalist voices.
He described Queen's as a "cool place"for unionists.


這是我近期裡面看到算比較有趣的演講，是 Github CTO Tom Preston-Werner 給的 talk
影片在這裡： http://confreaks.net/videos/712-rubyconf2011-github-flavored-ruby
投影片在這裡： http://speakerdeck.com/u/mojombo/p/github-flavored-ruby
本來先貼在社群內 http://ruby-taiwan.org/topics/69。現在來補充貼我自己的筆記…
裡面提到非常多有趣的東西。
提到五個 Github 的開發哲學：
- Relentless Modularization
- Readme Driven Development
- Rake Gem
- TomDoc
- Semantic Version
雖然這個 talk 長度不到一個小時，但是從中不少學到知識。
Relentless Modularization
當專案越來越大，身處其中的開發者就會越來越感覺到 codebase 帶來的壓力， code 會變得越來越 messay 和 tightly coupled。牽一髮而動全身。
把一些元件 modularize 應該會是好的解法。但我們總會困惑，那什麼東西應該是應該被 modularize ？
TOM 給出的答案：EVERYTHING。
Github 是這樣做的，當它們在建造 http://github.com 時，因為 Github 是個 git services。 於是他們造了
接著他們為了要 scale up，造了
- smoke，讓 frontend 可以直接跟 backend 溝通。
We then replace Grit::Git with a stub that makes RPC calls to our Smoke service. Smoke has direct disk access to the repositories and essentially presents Grit::Git as a service. It’s called Smoke because Smoke is just Grit in the cloud. Get it?
https://github.com/blog/530-how-we-made-github-fast http://www.slideshare.net/rubymeetup/inside-github-with-chris-wanstrath
而 smoke 又用了 bertrpc
For our data serialization and RPC protocol we are using BERT and BERT-RPC.
和
- proxymachine https://github.com/mojombo/proxymachine
保持連線平穩
ProxyMachine is my content aware (layer 7) TCP routing proxy that lets us write the routing logic in Ruby.
Each frontend runs four ProxyMachine instances behind HAProxy that act as routing proxies for Smoke calls.
再使用 chimney 控制 route
- chimney
Chimney finds the route by making a call to Redis. Redis runs on the database servers. We use Redis as a persistent key/value store for the routing information and a variety of other data.
而每台 Fileserver 上面跑了兩組 Ernie Server。Erine 是 BERT-RPC server implementation that uses an Erlang server to accept incoming connections。
Every file server runs two Ernie RPC servers behind HAProxy. Each Ernie spawns 15 Ruby workers. These workers take the RPC call and reconstitute and perform the Grit call. The response is sent back through the Smoke proxy to the Rails app where the Grit stub returns the expected Grit response.
當事情出錯了，用 Failbot 去掌握災情..
- failbot https://gist.github.com/1162437
===
- gerve
用 Gerve 去管控 identity
GitHub user and this information is sent along with the original command and arguments to our proprietary script called Gerve (Git sERVE). Think of Gerve as a super smart version of git-shell.
Gerve verifies that your user has access to the repository specified in the arguments. If you are the owner of the repository, no database lookups need to be performed, otherwise several SQL queries are made to determine permissions
用 resque 實作 job queue
Resque (pronounced like "rescue") is a Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.
RockQueue 是用來把東西丟進 resque
Rock Queue is a simple, yet powerful unified interface for various messaging queues. In other words it allows you to swap your queuing back-end without making any modification to your application except changing the configuration parameters.
jekyll 用來生靜態檔案
Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server.
nodeload 是拿來 handling download files
albino 拿來處理 pygments 上色
Albino: a ruby wrapper for pygmentize
markup 用來處理不同 format 文檔的 rendering
We use this library on GitHub when rendering your README or any other rich text file.
camo 用來作 SSL proxy
Camo is all about making insecure assets look secure. This is an SSL image proxy to prevent mixed content warnings on secure pages served from GitHub.
gollum 作 wiki-backend
Gollum wikis are simply Git repositories that adhere to a specific format. Gollum pages may be written in a variety of formats and can be edited in a number of ways depending on your needs. You can edit your wiki locally
stratocaster 拿來作 event timeline
Stratocaster is a system for storing and retrieving messages on feeds. A message can contain any arbitrary payload. A feed is a filtered stream of messages. Complex querying is replaced in favor of creating multiple feeds as filters for the messages. Stratocaster uses abstract adapters to persist the data, instead of being bound to any one type of data store.
- amen
amen is for graphing ( 我找不到資料 )
- heaven 用來作 deploy
http://bloggitation.appspot.com/entry/rubykaigi-2001-notes-day-1 https://github.com/holman/feedback/issues/38
`Heaven - wrapper around capistrano for easy branch deployments:
heaven -a github -e production -h fe -b my_branch`
- haystack 拿來收集 Failbot 傳回來的 Exception log
http://www.slideshare.net/rubymeetup/inside-github-with-chris-wanstrath # 173
We use in-house app called Haystack to monitor abitrary information treacked as JSON
- hubot
就是…bot XD
- github-services
https://github.com/github/github-services
Official GitHub Services Integration - You can set these up in your repo admin screen under Service Hooks
- help.github.com
https://github.com/github/help.github.com
opensource GitHub help guides
這一段只有七分鐘，但蒐集到的資料太多了…
開下一篇等等再接著寫。
其他
在翻一些相關資料時，還找到不少好東西
- https://github.com/blog/530-how-we-made-github-fast
- http://www.slideshare.net/rubymeetup/inside-github-with-chris-wanstrath
這兩篇也給了蠻多其他的 detail 的…


Technophilia will be going to help all the students to take a step ahead by witnessing themselves all the major activities which will keep in trend for two days. Following are the major activities list: • Coding Compete • Tech Debate • IoT Team • Debugging Challenges • Ethical Hacking • LAN Gaming • eTreasure Hunt • Still counting... Technophilia not only going to introduce science activities but also large amount of social, fitness, entertainment, cultural etc. activating. Below is the quick list of such fun fairs: • Hand Made Poster Designing • Khojiyon Ki Toli (Inspired by Sherlock Holmes Series) • Pani Puri Marathon (Inspired by Confidential) • Frame’s Battle • General Ability/Hobbies Introductions • And many…
Date: 7th Oct’16 Time : 10:30 AM TO 11:30 AM Venue: LT 1 No. of participants : 2 Event Description: A complete technical event which tests your core programming languages skills(C & C++).
1. Participants will be judged on the ground of the desired output along with the precision of the code. 2. Participants are not allowed to communicate with any other team members while the test is in run. 3. No one is allowed to bring their own system for the test.
Date : 7th October 2016 Time : 12:00 noon – 1:30 pm Venue : LT 1 Event Description : Participants who are qualified in General Ability(Round 1) will be tested on the grounds of general awareness and current affairs knowledge
1. Participants are not allowed to refer any other source during the exam. 2. Even if you know the answer, you won’t be allowed to answer until and unless u buzz the buzzer firstly.
Date -7th Oct ‘16 Time -12:00 pm to 01:00 Pm Venue – Lab 1 No. of participants- 2 Event Description- It is a computer based treasure hunt. Participants will be challenged with some riddles needed to unfold as they will contain clues to move further.
1. Interaction with other team members is not allowed during the event. 2. The submission of the result must be done under the defined time limit only.
Date: 7th Oct ‘16 Time: 11:30 AM to 1:00PM Venue: IIPS PREMISES Event Description: A list of technical articles will be given to the teams a day prior to the event. Participants need to gather and submit the aged articles describing their utility in the present Scenario.
1. Interaction with other team members is not allowed during the event. 2. The submission of the result must be done under the defined time limit only.
Date -6th Oct ‘16 Time -03:00pm to 05:00 Pm Venue – II floor old counselling area No. of participants- max 3 Event Description- participants will have to make a poster on the topic provided by the organiser’s at that very spot.
1. Drawing sheet will be provided by the organiser’s side. 2. Participants need to bring all the requisites for their creation. There is no provision for any stationary from oc. 3. Time limit will be two hours. 4. Discussions should be with your team partners only, not with others. 5. The team has to present the message desired to be conveyed before the judges. 6. Participants are not allowed to copy the poster idea from any other reference during the test time.
Date: 7th October 2016 Time: 3:30- 4:30 pm Venue: IIPS Premises No. of Participants: 1 Event Description: A mouth watering GOL_GAPPA marathon deciding the HUNGER_KING.
1. Only a single person allowed for taking part in this event. 2. The same participant will persist throughout the whole pani-puri circulation, i.e. teams are not allowed to switch the participants in mid of the event.
Date: 6th October 2016 Time: 1:30-3:00 pm Venue: LAB 1 No. of participants : 2 Event Description : A fun- filled event for the game-maniacs . (Counter_ Strike)
Date: 7th October 2016 Time: 10:30am-2:00pm Event Description: It’s a collage and video making competition.
1. Photographs must be somehow authentic and genuine making sure that the snaps clicked by the team members only. 2. The collage must contain at least 10 photographs. 3. The collage must be submitted in the hard copy.


Class HttpClientRequest
source code
object --+
|
streams.WriteStream --+
|
HttpClientRequest
Instances of this class are created by an HttpClient instance, via one
of the methods corresponding to the specific HTTP methods, or the generic
HttpClient request method.
Once an instance of this class has been obtained, headers can be set
on it, and data can be written to its body, if required. Once you are
ready to send the request, the end method must called.
Nothing is sent until the request has been internally assigned an HTTP
connection. The HttpClient instance will return an instance of this class
immediately, even if there are no HTTP connections available in the pool.
Any requests sent before a connection is assigned will be queued
internally and actually sent when an HTTP connection becomes available
from the pool.
The headers of the request are actually sent either when the end
method is called, or, when the first part of the body is written,
whichever occurs first.
This class supports both chunked and non-chunked HTTP.
- Overrides:
object.__init__
- (inherited documentation)
|
|
Headers for the request
- Decorators:
|
|
Inserts a header into the request.
Keyword arguments:
- Parameters:
key - The header key
value - The header value.
- Returns:
- self so multiple operations can be chained.
|
|
Write a to the request body.
Keyword arguments:
- Parameters:
str - The string to write.
enc - The encoding to use.
- Returns:
- self So multiple operations can be chained.
|
|
Forces the head of the request to be written before end is called on
the request. This is normally used to implement HTTP 100-continue
handling, see continue_handler for more information.
- Returns:
- self So multiple operations can be chained.
|
|
Ends the request. If no data has been written to the request body, and
send_head has not been called then the actual request won't get written
until this method gets called. Once the request has ended, it cannot be
used any more, and if keep alive is true the underlying connection will
be returned to the HttpClient pool so it can be assigned to another
request.
|
|
Same as write_buffer_and_end but writes a String
Keyword arguments:
- Parameters:
str - The String to write
enc - The encoding
|
|
Same as end but writes some data to the response body before ending.
If the response is not chunked and no other data has been written then
the Content-Length header will be automatically set
Keyword arguments:
- Parameters:
chunk - The Buffer to write
|
|
Sets whether the request should used HTTP chunked encoding or not.
Keyword arguments:
- Parameters:
val - If val is true, this request will use HTTP chunked encoding, and
each call to write to the body will correspond to a new HTTP
chunk sent on the wire. If chunked encoding is used the HTTP
header 'Transfer-Encoding' with a value of 'Chunked' will be
automatically inserted in the request.
If chunked is false, this request will not use HTTP chunked
encoding, and therefore if any data is written the body of the
request, the total size of that data must be set in the
'Content-Length' header before any data is written to the request
body.
- Returns:
- self So multiple operations can be chained.
|
|
Set's the amount of time after which if a response is not received
TimeoutException() will be sent to the exception handler of this request.
Calling this method more than once has the effect of canceling any
existing timeout and starting the timeout from scratch.
Keyword arguments:
- Parameters:
val - The quantity of time in milliseconds.
- Returns:
- self So multiple operations can be chained.
|
|
If you send an HTTP request with the header 'Expect' set to the value
'100-continue' and the server responds with an interim HTTP response with
a status code of '100' and a continue handler has been set using this
method, then the handler will be called. You can then continue to write
data to the request body and later end it. This is normally used in
conjunction with the send_head method to force the request header to be
written before the request has ended.
Keyword arguments:
- Parameters:
|


Home
Categories
Favorites
About
Login/Sign up
Life Hacker
Science Hacks
Tech Hacks
D.I.Y. Hacks
Home Hacks
Kitchen Hacks
Biz Hacks
Money Hacks
Life Hacks
Hack It!
Hack It!
Hack It!
Hack It!
Hack It!
Hack It!


About Us
Our Vision
Keep you updated with the latest technologies, help you learn new things and to keep the web free and open to all.
Facts
92
Members
12
Events
9
Sponsers
11
Hard Workers
Events
- All
- Upcoming Events
- Past Events
Unscript 2k23
11th & 12th Febuary 2023
Design Validation
25th January 2023
Innovation and Entrepreneurship
23rd September 2022
Design Validation
21st October 2021
Linux Security and Hacking
16th & 17th October 2021
Prototype Validation
10th April 2021
RoadMap : CyberSecurity
27th March 2021
Design and Validation
5th December 2020
Unscript2K20
21-22nd November 2020
AWS Workshop
31 October 2020
Node.js Workshop
3 August 2019
HTML, CSS AND Javascript Workshop
5 OCTOBER 2019
Networking Workshop
Past Event
Github Workshop
Past Event
Mozi Tech Talk 2019
Past Event
Hackathon 2019
Past Event
Ethical Hacking Seminar
Past Event
PHP Workshop
Past Event
Typing Contest
Past Event
Android Workshop
Past Event
Mozi Tech Talk 2018
Past Event
UnScript 2018
Past Event
Bash Shell Scripting
Past Event
Our Sponsers
Faculty Incharge
Prof. Prajakta Dhamanskar
Team
Shoydon Alphonso
CaptainCrystal Fernandes
Vice CaptainLisa Pereira
WebmasterLisa Gonsalves
Event HeadSanika Patankar
Marketing HeadSaahil Fernandes
Public Relations HeadAlfred Shajan
SE RepresentativeAllan Monis
Design HeadVallen D'souza
Documentation HeadHardik Murudi
Digi ContentPiyush Bhartiya
TreasurerContact Us
Address
Fr. Conceicao Rodrigues College of EngineeringFr. Agnel Ashram, Bandstand, Bandra (West)
Mumbai, India - 400050.


13.2 access.log
Squid saves key information about
HTTP transactions in access.log. This file is
line-based, such that each line corresponds to one client request.
Squid records the client IP address (or hostname), requested URI,
response size, and other information.
Squid records all HTTP accesses in access.log,
except for those that disconnect before sending any data. Squid also
records all ICP (but not HTCP) transactions unless you disable them
with the log_icp_queries directive.
Section 13.2.4 describes the
other squid.conf directives that affect the
access log.
The default access.log format contains 10
fields. Here are some examples,
with long lines split and indented:
1066037222.011 126389 <IP_ADDRESS> TCP_MISS/503 1055
GET http://home.gigigaga.com/n8342133/Miho.DAT.019 -
DIRECT/<IP_ADDRESS> -
1066037222.011 19120 <IP_ADDRESS> TCP_MISS/200 359
GET http://ads.x10.com/720x300/Z2FtZ3JlZXRpbmcxLmRhd/7/AMG -
DIRECT/<IP_ADDRESS> text/html
1066037222.011 34173 <IP_ADDRESS> TCP_MISS/200 559
GET http://coursesites.blackboard.com:8081/service/collab/../1010706448190/ -
DIRECT/<IP_ADDRESS> application/octet-stream
1066037222.011 19287 <IP_ADDRESS> TCP_REFRESH_MISS/200 500
GET http://fn.yam.com/include/tsemark/show.js -
DIRECT/<IP_ADDRESS> application/x-javascript
1066037222.011 19395 <IP_ADDRESS> TCP_MISS/304 274
GET http://fnasp.yam.com/image/coin3.gif -
DIRECT/<IP_ADDRESS> -
1066037222.011 19074 <IP_ADDRESS> TCP_CLIENT_REFRESH_MISS/304 197
GET http://ads.icq.com/content/B0/0/..bC6GygEYNeHGjBUin5Azfe68m5hD1jLk$/aol -
DIRECT/<IP_ADDRESS> -
1066037222.011 19048 <IP_ADDRESS> TCP_MISS/200 261
GET http://ads.adsag.com/js.ng/...ne&cat=friendship&subcat=girltalk -
DIRECT/<IP_ADDRESS> application/x-javascript
1066037222.118 106 <IP_ADDRESS> TCP_HIT/200 536
GET http://rcm-images.amazon.com/images/G/01/rcm/privacy.gif -
NONE/- image/gif
1066037222.352 19475 <IP_ADDRESS> TCP_MISS/200 12387
GET http://espanol.geocities.com/lebastias/divulgacion/budismo-tarot.html -
DIRECT/<IP_ADDRESS> text/html
1066037222.352 132 <IP_ADDRESS> TCP_MISS/504 1293
GET http://ar.atwola.com/image/93101912/aol -
NONE/- -
Here are the definitions for all fields:
- 1: timestamp
-
The completion time of the request, expressed as the
number of
seconds since the Unix epoch (Thu Jan 1 00:00:00 UTC 1970), with
millisecond resolution. Squid uses this format, instead of something
more human-friendly, to simplify the work of various log file
processing programs.
You can use a simple Perl command to convert the Unix timestamps into
local time. For example:
perl -pe 's/^\d+\.\d+/localtime($&)/e;' access.log
- 2: response time
-
For HTTP transactions, this field indicates how much time it
took to process the request. The timer starts when Squid receives the
HTTP request and stops when the response has been fully delivered.
The response time is given in milliseconds.
The response time is usually 0 for ICP queries. This is because Squid
answers ICP queries very quickly. Furthermore, Squid
doesn't update the process clock between receiving
an ICP query and sending the reply.
While time values are reported with millisecond resolution, the
precision of those entries is probably about 10 milliseconds. Timing
becomes even less precise when Squid is heavily loaded.
- 3: client address
-
This field contains the
client's IP address, or hostname if you enable
log_fqdn. For security or privacy reasons, you
may want to mask a part of client's address out
using the client_netmask directive. However,
that also makes it impossible to group requests coming from the same
client.
- 4: result/status codes
-
This field consists of two tokens separated by a slash.
The first token, result code, classifies the protocol and the result
of a transaction (e.g., TCP_HIT or
UDP_DENIED). These are Squid-specific codes,
defined in Section 13.2.1. The codes that begin with
TCP_ refer to HTTP requests, while
UDP_ refers to ICP queries.
The second token is the HTTP response status code (e.g, 200, 304,
404, etc.). The status code normally comes from the origin server. In
some cases, however, Squid may be responsible for selecting the
status code. These codes, defined by the HTTP RFC, are summarized
later in Table 13-1.
- 5: transfer size
-
This field indicates the number of bytes transferred to the
client. Strictly speaking, it is the number of bytes that Squid told
the TCP/IP stack to send to the client. Thus, it
doesn't include overheads from TCP/IP headers. Also
note that the transfer size is normally larger than the
response's Content-Length. This
value includes the HTTP response headers, while
Content-Length does not.
These properties make the transfer size field useful for approximate
bandwidth usage analysis but not for exact HTTP entity size
calculations. If you need to know a response's
Content-Length, you can find it in the
store.log file.
- 6: request method
-
This field contains the request method. Because Squid clients
may use ICP or HTTP, the request method is either HTTP- or
ICP-specific. The most common HTTP request method is
GET. ICP queries are always logged with
ICP_QUERY. See Section <IP_ADDRESS> for a
list of HTTP methods Squid knows about.
- 7: URI
-
This field contains the URI from the
client's request. The vast majority of logged URIs
are actually URLs (i.e., they have hostnames).
Squid uses a special format for certain failures. These are cases
when Squid can't parse the HTTP request or otherwise
determine the URI. Instead of a URI/URL, you'll see
a string such as
"error:invalid-request." For
example:
1066036250.603 310 <IP_ADDRESS> NONE/400 1203 GET error:invalid-request - NONE/- -
Also in this field look out for whitespace characters in the URI.
Depending on your uri_whitespace setting, Squid
may print the URI in the log file with whitespace characters. When
this happens, the tools that read access.log
files may become confused by the extra fields.
When logging, Squid strips all URI characters after the first
question mark unless the strip_query_terms
directive is disabled.
- 8: client identity
-
Squid can determine a user's identity in
two different ways. One is with the RFC 1413 ident protocol; the
other is from HTTP authentication headers.
Squid attempts ident lookups based on the
ident_lookup_access rules, if any (see Section 6.2). Alternatively, if you use proxy
authentication (or regular server authentication in surrogate mode),
Squid places the given username in this field. If both methods
provide Squid with a username, and you're using the
native access.log format, the HTTP
authentication name is logged, and the RFC 1413 name is ignored. The
common log file format has separate fields for both names.
- 9: peering code/peerhost
-
The peering information consists of two tokens,
separated by a slash. It is relevant only for requests that are cache
misses. The first token indicates how the next hop was chosen. The
second token is the address of that next hop. The peering codes are
listed in Section 13.2.3.
When Squid sends a request to a neighbor cache, the peerhost address
is the neighbor's hostname. If the request is sent
directly to the origin server, however, Squid writes the origin
server's IP address or its hostname if
log_ip_on_direct is disabled. The value
NONE/- indicates that Squid
didn't forward this request to any other servers.
- 10: content type
-
The final field of the default, native
access.log is the content type of the HTTP
response. Squid obtains the content type value from the
response's Content-Type header.
If that header is missing, Squid uses a hyphen
(-).
If you enable the log_mime_headers directive,
Squid appends two additional fields to each line:
- 11: HTTP request headers
-
Squid encodes the HTTP request headers and prints
them between a pair of square brackets. The brackets are necessary
because Squid doesn't encode space characters. The
encoding scheme is a little strange. Carriage return (ASCII 13) and
newline (ASCII 10) are printed as \r and
\n, respectively. Other non-printable characters
are encoded with the RFC 1738 style, such that Tab (ASCII 9) becomes
%09.
- 12: HTTP response headers
-
Squid encodes the HTTP response headers and prints
them between a pair of square brackets. Note that these are the
headers sent to the client, which may be different from headers
received from the origin server.
Squid writes to access.log only after the entire
response has been sent to the client. This allows Squid to include
both request and response information in the log file. However,
transactions that take minutes, or even hours, to complete
aren't visible in access.log at
the time of the request. When these types of transactions present a
performance or policy concern, the access.log
may be unable help you. Instead, use the cache manager to view a list
of pending transactions (see Section <IP_ADDRESS>).
13.2.1 access.log Result Codes
The following labels may
appear in the fourth field of the
access.log file in response to HTTP requests:
- TCP_HIT
-
Squid found a likely fresh copy of the requested resource and sent it
immediately to the client.
- TCP_MISS
-
Squid didn't have a cached copy of the requested
resource.
- TCP_REFRESH_HIT
-
Squid found a likely stale copy of the requested resource and sent a
validation request to the origin server. The origin server sent a 304
(Not Modified) response, indicating that Squid's
copy is still fresh.
- TCP_REF_FAIL_HIT
-
Squid found a likely stale copy of the requested resource and sent a
validation request to the origin server. However, the origin server
failed to respond or sent a response that Squid
didn't understand. In any case, Squid sent the
cached (and likely stale) copy to the client.
- TCP_REFRESH_MISS
-
Squid found a likely stale copy of the requested resource and sent a
validation request to the origin server. The server responded with
new content, indicating the cached response was indeed stale.
- TCP_CLIENT_REFRESH_MISS
-
Squid found a copy of the requested resource, but the
client's request included a
Cache-Control: no-cache
directive. Squid forwarded the client's request to
the origin server, forcing a cache validation.
- TCP_IMS_HIT
-
The client sent a validation request, and Squid found a more recent,
and likely fresh, copy of the requested resource. Squid sent the
newer content to the client, without contacting the origin server.
- TCP_SWAPFAIL_MISS
-
Squid found a valid copy of the requested resource but failed to load
it from disk. Squid then sent the request to the origin server as
though it were a cache miss.
- TCP_NEGATIVE_HIT
-
When a request to an origin server results in an HTTP error, Squid
may cache the response anyway. Repeated requests for these resources,
within a short amount of time, result in negative hits. The
negative_ttl directive controls the amount of
time these errors may be cached. Also note that errors are cached
only in memory and never written to disk. The following HTTP status
codes may be negatively cached, subject to additional constraints:
204, 305, 400, 403, 404, 405, 414, 500, 501, 502, 503, 504.
- TCP_MEM_HIT
-
Squid found a valid copy of the requested resource in the memory
cache and sent it immediately to the client. Note that this
doesn't accurately represent all responses served
from memory. For example, responses that are cached in memory, but
require validation, are logged with
TCP_REFRESH_HIT,
TCP_REFRESH_MISS, etc.
- TCP_DENIED
-
The client's request was denied, due to either the
http_access or
http_reply_access rules. Note that requests
denied by http_access have
NONE/- in the ninth field, whereas those denied by
http_reply_access have a valid entry.
- TCP_OFFLINE_HIT
-
When offline_mode is enabled, Squid returns
cache hits for almost any cached response, without considering its
freshness.
- TCP_REDIRECT
-
A redirector program told Squid to generate an HTTP redirect to a new
URI (see Section 11.1). Normally, Squid
doesn't log these redirects. To do so, you must
manually define the LOG_TCP_REDIRECTS preprocessor
directive before compiling Squid.
- NONE
-
Unclassified result used for certain errors, such as invalid
hostnames.
The following labels may appear in the fourth field of the
access.log file in response to ICP queries:
- UDP_HIT
-
Squid found a likely fresh copy of the requested resource in the
cache.
- UDP_MISS
-
Squid didn't find a likely fresh copy of the
requested resource in the cache. If the same object is requested via
HTTP, it would probably be a cache miss. Compare with
UDP_MISS_NOFETCH.
- UDP_MISS_NOFETCH
-
Like UDP_MISS, except that this also indicates
Squid's reluctance to handle the corresponding HTTP
request. If you use the -Y command-line option,
Squid returns this, instead of UDP_MISS, while
rebuilding its in-memory indexes at startup.
- UDP_DENIED
-
The ICP query is denied due to the icp_access
rules. If more than 95% of the ICP replies to a client are
UDP_DENIED, and the client database is enabled
(see Appendix A), Squid stops sending any ICP
replies to the client for an hour. When this happens
you'll also see a warning in
cache.log.
- UDP_INVALID
-
Squid received an invalid query (e.g., truncated message, invalid
protocol version, whitespace in the URI, etc.). Squid sent an
ICP_INVALID reply back to the client.
13.2.2 HTTP Response Status Codes
Table 13-1 lists the numerical HTTP response
codes and reason
phrases. Note that Squid and other HTTP agents care only about the
numeric value. The reason phrase is purely informational and
doesn't affect the meaning of the response. For each
status code, I also provide a reference to the particular section in
RFC 2616 that describes it. Note that status codes 0 and 600 are
nonstandard values used by Squid, and aren't
mentioned in the RFC.
Table 13-1. HTTP response status codes|
|
0
|
No Response Received (Squid-specific)
|
N/A
| |
1xx
|
Informational
|
10.1
| |
100
|
Continue
|
10.1.1
| |
101
|
Switching Protocols
|
10.1.2
| |
2xx
|
Successful
|
10.2
| |
200
|
OK
|
10.2.1
| |
201
|
Created
|
10.2.2
| |
202
|
Accepted
|
10.2.3
| |
203
|
Non-Authoritative Information
|
10.2.4
| |
204
|
No Content
|
10.2.5
| |
205
|
Reset Content
|
10.2.6
| |
206
|
Partial Content
|
10.2.7
| |
3xx
|
Redirection
|
10.3
| |
300
|
Multiple Choices
|
10.3.1
| |
301
|
Moved Permanently
|
10.3.2
| |
302
|
Found
|
10.3.3
| |
303
|
See Other
|
10.3.4
| |
304
|
Not Modified
|
10.3.5
| |
305
|
Use Proxy
|
10.3.6
| |
306
|
(Unused)
|
10.3.7
| |
307
|
Temporary Redirect
|
10.3.8
| |
4xx
|
Client Error
|
10.4
| |
400
|
Bad Request
|
10.4.1
| |
401
|
Unauthorized
|
10.4.2
| |
402
|
Payment Required
|
10.4.3
| |
403
|
Forbidden
|
10.4.4
| |
404
|
Not Found
|
10.4.5
| |
405
|
Method Not Allowed
|
10.4.6
| |
406
|
Not Acceptable
|
10.4.7
| |
407
|
Proxy Authentication Required
|
10.4.8
| |
408
|
Request Timeout
|
10.4.9
| |
409
|
Conflict
|
10.4.10
| |
410
|
Gone
|
10.4.11
| |
411
|
Length Required
|
10.4.12
| |
412
|
Precondition Failed
|
10.4.13
| |
413
|
Request Entity Too Large
|
10.4.14
| |
414
|
Request-URI Too Long
|
10.4.15
| |
415
|
Unsupported Media Type
|
10.4.16
| |
416
|
Requested Range Not Satisfiable
|
10.4.17
| |
417
|
Expectation Failed
|
10.4.18
| |
5xx
|
Server Error
|
10.5
| |
500
|
Internal Server Error
|
10.5.1
| |
501
|
Not Implemented
|
10.5.2
| |
502
|
Bad Gateway
|
10.5.3
| |
503
|
Service Unavailable
|
10.5.4
| |
504
|
Gateway Timeout
|
10.5.5
| |
505
|
HTTP Version Not Supported
|
10.5.6
| |
6xx
|
Proxy Error
|
N/A
| |
600
|
Unparseable Response Headers (Squid-specific)
|
N/A
|
You'll see status code 0 in the
access.log if Squid doesn't
receive any response from the origin server. You'll
see status code 600 if Squid received a response but
couldn't find any HTTP headers. In a small fraction
of cases, certain origin servers send only the response body and omit
any headers.
13.2.3 access.log Peering Codes
The following codes may appear in
the ninth field of the
access.log. Refer to Section 10.10 for a description of how Squid selects the
next-hop for cache misses.
- NONE
-
This indicates that Squid didn't communicate with
any other servers (neighbors, origin) for this request.
You'll see it in association with various types of
cache hits, denied requests, cache manager requests, errors, and all
ICP queries.
- DIRECT
-
Squid forwarded the request directly to the origin server. The second
half of the field shows the origin server's IP
address, or hostname if you've disabled
log_ip_on_direct.
- SIBLING_HIT
-
Squid sent the request to this sibling cache after the sibling
returned an ICP or HTCP hit.
- PARENT_HIT
-
Squid sent the request to this parent cache after the parent returned
an ICP or HTCP hit.
- DEFAULT_PARENT
-
Squid selected this parent because it was marked as
default on the cache_peer
line in squid.conf.
- FIRST_UP_PARENT
-
Squid forwarded the request to this parent because it is the first
parent in the list known to be alive.
- FIRST_PARENT_MISS
-
Squid forwarded the request to the parent cache that was first to
respond with an ICP/HTCP miss message. In other words, for this
particular ICP/HTCP query, at this particular time, the selected
parent had the best round-trip time. Note that measured RTTs may be
artificially adjusted by the weight option to the
cache_peer directive.
- CLOSEST_PARENT_MISS
-
Squid selected this parent because it reports the lowest RTT to the
origin server. This occurs only if both caches have
netdb enabled (see Section 10.5), and the origin server (or other servers on
its subnet) returns ICMP pings.
- CLOSEST_PARENT
-
This is similar to CLOSEST_PARENT_MISS, except
that the RTT measurements don't come from the
ICP/HTCP reply messages. Instead, they come from older measurements
saved by Squid, such as the netdb exchange feature.
- CLOSEST_DIRECT
-
Squid forwarded the request to the origin server based on
netdb measurements. This happens if any of these
conditions occur:
The RTT between Squid and the origin server is less than the
configured minimum_direct_rtt value. The measured number of router hops between Squid and the origin
server is less than the configured
minimum_direct_hops value. The RTT values returned in ICP/HTCP replies indicate that Squid is
closer to the origin server than any of its neighbors.
- ROUNDROBIN_PARENT
-
Squid forwarded the request to this parent because the
round-robin option was set, and it had the lowest
usage counter.
- CD_PARENT_HIT
-
Squid forwarded the request to this parent based on the Cache Digest
algorithm (see Section 10.7).
- CD_SIBLING_HIT
-
Squid forwarded the request to this sibling based on the Cache Digest
algorithm.
- CARP
-
Squid selected this parent based on the Cache Array Routing Protocol
algorithm (see Section 10.9).
- ANY_PARENT
-
Squid selected this parent as a last resort because none of the other
methods resulted in a viable next-hop.
Note that most of these codes may be preceded by TIMEOUT_ to indicate
that a timeout occurred while waiting for ICP/HTCP replies. For
example:
1066038165.382 345 <IP_ADDRESS> TCP_MISS/200 2836
GET http://www.caida.org/home/images/home.jpg
TIMEOUT_CLOSEST_DIRECT/<IP_ADDRESS> image/jpeg
You can adjust the timeout with the
icp_query_timeout directive.
13.2.4 Configuration Directives That Affect access.log
Following are the configuration file directives that affect the
access.log in one way or another.
<IP_ADDRESS> log_icp_queries
This directive, enabled by default,
causes Squid to log all ICP queries. If
you're running a busy parent cache, this may make
your access.log files huge. To save space,
disable this directive:
log_icp_queries off
If you disable ICP query logging, I suggest that you monitor the
number of queries, either through the cache manager or with SNMP.
<IP_ADDRESS> emulate_httpd_log
The access.log file has two formats: common
and native. The common format is the same
as most HTTP servers (e.g., Apache) use. It contains less information
than Squid's native format. However, you might want
to use the common log-file format if you use Squid as a surrogate
(see Chapter 15). The common format may also be
useful if you have log-file analysis tools that know how to parse it.
Use this directive to enable the common format:
emulate_httpd_log on
See the site http://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format,
for a description of this format.
<IP_ADDRESS> log_mime_hdrs
Use the log_mime_hdrs directive
to make Squid log the HTTP request and
response headers:
log_mime_headers on
When enabled, Squid appends the request and response headers to
access.log. This adds two fields to each line.
Each field is surrounded by square brackets to make parsing easier.
Certain characters are encoded to keep the log file readable. Table 13-2 shows the encoding scheme.
Table 13-2. Character encoding rules for HTTP headers in access.log|
|
Newline
|
\n
| |
Carriage return
|
\r
| |
Backslash
|
\\
| |
[
|
%5b
| |
]
|
%5d
| |
%
|
%25
| |
ASCII 0-31
|
%xx (hexadecimal value)
| |
ASCII 127-255
|
%xx (hexadecimal value)
|
<IP_ADDRESS> log_fqdn
By default, Squid puts client IP addresses
in the access.log.
You can record hostnames, when available, by enabling this directive:
log_fqdn on
This causes Squid to make reverse DNS lookups for the
client's address when it receives a request. If an
answer is available by the time the request is complete, Squid places
it in the third field.
<IP_ADDRESS> ident_lookup_access
This access rule list determines
whether or not Squid makes an RFC 1413
ident query for the client's TCP connection. By
default, Squid doesn't issue ident queries. To
enable this feature, simply add one or more rules:
acl All src 0/0
ident_lookup_access allow All
If an answer is available by the time the request is complete, Squid
places it in the eighth field. If you are also using HTTP
authentication, that username is written instead of the ident answer.
<IP_ADDRESS> log_ip_on_direct
When Squid forwards a cache miss to
an origin server, it records the origin
server's IP address in the ninth field. You can
disable this directive so that Squid writes the hostname instead:
log_ip_on_direct off
In this case, the hostname comes from the URI. If the URI contains an
IP address, Squid doesn't convert it to a hostname.
<IP_ADDRESS> client_netmask
This directive exists to provide
some level of privacy for your users. Rather than logging the entire
client IP address, you can mask off some bits.  It removes query terms from URIs
before logging them. If your log files somehow fall into the wrong
hands, they won't be able to find any usernames and
passwords. When this directive is enabled, all characters after a
question mark (?) are removed. For example, a URI
like this:
http://auto.search.msn.com/response.asp?MT=www.kimo.com.yw&srch=3
&prov=&utf8
is logged like this:
http://auto.search.msn.com/response.asp?
<IP_ADDRESS> uri_whitespace
Earlier, I mentioned the problem with whitespace appearing in some URIs.
The RFCs state that URIs must not contain whitespace, but in reality
it happens all too often. The uri_whitespace
directive dictates how Squid should handle such cases. The allowed
settings are: strip (default),
deny, allow,
encode, and chop. Of these,
strip, encode, and
chop ensure that the URI field
doesn't contain any whitespace (thus adding more
fields to access.log).
The allow setting allows the request to pass
through Squid unmodified. It is likely to cause trouble for
redirectors and log file parsers. The deny
setting, on the other hand, causes Squid to deny the request. The
user receives an error message, but the request is still written to
access.log with the whitespace characters.
If you set it to encode, Squid changes the
whitespace characters to their RFC 1738 equivalents. This is probably
what the user-agent should have done in the first place. The
chop setting causes Squid to cut off the URI at
the first whitespace character.
The default setting is strip, which makes Squid
remove the whitespace characters from the URI. It ensures that your
log-file parsers and redirectors will be happy, but it might break
certain things, such as improperly encoded search engine queries.
<IP_ADDRESS> buffered_logs
By default, Squid disables buffering for the
cache.log file, which allows you to run
tail -f and watch log file entries appear in real
time. If you think this will cause an unnecessary overhead, you can
disable buffering:
buffered_logs off
However, it probably doesn't matter unless you are
running Squid with full debugging. Note that this option affects only
cache.log. The others always use unbuffered
writes.
13.2.5 access.log Analysis Tools
The access.log file contains a wealth of
information, much more than you can see by just browsing through it.
In order to get the big picture view, you'll need to
use a third-party log-file analysis package. You can find a long list
of them linked from the Squid web page, or by going directly to
http://www.squid-cache.org/Scripts/.
One of the most popular tools
is
Calamaris—a Perl script that parses the log file and generates
either text or HTML-based reports. It provides a breakdown of traffic
by request method, client IP address, origin server domain name,
content types, filename extensions, reply size, and more. Calamaris
also reports on ICP query traffic and even understands log files from
other caching products. Check it out by visiting http://calamaris.cord.de/.
Squeezer, and its derivative,
Squeezer2,
are Squid-specific analysis tools. They provide many statistics that
can help you understand Squid's performance,
especially when you have neighbors. Both generate HTML pages as
output. Visit the Logfile Analysis page on the
squid-cache.org site for links to
these programs.
Webalyzer is another good utility. It
is
designed to be fast and produces HTML pages with tables and bar
charts. It was originally designed for origin server access logs.
Although it can parse Squid's logs, it
doesn't report on such things as hit ratios and
response times. It also uses some terms differently than I do. For
example, Webalyzer calls any request a
"hit," which isn't
the same as a cache hit. It also makes a distinction between
"pages" and
"files." For more information,
visit the Webalyzer home page at http://www.mrunix.net/webalyzer/.
|


We're using Git to write some documents about cats.
One document is a list of famous cats. The other is a list of interesting cat facts that are totally true.
We'll use Post-It notes to make sure we each work on a different task, because if we all do the same thing that would be silly?
Download Visual Studio Code (if you haven't already) and install it.
Visual Studio Code is also known as VS Code.
Go to github.com and sign up for a new account.
Go to our slack channel and tell us your Github username. Then we will give you permission to edit the cat facts!
(GitHub will send you an email. You must click on the link in this email to go to a confirmation page, then confirm your email address with GitHub.)
This is an app that works with the Github website.
Download Github Desktop if you haven't already.
Install it.
When it finishes installing, open it and log in using your new Github user name and password.
Our cat facts are stored on github.com. 'Cloning' means making a copy on your computer so you can work on it.
1. Go to the cat facts web page: cat facts.
2. Make sure you have signed in to the GitHub website, if you haven't already:
3. Click 'Clone or download', then choose 'Open in desktop' to clone the project using Github Desktop.
This message should pop up. Click the Open button.
Github Desktop will ask you where to save the files. Once you click OK, it will copy (aka clone) the repository to your computer.
WARNING! You should see a pop-up asking you what folder to save the project.
If you see a page like this, it is NOT working right:
If you see this page, the Github website and GitHub Desktop are not talking to each other properly. Please check (or ask a mentor to help you check):
You now have a copy of the catfacts project on your computer. GitHub desktop shows the project.
GitHub Desktop has two main views: History, and Changes. We will usually look at the Changes view.
When you make changes, the changes will appear in GitHub Desktop so you can commit them and push them.
The mentors should now have created some tasks to do and put them up on the whiteboard.
On the whiteboard, in real life, choose a task, move it to the Work In Progress column and write your name next to it.
Click on this button to create a new branch.
On Windows
On Mac
Give it a name based on the task you are going to do. (Check that it says the new branch will be based on the default branch).
When you create a branch, you are making your own working space. You can make changes there without affecting anyone else.
When your change is finished, you merge your changes back into the master branch (also known as the trunk).
Github Desktop lets us see our changes, but it's not for making changes. To actually make changes, we will use VS Code.
Open Visual Studio Code.
The first time you use VS Code, it will open up your web browser with a 'Getting Started' web page. You should close this. In VS Code, it will open a 'Welcome' page and you can close this too.  Open Folder… open the folder where you saved the project. (It's probably in My Documents\GitHub\catfacts)
VS Code is a text editor (much like Notepad, Microsoft Word or Pages for Mac). Select the file you're working on on the left-hand side.
This will open the file for editing.
Make the changes for your assigned task.
You need to save your changes by pressing Ctrl+S on Windows, or Command-S on a Mac. (Or click File -> Save.)  It should show your change.
Make sure you are happy with your change. Write a short note about what you did in the 'summary' box then click on the commit button.
When you commit a change, you are saying you want to keep it. We always label our commits so other people can tell what we did without having to read all our code.
Each commit is like a building block. All the commits together make up the project.
Now click publish. This makes a copy of your branch on github.com.
Once your new branch has been published once, the button changes to say 'Push Origin'. Click the button to push your changes to the cloud. This means if your computer falls in a pond we won't lose any of your work yay!
Now the button changes again, to 'Fetch'. Click fetch to check if anyone else has changed this branch. (Probably not, because it's your personal branch.)
What if it's not working!
If this happens, you need permission to publish.
1. Post your GitHub username into our slack channel.
2. Ask one of the mentors to make you a collaborator so you can publish changes.
3. Check your email. GitHub will send you an invitation email. You must click the link to accept the invitation and become a collaborator.
Now try publishing your changes again.
It's time to merge your branch into the master branch. This means your commit will be added to the main version of the project.
In Github Desktop, click on Branch, then 'Create pull request'.
This takes you back to the GitHub website. Click the big 'Create Pull Request' button. (If you want, you can write a comment about your change as well.)
Now ask one of our mentors to merge your pull request.
Once your change has been merged, go to Github Desktop and switch back to the master branch by clicking the 'Current branch' button and choosing 'master'.
Click 'Fetch Origin' to what changes are waiting for you.
Then click 'Pull Origin' (it's the same button!) to get those changes. Now you have all the latest changes.
What is a Pull Request?
When you work in a branch, you are making your own special version of the project.
A Pull Request says: I want my changes to be copied into the main version of the project.
Normally, someone else will review your Pull Request to check for any mistakes or problems. If your change is complicated, your reviewer might ask you to help explain what you did so they can review it properly. Once they are happy, they will merge the change.
Move your post-it note on the whiteboard (in real life) to the 'Done' section, so the Project Manager knows that job has been completed. That's how we make software!
Here's how we work on a task:


Hello please login again to access the admin dashboard
By signing in/up You agree to our Terms. Please download idena wallet from official website: idena.io Install, synchronize wallet and click the (Login or Register with Idena) button


About
Quotes
Gallery
Games
Shop
Login
Register
Contact
Log In
Register
Log In
Forgot your password?
Click Here!


Genotype Likelihoods IMputation and PhaSing mEthod
Version 1
27/11/2022: This page describes the GLIMPSE1 method. GLIMPSE1 is recommended to the users who want to use the joint model, for imputation of >1x data and a moderate sized reference panels. For large reference panels and lower coverages, we recommend the use of the GLIMPSE2 method
GLIMPSE1 is a phasing and imputation method for large-scale low-coverage sequencing studies.
Main features of the method:
- Accurate imputed genotype calls. Our method takes advantage of reference panels to produce high quality genotype calls.
- Accurate phasing. GLIMPSE1 outputs accurate phased haplotypes for the low-coverage sequenced dataset.
- Low-coverage sequencing outperforms SNP arrays. Imputation using low-coverage sequencing data is competitive to SNP array imputation. Results for European and African-American populations are interactively available on the website.
- A cost-effective paradigm. GLIMPSE1 realises whole genome imputation from the HRC reference panel for less than 1$.
- An easy-to-use framework for diploid, haploid and mixed ploidy imputation. Our method is able to perform imputation of samples with different ploidy without the need to split the data.
GLIMPSE1 is available under the MIT licence on the Github repository https://github.com/odelaneau/GLIMPSE.
If you use the GLIMPSE1 in your research work, please cite the following paper:
GLIMPSE1 is developed by Simone Rubinacci and Olivier Delaneau at the University of Lausanne, Switzerland.
GLIMPSE1 tools
GLIMPSE1 chunk
GLIMPSE1 phase
GLIMPSE1 ligate
GLIMPSE1 sample
Dashboard
21/05/2021: Version 1.1.1 is available on Github! An updated version of GLIMPSE1 is now available!
07/01/2021: The manuscript describing GLIMPSE1 is now published in Nature Genetics!
07/10/2020: Version 1.1.0 is available on Github! An updated version of GLIMPSE1 designed for diploid/haploid/mixed ploidy imputation is now available!
07/10/2020: A tutorial for non-PAR chrX imputation is now available! Click here to check it out!
07/10/2020: A tutorial for GRCh37/hg19 assembly is now available! Click here!
15/04/2020: Version 1.0.0 is available on Github! Check our Github page to download version 1.0.0 and have a GLIMPSE1 of your data
03/04/2020: A tutorial for GRCh38/hg38 build is now available. Click here to start running GLIMPSE1.


{% extends request.THEME_NAME|add:'site_account_base.html' %} {% block content_header %}Signup{% endblock%} {% block content %}
Already an account? Login now.