My name is Wilson Abubakar Radido. I'm 19 years old and the last born in a family of three children. My late father was half Tanzanian and half Kenyan while my mum is half Ugandan and half Kenyan.
I grew up in Area 3 of Mathare North. My dad was a carpenter and my mum used to work as a salonist before illness confined her to bed early this year. I dropped out of school last year while in Form Three and I have been supporting my family through my music.
That's a big load to carry at such a young age, how do you cope?
I'm used to struggling. Even when my dad was alive we encountered a lot of struggles sometimes even going to bed hungry. My first-born brother is an Electrical Engineering graduate but he hasn't been fortunate to get a job.
My younger brother was also supposed to join college this year but due to limited funds he is yet to. But despite the many challenges, we still manage to get by somehow.
A local magazine wrote that you get your clothes from abroad, how do you manage with so much on your plate?
It's true that some of the clothes I wear in my videos are sourced from Atlanta but I owe that to an organisation which sponsors my music career.
His name is Karanja. I met him in Mombasa during the recently concluded Groove Awards Tour.
So do you travel often to Atlanta to do your shopping?
No. Actually I have never been to Atlanta. He just sends me the stuff. Of course not all my clothes are from outside the country. I also shop locally.
Speaking of which, you seem to have a very deep Tanzanian accent in your songs, does that have anything to do with your middle Muslim name?
My middle name has been in our family for many generations. I should mention, no one in our family is a Muslim so it has nothing to do with religion.
As for the Tanzanian accent, I've grown up my entire life in Kenya so it also doesn't have anything to do with nationality.
I was a fan of Bongo music for a long time so when I decided to sing Gospel, God told me in a dream that that is the style I should use. After praying about it I was able to put together some lyrics then I hit the studio.
How did you end up doing a collabo with Gloria Muliro?


text:
QUEER CRITICISM AS A POST-MODERNIST APPROACH
Hamdi Hameed Yousif Department of English, College of Education for Women, Tikrit University, Tikrit , Iraq.
One of the post-modernist approaches to literary criticism is the queer criticism which has not been evaluated properly. Queer criticism can refer to any piece of literary criticism that interprets a text from a non-straight perspective. Therefore, it includes both lesbian and gay criticism.
The aim of this paper, therefore, is to trace the social and political reasons behind the emergence of Queer criticism in the late twentieth century till it acquired momentum in the twenty-first century. After trying to define the terms related to the Queer criticism, the paper tries to examine the poetics of queer (gay and lesbian) literary works and to point out the main characteristic features of this critical approach by identifying the criteria and the textual evidence by which a literary work is labeled queer. It, also tries to shed light on the common features between queer criticism and feminism, on the one hand, and queer criticism and the deconstructuralist approach on the other hand. The final section of the study is a critique which points out the negative aspects of this approach.
-Asquith, Mark. Annie Proulx: Brokeback Mountain and Postcards. London: Continuum Books 2009
-Bressler, Charles E. Literary Criticism: An Introduction to Theory and Practice. Upper Saddle River: Pearson Education, 2007.
-Hornby, A. S. Oxford Advanced Learner's Dictionary, 7th edition. Oxford: OUP, 2005.
-Jagose, Annamarie Rustom. Queer Theory: An Introduction. New York: New York University Press, 2005.
-Nelson, S. Emmanuel. Contemporary Gay American Poets and Writers: An A-to-Z Guide. London: Greenwood Press, 2003.
-Pickett, Brent L. The A to Z of Homosexuality, (the A to Z Guide Series, No. 122). Plymouth: The Scarecrow Press, Inc., 2009.
- Proulx, Annie Brokeblack Mountain. Dead Line Ltd., 1999.
-Rivkin, Julie and Michael Ryan (eds.). Literary Theory: An Anthology. Malden: Blackwell Publishers Inc., 2000.
- Sember, Brette McWhorter. Gay and Lesbian Rights: A Guide for GLBT Singles, Couples and Families. Naperville: Sphinx Publishing, 2003
-Siker, Jeffrey S. (ed.). Homosexuality and Religion: An Encyclopedia. London: Greenwood Press, 2007.
-Spargo, Tamsin . Foucault and Queer Theory (Postmodern Encounters Series). New York: Totem Books, 2000.
-Tyson, Lois. Critical Theory Today: A User Friendly Guide. New York: Taylor and Francis Group, 2006.
-Yaghoubi, Roya. Key Terms and Theories connected with Postmodernism. Tehran: Rehnama, 2013.
-www.wikipedia.com.
View the PDF File

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: Как делать автоматическое получение контента по внешнему ключу есть таблица ads. В ней около 80 полей. Мне нужно получить все значения этих полей. Но некоторые поля связанны по внешнему ключу с другими таблицами. Как я могу сделать чтобы в запросе место значения поля я сразу получал контент.
Объясню на примере:
Вот пример одного из полей

