text:
//
//  AppDelegate.m
//  RemoteNotificationDemo
//
//  Created by NavchinaMacBook on 15/8/4.
//  Copyright (c) 2015年 NavchinaMacBook. All rights reserved.
//

#import "AppDelegate.h"

@interface AppDelegate ()

@property(nonatomic) BOOL registered;
@end

@implementation AppDelegate

#pragma mark - 注册远程通知
//用户点击默认按钮、app图标时调用此方法。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//注册通知事件
    // 第一个事件

    UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc]init];
    //创建一个identify用于标记action
    acceptAction.identifier = @"ACCEPT_IDENTIFIER";
    acceptAction.title = @"Accept";
    //如果activationMode设置为UIUserNotificationActivationModeForeground,则authenticationRequired将被系统强制设置为yes,将忽视后面的设置。
    //选择在什么情况加激活应用程序。
    acceptAction.activationMode = UIUserNotificationActivationModeBackground;
    //提示字体颜色:yes :红色 no :蓝色
    acceptAction.destructive = NO;
    //是否需要密码验证,yes需要,no:不需要
    acceptAction.authenticationRequired = NO;

//    第二个事件
    UIMutableUserNotificationAction *meetingAction = [[UIMutableUserNotificationAction alloc]init];
    //创建一个identify用于标记action
    meetingAction.identifier = @"MEETING_IDENTIFIER";
    meetingAction.title = @"OK";
    //如果activationMode设置为UIUserNotificationActivationModeForeground,则authenticationRequired将被系统强制设置为yes,将忽视后面的设置。
    //选择在什么情况加激活应用程序。
    meetingAction.activationMode = UIUserNotificationActivationModeBackground;
    //提示字体颜色:yes :红色 no :蓝色
    meetingAction.destructive = YES;
    //是否需要密码验证,yes需要,no:不需要
    meetingAction.authenticationRequired = NO;

//添加到不同的类别中去
    UIMutableUserNotificationCategory *inviteCategory = [[UIMutableUserNotificationCategory alloc]init];
    inviteCategory.identifier = @"INVITE_CATEGORY";
    [inviteCategory setActions:@[acceptAction,meetingAction] forContext:UIUserNotificationActionContextDefault];
    [inviteCategory setActions:@[acceptAction,meetingAction] forContext:UIUserNotificationActionContextMinimal];

//注册通知类别
    NSSet *categories = [NSSet setWithObjects:inviteCategory,/*alarmCategory*/ nil];

    CGFloat systemVersion = [[UIDevice currentDevice].systemVersion floatValue];
    if (systemVersion >= 8.0) {
        UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
    }
    //向ios操作系统注册远程通知,以获取decice Token.
    [[UIApplication sharedApplication] registerForRemoteNotifications];
    return YES;
}

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    NSLog(@"%@",deviceToken);
    const void *deviceTokenBytes = [deviceToken bytes];
    //注册成功
    self.registered = YES;
    //发送给本地服务器
//    [self sendProviderDeviceToken:deviceTokenBytes];

}
-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
    //注册device Token时失败。
    NSLog(@"%@",error);
}
#pragma mark - 用户点击按钮后执行方法
-(void)handleAcceptActionWithNotification:(NSDictionary *)userInfo
{
    //设置用户点击按钮后程序需要执行的操作。
}
#pragma mark - 收到远程通知
//收到用户点击事件 (应用程序在后台,用户点击一个按钮时触发)
-(void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler
{
    //具体实现
    if ([identifier isEqualToString:@"ACCEPT_IDENTIFIER"]) {
        [self handleAcceptActionWithNotification:userInfo];
    }
    if ([identifier isEqualToString:@"MEETING_IDENTIFIER"]) {
        //执行具体操作。
    }

    completionHandler();
}
//应用程序在前台收到远程通知时会调用此方法,如果此方法不被实现则会调用application:didReceiveRemoteNotification
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
    NSString *itemName = [userInfo objectForKey:@"ToDoItemKey"];
    //具体的实现
    application.applicationIconBadgeNumber = 3;

}
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{

}

@end

redpajama_set_name: RedPajamaGithub


