Paste below text in nuke DAG.
Using this expression added in NoOp node we can sample the pixel under pointer with x & y coordinates.
Monkeypatching can be done without any library, but it has a number of repetitive (and kind of ugly) things it needs to do, so if you start to implement it yourself, you end up creating helpers to help with this. And naturally there a couple ready-to-use libraries to do it for you.
One way of monkeypatch is using Set class defined in stubout module of pymox package.
monkeyPatch(module, 'myFunc', lambda n: someObject)
monkeypatch is only recommendable while unit testing the code if no other approach works to avoid it.
using monkeypatch in runtime to change the behaviour of class without affecting the class defination can be hazardous.
On the other hand mox.StubOutWithMock gives the ability to audit the behaviour of system under test making use of actual library returning the result by mocking whatever piece of code doesn't need to be used when under certain known condition return value of collaborative function is known.
I thought to put it up on my blog that why I choose to become a vegetarian or why I think I made the right choice. Some people just find it funny and laugh a giggle when I explain why being vegetarian is good. I know many of my fellow friends and office colleagues are non-vegetarian.
For everyone else who I have already explained and for those reading for first time, I put this in simple words. Specially for all those who think they are better as a human being by being a non-vegetarian
I just cannot cut, kill or let anyone kill it for the satisfaction of my taste. All animals too feel pain just like we humans do. Pain is a part of life, but giving some one pain is inhuman and insensible act.
So I choose to be a vegetarian. And I made the right choice.
Although, I started as a vegetarian coming from religious radha soami family, but as I grew up I wanted to try everything in excitement to try different flavour. So that lead me to try meat of chicken, pork, turkey, fish, prawn, shrimp, beef.
However, when my consciousness woke up, I realised that animals do feel pain too. Just like we humans have headache or fever we suffer from pain. We can take medicine, go to a doctor and cure ourself but look out who is going to give medicine to animals for the pain they suffer. A very few of humans have pet at home and we take the pet to animals . Animals life span is even shorter than humans and non-vegetarian even cut that by killing them just for the taste.
If I/we can get all the same energy from eating fruits and vegetable then why kill animals. Killing a living being just for the sake of taste, would be very immoral and inhuman. Now I don't say my friends who are non-vegetarian are inhuman or immoral people, I'd rather say they are naive, not sure what they are doing. All it takes is to control what we desire for...
It is pitiful that Humans don't care about the feelings of their own kind, then how does one can expect telling someone not to be carnivore or animal sacrifice is causing pain would it be understandable to them..
I am proud to be a vegetarian and these are my moral values I believe in. I come to the conclusion of becoming vegetarian by rational and ethical thinking. It makes me more of humane.
this come straight from my heart, not that i always think from heart, just being alone at home this weekend, I couldn't resist writing about how it was in the old time back when I was young.
I really miss those old times when everything was simple enough and their were no bad news on TV like it is today.. Now roads are full of vehicles, people everywhere.
noise of vehicles honking makes things even crazy, and living in Bangalore its almost feels like living in mad-town.
back in the school days, I used to come home and if I turned on TV their were only few tv channels, and very few tv commercials, and now when I get back home from office, I turn on the TV, there is a commercial after every 5-10 minutes of news or some TV program, that is not all there is a commercial running at the bottom of the screen all the time. Now there are tv channels just for selling products like they are justasking Oh did I just forgot to mention , there are big billboards on the roads side too.
and what to say about these news there is always a murder , news of killing, war over religion or piece of land.
Go for shopping and you will notice corrupt people trying to rob you by being sweet.
DAMN it this is not healthy living at all. It is so much polluted here in Bangalore that chances to fall sick is very much likely. One has to take too many precaution and eat very carefully...
all this in confronted in combination takes a barbaric and very traumatising when all you wanted is to live a little life with easy and hassle free.
In the middle of this I do find it relaxing going to park near to my house and get a fresh air to breathe, I prefer going by foot but the roads I have to cross while reaching park are full of garbage, no sanity .
Too many people on roads instead there should be too many of them in the park and more parks to build a sustainable city for a healthy living.
For a while I have been thinking to write on this topic, because a lot of bullshit I have observed people doing comes from crowd that chooses to join the subject matter without knowing the real reason behind a movement, without investing time to know that requires effort or great deal of effort, without investigating whether what we/me/you are after is justifiable, or is it the reason we should really invest/ pledge/ pray or fight for. In this topic I will choose the word 'we' instead of 'I', as I an going to try to right for people of all societies, communities no matter where they come from.
I am an inexperienced writer/ blogger, so before you go on critique I would appreciate to put your comment section below where I need to fix or make change.
Before I go over writing about what anything in excess quantity can lead to, lets look at some excess quantities most of you have actually heard about it and caution but it is this same excessiveness everywhere that participate in becoming the problem.
Now these were just the problems related to health. now lets look at something different that goes unnoticed or/ and often ignored.
6. Hyper - liberal-ism: By definition liberal means willing to respect or accept behaviour or opinions different from one's own or being open to new ideas.
This means letting/ accepting someone else belief by respect thats just fine their is nothing wrong with it, but when while trusting or believing in someone idea without knowing the fact can lead the liberal to wrong judgements.
I can give you example out of my personal experience here: When I was in Vancouver, I noticed most places you see Chinese people. Very few people from local origin, intact I got to hear from someone who was Canadian saying that "he is a minority in his own country" that just sounded a bit sad to me. By letting someone in and believing in others ideas or tradition or culture and lead the native people to be forced to live it. Nothing wrong but what sounded from that person of Canadian origin sounded something not fair or right. Maybe something wrong with him, maybe he has a personality disorder or maybe he is sick and need help. But I too noticed there were many asian people in Vancouver or neighbouring towns/cities.
But something like this is weak government policy maybe for the greed or maybe due to the inability to acknowledge the fact the local citizens are not happy with the too many of non - residents walking in. The problem is compounded when one asks whether this is all that government can or should do on behalf of individual freedom.
Money Laundering, Pesticide spray, Pollution caused by fireworks, Noise caused by traffic, religious places prayers or from fireworks the list can go beyond.
But whats in common all above I mentioned is that they hold things that if/when goes in excess, it could lead to un easiness, un healthy state or can even lead to chaos and destruction. Riots can spree over religion which is happening right now around the world, Sometimes its jews who are paying, sometimes its muslims or sometimes its christians, if i didn't mentioned any religion doesn't mean they are not affected.
What I feel their is a need to have and build communities to live under set of rules and laws that are capped that one doesn't reaches excess. However this type of thinking can / and has its own problem. If the one who is imposing the limits to any act or practice belongs to the community that waiting for the opportunity to suppress.
So a thoughtful law and order needs to be setup in which everyone gets benefitted equally. Equal share by living within the boundaries.
Here is an image of four hands holding the wrist of other person. The holding together reflects unity, mutual dependence and assurance but holding the wrist also limits the movement which means you are not allowed to hurt anyone, so if one tries to harm someone the hand will tend to
refrain and stop it. This type of model in my belief is what the societies should be based on. And such society will undoubtedly form better communities.
But on the contrary what is happening now a days in the world we live in is exactly the opposite, no doubt we have boundaries but for personal interest we are prone to risk.
Sam Harris in his article "Sleepwalking towards Armageddon" mentions the "uncomfortable truths about the failures of multiculturalism, the inherent vulnerability of open societies, and the terrifying power of bad ideas."
Yes I totally agree with him, ISIS is one of the outcome as such. The policies government had for their own interest were somewhat weak and not fully investigated the fact, which now has lead the lives of many innocent to dangers. Already so many deaths of innocents have occurred.
Everyone likes to keep the software they used whether in the phone of pc or mac updated. Maybe not everyone, Like I am just avoiding the preliminary updates to OSx 9, I would rather grab when a major version of the software of OSx is released which means at that time what I will get will be stable and will have the least to ruin my enthusiasm.
I will get back to why i said "ruin my enthusiasm", but before that I want to state I am/have written this post for people who are either visual or from non-technology related profile.
So every time a new software is released, we tend to have an enthusiasm the take advantage of the new features, performance and security threat fixes being applied.
I will take the example of Firefox since firefox is the most widely used web browsing software around the world. Firefox has also evolved over a long period of time. So the software development team at Mozilla firefox continued the tradition of making it better to best suit the user experience and current trends.
In this period of evolution, they not just added new features they also got rid of some old features, interface. Now its the nature of people to criticise the change and I often see on discussion of new software releases people saying "why they took out that I have been using it for a long time" or " I really liked the old style and look" bla bla...
But here is the deal and whole dearth of this post, You do not have to lose the old software version, Just an extra bit of effort in being aware of what you are doing can help you keep the copy of old installed version of software and parallel install the new copy, Some softwares have this features built in so users usually don't have the problem switching back to old style, or ease of use to what they were addicted to. But like in case of firefox if you click the "Check for Updates" if the update is found the button appears update to version 32RC4 in this case it will overwrite the older version. In such cases or other softwares like this, you can download a redistributable version and carefully install the new version parallel without losing the old one.
I hope you find this article useful.
Dear reader, one of my friend from office shared the below story in the whatsApp, group, i think its worth sharing with larger community so I decided to put it on my blog. You are free to express your views.
Every day, a small ant arrives at work very early and starts work immediately.
She produces a lot and she was happy.
The Chief, a lion, was surprised to see that the ant was working without supervision.
He thought if the ant can produce so much without supervision, wouldn’t she produce even more if she had a supervisor!
So he recruited a cockroach who had extensive experience as supervisor and who was famous for writing excellent reports.
The cockroach’s first decision was to set up a clocking in attendance system.
He also needed a secretary to help him write and type his reports and …
... he recruited a spider, who managed the archives and monitored all phone calls.
The lion was delighted with the cockroach's reports and asked him to produce graphs to describe production rates and to analyse trends, so that he could use them for presentations at Board‘s meetings.
So the cockroach had to buy a new computer and a laser printer and ...
... recruited a fly to manage the IT department.
The ant, who had once been so productive and relaxed, hated this new plethora of paperwork and meetings which used up most of her time…!
The lion came to the conclusion that it was high time to nominate a person in charge of the department where the ant worked.
The position was given to the cicada, whose first decision was to buy a carpet and an ergonomic chair for his office.
The new person in charge, the cicada, also needed a computer and a personal assistant ,who he brought from his previous department, to help him prepare a Work and Budget Control Strategic Optimisation Plan …
The Department where the ant works is now a sad place, where nobody laughs anymore and everybody has become upset...
It was at that time that the cicada convinced the boss , the lion, of the absolute necessity to start a climatic study of the environment .
Having reviewed the charges for running the ant’s department , the lion found out that the production was much less than before.
So he recruited the owl , a prestigious and renowned consultant to carry out an audit and suggest solutions.
The owl spent three months in the department and came up with an enormous report , in several volumes, that concluded : “ The department is overstaffed ...”
Guess who the lion fires first?
The ant , of course, because she “showed lack of motivation and had a negative attitude...
Python has a Queue class that can be very quick to implement a producer/consumer queue, and it is thread-safe.
Each worker should call get() on the queue to retrieve a task. This call will block if no tasks are available, causing the worker to go idle until one becomes available. Then the worker should execute the task and finally call task_done() on the queue.
You would put tasks in the queue by calling put() on the queue.
From the main thread, you can call join() on the queue to wait until all pending tasks have been completed.
This approach has the benefit that you are not creating and destroying threads, which is expensive. The worker threads will run continuously, but will be asleep when no tasks are in the queue, using zero CPU time.
multiprocessing simulates threads with child processes, then builds extra features (like pools, explicit shared data, etc.) on top of it, and also (in multiprocessing.dummy) provides those same extra features for threads. (Not ideal stdlib design, but historical reasons…) futures runs on top of either threading or multiprocessing (depending on which executor you use), providing the same interface either way.
So what has been my latest learning is no need to build your own thread pool implementation when you already have a perfectly good one in the standard library.
thread-based Pool interface in the multiprocessing module
It is implemented using a dummy Process class wrapping a python thread. This thread-based Process class can be found in multiprocessing.dummy which is mentioned briefly in the docs. This dummy module supposedly provides the whole multiprocessing interface based on threads.
A simple way of implementing multiprocessing in python is
map() returns the direct return value of a function called on the iterable through the processes or threads or you can think of concurrent.map as just a parallel version of the builtin map function.
One nice advantage of this existing implementation in multiprocessing, is that it should make any such threading patch much easier to write
Another example of built in thread based pool is concurrent.futures module. Concurrent.futures has a minimalistic API. It's easy to use for very straightforward problems. Below is implementation based on futures of example above.
though, according to the documentation ProcessPoolExecutor is built on top of multiprocessing. Here is another example, i got from web:
Changing this to use multiple processes instead of multiple threads is just a matter of s/ThreadPoolExecutor/ProcessPoolExecutor.
submit is used to generate a Futureobject for a single function call with its associated arguments.
To take advantage of process level parallelism you still have to have a pickle-able function, i.e. defined at the top level in a module.
ProcessPoolExecutor is doing the exact same thing as multiprocessing.Pool with a simpler (and more limited) API. If you can get away with using ProcessPoolExecutor, use that, because I think it's more likely to get enhancements in the long-term.
Note that you can use all the helpers from multiprocessing with ProcessPoolExecutor, like Lock, Queue, Manager, etc. The main reasons to use multiprocessing.Pool is if you need initializer/initargs (though there is an open bug to get those added to ProcessPoolExecutor), or maxtasksperchild. Or you're running Python 2.7 or earlier, and don't want to install (or require your users to install) the backport of concurrent.futures.
Apart from that, an obvious way to proceed using multiprocessing is to use the Pool.apply_async() method, put the async result objects on a bounded Queue.Queue, and have threads in your main program pull those off the Queue and wait for the results to show up. This is easy enough, but it's not magic. It solves your problem because bounded Queues are the canonical way to mediate between producers and consumers that run at different speeds. Nothing in concurrent.futures addresses that problem directly, and it's at the heart of your "massive amounts of memory" problem.
However, worth noting, multiprocessing.Pool.map outperforms ProcessPoolExecutor.map. Note that the performance difference is very small per work item, so you'll probably only notice a large performance difference if you're using map on a very large iterable. See this closed bug filed against ProcessPoolExecutor for more info. The reason for the performance difference is that multiprocessing. Pool will batch the iterable passed to map into chunks, and then pass the chunks to the worker processes, which reduces the overhead of IPC between the parent and children. ProcessPoolExecutor always passes one item from the iterable at a time to the children, which can lead to much slower performance with large iterables, due to the increased IPC overhead.
Concurrent.futures provides a more convenient programming model for long-running task submission and monitoring situations. A program I recently wrote using concurrent.futures involved monitoring a directory for incoming files over a 2-3 hour window, translating each file as it arrives to a task, submitting it and so on. Future objects returned by the ProcessPoolExecutor allow for tracking task status, providing intermediate status reports etc in a convenient way.
Yes these are scenes from India. People from the west often think about us a country of slums and dirty rivers. They are not wrong. A major part of the population in India still resides below the poverty line. Tourism companies often portray us a country with a pseudo intelligent prefix of “Incredible India.” Are we truly incredible is the question we need to ask ourselves.
We inherited some truly great values over the years. We worship the cows. We see many avatars of Hindu gods in a dog. But when it comes to slaying these species we don’t think twice. Cows are forcibly made to lactate with injections of cheap Oxytocin available at a meagre price of 10 paisa per shot. By the time these cows are of no use by the age of 9 years they end up at slaughter houses sacrificing almost 30 years of their lifespan. Dogs on the other hands are always on the line of fire. Stray dogs are illegally culled at various places and let’s not forget that even the pedigree breed of dogs is not treated with dignity.
WE ARE ONE FUCKING BREED OF BLOODY INDIANS. Sorry for the profanity of language. The reality is that we inherited some great values but they are seldom put into practice. Values were never incorporated in our day-to-day lives except practising it for a day or two during religious festivities. WE ARE THE BIGGEST HYPOCRITES ON THIS PLANET. There is nothing to be proud of to be an Indian.
Re-blogged from a photo post on facebook
Around 3+ years back, I remember having seen a man brutally beating a 7-8 year old kid. It all started in front of my eyes in Mumbai at Siwri railway station ticket counter where a man beats up a homeless kid, He took kid behind the ticket counter and beat him brutally while the kid was shouting crying helpless. Then few of those standing in ticket queue went to stop that man... Perhaps humans are becoming lesser human...
Few months back I saw a news in which muslims were attacked in china, just because they were muslims. 31 innocent people were killed and 90 were injured in the attack on market in volatile western China region: source: Fox News
I see a clear picture we humans are not the species best evolved, infact humans are still those unsocial animal, criminal carnivore beasts roaming freely. I have been hearing news on attack on israel by Hamas. Hatred and killing to such an extent is the failure of our societies and culture. Religion seems to have played venomous role in making the situation even more worst. Sadly, society is lacking collectively in critical thinking skills.
Hang on a second is this Man who god created in his own image? what is the excuse for the religious now? If god really existed why are their so many rapes, murder and crimes happening all around the world. Its not a religion trying to overcome other religion or trying o prove who/ what/ which is better, it is people killing people. Everyday if you watch TV news pick up a newspaper you will get to see, hear news of murder, killing rape, honour killing.
Just today I see this news on TV a private tutor beating a 3 year old kid ruthlessly, and another incident in which 3 visually challenged students gets caned by teacher. Undoubtedly humanity is seems to losing grip of civilised and sane living.
I am not sure if this is going to continue like this? why can't this be changed for goodness, if not god then why can't human proves themselves that they are really the one who deserve to be on the top order of all the species on the planet. To bar or refrain yourself to effort to make things better or just ignore or being blind with eyes wide open is the worst of mankind has ever faced. Law and government who are supposed to bring law justice and order is just sitting their to prove themselves right and they are doing their best in efforts. maybe true to some extent but for sure it is we the people of so called civilised society also has to change.
Everyone commutes to go places, come to office, make use electricity to heat water for bathing or washing, watch TV or browse the internet, then why do we go to temple or pray to god to bring happiness in their lives, when it is technology that is making lives better, why not work an effort like a worship to learn and do the things that helps each other and ourselves to progress and survive and prosperous and cherish in life. When all vehicles runs on petrol, diesel or some electric power why do we have to still believe or pray to someone invisible that doesn't exist. This is the real image of society we are living in . It is too difficult for the civilised to keep a control to their emotions and be self disciplined.