[Igor Sobreira] Generating test functions dynamically in Python

October 21st, 2016

Some tests I write get tedious and repetitive, even with custom asserts to make it easier. For instance, take this test from a Django project I’m working on:

import myapp.views

def test_my_view_requires_login():
    assert_login_required(myapp.views.my_view)

I have a @login_required decorator and a function assert_login_required that checks if a view has been decorated with it. I know the test is quite small but I decided to do some metaprogramming and simplify it even further:

import myapp.views

ensure_login_required(myapp.views.my_view)

Here is the code for ensure_login_required:

import sys

def ensure_login_required(view):
    """
    Generate a test function checking that 'view' is using @login_required
    """
    def test_func():
        assert_login_required(view)

    # get global namespace from where this function is being called, if I use
    # globals() here I'll actually get the global namespace of this module
    namespace = sys._getframe(1).f_globals
    namespace['test_%s_requires_login' % view.__name__] = test_func

[Igor Sobreira] Posting strings using HTTPie

October 19th, 2016

Some time ago I came across this great command line tool to make http requests: HTTPie. Simple and intuitive API:

http PUT example.org X-API-Token:123 name=Igor

this sends that PUT as JSON. To submit as form (application/x-www-form-urlencoded; charset=utf-8), just set the -f flag.

Now it took me some time to figure out how to send a raw string as body. It turns out you can just write to it’s stdin:

echo '{"name":"Igor"}' | http PUT example.org

Nice API.

[Emerson Macedo] Escrevendo em inglês - Blog no Medium

September 26th, 2016

Recentemente resolvi começar a escrever no medium e em inglês. Pretendo continuar escrevendo em português, porém com um foco diferente. Eu não sei ainda exatamente qual vai ser a diferença entre ambos, mas a única coisa que eu tenho certeza é que o blog em português não será uma tradução do blog em inglês.

Outra mudança é que meu domínio https://emerleite.com passará a ser uma espécie e home, falando sobre mim. Os blogs ficarão em subdomínios.

Quem quiser acompanhar o blog em inglês, já tem algumas coisas bem interessantes lá. Basta entrar em https://blog.emerleite.com.

[Fabio M Costa] WHAT NEED TO REMEMBER WHEN INSTALLING RECTANGULAR GAZEBO WITH ALUMINUM FRAME

August 30th, 2016

Manual paper

A handbook construction paper lifts best in a transparent envelope on, multipage instructions in several brochures and sleeves and sticks everything in a thin flat file from. To protect the documents from moisture and soiling. Unilateral assembly instructions, for example, are glued to the inside of the transport box lid to keep them permanently and directly accessible. In this way, they have the blueprint always.

Digital assembly instructions

In addition to or instead of a paper manual, it’s a good idea to save the gazebo assembly instructions digitally, for example by a photograph on a mobile device. This not only has the advantage, instead of fluttering in the wind paper manual to be able to handle a digital version better, but the same time prevents the loss. Therefore, save the instructions on a smartphone or tablet, so you have a backup.

Protection in adverse weather conditions

Even when the cheap tents for sale were erected strictly according to plan, the ground is on the site of stones and as a ground sheet as well as all side parts are accurately secured and sealed: In the case of rain, wind, and sun usually help only extras such films & Schedule to protected against the weather to be.

Wire ropes against the wind

Ask the gazebo, where possible, sheltered from the wind on. In nearby trees, but not directly under, for example, is a right place. He is indeed sheltered but is not charged when it rains due to too much water and storms the gazebo roof is not endangered by falling branches. Additional guy ropes fix the gazebo best when they are run in several directions and anchored by pegs firmly in the ground.

Other Plan against rain

Because aluminum does not rust, no precautions against rain must be taken when linkage. The situation is different for the wall sheets and the roof. Here urgent need to pay attention to water-resistant material, if you leave the gazebo are outdoors permanently. Prevents mold growth on walls substance should be prevented by complete drying of the tent walls before packing. Additionally, Planning and films can be stretched as additional protection in wet rain. Under Awnings & Accessories, You can find more meaningful extras like Sturmsicherungs- and repair kits with which cracks can be repaired quickly.