оно по внешнему ключу связана с таблицей employ_type

таблица employ_type:

При запросе "SELECT * FROM ads" он мне выдает idшник строки из таблицы employ_type

Какой запрос должен быть чтобы он выводил не просто idшник значение, а поле content.
Да, я понимаю как сделать это для одного поля, но мне надо сделать это для множества полей, без ручного прописывания для каждого.
Таблицы к которым идут внешние ключи имеют одинаковую структуру, отличаются только названия полей и таблиц.
Таблицы на Mysql.

redpajama_set_name: RedPajamaStackExchange


text:
It's Over, Says Mayawati, Questions Attitude Of 'Ex' Samajwadi Party
HomeAll IndiaIt's Over, Says Mayawati, Questions Attitude Of 'Ex' Samajwadi Party
Read inOther Languages
Mayawati said, "The attitude of the SP compels BSP to think whether it will be possible to defeat the BJP in the future"
All IndiaReported by Alok Pandey, Edited by Anindita SanyalUpdated: June 24, 2019 17:05 IST
Mayawati today said Bahujan Samaj Party will "fight all elections alone"
Mayawati said she will contest all elections, big or small, on its own
Mayawati had accused Akhilesh Yadav of not calling her after the results
She accused Mr Yadav of neglecting Muslims when he was UP Chief Minister
Mayawati today formally called an end to the alliance with Akhilesh Yadav's Samajwadi Party, tweeting that going forward, her party will contest all elections, big and small, on its own. In a series of tweets, the Bahujan Samaj Party also aired her grouse against Akhilesh Yadav, with whom she promised to keep cordial relations barely three weeks ago. A string of assembly seats will be up for by-election later this year.
"It is known that all our old grievances with the SP were kept aside, along with the anti-Dalit and ant-BSP decisions taken by the SP government between 2012-17, works carried out that were against reservation in promotion and deteriorating law and order situation - were all kept aside and an alliance was formed in public interest which was honoured completely," one of her tweets read.
In another, she said: "But after the Lok Sabha general election, the attitude of the SP compels BSP to think whether it will be possible to defeat the BJP in the future. Hence, for the sake of the party and the movement, the BSP will now fight all elections - big or small - by itself."
Accusing the BSP chief of "weakening the fight for social justice", Samajwadi Party leader Ramashankar Vidyarthi said, "She is speaking against the Samajwadi Party in haste and due to the Dalit support to the SP and its leader Akhilesh Yadav."
"People know the reality about what the ''malkin'' of the alliance has done," he said.
Yesterday, after a meeting with senior party leaders, Mayawati had accused Akhilesh Yadav of not calling her after the results, and working "against non-Yadav backward communities" and even neglecting the Muslims while he was the Uttar Pradesh Chief Minister.
The Mayawati-Akhilesh Yadav alliance failed to replicate the success during last year's bypolls at Gorakhpur and Phulpur
Party sources indicated that her remarks were meant to placate her traditional Scheduled Caste voter base in view of the coming by-polls on 11 assembly seats.
A section of her party leaders have attributed the loss in the national election to Dalit anger at the alliance with Akhilesh Yadav. The Other Backward Classes Yadavs, who support the Samajwadi Party, are traditional rivals of the Dalits.
The Mayawati-Akhilesh Yadav alliance failed to replicate the success during last year's bypolls at Gorakhpur and Phulpur, which had provided what the opposition considered a formula to beat the BJP.
This time, it managed to bag only 15 of UP's 80 seats, far less than the BJP's rich haul of 62. Mayawati has blamed it on the Samajwadi Party's failure to transfer its vote base to her BSP. Her party, however, made more gains - from a score of zero in 2014, the BSP manage to get 10 seats.
MayawatiAkhilesh Yadav
Government Suppressing People's Voice, Adopting Violence: Akhilesh Yadav
Cases Against UP Citizenship Law Protesters Should Be Withdrawn: Mayawati
All Those Who Understand Country's Soul Opposing CAA: Akhilesh Yadav
Video Of New Zealand Fan Chanting "Bharat Mata Ki Jai" Goes Viral. Watch
"Don't Hold Back": Dia Mirza Breaks Down At Jaipur Literature Festival
Work On To Provide Drinking Water Facility To Drought-Hit Bundelkhand: Yogi Adityanath
Budget 2020Delhi ElectionsPNR StatusUnion Budget 2020Train Running StatusOil HeaterRoom HeatersDelhi Election DateNirbhaya CaseAir India
BS Yediyurappa To Meet PM Modi, Amit Shah In Delhi On Thursday
Proposed Palestinian Capital Will Be In Abu Dis: Benjamin Netanyahu
Work On To Provide Drinking Water To Bundelkhand: Yogi Adityanath
Putin Pardons US-Israeli Woman Jailed In Russia For Drug Trafficking
All I Want Is To Express Solidarity With Rohith Vemula: Kunal Kamra


