You are here

thinktime

David Rowe: Minimalist VHF Software Defined Radio Part 2

Planet Linux Australia - Thu 19th Mar 2015 18:03

Shortly after I published the first post on a simple VHF SDR, Brady KC9TPA started making suggestions about optimising the code. So I encouraged him to have a look into the transmit side. How can we take a baseband modem signal (like GMSK) and convert it up to a HF IF frequency like 10.7 MHz using the STM32F4 DAC?

After a busy month (and not much sleep) Brady has done it! The following figures explain how it works:

Normally we would use a baseband DAC, mixer, LO, and crystal filter to generate a signal at HF (top). However Brady has shown it is possible to use a much simpler architecture (bottom).

So with the STM32F4, some clever software, and a buffer amplifier, he has generated a 10.7MHz HF signal. The DAC runs at 2MHz, which creates images (aliases) spaced every 1 MHz. The Band Pass Filter (BPF) selects just the image you want, e.g. 10.7 MHz in our case. The BPF doesn’t have to be very demanding like an Xtal filter, as the other images are 1MHz away. It is possible to tune the exact frequency a few hundred kHz in software.

Compared to a baseband IQ design this architecture doesn’t need two DACs, and doesn’t have have any IQ balance issues.

He used a GMSK modem signal as the baseband signal, however it could have easily been SSB, analog FM, or FreeDV. This is basically a baseband to HF SSB exciter. With a suitable BPF it could easily be tuned to anywhere on the lower HF bands. Software could then be used to tune the tx frequency within that band.

Brady received and sampled the 10.7MHz signal using an off the shelf SDR and it demodulated perfectly. Here are few photos showing his experimental set up, just a STM32F4 Discovery board and a buffer amplifier connected to the DAC. Note the sharp edges on the scope plot – this indicates lots of juicy HF content that we can tune to. He hasn’t added a BPF yet. The last plot is the GMSK signal as received by our demodulator running in Octave.

Our next step will be to mix this signal to VHF and add a PA to produce a 1 Watt of signal on 2M, to support our VHF FreeDV work. Please contact us if you can help us with a VHF PA design!

This design and the previous post that demonstrated the HF rx side suggests that the SM1000 could be modified to be a HF SDR transceiver. It already has a microphone and speaker amplifier, and even runs FreeDV out of the box! We would need to add a BPF, PA, and some gain on the rx side.

There is still a question over the STM32F4 internal ADC, e.g. it’s inter-modulation performance when used in over-sampled mode (thanks Glen English for pointing this out). Some more work required there. However this architecture is not limited to the STM32F4 – any uC connected to a few M-sample/s DAC and ADC (internal or external) will do. That’s the great thing about radios based on gcc C code and nearly no hardware!

Categories: thinktime

Binh Nguyen: Indo-Chinese Chilli Chicken Recipe

Planet Linux Australia - Thu 19th Mar 2015 16:03
This is based on recipes online and an interpretation by a local fusion restaurant that I used to frequent. While there are other alternative recipes that possibly taste better, I find that this is the quickest and easiest version.

- chicken (purchase diced for quicker preparation time)

- onion

- capsicum

- tomato sauce

- soy sauce

- chilli sauce

- egg (optional)

- cornflour (optional)

- garlic (optional)

- ginger (optional)

- spring onion (optional)

- lemon juice (optional)



Coat chicken with bicarbonate soda if desired (meat tenderiser. This step is not required at all if chicken is diced into small enough pieces and cooked well) and then wash off in cold water. Marinade chicken in corn flour, egg, salt, pepper (optional step). Fry off chicken in pan. Create sauce by using tomato sauce, soy sauce, chill sauce add add to pan (add water to mixture if it reduces too far over time). Add onion and capsicum to pan as well to cook through. Add garlic, ginger, lemon juice, etc... to taste... Goes well with rice or crusty bread.



The following is what it looks like.

https://nishkitchen.wordpress.com/category/indo-chinese/

https://nishkitchen.wordpress.com/tag/chilli-chicken-recipe/



http://www.indianfoodforever.com/indo-chinese/chinese-chilli-chicken.html

http://food.ndtv.com/recipe-boneless-chilli-chicken-98809

http://www.boldsky.com/cookery/non-vegetarian/chicken/indo-chinese-chilli-garlic-chicken-recipe-053009.html?PageSpeed=noscript
Categories: thinktime

Molecular biologist named Rising Talent for L’Oréal Women in Science

Teaser:  In a ceremony held in Paris, biochemist and molecular biologist, Dr Kathryn Holt was named one of fifteen Rising Talents for L’Oréal Women in Science for 2015.

In a ceremony held in Paris, biochemist and molecular biologist, Dr Kathryn Holt was named one of fifteen International Rising Talents for L’Oréal Women in Science for 2015.

Dr Holt’s innovative methods in detecting the presence and impact of drug resistant bacteria in hospitals, was modelled on her discovery when researching typhoid in Nepal. She found that the tropical disease didn’t always arise from the same source even within a small community, indicating that community members could be carrying the disease from multiple sources.

read more

Categories: thinktime

Michael Still: Goodwin trig

Planet Linux Australia - Thu 19th Mar 2015 08:03
I talk about urban trigs, but this one takes the cake. Concrete paths, street lighting, and a 400 meter walk. I bagged this one on the way home from picking something up in Belconnen. To be honest, I can't see myself coming here again.



   



Interactive map for this route.



Tags for this post: blog pictures 20150318-goodwin photo canberra bushwalk trig_point belconnen