Awning for sun protection

To extend the gazebo in the sunshine, a solar sail is useful. This enlarges the shadow area and may, for example, be stretched as a trapezoid, square or triangle between the gazebo and a tree.

Interior for garden Tents

To shape, decorate or create the right lighting to be Aluminium Garden tent livable, Browsed on eBay in the category furniture for outdoor use or looking around in the class camping furniture and in the Department of exterior decoration. Here you can go on a discovery tour.

Furniture for outdoor use

Popular for Aluzelt are especially Benches & Sofas, let off which there are also beer benches and classic garden furniture. Optionally Barstools & bar tables are suitable for special festivals and celebrations. In addition to the design to consider when deciding that your gazebo device is weatherproof and easy to clean. After all, the Party furniture are usually standing outside and need moisture and sun tolerated without rust going to fade or become porous. Regular maintenance is achieving them also.

Light and heat for gazebo

A heater in the party tent is a comfort that you should, and your guests enjoy the area in front of the gazebo by Bauheizgeräte as the gas fan or heater. This cozy atmosphere arises, light tubes are & chains for parties always a welcome option chosen. But also act stylish lamps with solar technology, which are quickly recharged without electricity by sunlight and are therefore ideally suited for outdoor use.

Decoration for parties

A party without decoration is only half as good, which is why the creative sectors on eBay are particularly lush filled with offers. Under Party & Event Decoration to provide excellent party sets and extraordinary decorative elements to make to each festival to highlight the year. Take for selecting the party decoration time, because that eBay offer for creative products is tremendous. By Demo material entering, each gazebo a personal touch and can create an atmosphere on your guests will be amazed.

For more tips, visit http://www.familytentcenter.com/

[Fabio M Costa] WHAT CAN NOT MISS FOR YOUR GARDEN PARTY IN A TENT

August 17th, 2016

We took a few days talking about what you can not miss in my party in the home garden in tents for sale because there are many people who want to ride an event in your garden and do not know how. Others do know how to do, but it is always good some further advice on some issues. The protocol, for example, is an important topic to us after more than 20 years organizing wedding and events can be a little different, but do not discuss in this post today.

The first thing is to know who will be invited, is not the same to come friends or family, because one or the other how to organize will be different; also the number of people condition my party, if many are practically essential to mount a tent in the garden unless you want to suffer from the weather throughout the event. That is why we strongly recommend installing a shelter if the number of guests is large enough not to enter our house in case of inclement weather.

If the party is at noon is required to have somewhere to give shade. If the House can not find a space shade, we recommend two solutions: the first one and covers more area is a tent, which will give us plenty of shade, the second option will give us less shade, but that’s fine too are umbrellas, but considering that if seated, the guests have to be able to eat under a shade, that is, has to be carp, the umbrella or parasol, is whether the guests are standing, they can seek shade, it is not possible under any circumstances that the tables are under a parasol, because the sun moves and therefore the shadow is not static, so if one gives the shade for a while, then he will do so all the time.

If finally, we do an event with carp and out at night, you need to think about the temperature, the fact that our party guests to be cold are very unpleasant, so do not risk anything about it. From failure to success in this regard is a step.

As for the food, try to be varied if you’ve invited people on other occasions, not to repeat meal. Also critical that if you decide that the guests are standing and make the cocktail party type, try to give things that are easy to eat, because there is nothing but to eat hard things when you are invited to an event.

We have already been discussing the topic of music in another post, I think the background music, can be well outdoors, but do not abuse it, sometimes it is high, and not everyone is comfortable with it. When in doubt look to your guests and put faces, that will give a clear picture of whether or not too high. It’s ambient music, no disco music.

How do I organize an event tent in my garden?

Most people who contact us and ends up buying, has a first call which does not quite know what you need, have the illusion of holding something in the garden, but does not quite know what to put, you see they have a garden, but do not quite know how to prepare it, or how to make the most. Then we will try to give some tips so that any of our readers who have a garden can take full advantage.

The first thing you have to know a person with his garden is square meters has the dimensions of it will tell us what capacity is and what kind of party, celebration or event can make. Important that the square footage that we measure are useful, i.e., if it turns out that our garden is full of plants, areas sloping or low trees, are little practical areas, although they will serve to the party remains wider, and we provide excellent views. To find the square footage, we must teach us the following table, which will be approximate because you have to take into account other factors:

  • Party standing will be 1 square meter per person.
  • Party sitting will be 1.5 square meters per person.

With these two pieces of information that we can put the space, you have available. Above all, do not you, Take to the letter, because sometimes when comes a catering to your house asking for more space because you want to put a dessert buffet or want to put tables support or also have to count the number of writers who will participate in the event.

For more information, visit http://www.familytentcenter.com/

 

[Christiane Melcher] Hello world!

August 16th, 2016

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

[Christiane Melcher] Hello world!

August 16th, 2016

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!

[Fabio M Costa] Checklist of tips to protect your pillow

August 7th, 2016

You do not have a good night sleep? Are you suffering from the pain in neck and shoulder? Are you looking for the new pillow? Do you know if all your pillow care are successful? Do you think it has an optimum maintenance? Today we will bring you a checklist of tips to protect your pillow and keep a long long, time. The bamboo memory foam pillow is highly recommended

When purchasing a pillow, and bearing in mind that “there is no perfect pillow,” physiotherapists remember that the way to sleep is the main aspect that significantly should condition the choice of one or the other.

The average height of between 10 and 13 centimeters are recommended for those who sleep on their backs, and in these cases, it is important to note that the length of the pillow should exceed the width of shoulders while the hardness, in this case, It must also average.

High pillows, up to 15 centimeters, are for those who choose to sleep on your side with sufficient hardness so that the head remains aligned with the trunk.

In contrast, low, between 8 and 10 centimeters are more appropriate for those who sleep on their stomachs, because in these cases it is preferable to present little consistency. These pillows are also recommended for children, although in some cases it is even considered better sleep without it.

Also, physical therapists advise that people who sleep on beds use the same pillow your partner, because “each person should have their pad suited to the morphology and sleep habits.”

Before purchasing, they are advised to consult with a physical therapist to analyze the posture in different positions and assess the state of their muscles, to recommend the pillow that suits the body and the position of the person concerned.

List of tips to protect your pillow stuffed with fiber

Opting for a pillowcase to keep it clean and maintained. Remember to use a pillowcase that is easy to wash. The cotton pillowcases are the most successful, thanks to its characteristics, ideal to prevent allergy symptoms.

What is the correct procedure to aerate your pillow? Choose the time of making the bed, shake well and redistributes his pillow stuffing. With this action, we get the pillow does not lose its filling properties and retains its firmness.

Pillow maintenance tips

As we always say, when washing is best left in the hands of a professional. If instead, we remove the pillow at home, it is advisable to hand wash with a mild soap without detergent or bleach.

The fourth council of our checklist of tips to protect your pillow is followed to the letter the hang of tennis balls. It is essential to put it in the washer and keep the pad as new. Add in the washing machine two or three balls so that the filling of the pillow is not taking, every time you turn the drum of the washing machine will gap between the filling and consigned not focus on a single part of the pillow.

It is critical to dry your pillow using the dryer. You can put it in the dryer at low temperature to remove all moisture or leave aerate abroad. Do not forget to make sure it is completely dry.
The frequency of washing should be slight, wash the pillow is often harmful for the conservation of it. Its properties will be depleted; the filling will remain caked and moisture damage inside. If you want to keep your pillow in perfect condition, wash it only if necessary. For preservation and good maintenance aerates the pillow on multiple occasions.

If you go on a trip, it’s best to keep it in your bag accordingly. Where will avoid contact with the outside, humidity, and dust

Have you taken note of our checklist of tips to protect your pillow? Enjoy adequate rest with a well-preserved, according to your needs pillow, responsive to the care of your back and neck. If you can not fall asleep, easily you know the best positions to sleep well.

That is all about the choice of the pillow. Hope you find usefull information here in this post. For more information, visit http://www.bedtimefriends.com/. Good luck with the choice!

[Fabio M Costa] What are Your Choices When Purchasing an Embroidery Machine?

July 27th, 2016

Generally, there are two types of embroidery machines with almost the same functionality. There is the embroidery machine whose task is only to do embroidery and then the embroidery sewing machine which is versatile. It can do both embroidery and sewing. These machines decorate and add unique styles to fabrics. There are many brands of these machines and they come in different sizes.

the embroidery machine

If you want to purchase an embroidery machine, you need to keep in mind that they come in different prices. Embroidery sewing machines are quiet expensive more than the embroidery-only machines. Prices of these machines mainly depend on the size of the machines itself and also the size of embroidery. They range from $200 to about $8000 dollars.

It is important to also consider the functionality of the machine. If you want to take home an embroidery machine, ask yourself what you want to do with it. If you are specifically oriented in embroidery work alone, then opt for the embroidery only machine. However, if you want an all-in-one machine that will give you the privilege of sewing and also adding embroidery on the fabric, then an embroidery sewing machine will be the best option.

Embroidery sewing machines usually have hoops. During embroidery the fabric is attached to the hoops that are connected to the sewing machines. These hoops hold the fabric firmly to prevent any movements until the machine finishes crafting the desired design. On the other hand, embroidery only machines lack a tool to hold the fabric. Instead, they are fitted with stabilizers.  Some of these stabilizers are found on top of the fabric, while others are found under the fabric. Heat away stabilizers are usually recommended because they leave no trace when ironed.

Some of the embroidery sewing machines are fitted with stitch regulators which enhances more stitches for the sewers who prefer the free motion embroidery.

In the market today, there are three main types of embroidery machines namely;

  • Mechanical embroidery sewing machines
  • Electronic embroidery sewing machines
  • Computerised embroidery sewing machines

All these three machines have their benefits. Let us take a look and compare these different categories of embroidery sewing machines;

Mechanical Embroidery Sewing Machine

Mechanical Embroidery Sewing Machine

This is the simplest style of embroidery sewing machines. They were invented almost 200 years ago and are still used up to date. They were manually controlled by a rotary wheel.  The most common brands still on the market are Brother and Singer. A number of people still prefer to use these embroidery sewing machines.

These machines are not so easy to work with. You need to have a mastery of high skills in embroidery. These embroidery sewing machines have a few numbers of stitches. One of the major advantages is that there quiet cheap as compared to the others. So if you are facing financial constraints, this will be your best alternative. These embroidery machines come in handy when creating antiques and vintage pieces.

Electronic Embroidery Sewing Machine

Electronic Embroidery Sewing Machine

This machine is more popular than the mechanical one. Quiet a number of people who practice embroidery prefer using electronic embroidery sewing machine because it is easier to operate. They are lighter, convenient and easy to carry. An added advantage is that they have more stitches than the mechanical ones and also have a number of more accessories.

This machine widens the scope of your creativity because it is easy to manipulate. Hence, it allows you to be more creative and come up with extra designs. Available models include Brother, Singer, Viking and Kenmore.

Computerized Embroidery Sewing Machines

Computerized Embroidery Sewing Machines

In the modern era, technology has evolved a great deal. It has made these machines very easy to use. They use a very advanced form of technology to function. You can easily make a complex design that would have taken days to craft using hands in a matter of minutes. These embroidery machines are very expensive but they render services that are worth your money.

Their automatic functions include;

  • Needle threading
  • Mirror imaging
  • Touch display screens
  • Multiple needle positions
  • Very many stitch functions
  • Autopilot features

It also has added features like USB ports and allows internet connection where you can download desired patterns. These machines contain a microprocessor that allows you store patterns from a card and create the patterns on its own.

The only disadvantage being the pricing, this is the ideal embroidery machine for you, whether for commercial purposes or personal reasons. Some of the common models include Singer CE-200 Quantum Futura, Brother SE270D and Singer Quantum XL-6000.

In conclusion, you should critically analyse whether you want an embroidery sewing machine or embroidery only machine. Ask yourself for what purposes do you need it. Take it to consideration your needs and budget. Also do a thorough market research of what best brand will bring you satisfaction because different models have different features. Then with all that in mind, find a reputable dealer, make an informed purchase and put your embroidery skills into use.

[Flávio Ribeiro] Snickers: Open Source HTTP API for Media Encoding

July 18th, 2016

At the beginning of this year we created a group on our video engineering team to deal with the ingesting, encoding, publishing and syndication of The New York Times videos. The main goal of the team was to build a pipeline that is vendor agnostic, cloud-based, efficient and elastic. We also wanted to build an easier workflow for video producers in the newsroom and third-party partners who distribute our videos. We named this team Media Factory.

After a few months of development, the pipeline is almost ready to be deployed to production. It consists of three different steps: Content Acquisition, Transcoding and Distribution. The content acquisition part is responsible for receiving ProRes/Raw videos, the transcoding API transforms the source files in playable videos by our supported browsers and devices and the distribution step sends the final videos to our CDN.

Probably the most important and complex part of the pipeline is the transcoding process. Instead of using heavy and expensive hardware for that we decided to create clients for different encoding services like Encoding.com, Elastic Transcoder and Elemental. This enabled us to decide which one to use based on a set of variables such as availability, speed, formats supported (HLS, webm, mp4, DASH, etc) and even cost.

While discussing the design of the pipeline and the integration with cloud services, we thought it would be useful (and FUN!) to implement another provider that would be just a tiny wrapper for FFmpeg or GStreamer. By using this tiny wrapper, we would have the freedom to deploy anywhere, implement new features (such as the generation of thumbnails) and perhaps, one day, be used to encode our lower priority jobs.

We have plans to write a blog post about the details of each step and how they work together on the Open Blog. We should work on that as soon as we have people at the company using the pipeline.

Time To Learn Some Go

After having a lot of fun on the journey to remove Flash from our player I got attracted by the chance to be part of this team. I was already willing to work with back-end services again and knowing that the company is adopting Go for API’s turned this opportunity into something even more attractive. Although I was participating on meetings and design decisions, I actually started working on the team in April.

I had never worked with Go before and after a few years plunged on dynamically typed languages I felt a bit of pain during the first steps working with it. The rest of the team was already fluent and I though I’d need something to exercise myself and keep up with the team’s pace.

snickers logo

Creating this dummy provider that is a wrapper for FFmpeg seemed like a good chance for me to evolve my Go skills. A month ago I started writting it, I called the project Snickers. I put this name because it’s my favorite chocolate and I was holding one when I created the GitHub repository.

To be honest, the title of this post doesn’t actually represent the current state of the project. Right now, it looks much more like a proof-of-concept/embryo project than anything else.

It supports the download of sources from HTTP and Amazon S3, encode them in H264/MP4 or VP8/WebM using a FFmpeg binding and uploads the results to Amazon S3. We still need a plethora of features to be able to actually call it a Media Encoding API, but one of the purposes of this post is to broadcast the idea and try to engage people to collaborate. Snickers already has contributors!

Next Steps

I have a bunch of ideas for this project. The next steps include building clients in JavaScript so people can use Snickers directly on the browser (with nice progress bars and stuff) as well as a client in Go, probably as part of the encoding-wrapper project. We also need to write some glue code for the Transcoding API so Snickers can be considered in the decision process of Media Factory pipeline. We use a lot of HLS at the company so HLS support is mandatory and probably the highest priority feature.

I’m also interested in working on the creation of a GStreamer driver for the encoding part so we can have benchmarks using different drivers. I saw that there’s already a Gstreamer binding for Go and it seems that the code is simpler than handling libav calls.

You can find some instructions on how to deploy and use the API as well as some examples. I also labeled a bunch of relatively easy issues in case you want to work on and be part of this project.