II. Diagnostic Confirmation: Are you sure your patient has open angle glaucoma?
Early diagnosis is difficult. The typically asymmetric deficits contribute to delay in recognition. However, some patients have complaints such as missing stairs if their inferior visual field has been lost, noticing portions of words missing when reading or having difficulty with driving. Usually, the patient becomes aware of visual field loss only when optic nerve atrophy is marked.
Glaucoma is a leading cause of irreversible blindness, second only to macular degeneration. Glaucoma can occur at any age but is 6 times more common among people over 60 years. Prevalence of primary open angle glaucoma (POAG) is 3-4 times higher in blacks than in Caucasians; in addition, blacks are up to 6 times more susceptible to optic disc nerve damage than Caucasians.
In a white population at risk for glaucoma, visual field loss can be expected to develop in about 3% of subjects over 10 years of follow-up without treatment. Risk increases with age and IOP. Patients over 40 years and those who have risk factors for open-angle or angle-closure glaucoma should receive a comprehensive eye examination every 1 to 2 years.
IOP can be elevated or within the average range.
Axons of retinal ganglion cells travel through the optic nerve carrying images from the eye to the brain. Damage to these axons causes ganglion cell death with resultant optic nerve atrophy and patchy vision loss. Elevated IOP (in unaffected eyes, the average range is 11 to 21mm Hg) plays a role in axonal damage, either by direct nerve compression or diminution of blood flow. However, the relationship between pressure and nerve damage is variable.
Of people with IOP over 21mm Hg (i.e., ocular hypertension), only about 1 to 2% per year (about 10% over 5 years) develop glaucoma. Additionally, about one third of patients with glaucoma do not have IOPs over 21mm Hg (known as low-tension glaucoma or normal-tension glaucoma).
IOP is determined by the balance of aqueous secretion and drainage. Elevated IOP is caused by inhibited or obstructed outflow, not oversecretion. In open-angle glaucoma, IOP is elevated because outflow is inadequate despite an angle that appears unobstructed. In angle-closure glaucoma, IOP is elevated when a physical distortion of the peripheral iris mechanically blocks outflow.
C. History Part 3: Competing diagnoses that can mimic open angle glaucoma.
Patients suspected of having open angle glaucoma may need work-up to rule out other causes for optic neuropathy, including, but not limited to, complete blood count, erythrocyte sedimentation rate (ESR), serology for syphilis and if suggested by the pattern of visual field loss, neuroimaging.
Fundus photography provides a permanent record of the appearance of the optic disc also useful for future references.
No consensus exists on what the appropriate medical treatment is for preventing or delaying the damage due to POAG when a patient has only elevated IOP and no other signs of POAG. To date, no one has been able to define conclusively which subgroups will develop damage if left untreated.
Typically, to gauge effectiveness, clinicians start drugs in only one eye (one-eye trial), once improvement in the treated eye has been confirmed at a subsequent visit (typically 1 to 4 weeks later), both eyes are treated. This is mailny useful in helping to decide whether or not to treat (i.e., if the medication is effective in achieving good pressure reduction without adverse effects).
Refer to ophthalmologist for further evaluation, management and follow-up.
Neuro-ophthalmology consultation may have a role in those patients who are experiencing progressive visual loss that does not appear to follow a typical glaucomatous pattern or if there are systemic symptoms or complaints.
Beta-blockers: adverse effects are due to systemic absorption of the drug :decreased cardiac output, and bronchoconstriction (bronchospasm), bradycardia, heart block, hypotension, depression or anxiety, and sexual dysfunction may be initiated or exacerbated. Ocular adverse effects may include blurred vision, eye ache, and corneal anesthesia.
Alpha2-adrenergic agonists: systemic adverse effects include dry mouth, fatigue, and drowsiness. Ocular adverse effects include allergic (follicular) conjunctivitis and contact dermatitis.
Prostaglandin analogs: adverse effects include conjunctival hyperemia, iris pigmentation, CME, and uveitis.
Timolol maleate/hemihydrate (Timoptic 0.25%, 0.5%; Timoptic XE, Betimol 0.25%, Istalol) – non-selective.
Carteolol ophthalmic (Cartrol, Ocupress) – blocks beta1 and beta2-receptors, and has mild intrinsic sympathomimetic activity (ISA), with possibly fewer cardiac and lipid profile adverse effects.
Betaxolol ophthalmic (Betoptic-S) – beta1-selective adrenergic antagonist, with possibly less pulmonary effects than non-selective agents. IOP-lowering effect is slightly less than non-selective beta-blockers.
Metipranolol hydrochloride (OptiPranolol) – beta-adrenergic blocker that has little or no intrinsic sympathomimetic effects and membrane stabilizing activity. Has little local anesthetic activity.
Levobetaxolol (Betaxon) – selectively blocks beta1-adrenergic receptors.
Apraclonidine 0.5%, 1% (Iopidine) – selective alpha-adrenergic agonist without significant local anesthetic activity. Has minimal cardiovascular effect.
Dorzolamide (Trusopt) – more commonly used concomitantly with other topical medicines.
Brinzolamide (Azopt) – may cause less ocular discomfort on instillation, secondary to a buffered pH, but can still cause foreign body sensation.
Acetazolamide (Diamox) – used for adjunctive treatment of chronic simple (open-angle) glaucoma and secondary glaucoma and preoperatively in acute angle-closure glaucoma when delay of surgery desired to lower IOP.
Various combinations of above drugs are also available.
Latanoprost 0.005% (Xalatan), Bimatoprost (Lumigan), Travoprost ophthamic solution (Travatan), Unoprostone (Rescula).
Careful monitoring needed in patients on beta-blockers.


