Short Box Explained

Best Binary Options Brokers 2020:
  • Binarium

    The Best Binary Options Broker 2020!
    Perfect Choice For Beginners!
    Free Demo Account!
    Free Trading Education!
    Get Your Sing-Up Bonus Now!

  • Binomo

    Only For Experienced Traders!

The BOX – a short story Part 2

THE BOX – A short story Part 2

The rain drops falling on the window made it harder and harder to see what was happening; and instead of trying to look through the window, Sophie looked at it, and watched the red, blue and white light break into a thousand dancing and trickling spots.

Eventually the traffic began to move on, and a moment later, Opie’s Corner, with its lights and its police cars, had disappeared into the night behind them.
“Come on,” said Mick. “Next stop!”
They got off at the foot of Blenden Road, and began walking up the last hundred yards towards the Hotel.
” Gee this box is heavy!” exclaimed Mick.
“He must have thought you had a car!” answered Sophie.
“No, he asked how old I was!”
“We’re early, you know!”
“Too bad! What are we supposed to do? Just hang round waiting?”
“I don’t know, do I? You made the arrangements!”

It was indeed just a quarter to ten as they turned off Blenden Road and through the gates of the Hill Park Hotel. It was an old manor house that had once stood well outside the town, but was now surrounded by suburban streets. It still stood, however, in spacious grounds .
Inside the gates, the driveway curved off to the left, through a group of trees; they could see the lights of the hotel in front of them, across the grass; but under the trees it was very dark. Drops of water were falling heavily off the wet branches.
“I don’t like this!” said Sophie. “Someone could jump out from behind one of those trees!”
“Oh get real!” answered Mick. “This is a posh hotel! You’ve been watching too much telly!”
“I don’t like it, Mick! I think there’s something in that box!”
“Well of course there is! It’s a surprise for Mr. Ansell, straight from Tescos !”
“Yeah, I know. But it’s all rather suspicious , isn’t it? Why couldn’t they get the box delivered normally?”
“Well I s’pose they couldn’t find any firm that delivers at this time of night! And anyway, what d’you think’s in the box? Ten pounds of special-offer ecstasy tabs , or what?”
“No. ”
“Maybe it’s a box of their best semtex then, for terrorists !”
“Mick. “

At that moment, a car came in through the gates behind them, its lights sweeping across the green grass is it turned towards them.
Then, as it reached them, it braked hard and stopped, one of the doors opened, and a man jumped out.
“Police!” he said. He was not in uniform. “What’s that you’ve got there? Where are you going?”
“We’re delivering it to the hotel!” said Sophie.
“Is it yours?”
“No,” Mick answered. “We’re delivering it to Mr. Ansell’s party. It’s a surprise.”
“And who’s Mr. Ansell?”
“We don’t know,” said Sophie. “We’ve never met him.”
“Come on!” said the other policeman, a very large man. “Get in the back of the car, you two!”
“What for?”
“Do as I say, please! We’ll drive you to the door. And give me that box will you!”
Mick and Sophie climbed into the back seat; thirty seconds later, the car pulled up outside the hotel entrance.
“Wait in the car,” said the shorter of the two policemen. The big policeman said nothing as they sat and waited; but the wait was not long.
In less than a minute, the short policeman was back in the car.
“Right, you two,” he said. “They don’t know anyone by the name of Ansell there. And there’s no-one with that name at the dinner party. So we’d better go down to the station with this!”
” Cor !” exclaimed Mick. “And what about the fifty quid I was going to get?”
“Fifty quid?” asked the smaller policeman.
“Yes, for bringing the box from Tesco’s.”
“Well, we’ll see about that later,” said the policeman. “Where d’you live, young lad ?”
“Larkway St.” said Mick, “Just near Opie’s Corner.”
“Oh, there, I know,” said the policeman. “Well we’ll drop you off there now, and you can come in and see us at the station tomorrow morning, O.K.”
As they approached Opie’s corner, Mick saw that the police cars with their blue flashing lights were still there. At that moment, the car stopped.
“We’ll set you down here,” said the driver. “We’ve got to go back to the hotel, I’ve just remembered!”
“And here’s thirty quid,” said the other policeman.
“What’s that for?” asked Mick.
“You’ll find out when you come down to the station tomorrow.”
“Which station?”
“The main one, of course; in the town centre.”

“Oh well,” said Mick, as the police car drove off. “Maybe there was something strange in that box!”
“I told you so,” said Sophie.
“Anyway, let’s go to Gigi’s!”

Next morning after breakfast, Mick went to the police station. The officer on duty was most interested in his story; especially since no policemen on duty the night before had gone anywhere near the Hill Park Hotel.