Related posts: Harcourt and Rogers Trigs; Big Monks; Cooleman and Arawang Trigs; A walk around Mount Stranger; Forster trig; Two trigs and a first attempt at finding Westlake



Comment
Categories: thinktime

Spring forward

Seth Godin - Thu 19th Mar 2015 04:03
Sometimes, it takes some prodding to make a leap. For the next 48 hours (through Friday, March 20), the five-copy pack of my new book is on sale. Use the discount code spring to save 40% off the discounted price,...         Seth Godin
Categories: thinktime

Don’t Forget About Contrast

a list apart - Wed 18th Mar 2015 23:03

Several years ago I wanted to get an external monitor to go along with the laptop my work provided. I was a remote worker and decided to buy one myself that I could hang on to even if I left that job. But I was also a bit cheap. I drooled over the Apple Cinema displays, but I didn’t want to spend that kind of money.

Enter the big-box electronics store and their wide range of displays. I stood in front of one, decided on a size, and purchased it. I bought an LG that seemed “good enough” for my need for more screen real estate for windows of code, browsers, and dev tools. To be quite honest, this monitor has met those needs. I’m still using it.

It also pointed out a glaring issue that rears its head in a lot of our designs: we aren’t using enough color contrast to accommodate users who may not have the latest and greatest screens. I surfed the web the way I think a lot of people do, on a monitor that they took out the box and started using without doing any calibration. I was astounded by the lack of contrast all over the place. We like gray a lot and often we like it to be very subtle.

So, even though this monitor is not exactly what I would have bought if I could have afforded something nicer at the time, I’m now grateful for it. While I’m working on client projects, I’m often pointing out to the designers when their design cues or colors may be a little too subtle. If I’m dragging a design over to my laptop screen to be able to differentiate the contrast and colors, then it’s probably a good idea to punch things up a bit.

You don’t have to go out and buy a cheap monitor to see this, you can also test on older devices that don’t have the latest and greatest screens on them. Many cities have Open Device Labs where you can test on devices for free. If something like that is unavailable to you, there are other ways to find devices for inexpensive testing—Brad Frost has a great post on how to do that. There are many instances where our sites or applications aren’t going to be used on high-end, Retina devices or monitors and I think we have an obligation to consider that as we design so all our users can easily interact with the things we build.

As an example of this, I recently worked on an application that was intended for use in hospitals. I couldn’t help but wonder, were those monitors going to be able to show subtle color differences? Many of us are making applications that may be used places like hospitals, or other settings where the screens being used aren’t calibrated to perfection so subtle contrast can get lost. That’s just one example of an audience where I would want to be careful about what I expect out of a screen or monitor.

If you don’t have a cheaper monitor around, I highly recommend using developer tools to help you check for accessibility issues such as contrast. The accessibility team at Google has been doing a great job making tools that can help point out where there may be issues, so if you use Chrome, run an accessibility audit to see where you may need to make changes. Jenn Lukas wrote a great blog post here on ALA to describe testing color in the Chrome Dev Tools.

I’m grateful for this monitor because it points out contrast issues and reminds me frequently that those issues exist, and like color blindness variations, need to be taken into account as we work. Color contrast plays a large role in our designs, so make sure you test for it, check out designs on less capable screens, and audit your sites with the tools available, so that your users can easily see all the pieces of your design.

Categories: thinktime

Along for the ride

Seth Godin - Wed 18th Mar 2015 20:03
Like the pilot says, "sit back, relax, and enjoy the flight." When you're on one of those Disneyland boats, it takes you where Disney wants you to go. That's why you got on. And so you are lulled, a spectator,...         Seth Godin
Categories: thinktime

Linux Users of Victoria (LUV) Announce: LUV Beginners March Meeting: An Introduction to High Performance Computing Using Linux

Planet Linux Australia - Wed 18th Mar 2015 16:03
Start: Mar 21 2015 12:30 End: Mar 21 2015 16:30 Start: Mar 21 2015 12:30 End: Mar 21 2015 16:30 Location: 

RMIT Building 91, 110 Victoria Street, Carlton South

Link:  http://luv.asn.au/meetings/map

Of the top five hundred computers in the world today, 97% of them run Linux. This is no accident, as Linux offers the best platform for efficient and scalable code. In this introductory session, LUV members will be introduced to the core concepts and architecture behind supercomputing, high-performance computing, and parallel processing, along with an introductory session on an actual HPC system.

LUV would like to acknowledge Red Hat for their help in obtaining the Buzzard Lecture Theatre venue and VPAC for hosting.

Linux Users of Victoria Inc., is an incorporated association, registration number A0040056C.

March 21, 2015 - 12:30

read more

Categories: thinktime

David Rowe: SM1000 Part 12 – Testing in the US

Planet Linux Australia - Wed 18th Mar 2015 08:03

Walter, K5WH has one of the 3 pre-beta SM1000 units. He writes:

Here’s a pic of the operations setup of the SM1000 on the air today from Houston Texas, into my HPSDR radio. With average Power down to 3 watts even. Made successful contacts to Mel-K0PFX and Gerry-N4DV. After working the audio levels a little, had reports of nice transmitted audio, and the received audio was very clean sounding as well. We were even fortunate enough to have a station breaking in with us from Benin West Africa, TY2BP Pat.

So not only working a couple stateside stations, but first DX as well. Great success with the SM1000!

Categories: thinktime

Jeff Waugh: Pictures of depression