text:
Page Podcast
Page: New Voices In Fiction
The Road to Podcasting is Paved with Amazon Returns | Part Two
March 19, 2018 By Austin Flynn
In high school, Josh, Fodrea, and I spent a lot of time in my parent's basement, and though we didn't intend to live out the stereotype, we found that basements make for the perfect tabletop gaming environment. Every Friday night, we'd pull up chairs around the ping pong table in my parent's basement and scatter our Dungeons and Dragons 3rd edition manuals across its surface initiate the seven-hour session of make-believe that would culminate in a sleepy stagger up the stairs in the wake of a miasma that only high school boys can produce.
The Basement Cast is more than just an homage to those days. It reminds us that some of the best parts of life stay with you if you let them. We record shows for The Basement Cast in the basement of my house, on the ping pong table I received as a wedding gift. Creatures of habit, indeed.
No sooner than not-John climbed back into his truck, I had unboxed the Yeti on the ping pong table, plugged it in, and started recording myself.
The initial setup was simple. We would get a single Yeti for a solo recording of the narrator. The voiceover had to be sharp and crisp, so we left the heavy hardware for that purpose. A pair of blue snowballs would suit the rest of the cast, omni- or bi-directional modes engaged (those who are currently cringing or grinding your teeth, just wait. There's more).
Later that day, I drove to Best Buy and purchased a pair of Blue Snowballs. Fodrea came with, and together we hooked up all three microphones via a USB hub into my computer, pulled up Garageband, and started recording the two of us.
For those of you unfamiliar with multi-mic recording with USB microphones, let me explain something important you should know. It is possible. But so is riding a bike without handlebars. Even if something is possible, that doesn't mean it is the best or even a good way to do it.
Still, despite a few bad crashes, we managed to get the bike going and as we picked up speed, we basked in the giddy anticipation of preparing for something new.
We noticed something, though. Though both microphones were billed as being exceptional quality for the price, the extra $50 of the Yeti bought you a lot in terms of sound. The difference between the two was stark, and as we ascended the basement stairs, I began to think and rethink.
Was one Yeti really enough?
Fodrea bought the next two Yetis. They arrived in two days, delivered to his department by a man who may have been John. The plans had changed, and now we envisioned a more individualistic setup. Each person gets their own mic. The more powerful Yetis would support softer voices (like my own), while Josh's boisterous rumble might be contained by the less impressive Snowball. Each voice would get its own track in Garageband, making it easy to remove cross talk and the occasional bodily chorus.
To anyone who has been down this path before, let me say this. We were foolhardy, led by the nose down a path of flimsy promises by the simple expectation that what you could do with two Snowballs and a Yeti you could do with two Snowballs and three Yetis.
To everyone else, buckle up and let me tell you a little something about serial numbers.
In order to use multiple USB microphones on an Apple computer, you have to create what is called an aggregate device, which is essentially a combination of inputs that the computer understands as one device. Garageband will accept this one device and, with enough positive thinking, will allow you to put each channel onto a different track. After a lot of tinkering, we made this work initially with the two Snowballs and the Yeti. The device recognized all three as unique devices, and we were able to assign each to a separate track. This is because each device had its own serial number and, therefore, its own identifier.
When we plugged in all five devices, we immediately noticed an issue. The aggregate device did not seem to change despite the two new microphones now plugged in. The computer only recognized two Snowballs and a Yeti. Certainly there was some sort of issue.
I unplugged the hub and plugged it back in. Three devices.
I restarted Garageband. Three devices
I restarted the computer and installed updates.
Three. Devices.
During my cycle of thinking and rethinking, it would have been great had I thought to check that multiple Blue Yetis were a workable option. Even if I had accidentally typed multiple Yetis in Google, I would have found a popular post decrying the fact that Blue Yetis all possess the same serial number and therefore will only ever be recognized as a single device despite the number being used. Had I read farther down the page, I would have run into a solution to the issue, which involved contacting Blue, packaging and shipping the microphones back to their California HQ, and waiting for up to 2 weeks for them to reassign serial numbers to the microphones before sending them back in usable condition.
But I didn't. Instead, I thought about what song we would use for our intro.
We were at an impasse. Five working microphones sat on the table before us, more or less unusable in their current condition. We could send back two Yetis and replace them with two Snowballs, sure. That way everyone would have their own microphone and we could move ahead with the podcast. By this point, we had Coyote's Ballad mapped out with voices assigned. All we needed were microphones.
But we weren't settled on the quality of the Snowballs. More Yetis would yield a better sound, and we wanted a polished product out of the gate. We discussed the matter at length and finally decided to send back two of the Yetis to have their serial numbers changed.
So there we were, a few budding podcasters with parts assigned, stories highlighted and ready for production, and two Blue Snowballs. To say this was a far throw from what I'd imagined is an understatement, but we didn't really have much of a deadline. Nothing had been promised to anyone at that time, so we settled in an prepared for two and a half weeks of patient waiting.
At least, that was the idea.
The Road to Podcasting is Paved with Amazon Returns | Part One
In December of 2017, I became close with a man named John. John was a delivery man who drove for UPS. Several days during that month, I'd watch from our picture window as John pulled up alongside the curb in front of our house, scrutinized our narrow driveway that could never accommodate a cargo truck, cursed, and turned on his hazards.
As John approached the house, I readied the packages next to me: Frankensteinian Amazon boxes that I had torn open with relish days ago and resealed with less vigor a few minutes before John knocked on the door. I opened it. John breathed a heavy sigh.
"Return pickup, right?"
I smiled and handed him the stack of packages.
This happened at least four times over the course of the month, and each time I saw a little bit of John's hope in the world die as I opened the door and handed him my returns. I knew what he must think. At best, here's a guy who has figured out how to play the system and is getting rich off of Amazon's merciful policies. At worst, this guy just likes watching me suffer.
For the sake of John and you few who are still reading, I'd like to offer an explanation.
When I'm home alone and Amy is at work, I walk around and think. This, I have found, is a dangerous process. You see, I don't think as much as I rethink. I decide and reconsider. Do and regret. Impulse and consternation are my major humors, and so when I finished grading semester one essays and clicked Submit on the grades, I began thinking and rethinking about how I would spend the next two weeks.
In other words, what would I obsess about?
There was the novel, of course, sitting there "finished" but unedited. But instead of beat my head against the keyboard, I thought about another pursuit.
A week prior, I had coffee with my friends Josh and Fodrea. We've been friends since high school, and a common theme in our interactions together has been coming up with big ideas that we'd certainly do some day (I'd tell you about a few, but then you'd take them. They're very good ideas). That day, we talked about creating a podcast that takes short stories and produces them as audio dramas. I'd been dreading the idea of putting my work out into the world, and so this would be a way to help other people who might be feeling that same sense of foreboding. Plus, it was an excuse to hang out and goof around.
When we parted, I fully expected this idea to go the way of the oak table (a story for another day) and remain a dream.
Fodrea called me two days later and asked a very important question: "Why don't we just do it?"
"The podcast. All we need are mics. I can build us a website. Libsyn is affordable if we all pitch in. Let's just do it."
Just do it. It was as though Nike herself, in all her divine glory, had opened my eyes. The path was set. Clearly arranged.
All we needed were mics.
So I paced and thought and rethought until I sat down at the computer and started researching microphones for podcasting. I pulled up article after article and started looking for the names that came up most often.
Blue Yeti
Audio Technica 2020
Heil PR 40
I compared prices and started considering our needs.
Page could require quite a few mics, depending on the demands of the story. This meant I needed either multiple mics or a few with the capability to pick up multiple voices. The Blue mics seemed the logical choice. Along with being well-reviewed and affordable, the Yeti and Snowball offered omni-directional mode, which meant multiple people could be picked up around the microphone.
It was settled. I bought a Yeti. Two day delivery.
I acted, then I rethought. The Yeti is a USB microphone, which comes with certain benefits. It is easy to use, just plug in and go, and relatively transportable. I didn't want to worry about learning how to hook up a mixer or an audio interface, and so it seemed perfect at the time.
Still, I looked to the dissenters, those who preached the good word of xlr mics as more powerful and easily upgradeable. A part of me began second guessing. If we really were doing this thing, didn't it make sense to think about the long run? If a USB would only get us so far, were we setting ourselves up to hit a wall in progress.
These thoughts battered my conscience until, two days later, a man (not John) arrived at my door with a box.
It Takes a Village: Writing, Collaboration, and Support in the Craft
March 5, 2018 By Amy Flynn
by Amy Flynn
I am not a writer. I've never had that "writing itch." There are stories in my head, but I would much rather tell someone about them than spend hours typing at a laptop. And, truth be told, I never really saw any value in my stories until my husband, Austin, introduced me to tabletop RPGs, namely Dungeons and Dragons, but I digress.
This year, I had the unique and jarring experience of realizing I knew much less about something than I thought: the writing process.
Austin decided that he was going to write a novel last year. "That's great," I thought, "He will stay busy during the summer, and I will support him on this quest!" And boy howdy, did I underestimate that timeline. He started writing at the beginning of summer vacation. He had a few chapters done, and then we went on a month trip to Ireland (well, he stayed for a month. I have a job that does not include a three month vacation, and thus could not spare a month of PTO). He wrote during the two weeks I was there with him – almost any moment we weren't sightseeing or doing other tourist things, he wrote. After I went back home, he spent a week in the isolated village of Grange in County Sligo, writing. Then he went on a week-long writer's tour. He came home with it "half-done."
He spent the next few months working on it, and then delivered a Staples-bound copy into my hands in December. A whole half a year of work boiled down into 103k words. And we are still early into the process. It's been read by three alpha readers (myself included), and a huge chunk of it changed before the last alpha reader's edits even came in.
As Indianapolis residents, we go to GenCon every year, and this year, most of our GenCon time was spent at the writer's symposiums offered by the con. It felt like there was an endless amount of information to process regarding the writing and publishing process. So much so that I ended up feeling fairly overwhelmed, and I took a two-hour break from the workshops to listen to the finale of my personal favorite podcast, which resulted in me sitting with well-known author, Patrick Rothfuss (that is a story for another time, and it is much less interesting than it sounds).
Our good friends, Jacob Gillam and Stevi Roberts, joined us for GenCon this year. I knew that Jacob was a writer, because Austin always told me about how much he loved Jacob's story about a wily necromancer. At that point, Page was not even a twinkle in Austin's eye, and I would never have anticipated that we would give that story a voice less than a year later.
Jacob is a man of unbridled passion. You hear it in the way he talks, see it in the way he moves (and he never stops moving). He pours that passion into his stories, and it is palpable. That being said, I would not have the same kind of appreciation for this story he has shared with us if not for the crash course in the writing experience I've gotten in the last year.
It all culminated during the author interview that he completed with Austin and Josh, voice actor for Page and one of Austin's oldest friends. While we were not featured in the interview, myself and Stevi (who also goes by Evi), were in the basement listening to the banter. The whole time, Evi, provided me with a running commentary alongside the interview, that I wish we would have recorded. While Jacob talked about his inspiration for "Coyote's Ballad", Evi whispered to me that it had been a prompt from her that seeded the idea in his head. As they were talking about some of the challenges authors face while writing, I whispered back to her about the hours we spent talking about Austin's novel, arguing about what motivations made sense or how two characters would interact in a way that was true to both their natures.
At that moment, sitting on the futon in our cold basement, giggling with my friend, it finally clicked for me that writing is not, and cannot be, a solitary process There are so many more people involved in the process that I could have never anticipated. I think we all have this image of authors sitting in front of a typewriter with words flowing onto the page like sand through an hourglass. We romanticize the process, and attribute the success to the amount of passion and blood and sweat and tears that the author put into their story. And at that moment, Page became more than just a fun divergence for me. Sure, recording and voice acting is fun. The story is, on its own, enthralling. But more than that, Page has the potential to become a major factor in having an author's story be heard. When it comes down to it, having a story published means the inclusion of more people into the writing process. This, hopefully, results in the story reaching more people and the development of a wider audience. And while we at Page will probably never be comfortable navigating the publishing world, there is one thing we excel at: telling a good story. Page is our way of giving these stories a voice, and becoming part of the story's, well, story.
A week after we wrapped on "Coyote's Ballad" and recorded our interview with Jacob, we started on our next story, written by our good friend Bryan Partner. I don't want to give too much away too soon, because at this point it is a month before you will hear "The Secret Keeper", and while I am not a writer, I do understand the importance of suspense, but I do want to share what I took away from our recording. We chose to have Bryan record the narration of his story. I had not read a word of it before the recording session, and the experience of hearing Bryan, the author, give voice to his own work, was profound. It really drove home the fact that Page, at its core, was created to shine a spotlight on these emerging authors, and give them the opportunity to share their stories with anyone with a smart phone and a free afternoon, long commute, or even just a few free moments.
Submission is Success or: How I Learned to Stop Worrying and Just Create
March 4, 2018 By Austin Flynn
by Austin Flynn
Here's something I very recently learned: it is easy to submit a podcast.
Submit. Before you punch through your screen in agonized dissent, notice I said submit. Creating this podcast challenged me in ways I had never considered, even as a frequent listener and occasional contributor to other podcasts. I've learned so much during this time, and I have nothing but respect for those who pour so much time, energy, and creativity into making professional content they are willing to share with the world for free.
But iTunes just…takes it.
I submitted our RSS feed to iTunes at 5:45pm on a Sunday night and my Google-sleuthing revealed that, for the most part, it could take a while for iTunes to get around to reviewing and accepting the feed.
24 hours. 48 hours. "Give it a good week," one person said.
Fair enough. I gave Apple some breathing room, and only started obsessively checking my email after a whole hour of patient waiting.
At 6:37pm on that same Sunday, they accepted the podcast, and I could view the iTunes page. There it was. Page: New Voices In Fiction. Look! That's our logo. I made that.
By the time I clicked submit that evening, I had already obsessed over the details of the RSS feed. Title, art, ID3 info for the "Prologue" episode — I double-, triple- checked everything. As I scrutinized, I imagined a team of Apple's finest gathered around a table — I think Steve Wozniak was there — pulling up the feed, scrutinizing the details, listening again and to the introduction. Judging. Taking notes. Hours of notes. 24. 48. A week, even.
Maybe this actually happens, and over time the team has become incredibly efficient. Maybe Woz is the real stickler, but by some miracle he had to pee and left the room just as Page rolled down the pipes.
What is more likely, though, is that it's actually really easy to submit a podcast.
That leaves a different sort of anxiety nesting in the pit of your stomach. You have a podcast, yes, but do you have listeners? If there is no guarantee that your work has been Woz-approved, if you have no established platform or fanbase, how do you ensure your voice is heard?
The idea for Page came out of a conversation with my friend Josh about this exact idea. People I know write books. I know this because I read them. People I know make movies, which I watch and enjoy. I've participated multiple times in a friend's RPG Actual Play podcast, so I know that people make podcasts. These talented friends have been clever and resourceful enough to build audiences and communities around their work. They reach people with their art.
This past summer, I wrote a novel. There, I said it, though it still sounds weird. I created something that I hope to share with a lot of people. Fortunately, there is no dearth of voices on the internet who will tell you about their experiences, trials, and best practices when it comes to traditional publishing.
Unfortunately, there are also plenty of people who will readily tell you just how fraught the publication process can be. They'll tell you the chilling percentage of new authors that actually get a traditional publishing deal and follow that up with an even frostier percentage of authors whose work actually sells. This was the first major punch to the gut when I finished the novel and started to consider the editing and publication route. Creation is just the beginning, so it is hard to imagine that it could also be the end.
Like submitting a podcast, sending a query letter is really easy, and so a similar question arises. If submission is not success, if just doing something does not guarantee that anyone will see or enjoy it, then what remains to drive a person to create?
I told this to Josh in one great rush. He blinked, thought for a moment, and said, "Alright, let's just make your novel an audiobook."
What a strange idea: let's just do it ourselves. Self-publish, but in an audio format. Build a community by creating quality content on a consistent basis.
So we are doing just that. Not with my novel (though it might happen), but the work of talented people who have created amazing works that haven't yet taken off.
Producing Page has taught me something incredibly valuable that I needed to realize. Submission is success. If you've created something that is uniquely you, then that is really cool. That's an accomplishment. Creation is a rare thing in a consumer culture, so never discount the work you've put in. Keep creating, keep sharing, and keep talking about what you love. Eventually, people will listen.
The guiding mission of Page is to celebrate creators and their work. To build a community around them that encourages creativity and support.
The creation is the thing. Everything else comes second.
Thank you for reading! Here's a picture of Teddy.
In high school, Josh, Fodrea, and I spent a lot of time in my parent's basement, and though we didn't intend to live out the stereotype, we found that basements make for the perfect tabletop gaming environment. Every Friday night, we'd pull up chairs around the ping pong table in my parent's basement and scatter…
In December of 2017, I became close with a man named John. John was a delivery man who drove for UPS. Several days during that month, I'd watch from our picture window as John pulled up alongside the curb in front of our house, scrutinized our narrow driveway that could never accommodate a cargo truck,…
by Amy Flynn I am not a writer. I've never had that "writing itch." There are stories in my head, but I would much rather tell someone about them than spend hours typing at a laptop. And, truth be told, I never really saw any value in my stories until my husband, Austin, introduced me…
by Austin Flynn Here's something I very recently learned: it is easy to submit a podcast. Submit. Before you punch through your screen in agonized dissent, notice I said submit. Creating this podcast challenged me in ways I had never considered, even as a frequent listener and occasional contributor to other podcasts. I've learned so…
Flynn's Basement LLC

redpajama_set_name: RedPajamaCommonCrawl


The most reliable & most portable welding machine offering best welding performance in its class.
250A Welding Current at 30% (40°C) - You will be able to perform un-interrupted welding also in intense welding applications with 5.0 mm diameter electrodes and 250A welding current offered at 30% duty cycle.
Overload and Thermal Protection Indicator Lamp - Thermal protection lamp will warn you in case of the machine enters protection mode due to overload.
Compability with Generator - Welding capability in environments without electricity due to its compatibility with generators.
Digital Ampermeter - It is possible to start welding operation with a more accurate setting after reading the adjusted current value from the indicator.
Hot Start Setting - You will never encounter arc ignition problems especially when welding on dirty or rusty parts and when using electrodes with moistured coating.
Arc Force Setting - Electrode will not stick to the workpiece any more or you will benefit from uninterrupted arc. Due to this feature, welding current will increase for a very short time and after the arc becomes stable it will automatically return to the adjusted value.
Lightweight, Small and Compact Design - Due to its new generation electronic circuit design, it is much more smaller than the welding machines designed with old technology and you will be able to carry your 250A welding machine without any need for a cart or wheeled carrier system especially in rough, narrow and crowded environments.


text:
Home / Video / Going Back to Pakistan: 70 Years After Partition | Witness
Title : Going Back to Pakistan: 70 Years After Partition | Witness
"Before I die, I want to go back to where I was born." Krishan Kumar Khanna grew up just outside Lahore, Pakistan's second-largest city. After a childhood he remembers fondly, his life changed dramatically in August 1947.
As Britain left the Indian subcontinent, colonial planners hastily split it into Hindu-majority India and Muslim-majority Pakistan.
Khanna was forced to join one of the largest migrations in human history, as sectarian violence erupted and millions fled in both directions to save their lives.
He has dreamed of going back ever since and, after trying for several years, Khanna finally obtained a visa to return to Pakistan.
Despite deep tensions, he's determined to show that people in the neighbouring nations still have much more in common than that which divides them.
More from Witness on: YouTube - http://aje.io/witnessYT
Facebook - https://facebook.com/AJWitness
Twitter - https://twitter.com/AJWitness
Instagram - https://instagram.com/ajwitness/
Website - http://aljazeera.com/witness
The abandoned mansions of Pakistan (Full Docume...
Salman Khan Latest Hindi Full Movie | Kareena K...
The Samjhauta Express - Pakistan And India Laho...
🇵🇰 Pakistan: No Place Like Home l Witness
Dalit Muslims of India | Al Jazeera World
What Happened in 1971? Complete Documentary Fil...
How this border transformed a subcontinent | ...
Kashmir The Story | Full Documentary On The His...
Video Going Back to Pakistan: 70 Years After Partition | Witness - MP4 HD


Power through your day in chic style when you don the Ryka Elita slip-on sneaker!
Elasticized bands across the top of the foot promote a snug fit and feel.
Anatomical Precise-Return footbed supplies daylong comfort.
Soft EVA midsole provides lasting underfoot cushioning.


text:
DAF (Van Doorne's Automobiel Fabriek) Trucks est un constructeur automobile néerlandais, dont le siège social se situe à Eindhoven. DAF Trucks appartient au groupe américain PACCAR.

Bien connu pour sa fabrication de poids lourds et d'autocars, DAF (Van Doorne's Automobiel Fabriek) a également produit des petites voitures entre 1959 et 1980. DAF Trucks commercialise aussi des pièces détachées destinées aux poids lourds et aux remorques par le biais de sa division PACCAR Parts.

Le réseau DAF Trucks est composé de plus de  de service en Europe dont plus d'une centaine en France. La filiale française (DAF Trucks France) est basée à proximité de l'aéroport Roissy-Charles de Gaulle.

Historique

L'entreprise DAF est fondée le  aux Pays-Bas, par les frères Hubertus et Wim Van Doorne, sous le nom Van Doorne's Aanhangenwagenfabriek NV. La société fabrique des remorques ainsi que des châssis et transmissions intégrales dont l'armée se sert pour ses camions militaires .

En 1938, DAF se lance dans la production de quelques véhicules utilitaires, mais ce n'est qu'après la Seconde Guerre mondiale que l'entreprise développe sa nouvelle activité. En 1948, la société change de nom pour Van Doorne's Automobiel Fabriek. Les volumes de production sont caractérisés de la manière suivante : en produisant des camions à trois, cinq et six tonnes, on ne fait que douze véhicules par semaine.

Dans les années 1950, DAF fabrique ses propres moteurs et s'associe à l'entreprise de mécanique Leyland. Sa première usine de moteur ouvre en 1957. Un an plus tard, les frères Van Doorne produisent leur première voiture particulière, la Daf 600, vendue à . C'est à la même époque que fut racheté la Société nouvelle Minerva de Mathieu Van Roggen. DAF continue l'élaboration de tracteurs de dix tonnes à plusieurs essieux, ce qui est rare pour cette époque. En 1965, Hubertus Van Doorne part à la retraite et cède sa place de président du conseil d'administration. Son frère Wim fait de même en 1971.

En 1976, Volvo rachète la branche de la production des voitures particulières DAF. L'entreprise abandonne ainsi cette division et se consacre exclusivement à la production de poids lourds. À la fin des années 1970, les deux frères Van Doorne meurent à un an d'intervalle. Par la suite, l'entreprise arrête la production de remorques. Au milieu des années 1980, DAF rachète la quasi-totalité du capital de l'entreprise britannique Leyland. En 1990, DAF change de logo pour adopter le logo que l'on connaît actuellement, l'actuel logo DAF possède des caractères originaux. En 1996, la société est rachetée par le troisième plus grand constructeur de camions, le groupe américain Paccar Inc., qui possède notamment la marque Kenworth.

En 1998, le DAF 95 XF est élu « camion de l'année 1998 ». De même, l'entreprise voit son nouveau modèle LF récompensé du même titre pour l'année 2002. En 2010, DAF devient le premier constructeur européen de poids lourds. Les moteurs conçus respectent les normes européennes d'émission (5 et EEV).

En juillet 2016, DAF est contraint de payer une amende  d'euros infligée par les autorités de la concurrence européenne pour avoir participé à l'entente dans le secteur de la production de poids lourd.

Au cours de l'année 2017, les véhicules DAF LF, CF et XF évoluent avec un design mis à jour et une chaîne cinématique optimisée, ce qui réduit notamment encore un peu plus la consommation de carburant des véhicules. Ainsi, en novembre 2017, lors du salon international Solutrans à Lyon, les nouveaux DAF CF et XF reçoivent le prix du camion international de l'année 2018 (International Truck Of the Year 2018).

Véhicules

Principaux modèles de voitures

 Daf 600, 750
 Daffodil, déclinée en Daf 30, Daf 31, Daf 32 ;
 Daf 33 ;
 Daf 44 ;
 Daf 46 ;
 Daf 55 ;
 Daf 66;
Daf 77 (à l'état de prototype lors du rachat par Volvo, qui la commercialisera sous l'appellation 340 et dérivées).

Principaux modèles de poids lourds

 DAF Serie 1000, 2000, 3000 ;
 DAF 55CF, 75CF,85CF ;
 DAF 95 ATi ;
 DAF 95XF ;
 DAF XF 105 ;
DAF XF 106.

Poids lourds actuels

 DAF XF
 DAF CF
 DAF LF
Depuis le , les modèles sont identifiés par leur puissance. Par exemple XF 530, CF 440, etc.
 DAF XF Euro 6
 DAF CF Euro 6
 DAF LF Euro 6

À partir de , les modèles XF et CF évoluent par leur chaîne cinématique et un facelift, nouvelle puissance 400 et 450 pour les MX11, 430, 480, 530 pour les MX13, la boite  de vitesses Traxon ZF remplace l'ancienne AStronic ZF, les différentiels subissent également un traitement afin de réduire la friction.

Résultat, une baisse de consommation considérable par rapport à la concurrence faisant de DAF l'un des leaders du véhicule industriel à faible consommation et l'un des moins polluants en développant des motorisations diesel

Activité pièces détachées
Au-delà de la fabrication et la commercialisation de véhicules industriels, DAF Trucks commercialise aussi des pièces détachées destinées aux poids lourds et aux remorques par le biais de sa division PACCAR Parts. Cette dernière propose des pièces d'origine DAF et PACCAR (DAF Genuine Parts et PACCAR Genuine Parts) ainsi que des pièces adaptées à tous types de camions et de remorques via la marque TRP (Truck and Trailer Parts). Depuis 1973, PACCAR Parts est une filiale du groupe mondial PACCAR mais cette dernière n'est arrivée sur le marché européen qu'en 1996.

En Europe, PACCAR Parts dispose de cinq centres de distribution des pièces de rechange (PACCAR Distribution Centers) :
 Eindhoven (Pays-Bas)
 Leyland (Royaume-Uni)
 Budapest (Hongrie)
 Madrid (Espagne)
 Moscou (Russie)
Depuis plusieurs années, PACCAR Parts Europe propose aux clients le programme de fidélité MAX. Le client dispose alors gratuitement d'une MAX Card qui lui permet de bénéficier d'offres spéciales.

Notes et références

Autres références

Voir aussi

Liens externes

Constructeur de camions
Constructeur automobile ayant son siège aux Pays-Bas
DAF
Entreprise fondée en 1928
Entreprise ayant son siège à Eindhoven

redpajama_set_name: RedPajamaWikipedia


text:
Oilpressure
Speed is Life
« Another New Day Ahead For AJ Foyt?
Could We See Stewart In The Indianapolis 500? »
The Best Choice To Drive The Pace Car
Usually, I can come up with my own topics for my posts here – which might explain why some of my efforts here are a little on the lame side. But it's sometimes tough to come up with new and different things to write about – especially in the offseason. That's why I was very happy to get an e-mail last week from a regular reader named "Tom", who had a very good suggestion for a post topic.
I'll gladly give credit to Tom for the idea. It's a subject I had heard about, but it never really dawned on me to write about it. Had it not been for Tom, I probably would have gone on some pointless rant about racing clichés, or why Valvoline left their classic IndyCar livery after the 1993 season – for paint schemes that looked like they were drawn out on a cocktail napkin. Come to think of it; that's not a bad offseason topic at all. Don't be surprised if I visit that one in the next month or so.
So let's get right to it. Tom's suggestion was that I write about a possibility to drive the pace car for the upcoming 101st Indianapolis 500 – Alex Zanardi.
Curt Cavin used to campaign for this back in his days with The Indianapolis Star. I'm not sure his new position with IndyCar allows Curt to publicly campaign for such things, but you know he can try to pull strings internally.
It's a good thing to campaign for. If my readership of a couple of dozen can make a difference, I'm all for it.
The use of celebrities driving the pace car for the Indianapolis 500 is a relatively new thing. Sure Jim Garner drove it three times in the seventies and eighties, but he was an avid race fan and had portrayed drivers in movies. Normally, any celebrity had some sort of ties to racing or The Speedway. Usually it was a former driver, an automotive industry exec or just a car guy like Jay Leno that was chosen for the honor.
That all changed in 2000, when actor Anthony Edwards was chosen. Aside from playing "Goose" in Top Gun, where he did go very fast, I'm not aware Mr. Edwards had any ties to racing whatsoever. That opened the floodgates. The next year, Elaine Irwin Mellencamp took the wheel to become the first female to pace the field. I couldn't help but wonder at the time why her much more famous then-husband wasn't driving it instead.
The following year in 2002, Jim Caviezel drove the pace car. At the time, I said "Who?" Then a couple of years later, he played Jesus in The Passion of the Christ. That and driving the pace car were apparently his two crowning achievements in life. Almost fifteen years after driving the pace car, I'm sure most people again are saying "Who?"
As the years went on, the celebrity drivers were a mixture of hits and misses. The hits were Morgan Freeman, Colin Powell, Patrick Dempsey, Jim Harbaugh and – at the time – Lance Armstrong, before we all knew what a scumbag he was. Of course, there have been many drivers interspersed in the rotation since Anthony Edwards first drove in 2000. Emerson Fittipaldi, AJ Foyt, Dario Franchitti, Jeff Gordon and Roger Penske all paced the field in this millennium.
Celebrity misses were Josh Duhamel, Guy Fieri and Robin Roberts. I know that many will scream that Robin Roberts was a great choice. I thought all of the GMA promotion was supposed to bring a ton of new eyeballs to the screen and give ratings a huge bump. Instead, she didn't move the needle at all.
I'm more of a fan of using people who are celebrities to racing fans. Franchitti, Gordon and The Captain have been the last three choices to drive the pace car and have all resonated with race fans. I'd much rather see someone that race fans appreciate, more than some icon from pop culture. I mean, who would you rather see pacing the field? Rick Mears or Justin Bieber?
But if you want someone who would appeal to the hard core race fan as well as the casual once-a-year fan, I don't think you could beat the choice of Alex Zanardi.
If there is anyone reading this (aside from my mother) who doesn't know who Alex Zanardi is – Zanardi was a two-time CART champion, who left CART after the 1998 season for the greener grass of Formula One. Zanardi had already had an unsuccessful stint in F1. He had sporadic appearances before driving for Lotus in 1993 & 1994. When Lotus folded in 1995, Zanardi went sports car racing in 1995 before landing what turned out to be the ride of a lifetime.
Before 1996, Target Chip Ganassi Racing had experienced only two wins, both in 1994 with Michael Andretti. The team was coming off of a strange season in 1995, that saw them expand unexpectedly when Jimmy Vasser's Hayhoe Racing team folded just before the season. Ganassi took Vasser's STP sponsorship and paired him alongside newly signed Bryan Herta, who had a disastrous season that produced only two Top-Tens in a seventeen race season. Herta was gone after one season, replaced by Alex Zanardi.
Ganassi was the first to run a Reynard chassis. But for 1996, he paired it with the superb Honda engine and the equally superb Firestone tires. We quickly learned that the Reynard-Honda-Firestone combination was the package of choice for years to come.
Alex Zanardi didn't win the championship that season. He finished third in a tie-breaker with Michael Andretti for second, while both finished behind Zanardi's Ganassi teammate, Jimmy Vasser. It took Zanardi half of the season to get used to that type of car and the tracks. Zanardi won no races and his average finish in the first half was 15.9. But in the second half of the season, Zanardi scored three wins and three more podiums, bringing his average finish for the second half down to an impressive 7.1. Had it not been for finishing twenty-sixth at Vancouver, perhaps the savvy Italian could've won the championship as a rookie.
The second half of the 1996 campaign showed what was to come. Zanardi dominated the next two seasons, winning the championships both times. He scored five wins in 1997 and six in 1998. In fact, the 1998 season shows that he had fifteen total podiums in the nineteen race season that year. It's no wonder he was able to parlay that into a ride at Williams in F1. Unfortunately, his foray back into F1 was a disaster and he was on the sidelines for 2000.
Zanardi signed with Mo Nunn for the 2001 season, paired with the up and coming Tony Kanaan. It did not go well. Nunn was running the underpowered Mercedes engine and didn't come close to having the resources that Chip Ganassi had. Through fourteen races, Zanardi had no podiums and had more than twice as many finishes worse than twentieth (7) as he did in the Top-Ten (3).
The Lausitzring is located in Klettwitz, Germany and was to hold the first of two back-to-back CART races across the pond. After the cars and equipment had already been shipped, the 9-11 took place on the Tuesday before the race. While the NFL, College Football, Major League Baseball and NASCAR all put their respective sports on hiatus for a week – CART chose to run their race overseas. In all fairness, CART was put in a no-win situation. It would be a PR nightmare to run, but a scheduling and financial nightmare if they didn't. They chose to run and took the heavy criticism for doing so.
I did not watch the race. I remember I had friends in from out of town and we went to an early dinner. There was no football and they were about to leave, so we went to go grab a bite. There was a TV tuned to CNN, who was still covering 9-11. I happened to see the scroll saying something to the effect that driver Alex Zanardi was critically injured in a crash and had sustained life-threatening injuries. With no iPhone or portable internet in those days, that's all I knew until I got back home.
When I did return home, I saw the video of the crash for the first time. We've all seen it and I won't post it here. For those that don't know or remember, Zanardi spun while leaving the pits and spun out into the front-straightaway. He was sitting broadside to the oncoming traffic, when he was struck by Alex Tagliani. Zanardi's car was ripped into two pieces, the lower part of Zanardi's legs stayed in the front portion of the car, while the rest of his body stayed in the cockpit. He is said to have lost three-fourths of his blood volume and was in grave condition when Dr. Terry Trammel arrived on the scene quickly. Trammel's efforts and quick thinking are credited with saving Zanardi's life.
Although Zanardi's open-wheel career was over, a new chapter in his life had just begun. Ultimately, Alex Zanardi was fitted with prosthetic legs. Not happy with the prosthetics available at the time, Zanardi designed and built his own prosthetic legs.
Alex Zanardi did return to the cockpit of a race car. In 2003, Zanardi drove a specially fitted Reynard for thirteen laps around the Lausitzring, symbolizing the final thirteen laps remaining after his crash. He drove fast enough in his return to qualify fifth on the 2001 grid of his ill-fated race. It wasn't enough.
Zanardi has raced and won in touring cars since his accident. Always looking for a new challenge, Alex Zanardi took up handcycling. In typical Zanardi fashion, he didn't just take up handcycling – he attacked it. In 2007, he placed fourth in the New York City Marathon handcycling division. In 2009, he won the Venice Marathon and in 2010, the Rome Marathon. He topped it all with a Gold Medal in the 2012 Paralympic Games in London. He recently won a Gold Medal in the H5 category of the 2016 Paralympic Games in Rio.
While we marvel at his prowess, Zanardi celebrates but is always looking for the next challenge.
Life can deal the cruelest of blows. What happened to Alex Zanardi in September of 2001 would make the heartiest of souls buckle. I cannot even imagine losing both legs at the age of thirty-four, along with the added shock of almost losing my life in the process.
But fate underestimated Alex Zanardi. He did not die that day in the middle of a race track in Germany. He did lose his legs, but not his spirit. Before his accident, Alex Zanardi always had a smile on his face which symbolized his effervescent personality. He simply loved life. Few drivers loved winning like Alex Zanardi. He originated the celebratory "donuts" as we saw his car spinning on it's axis as he celebrated every single win with the excitement level of his first.
After his accident and his ensuing recovery – nothing has changed. He tackled the Lausitzring two years later, won in Touring Cars and in handcycling. He celebrates every one of those wins as if he had just won the Indianapolis 500, which he never drove in due to the politics of The Split.
Doug Boles can score major points with fans and even non-fans by asking Alex Zanardi to pace the field of a race he never drove in. The words "hero" and "inspiration" are thrown about too casually in these times. We may admire football players and race drivers, but are they really heroes? In my book, both of these words (and many others) apply to Alex Zanardi.
I'm not one to seek inspiration from a poster, a book or a seminar. At my age, I've seen a lot and there's not a lot out there that can still move or inspire me. But Alex Zanardi is a true inspiration for anyone that feels as if life has dealt them a bad hand. All they need to do is look to see how he led his life before and after his accident.
The Indianapolis 500 is known for a lot of great things. Among them is the platform it can give to anyone involved in it. Not only could the Indianapolis 500 benefit from having Alex Zanardi drive the pace car next May, but many more people can learn Zanardi's story and benefit.
It's hard to believe that it's been over fifteen years since Zanardi's accident. What's even harder to believe is what he has accomplished in those fifteen years. The best thing, however, is that the story is still unfolding before our very eyes. Alex Zanardi is now fifty. I can't wait to see what next great thing he has in store for us. It has been a pleasure to watch his story take shape and I hope that his story can include driving the pace car in the 2017 Indianapolis 500.
George Phillips
This entry was posted on November 18, 2016 at 4:03 am and is filed under IndyCar.	You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
13 Responses to "The Best Choice To Drive The Pace Car"
its a real no brainer , that's why it wont happen
Phil Kaiser Says:
George, li'l Johnny Cougar couldn't see over the steering wheel!
By the way, Jim Caviezel just finished a six year stint on one of the most popular one-hour crime drama shows on network TV: "Person of Interest." You know, the show where Taraji P. Henson got her start before "Empire."
Oh, and the tip I sent you Wednesday was for real, I wasn't kidding. Thanks for taking time out of your busy day to respond!
billytheskink Says:
I thought Henson got her start in the Rocky and Bullwinkle movie…
Ron Ford Says:
I will postulate that the name of George Phillips will have more long-lasting name recognition in racing circles than many of the folks mentioned above who could collectively be called The Who?.
And yes, Alex Zanardi would be a no-brainer choice IMO.
Zanardi, of course, is an excellent choice to drive the pace car at Indy. I also wouldn't mind seeing him run some exhibition laps during the month of May in that specially-fitted Reynard from the 2003 Lausitz race, if it still exists as such. Alex may never have raced in the 500, but he is very much a part of our sport.
JohnMc Says:
Zanardi is perfect and, in my opinion, could be the driver for several years in a row! Perfect call.
I agree Zanardi would be an excellent choice and would have not qualms if he gets the nod. However, another fitting choice would be Sam Schmidt. Talk about a way to bring attention to innovation (some of us remember when that was important at IMS) Sam works in so many ways, demonstrates incredibly advance technology, a Chevy Corvette is a staple of pace cars, would generate probably more attention from non-racing avenues, and he's currently involved in IndyCar in a big way. Now that would be a headline…"Schmidt's Triumphs Against All Odds, Drives Pace Car, Team Wins 500!!"
Agreed about Sam.
Mark Wick Says:
Alex Zanardi would be a wonderful choice, and if he could be/would be available through the weeks leading up to the race to participate in special events, several weeks of very meaningful events could be produced.
Bob F. Says:
I have long disagreed with the celebrities being part of this. I think there should be some tie to the Indy 500. For that reason, while Zanardi would be better than a celebrity, I would not agree that he is a slam dunk. That said, he would be better than some that have done it in the recent past.
Ed Emmitt Says:
Hey,let's not forget the Indiana kid Tony Stewart.
Came here expecting to see an article about renewing Donald Trump's invitation, and left disappointed that his debacle wasn't even mentioned . . .
As far as Alex Zanardi, his rightful place is behind the pace car!


The Paper, one of the oldest independent publications supporting Commodore computers, is merging with the Midnite Software Gazette, beginning with the October 1982 issue.
To celebrate the merger, a contest is underway to rename the merged magazines. The person suggesting the best name will receive a free VIC computer, courtesy of Computer Country of Springfield, Illinois. Judging will be by the editors, and in case of ties, by the readers of the combined magazine. Entries must be received by November 1 at the address below.
Midnite specializes in brief independent reviews of products for Commodore computers. Its current issue is a 300 + page $10 book.
The Paper has traditionally been a source of articles and tutorials for users of Commodore computers, with series on such topics as first steps in machine language, as well as extended reviews of important products.
Subscriptions to the combined magazine are $20 U.S. or $25 CDN. in North America for six bi-monthly issues. Overseas subscriptions are $45 U.S.


There are 13 users using the Andro Hexer.
Players in search of a rubber for whirling topspins will be enthused by HEXER.
The mixture of 100% natural rubber in the upper layer results in increased grip and a longer impact time. This effects in improved trampoline and rotation features for the same striking energy (EFFICIENT PERFORMANCE), and provides each topspin with a higher trajectory. In addition, the new and progressive pips geometry puts a compact playing feeling across. The fourth TENSOR generation unfolds its immense qualities in spin and rotation oriented play.
I used this rubber about 3 years and I love it. I can produce very spiny services and top spins (not so spiny as Hurricane 3 neo) it has a good control and a nice speed. I'm not a professional player but I recommend this rubber.
The first thing that i noticed about this rubber is how soft the sponge is. The dwell time and control is excellent. Very fast when you go for the topspin kill, but regular warm up shots pretty slow (unlike fast rubbers where you have to hold back some power). I love blocking with this rubber. It doesnt react much to oncoming spin and has a very low throw.
This is definitely not a beginner's rubber and hard to Control with its High speed and spin ratio. When compared to other tensors say Tenergy 05, the spin is just as good and the speed maybe slightly slower but the control factor is much higher with the softer sponge. The Durability and the consistency makes it a very desirable rubber.
Im using the Hexer rubber for quite a while now. Although i found it a very good replacement for my Butterfly G2 and G3 im kinda stuck in my performance at the moment. I have the feeling it doesnt bring what i used to do bring with my butterfly rubbers. It could be my frame (Tibhar samsonov Alpha sgs) or my skill :p Above the table for agressive blocks and flips this rubber is king. There it is really fast. I havent found any better. Players with short pips get utterly destroyed with this rubber. But the further i get away from the table how harder i need to work to bring any spin in the ball and the speed is reduced as well for my feeling. I like to mix up my play and for an allround attacking player this rubber is good to start with. I found the durabilitiy of this rubber not as good as the butterfly rubbers i played with, but for the price its very reasonable. I recommend this rubber for every player with an allround attacking playstyle. However there comes a time where you want to try something new and improve your skill even further.


text:
Las playa de El Embayo se encuentra en el concejo asturiano de Avilés, España, y pertenece a la localidad de Nieva. El grado de urbanización y de ocupación son altos y su entorno es industrial. El lecho tiene pequeñas zonas de arenas de grano fino y de color tostado. Las bajadas peatonales son muy fáciles. Los grados de urbanización y ocupación son muy bajos.
Pertenece a la Costa Central asturiana, la cual, salvo casos contados no presenta playas con protección medioambiental.

Para acceder a esta playa hay que localizar los núcleos más cercanos que son Nieva y Zeluán. El nombre popular por el que suele ser conocida esta zona es la  Cola de Caballo puesto que es el nombre de la formación rocosa por la que se pasa, incluyendo un corto túnel de unos 10 m y va hacia el faro de san Juan desde el enclave de Zeluán. Está en una desembocadura fluvial, no tiene ningún servicio y solo se recomienda como actividad de recreo la pesca a caya ya que el baño en la ría no es recomendable.

Referencias

Embayo
Espacios naturales de Asturias


text:
/**
 * The content of this file is subject to the caAdapter Software License (the "License").
 * A copy of the License is available at:
 * [caAdapter CVS home directory]\etc\license\caAdapter_license.txt. or at:
 * http://ncicb.nci.nih.gov/infrastructure/cacore_overview/caadapter/indexContent
 * /docs/caAdapter_License
 */

package gov.nih.nci.cbiit.cmts.ui.common;

import org.jgraph.graph.AttributeMap;
import org.jgraph.graph.DefaultGraphCell;
import org.jgraph.graph.DefaultPort;
import org.jgraph.graph.GraphConstants;

import gov.nih.nci.cbiit.cmts.core.AttributeMeta;
import gov.nih.nci.cbiit.cmts.core.BaseMeta;
import gov.nih.nci.cbiit.cmts.core.Component;
import gov.nih.nci.cbiit.cmts.core.ElementMeta;
import gov.nih.nci.cbiit.cmts.ui.mapping.ElementMetaLoader;
import gov.nih.nci.cbiit.cmts.ui.tree.DefaultMappableTreeNode;
import gov.nih.nci.cbiit.cmts.ui.tree.DefaultSourceTreeNode;
import gov.nih.nci.cbiit.cmts.ui.tree.DefaultTargetTreeNode;
import gov.nih.nci.cbiit.cmts.ui.function.FunctionBoxGraphCell;
import gov.nih.nci.cbiit.cmts.ui.function.FunctionBoxGraphPort;

import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.Font;
import java.awt.geom.Point2D;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Enumeration;
import java.util.StringTokenizer;

/**
 * This class defines a list of utilities to help carry out some general functionality used in UI.
 * This class utilizes singleton pattern.
 *
 * @author Chunqing Lin
 * @author LAST UPDATE $Author: linc $
 * @since     CMTS v1.0
 * @version    $Revision: 1.2 $
 * @date       $Date: 2008-12-10 15:43:02 $
 */
public final class UIHelper
{
	//to defin the vertex that represents the almost invisible cell for source or target tree
	public static final int VERTEX_CELL_WIDTH = 3;
	public static final int VERTEX_CELL_HEIGHT = 3;
	public static final Color DEFAULT_VERTEX_COLOR = Color.BLACK;
	public static final Color DEFAULT_VERTEX_BORDER_COLOR = Color.BLACK;
	public static final Color DEFAULT_MAPPING_LINK_COLOR = Color.BLUE.darker().darker();
	public static final Color MAPPING_LINK_OBJECT_COLOR = Color.green.darker();
	public static final Color MAPPING_LINK_ATTRIBUTE_COLOR = Color.blue;
	public static final Color MAPPING_LINK_ASSOCIATION_COLOR = Color.RED;
	private static final Dimension invisibleVertexDimension = new Dimension(VERTEX_CELL_WIDTH, VERTEX_CELL_HEIGHT);
	//location of port in cell
	public static final int PORT_LEFT = 0;
	public static final int PORT_RIGHT = 1;
	public static final int PORT_NORTH = 2;
	public static final int PORT_SOUTH = 3;

	private static final String PORT_INPUT_STRING = "Input";
	private static final String PORT_OUTPUT_STRING = "Output";

	//used most time for Logging purposes.
	private static final UIHelper internalInstance = new UIHelper();

	private UIHelper()
	{

	}

	public static final int getDefaultFunctionalBoxInputOrientation()
	{
		return PORT_LEFT;
	}

	public static final int getDefaultFunctionalBoxOutputOrientation()
	{
		return PORT_RIGHT;
	}

	public static final String getDefaultFunctionalBoxInputCaption()
	{
		return PORT_INPUT_STRING;
	}

	public static final String getDefaultFunctionalBoxOutputCaption()
	{
		return PORT_OUTPUT_STRING;
	}

	//	public static final void timeMessage(Object sender, String msg, long timeLapse)
	//	{
	//		Log.logInfo(sender, msg + " time(milisec): " + timeLapse);
	//	}

	private static final boolean isPortOrientationMatch(DefaultGraphCell cell, boolean isInputData)
	{
		Object cellLabel = cell.getUserObject();
		if(cellLabel!=null)
		{
			String cellLabelStr = (String) cellLabel;
			String defaultCaption = isInputData ? getDefaultFunctionalBoxInputCaption() : getDefaultFunctionalBoxOutputCaption();
			return (cellLabelStr.contains(defaultCaption));
		}
		else
		{
			return false;
		}
	}

	/**
	 * Return first un-used port.
	 * @param cell
	 * @param isInputData
	 * @return a DefaultPort object
	 */
	public static final DefaultPort getFirstUnmappedPort(DefaultGraphCell cell, boolean isInputData)
	{
		int size = cell.getChildCount();
		//		Log.logInfo(this, "Cell has " + size + " children. Cell of type '"+cell.getClass().getName() + "'.");
		DefaultPort port = null;
		boolean found = false;
		for (int i = 0; i < size; i++)
		{
			DefaultGraphCell childCell = (DefaultGraphCell) cell.getChildAt(i);
			if (childCell instanceof DefaultPort)
			{
				port = (DefaultPort) childCell;
				boolean portOrientationMatch = isPortOrientationMatch(childCell, isInputData);
				if (!port.edges().hasNext() && portOrientationMatch)
				{//not used port, empty and the port caption matches, ie, input for source, output for target
					found = true;
					break;
				}
			}
			else if(childCell instanceof DefaultGraphCell)
			{//cell contains cell, then find the first of port of that then.
				/**
				 * NOTE:
				 * Since DefaultPort is descendant of DefaultGraphCell, so has to structure this way.
				 */
				port = getFirstUnmappedPort(childCell, isInputData);
				if(port!=null)
				{
					found = true;
					break;
				}
			}
		}

		if(found)
		{
			return port;
		}
		else
		{
			return null;
		}
	}

	/**
	 * Answer whether a given tree node is from source or target tree.
	 * @param treeNode
	 * @return whether a given tree node is from source or target tree.
	 */
	public static final boolean isDataFromSourceTree(TreeNode treeNode)
	{
		boolean isDataFromSourceTree = false;
		if (treeNode instanceof DefaultSourceTreeNode)
		{
			isDataFromSourceTree = true;
		}
		else if (treeNode instanceof DefaultTargetTreeNode)
		{
			isDataFromSourceTree = false;
		}
		else
		{
			String msg = "The data is of type '" + treeNode.getClass().getName() + "', but I don't know where it is from!";
			System.err.println(msg);
			throw new UnsupportedOperationException(msg);
		}
		return isDataFromSourceTree;
	}

	public static final Dimension getDefaultSourceOrTargetVertexDimension()
	{
		return invisibleVertexDimension;
	}

	public static final Color getLinkColor(Object metaData)
	{
		Color linkColor=DEFAULT_MAPPING_LINK_COLOR;
		if (metaData instanceof ElementMeta)
			linkColor=MAPPING_LINK_OBJECT_COLOR;
		else if (metaData instanceof AttributeMeta)
			linkColor=MAPPING_LINK_ATTRIBUTE_COLOR;

		return linkColor;
	}

	public static final AttributeMap getDefaultUnmovableEdgeStyle(Object metaData)
	{
		Color linkColor=getLinkColor(metaData);
		return getDefaultUnmovableMappingEdgeStyle(linkColor);
	}

	private static final AttributeMap getDefaultUnmovableMappingEdgeStyle(Color lineColor)
	{
		AttributeMap lineStyle = new AttributeMap();
		GraphConstants.setLineBegin(lineStyle, GraphConstants.ARROW_NONE);
		GraphConstants.setLineColor(lineStyle,lineColor);
		GraphConstants.setBeginSize(lineStyle, 10);
		GraphConstants.setFont(lineStyle, GraphConstants.DEFAULTFONT.deriveFont(10));
		GraphConstants.setBendable(lineStyle, false);
		GraphConstants.setEditable(lineStyle, false);
		GraphConstants.setMoveable(lineStyle, false);
		GraphConstants.setResize(lineStyle, false);
		GraphConstants.setSizeable(lineStyle, false);
		return lineStyle;
	}

	public static final AttributeMap getDefaultInvisibleVertexAttribute(Point position, boolean representSourceVertex)
	{
		AttributeMap map = getDefaultInvisibleVertexBounds(position, representSourceVertex);
		GraphConstants.setEditable(map, false);
		GraphConstants.setBendable(map, false);
		GraphConstants.setSelectable(map, false);
		GraphConstants.setResize(map, false);
		GraphConstants.setSizeable(map, false);
		return map;
	}

	public static final AttributeMap getDefaultInvisibleVertexBounds(Point position, boolean representSourceVertex)
	{
		AttributeMap map = new AttributeMap();
		Dimension cellDimension = getDefaultSourceOrTargetVertexDimension();
		//hide source is better? or present the target cell is better?
		double pointX = position.getX();
		if (representSourceVertex)
		{
			pointX -= Math.ceil(cellDimension.getWidth() * 2 + 0.5);
		}
		else
		{
			pointX += Math.ceil(cellDimension.getWidth() + 2 );
		}
		map = (AttributeMap) UIHelper.createBounds(map, pointX, position.getY(), cellDimension, DEFAULT_VERTEX_COLOR, false);
		//since it is invisible, explicitly set autosize to be false.
		GraphConstants.setAutoSize(map, false);
		return map;
	}

	/**
	 * copied similar function from JGraph implementation to make the vertex smaller
	 * Returns an attributeMap for the specified position and color.
	 */
	public static Map createBounds(AttributeMap map, Point2D point, Dimension dimension, Color c, boolean moveable)
	{
		return createBounds(map, point.getX(), point.getY(), dimension, c, moveable);
	}

	public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
	{
		//		final int ALPHA = 255;
		GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
		//		GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
		GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
		GraphConstants.setBackground(map, c.darker());
		// Add a nice looking gradient background
		GraphConstants.setGradientColor(map, c.darker());
		// Make sure the cell is resized on insert
		//		GraphConstants.setSize();
		//		GraphConstants.setResize(map, true);
		// Add a Border Color Attribute to the Map
		GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
		GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
		GraphConstants.setMoveable(map, moveable);
		GraphConstants.setOpaque(map, true);
		GraphConstants.setResize(map, false);
		GraphConstants.setAutoSize(map, true);
		return map;
	}

	public static final Map getDefaultFunctionBoxPortAttributes(Map map, Dimension portDimension)
	{
		GraphConstants.setSize(map, portDimension);
		GraphConstants.setSize(map, portDimension);
		GraphConstants.setSelectable(map, true);
		GraphConstants.setBorderColor(map, Color.RED.darker().darker());
		GraphConstants.setMoveable(map, true);
		return map;
	}

	/**
	 * Could return null if nothing is found.
	 * @param treeRoot
	 * @param metaObject
	 * @return MappableNode, null if nothing is found.
	 */
	public static final MappableNode constructMappableNode(Object treeRoot, Object metaObject)
	{
		MappableNode result = null;
		if(treeRoot instanceof DefaultMappableTreeNode)
		{//either source or target
			DefaultMappableTreeNode root = (DefaultMappableTreeNode) treeRoot;
			result = (MappableNode) findFirstTreeNodeMatchUserObject(root, metaObject);
		}
		if(result==null)
		{
			System.out.println("Could not find the metaObject '" + metaObject + "' in the given tree rooted by '" + treeRoot + "'.");
			//Log.logError(internalInstance, "Could not find the metaObject '" + metaObject + "' in the given tree rooted by '" + treeRoot + "'.");
			//Log.logError(internalInstance, "treeRoot is of type '" + (treeRoot==null? "null" : treeRoot.getClass().getName()) + "'");
		}
		return result;
	}

	public static final MappableNode constructMappableNodeObjectXmlPath(Object treeRoot, String dtObjectXmlPath)
	{
		MappableNode result = null;
		if(treeRoot instanceof DefaultMappableTreeNode)
		{//either source or target
			DefaultMappableTreeNode root = (DefaultMappableTreeNode) treeRoot;
			result = (MappableNode)findTreeNodeWithXmlPath(root, (String)dtObjectXmlPath);
		}
		else if (treeRoot instanceof DefaultMutableTreeNode)
		{
			DefaultMutableTreeNode rootNode =(DefaultMutableTreeNode)treeRoot;
			result = (MappableNode)findTreeNodeWithXmlPath(rootNode, (String)dtObjectXmlPath);
		}

        if(result == null)
        {
//		    int c = 0;
//            if(treeRoot instanceof DefaultMappableTreeNode) c=1;
//		    else if (treeRoot instanceof FunctionBoxGraphCell) c=2;
//            else if (treeRoot instanceof FunctionBoxGraphPort) c=3;
            if ((dtObjectXmlPath.trim().equals("constant"))||
                (dtObjectXmlPath.trim().equals("currentDate"))) {}
            else
            {
                System.out.println("UIHelper.constructMappableNodeObjectXmlPath():Could not find the data obj in the given tree rooted by '" + treeRoot + "'. path:"+ dtObjectXmlPath);
            }

            //Log.logError(internalInstance, (new StringBuilder()).append("Could not find the datatypeBaseObject '").append(dtObjectXmlPath).append("' in the given tree rooted by '").append(treeRoot).append("'.").toString());
			//Log.logError(internalInstance, (new StringBuilder()).append("treeRoot is of type '").append(treeRoot != null ? treeRoot.getClass().getName() : "null").append("'").toString());
		}

		return result;
	}

	public static DefaultMutableTreeNode findTreeNodeWithXmlPath(DefaultMutableTreeNode treeNode, String nodeXmlPath)
	{
		if (nodeXmlPath==null)
		{
			System.out.println("UIHelper.findTreeNodeWithXmlPath()..invalid node to search:"+nodeXmlPath);
			return null;
		}

		StringTokenizer st = new StringTokenizer(nodeXmlPath, "/@");
		boolean foundRoot = false;
		DefaultMutableTreeNode e = treeNode;
		while(st.hasMoreTokens() && e!=null){
			String tmp = st.nextToken();
			if(!foundRoot){
				if(e.toString().equals(tmp)){
					foundRoot = true;
					continue;
				}else
					continue;
			}else{
				int childCount = e.getChildCount();
				DefaultMutableTreeNode found = null;
				for(int i=0; i<childCount; i++){
					DefaultMutableTreeNode child = (DefaultMutableTreeNode) e.getChildAt(i);
					if(child.toString().equals(tmp)){
						found = child;
						break;
					}
				}
				if(found == null){
					return null;
				}else{
					e = found;
				}
			}
		}

		if(!foundRoot)
			return null;
		return e;
	}

	/**
	 * This method will traverse the sub-tree whose root is itself and including itself to
	 * find a tree Node whose userObject matches the given one. If none is found, return null.
	 * @param userObject
	 * @return the default mutable tree node matching the given object.
	 */
	public static DefaultMutableTreeNode findFirstTreeNodeMatchUserObject(DefaultMutableTreeNode treeNode, Object userObject)
	{
		Object selfUserObject = treeNode.getUserObject();
		if(selfUserObject!=null && selfUserObject instanceof ElementMetaLoader.MyTreeObject)
			selfUserObject = ((ElementMetaLoader.MyTreeObject)selfUserObject).getUserObject();
		boolean boolEquals = selfUserObject==null? userObject==null : selfUserObject.equals(userObject);
		if(boolEquals)
		{
			return treeNode;
		}
		else
		{
			DefaultMutableTreeNode foundTarget = null;
			int childCount = treeNode.getChildCount();
			for(int i=0; i<childCount; i++)
			{
				foundTarget = null;
				Object obj = treeNode.getChildAt(i);
				if(obj instanceof DefaultMappableTreeNode)
				{
					DefaultMappableTreeNode childNode = (DefaultMappableTreeNode) obj;
					foundTarget = findFirstTreeNodeMatchUserObject(childNode, userObject);
					if(foundTarget!=null)
					{
						break;
					}
				}
			}
			return foundTarget;
		}
	}

	public static String getPathStringForNode(DefaultMutableTreeNode node){
		StringBuilder sb = new StringBuilder();
		Object[] path = node.getUserObjectPath();
		for(int i=0; i<path.length; i++){
			if(path[i] instanceof ElementMetaLoader.MyTreeObject){
				Object obj = ((ElementMetaLoader.MyTreeObject)path[i]).getUserObject();
				if(obj instanceof ElementMeta){
					sb.append("/").append(((ElementMeta)obj).getName());
				}else if(obj instanceof AttributeMeta){
					sb.append("/@").append(((AttributeMeta)obj).getName());
				}else
					return "";
			}else
				return "";
		}
		return sb.toString();
	}

	/**
	 * Return true if port matches the type of input (isInputPort is true) or output (isInputPort is false);
	 * @param port
	 * @param isInputPort
	 * @return true if port matches the type of input (isInputPort is true) or output (isInputPort is false);
	 */
	//	public static final boolean isPortTypeMatch(DefaultPort port, boolean isInputPort)
	//	{
	//		boolean result = false;
	//		Object obj = port.getUserObject();
	//		if(obj instanceof ParameterMeta)
	//		{
	//			ParameterMeta paramMeta = (ParameterMeta) obj;
	//			result = (isInputPort ==paramMeta.isInput());
	//		}
	//		return result;
	//	}

	/**
	 * Return true if port is already mapped;
	 * @param port
	 * @return true if port is already mapped.
	 */
	public static final boolean isPortMapped(DefaultPort port)
	{
		boolean result = false;
		Set edges = port.getEdges();
		if (edges != null && !edges.isEmpty())
		{
			result = true;
		}
		return result;
	}

}
/**
 * HISTORY : $Log: not supported by cvs2svn $
 * HISTORY : Revision 1.1  2008/12/09 19:04:17  linc
 * HISTORY : First GUI release
 * HISTORY :
 * HISTORY : Revision 1.1  2008/12/03 20:46:14  linc
 * HISTORY : UI update.
 * HISTORY :
 */


text:
New Yorkers Terrified By 80ft Gorilla
NEW York was flung into a state of panic yesterday as thousands of people watched an 80 foot-high gorilla climb the Empire State Building.
The White House later apologised for the incident, revealing that it had simply wanted a nice photograph of the city's population gaping in terror at a giant, furious ape.
The first signs of panic were at 9.30am when office workers were evacuated after a four-foot wide eyeball was seen peering into their meeting room.
Sales manager Bernadette McLintock said: "Josh was just giving us the weekly figures when there was a really strong smell of bananas and faeces.
"The next thing I know, there's this huge monkey nose sniffing the coffee machine. I thought his big hand was going to reach in and grab me, but he went for my friend Carol instead. Skank."
Air Force general Thomas Logan said: "Yesterday's activities were unfortunate but from time to time we will have to carry out anti-monster exercises.
"Through our intelligence sources we know that Al-Qaeda has been trying for months to recruit an enormous ape, with their efforts focused mainly on Skull Island."
Mayor Michael Bloomberg said: "It was insensitive to do this on a date that, while utterly dissimilar to September 11th, shares many of the same letters.
"I'd scrambled half a dozen biplanes before we were told the real situation. Have you tried finding one working biplane? Let alone six? It's incredibly difficult."
Iggy Pop To Insure 1996 Renault Laguna
GODFATHER of punk Iggy Pop last night requested a comprehensive insurance quote for his 1996 Renault Laguna estate.
Pop was forced to act after the Advertising Standards Authority ruled that his television commercials for Swiftcover.com had misled more than 11 people.
The ASA said it was shocked to discover that the New York-based new-wave legend did not have a motor policy with the biggest insurance company in Woking.
Insurance industry analyst Julian Cook said: "When I saw the advert I have to say my first thought was not, 'I wonder if he really does have a policy with Swiftcover', it was, 'Oh dear God, Iggy Pop must be absolutely skint'.
"Personally I would be shocked to discover if the 12 people who complained were not in some way connected to Norwich Union, or whatever the hell they're called these days."
Meanwhile the ASA rejected complaints from more than 250,000 Iggy Pop fans who said they could simply not believe what they were seeing.
Mr Pop added: "It's a diesel, it's done about 87,000 miles and I keep it in the driveway overnight.
"I don't use it for business or commuting. It's really just for nipping to the shops two or three times a week, golf on Saturday mornings and, of course, church."
A Swiftcover representative said the premiums are likely to be a bit higher as Mr Pop has four points on his licence for driving while having home-made vodka injected into the base of his spine and fucking a frozen chicken.