trickle : to flow (move) very slowly – eventually: at last, finally – Gee! – Oh! – hang round: wait – grounds: land, gardens – driveway: access road – posh: chic, luxurious – suspicious: strange – tabs: tablets – semtex : a type of explosive – to brake: to slow down – pull up: stop – station: police station (not railway station!) – Cor!: Oh! – lad: boy, young man – on duty: on service.

Printing: Optimized for A4 printing with the Firefox or Chrome browsers
Copyright © Linguapress. Do not copy this document to any other website

Copying permitted for personal study, or by teachers for use with their students

THE BOX, part 2 – Worksheet

Instead of trying to look _______ the window, Sophie looked _______ it, and watched the red, blue and white light break _______ a thousand dancing and trickling spots.
Eventually the traffic began to move _____, and a moment later, Opie’s Corner, _______ its lights and its police cars, had disappeared _______ the night _______ them.
“Come ____,” said Mick. “Next stop!”
They got _______ _______ the foot of Blenden Road, and began walking _______ the last hundred yards _______ the Hotel.
“Gee this box is heavy!” exclaimed Mick.

It was just a quarter to ten as they turned _______ Blenden Road and _______ the gates of the Hill Park Hotel. It was an old manor house that had once stood well __________ the town, but was now surrounded ____ suburban streets. It still stood, however, _____ spacious grounds.
Inside the gates, the driveway curved _______ to the left, _______ a group of trees; they could see the lights of the hotel _______ front of them, _______ the grass; but _______ the trees it was very dark. Drops of water were falling heavily _______ the wet branches.
“I don’t like this!” said Sophie. “Someone could jump ____ ____ _______ one of those trees!”

For teachers: using this story in class : Introductory exercise: Before taking the second part of this story with your class, begin by asking students to tell the story collectively. Here are a lot of quick questions, to elicit answers that will tell the story.

Best Binary Options Brokers 2020:
  • Binarium

    The Best Binary Options Broker 2020!
    Perfect Choice For Beginners!
    Free Demo Account!
    Free Trading Education!
    Get Your Sing-Up Bonus Now!

  • Binomo

    Only For Experienced Traders!

In line 10, note the indirect question: He asked how old I was.
Have students re-express some of the direct questions in the text on the same model,
i.e.: (two lines below) What are we supposed to do becomes He asked what we were supposed to do.
The point to remember is the word order.