Planet Linux Australia - Wed 18th Mar 2015 06:03

A warning light is pulsing on the control panel in front of you, but it can wait. You’ll get to it in a moment. So many things to do.

A polite, persistent bleeping began at some point. You weren’t paying enough attention to recall when. It’s ever so slightly out of phase with the warning light.

You feel a dull rumbling through the seat, the floor, between your joints. The room shifts on its axis, as if it’s falling away from under you.

Darkness. A klaxon splutters and honks. Rotating beacons cut the room into contorted still images. Orange, blue, orange, blue.

You watch a wall puncture, crack, and tear. The air around you whistles out into silence.

Metal grinds through metal. It would sound like two trains carving through each other, but for the vacuum.

Then the walls peel away.

Floating. Alone. Adrift. Bewildered.

In depression, no one can hear you scream.

Late last year, I had another crash. (Episode is a silly word.) I should’ve seen it coming. Or, I did see it coming, but pretty much anything else short of anchovies is more pleasant than actually dealing with it.

I have no right or reason to be depressed. There are contributing factors, for sure, but no root cause. In every other respect, life is grand. But that’s not how depression works. It’s a parasite, sucking out every feeling until you’re a dead-eyed husk… except guilt. That one it nurtures.

What’s weird is having a graphical representation of the fall. Check it out: Metadata! The quantified self!

This is a collectd chart of the RAM utilisation in my desktop computer. SLIVER has two big monitors, a nice video card, proper headphones, and so on. It’s where the work gets done, and it’s a dead zone from late November to mid February. My GitHub activity chart looks much the same.

Things improved in February, but I’m still taking a break from work. I need to get my shit together, and don’t want to disappoint anyone if I hit another wall. See that gap in March? Another wall!

But I’m out of the dead zone.

On good days, I’ve been seeing friends, doing personal projects, science experiments, and learning new things. On bad days, sleeping, watching television, reloading web pages. I’m still trading the occasional people-heavy event for a couple of bad days to “recover”. Pfft. That’ll get better.

It sucks being away from work. Lots of big changes and exciting things going on. But I’m grateful for the support, understanding, and time away. Back soon.

– — –

The big difference this time around is hope. Psychologically, I know I can beat depression a hundred times worse, because I did. Financially, I can survive a siege of non-functional depression because I’ve had three years to build a war chest to outlast it. Personally and professionally, I’m more confident because I know where I fit, and what I need to learn.

So, it’s been a shitty few months. But it’s going to be okay.

Categories: thinktime

80/20 Practitioners Make Better Communicators

a list apart - Wed 18th Mar 2015 01:03

I spent the better part of 2014 working on two redesigns: one for a major pizza chain, the other for a major bike retailer. The five of us working on the redesigns were excited beyond words—two large-scale sites about two things we loved: pizza and bikes! We all wanted to be heavily involved in every phase of these projects to ensure their success. Along the way, we learned important lessons about how to fine-tune that involvement to arrive at a better outcome.

Working with the same team on two simultaneous projects allowed us to experiment a little with our process and compare notes. The ecommerce-driven Pizza Site had a strong focus on user flows, so we began by creating HTML wireframes for every page. What had once seemed like a bunch of grandiose ideas on whiteboards morphed into actual working prototypes. As we moved into design, the prototypes came to life in all their melted-cheese glory. But by month nine of the engagement, as we started to polish up the templates, we realized that we were looking at the third installment of the same redesign.

This isn’t an unusual occurrence. Teams often inadvertently recreate designs multiple times across phases; the end result looks almost nothing like what the team set out to achieve. What causes this disconnect?

In my experience, it comes from insufficient communication among teams with varying skillsets. Some teams are composed of specialists who all want their ideas and voices heard (yielding vastly different results) while fighting for time, resources, and budget. Alternately, when a generalist works on the entire site, they risk getting spread too thin; the struggle to explore and iterate can produce stale, predictable solutions. Either too much specialization or too much generalization can overwhelm practitioners (and budgets)—and neither approach works.

How to become an 80/20 practitioner

Luckily, there’s a better way. When designers and developers (and entire web teams) work closely together with flexibility and shared understanding, they can use their time and resources more efficiently and creatively. Whether your process is waterfall or agile, a solid team foundation applies to everyone: it allows you to shape a solution that benefits all teammates on a project.

To avoid the mistakes we made on our Pizza Site process, we balanced our responsibilities differently with the Bike Site. We became what I call 80/20 practitioners, focusing 80 percent of our time on our own respective strengths while distributing the remaining 20 percent across other disciplines to benefit the entire project.

80/20 collaboration is about people. It’s about passions. Sounds great, right? So, where do we start?

Establish the foundation

Being a good practitioner means seeing beyond yourself to your team’s broader needs and goals. While molding your process, it’s important to maintain an open, honest discussion with your teammates. Take a comprehensive inventory of the people on your team. Instead of labeling someone a “designer” or a “developer,” take stock of their true skillsets and passions. I’ve worked with amazing graphic designers, amazing UX designers, and amazing interaction designers, all of whom had the same title: designer. What works depends on the person.

We’ve all heard the argument that designers need to code. And while that might be ideal in some cases, the point is to expand your personal spectrum of skills to be more useful to your team, whether that manifests itself in the form of design, content strategy, UX, or even project management. A strong team foundation begins by addressing gaps that need to be filled and the places where people can meet in the middle. This is also how you, as a practitioner, can identify where you should develop your 20 percent of surplus abilities for a given project.

If you imagine your team as a spectrum of skills, each person should have a skillset that covers one part of that spectrum (overlapping to some extent with another part). Let’s pretend this spectrum goes from graphic design (red), to code (blue), with every shade of purple in between. As a designer, I span from the reddest of reds to a reddish purple. That leaves the rest of the purple and blue to be picked up. Let’s say my team includes a designer/developer hybrid, Ava, who is all the varying shades of purple. And let’s say I also have a strictly blue backend developer, Carter, on my team. In this instance, we’ve covered all our bases. If it was just Carter and me, though, we’d be left with a significant void in the middle. We would need either to extend our 20-percent skillset into the purple area or to bring in an additional person to bridge the gap. The spectrum’s endpoints will vary from person to person and team to team.

Strengthen weaknesses

Whenever someone told me, “You should code!” I would think: “But Developer McCoderson can do it so much better and faster than I ever could!” Which was true, so I continued my deep dive into design. Over time, though, working very closely with my developers every day on the Pizza Site, my interest was slowly piqued. Once I started incorporating HTML wireframes into my design process, I began to see how it benefitted me. I could make faster content updates, my layout was automatically responsive, and I could focus purely on content hierarchy rather than worrying about resizing boxes every time content changed.

The more I realized that coded deliverables could be design deliverables, the more I understood that I could get interactions in front of a client earlier. Animations, dropdowns, popovers, etc.—these things are design. We want the client’s feedback on this early, because seemingly minor details like hovers reflect the brand and reinforce the design just as much as an image or color choice do.

This discovery was so liberating that I actually wanted to include code in my process from then on because I preferred working that way, not just because I thought “This will make me a better designer.” I now catch myself voluntarily reading about things like inline SVG and the picture element and almost don’t recognize myself!

Take a candid look at your process and see where you want to expand your 20 percent, not where you think you should expand it. Let’s go back to Carter, the backend developer, for a second. Maybe he wants to improve his front-end skills—but by “front-end,” does he mean his code or his design eye? What’s missing is probably not a talent for writing beautiful DRY code, but rather the ability to recognize design nuances. Maybe the place to start is by reading articles about typography or checking out other design resources, instead of plunging into JavaScript.

Once you start recognizing these secondary areas, you can begin to take your newfound interests offline and look into different meetups or talks than you’d normally attend. I discovered that nothing helped me improve my 20-percent skills more than simply befriending wildly talented developers, both in and out of the workplace.

Learn from each other

The developer on the Bike Site team created a Grunt file to accommodate our entire team’s needs, including design deliverables and how we handle wireframes. Once everything started being delivered within a code-based project hub, we were all on the same page—literally. We could jump in and help each other as necessary, especially on stressful delivery days. Even the project manager was able to use and update the hub.

And the developers learned from me, too. Having them involved from day one meant that they were included in a lot of our design reviews. They began to understand the thought process behind our design decisions, and everyone could holistically understand the system we all were building together. When we began to figure out the wireframing and user-experience part of the site, every member of the team had behavior- and experience-driven suggestions that found their way into the project, both in terms of how it would ultimately look and how it would be built. With everyone involved from the beginning, new ideas that previously never would have been considered cross-pollinated the deliverables—whether it was a developer suggesting an out-of-the-box design pattern or a designer creating a performance budget.

When these conversations happen, barriers between teammates gradually fall away. You’ll probably suggest tools to one another and start to merge processes; in that merging, a new collaborative process will take shape. When we borrow one another’s tools, we begin to learn their benefits and how they may work for our own needs, and we ultimately start speaking the same language. Being aligned on objective project goals helps to keep reviews on track and to more easily settle discrepancies. It isn’t about making anyone’s job easier; it’s about focusing on what’s best for the project. Shared process isn’t something that you can just decide to do; rather, it emerges from learning how another person works.

Let go of ego

To rapidly take a design to code, the overall direction needs to be mostly approved by the client. I say “mostly” because the best iterations happen in the browser once we begin interacting with our designs. This is where our 20-percent-spectrum overlap really kicks in. There will be holes in the design that need to be filled, and it’s up to the developer to create a useful roadmap for the designer to iterate on. Imagine that an early homepage concept is approved and we jump into developmental iterations, but I haven’t had a chance to style the navigation dropdowns yet. I love it when developers take a stab at styling these things. If need be, I can always tweak details that feel off to me. When developers have some design sense, they are able to jump in and make design decisions that the designer may not have considered in a fluid layout or behavior. Designers love to be perfectionists, but we need to learn to let go and not be afraid to allow developers to jump into coding a template of an “imperfect” mockup.

There’s nothing wrong with piece-designing parts and modules as the developer finds holes in the page or media queries. As Dan Mall has stated, it’s about deciding in the browser, not designing in the browser. Everything might not be figured out yet, but that’s okay: we’ll figure it out together. Our websites are fluid; our process should be, too.

Shaking up a process isn’t easy

Change can be hard for any organization, especially when strict guidelines are in place for current processes. You have to work toward breaking down any barriers in communication—whether by getting to know a new teammate on a new project, working within your organization to dissolve silos, or trying to introduce a new workflow idea to your boss. A malleable process is a strong one.

The best place to start is with your project manager. It’s difficult to fit a new process into an ongoing project retroactively, so try to address this at the planning stage. If you’re about to begin a project, make the manager aware of your ideas and how the project plan could be shaped a little differently. It’s important for the project manager to understand the plan so that they can set the expectations with the client accordingly. It’s equally important for them to understand how the timeline will be affected, as it may depart from the typical flow your team is used to.

In large organizations, managers may need to run ideas past the managers of other departments. See if your next project can be a trial run for experimenting with a new process, and volunteer to head the initiative. Samantha Warren gave a fantastic presentation at An Event Apart on getting design ideas moved through an organization. If this doesn’t seem feasible, try building relationships with your counterparts yourself. See if they are open to trying new methods and working more closely together. If you get multiple people on board, it may be easier to convince the powers that be to try something new. Teams organically working well together are a powerful demonstration of just how effective collaboration can be.

Everybody benefits

Dive deeply into your passions while understanding the moving parts around you. Mastering your specialty is not only crucial for professional development and personal satisfaction, but it will also serve your team as you help to stretch that spectrum further. Projects benefit from experts who understand the whole while focusing on their strengths.

When we speak openly about shared end goals, our teamwork gets stronger. When we jump in and help out on cross-discipline deliverables, our teamwork gets stronger. Most importantly, when we combine our collective strengths and work together fluidly, it gives us the perfect recipe for an amazing project.

Remain true to your passions, but take the time to learn something about the skillsets of others to help you craft a unique team dynamic. The 80/20 guideline is a place to strive for—a place where we push our own skills and passions while rounding out our knowledge so that we can work better with our teammates. Being an 80/20 practitioner makes a stronger you and a stronger team.

Categories: thinktime

Pluralization for JavaScript

a list apart - Wed 18th Mar 2015 01:03

Seventy-one percent of today’s internet users don’t speak English as a first language, and that number keeps growing. But few people specialize in internationalization. As a result, most sites get it wrong—because things that seem straightforward are often anything but.

Take pluralization. Turning singular words into plurals within strings gets tricky quickly—even in English, where most plural words end with an s. For instance, I worked on a photo-sharing app that supported two languages, English and Chinese. It was easy to add an s to display “X like[s]” or “Y comment[s].” But what if we needed to pluralize “foot” or “inch” or “quiz”? Our simple solution became a broken hack.

And English is a relatively simple case. Many languages have more than two plural forms: Arabic, for example, has six, and many Slavic languages have more than three. In fact, at least 39 languages have more than two plural forms. Some languages only have one form, such as Chinese and Japanese, meaning that plural and singular nouns are the same.

How can we make sense of these complex pluralization issues—and solve them in our projects? In this article, I’ll show you some of the most common pluralization problems, and explain how to overcome them.

Problems with pluralization

Pluralization gets even more complex: each language also has its own rules for defining each plural form. A plural rule defines a plural form using a formula that includes a counter. A counter is the number of items you’re trying to pluralize. Say we’re working with “2 rabbits.” The number before the word “rabbits” is the counter. In this case, it has the value 2. Now, if we take the English language as an example, it has two plural forms: singular and plural. Therefore, our rules look like this:

  • If the counter has the integer value of 1, use the singular: “rabbit.”
  • If the counter has a value that is not equal to 1, use the plural: “rabbits.”

However, the same isn’t true in Polish, where the same word—“rabbit,” or “królik”—can take more than two forms:

  • If the counter has the integer value of 1, use “królik.”
  • If the counter has a value that ends in 2–4, excluding 12–14, use “królika.”
  • If the counter is not 1 and has a value that ends in either 0 or 1, or the counter ends in 5–9, or the counter ends in 12–14, use “królików.”
  • If the counter has any other value than the above, use “króliki.”

So much for “singular” and “plural.” For languages with three or more plural forms, we need more specific labels.

Different languages use different types of numbers

You may also want to display the counter along with the pluralized noun, such as, “You have 3 rabbits.” However, not all languages use the Arabic numbers you may be accustomed to—for example, Arabic uses Arabic Indic numbers, ٠١٢٣٤٥٦٧٨٩:

  • 0 books: ٠ كتاب
  • 1 book: كتاب
  • 3 books: ٣ كتب
  • 11 books: ١١ كتابًا
  • 100 books: ١٠٠ كتاب
Different languages or regions use different number formats

We also often aim to make large numbers more readable by adding separators, as when we render the number 1000 as “1,000” in English. But many languages and regions use different fractional and thousand separators. For example, German renders the number 1000 as “1.000.” Other languages don’t group numbers by thousands, but rather by tens of thousands.

Solution: ICU’s MessageFormat

Pluralization is a complex problem to solve—at least, if you want to handle all these edge cases. Recently, International Components for Unicode (ICU) did precisely that with MessageFormat. ICU’s MessageFormat is a markup language specifically tailored to localization. It allows you to define, in a declarative way, how nouns should be rendered in various plural forms. It sorts all the plural forms and rules for you, and formats numbers correctly. Unfortunately, many of you probably haven’t heard of MessageFormat yet, because it’s mostly used by people who work specifically with internationalization—known to insiders as i18n—and JavaScript has only recently evolved to handle it.

Let’s talk about how it works.

Using CLDR  for  plural forms

CLDR stands for Common Locale Data Repository, and it’s a repo that companies like Google, IBM, and Apple draw on to get information about number, date, and time formatting. CLDR also contains data on the plural forms and rules for many languages. It’s probably the largest locale data repository in the world, which makes it ideal as the basis for any internationalization JavaScript tool.

CLDR defines up to six different plural forms. Each form is assigned a name: zero, one, two, few, many, or other. Not all locales need every form; remember, English only has two: one and other. The name of each form is based on its corresponding plural rule. Here is a CLDR example for the Polish language—a slightly altered version of our earlier counter rules:

  • If the counter has the integer value of 1, use the plural form one.
  • If the counter has a value that ends in 2–4, excluding 12–14, use the plural form few.
  • If the counter is not 1 and has a value that ends in either 0 or 1, or the counter ends in 5–9, or the counter ends in 12–14, use the plural form many.
  • If the counter has any other value than the above, use the plural form other.

Instead of manually implementing CLDR plural forms, you can make use of tools and libraries. For example, I created L10ns, which compiles the code for you; Yahoo’s FormatJS has all the plural forms built in. The big benefits of these tools and libraries are that they scale well, as they abstract the plural-form handling. If you choose to hard-code these plural forms yourself, you will end up exhausting yourself and your teammates, because you’ll need to keep track of all the forms and rules, and define them over and over whenever and wherever you want to format a plural string.

MessageFormat

MessageFormat is a domain-specific language that uses CLDR, and is specifically tailored for localizing strings. You define markup inline. For example, we want to format the message “I have X rabbit[s]” using the right plural word for “rabbit”:

var message = 'I have {rabbits, plural, one{# rabbit} other{# rabbits}}';

As you can see, a plural format is defined inside curly brackets {}. It takes a counter, rabbits, as the first argument. The second argument defines which type of formatting. The third argument includes CLDR’s plural form (one, many). You need to define a sub-message inside the curly brackets that corresponds to each plural form. You can also pass in the symbol # to render the counter with the correct number format and numbering system, so it will solve the problems we identified earlier with the Arabic Indic numbering system and with number formatting.

Here we parse the message in the en-US locale and output different messages depending on which plural form the variable rabbits takes:

var message = 'I have {rabbits, plural, one{# rabbit} other{# rabbits}}.'; var messageFormat = new MessageFormat('en-US'); var output = messageFormat.parse(message); // Will output "I have 1 rabbit." console.log(output({ rabbits: 1 })); // Will output "I have 10 rabbits." console.log(output({ rabbits: 10 })); Benefits of inlining

As you can see in the preceding message, we defined a plural format inline. If it weren’t inlined, we might need to repeat the words “I have…” for all plural forms, instead of just typing them once. Imagine if you needed to use even more words, as in the following example:

{ one: 'My name is Emily and I got 1 like in my latest post.' other: 'My name is Emily and I got # likes in my latest post.' }

Without inlining, we’d need to repeat “My name is Emily and I got…in my latest post” every single time. That’s a lot of words.

In contrast, inlining in ICU’s MessageFormat simplifies things. Instead of repeating the phrase for every plural form, all we need to do is localize the word “like”:

var message = 'My name is Emily and I got {likes, plural, one{# like} other{# likes}} in my latest post';

Here we don’t need to repeat the words “My name is Emily and I got…in my latest post” for every plural form. Instead, we can simply localize the word “like.”

Benefits of nesting messages

MessageFormat’s nested nature also helps us by giving us endless possibilities to define a multitude of complex strings. Here we define a select format in a plural format to demonstrate how flexible MessageFormat is:

var message = '{likeRange, select,\ range1{I got no likes}\ range2{I got {likes, plural, one{# like} other{# likes}}}\ other{I got too many likes}\ }';

A select format matches a set of cases and, depending on which case it matches, it outputs the corresponding sub-message. And it is perfect to construct range-based messages. In the preceding example, we want to construct three kinds of messages for each like range. As you can see in range2, we defined a plural format to format the message “I got X like[s],” and then nested the plural format inside a select format. This example showcases a very complex formatting that very few syntaxes can achieve, demonstrating MessageFormat’s flexibility.

With the above format, here are the messages we can expect to get:

  • “I got no likes,” if likeRange is in range1.
  • “I got 1 like,” if likeRange is in range2 and the number of likes is 1.
  • “I got 10 likes,” if likeRange is in range2 and the number of likes is 10.
  • “I got too many likes,” if likeRange is in neither range1 nor range2.

These are very hard concepts to localize—even one of the most popular internationalization tools, gettext, can’t do this.

Storage and pre-compiled messages

However, instead of storing MessageFormat messages in a JavaScript variable, you might want to use some kind of storage format, such as multiple JSON files. This will allow you to pre-compile the messages to simple localization getters. If you don’t want to handle this alone, you might try L10ns, which handles storage and pre-compilation for you, as well as syncing translation keys between source and storage.

Do translators need to know MessageFormat?

You might think it would be too overwhelming for non-programming translators to know Messageformat and CLDR’s plural form. But in my experience, teaching them the basics of how the markup looks and what it does, and what CLDR’s plural forms are, takes just a few minutes and provides enough information for translators to do their job using MessageFormat. L10ns’ web interface also displays the example numbers for each CLDR plural form for easy reference.

Pluralization isn’t easy—but it’s worth it

Yes, pluralization has a lot of edge cases that aren’t easily solvable. But ICU’s MessageFormat has helped me tremendously in my work, giving me endless flexibility to translate plural strings. As we move to a more connected world, localizing applications to more languages and regions is a must-do. Knowledge about general localization problems and tools to solve them are must-haves. We need to localize apps because the world is more connected, but we can also localize apps to help make the world more connected.

Categories: thinktime

When push comes to hug

Seth Godin - Tue 17th Mar 2015 20:03
This is a much more stable response than pushing coming to shoving, because shoving often leads to something unsustainable. Hugging is a surprising and difficult response to pushing, but it changes the trajectory, doesn't it?         Seth Godin
Categories: thinktime

Ben Martin: Google Breakpad and the post crash experience

Planet Linux Australia - Tue 17th Mar 2015 15:03
Google Breakpad has many components to it, but at the basic level it lets you capture information at the time a crash occurs and upload that to the net. A really cute part of Breakpad is that the binary doesn't need to have the debug symbols in it, you don't even need to have them on the client machine at any location. When you build version $githash then you use a breakpad tool to copy out the debug symbols into separate files. When the user discovers a crash they upload a minidump file to a server of your selecting. Then you can combine the extracted symbols from build time and the minidump file to generate a backtrace with line number information. So software users don't have to know about gdb or lldb or whatnot and how to make a backtrace and where to paste it.







I recently updated FontForge's use of breakpad to use a small server on localhost to report the bug. The application dmg file for fontforge will soon also include the extracted symbols for the build. By telling breakpad to use a local server, that server can lookup the symbols that are shipped and generate a human readable backtrace with line number information. Because its also a web interface and running locally, it can spawn a browser on itself. So instead of getting the Mac dialog supplied by the osx crash reporter app telling you that there was a crash, you get a web page telling you the same thing. But the web page can use jQuery/Bootstrap (or $ui tool of choice) and ask what the user was doing and offer many ways to proceed from there depending on how the user wants to report things. The https://gist.github.com/ site can be used to report without any login or user accounts. It's also rather handy as a place to checking larger backtraces that might be, maybe, 50-100kb.



But once you can upload to gist, you can get a http and other URL links to the new gist. So it makes sense from there to offer to make a new github issue for the user too. And in that new issue include the link to the gist page so that developers can get at the full backtrace. It turns out that you can do this last part, which requires user login to github, by redirecting to github/.../issues/new and passing title and body GET parameters. While there is a github API, to report a new issue using it you would need to do OAuth first. But in the libre world it's not so simple to have a location to store the OAuth secure token for next time around. So the GET redirect trick nicely gets around that situation.





For those interested in this, the gist upload and callback to subsequently make a github issue are both available. The Google Breakpad hands over the minidump to a POST method which then massages the minidump into the backtrace and spawns a browser on itself. The GET serves up all the html, css, js, and other assets to the browser and that served html/js is what I link to at the start of the paragraph which is where the actual upload/reporting of the backtrace takes place.



The only thing left to do is to respond to the backtraces that come in and everybody gets a more stable FontForge out of the deal. It might be interesting to send off reports to a Socorro server too so that statistics month on month can be easily available.



Categories: thinktime

Tim Serong: FWIW

Planet Linux Australia - Tue 17th Mar 2015 13:03

Today I emailed Julie Collins MP, and senators Catryna Bilyk, Carol Brown, Jacqui Lambie, Helen Polley, Lisa Singh and Anne Urquhart concerning data retention. For the record, and in case it helps anyone else who wants to contact their representatives and senators, here’s what I wrote:

Dear NAME/TITLE,

I am writing regarding the Telecommunications (Interception and Access)

Amendment (Data Retention) Bill 2014. As I am sure you are very busy,

I will be as brief as I can.

The distinction the bill makes between metadata (so-called “non-content

data”) and content is grossly misleading; once you have enough of it,

metadata is just as privacy invasive, if not more so, than the actual

content of communications, and as such should only be collected with

proper judicial oversight, i.e. after a warrant is obtained.

Retaining this data for the entire Australian population is mass

surveillance, nothing more, nothing less, and is completely

inappropriate in a modern democratic society.

Tinkering around the edges as Labor is suggesting with amendments to

protect journalists’ sources is misguided at best; the only way to

protect such sources effectively would be to not retain the sources’

data either, and given that you can’t know who they are, the only way

to achieve this would be to not retain anyone’s data at all.

Finally, mandatory data retention won’t help to catch any criminal with

even a shred of intelligence, as it can be trivially circumvented by

the use of overseas communications providers, virtual private networks

and the like.

In summary, I am completely opposed to mandatory data retention in

Australia. As my representative, I’m asking you to reject this bill.

Yours faithfully,

Tim Serong

Categories: thinktime

The one who makes things worse

Seth Godin - Mon 16th Mar 2015 20:03
Every committee or organization has at least one well-meaning person who is pushing to make things more average. "On behalf of the masses, the uncommitted, the ones who don't care, we need to dumb this down, smooth out the edges...         Seth Godin
Categories: thinktime

Sridhar Dhanapalan: Twitter posts: 2015-03-09 to 2015-03-15

Planet Linux Australia - Mon 16th Mar 2015 01:03
Categories: thinktime

Double and half (freelancer math)

Seth Godin - Sun 15th Mar 2015 20:03
Successful freelancers need to charge at least double the hourly rate that they'd be happy earning doing full time work. (In many fields, it's more like 4 or 5x). And they need to spend at least half their time getting...         Seth Godin
Categories: thinktime

Binh Nguyen: Memorable Quotes

Planet Linux Australia - Sun 15th Mar 2015 16:03
- They like their cats fried with garlic and washed down with beer in Vietnam's specialist restaurants.



Some diners even falsely believe that by eating a cat's spine they will gain the feline's agility.



Although no official statistics are available, eating cat meat in Vietnam is by all accounts almost as popular as eating dog meat, something of a tradition in the South-east Asian nation, despite the import of both meats being illegal.

...

Animal rights groups say cats and dogs are smuggled across the border from China, Thailand and Laos to feed the Vietnamese trade.



Residents of Hanoi say they see few cats and dogs roaming the streets.

http://www.smh.com.au/world/cat-on-the-menu-outrage-at-vietnamese-trade-in-felines-20150205-136ras.html

- Dog vs. Cat

In this gastronomic sampling of Chinese food, I'd have to go with dog. The meat was much more tender with a pleasant flavor. Cat on the other hand was average and not something to really look forward to eating.

http://thoughtcatalog.com/mark-wiens/2013/07/what-does-dog-and-cat-meat-taste-like/

- "My life is rather full. I have a full time job and numerous hobbies in addition to copy editing Wikipedia."...

http://www.mirror.co.uk/news/technology-science/technology/man-makes-47000-wikipedia-edits-5106883

- Statistics: you can sensationalise anything with the right statistics. Case in point being the ad for the TV program about what really happens in Bali: "one Australian dies every 9 days in Bali". With the number of Australians visiting Bali that is probably unsurprising. So if they stayed in Australia they were more of a chance to die as one Australian dies every 3 1/2 minutes in Australia.

https://plus.google.com/109656415348418300485/posts

- A 'notorious molester' at Knox Grammar School had memorial gates erected in his honour with the inscription 'He touched us all', an inquiry has been told.

http://www.skynews.com.au/news/national/2015/02/24/school-put-up-memorial-for--molester-.html

- If you use a search engine, you will discover a wealth of material and, after reading and attmepting to apply some of it to your situation, you will enjoy a sense of satisfaction and achievement that I would in no way wish to deprive you of...

http://unix.stackexchange.com/questions/187140/centos-software-raid-1-issue

- @fruit: To quote the great Homer Simpson, "Aw, you can come up with statistics to prove anything, Kent. Forty percent of all people know that.

https://www.ozbargain.com.au/node/184124

- "It's like watching a truck jack-knife on a road," Oliver says, clearly relishing the suspense. "It's like, 'It didn't crash this time. Let's give it five minutes, then it's going into a ditch'."



Oliver, host of Last Week Tonight, the satirical take on the world's news and current affairs that is fast becoming one of the world's most popular programs of its type, describes Abbott as "a car crash of a human being", albeit terrific fodder for comedy.

...

"Tony Abbott is an objectively fascinating man," Oliver insists. "The fact he's the leader of a country is in itself appealing as a comic. What's nice is being able to present someone who people have not seen here [in the US] and just to give them a glimpse into other people's pain, as well as their own."

http://www.smh.com.au/entertainment/tv-and-radio/tony-abbott-is-a-car-crash-of-a-human-being-says-comedian-john-oliver-20150302-13sog5.html

- "This paint job sends a direct message back to perpetrators that their wild urinating on this wall is not welcome," said Julia Staron of the St. Pauli's Community of Interest group to Reuters. "The paint protects the buildings and the residents and most importantly it sends a signal this behaviour is not on."

http://www.cbc.ca/news/trending/german-city-uses-water-repellent-paint-to-splash-public-urinators-with-their-own-pee-1.2985123

- Work on the embassy was stopped in 1985, after it was determined that the building was so riddled with listening devices implanted by Soviet workers that the structure was in effect a multistory microphone. Washington and Moscow, as well as the Administration and Congress, have been haggling over what to do with the building ever since.

http://www.nytimes.com/1992/06/20/world/deal-made-on-bugged-us-moscow-embassy.html

- The Prime Minister has once again left onlookers shocked, and probably a little confused, but for once it wasn't what was coming out of his mouth, rather what was going into it.



While on a tour of a produce farm in Tasmania, Tony Abbott was seen to be munching on a raw onion - skin and all.

Onion, anyone?



"Better than any other onions I've eaten in a long time," Mr Abbott was reported as saying.



Images of the odd onion-fest immediately began doing the rounds online, with one media outlet labelling Mr Abbott "The Minister for Onions."



Mr Abbott was touring Charlton Farm Produce near Devonport in Tasmania on Friday when all of a sudden, he picked up the onion and ate it skin-on merely commenting that it was delicious and not shedding a single tear.



The PM, who appeared to be grimacing slightly, but otherwise may as well have been eating an apple, took the onion in his hand, and casually chomped into it while watching the grading of the vegetable.

http://www.smh.com.au/federal-politics/political-news/tony-abbott-shocks-as-he-eats-a-raw-onion-whole-20150313-143syz.html
Categories: thinktime

Tim Serong: Evolution

Planet Linux Australia - Sun 15th Mar 2015 16:03

I saw this on Twitter today:

HOLY SHIT LOOK AT THIS EMAIL I GOT FROM A RECRUITER USING HIS REAL FULL NAME AND EMAIL cc @girlziplocked for the list pic.twitter.com/qvAX2HLTZX

— Kelly Ellis (@justkelly_ok) March 13, 2015

I’m going to leave aside the possibility that this is a plot by someone else to ruin Justin D’Agostino’s life by forging an email to Kelly Ellis, as I’ve seen similar sentiments posted too many times (i.e. more than never), and I’m fucking sick of it.

Assuming for a moment that the egg-donor hypothesis is correct, if you are insufficiently evolved to control your urges (or if you share any of the opinions stated in the email above), then you are insufficiently evolved to warrant employment. Please leave and make room for someone else.

Categories: thinktime

Pages

Subscribe to KatteKrab aggregator