The 380-unit Lush Acres will house four soaring towers of up to 25 storeys high on its tranquil, verdant grounds. Located near Layar LRT Station, and minutes from Sengkang MRT Station and major expressways, Lush Acres keeps its residents closely connected to other parts of Singapore.
Within short walking distance is Fernvale Point with a 24-hour food court and supermarket. Other nearby malls include Compass Point, Greenwich V and the upcoming Seletar Mall. A short drive away is the Jalan Kayu enclave with its delectable F&B offerings and the Seletar Aerospace Park, which houses several MNCs. Leisure amenities and established schools are also available nearby.


text:
package models.daos

import scala.concurrent.Future

import shared._

trait GameDAO {

  def get(id: String): Future[Option[Game]]

  def set(id: String, g: Game): Future[Any]

  def delete(id: String): Future[Any]

  def find(handle: String, max: Int = settings.GlobalSettings.MONGO_COLLECT_MAX): Future[List[Game]]

  def findpres(handle: String, max: Int = settings.GlobalSettings.MONGO_COLLECT_MAX): Future[List[Game]]

}

redpajama_set_name: RedPajamaGithub


text:
How a Victorian nurse became a pop culture icon
Stamps, an asteroid, a recipe and a Barbie doll have her name
Zena HawleyAgenda editor
An early portrait of Florence Nightingale, photographed in Berlin on her way back from Egypt, July 1850.
Statues and memorials are commonplace ways of remembering famous people but what about lending your name to a breakfast recipe, an asteroid or even a Barbie doll?
As people ready themselves to celebrate the 200th anniversary of nursing pioneer Florence Nightingale's birth tomorrow, her name lives on in dozens of sometimes surprising ways.
Appropriately, her name was given to seven NHS Nightingale hospitals set up across the country as part of the fight against the coronavirus pandemic.
And plans are in hand to rename the former Derbyshire Royal Infirmary, currently known as the London Road Community Hospital, the Florence Nightingale Community Hospital during her bicentennial anniversary year.
World prepares to mark 200th anniversary of Florence Nightingale's birth
Sign up to the Derbyshire Live newsletter for free and get the latest stories sent to your inbox
Disappointingly, most of the events, exhibitions and activities that had been planned around the anniversary have had to be cancelled or postponed because of the coronavirus outbreak.
There are plans to rename London Road Community Hospital after famed nurse Florence Nightingale
Many of them would have been held at the Florence Nightingale Museum, which is based at St Thomas' Hospital in London, and where dozens of events had been organised throughout 2020.
The hospital is where Florence originally set up her nurse training school in 1860, following her return from the Crimean War where she became known as the The Lady of the Lamp as she tended wounded soldiers in the hospital at Scutari, along with 38 other hand picked nursing assistants.
Nurses at the DRI in 1954 with a replica of the lamp which earned Florence Nightingale her enduring sobriquet
Now the museum finds itself facing the threat of closure permanently unless £160,000 can be raised to keep it going.
But while the Florence Nightingale Museum is physically closed, its new online exhibition Nightingale in 200 Objects, People & Places, is open for viewing at florence-nightingale.co.uk/200exhibits.
The exhibition presents 200 items, stories and places that explore the reasons for Florence Nightingale's international fame and enduring influence.
With the help of the museum, Derbyshire Live has put together some of the items from the exhibition which have turned Florence Nightingale into a modern pop culture icon.
Florence Nightingale Barbie
The Limited Edition Florence Nightingale Barbie doll by Mattel (Image: Paul Jordan)
The Florence Nightingale Museum has worked with toy maker Mattel on their Inspiring Women range, offering advice on the Scutari sash and the type of lamp Florence used so that a likeness of her during the Crimean War can be reproduced to celebrate the bicentenary of her birth.
The collectors' item launched on International Women's Day, March 8 and can be ordered online from the museum's gift shop, priced £65.
Asteroid 3122 Florence
The asteroid was named after Florence Nightingale by American astronomer Schelte J. 'Bobby' Bus in 1981.
Asteroid 3122 Florence is unusually large at five kilometres in diameter. It completes an orbit of our sun every 859 days.
It passed close to the Earth in 2017 and observations of this asteroid revealed, among other things, that Florence has two moons.
Rice à la Sœur Nightingale by Charles Elme Francatelli, 1861
Rice à la Sœur Nightingale by Charles Elme Francatelli, 1861 is contained in his recipe book It was named after Florence Nightingale and was a type of kedgeree dish (Image: Florence Nightingale Museum)
Florence Nightingale was known to be fond of curry and she was also the inspiration for this breakfast kedgeree recipe Rice à la Sœur Nightingale by chef Charles Elme Francatelli.
He was chief cook to Queen Victoria and later become the chef at the Reform Club.
In 1861, he published The Cook's Guide and Housekeepers and Butler's Assistant: A Practical Treatise on English and Foreign Cookery.
This book contained his recipe for fish with spiced rice named in honour of Florence Nightingale.
This is the recipe:
Fry 7oz boiled dry rice with a little fresh butter, nutmeg, pepper and salt; and when quite hot, add the whites of three hard-boiled eggs shred fine, and the white parts of a dried haddock.
Pile all this up lightly in a hot dish. Strew over the cone the yolks of the hard-boiled eggs previously rubbed through a wire sieve, and mixed with a little grated Parmesan cheese.
Garnish the rice round the base with fried croutons of bread push in the oven for five minutes - just to slightly colour the surface of a golden hue, and serve immediately.
The first movie of Florence Nightingale's life in 1915 and other films
(Image: Derby Telegraph)
The story of Nightingale's life and work has been told many times but the first time was in a silent film in 1915.
English actress Elisabeth Risdon was the first women to play Florence Nightingale on screen in the silent film Florence Nightingale. The film was directed by Maurice Elvey and based on Edward Tyas Cook's biography of Nightingale.
Other films have included The Lady with the Lamp, starring Anna Neagle, whose premier was attended by Princess Elizabeth and Prince Phillip in 1951.
Pub landlords uncover historic mural in bar while stripping wallpaper
Derby charity hands out PPE to disabled people and their carers
Money generated from the movie were donated to the Royal College of Nursing.
And in 1985 there was a lavish television movie made called Florence Nightingale, starring former Charlie's Angels star Jaclyn Smith and Belper-born actor Timothy Dalton.
There was also a 1936 American film called The White Angel directed by William Dieterle and starring Kay Francis, set during the Crimean War.
Nurse Florence Nightingale in Scutari Hospital in the Crimea (Image: Submitted)
Assassin's Creed Syndicate 2015
Florence's fame has also led to her becoming a star on the smaller screen in video game Assassin's Creed Syndicate by Ubisoft.
In the game, players complete missions set in Victorian London as the fictional protagonists Jacob and Evie Frye.
Players meet the character of Florence Nightingale and help her to complete a challenge at Lambeth Asylum.
The Assassin's Creed series is known for undertaking in-depth historical research, and the Nightingale we see here closely resembles her appearance after returning from the Crimean War.
However Lambeth Asylum and the Nightingale storyline are entirely fictional.
Florence Nightingale taken about 1860
Florence Nightingale in Japanese Manga
Florence has been a popular figure in Japanese educational literature since a translation of her life story was first published in 1890.
During the 20th century, she became a popular subject for manga biographies. These are aimed at young female readers and present her as a role model.
In Japan, her story is associated with heroic ideals including moral virtue and perseverance. She has also inspired fantastical fictional characters appearing in series such as Hokago no Charisma (2009-2014) and games including Fate/Grand Order (2015-present).
Santa Filomena by Henry Wadsworth Longfellow 1857
This poem was probably one of the man reasons that Florence Nightingale rose to public prominence in the aftermath of the Crimean War.
Santa Filomena is written by US poet Henry Wadsworth Longfellow. It is written shortly after the Crimean War in Nightingale's honour and describes her work in Scutari Hospital.
In this poem, Longfellow coined the name The Lady with the Lamp - an image which has become forever associated with Florence Nightingale.
This is an extract from the poem:
Lo! in that house of misery
A lady with a lamp I see
Pass through the glimmering of gloom
And flit from room to room.
Sheet of Royal Mail Stamps, 1970
Royal Mail postage stamps were produced in 1970 to celebrate 150 years since Florence Nightingale's birth.
The image shows her caring for soldiers during the Crimean War. Whilst her work at Scutari Hospital was only a short part of her life, it has remained her most vivid popular image.
£10 bank note featuring Florence Nightingale, 1975-1992
Florence Nightingale was the first historical woman to feature on one of England's bank notes.
(Image: Florence Nightingale Museum)
The Florence Nightingale Museum, an independent charity receiving no Government funding, has just launched a public appeal to help avert the risk of permanent closure.
A museum spokesman said: "Every donation is wholeheartedly welcome and will help the museum to continue to care for a historically significant collection and to inspire the next generation of healthcare workers."
The Museum's Go Fund Me fundraiser can be found at florence-nightingale.co.uk or a donation of £10 can be made by texting NIGHTINGALE to 70085.


text:
FDA clears Pharmacyclics drug for new cancer use
WASHINGTON – The Food and Drug Administration on Wednesday approved a cancer drug from Pharmacyclics and Johnson & Johnson for a new use against a rare blood and bone marrow disease.
The agency said it approved Imbruvica for patients with chronic lymphocytic leukemia who have already tried at least one other therapy. The disease causes a dangerous buildup of certain white blood cells that gradually spread from the bone marrow to lymph nodes and other organs. The National Cancer Institute estimates 15,680 Americans were diagnosed with the cancer in 2013 and 4,580 people died from the disease.
Wednesday's action is the second approval for Imbruvica, which the FDA approved for mantle cell lymphoma in November.
The once-a-day capsule works by blocking a protein that allows the cancer to multiply and spread. Regulators approved the drug for its new use based on a study of 48 patients who had already received four other treatments, on average. Results showed 58 percent of patients saw their cancer shrink after using Imbruvica. Studies of the drug are ongoing and an improvement in lifespan has not yet been established.
Imbruvica is manufactured by Sunnyvale, Calif.-based Pharmacyclics and marketed with Janssen Biotech Inc., a unit of New Brunswick, N.J.-based Johnson & Johnson.
Shares of Pharmacyclics Inc. rose $5.19, or 3.9 percent, to $138.04 in afternoon trading. J&J stock slipped 81 cents to $92.16.


text:
require 'zlib'
require 'json'
require 'csv'
require_relative 'value_converter_factory'

module Embulk
  module Output
    class Bigquery < OutputPlugin
      class FileWriter
        def initialize(task, schema, index, converters = nil)
          @task = task
          @schema = schema
          @index = index
          @converters = converters || ValueConverterFactory.create_converters(task, schema)

          @num_input_rows = 0
          @progress_log_timer = Time.now
          @previous_num_input_rows = 0

          if @task['payload_column_index']
            @payload_column_index = @task['payload_column_index']
            @formatter_proc = self.method(:to_payload)
          else
            case @task['source_format'].downcase
            when 'csv'
              @formatter_proc = self.method(:to_csv)
            else
              @formatter_proc = self.method(:to_jsonl)
            end
          end
        end

        @mutex = Mutex.new
        @ios = Hash.new

        def self.mutex
          @mutex
        end

        def self.reset_ios
          @ios = Hash.new
        end

        def self.ios
          @ios
        end

        def self.paths
          @ios.keys
        end

        THREAD_LOCAL_IO_KEY = :embulk_output_bigquery_file_writer_io

        # Create one io object for one output thread, that is, share among tasks
        # Close theses shared io objects in transaction
        #
        # Thread IO must be created at #add because threads in #initialize or #commit
        # are different (called from non-output threads). Note also that #add of the
        # same instance would be called in different output threads
        def thread_io
          return Thread.current[THREAD_LOCAL_IO_KEY] if Thread.current[THREAD_LOCAL_IO_KEY]

          path = sprintf(
            "#{@task['path_prefix']}#{@task['sequence_format']}#{@task['file_ext']}",
            Process.pid, Thread.current.object_id
          )
          if File.exist?(path)
            Embulk.logger.warn { "embulk-output-bigquery: unlink already existing #{path}" }
            File.unlink(path) rescue nil
          end
          Embulk.logger.info { "embulk-output-bigquery: create #{path}" }

          open(path, 'w')
        end

        def open(path, mode = 'w')
          file_io = File.open(path, mode)
          case @task['compression'].downcase
          when 'gzip'
            io = Zlib::GzipWriter.new(file_io)
          else
            io = file_io
          end
          self.class.mutex.synchronize do
            self.class.ios[path] = io
          end
          Thread.current[THREAD_LOCAL_IO_KEY] = io
        end

        def close
          io = thread_io
          io.close rescue nil
          io
        end

        def reopen
          io = thread_io
          open(io.path, 'a')
        end

        def to_payload(record)
          "#{record[@payload_column_index]}\n"
        end

        def to_csv(record)
          record.map.with_index do |value, column_index|
            @converters[column_index].call(value)
          end.to_csv
        end

        def to_jsonl(record)
          hash = {}
          column_names = @schema.names
          record.each_with_index do |value, column_index|
            column_name = column_names[column_index]
            hash[column_name] = @converters[column_index].call(value)
          end
          "#{hash.to_json}\n"
        end

        def num_format(number)
          number.to_s.gsub(/(\d)(?=(\d{3})+(?!\d))/, '\1,')
        end

        def add(page)
          io = thread_io
          # I once tried to split IO writing into another IO thread using SizedQueue
          # However, it resulted in worse performance, so I removed the codes.
          page.each do |record|
            Embulk.logger.trace { "embulk-output-bigquery: record #{record}" }
            formatted_record = @formatter_proc.call(record)
            Embulk.logger.trace { "embulk-output-bigquery: formatted_record #{formatted_record.chomp}" }
            io.write formatted_record
            @num_input_rows += 1
          end
          now = Time.now
          if @progress_log_timer < now - 10 # once in 10 seconds
            speed = ((@num_input_rows - @previous_num_input_rows) / (now - @progress_log_timer).to_f).round(1)
            @progress_log_timer = now
            @previous_num_input_rows = @num_input_rows
            Embulk.logger.info { "embulk-output-bigquery: num_input_rows #{num_format(@num_input_rows)} (#{num_format(speed)} rows/sec)" }
          end
        end

        def commit
          task_report = {
            'num_input_rows' => @num_input_rows,
          }
        end
      end
    end
  end
end