Follow-up exercises. Though this episode ends the story, it still leaves room for further developments, as the last paragraph leaves everything wide open. Have students explain what really happened, in their own words. Maximum length: 300 words. (four point line
Role Play After Mick went to the police station, the policemen asked him and Sophie to come in and answer some questions. Sophie’s Mum and Dad came along too. Imagine the interrogation session that took place.

This teaching resource is © copyright Linguapress 1996-2020.
Revised 2020 . Originally published in Freeway, the Intermediate level English newsmagazine.
Republication on other websites or in print is not authorised

Интересные моменты в C# (boxing unboxing)

В этой статье мы коротко пройдемся по малоизвестным особенностям boxing/unboxing.

Типичный вопрос на собеседовании об упаковке и распаковке выглядит следующим образом — «Что будет при запуске данного кода, и если он не будет работать то как его исправить?».

Ответ может быть следующий — «При распаковке первый оператор является не приведением типов а распаковкой типа, соответственно он должен соответствовать типу значения находящегося в запакованном виде.».

Обычно это считается правильным ответом, но это не совсем так…

Unboxing и Enum

Представьте себе удивление человека, когда вы ему напишете другой правильный вариант.

Второй правильный ответ:

Напомню, enum не является фундаментальным типом и не наследует его, он является структурой содержащей фундаментальный тип (базовый). Это говорит о том что в .NET есть явная поддержка такой распаковки. Так же легко проверить что распаковка не использует операторы явного и неявного преобразования и интерфейс IConvertible и свой тип не получится развернуть из чужого типа.
При распаковке enum’а используется его базовый тип и следующая распаковка не будет работать.

Распаковка для enum’ов ослаблена предельно.

Распаковываем int из enum’а:

Распаковываем один enum из другого:

Unboxing и Nullable

Распаковка поддерживает и Nullable типы, что кажется более логичным.

Распаковка Nullable типа из обычного:

Распаковка обычного типа из Nullable:

Напомню что Nullable это структура с одним обобщенным типом значения и предназначена для хранения данных и флага присутствия данных. Это говорит о том что в C# есть явная поддержка распаковки Nullable типов. В новых версиях C# для этой структуры появился alias “?”.

What is boxing and unboxing and what are the trade offs?

I’m looking for a clear, concise and accurate answer.

Ideally as the actual answer, although links to good explanations welcome.

8 Answers 8

Boxed values are data structures that are minimal wrappers around primitive types*. Boxed values are typically stored as pointers to objects on the heap.

Thus, boxed values use more memory and take at minimum two memory lookups to access: once to get the pointer, and another to follow that pointer to the primitive. Obviously this isn’t the kind of thing you want in your inner loops. On the other hand, boxed values typically play better with other types in the system. Since they are first-class data structures in the language, they have the expected metadata and structure that other data structures have.

In Java and Haskell generic collections can’t contain unboxed values. Generic collections in .NET can hold unboxed values with no penalties. Where Java’s generics are only used for compile-time type checking, .NET will generate specific classes for each generic type instantiated at run time.

Java and Haskell have unboxed arrays, but they’re distinctly less convenient than the other collections. However, when peak performance is needed it’s worth a little inconvenience to avoid the overhead of boxing and unboxing.

* For this discussion, a primitive value is any that can be stored on the call stack, rather than stored as a pointer to a value on the heap. Frequently that’s just the machine types (ints, floats, etc), structs, and sometimes static sized arrays. .NET-land calls them value types (as opposed to reference types). Java folks call them primitive types. Haskellions just call them unboxed.

** I’m also focusing on Java, Haskell, and C# in this answer, because that’s what I know. For what it’s worth, Python, Ruby, and Javascript all have exclusively boxed values. This is also known as the “Everything is an object” approach***.

*** Caveat: A sufficiently advanced compiler / JIT can in some cases actually detect that a value which is semantically boxed when looking at the source, can safely be an unboxed value at runtime. In essence, thanks to brilliant language implementors your boxes are sometimes free.

Electrical Wiring – How to Wire a Junction Box to Extend Circuits for Sockets and Lights

How to wire an electrical junction box. A junction box is used to add a spur or to extend circuits and direct power to lights and additional sockets. Advice on wiring electrical junction box with easy to follow junction box wiring diagrams, including information on 20 and 30 amp junction boxes. Be sure which type of junction box should be used for ring main, radial circuits and lighting circuits. Also includes safety tips and information on fixing junction boxes and ensuring they are accessible.

Warning: To complete electrical works you must comply with Electrical Regulations – Click here for more information.

Working With Junction Boxes Safely

Part P of the new building regulations could involve a check on any additional circuitry by qualified electricians when you sell your home. This can affect your sale, you could be breaking the law and your house insurance may not be valid. Please be absolutely sure you know what you are doing and get all of your work checked by a qualified electrician. Make sure you turn all power off and isolate the circuits you are working on.

What are Junction Boxes Used for?

Junction boxes can be used to connect additional sockets to circuits, add lighting points, extend circuits, and in general they are a way of getting power from an existing source and taking it somewhere else. They can also be used for repairs.

If a wire has become damaged, the damaged section can be cut out and teh two sections joined back together again using a junction box.

In short they are used for joining wires or running a spur from an electrical circuit safely. Whenever you need to join two or more electrical wires, then you should use a junction box. As a result they are commonly used and very useful for anyone involved in wiring and electrics.

You might be thinking that block connectors do the same job and you would be right, but they do leave quite large sections of wiring exposed and if you have removed long lengths of the protective sleeve from wires, bare live wires can be easily accessible and cause an obvious danger.

Junction boxes have an advantage here in that all wiring and joins are housed within the junction box itself, leaving no exposed bare wires that can be touched or knocked.

Junction boxes can also be used to add lights and switches. For more information please see our lights and switches project.

Types of Electrical Junction Box Explained

Electrical junction boxes come in a range of different types. There are two key differences that you will need to look out for when purchasing your junction box:

There are also different styles of junction boxes that you can use. Each will differ slightly depending manufacturer (terminal layout, slightly different mouldings etc….), but the essentials should all be the same:

  • Standard Junction Box
  • Maintenance Free or Wagobox Junction Box

We will explain the differences between these types of junction box and their various benefits shortly, however it is important that you have the right rating whichever type that you choose.

Junction Box Amp Rating

Junction boxes are rated in amps to protect them, you and the circuit. Make sure you have the right box for the right job. A ring main (more about ring mains can be found in our project here) and also a radial circuit (more about radial circuits in our project here) will need a 30 amp junction box, whereas a lighting circuit (although you can buy 5amp junction boxes) will need a 20amp junction box.

The rating that you use must reflect the current of the circuit that it will be used on. It is possible to use a higher amp rated junction box on a lower rated circuit, but never the other way around – To summarise:

  • Ring mains and radial circuits = 30 amp
  • Lighting circuits = 20 amp

Junction Box Terminals and Wiring

Junction boxes come with either 3, 4, 5 or 6 terminals so work our which you will need to complete your project. The terminals are where the connections will be made by inserting the wire core from either side or the wiring run and then screwing the terminal close to create a safe electrical junction and join.

A 3 terminal junction box being used to join two sections of wiring together

Essentially there are three types of terminal that are used in a junction box – these are:

    Single screw terminal – The terminal has one screw which is screwed closed on to the cable cores being joined together to secure them all in one single connection point. These are typically found in the Standard junction box, and allow the connection of a larger number or sizes of cable cores that the other terminal types

Single Screw type terminals inside a junction box

Bussbar screw terminals – The cable cores are inserted into their own holes and then secured by screwing down on them to trap them securely. It is important to ensure that the terminal hole is sufficiently large for the cable core to fit. These terminals are relatively quick and easy to work with

Bussbar type terminals in a junction box

Easy connect/maintenance free terminals – the cable cores are each inserted into their own hole in the terminal. The cables are either secured by levers, or are push fit. The number of cores that can be connected at each terminal is limited by the number of holes in each terminal – Generally 2 to 8. They are extremely quick to connect and easy to use.

Easy connect maintenance free type terminal connector

Round or Square Junction Boxes

There is no requirement for a junction box to be either round or square, and they are commonly both. As a rule of thumb the more common round junction boxes are typically used for lower current cables.

High current junction box – Image courtesy of Bartec

Increasingly common are the “Maintenance Free” Junction boxes. These are designed to replace the standard round junction boxes commonly use in household wiring. The reason that they have become so popular is that they can save nearly 75% of the time required to wire a traditional junction box.

Maintenance free type junction box

Wiring a Junction Box

This section explains how to wire a traditional or standard style junction box. It doesn’t matter about the rating or number of terminals, the process is the same in each case.

Joining Two Sections of Wire Together

Double checking that the power is off and connect your junction box as shown below:

Junction Box Wiring diagram – Connecting cables using a junction box

Creating a Spur using a Junction Box

If you want to spur off from a current circuit to provide power to a new socket of light, again, make sure the power is off and the circuit is isolated and wire your junction box using the method below.

Junction Box with spur wiring diagram – Adding a Spur using a Junction box

Fixing cables into the Junction Box

The cables should be stripped to reveal the cable cores, but ensure that you do not do this back beyond the junction box itself. The cable leaving the junction box should be complete and intact.

The cable cores will need to be stripped before being inserted into the terminals. Try to expose the minimum amount of the conductor as necessary. 10mm will be typically sufficient for this.

Use green and yellow earth sheathing to cover the earth which will most likely be uncovered.

Which Colour Wires are Which?

UK wiring colours went through a change in March 2004. The traditional red live and black neutral were changed to brown live and blue neutral. The earth wire remains as yellow and green if sheathed but it can also come bare. As stated above, if bare, you should cover with some sleeve just to indicate that it is the earth.

For more information, please also see our project on the New Wiring and Cable Colours for a full explanation about the cable colours in use.

Before March 2004 After March 2004
Live Red Brown
Neutral Black Blue
Earth Green and Yellow or Bare Core Green and Yellow or Bare Core

Securing a Junction Box Once Installed

Junction boxes must be fixed solidly to a firm, suitable surface and must be accessible. These rules are stipulated in the 17th edition regulations and must be adhered to. Screw the base of the junction box to a joist or rafter through the securing holes indicated in the image below.

Parts of a junction box

This does not necessarily mean they have to be visible, they can be fixed in floor or roof voids. Accessible means that a builder or electrician can easily remove part of the floor or ceiling etc…. and access the junction box when required. Junction boxes may not be buried in plaster or other similar materials.

Likewise, the cables running into and out of the junction box should also be secured to a suitable, stable surface. If not, then “mechanical strain” could take place and over time, wires may become loose causing loose connections. Cables should be clamped using cable clips or clamps.

Please also check the rules very carefully for ring mains and radial circuits. You are limited in the length of cable you are allowed to use in both circuits and long spurs could make you exceed the limit and over load the circuit!

If this is the case you are asking the circuit to use much more energy than the circuit is designed for. More energy = more heat and cables can catch fire!

You can also read a brief synopsis on the electrical guidelines and what they mean by visiting our Approved Document P project here.

Once the junction box has been fixed to a secure surface, and the wiring has been connected to the terminals and tested you can close the junction box, they must never be left open and exposed. The cover is screwed closed using the provided securing screw (or possibly screws) through the cover and fixing it to the base. It is often necessary to adjust the wiring inside the junction box to allow the cover to close. Avoid simply forcing the cover closed with the screw as this can risk causing damage to cables.

Stuck or confused with wiring and electrics?! Get professional help – Image courtesy of Active Rain

All project content written and produced by Mike Edwards , founder of DIY Doctor and industry expert in building technology.

Best Binary Options Brokers 2020:
  • Binarium

    The Best Binary Options Broker 2020!
    Perfect Choice For Beginners!
    Free Demo Account!
    Free Trading Education!
    Get Your Sing-Up Bonus Now!

  • Binomo

    Only For Experienced Traders!

Like this post? Please share to your friends:
Binary Options Trading For Beginners
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: