text
stringlengths
3
1.04M
package org.knowm.xchange.bitz.dto.marketdata; public enum BitZKlineResolution { MIN1("1min"), MIN5("5min"), MIN15("15min"), MIN30("30min"), MIN60("60min"), HOUR4("4hour"), DAY1("1day"), DAY5("5day"), WEEK1("1week"), MON1("1mon"); private final String code; private BitZKlineResolution(String code) { this.code = code; } public String code() { return code; } }
Arsenal are tracking former Monaco and Atleico Madrid midfielder Yannick Carrasco. Read on for ten facts about the player who has scored in a Champions League final. Arsenal will learn their Europa League fate on Monday afternoon as the draw for the round of 32 will be made. With Arsenal set to announce the former PSG and Sevilla manager Unai Emery as the club’s new manager read on for his best quotes. David Dein has hailed Arsene Wenger and says he will have ‘no shortage of offers’ if he opts to continue in management once he leaves Arsenal at the end of this season.
########################################################################## # Copyright 2016 ThoughtWorks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ########################################################################## module ApiV1 class CommandSnippetRepresenter < ApiV1::BaseRepresenter alias_method :command_snippet, :represented link :self do |opts| opts[:url_builder].apiv1_admin_command_snippet_url(relative_path: command_snippet.getRelativePath()) end link :doc do |opts| 'http://api.go.cd/#command_snippets' end property :getName, as: :name property :getDescription, as: :description property :getAuthor, as: :author property :getAuthorInfo, as: :author_info property :getMoreInfo, as: :more_info property :getCommandName, as: :command property :arguments, exec_context: :decorator property :getRelativePath, as: :relative_path def arguments command_snippet.getArguments().to_a end end end
*{ font-family: -apple-system,".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande",Arial,sans-serif; color: #D8DEE9; line-height: 1.5; } html{ background: #2E3440 !important; } img[src="http://i.imgur.com/u15K8W6.png"]{ filter: brightness(115%) !important; -webkit-filter: brightness(115%) !important; } a{color: #7694b8; text-decoration:none} a:hover{color:#7694b8; text-decoration:underline} .tg {border-collapse:collapse;border-spacing:0;margin: 0.9em 0 !important;} .tg td{padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;font-size:0.9em;background:#3B4252} .tg th{padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;font-size:0.9em;background:#4C566A} .tg .tg-yw4l{vertical-align:top} h1:first-of-type{ font-size: 1.563em } span{ color: #7694b8 } hr { display: block; margin: 1em 0; border: 0; border-top: 1px solid #4C566A; } .red{ margin: 1em 0 !important; padding: 1em; font-family: -apple-system,".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande",Arial,sans-serif; font-size: .9em !important; font-weight: bold; text-indent: initial; background: #8E4E5F !important; box-shadow:0 1px 1px #BF616A !important; border-radius: 4px; color: #D8DEE9; !important; } .blue{ margin: 2em 0 !important; padding: 1em; font-family: -apple-system,".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande",Arial,sans-serif; font-size: .9em !important; font-weight: bold; text-indent: initial; background-color: #485e7b; !important; box-shadow: 0 1px 1px rgba(94,129,172,0.25) !important; color: #D8DEE9; !important; border-radius: 4px; } .blue img{ max-width: 100% } .blue a{color:#8ea7c5;!important; text-decoration:none} .blue a:hover{text-decoration:underline!important} p:nth-of-type(5),p:nth-of-type(8),p:nth-of-type(10){ display:none } h3{ line-height: 1.5 !important; font-family: -apple-system,".SFNSText-Regular","San Francisco","Roboto","Segoe UI","Helvetica Neue","Lucida Grande",Arial,sans-serif !important; font-weight: bold !important; font-size: .9em; } li{ font-size: 1em; margin-bottom: 0.5em; } body{ margin-left: 30%; margin-right: 30%; } code{ font-family: Monaco,Consolas,"Lucida Console",monospace !important; padding: 0.15rem; font-size: .9em; background: #434C5E; border: 1px solid #f2f3f3; border-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,0.125); } }
--- layout: post title: "Mac/Linux平台Chrome公测版发布" date: 2009-12-09 01:32 author: Eyon comments: true tags: [Chrome, Chrome扩展, Chrome新闻, Chrome更新, Chrome测试版] --- 太平洋时间2009年12月8日,万众期待的Mac以及Linux Chrome Beta版正式发布,和我们[之前预料的](http://www.chromi.org/archives/category/chrome/chrome-for-mac)一样,Chrome Beta For Mac将会在圣诞节前推出,但没有想到Linux公测版也一起同时发布。目前,这Mac和Linux平台的最新Chrome版本均为4.0.249.30。 <a href="http://img.chromi.org/2009/12/Chrome-Beta-For-Mac.jpg">![Chrome Beta For Mac](http://img.chromi.org/2009/12/Chrome-Beta-For-Mac.jpg "Chrome Beta For Mac")</a> Mac版Chrome Beta和我们[之前预测的](http://www.chromi.org/archives/2245)一样,没有书签同步以及扩展功能,不过可以更换浏览器主题。目前Chrome Beta For Mac仅适用于 Mac OS X 10.5或更高版本,同时只能支持Intel处理器。 <a href="http://img.chromi.org/2009/12/Chrome-Beta-For-Linux.png">![Chrome Beta For Linux](http://img.chromi.org/2009/12/Chrome-Beta-For-Linux-550x345.png "Chrome Beta For Linux")</a> Linux版Chrome Beta默认也没有开启书签同步功能,不过可以支持扩展,并且支持GTK主题。 同时,最令人兴奋的是,Google官方的[Chrome扩展中心](https://chrome.google.com/extensions)也随着Chrome Beta For Mac/Linux同时上线,这不管对于Windows版Chrome用户还是Linux版Chrome用户都是一个非常好的消息,Chrome将会凭借着强大的扩展支持与FireFox及其他浏览器一争高下。
Welcome to the Purpose Nation Podcast, inspiring conversations with Christians in science, technology and industries of the future. For more information or to make a tax deductible contribution visit PurposeNation.org. This is Brad Cooper with the Purpose Nation Podcast and today we are blessed and honored to be joined by the CEO and Co-Founder of Carpenters Code, Neil Alston. Neil, welcome thanks for joining us today. Thank you so much. I'm excited to be here. Likewise likewise. SoI look. Looking forward to discussing some of the things that Neil's involved with. Very busy guy has a lot of experience here in technology and combining that with what he's doing with his application and just serving the Lord in many ways. I'm really excited to talk about that. First let me just if it's ok give a brief summary of some of Neil's background and then he can fill some other things in. He's been in the Bay Area technology for many years. He currently is the CEO and co-founder of Carpenters Code and he's also their Chief Evangelist. He launched a program called Code for the Kingdom, a hackathon series previously. He also managed business development for Google and was with Google for many years on some other ad platforms and some of the work in Africa. And before Google actually worked in Africa and was a refugee program manager for the U.S. Department of State which was very interesting and also prior to that was with food for the hungry and working in Africa there. So he has a masters in quantitative economics and policy from Princeton. So lots of great and interesting experience there. All that kind of led you to where you are today and let it lead you to our discussion. So just just kicking it off if you wouldn't mind. Tell us a little bit about your current project Carpenters Code? Definitely, it's been an interesting journey and very exciting. I came to it really about four years ago some friends and I were just wondering if it was possible to take things that we saw in the Bible different principles, different behaviors and use that along with you know world class Silicon Valley product and process to build products that would help people and enrich their lives. It was just really that simple. Can we use these things that have been practiced for thousand years in the Bible to build stuff and we started out with a hackathon scheme and just getting a bunch of people together to try things and I did that got a team of people including several people from Google who wanted to do this more full time. And it was a fascinating journey as we were trying to tackle the space of prayer and we had an aha moment about six months into it where we were testing guiding people through audio prayers. And I just found that it was an extremely powerful effective way to get people to kind of refresh and experience God's presence and experience peace. And so everything just kind of continued to snowball from there. So it's been really exciting just using and seeing that kind of a data driven approach even and a very design center approach to taking biblical truth has actually works to break apart product to market a whole bunch of people to use. So that's exciting. Yeah. So you are your main product right now as I understand it is is a mobile app called Abide? That's correct. Yeah. Abide has shifted a lot. We originally started as more of a social platform to share prayer requests and pray for each other and we found out that that was actually really hard for people to do. People had a hard time praying for each other because they didn't know how they didn't feel equipped to do it. And so we actually shifted to just guide people to pray through and teach the issues in their life. And so what Abide does is we have a daily meditation which we partnered with Youversion which is a big Bible up on to take their most popular scriptures that are out there and then use those to make meditations which are effectively just stopping, reading Scripture really deeply reflecting on it and figuring out how to respond in and we have that and you can pick your length to 5, 10, 15 minute meditations and then we also have a lot of topical things which are popular and that has been fascinating because I did not expect when we started this project that we would be a place for people to fall asleep and have some of those kinds of things but it turns out a lot of people struggle with insomnia. And so you know even Christians have a hard time falling asleep or they struggle with depression or they struggle with relationships. All sorts of things. And so to be able to guide it through Hey how can I how is God going be able to help us this situation has been very effective. So every night we put people to sleep when they click our Insomnia and our Rests meditations and they fall asleep. And so yeah that's that's a lot of what the book doesn't for user how to use it. That's pretty interesting because I actually personally I've used the Youversion app obviously as well and yeah I mean I've used I actually have used that to you know to have it because they do have audio readings and they're the only people reading some of the scripture and I have used it for that as well. So yeah. Yeah sure. People use radio Christian radio for that. They use things like Youversion for that and where you know we could have another way to do that but it's actually more tailored for exactly that kind of experience to help you release with it as opposed to just reading scripture which is great and phenomenal but it's it's kind of a different way. Right and it seems like the response has been has been great. 4 million downloads is that what you're at right now? Right, great and we'll be sure to place a link to our site to the apps everybody can go download it and try it out and it's on both the iPhone and on on Google. So let's take it back a little bit so we can reel it way back talking about your childhood a little bit growing up. I don't know if there was any kind of a tech kind of interest or background there. But I think math it sounded like and then also just you know what drew you into the tech industry from the start and then also if you could talk a little bit about any faith or or Christian background. I actually was a bit of a math geek. Growing up I remember my dad taught me the multiplication tables when I was five and I just loved it. It just made sense to me. I was actually very interested in computers when I was younger. I took a computer programming class at my junior high when I was in ninth grade and I actually wrote a computer game program on an Apple TV at the time and my teacher had no idea what I was doing because he could you know you learn so fast sometimes when you're that age he kind of gets the basics in that way and wrote this program. I took some computer class in college too. But it was really interesting because I actually was much more focused on service and helping the poor was really personal in that I felt. So I focused a lot more of my energy on that area as I grew up. That's why I focused on more of the economics econometrics idea of hey maybe we can use that to help the poor and help them grow. But there was definitely an interest in tech from a young age and I was very fortunate in that my family two amazing parents both were very involved in the church. I had a little bit of my own claiming of the faith to really personalize it as I was going through high school and college but it was very much grew up in that loving environment. I think that was a huge influence for me to just be in God's word and be connected and out of that find purpose and call that's led me to where I am today of teaching and math skills and a computer background in the time that into providing people with an experience of connecting with. So yeah it's not necessarily I would not have expected that I would be here today if you asked me that 20 years ago. Yeah, didyou or did you grow up in the Bay Area or come from somewhere else? I grew up in the north bay Santa Rosa which is about an hour and a half north of San Francisco pretty much California through and through. OK, definitely see them trying to apply the math interests and skills to solve some problems. In that case it was already seeing some of the areas that could be used combined with your faith and then you went off to college at Berkeley is that right. So tell us about that experience and then I guess Princeton as well if you can if you can remember were there some points you know either in sort of the math curriculum or professors or the student body. I mean are there places where you started and maybe I guess even you know growing up in high school in Santa Rose area you know where you're starting to run into some conflicts with your faith in terms of just either people or teachings or things that were kind of against your faith? That's a great question. And Berkeley to me was very much a trial by fire experience. I think that you know the big challenge in a place like that obviously there's there's very much to a lot of professors and teachers and students who don't share that element of faith or even necessarily the same level of curiosity into it and it gets ruled out. And that was hard. I think actually for me the biggest challenge was that I really wanted to believe and live in a world where everything made sense because you know being very mathematically mind I wanted to say look if you do a and b then c happens that's the way that life should work. And I was really challenged during my college period as I was reading the Bible to actually try to live a normal life of faith and I stepped out to do that. But in particular my sophomore year when I felt really called to go actually live with streets and be homeless for a period of time and God responded in some pretty phenomenal amazing way that I never could have predicted and I actually had to shift my mindset to think you know what, I think God's equation is far beyond my understanding and the way that God works. And so I need to be able to accept the fact that I can't figure everything out and I can't understand everything and that's ok it leaves space for mystery and leave space for kind of a faith. It's ok, God's going work in ways that are beyond my understanding. And I think that you know that has really worked for me where I find my own personal challenge in Berkeley in Princeton and in others in that I think there is some intellectual dishonesty that happens that really frustrates me where people will take and make assumptions and just my very nature the way that they're making assumptions, they and building their model they exclude God and they say look you know we're building a model that excludes God therefore there's no God. And you're like yeah but your model doesn't actually make any sense. And I see that kind of inconsistency quite often and that's actually a kind of a more personal you know challenging frustration for me. But ultimately you know Berkeley was really tough. Princeton I would say it was less so because I was just older then you know when you're in grad school and I was already in my mid 20s and what not, I found much less resistance. But it was equally as challenging environment. So it's I fortunately have survived and continue continued with it. Well and where you're at now I mean it's yeah. I mean if you give you get guess if you can make it as a college student through Berkeley and then man that was pretty amazing to take some time off to explore what would be like to be homeless. I know some other Christians have done similar things. That's not something normally that a college student would do. But that experience plus you know it just sounds like being challenged and getting through that. At that point you know you can you can make it and or in any place just about. Yeah. So tell us about how you landed in Africa? That was passionate had since I was about 16. It was after Berkeley and I connected with this organization which I looked at a lot of Christian prophets and I wanted to go over with and got a role there which was great in Ethiopia really trying to just help people build better farms and get access to water and things like that and then got kind of pushed into a leadership position which was really quite interesting over Congo. Congo is one of the absolutely most difficult places in the world to live and work in the midst of warfare that goes on there and the humanitarian disaster and so that was an absolutely fascinating and amazing time for me to kind of see people who were really at the end of their their ability to provide for themselves. You know when your homes are getting burned down and there's war going on and you just trying to get through the basics and yet had a deep joy and I saw that in Chad as well. I worked on Darfur kind of when that was going on and when the outbreak was happening and you know to Jeff's genocide things were going on a lot and so it was being around people who are really at a tough position in life at that position in life and still seeing their ability to have a family to have joy to have hope and find purpose I think it has shaped a lot because when I look at the things that we're trying to surmount here which are very real hard problems and building product and getting product market fit it's like hey I know people who walk through much more difficult times and have survived with great hope and done beautiful things in a life that has been a really big kind of life shape or for me to see just the amazing people who have mentored me who have gone through years of war and famine and other things so that was that was really neat. What was interesting about that to kind of bring to fruition where I am now I went through a season of life where I really felt called that and I think I was able to hopefully contribute to some really great things in that season shifted and brought me back into the technology space and what I'm doing now and I think just as a lesson learned to not always clinging to things so tightly but giving space for kind of God to move and work and change. We need to be able to do those things in Africa but now I have people in Africa who are using our product. But I know I understand the environment I've lived there. To languages there are adopted children from there. And so that's very important part of my life even though I'm a technologist. And it's neat to see those come together. Right. Were there some thought that you could somehow bring either the economic experience that you had or technology to bear on those problems you were seeing? I mean did it seem insurmountable? Did it seem like well if we only had a few of these things would it be better? Or what's your view of it how it was then and now and how that relates to the technology aspect? I would say so. One thing that I learned very definitively is that if you want to be in technology and making a difference you need to be in the places where the absolute top class people are and they're making difference and that is something that I think Silicon Valley really offers and one of the reasons why I'm very committed to being here and that's not to say that there aren't people in other parts of World who aren't able but having lived in Africa I actually work on for technology solutions when I was over there. And I found that it was so hard to move the needle on things because what we were working on was not the core technology that was going to be transformative what we were working on were the little things on the odds and ends around the edges that were going to make it slightly better. And what I needed to do to make that difference was to actually go in and say no I need to work on a core technology platform because that's where you make the difference. I thought to say that there aren't important solutions will come out of those spaces but by and large the absolute tidal wave of change thats happening is happening because of the minds in the core of the technology business. A lot of whom are located here in Silicon Valley and so being here if I want to be an influencer, if I want to be a change agent is absolutely essential to understand what's going on to be able to make the difference to make a difference at scale. And so that was really an eye opener for me. So I tried to shift from being somebody who was out in the field kind of one on one helping people or you know working on various parties got to somebody was like not want to actually help change the core technology in the way that it works and the way it is understood to have a much bigger systemic influence on what's going on and that's what everybody needs to do that but that's what I needed to do and I feel very satisfied being where I'm at now being able to do that. And in trying to be one of those change agents who's helping design the system in a better way. Right. And challenge assumptions that are wrong or that I think are incorrect and that that part's really fun and rewarding. So I enjoy being part of that. Right. And then led you to Google but then just before that you were at the Department of State so you were in the government as well. Maybe you talked about that in terms of you were talking earlier about just the speed of things and the specification of the technology. I'm guessing things slow down didn't speed up any. I worked for some people who I dearly love and who care so deeply about the issues. But the pace of change and the ability to make change was not something that meshed with what I was looking for. I got to be a part of all sorts of secretive meetings where you know about what's going on you know the intelligence but not necessarily reshape policy or reshape programs in a way that's going to make a huge difference because there's just so much inertia there's so much organization inertias that says this is the way we do it. This is why we do it this way. I mean the one example that I have where I really feel like they will make a big difference was that we were doing some programs or people who had suffered from post-traumatic stress disorder due to the genocide they had family members died. I just got to extremely tragic things and we had hired a nonprofit group to go to counseling. And I thought well this is great but I have no idea if it's doing any good that we can go spend a billion dollars a year on this. We've never we have no evidence that this is actually helping people. And so I was able to get an evaluation grant to get to bring in one of the best researchers in it to evaluate what was going on several people actually having better outcomes because it turned out the word and the reason they were is that the methods being used were actually causing people to kind of relive the experiences without treating the emotional space for them to heal. For me to go see me after two years I look back and see kind of one victory and they designed the programs better and made them better, etc. But it was really hard to fight for change. And actually my former boss at Google, Megan Smith, went to be the CTO of the U.S. government and she you know since left I think she and we have talked about that much had a bit of a similar experience. They're just very different things. The risks that we can take. I put it to the risks that we're able to take as startups and businesses in Silicon Valley are different fundamentally than the risks went to U.S. government technically. So it's OK if we fail as a matter of fact 90 percent of start ups fail. People know that investors know that. But you don't want 90 percent of your projects to fail right. So that's just a different space that you need to live in. So I enjoy the space of where we we live in a space of fruitful year but less access to Google and a lot of people have a great saying with a new idea and we know that a lot of things are going to fail just realize that quickly and then start doing something else you'd say you can learn fast. And that's a really really fun place to be. It's also a place to be in because it can be a bit exhausting. When you design something try it with your users it looks good. You have engineers build it you build out features you ship it and it doesn't work in the same say. We just spend two months working on this feature and it absolutely flopped. Now we need to tear it out. We need to remove everything we need to tell you you're just not there anymore. And then go look for the next thing that can be an exhausting process to maintain that kind of excitement to keep trying and keep learning when you know that. But there's a humility I think part of it is there's a humility that there's a lot of great ideas. Hopefully we have good ideas but a lot of them are going to fail and that's OK. Yeah let's take it to Google now so you were there for seven years. Tell us a little bit about what you did there. And then I also would really like to hear about what the experience was like as a Christian working inside of Google. Firstof all I drink a lot of the Kool-Aid there's a lot that I love about Google. I had a rule that let me be in meetings with the founders Larry Page and Sergey Brin and Eric Schmidt because of the deals that I was working on. There's there's kind of a method of perspective of what technology can do that is really, really, really powerful because of the problem solving ability and ability to understand data and what's happening and I really enjoy that and love that and have some great examples of what surprised me about being in that kind of environment. And it was like being in breakthroughs like being in technology school I was there was seven years and I was always learning. Google's not always right either. They make mistakes and they make a lot of mistakes and they have to figure out how to fix those so that was healthy to realize that even the big juggernauts are not always right. In terms of being a Christian at Google., you know it was very interesting to me because I did not ever feel any direct discrimination or resentment. It was much more of that well if that's what you're into that's cool. But I'm not really interested kind of mentality. There still is a very active Christian group there and I know a number of people who are part of it. And I've spoken there about this project and continue to connect with them. But it's very, relative to the size of Google, it's quite small. You know I think the culture, there's much more interest in culture around hey let's do mindfulness meditation, let's do yoga, let's do all those things as opposed to let's talk about the faith. But in small group settings, I did find people were generally open to at least know that that's part of your life and say OK that's fine. And I mean I know senior executives at Google who are believers and who feel like they're able to still maintain that bouts of professional excellence and their faith. But it is hard, Christianity is not the defacto kind of thing in Silicon Valley at all. You know even when I was going to launch this project is a great example. I was talking to a Google colleague and I was talking about how we were doing. You know it's got a meditation and what not and his comment was, "Well I guess we have to digitize everything." That was the kind of his comment and I thought man, that is the really kind of attitude what I'm doing. We've been part of technology startup forums and events and lots of think outside of the Christian faith and the general reaction is "man, what you're doing is just not very interesting and if some people want it there's a market for it great. Good luck." I mean that's really that's what investors tell you. That's why Piers tell you that really the prevailing attitude is so you know even at Google I think we're towards what I'm working on here. Most people would just say what you're doing just does not matter. It's just not big enough. It doesn't have enough scale it just does not matter. And so you're wasting your time and if you want to waste your time go ahead and waste your time all you want. Just don't do it around me. And that's really the the prevailing attitude that I've kind of heard and seen I mean it was great when I was at Google and I was working as part of product I told my boss hey I want to do this and actually have a moonlighting policy where they'll let you work on side projects as long as it's not competitive to what Google is doing. You can use your own time on computers and stuff. What Oh yeah. This is not competitive to what Google is doing at all. So I was given free reign to work on that. As a matter of fact we still have a number of people working at Google who volunteer on a project and they've gone through similar process and get approved to do but it's the same sort of things like, "Good luck with that." During your seven years there. How did you how did you balance that are in terms of balancing your faith and family and we haven't talked about family. Mean I'd love to hear more about family and your wife and your children but where that came under you're in the story. Well you know it's interesting you mentioned that because that was the first thing that came to mind when I was thinking about balancing my faith is when I joined Google we had our first child six months later. So and then had another one to 20 months after that and then adopted twins after that. And so really my first four years ago were much more about learning to trade growing in the trade and investing in my family. You know lots of young kids running around. And then it was kind of after that season when I when I was able to apply or start thinking about applying my faith more directly as part of the technology that I was working on. Google was a phenomenal place. Kids are I was so awkward could work. How all your kids go. They give you great leave. They give you great support. They give you a free meal that you have the kids. I mean it's insane how much of or I got as a new father at Google and for the adoption process they were incredibly supportive. So yeah it's a good place to have kids. You know turning back towards the Christian side of what it's like to apply your faith there. I actually have generally found this extremely hard. There are some Bible studies that people do occasionally go to. There's one at Facebook that I've been to. There's one at Google and there's one at Apple and those are nice you know and I do know some examples of people who have really directly taken their faith or church principles and use that in the product development process. One of the guys who created Facebook groups is actually as far as I understand the lead on I sat down to talk with them about it. He built it as a test because he wanted to play for his church to be able to come out on Facebook this was gosh probably 10, 12 years ago now I don't even know how long ago it was but really interesting to see where he said I want to use technology to create a space for my church and me and build a building a very widely used feature on Facebook or the principle community and fellowship and be able to do that in space together online. And so there are some interesting examples of people who really have felt inspired. I think you've talked with Pat Gelsinger and his kind of vision of using you know his leadership role as being where as a platform for outreach and Christian principles is really cool and really neat. Sothere are those examples of that and they're not that common. What's much more common to me is one where there's a bit of a separation of the two. And I understand why that happens. I know a lot of Christians who I talked about hey when you come in apart from the tsunami talented designers, engineers, entrepreneurs who have decided that it would be much more interesting to go work on some sort of new messaging app or go work on even some sort of new like fantasy draft you know or something because they were just really excited that hey this is a hot market I want to be part of it and it's OK well that's fine but if it links to faith in God is very tenuous if at all, if not on the opposite side and there's an allure here there's just an absolute allure that you can use technology to create a business that's worth billions of dollars and that people are using all around the world. And if you're not doing that you're wasting your time. Is it really that that's kind of the thing that I keep hearing. If you're not creating a multibillion dollar business if you're not getting 100 million active users, you're wasting your time. And if that's if that's your only metric that you care about. Yeah maybe that's true but if you care about spiritual impact it looks totally different. And you know the e-mails that we get from people and the messages about people who have been dealing with self-harm issues who have stopped cutting themselves because they've been able to pray through it and people pray through grief and depression and really heavy hard things where they say thank you so much for doing that. This has made a significant difference in my life. You know to be able to look at and say I think that's a little more in line and it's not to say that I don't think that people can be in Google and you know practice their faith in your work. Absolutely they can if people who are but I think being open to a different perspective on what kind of impact God is calling us to make. You know, it is important to say that maybe God has called me to something different. Is that true or not true. And so but that's really uncommon. And in sort of the younger generation or do you see it changing at all do you see it the same as it was when you know 10 years ago or do you see any movement there? Because I mean a lot of the studies show that at least now if you look at millennials for example they seem to want to do something beyond themselves. They have a little bit more purpose orientation. But maybe that doesn't play out at the end of the day when they have to pay for college loans. They they still come back to I want to be part of something that's you know the highest and what are you seeing? I see some of that. I mean I would say most of the people working on the project are millennials. I'm kind of the old guy and my content director is well he's he's he's you know somebody from a different generation or not Millennial but I definitely have seen a lot of millennials who are interested. I think what's challenging for them is where does the rubber hit the road like. How does this actually work and what does it what does it look like for me to actually participate in this in a way that works with my schedule and everything. And then the realities kick in like a lot of our millennium. Once they get married and have kids drop off because they didn't like. You know you just hit a stage where it's really hard to do this unless you have an opportunity to do a full time. So there is some of that. We have seen the biggest challenge of Christians who have tried to do it by and large. There's this really weird thing that I found happens a lot of Christianity which is and again I'm almost contradicting myself because I would rather have this quantity side, geeky side I had to realize hey God can work in ways that I don't understand that's absolutely true. But a lot of people will say you know why God told me to build this thing or this app should exist because the Bible says this. I'm going to go build it and I'll say OK it's great that the Bible says that. Go look at the market and see how other people tried to build something similar. And what happened to it. Like does it actually work just because the Bible says something doesn't mean that a digital art is going to work. Your products may fail for other reasons outside of Scripture being true. And that's really where I felt this really and seeing this really weird thing even in the evidence of data where I've sat down with people who said OK great you want to build it up that looks like this here's 15 other apps that were got the Christian social networks. It's a great example. So many people have tried to build almost exactly the same Christian social network. And again again I'm like go look at this one go look at the City what happened why didn't that work. Go look at this one. Go look at this one. You will see no this has to work. And it says no it doesn't your product doesn't have to work. Like you know there can be fundamental flaws in the product it or how people use the product I mean the Bible's still true but your product is just not something that gives people value. And that's another interesting thing that I've run into and seen frequently that's where I feel like I try to differentiate at least or stay true is if the evidence shows that people are not using that digital product or not using that feature. I'm just stop it because and find something else to build. I'm not going to keep doing it just because the Bible says something that to take you to contravene biblical principles. It's just that behavior that having that feature just might not work. And so I think that's an interesting kind of challenge that I've seen in a lot of Christian technology enterprises. Right, but also to me it also seems that that there's sort of this by modal thinking where you can either go to Google and or you can do some technology thing or you can do something that's Christian. There doesn't seem to be like well you can also do what we were talking earlier. I mean maybe there's a technology that will help millions of people in Africa. You have to be sure. I mean you obviously are going to infuse your Christian beliefs and values into it but it doesn't have to be a Christian app or you know some other church based thing or that's sort of what I've seen too is that they sort of just gravitate towards OK. Selling into the Christian sort of cortico you know church or market versus taking something that's yet still technology but it helps people and through that somehow infusing your Christian faith in you know as a calling. So we're now talking a little bit more about, you talked about a little bit, about the app and just the people that are using it and benefiting from it. I mean you're you're the math geek and I've dived into that data. So what are you seeing and what have you sort of learned from it quantitatively or you mentioned a couple of the stories of people who've been changed by it? The data has been really fascinating and we're trying to publish more of this. Weactually just are research grant we're finalizing to research more of the evidence as well as benefits of what we're doing. But there are some just very simple things that make huge differences in people's lives. Building a habit of spending time with God every day. It's incredible the difference that that makes in people's lives. And that may seem self evident to people but it just turns out that people who have a regular devotional time or actually spend 5, 10, 15 minutes particularly in the morning with God have they're more consistent in prayer life and more consistent reading Scripture. They're generally even, I mean the data would suggest, they're happier that they're less stressed when we ran surveys around this of people representing how often they're meditating on the platform and what impact that has on things like stress. Basically nine or 10 people who experience stress regularly said if I stop to do this experience and meditate on God's word I feel less stress and they face lower depression and that data to me is phenomenally interesting. It just turns out I think on the flip side what we're doing is a lot like people say hey sell painkillers not vitamins because people want that they want the pain to go away not necessarily the other benefits. And I think that spiritual practices are a little bit have a problem being more of the vitamin and the work out is that you've got to put in the time. And a lot of people just don't. And that's something that really seems to be endemic in our society is just people feel too busy. I mean I've surveyed talked to so many users who have stopped using drugs. I want to know why and the number one thing is always I'm just too busy. They'll give you a 9 out of 10 rating on your content. This is awesome. This is life changing and I'm just too busy and I think from a data perspective we as a church I think this is actually really kind of an endemic problem as we've looked around and surveyed people. Is that a lot of people feel like they just have too much going on whether it's you know Facebook encroaching Netflix encroaching or gaining time or work requirements and being always on culture. You know it's hard for me to say what are the drivers of that. But the data suggest pretty strongly that it's an overwhelming sentiment of just having too much going on being too busy. And what that's doing is eroding people's time with God and time to kind of really connect with God. I don't know where that leads and how we change that trend. But I know it works fine to make our impact or we can. But that's been one pretty significant thing. The other thing that's really interesting is what people do when they have negative emotional experiences. A lot of our product usage comes because people have a downer that people don't have a devotional time. The reason they use our products is that they feel down. They feel all lonely they feel panic attacks as one that comes up all the time like just overwhelmed. So there's this Grammy Award winning artist Mandisa said who sent her through Youversion and she was like tweeting out how she was using it and it was fascinating. What are your issues like. Abide saved me in traffic today. I was just trying to avoid Jesus was there and if I say. That's an interesting thing is that people come in feeling down. And what that pick up and feeling the sense of. So those are some really interesting things I think other data that's really interesting or has been hard for me to swallow and I don't know what to do with it. Number one if you ask people who they prefer we surveyed 20,000 people in the question of course you know the number one person that people pray for. If you give them a list of who in your life you pray for the most? It's himself. Yes. And so it's pretty obvious that certain family and other things come down the list. But in reality when we tried experiments we found that at least digitally it has been harder than we had hope to really motivate people to pray for others. What they typically do is when they say I'm praying for you what you're saying is I'm thinking of you and I what I wish you well not necessarily I'm going to go intercede to the God of the universe on your behalf that you know these things will be true and a lot of people don't know how and they feel overwhelmed with their own prayer life. And that's a really fascinating kind of result. So what do you do with that. You know and I'm not sure that digital is the right way to solve it. I actually think it's probably not the right way is probably just more people getting together in person praying for each other. But even there you know when we've done the studies most small groups of people when they get together they spend almost all their time not praying but sharing because people want to share. And then there's a quick closing parent. It's like oh my gosh we forgot for the right time looking for somebody close us. You know I don't know what to make of that data. But that's really strongly what the data suggests and the status of the church is pro-life so I'm not saying it's right or wrong I'm just saying that's what we're seeing now. Again that's probably what we pivoted towards hey we're going to help you pray for yourself because that's where the market and that's the question, "Neil, is that even right?" "Are you doing the right thing by enabling this self-focused behavior?" Well the Bible does say that talking to God is a good thing. So we're going to at least do what we can do. And that's where people use our product for. Right, hard to change habits and behavior with an app. But maybe there are some ways you can I guess I mean maybe a checklist of things they have to do to be you know certified on the app by your brain before they can pray for somebody else first and then maybe a shared thing where you could share it with your friend and say I just prayed for you in a little share thing. I don't know. It sounds like an interesting one. Now as far as the the model itself so it's a free app but there'sf a paid version is there advertising?Tell us about the business model. Yes sure. It is freemium that's I think I was just reading a status symbol with 95 percent of the revenue iTunes come from freemium products. So we have a bunch of free resources on there that you can play through. And then our guides which are structured plans that will take you through are topics those are paid as well as our longer daily meditations we give a free two minute. And then if you want to a longer one and we see a pretty reasonable conversion rate in that and then we do have a little bit of advertising that comes through partners who have spiritual formation content. We have our policy strictly say it needs to apply to like spiritual formation and actually helping people would obviously be biblical and then we include some of those ads and offers that gets sent out to our audience. It's generally working. I mean our goal was really sustainability and we're extremely fortunate that we're very close to being sustainable in this. I wouldn't say we're thriving at just a lot of things we can't because we don't have the resources coming in but it in general is working and it is hard though for me personally I really don't like prey on people from religious experience say come in and spend time with Jesus. Then say you've got to pay. But when we ran experiments and tests we were not able to successfully get enough giving kind of support to make it saleability and lead. We had good content and a good flow and a paywall and people were like hey I'm totally going to pay for this. And so that's the reality of where the business is at and something that we continue to kind of pray about and think about. If you look at our our one star reviews, a vast majority of our one star views come from people who, andwe have a high rating and they AppStore so that many but they come from people who are like I can't believe you're making me pay for the one word of God so they're turned off by that. It's hard and I get that perspective but on the flip side you know so what do you what do you want me. Is your expectation is then that you know I'm going to get together some of the best techies who have come out of Google and these other places and we have to live in the Bay Area. And pay of an office in the Bay Area and pay for serving cost and that you know does the workers deserve their wages or not? I get both sides of it. Now, you had funding as well. Is that just friends and family? We did get funding. We were very fortunate we got funding from a lot of higher net worth Christians and Christian foundations we had Hobby Lobby and family support us and MacLellan foundation out of Tennessee which is a really big Christian foundation supported us. David weekly foundation out of Texas. I think a lot of them were really excited to see what could happen if they support people with this kind of background to go into the market. And we had to get really creative though. And when you're running a startup you have to get creative and actually a lot of our investment actually came through a vehicle out of Kansas City that the National Christian foundation helped set up. So that does sound a lot of foundations actually wrote nonprofit check like tax deductible a 501(c)(3) money to a charity that they invested in us. And when their is liquidity event meaning we need to pay a dividend or somebody buys whatever happens that money goes back to the charity that gets regifted back out to other causes. It's an unusual model but something that really made sense to a lot of politicians who said hey this is really interesting. I see the spiritual impact you can make and I might actually get my money back one day or back you know two three five acts in order to get it away again. And that was that was a really interesting thing. That sounds like a pretty interesting, creative route to go. And maybe some of the research aspects as well have some value. Exactly, those research aspect came to those same thing with these Christian foundations that hey we want to know how can this be helpful. Here's some research grant money in order to advance this. So you know we just kind of had to cobble it together and there was no way that really looked like we were going to get so big A-round from some. You know we're out to be honest that would have been probably bad for us because their expectations are lightning fast growth at all costs and a lot of times if you're not you know CEOs get fired, missions you change everything. So our investors are extremely aligned with the outcome that we want which is sustainable business biblically impacting people's lives. It is hard though. I was just going to ask, so I mean you went from Google which you know like you said all of the support you could get, when you have kids, the lunch area. I mean you got all the support and then from that to sort of on your own. I mean how is that transition to employee to founder? I was fortunate that I was able to save up some money and get some family support quite frankly too. I mean I basically went for like two years taking no salary. You know four kids in the Bay Area that's life and my main co-founder you know that we're starting way below market salaries to do this. That's just the nature of it and I think you're not ready for that, you're not you know carrying the cost before you're going to do something. So that's investment. Now the flip side of it is to have a subscription business like we do because once you build out of a good subscribers and you give them a really good product that's making a difference in their life they tend to stick around that I really see in the next couple of years the opportunity for us to take the resources that are coming in from Abide and build additional products and features that are going to help with people's spiritual life. That will be hugely impactful and I'm not going to have to go out talking to 250 people in order to get 10 investors to get it. You know it's an exhausting process. It's hard though. I mean I think that some of this if you're going to try to come in and do this kind of spiritual benefit technology, you got to try to be really smart about making sure you have enough resources that you can actually give it a try and not fail because you didn't have the resources and to know it's going to take you twice as long and twice as much money as you thought it was to get. Right. And I think that's good advice for probably any startup right down the runway as it is not always as long as you would like to. Talk a little bit about just you know, you've mentioned this throughout your life, but you know some of those decision points like this one you know to start to go and abide and what method steps resources you used if any? Or was it really more of God kind of just putting you on a path and you didn't really have much of a choice there like you're going to do this or what went through your life? I mean if you could talk maybe a couple examples or put forks in the road in terms of relying on either resources or your faith in making decisions? That's a great question. It almost seems like it boils down to a couple of different things. I think that there is a set of decisions like when Nadia and I were talking about adopting together. My wife and I you know we knew James 1:27 that helping orphans and widows their distress is a good thing. I can't say that there was a particular moment where I said man I absolutely feel God's Spirit saying you need to adopt. It was a good thing and we had seen kids who were in need and we wanted to be part of our family. And the decision process was much more of a this is something that God says is true and we want and have the space to pour into other children in our family. And we've had a number of those kinds the ones where I can't say I heard anything directly from God other than here's some scriptures that are true. And you know confirming with other ventures and some may have had some little like this project which it had a biblical basis to it. But really there were very specific times and we even had this one guy who prophesied over me and I know people come from different or traditional evangelical and whatever mainline charismatic people always liked that but it was fascinating. He without having no clue what we're working on literally prophesied down to the name that we were using for that. He started talking about John 15:7 if you know if you abide in me and my word abides and you ask for the good wish. And he was like you know I see a platform of prayer and all these people connected on it and very specific things including the ethnicity of people would be working like you're like really I mean I guess that makes it very very very interesting things that was there. Well what I do. What do we do with that. You know now we've got this is well in just personally words of knowledge maybe that I heard. Including my favorite which was I really had a little white feel like God told me you're not big enough to understand what I do in prayer which is really humbling to say. OK. So we're going to go build a product or a behavior that I fundamentally I'm not big enough to understand like I don't actually get how the product works. That is kind of mind blowing. Well what do you do without to make a decision to leave a great career at a company where I make a ton of money and I get really good vacation and I work on meaningful things to do this project work. I fundamentally don't really know how God works and I really I mean I know principles you know spiritual behaviors and practices. But one of them that I can give you that is really fascinating. Again this is hypothesis I'm not going to say and tell the truth but there's something about praying a prayer and saying OK God do with this what you will when we do these guided prayer. I don't know the people who are listening to them or in terms of what they are going through what God is going to do with that. But we pray that they will say OK we're going to guide you through this and in faith we are praying that God will do something with us because it's based in God's Word from Scripture and we're just taking you through reflective questions and praying that this will be true in your life. God's word which you like indicated about is somehow i think god multiplies that in the heavenly realms to actually work. I just think when David wrote Psalms you know he was like I'm writing this psalm you know psalm of scent or lament or whatever because this is an expression that calls me a in prayer and you know in some way when I'm reading that something is happening. And so it's been really interesting from the decision point perspective when you say trying to have a framework that really makes a lot of sense. And that being open to the mystery piece ideally both must come together and there's strong confirmation was you that's not always the case and sometimes you've got to just keep plowed forward anyway but at least have a record of what's happened. I think that's one of the toughest things in starting a business is you just get slammed. I mean you know things happen. We had times when iTunes subscription just quit working. They were like we have a bug and all those subscribers you have are now getting turned off. What? How am Ito run a business we're going to go out of business if this happen,s it continues happening. And you know but looking back and saying I could call this God just put me in his face I'm not leaving. It as has proven to be something that materialize them together. While we were talking I went on your app. I noticed there's a making a decision path that you could go down. So yes they could do that, too. Certainly people were listening. So as far as you know young people or people are in a career like like you were thinking about well you know I really want to start this startup. I would really want to start this technology company wherever they may be that may be in the Bay Area or maybe somewhere else. What advice would you give them? Find good people to do it with. Don't go it alone. That would be my number one thing. Find mentors, find investors, find coworkers and colleagues and if you can't then you're probably not going to get anywhere. That's been my support along the way are just great people to work with. What's up next for you? What can we pray for for for you? For Carpenters Code and Abide. What are some of things coming up or that you're working on for the rest if the year? That's a great question. I think you know one of the things that as we develop this business we were expecting it to be more of a platform where we would either aggregate content or to be user generated content. We're actually a media company more than a technology company meaning we created publish media. And along with that we create books that we create devotionals that we create you know the essential how to meditation. Well we weren't expecting to but now we have this incredible data and insight into what works. That's a new path for us that I would love prauer for to say what is the right answer to do there? And you know just to continue to be faithful and work on the right things and not distracted by the wrong ones because there's always a lot to do with. So doing the right things and not wasting your time on the wrong things is extremely important so I would appreciate those. Oh absolutely. It will definitely for that and continue to pray for success for Abide and your organization and keep going ahead and loved to hear stories who do take the big step in faith. And after being at a big company like Google or others where it is definitely a big step ain faith. Congratulate you on that and wish you the best of success and hopefully you can continue to keep in touch and on looking at your progress and everybody go check out the Abide app and share it with friends. Thank you a much. It's been a pleasure being on your show. Likewise. Good talking to you Neal and we'll definitely be talking soon. Thank you for joining the Purpose Nation Podcast. For more great interviews. resources or to make your tax deductible contribution to support our nonprofit ministry. Please visit PurposeNation.org. This program is copyright Purpose Nation, Inc. a 501(c)(3) nonprofit corporation.
As an innovative training organisation Total Focus brings you the very latest and most effective techniques from a variety of training methods and many years experience of working as a trainer and delivering training programmes. These range from half-day workshops to year-long programmes, bespoke training designed for your business or organisation through to approved QQI nationally accredited training modules. Derived from some of the most trusted techniques used in coaching, both from leadership executive coaching to personal coaching, the information contained on the following pages has been designed and tested by Total Focus to help bring progress and balance into your life. With the ever-increasing pressures and demands of modern life, it can be all too easy to lose motivation and direction in your life. Total Focus runs workshops under three main headings. For the team/organisation Personal Development Start-up business All the workshops are training sessions either for a half day / full day and or longer. Stillorgan area 13 & 14 Oct, 08 & 09 Dec 2018, 19 & 20 Jan 2019 .. etc.
title: 'Longest Common Subsequence' date: 2002-11-25 00:00:00 probid: 10405 uvaid: 1346 translator: "Luckycat" transource: "Lucky 貓" transurl: "http://luckycat.kshs.kh.edu.tw/homework/q10405.htm" categories: "Volume - 104" tags: - LCS --- 給你 2 個字串,請你輸出他們的最長共同子字串 (longest common subsequence) 的長度。例如:給你以下 2 個字串: abcdgh aedfhr 他們的最長共同子字串為 adh,長度為 3。 ## Input ## 輸入含有多組測試資料。每一組測試資料 2 列,分別代表這 2 個字串 (最多 1000 個字元)。 ## Output ## 每組測試資料輸出他們的最長共同子字串 (longest common subsequence) 的長度。 ## Sample Input ## a1b2c3d4e zz1yy2xx3ww4vv abcdgh aedfhr abcdefghijklmnopqrstuvwxyz a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0 abcdefghijklmnzyxwvutsrqpo opqrstuvwxyzabcdefghijklmn ## Sample Output ## 4 3 26 14
pelisalacarta ============= XBMC plugins for spanish TV and movies on demand
from django.conf.urls import include, url from . import admin, custom_has_permission_admin, customadmin, views urlpatterns = [ url(r'^test_admin/admin/doc/', include('django.contrib.admindocs.urls')), url(r'^test_admin/admin/secure-view/$', views.secure_view, name='secure_view'), url(r'^test_admin/admin/secure-view2/$', views.secure_view2, name='secure_view2'), url(r'^test_admin/admin/', admin.site.urls), url(r'^test_admin/admin2/', customadmin.site.urls), url(r'^test_admin/admin3/', (admin.site.get_urls(), 'admin', 'admin3'), dict(form_url='pony')), url(r'^test_admin/admin4/', customadmin.simple_site.urls), url(r'^test_admin/admin5/', admin.site2.urls), url(r'^test_admin/admin7/', admin.site7.urls), url(r'^test_admin/has_permission_admin/', custom_has_permission_admin.site.urls), ]
<?php /** * * Copyright (C) 2010 Arie Nugraha ([email protected]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ /* Visitor Report by Day */ // main system configuration require '../../../../sysconfig.inc.php'; // start the session require SENAYAN_BASE_DIR.'admin/default/session.inc.php'; require SENAYAN_BASE_DIR.'admin/default/session_check.inc.php'; // privileges checking $can_read = utility::havePrivilege('reporting', 'r'); $can_write = utility::havePrivilege('reporting', 'w'); if (!$can_read) { die('<div class="errorBox">'.__('You don\'t have enough privileges to access this area!').'</div>'); } require SIMBIO_BASE_DIR.'simbio_GUI/form_maker/simbio_form_element.inc.php'; require SIMBIO_BASE_DIR.'simbio_UTILS/simbio_date.inc.php'; // months array $months['01'] = __('Jan'); $months['02'] = __('Feb'); $months['03'] = __('Mar'); $months['04'] = __('Apr'); $months['05'] = __('May'); $months['06'] = __('Jun'); $months['07'] = __('Jul'); $months['08'] = __('Aug'); $months['09'] = __('Sep'); $months['10'] = __('Oct'); $months['11'] = __('Nov'); $months['12'] = __('Dec'); $page_title = 'Visitor Report by Day'; $reportView = false; if (isset($_GET['reportView'])) { $reportView = true; } if (!$reportView) { ?> <!-- filter --> <fieldset style="margin-bottom: 3px;"> <legend style="font-weight: bold"><?php echo strtoupper(__('Visitor Report')); ?> - <?php echo __('Report Filter'); ?></legend> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>" target="reportView"> <div id="filterForm"> <div class="divRow"> <div class="divRowLabel"><?php echo __('Year'); ?></div> <div class="divRowContent"> <?php $current_year = date('Y'); $year_options = array(); for ($y = $current_year; $y > 1999; $y--) { $year_options[] = array($y, $y); } echo simbio_form_element::selectList('year', $year_options, $current_year); ?> </div> </div> <div class="divRow"> <div class="divRowLabel"><?php echo __('Month'); ?></div> <div class="divRowContent"> <?php $current_month = date('m'); $month_options = array(); foreach ($months as $idx => $month) { $month_options[] = array($idx, $month); } echo simbio_form_element::selectList('month', $month_options, $current_month); ?> </div> </div> </div> <div style="padding-top: 10px; clear: both;"> <input type="submit" name="applyFilter" value="<?php echo __('Apply Filter'); ?>" /> <input type="hidden" name="reportView" value="true" /> </div> </form> </fieldset> <!-- filter end --> <iframe name="reportView" id="reportView" src="<?php echo $_SERVER['PHP_SELF'].'?reportView=true'; ?>" frameborder="0" style="width: 100%; height: 500px;"></iframe> <?php } else { ob_start(); $visitor_data = array(); // year $selected_year = date('Y'); if (isset($_GET['year']) AND !empty($_GET['year'])) { $selected_year = (integer)$_GET['year']; } // month $selected_month = date('m'); if (isset($_GET['month']) AND !empty($_GET['month'])) { $selected_month = $_GET['month']; } // query visitor data to database $_visitor_q = $dbs->query("SELECT SUBSTRING(`checkin_date`, 9, 2) AS `mdate`, COUNT(visitor_id) AS `vtotal` FROM `visitor_count` WHERE `checkin_date` LIKE '$selected_year-$selected_month%' GROUP BY DATE(`checkin_date`)"); while ($_visitor_d = $_visitor_q->fetch_row()) { $date = (integer)preg_replace('@^0+@i', '',$_visitor_d[0]); $visitor_data[$date] = '<div class="data">'.($_visitor_d[1]?$_visitor_d[1]:'0').'</div>'; } // generate calendar $output = simbio_date::generateCalendar($selected_year, $selected_month, $visitor_data); // print out echo '<div class="printPageInfo">Visitor Report for year <strong>'.$selected_year.'</strong> <a class="printReport" onclick="window.print()" href="#">['.__('Print Current Page').']</a></div>'."\n"; echo $output; $content = ob_get_clean(); // include the page template require SENAYAN_BASE_DIR.'/admin/'.$sysconf['admin_template']['dir'].'/printed_page_tpl.php'; } ?>
{% extends "base.html" %} {% if user.is_authenticated %} auth <a href="{% url 'food_new' %}" class="top-menu"><span class="glyphicon glyphicon-plus"></span></a> {% endif %} <h1><a href="/food">Food</a></h1>
We are a Miami, Florida established insurance agency specializing in AAA insurance. We have been helping Florida residents in Shalimar find the right insurance coverage for well over a decade. Shalimar | FL Essential concerning AAA insurance in Shalimar | FL and also the 32579 vicinity also including AAA condo insurance discounts services. Condo insurance is not mandated in The sunshine state, but your condo association can still require you to get coverage. While condo associations have to purchase a minimum amount of their own insurance, these plans often don't deal with destruction to your individual belongings, your personal liability or harm to your condo's structural elements. Condo insurance offers financial protection by delivering insurance coverage for these kinds of possibilities. A condo insurance plan in Florida may likely amount to just $20 to $50 monthly, depending on your condo's area, construction and the extent of policy coverage you get. Though condo associations are normally mandated to carry insurance, Florida Regulations don't mandate your association's protection plan to incorporate most accessories and systems unique to your condo. Because of this, you might be responsible for destruction to and substitute of any personal possessions, the condo's floors and wall structures, electric equipment and appliances, hot water heater and filters, integral fittings, and window treatments. You're not required to bear insurance for these particular products, but it may be simple to protect yourself financially. Condo image source insurance, also referred to as an HO-6 insurance plan, is similar to homeowners insurance in that it covers your private property, liability and a few structural explanation parts more hints of your condo. Nevertheless, condo insurance is top article commonly called "walls-in coverage," as it provides limited protection for damage to the building that occurs outside your condo. You can obtain condo coverage whether you're leasing a condo or purchasing a condo. Depending on the level of protection you'd like, you can certainly get a condo insurance plan in Florida for either the market value or replacement cost of your home and possessions. A replacement cost policy is more costly, as it covers any affected possessions, as high as your policy's caps, without taking into consideration depreciation. Condo insurance policies can be individualized to your wishes and risk assessments, and the majority of insurance policies come with the following coverage possibilities.
One problem I never have when waking up in the morning, is wondering what to do today. It is a privilege to live a life dedicated to creative endeavours. There is also the adventure and challenge of dealing with daily life, I’m sure you know exactly what I mean. Just yesterday the dogs treed a troupe of monkeys in one of the big bush willows behind the pond. I spent quite some time out there admiring the monkeys and wishing I could understand the comical curses and sign language they were hurling at the dogs. Then I distracted the dogs with a snack and a walk so the monkeys could make a safe escape. It was a few hours till I got back to work. All that time I was supposed to be at my sewing table but what the heck, we only get to live this one life! You will find a small Newsletter with Sew Along dates and Saturday Workshops for the second quarter of 2013 as a PDF HERE. We also have an all day bear making workshop on the first Saturday of every month. This is great for beginner bear makers, and for those who want to spend a stretch of time with their works in progress. It would be lovely if you join us at Sew Along, or one of the Saturday workshops. Polymer clay play. This is not a workshop. I am busy making dolls house food and clay pins at the moment. You can copy what I am doing, pick a project from a book or magazine, or just bring your clay and make whatever you feel like. I will be available to answer questions and to assist if you get stuck. This month the studio has acquired a dedicated clay oven, what luxury! I’ve tried it out and it is working beautifully. I’m eager for you to help me put it to good use :-) Cost R 55. Sew Along. Bring any project that you are working on, bears, dolls, beading, crochet, whatever, and sew along with us. I will be available to answer questions and to assist if you get stuck. We will also have a sort discussion about pandas, and I will show you how to alter a one-colour bear to incorporate two or more colours. Cost R 55. Polymer clay play. This is not a workshop. I am busy making dolls house food and clay pins at the moment. You can copy what I am doing, pick a project from a book or magazine, or just bring your clay and make whatever you feel like. I will be available to answer questions and to assist if you get stuck. This month the studio has acquired a dedicated clay oven, what luxury! I’ve tried it out and it is working beautifully. I’m eager for you to help me put it to good use :-) Cost R 55 per session. There will be tea and biscuits all day long. You are welcome to stay for the day, just bring your own snack for lunch. A mohair teddy with needle felted face and paw pad details. This is going to be an advanced workshop, and will incorporate many techniques apart from needle felting. It will be a full day Saturday workshop, or complete the bear in two sessions on a weekday. If you are interested and would like to put your name down for a place already, you can let me know. More details and pictures available soon.
from setuptools import setup setup(name='joinmarket_core', version='0.1', description='Joinmarket library for Bitcoin coinjoins', url='http://github.com/Joinmarket-Org/joinmarket', #author='Flying Circus', #author_email='[email protected]', license='GPL', packages=['joinmarket_core'], install_requires=['libnacl',], zip_safe=False)
Sun Song from the Ocarina of Time, introduced in Majora's Mask medley - the Zelda Orchestra. "Stravinsky's music from the 'Firebird' was a showcase for the RSO woodwinds and percussion, and Constantine led one more high-energy, colorful performance of a work that still sounds as fresh as the day it was created. In Sierra's Cancionero Sefardi, (soprano Jody Karin Applebaum) sang against microtonal instrumental lines, illuminating the cross-references of Latin tradition and the ancient Jewish song style. The ensemble of flute, piano, clarinet, violin and cello built clouds of sound. Against those undulating tones, Applebaum revealed humor, sensuality and playfulness." "Orchestra 2001 'Latin Masterpieces' Concert" From eighteen years worth of experience with the new music ensemble Orchestra 2001, Lois Bliss Herbine has worked closely with 20th and 21st Century composers such as Tan Dun, Gunther Schuller, George Rochberg, Peter Schickele and Andrea Clearfield. As Herbine's performances on solo flute and piccolo are known for their colorful expression (as are those of her colleagues pianist Charles Abramovic, harpist Sophie Bruno, flutist Pamula Guidetti, and cellist Lori Barnett) these details are evident in the reviews, especially within the five to thirteen member chamber ensemble- Orchestra 2001 reviews. Her piccolo, flute, alto flute and bass flute can be heard in five commercial recordings with Orchestra 2001 on the New World Records and Albany labels. "Crumb's 1993 Variations for Cello and Chamber Ensemble is the major prize on the disc... how can you argue with its intoxicating range of instrumental color?" "At a time when a performance of a new orchestral work has become a rare event, and when we are less and less surprised to hear such music performed poorly by one of the giants of the industry, there are fewer and fewer orchestras truly dedicated exclusively to this music. Fortunately, among those few there is Orchestra 2001. Based in Philadelphia; this ensemble is showing those giants how it's done. Its dedication to the performance of new music is not only admirable, but also vital to the defining and preserving of the music of our time."
#include <tk.h> #include <X11/Xlib.h> #include <X11/keysym.h> #include <xcircuit.h> #include <tk.h> #include <tkPlatDecls.h> #include <X11/cursorfont.h> extern Tcl_Interp *xcinterp; extern XCWindowData *areawin; extern char* TkKeysymToString(KeySym ks); static void unimplemented(const char *str) { printf(">>>>>>>>> Unimplemented: %s\n", str); } typedef struct font_item { Tk_Font tkfont; Font fid; struct font_item *next; }; static struct font_item *font_map = NULL; static void add_tkfont(Tk_Font tkfont, Font fid) { struct font_item *item = (struct font_item*)malloc(sizeof(struct font_item)); item->next = font_map; font_map = item; item->tkfont = tkfont; item->fid = fid; } static Tk_Font get_tkfont(Font fid) { struct font_item *item = font_map; while (item != NULL) { if (item->fid == fid) return item->tkfont; item = item->next; } fprintf(stderr, "Font not found: ID=%d\n", fid); return (Tk_Font)NULL; } #ifndef STATIC_BUILD int XDrawPoint(Display *dpy, Drawable d, GC gc, int x, int y) { HDC hdc; HWND hwnd; hwnd = Tk_GetHWND(d); if (IsWindow(hwnd)) { hdc = GetDC(hwnd); SetPixelV(hdc, x, y, gc->foreground); ReleaseDC(hwnd, hdc); hdc = NULL; } else { /* This is pretty slow when called a lot hdc = CreateCompatibleDC(NULL); SelectObject(hdc, hwnd); SetPixelV(hdc, x, y, gc->foreground); DeleteDC(hdc); */ } return 1; } #endif int XClearArea(Display *dpy, Window w, int x, int y, unsigned int width, unsigned int height, Bool exposures) { HWND hnd; RECT r; HDC hdc; int oldROP; hnd = Tk_GetHWND(w); hdc = GetDC(hnd); oldROP = SetROP2(hdc, R2_COPYPEN); GetClientRect(hnd, &r); if (width != 0 || height != 0) { r.left = x; r.top = y; r.right = x+width; r.bottom = y+height; FillRect(hdc, &r, (HBRUSH)(COLOR_WINDOW+1)); } SetROP2(hdc, oldROP); ReleaseDC(hnd, hdc); return 1; } Pixmap XCreatePixmap(Display *dpy, Drawable d, unsigned int width, unsigned int height, unsigned int depth) { return Tk_GetPixmap(dpy, d, width, height, depth); } int XLookupString(XKeyEvent *event, char *buf, int buflen, KeySym *keysym, XComposeStatus *status) { #if 0 printf("code : %04x\n", event->keycode); printf("state: %04x\n", event->state); #endif switch (event->keycode) { case VK_NUMPAD0: case VK_NUMPAD1: case VK_NUMPAD2: case VK_NUMPAD3: case VK_NUMPAD4: case VK_NUMPAD5: case VK_NUMPAD6: case VK_NUMPAD7: case VK_NUMPAD8: case VK_NUMPAD9: *keysym = XK_KP_0 + (event->keycode - VK_NUMPAD0); event->state |= ShiftMask; break; default: *keysym = XKeycodeToKeysym(NULL, event->keycode, event->state); break; } return 1; } Bool XCheckWindowEvent(Display *dpy, Window w, long event_mask, XEvent *event) { unimplemented("XCheckWindowEvent"); return False; } int XTextWidth(XFontStruct *font, char *string, int len) { Tk_Font tkfont = get_tkfont(font->fid); return Tk_TextWidth(tkfont, string, len); } int XDrawString(Display *dpy, Drawable d, GC gc, int x, int y, char *string, int len) { Tk_Font tkfont = get_tkfont(gc->font); Tk_DrawChars(dpy, d, gc, tkfont, string, len, x, y); return 1; } int XFreePixmap(Display *dpy, Pixmap pix) { Tk_FreePixmap(dpy, pix); return 1; } #ifndef STATIC_BUILD int XPutImage(Display *dpy, Drawable d, GC gc, XImage *img, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height) { // unimplemented("XPutImage"); TkPutImage(NULL, 0, dpy, d, gc, img, src_x, src_y, dest_x, dest_y, width, height); return 1; } #endif // The following two functions may be defined as macros. . . #ifndef XSync int XSync(Display *dpy, Bool discard) { unimplemented("XSync"); return 1; } #endif #ifndef XFlush int XFlush(Display *dpy) { unimplemented("XFlush"); return 1; } #endif #ifndef STATIC_BUILD Cursor XCreateFontCursor(Display *dpy, unsigned int shape) { Tk_Window win = Tk_MainWindow(xcinterp); switch (shape) { case XC_xterm: return (Cursor)Tk_GetCursor(xcinterp, win, "xterm"); case XC_watch: return (Cursor)Tk_GetCursor(xcinterp, win, "watch"); default: return (Cursor)NULL; } } #endif void XDefineCursor_TkW32(Display *dpy, Window w, Cursor c) { Tk_DefineCursor(Tk_IdToWindow(dpy, w), (Tk_Cursor)c); } static u_char reverse_byte(u_char c) { u_char rc = 0; int i; for (i=(sizeof(char)*8-1); i>=0; i--, c>>=1) rc |= (c&0x01) << i; return rc; } static void compute_cursor_src_mask(u_char *src, u_char *mask) { u_char pixsrc = *src, pixmask = *mask; *src = ~(reverse_byte(pixmask)); *mask = reverse_byte(~pixsrc & pixmask); } typedef struct tkw32cursor { struct tkcursor { Tk_Cursor cursor; Display *display; int resourceCount; int objRefCount; Tcl_HashTable *otherTable; Tcl_HashEntry *hashPtr; Tcl_HashEntry *idHashPtr; struct tkcursor *nextPtr; } info; HCURSOR winCursor; int system; } w32cursor; static Cursor Tk_GetCursorFromData_TkW32(Tcl_Interp *interp, Tk_Window w, u_char *src, u_char *mask, int width, int height, int xhot, int yhot, Tk_Uid fg, Tk_Uid bg) { w32cursor *wcursor; wcursor = (w32cursor*)ckalloc(sizeof(w32cursor)); wcursor->info.cursor = (Tk_Cursor)wcursor; wcursor->winCursor = NULL; wcursor->system = 0; wcursor->winCursor = CreateCursor(Tk_GetHINSTANCE(), xhot, yhot, width, height, src, mask); if (wcursor->winCursor == NULL) { ckfree((char*)wcursor); return (Cursor)NULL; } return (Cursor)wcursor; } Cursor CreateW32Cursor(Tcl_Interp *interp, Tk_Window w, u_char *src, u_char *mask, int width, int height, int xhot, int yhot, Tk_Uid fg, Tk_Uid bg) { u_char *new_src, *new_mask; int nb = (width-1)/(8*sizeof(char))+1; int nb2 = (GetSystemMetrics(SM_CXCURSOR)-1)/(8*sizeof(char))+1, height2 = GetSystemMetrics(SM_CYCURSOR); int i, j, idx1 = 0, idx2 = 0; Cursor cursor; new_src = (u_char*)malloc(sizeof(char)*nb2*height2); new_mask = (u_char*)malloc(sizeof(char)*nb2*height2); for (j=0; j<height; j++) { for (i=0; i<nb; i++, idx1++, idx2++) { new_src[idx2] = src[idx1]; new_mask[idx2] = mask[idx1]; compute_cursor_src_mask(&new_src[idx2], &new_mask[idx2]); /*printf("%02x ", new_src[idx2]);*/ } for (i=0; i<(nb2-nb); i++, idx2++) { new_src[idx2] = 0xff; new_mask[idx2] = 0x00; /*printf("%02x ", new_src[idx2]);*/ } /*printf("\n");*/ } for (j=0; j<(height2-height); j++) { for (i=0; i<nb2; i++, idx2++) { new_src[idx2] = 0xff; new_mask[idx2] = 0x00; /*printf("%02x ", new_src[idx2]);*/ } /*printf("\n");*/ } /*printf("\n");*/ cursor = Tk_GetCursorFromData_TkW32(interp, w, new_src, new_mask, nb2*8, height2, xhot, yhot, fg, bg); free(new_src); free(new_mask); return cursor; } int XRecolorCursor(Display *dpy, Cursor cursor, XColor *foreground, XColor *background) { unimplemented("XRecolorCursor"); return 1; } Status XAllocNamedColor(Display *dpy, Colormap cm, char* cname, XColor *screen_return, XColor *exact_return) { XColor *c = Tk_GetColor(xcinterp, (areawin ? areawin->area : NULL), cname); if (c != NULL) { screen_return->pixel = c->pixel; exact_return->pixel = c->pixel; return True; } return False; } Status XLookupColor_TkW32(Display *dpy, Colormap cmap, const char *name, XColor *cvcolor, XColor *cvexact) { if (XParseColor(dpy, cmap, name, cvcolor)) { return True; } else { return False; } } int XQueryColors_TkW32(Display *dpy, Colormap cmap, XColor *colors, int ncolors) { int i; for (i=0; i<ncolors; i++) { int pixel = colors[i].pixel; colors[i].red = ((pixel&0x000000ff)<<8)|(pixel&0x000000ff); colors[i].green = (pixel&0x0000ff00)|((pixel&0x0000ff00)>>8); colors[i].blue = ((pixel&0x00ff0000)>>8)|((pixel&0x00ff0000)>>16); } return 1; } Bool XQueryPointer_TkW32(Display *dpy, Window w, Window *root_return, Window *child_return, int *root_x, int *root_y, int *win_x, int *win_y, unsigned int *mask) { POINT p; GetCursorPos(&p); *root_x = p.x; *root_y = p.y; ScreenToClient(Tk_GetHWND(w), &p); *win_x = p.x; *win_y = p.y; *mask = 0; return True; } Colormap XCopyColormapAndFree(Display *dpy, Colormap cmap) { unimplemented("XCopyColormapAndFree"); return cmap; } char* XDisplayString(Display *dpy) { /*printf("XDisplayString\n");*/ return "localhost:0.0\n"; } char* XKeysymToString_TkW32(KeySym ks) { return TkKeysymToString(ks); } XFontStruct* XLoadQueryFont(Display *dpy, char *fontname) { Tk_Font tkfont; Tk_FontMetrics tkfm; XFontStruct *fs; tkfont = Tk_GetFont(xcinterp, Tk_MainWindow(xcinterp), fontname); if (tkfont != NULL) { fs = (XFontStruct*)malloc(sizeof(XFontStruct)); fs->fid = Tk_FontId(tkfont); Tk_GetFontMetrics(tkfont, &tkfm); fs->ascent = tkfm.ascent; fs->descent = tkfm.descent; add_tkfont(tkfont, fs->fid); return fs; } else return NULL; } DIR* opendir(const char *name) { DIR *d = (DIR*)malloc(sizeof(DIR)); static char buffer[MAX_PATH]; strncpy(buffer, name, MAX_PATH); strncat(buffer, "\\*", MAX_PATH); d->hnd = FindFirstFile(buffer, &(d->fd)); if (d->hnd == INVALID_HANDLE_VALUE) return NULL; d->dirty = 1; return d; } void closedir(DIR *d) { free(d); } struct direct* readdir(DIR *d) { if (!d->dirty) { if (!FindNextFile(d->hnd, &(d->fd))) return NULL; } d->d.d_name = d->fd.cFileName; d->dirty = 0; return &(d->d); }
The First License Stick Arts ® Café in Malaysia located at NU Sentral Kuala Lumpur was officially launched on the 29 November 2016. Stick Arts is an ice cream bar concept using the best Italian ingredients and equipments to produce Gelato, Yogurt & Sorbet made fresh daily with more than 38 flavors with less air. The uniqueness of the Stick Arts ® Café is to cater to the needs of creative & delicious dessert dining with the introduction of more than 50 unique hand crafted new design 3D Italian ice cream stick (Exclusively in South East Asia), 3D cakes, Chocolate Frozen Cake, Fancy Ganache, Pralines set, Hot Chocolate on a spoon, Cake in a Jar, Hello Kitty License Flavor and the World’s First 3D Gelato Flower in a Bouquet which is suitable for any occasion. Also introducing the specialty Italian Lucaffe coffee and Tea & Salute. Some of the highlights of the launch event is performance by Queen Sheba, first woman mentalist in the world to drive Blindfolded in a go cart race. Queen Sheba did a prediction related to Stick Arts product with amazement from the volunteers and guests. Followed by the Launch ceremony of the unveiling of the World’s First Gelato Flower Bouquet by our guest of honor Yang Berbahagia Tan Sri Dato’ Sri Azlani Dr. Mahadevan (Founder President of Malaysia Psychiatric Association), Chef Kimora (Principal Stick Arts), Mr. Eric Lim (Director Stick Arts Café) and Mr. Vin Wee (Advisor Stick Arts). Many premium stick arts products are also given out for the lucky draw including The World’s First Gelato Bouquet which was won by Mr Joshua Loke. Special announcement promo in conjunction with our Stick Arts Café launch is 50% Discount on all gelato sticks valid till 5 December at Nu Sentral Outlet. We are also very please and honor to be invited to participate in two Christmas events for the month of December at Lot 10 Musical Christmas (Stick Arts Showcase in front of Rolex & Isetan The Japan Store) from 5 till 25 December 2016 as well as KL Winter Fest @ Midvalley Exhibition Center (Platinum Booth No. P12A) from 16 till 25 December 2016. Do visit us for our Christmas Promo Hampers of Lucaffe Specialty Coffee Machines & 9espresso, BUY 1 FREE 1 Pralines Set offers, FREE RM25 Gelato Bouquet Vouchers & many more exciting deals at all our Christmas Events.
/* This file is part of the Palabos library. * * Copyright (C) 2011-2017 FlowKit Sarl * Route d'Oron 2 * 1010 Lausanne, Switzerland * E-mail contact: [email protected] * * The most recent release of Palabos can be downloaded at * <http://www.palabos.org/> * * The library Palabos is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * The library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OFF_LATTICE_BOUNDARY_PROFILES_3D_HH #define OFF_LATTICE_BOUNDARY_PROFILES_3D_HH #include "core/globalDefs.h" #include "core/functions.h" #include "offLattice/offLatticeBoundaryProfiles3D.h" namespace plb { template<typename T> struct DefaultWallProfile3D<T, Array<T,3> > { BoundaryProfile3D<T,Array<T,3> >* generate() { return new NoSlipProfile3D<T>(); } }; template<typename T> struct DefaultWallProfile3D<T, Array<T,2> > { BoundaryProfile3D<T, Array<T,2> >* generate() { return new ScalarNeumannProfile3D<T>(); } }; /********** NoSlipProfile3D ********************************************/ template<typename T> void NoSlipProfile3D<T>::setNormal(Array<T,3> const& normal_) { } template<typename T> void NoSlipProfile3D<T>::defineCircularShape(Array<T,3> const& center_, T radius_) { } template<typename T> void NoSlipProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { data.resetToZero(); bdType = OffBoundary::dirichlet; } template<typename T> NoSlipProfile3D<T>* NoSlipProfile3D<T>::clone() const { return new NoSlipProfile3D<T>(*this); } /********** FreeSlipProfile3D ********************************************/ template<typename T> void FreeSlipProfile3D<T>::setNormal(Array<T,3> const& normal_) { } template<typename T> void FreeSlipProfile3D<T>::defineCircularShape(Array<T,3> const& center_, T radius_) { } template<typename T> void FreeSlipProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { data.resetToZero(); bdType = OffBoundary::freeSlip; } template<typename T> FreeSlipProfile3D<T>* FreeSlipProfile3D<T>::clone() const { return new FreeSlipProfile3D<T>(*this); } /********** PoiseuilleProfile3D ********************************************/ template<typename T> PoiseuilleProfile3D<T>::PoiseuilleProfile3D(T uAverage_) : uAverage(uAverage_), normal(T(),T(),T()), center(T(),T(),T()), radius((T)1) { } template<typename T> void PoiseuilleProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void PoiseuilleProfile3D<T>::defineCircularShape(Array<T,3> const& center_, T radius_) { center = center_; radius = radius_; } template<typename T> void PoiseuilleProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; Array<T,3> radial = pos-center; T r = norm(radial) / radius; if (r<=(T)1.) { data = 2*uAverage*(1-r*r)*(-normal); } else { data.resetToZero(); } } template<typename T> PoiseuilleProfile3D<T>* PoiseuilleProfile3D<T>::clone() const { return new PoiseuilleProfile3D<T>(*this); } /********** IncreasingPoiseuilleProfile3D ********************************************/ template< typename T, template<typename U> class Descriptor> IncreasingPoiseuilleProfile3D<T,Descriptor>::IncreasingPoiseuilleProfile3D ( T uAverage_, plint maxT_ ) : uAverage(uAverage_), maxT(maxT_), normal(T(),T(),T()), center(T(),T(),T()), radius((T)1) { } template< typename T, template<typename U> class Descriptor> void IncreasingPoiseuilleProfile3D<T,Descriptor>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template< typename T, template<typename U> class Descriptor> void IncreasingPoiseuilleProfile3D<T,Descriptor>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { center = center_; radius = radius_; } template< typename T, template<typename U> class Descriptor> void IncreasingPoiseuilleProfile3D<T,Descriptor>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; BlockLattice3D<T,Descriptor> const* lattice = dynamic_cast<BlockLattice3D<T,Descriptor> const* >(argument); plint t = lattice->getTimeCounter().getTime(); T signal = util::sinIncreasingFunction<T>((T) t, (T) maxT); Array<T,3> radial = pos-center; T r = norm(radial) / radius; if (r<=(T)1.) { data = signal*2*uAverage*(1-r*r)*(-normal); } else { data.resetToZero(); } } template< typename T, template<typename U> class Descriptor> IncreasingPoiseuilleProfile3D<T,Descriptor>* IncreasingPoiseuilleProfile3D<T,Descriptor>::clone() const { return new IncreasingPoiseuilleProfile3D<T,Descriptor>(*this); } /********** IncreasingVelocityProfile3D ********************************************/ template< typename T, template<typename U> class Descriptor> IncreasingVelocityProfile3D<T,Descriptor>::IncreasingVelocityProfile3D ( Array<T,3> const& u_, plint maxT_ ) : u(u_), maxT(maxT_) { } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityProfile3D<T,Descriptor>::setNormal(Array<T,3> const& normal_) { } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityProfile3D<T,Descriptor>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityProfile3D<T,Descriptor>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; BlockLattice3D<T,Descriptor> const* lattice = dynamic_cast<BlockLattice3D<T,Descriptor> const* >(argument); plint t = lattice->getTimeCounter().getTime(); T signal = util::sinIncreasingFunction<T>((T) t, (T) maxT); data = u*signal; } template< typename T, template<typename U> class Descriptor> IncreasingVelocityProfile3D<T,Descriptor>* IncreasingVelocityProfile3D<T,Descriptor>::clone() const { return new IncreasingVelocityProfile3D<T,Descriptor>(*this); } /********** IncreasingVelocityPlugProfile3D ********************************************/ template< typename T, template<typename U> class Descriptor> IncreasingVelocityPlugProfile3D<T,Descriptor>::IncreasingVelocityPlugProfile3D ( T uMax_, plint maxT_ ) : uMax(uMax_), maxT(maxT_), normal(T(),T(),T()) { } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityPlugProfile3D<T,Descriptor>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityPlugProfile3D<T,Descriptor>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template< typename T, template<typename U> class Descriptor> void IncreasingVelocityPlugProfile3D<T,Descriptor>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; BlockLattice3D<T,Descriptor> const* lattice = dynamic_cast<BlockLattice3D<T,Descriptor> const* >(argument); plint t = lattice->getTimeCounter().getTime(); T signal = util::sinIncreasingFunction<T>((T) t, (T) maxT); data = -signal*uMax*normal; } template< typename T, template<typename U> class Descriptor> IncreasingVelocityPlugProfile3D<T,Descriptor>* IncreasingVelocityPlugProfile3D<T,Descriptor>::clone() const { return new IncreasingVelocityPlugProfile3D<T,Descriptor>(*this); } /********** TimeDependentVelocityProfile3D ********************************************/ template< typename T, template<typename U> class Descriptor> TimeDependentVelocityProfile3D<T,Descriptor>::TimeDependentVelocityProfile3D ( util::TimeDependentFunction<T,3>* velocity_) : velocity(velocity_) { } template< typename T, template<typename U> class Descriptor> TimeDependentVelocityProfile3D<T,Descriptor>::TimeDependentVelocityProfile3D ( TimeDependentVelocityProfile3D<T,Descriptor> const& rhs) : velocity(rhs.velocity->clone()) { } template< typename T, template<typename U> class Descriptor> TimeDependentVelocityProfile3D<T,Descriptor>& TimeDependentVelocityProfile3D<T,Descriptor>::operator= (TimeDependentVelocityProfile3D<T,Descriptor> const& rhs) { TimeDependentVelocityProfile3D<T,Descriptor>(rhs).swap(*this); } template< typename T, template<typename U> class Descriptor> void TimeDependentVelocityProfile3D<T,Descriptor>::swap(TimeDependentVelocityProfile3D<T,Descriptor>& rhs) { std::swap(velocity, rhs.velocity); } template< typename T, template<typename U> class Descriptor> void TimeDependentVelocityProfile3D<T,Descriptor>::setNormal(Array<T,3> const& normal_) { } template< typename T, template<typename U> class Descriptor> void TimeDependentVelocityProfile3D<T,Descriptor>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template< typename T, template<typename U> class Descriptor> void TimeDependentVelocityProfile3D<T,Descriptor>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; BlockLattice3D<T,Descriptor> const* lattice = dynamic_cast<BlockLattice3D<T,Descriptor> const* >(argument); plint t = lattice->getTimeCounter().getTime(); data = (*velocity)(t); } template< typename T, template<typename U> class Descriptor> TimeDependentVelocityProfile3D<T,Descriptor>* TimeDependentVelocityProfile3D<T,Descriptor>::clone() const { return new TimeDependentVelocityProfile3D<T,Descriptor>(*this); } /********** OscillatingPoiseuilleProfile3D ********************************************/ template< typename T, template<typename U> class Descriptor> OscillatingPoiseuilleProfile3D<T,Descriptor>::OscillatingPoiseuilleProfile3D ( T minUave_, T maxUave_, T period_ ) : minUave(minUave_), maxUave(maxUave_), period(period_), normal(T(),T(),T()), center(T(),T(),T()), radius((T)1) { } template< typename T, template<typename U> class Descriptor> void OscillatingPoiseuilleProfile3D<T,Descriptor>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template< typename T, template<typename U> class Descriptor> void OscillatingPoiseuilleProfile3D<T,Descriptor>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { center = center_; radius = radius_; } template< typename T, template<typename U> class Descriptor> void OscillatingPoiseuilleProfile3D<T,Descriptor>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; static const T pi = (T)4.*std::atan((T)1.); BlockLattice3D<T,Descriptor> const* lattice = dynamic_cast<BlockLattice3D<T,Descriptor> const* >(argument); PLB_ASSERT(lattice); T t = (T) lattice->getTimeCounter().getTime(); T signal = (std::sin((T)2.*pi*t/period)+(T)1.)*(T)0.5; Array<T,3> radial = pos-center; T r = norm(radial) / radius; if (r<=(T)1.) { data = ( minUave+(maxUave-minUave)*signal* (T)2*((T)1-r*r) ) * (-normal); } else { data.resetToZero(); } } template< typename T, template<typename U> class Descriptor> OscillatingPoiseuilleProfile3D<T,Descriptor>* OscillatingPoiseuilleProfile3D<T,Descriptor>::clone() const { return new OscillatingPoiseuilleProfile3D<T,Descriptor>(*this); } /********** ConstantVelocityProfile3D ********************************************/ template<typename T> ConstantVelocityProfile3D<T>::ConstantVelocityProfile3D(Array<T,3> const& u_) : u(u_) { } template<typename T> void ConstantVelocityProfile3D<T>::setNormal(Array<T,3> const& normal_) { } template<typename T> void ConstantVelocityProfile3D<T>::defineCircularShape(Array<T,3> const& center_, T radius_) { } template<typename T> void ConstantVelocityProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; data = u; } template<typename T> ConstantVelocityProfile3D<T>* ConstantVelocityProfile3D<T>::clone() const { return new ConstantVelocityProfile3D<T>(*this); } /********** VelocityPlugProfile3D ********************************************/ template<typename T> VelocityPlugProfile3D<T>::VelocityPlugProfile3D(T uMax_) : uMax(uMax_), normal(T(),T(),T()) { } template<typename T> void VelocityPlugProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void VelocityPlugProfile3D<T>::defineCircularShape(Array<T,3> const& center_, T radius_) { } template<typename T> void VelocityPlugProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; data = -uMax*normal; } template<typename T> VelocityPlugProfile3D<T>* VelocityPlugProfile3D<T>::clone() const { return new VelocityPlugProfile3D<T>(*this); } /********** NeumannBoundaryProfile3D ******************************************/ template<typename T> void NeumannBoundaryProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void NeumannBoundaryProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void NeumannBoundaryProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::neumann; // In a Neumann condition, the velocity will need to be // computed in the actual off-lattice boundary algorithm. // Nothing to be done here. data.resetToZero(); } template<typename T> NeumannBoundaryProfile3D<T>* NeumannBoundaryProfile3D<T>::clone() const { return new NeumannBoundaryProfile3D<T>(*this); } /********** DensityNeumannBoundaryProfile3D ******************************************/ template<typename T> DensityNeumannBoundaryProfile3D<T>::DensityNeumannBoundaryProfile3D(T rho_) : rho(rho_) { } template<typename T> void DensityNeumannBoundaryProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void DensityNeumannBoundaryProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void DensityNeumannBoundaryProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,3>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::densityNeumann; // In a Neumann condition, the velocity will need to be // computed in the actual off-lattice boundary algorithm. // Nothing to be done here. data.resetToZero(); data[0] = rho; } template<typename T> DensityNeumannBoundaryProfile3D<T>* DensityNeumannBoundaryProfile3D<T>::clone() const { return new DensityNeumannBoundaryProfile3D<T>(*this); } /********** ScalarDirichletProfile3D ******************************************/ template<typename T> ScalarDirichletProfile3D<T>::ScalarDirichletProfile3D(T value_) : value(value_) { } template<typename T> void ScalarDirichletProfile3D<T>::setNormal(Array<T,3> const& normal_) { } template<typename T> void ScalarDirichletProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void ScalarDirichletProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,2>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::dirichlet; data[0] = value; data[1] = T(); // Second argument is not used here. } template<typename T> ScalarDirichletProfile3D<T>* ScalarDirichletProfile3D<T>::clone() const { return new ScalarDirichletProfile3D<T>(*this); } /********** ScalarNeumannProfile3D ******************************************/ template<typename T> void ScalarNeumannProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void ScalarNeumannProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void ScalarNeumannProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,2>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::neumann; // Neumann means zero-gradient, the two arguments are unused. data[0] = T(); data[1] = T(); } template<typename T> ScalarNeumannProfile3D<T>* ScalarNeumannProfile3D<T>::clone() const { return new ScalarNeumannProfile3D<T>(*this); } /********** ScalarFluxProfile3D ******************************************/ template<typename T> ScalarFluxProfile3D<T>::ScalarFluxProfile3D(T gradVal_) : gradVal(gradVal_) { } template<typename T> void ScalarFluxProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void ScalarFluxProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void ScalarFluxProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,2>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::flux; data[0] = gradVal; data[1] = T(); } template<typename T> ScalarFluxProfile3D<T>* ScalarFluxProfile3D<T>::clone() const { return new ScalarFluxProfile3D<T>(*this); } /********** ScalarIsolationProfile3D ******************************************/ template<typename T> ScalarIsolationProfile3D<T>::ScalarIsolationProfile3D(T asymptoticRho_, T kappa_) : asymptoticRho(asymptoticRho_), kappa(kappa_) { } template<typename T> void ScalarIsolationProfile3D<T>::setNormal(Array<T,3> const& normal_) { normal = normal_; } template<typename T> void ScalarIsolationProfile3D<T>::defineCircularShape ( Array<T,3> const& center_, T radius_ ) { } template<typename T> void ScalarIsolationProfile3D<T>::getData ( Array<T,3> const& pos, plint id, AtomicBlock3D const* argument, Array<T,2>& data, OffBoundary::Type& bdType ) const { bdType = OffBoundary::isolation; data[0] = asymptoticRho; data[1] = kappa; } template<typename T> ScalarIsolationProfile3D<T>* ScalarIsolationProfile3D<T>::clone() const { return new ScalarIsolationProfile3D<T>(*this); } } // namespace plb #endif // OFF_LATTICE_BOUNDARY_PROFILES_3D_HH
Susan Bernhard Peters was born in Schoenfeld, Russia, the daughter of Bernhard and Margaretha Peters. The family emigrated to Alberta in 1924, after being dispossessed of home and property as a result of World War I. Susie worked in Vancouver in 1931, completed her high school education in 1934, and studied at the Calgary Normal School from 1934 to 1935. She then taught in several rural schools while attending summer sessions at the University of Alberta. She received her Professional Teachers Certificate in 1938. From 1945 to 1946 she worked as a Mennonite Central Committee volunteer in Europe, working with homeless boys and the elderly in England, and refugees in Holland. From late 1946 to 1948 Peters directed MCC refugee work in Denmark. She returned to Canada and continued her teaching and studies. She received her Bachelor of Education degree from the University of Alberta in 1956. From 1956 to 1962 she taught Inuit and Dene children in the North West Territories at Reindeer Station, a settlement established in 1932 to introduce reindeer farming into northern Canada. From 1962 to 1963 she worked at Fort McPherson. She subsequently worked with the Mennonite Central Committee in Jordan and in the Middle East. In 1965 she retired to Linden, Alberta. Taken from Glenbow Archives fonds level description. Peters’ original papers, printed materials, and photographs were donated to Centre for Mennonite Brethren Studies in 1993 by Arnie Neufeld of Winkler, Manitoba and Dorothy Ratzlaff of Linden, Alberta. In 1995 Arnie Neufeld donated the original source for the translation published in “A family portrait: Stories and Adventures of the Klassen/Peters family.” Arnie Neufeld received these papers from Susan Peters, so they are filed with the Susan Peters fonds. The Susan B. Peters fonds consists of 11 photographs (1940–1946), correspondence (1944–1956), personal effects (1915–1980), biographical material, and a plate from Mennonite Central Committee. The documents and memorabilia in this fonds were created as a result of Peters involvement with MCC. Part of the Peters fond, relating to her teaching experiences, is in the Glenbow Archives (an inventory is available in this fonds). Accession numbers are 1993–19 and 1995–81. An item list description prepared by Arnie Neufeld was part of this accession and is available in the collection. I. Susan B. Peters fonds at Glenbow archives. This series contains an inventory of the Susan B. Peters’ materials available at the Glenbow Archives, Calgary, Alberta. Also included are photocopies of MCC photos from file 41 at Glenbow. Finding aid: Susan B. Peters list 1. II. Susan B. Peters correspondence. This correspondence is predominantly with MCC committee members, such as C.J. Rempel (Kitchener), J.N. Byler (Akron), and others. Also in this series is “Bericht ueber unsre Erlebnisse” by Susanna Toews, a relative of the Peters family. Finding aid: Susan B. Peters list 2–4. III. Susan B. Peters personal effects. Finding aid: Susan B. Peters list 5–6. IV. Susan B. Peters tributes. Includes a memorial bulletin with a lengthy obituary, a funeral album and other tributes. Finding aid: Susan B. Peters list 7. V. Susan B. Peters photographs. This series contains photographs, some of boys (probably the homeless boys Peters cared for in England), some of historic sites in England and some of Susan B. Peters. Finding aid: The photographs are classified under NP118–1. Records pertaining to Glenbow Archives. – 1994. Correspondence with Mennonite Central Committee. – 1944–1946. Correspondence with Mennonite Central Committee. – 1947–1948. Correspondence with Mennonite Central Committee. – 1949–1956. Handwritten account: “Bericht ueber unsre Erlebnisse” by Susanna Toews (1880-). – [ca. 1945]. * Souvenir plate with crest of Mennonite Central Committee. Bulletin of Memorial Service of Susan B. Peters, Linden Mennonite Brethren Church. – June 23, 1992. NP118–1–1 Photograph of Susan Peters. 8 x 14 cm. – Early 1940s. NP118–1–2 Photograph of Susan Peters taken in Holland. 4 x 5 cm. – 1946. NP118–1–3 Photograph of buildings in Canterbury, England. 6 x 8 cm. – 1946. NP118–1–4 Photograph of a woman taken in Canterbury, England. 6 x 8 cm. – 1946. NP118–1–5 Photograph of the changing of the guard in England. 6 x 8 cm. – 1946. NP118–1–6 Photograph of the changing of the guard in England. 6 x 8 cm. – 1946. NP118–1–7 Photograph of the changing of the guard in England. 6 x 8 cm. – 1946. NP118–1–8 Photograph of a group of boys in England. Front lying: Ernest Hamilton, Brian Nolan, R. Hillin, John Robertson, David ___, Dani Moogan. Middle sitting: Unidentified, Al Jackson, Joe Lawton, Denneth McDuff. Standing: R. Mulherrn, David Davison, Brian Weatherby, Mountford, Parker, John Finney, Peter ___. 6 x 8 cm. – 1946. NP118–1–9 Photograph of Susan Peters taken on the day of her departure at Taxal, England. 6 x 8 cm. – June 24, 1946. NP118–1–10 Photograph of three boys in England: Parker, Brian Nolan (artist), Mountford. 6 x 8 cm. – 1946. NP118–1–11 Photograph of two boys in England: Joe Lawton and Allan Jackson. 6 x 8 cm. – 1946.
#include <sys/unistd.h> #include <sys/wait.h> #include <gtest/gtest.h> #include "mod_websocket.h" #ifdef HAVE_PCRE_H # define ALLOWED_ORIGIN "http:\\/\\/bar\\.com\\/.*" #else # define ALLOWED_ORIGIN "http://bar.com/foo" #endif #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ # define SEC_WEBSOCKET_KEY1 "18x 6]8vM;54 *(5: { U1]8 z [ 8" # define SEC_WEBSOCKET_KEY2 "1_ tx7X d < nw 334J702) 7]o}` 0" # define SEC_WEBSOCKET_KEY3 "Tm[K T2u" # define REQ_IETF_00 "GET /chat HTTP/1.1\r\n"\ "Upgrade: WebSocket\r\n"\ "Connection: Upgrade\r\n"\ "Host: bar.com\r\n"\ "Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Key1: " SEC_WEBSOCKET_KEY1 "\r\n"\ "Sec-WebSocket-Key2: " SEC_WEBSOCKET_KEY2 "\r\n"\ "X-Forwarded-Proto: http\r\n"\ "X-Forwarded-For: unknown:unknown\r\n"\ "X-Forwarded-Port: unknown\r\n\r\n"\ SEC_WEBSOCKET_KEY3 # define REQ_IETF_00_MULTI "GET /chat HTTP/1.1\r\n"\ "Upgrade: WebSocket\r\n"\ "Connection: Upgrade\r\n"\ "Host: bar.com\r\n"\ "Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Key1: " SEC_WEBSOCKET_KEY1 "\r\n"\ "Sec-WebSocket-Key2: " SEC_WEBSOCKET_KEY2 "\r\n"\ "X-Forwarded-Proto: http, http\r\n"\ "X-Forwarded-For: 192.168.0.1, unknown:unknown\r\n"\ "X-Forwarded-Port: 80, unknown\r\n\r\n"\ SEC_WEBSOCKET_KEY3 # define RESP_WS_IETF_00 "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"\ "Upgrade: WebSocket\r\n"\ "Connection: Upgrade\r\n"\ "Sec-WebSocket-Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Location: ws://bar.com/chat\r\n"\ "\r\n"\ "fQJ,fN/4F4!~K~MH" # define RESP_WSS_IETF_00 "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"\ "Upgrade: WebSocket\r\n"\ "Connection: Upgrade\r\n"\ "Sec-WebSocket-Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Location: wss://bar.com/chat\r\n"\ "\r\n"\ "fQJ,fN/4F4!~K~MH" #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ # define SEC_WEBSOCKET_KEY "dGhlIHNhbXBsZSBub25jZQ==" # define REQ_RFC_6455 "GET /chat HTTP/1.1\r\n"\ "Upgrade: websocket\r\n"\ "Connection: Upgrade\r\n"\ "Host: bar.com\r\n"\ "Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Key: " SEC_WEBSOCKET_KEY "\r\n"\ "Sec-WebSocket-Version: 13\r\n"\ "X-Forwarded-Proto: http\r\n"\ "X-Forwarded-For: unknown:unknown\r\n"\ "X-Forwarded-Port: unknown\r\n\r\n" # define REQ_RFC_6455_MULTI "GET /chat HTTP/1.1\r\n"\ "Upgrade: websocket\r\n"\ "Connection: Upgrade\r\n"\ "Host: bar.com\r\n"\ "Origin: http://bar.com/foo\r\n"\ "Sec-WebSocket-Key: " SEC_WEBSOCKET_KEY "\r\n"\ "Sec-WebSocket-Version: 13\r\n"\ "X-Forwarded-Proto: http, http\r\n"\ "X-Forwarded-For: 192.168.0.1, unknown:unknown\r\n"\ "X-Forwarded-Port: 80, unknown\r\n\r\n" # define RESP_RFC_6455 "HTTP/1.1 101 Switching Protocols\r\n"\ "Upgrade: websocket\r\n"\ "Connection: Upgrade\r\n"\ "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"\ "\r\n" # define RESP_RFC_6455_SUBPROTO "HTTP/1.1 101 Switching Protocols\r\n"\ "Upgrade: websocket\r\n"\ "Connection: Upgrade\r\n"\ "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n"\ "Sec-WebSocket-Protocol: subprotocol2\r\n" \ "\r\n" #endif class ModWebsocketHandshakeCheckRequestTest : public testing::Test { protected: ModWebsocketHandshakeCheckRequestTest() {} ~ModWebsocketHandshakeCheckRequestTest() {} virtual void SetUp() { std::cerr << __PRETTY_FUNCTION__ << std::endl; // init server_socket srv_sock.is_ssl = 0; // init connection con.fd = -1; con.read_queue = chunkqueue_init(); con.request.request = buffer_init(); con.request.uri = buffer_init(); con.request.headers = array_init(); con.srv_socket = &srv_sock; con.uri.path = buffer_init_string("/chat"); // init plugin_data pd.conf.debug = MOD_WEBSOCKET_LOG_DEBUG; // init extension: "/chat" => ( "host" => "...", ... , "origins" => () ), ... ) origins = data_array_init(); buffer_copy_string(origins->key, "origins"); ext = data_array_init(); buffer_copy_string(ext->key, "/chat"); array_insert_unique(ext->value, (data_unset *)origins); // init handler_ctx memset(&hctx, 0, sizeof(hctx)); hctx.srv = &srv; hctx.con = &con; hctx.pd = &pd; hctx.ext = ext; hctx.handshake.host = NULL; hctx.handshake.origin = NULL; hctx.handshake.version = -1; hctx.tocli = chunkqueue_init(); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ hctx.handshake.key1 = NULL; hctx.handshake.key2 = NULL; hctx.handshake.key3 = buffer_init(); #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ hctx.handshake.key = NULL; #endif } virtual void TearDown() { std::cerr << __PRETTY_FUNCTION__ << std::endl; chunkqueue_free(con.read_queue); buffer_free(con.request.request); buffer_free(con.request.uri); array_free(con.request.headers); buffer_free(con.uri.path); buffer_free(ext->key); array_free(ext->value); free(ext); chunkqueue_free(hctx.tocli); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ buffer_free(hctx.handshake.key3); #endif } public: server_socket srv_sock; connection con; plugin_data pd; data_array* ext; data_array* origins; server srv; handler_ctx hctx; }; class ModWebsocketHandshakeCreateResponseTest : public testing::Test { protected: ModWebsocketHandshakeCreateResponseTest() {} ~ModWebsocketHandshakeCreateResponseTest() {} virtual void SetUp() { std::cerr << __PRETTY_FUNCTION__ << std::endl; // init server_socket srv_sock.is_ssl = 0; // init connection con.fd = -1; con.read_queue = chunkqueue_init(); con.request.request = buffer_init(); con.request.uri = buffer_init(); con.request.headers = array_init(); con.srv_socket = &srv_sock; con.uri.path = buffer_init_string("/chat"); // init plugin_data pd.conf.debug = MOD_WEBSOCKET_LOG_DEBUG; // init extension: "/chat" => ( "host" => "...", ... , "origins" => () ), ... ) origins = data_array_init(); buffer_copy_string(origins->key, "origins"); ext = data_array_init(); buffer_copy_string(ext->key, "/chat"); array_insert_unique(ext->value, (data_unset *)origins); // init handler_ctx memset(&hctx, 0, sizeof(hctx)); hctx.srv = &srv; hctx.con = &con; hctx.pd = &pd; hctx.ext = ext; hctx.handshake.host = NULL; hctx.handshake.origin = NULL; hctx.handshake.version = -1; hctx.tocli = chunkqueue_init(); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ hctx.handshake.key1 = NULL; hctx.handshake.key2 = NULL; hctx.handshake.key3 = buffer_init(); #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ hctx.handshake.key = NULL; #endif } virtual void TearDown() { std::cerr << __PRETTY_FUNCTION__ << std::endl; chunkqueue_free(con.read_queue); buffer_free(con.request.request); buffer_free(con.request.uri); array_free(con.request.headers); buffer_free(con.uri.path); buffer_free(ext->key); array_free(ext->value); free(ext); chunkqueue_free(hctx.tocli); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ buffer_free(hctx.handshake.key3); #endif } public: server_socket srv_sock; connection con; plugin_data pd; data_array* ext; data_array* origins; server srv; handler_ctx hctx; }; class ModWebsocketHandshakeForwardRequestTest : public testing::Test { protected: ModWebsocketHandshakeForwardRequestTest() {} ~ModWebsocketHandshakeForwardRequestTest() {} virtual void SetUp() { std::cerr << __PRETTY_FUNCTION__ << std::endl; // init server_socket srv_sock.is_ssl = 0; // init connection con.fd = -1; con.read_queue = chunkqueue_init(); con.request.request_line = buffer_init(); con.request.request = buffer_init(); con.request.uri = buffer_init(); con.request.headers = array_init(); con.srv_socket = &srv_sock; con.uri.path = buffer_init_string("/chat"); // init plugin_data pd.conf.debug = MOD_WEBSOCKET_LOG_DEBUG; // init extension: "/chat" => ( "host" => "...", ... , "origins" => () ), ... ) origins = data_array_init(); buffer_copy_string(origins->key, "origins"); ext = data_array_init(); buffer_copy_string(ext->key, "/chat"); array_insert_unique(ext->value, (data_unset *)origins); // init handler_ctx memset(&hctx, 0, sizeof(hctx)); hctx.srv = &srv; hctx.con = &con; hctx.pd = &pd; hctx.ext = ext; hctx.handshake.host = NULL; hctx.handshake.origin = NULL; hctx.handshake.version = -1; hctx.tocli = chunkqueue_init(); hctx.tosrv = chunkqueue_init(); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ hctx.handshake.key1 = NULL; hctx.handshake.key2 = NULL; hctx.handshake.key3 = buffer_init(); #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ hctx.handshake.key = NULL; #endif } virtual void TearDown() { std::cerr << __PRETTY_FUNCTION__ << std::endl; chunkqueue_free(con.read_queue); buffer_free(con.request.request_line); buffer_free(con.request.request); buffer_free(con.request.uri); array_free(con.request.headers); buffer_free(con.uri.path); buffer_free(ext->key); array_free(ext->value); free(ext); chunkqueue_free(hctx.tocli); chunkqueue_free(hctx.tosrv); #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ buffer_free(hctx.handshake.key3); #endif } public: server_socket srv_sock; connection con; plugin_data pd; data_array* ext; data_array* origins; server srv; handler_ctx hctx; }; static void print_headers(array *a) { #if 0 array_print(a, 1); std::cout << std::endl; #endif }; #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ TEST_F(ModWebsocketHandshakeCheckRequestTest, IETF_00) { mod_websocket_errno_t ret; data_string *header; data_string *origin; int pipefd[2]; ret = mod_websocket_handshake_check_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key1"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY1); array_insert_unique(con.request.headers, (data_unset *)header); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key2"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY2); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); chunkqueue_append_mem(con.read_queue, SEC_WEBSOCKET_KEY3, sizeof(SEC_WEBSOCKET_KEY3)); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); // not allowed origin origin = data_string_init(); buffer_copy_string(origin->value, "http:\\/\\/foo\\.com\\/.*"); array_insert_unique(origins->value, (data_unset *)origin); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_FORBIDDEN, ret); // allowed origin origin = data_string_init(); buffer_copy_string(origin->value, ALLOWED_ORIGIN); array_insert_unique(origins->value, (data_unset *)origin); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); // check chunked key-3 chunkqueue_reset(con.read_queue); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); if (pipe(pipefd) != 0) { ASSERT_FALSE(true) << "fail to create pipe"; } if (fork() == 0) { close(pipefd[0]); if (write(pipefd[1], SEC_WEBSOCKET_KEY3, strlen(SEC_WEBSOCKET_KEY3)) < 0) { ASSERT_FALSE(true) << "fail to write"; } close(pipefd[1]); _exit(0); } else { wait(NULL); con.fd = pipefd[0]; close(pipefd[1]); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); close(pipefd[0]); } } #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ TEST_F(ModWebsocketHandshakeCheckRequestTest, RFC_6455) { mod_websocket_errno_t ret; data_string *header; data_string *origin; ret = mod_websocket_handshake_check_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Version"); buffer_copy_string(header->value, "13"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_BAD_REQUEST, ret); // not allowed origin origin = data_string_init(); buffer_copy_string(origin->value, "http:\\/\\/foo\\.com\\/.*"); array_insert_unique(origins->value, (data_unset *)origin); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_FORBIDDEN, ret); // allowed origin origin = data_string_init(); buffer_copy_string(origin->value, ALLOWED_ORIGIN); array_insert_unique(origins->value, (data_unset *)origin); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); } #endif static int check_response(chunkqueue *q, const char *exp) { chunk *c = NULL; buffer *b = NULL; for (c = q->first; c; c = c->next) { if (!b) { b = buffer_init_buffer(c->mem); } else { buffer_append_memory(b, c->mem->ptr, c->mem->used); } } if (b) { if (memcmp(b->ptr, exp, strlen(exp)) != 0 || b->used - 1 != strlen(exp)) { std::cerr << "invalid response" << std::endl << std::endl << "exp:" << std::endl << "[" << exp << "], size = " << strlen(exp) << std::endl << std::endl << "res:" << std::endl << "[" << b->ptr << "], size = " << b->used - 1 << std::endl; return -1; } } else { std::cerr << "null response" << std::endl << std::endl << "exp:" << std::endl << "[" << exp << "], size = " << strlen(exp) << std::endl; return -1; } return 0; } #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ TEST_F(ModWebsocketHandshakeCreateResponseTest, IETF_00) { mod_websocket_errno_t ret; data_string *header; data_string *origin; int pipefd[2]; ret = mod_websocket_handshake_create_response(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); // create request header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key1"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY1); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key2"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY2); array_insert_unique(con.request.headers, (data_unset *)header); chunkqueue_append_mem(con.read_queue, SEC_WEBSOCKET_KEY3, sizeof(SEC_WEBSOCKET_KEY3)); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ret = mod_websocket_handshake_create_response(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); check_response(hctx.tocli, RESP_WS_IETF_00); chunkqueue_reset(hctx.tocli); srv_sock.is_ssl = 1; ret = mod_websocket_handshake_create_response(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); check_response(hctx.tocli, RESP_WSS_IETF_00); } #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ TEST_F(ModWebsocketHandshakeCreateResponseTest, RFC_6455) { mod_websocket_errno_t ret; data_string *header; data_string *origin; header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Version"); buffer_copy_string(header->value, "13"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_check_request(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ret = mod_websocket_handshake_create_response(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_response(hctx.tocli, RESP_RFC_6455)); chunkqueue_reset(hctx.tocli); srv_sock.is_ssl = 1; ret = mod_websocket_handshake_create_response(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_response(hctx.tocli, RESP_RFC_6455)); // check subproto header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Protocol"); buffer_copy_string(header->value, "subprotocol1, subprotocol2"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); data_string* subproto = data_string_init(); buffer_copy_string(subproto->key, "subproto"); buffer_copy_string(subproto->value, "subprotocol2"); array_insert_unique(ext->value, (data_unset *)subproto); chunkqueue_reset(hctx.tocli); ret = mod_websocket_handshake_create_response(&hctx); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_response(hctx.tocli, RESP_RFC_6455_SUBPROTO)); } #endif static int check_forward(chunkqueue *q, const char *exp) { chunk *c = NULL; buffer *b = NULL; for (c = q->first; c; c = c->next) { if (!b) { b = buffer_init_buffer(c->mem); } else { buffer_append_memory(b, c->mem->ptr, c->mem->used); } } if (b) { if (memcmp(b->ptr, exp, strlen(exp)) != 0 || b->used - 1 != strlen(exp)) { std::cerr << "invalid request" << std::endl << std::endl << "exp:" << std::endl << "[" << exp << "], size = " << strlen(exp) << std::endl << std::endl << "res:" << std::endl << "[" << b->ptr << "], size = " << b->used - 1 << std::endl; return -1; } } else { std::cerr << "null request" << std::endl << std::endl << "exp:" << std::endl << "[" << exp << "], size = " << strlen(exp) << std::endl; return -1; } return 0; } #ifdef _MOD_WEBSOCKET_SPEC_IETF_00_ TEST_F(ModWebsocketHandshakeForwardRequestTest, IETF_00) { mod_websocket_errno_t ret; data_string *header; ret = mod_websocket_handshake_forward_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); buffer_copy_string(con.request.request_line, "GET /chat HTTP/1.1"); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key1"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY1); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key2"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY2); array_insert_unique(con.request.headers, (data_unset *)header); buffer_copy_string(hctx.handshake.key3, SEC_WEBSOCKET_KEY3); ret = mod_websocket_handshake_forward_request(&hctx); print_headers(con.request.headers); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_forward(hctx.tosrv, REQ_IETF_00)); } TEST_F(ModWebsocketHandshakeForwardRequestTest, IETF_00_MULTI) { mod_websocket_errno_t ret; data_string *header; ret = mod_websocket_handshake_forward_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); buffer_copy_string(con.request.request_line, "GET /chat HTTP/1.1"); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "WebSocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key1"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY1); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key2"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY2); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-Proto"); buffer_copy_string(header->value, "http"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-For"); buffer_copy_string(header->value, "192.168.0.1"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-Port"); buffer_copy_string(header->value, "80"); array_insert_unique(con.request.headers, (data_unset *)header); buffer_copy_string(hctx.handshake.key3, SEC_WEBSOCKET_KEY3); ret = mod_websocket_handshake_forward_request(&hctx); print_headers(con.request.headers); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_forward(hctx.tosrv, REQ_IETF_00_MULTI)); } #endif #ifdef _MOD_WEBSOCKET_SPEC_RFC_6455_ TEST_F(ModWebsocketHandshakeForwardRequestTest, RFC_6455) { mod_websocket_errno_t ret; data_string *header; ret = mod_websocket_handshake_forward_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); buffer_copy_string(con.request.request_line, "GET /chat HTTP/1.1"); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "websocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Version"); buffer_copy_string(header->value, "13"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_forward_request(&hctx); print_headers(con.request.headers); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_forward(hctx.tosrv, REQ_RFC_6455)); } TEST_F(ModWebsocketHandshakeForwardRequestTest, RFC_6455_MULTI) { mod_websocket_errno_t ret; data_string *header; ret = mod_websocket_handshake_forward_request(NULL); ASSERT_EQ(MOD_WEBSOCKET_INTERNAL_SERVER_ERROR, ret); buffer_copy_string(con.request.request_line, "GET /chat HTTP/1.1"); header = data_string_init(); buffer_copy_string(header->key, "Upgrade"); buffer_copy_string(header->value, "websocket"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Connection"); buffer_copy_string(header->value, "Upgrade"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Host"); buffer_copy_string(header->value, "bar.com"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Origin"); buffer_copy_string(header->value, "http://bar.com/foo"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Key"); buffer_copy_string(header->value, SEC_WEBSOCKET_KEY); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "Sec-WebSocket-Version"); buffer_copy_string(header->value, "13"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-Proto"); buffer_copy_string(header->value, "http"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-For"); buffer_copy_string(header->value, "192.168.0.1"); array_insert_unique(con.request.headers, (data_unset *)header); header = data_string_init(); buffer_copy_string(header->key, "X-Forwarded-Port"); buffer_copy_string(header->value, "80"); array_insert_unique(con.request.headers, (data_unset *)header); print_headers(con.request.headers); ret = mod_websocket_handshake_forward_request(&hctx); print_headers(con.request.headers); ASSERT_EQ(MOD_WEBSOCKET_OK, ret); ASSERT_EQ(0, check_forward(hctx.tosrv, REQ_RFC_6455_MULTI)); } #endif int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
Tasty quiche using quick homemade pastry recipe. Recipes . Latest recipe reviews . Latest recipes adding enough cold water to make into a dough. STEP 3 Remove from food processor and knead lightly on a floured surface. STEP 4 Roll the pastry out into a circle 4 mm thick. Line the quiche plate with the pastry. Trim edges. STEP 5 Quiche: Preheat oven to 180C. STEP 6 Sprinkle onion, tasty... Let�s make a classic: a basic quiche dough! Basic Quiche Dough � Stand Mixer Mini So yesterday I worked with the KitchenAid Cook Processor Slicer and Grater Kit � I made a video while preparing a delicious chicken waldorf salad , check it out! 1/01/2010�� When making shortcrust pastry, your ingredients and equipment should be as cold as possible (marble benchtops and chopping boards are ideal). It's also important not to over-work the dough when kneading as it will make the pastry tough. We recommend that you bake shortcrust in a metal tin as it will give the pastry a crispier texture.... 1/01/2010�� When making shortcrust pastry, your ingredients and equipment should be as cold as possible (marble benchtops and chopping boards are ideal). It's also important not to over-work the dough when kneading as it will make the pastry tough. We recommend that you bake shortcrust in a metal tin as it will give the pastry a crispier texture. Quiche is a French open pie with crusty pastry. The stuffing can widely vary, but the dough, used for quiche is the same. Making pastry for quiche is very simple and everybody can do it. To make enough dough for a 10-inch porcelain quiche dish or a 10-1/2- or 11-inch metal tart pan with removable bottom, measure your ingredients using the first list below. To make enough dough for a 12-inch porcelain quiche dish or a 12-1/2-inch metal tart pan with removable bottom, use the second ingredient list. The method is the same for both.
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hive.ql.io; import java.io.IOException; import org.apache.hadoop.hive.io.HiveIOExceptionHandlerUtil; import org.apache.hadoop.io.Writable; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.mapred.FileSplit; import org.apache.hadoop.mapred.InputFormat; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.Reporter; /** * BucketizedHiveRecordReader is a wrapper on a list of RecordReader. It behaves * similar as HiveRecordReader while it wraps a list of RecordReader from one * file. */ public class BucketizedHiveRecordReader<K extends WritableComparable, V extends Writable> extends HiveContextAwareRecordReader<K, V> { protected final BucketizedHiveInputSplit split; protected final InputFormat inputFormat; protected final Reporter reporter; protected long progress; protected int idx; public BucketizedHiveRecordReader(InputFormat inputFormat, BucketizedHiveInputSplit bucketizedSplit, JobConf jobConf, Reporter reporter) throws IOException { super(jobConf); this.split = bucketizedSplit; this.inputFormat = inputFormat; this.reporter = reporter; initNextRecordReader(); } @Override public void doClose() throws IOException { if (recordReader != null) { recordReader.close(); recordReader = null; } idx = 0; } public K createKey() { return (K) recordReader.createKey(); } public V createValue() { return (V) recordReader.createValue(); } public long getPos() throws IOException { if (recordReader != null) { return recordReader.getPos(); } else { return 0; } } @Override public float getProgress() throws IOException { // The calculation is strongly dependent on the assumption that all splits // came from the same file return Math.min(1.0f, ((recordReader == null || this.getIOContext().isBinarySearching()) ? progress : recordReader.getPos()) / (float) (split.getLength())); } @Override public boolean doNext(K key, V value) throws IOException { while ((recordReader == null) || !doNextWithExceptionHandler(key, value)) { if (!initNextRecordReader()) { return false; } } return true; } private boolean doNextWithExceptionHandler(K key, V value) throws IOException { return super.doNext(key, value); } /** * Get the record reader for the next chunk in this * BucketizedHiveRecordReader. */ protected boolean initNextRecordReader() throws IOException { if (recordReader != null) { recordReader.close(); recordReader = null; if (idx > 0) { progress += split.getLength(idx - 1); // done processing so far } } // if all chunks have been processed, nothing more to do. if (idx == split.getNumSplits()) { return false; } // get a record reader for the idx-th chunk try { recordReader = inputFormat.getRecordReader(split.getSplit(idx), jobConf, reporter); } catch (Exception e) { recordReader = HiveIOExceptionHandlerUtil.handleRecordReaderCreationException(e, jobConf); } // if we're performing a binary search, we need to restart it if (isSorted) { initIOContextSortedProps((FileSplit) split.getSplit(idx), recordReader, jobConf); } idx++; return true; } }
The Vicks EasyFill Cool Mist Humidifier is the first Vicks humidifier with two easy ways to fill: bring water to the humidifier and fill from the top OR remove the tank and fill at the sink. This ultrasonic, filter-free humidifier delivers quiet, visible cool mist to provide temporary relief from cough and congestion for better breathing and a more comfortable sleep. Includes one Protec® Humidifier Demineralization Cartridge (model TWT500) to help prevent white dust.
/********************************************************************** This source file is a part of Demi3D __ ___ __ __ __ | \|_ |\/|| _)| \ |__/|__| || __)|__/ Copyright (c) 2013-2014 Demi team https://github.com/wangyanxing/Demi3D Released under the MIT License https://github.com/wangyanxing/Demi3D/blob/master/License.txt ***********************************************************************/ #include "ArenaPch.h" #include "ArenaFxProperty.h" #include "K2Terrain.h" #include "K2World.h" #include "ArenaGameApp.h" #include "ArenaGameEntity.h" #include "ArenaDynEntity.h" #include "ArenaAttribute.h" #include "ArenaEntityManager.h" #include "ArenaEntityConfig.h" #include "K2RenderObjects.h" #include "EffectManager.h" #include "ParticleElement.h" #include "ParticleSystem.h" namespace Demi { ArFxProperty::ArFxProperty() { } ArFxProperty::~ArFxProperty() { } void ArFxProperty::Update(float dt) { for(auto iter = mProjectiles.begin(); iter != mProjectiles.end(); ) { auto& pj = *iter; if(pj->trailFx->GetState() == DiParticleSystem::PSS_STOPPED) { iter++; continue; } // update the target position auto entityPtr = ArGameApp::Get()->GetEntityManager()->FindEntity(pj->targetID); if(entityPtr) { pj->curTarget = entityPtr->GetImpactPosition(); } // update the motion auto dir = (pj->curTarget - pj->curPos).normalisedCopy(); pj->curPos += dir * (dt * pj->speed); pj->node->SetPosition(pj->curPos); size_t numElements = pj->trailFx->GetNumElements(); for (size_t i = 0; i < numElements; ++i) { pj->trailFx->GetElement(i)->direction = -dir; } // update the effect pj->trailFx->Update(dt); //reach or not if(DiMath::Abs(pj->curPos.distance(pj->curTarget)) < 8) { pj->trailFx->Stop(); pj->node->DetachObject(pj->trailFx); DiEffectManager::GetInstance().DestroyParticleSystem(pj->trailFx); if(entityPtr && pj->impactFx) { entityPtr->GetRenderObj()->GetNode()->AttachObject(pj->impactFx); pj->impactFx->AttachModel(entityPtr->GetRenderObj()->GetModel()); pj->impactFx->Start(); } DI_DELETE pj; iter = mProjectiles.erase(iter); } else { ++iter; } } } DiParticleSystemPtr ArFxProperty::PlayParticleSystem(const DiString& templateName) { DiString name; name.Format("EtFx_%d_%d", mEntity->GetID(), mFxCount++); DiParticleSystemPtr ret = DiEffectManager::GetInstance().CreateParticleSystem(name, templateName); DiCullNode* node = Driver->GetSceneManager()->GetRootNode()->CreateChild(); node->AttachObject(ret); ret->AttachModel(mEntity->GetRenderObj()->GetModel()); ret->AddParticleSystemListener(this); ret->Start(); mEffects.insert(ret.get()); return ret; } void ArFxProperty::PlayProjectile(uint32 entityID) { if(!mCurrentConfig) { Init(); } if (mTrailFxName.empty()) return; auto entity = GetEntity<ArDynEntity>(); auto entityConfig = entity->GetAttribute()->GetEntityConfig(); auto pos = entity->GetRenderObj()->GetWorldPosition(); auto rot = entity->GetRenderObj()->GetNode()->GetDerivedOrientation(); DiString name; name.Format("EtPj_%d_%d", mEntity->GetID(), mFxCount++); DiString impactname; impactname.Format("EtImp_%d_%d", mEntity->GetID(), mFxCount++); DiParticleSystemPtr trailFx = DiEffectManager::GetInstancePtr()->CreateParticleSystem(name, mTrailFxName); DiCullNode* node = Driver->GetSceneManager()->GetRootNode()->CreateChild(); node->AttachObject(trailFx); node->SetPosition(pos); trailFx->AttachModel(mEntity->GetRenderObj()->GetModel()); trailFx->Start(); DiParticleSystemPtr impactFx = DiEffectManager::GetInstancePtr()->CreateParticleSystem(impactname, mImpactFxName); impactFx->AddParticleSystemListener(this); Projectile* pj = DI_NEW Projectile(); pj->speed = mCurrentConfig->speed; pj->curPos = pos + rot * (entityConfig->attackoffset * entityConfig->GetMaxPreGlobalScale()); pj->trailFx = trailFx; pj->impactFx = impactFx; pj->node = node; pj->targetID = entityID; node->SetPosition(pj->curPos); mProjectiles.push_back(pj); } void ArFxProperty::Init() { auto entity = GetEntity<ArDynEntity>(); auto entityConfig = entity->GetAttribute()->GetEntityConfig(); if(!entityConfig) { DI_WARNING("No valid entity config!"); return; } DiString pjName = entityConfig->attackprojectile[0]; mCurrentConfig = entityConfig->GetProjectile(pjName); if(!mCurrentConfig) { //DI_WARNING("Failed to get the projectile config"); return; } mTrailFxName = entityConfig->path + "projectile/" + mCurrentConfig->traileffect; mImpactFxName = entityConfig->path + "projectile/" + mCurrentConfig->impacteffect; } void ArFxProperty::HandleParticleSystemEvent(DiParticleSystem* particleSystem, DiFxEvent& event) { if (event.eventType == PU_EVT_SYSTEM_STOPPED) { auto node = particleSystem->GetParentCullNode(); node->DetachObject(particleSystem); DiEffectManager::GetInstance().DestroyParticleSystem(particleSystem->GetName()); } } }
package jp.mydns.sys1yagi.android.jsoupsample; import org.jsoup.Jsoup; import org.jsoup.safety.Whitelist; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.EditText; public class SanitizeActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sanitize); final EditText inputText = (EditText) findViewById(R.id.input_text); inputText .setText("<p><a href='http://example.com/' onclick='doAttack()'>Link</a></p>"); final EditText sanitizedText = (EditText) findViewById(R.id.sanitized_text); findViewById(R.id.sanitize_button).setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { String sanitized = Jsoup.clean(inputText.getText() .toString(), Whitelist.basic()); sanitizedText.setText(sanitized); } }); } }
Leading Internet companies including Google, Ebay, IAC, Microsoft, Yahoo and Amazon issued a letter sharply critical of a House bill that would hamstring the FCC from implementing net neutrality regulations. Leading Internet companies including Google, Ebay, IAC, Microsoft, Yahoo and Amazon issued a letter sharply critical of a House bill that would hamstring the FCC from implementing net neutrality regulations, the Washington Post reports. The bill, championed by House Commerce Committee Chairman Joe Barton (R-Tex.), would allow the FCC to decide disputes about Web access only case by case and would bar the agency from writing detailed rules on the subject. Open-Internet advocates said the bill would make the FCC toothless in the area of net neutrality, which is the concept that companies controlling Internet access should not use that power to block or slow particular Web services. "We are extremely concerned that legislation before your committee would fail to protect the Internet from discrimination and would deny consumers unfettered access," six companies wrote in a letter to Barton and Rep. Fred Upton (R-Mich.), who is chairman of the panel's subcommittee on telecommunications and the Internet. "We have urged Congress to adopt network neutrality requirements that are meaningful and enforceable. The provisions in the committee bill achieve neither goal," the letter said. "The 'network neutrality' section of the bill represents a body blow to the Internet community," Markey said. "It removes FCC authority to establish any future rules needed to ensure that consumers and competitors can avail themselves of the Internet experience they enjoy today."
Ti=Trade_Secret sec=“{_Trade_Secrets}” means any scientific or technical data, information, design, process, procedure, formula, or improvement that is commercially available to the {_Company} or a {_Company_Affiliate} and is not generally known in the industry; including not only information belonging to the {_Company} which existed before the date of this {_Agreement}, but also information developed by the {_Employee} for the {_Company} or its employees during the {_Employee}’s employment and thereafter. =[G/Z/ol/Base]
SCOTLAND has been selected as the site for a new mechanical engineering research station, which is to be set up by the Department of Scientific and Industrial Research. The station will undertake basic work to form the foundation of mechanical engineering development and supplement the research undertaken in mechanical engineering by leading Government industrial and University establishments. A road research sub-station is also to be set up in Scotland. The D.S.I.R. points out that Scottish road problems differ from those experienced farther south. In Scotland the highways have to withstand more prolonged periods of cold or wet weather The average density of traffic is also somewhat lower than in the south, so that bituminous surfaces do not receive as much of the beneficial kneading that is afforded by the passage of traffic on busier roads. THE recent reference by Sir Stafford Cripps to the need for effective and attractive packaging for export throws topical light on a handbook prepared during the war by the British Standards Institution. This handbook; with a supplement entitled "Recommendations for Preservation and Packaging for Tropical Theatres of War," applies with equal emphasis to goods exported for civilian use. Section 3 of the main Packaging Code deals specifically with the prevention of corrosion, and copies of it may be obtained from the Institution at 28, Victoria Street, London, S.W.I, at 6s. by post. The supplement costs 7s. 6d. In addition, a revision of the section on wood containers is available in proof form at 6s. THE following reports on German industry can be consulted at public libraries or are available from H.M. Stationery Office:—B.I.O.S. 1423: The application of Aluminium and its Alloys in Germany, 5s. 6d., F.I.A.T. 1018: Rubber Vulcanization Accejerators produced by I.G.Farbenindustrie, gs.; F.I.A.T. 1034; English Translation of the Future of Gas Turbine Installations," 9s. EdARGE stocks of pistons, liners, thinshell bearings, and other components are held at 22, Brompton Road, London, S.W.3, by Messrs. Phcenix Components. This depot is now open to the trade. AREVISED edition of its policy brochure is being circulated by the Traders' Road Transport Association. One of the principal aims. of the Association is to preserve freedom in the operation of C-licensed vehicles and to maintain for traders an unfettered choice of any available means for transport. A28 The Association does not seek relaxation of the prohibition on operation for hire or reward by ancillary users. It maintains, however, that statutory regulations should not exceed the bounds prescribed by public safety and proper conditions of employment. Although supporting all efforts to improve the conditions of drivers, the T.R.T.A, considers that the present statutory requirements in the matter of pay amply safeguard the standards of employment of those engaged in work connected with C-licensed vehicles. riA PORTABLE plant for the distillation of water for batteries has been introduced under the name of Deminrolit by the Permutit Co., Ltd., Perm utit House, Gunnersbury Avenue, London, W.4. It weighs 56 lb. and can supply up to 75 gallons between each regeneration process. The water is freed from minerals by a chemical process known as ion exchange, for which neither heat nor power is needed. The equipment requires only to be regenerated periodically, as with the normal-type base exchange water softener. Regeneration is effected by hydrochloric acid and sodium-carbonate solutions prepared in a collapsible plastic tank. An electric tester is attached to the plant to indicate when regeneration is required. The full regeneration cycle is accomplished by turning a knob on the indicator. products is available in Britain. The materials are described in a booklet, entitled "The New Cutting Oil Concentrates and Additives for Lubricating Oils," just published by Petroleum Inventions, Ltd. (a member of the Manchester Oil Refinery group of tompanies), Trafford Park, Manchester. The range of additives has been developed mainly for use in transmission and engine lubricants. It is stated that such additives afford extreme-pressure properties to gear lubricants, improve oxidation resistance and impart detergency to oils for compression-ignition and petrol engines, in addition to inhibiting bearing corrosion. A BOOK FOR THE STUDENT QTUDENTS of motor engineering will find useful information in a new pocket-size book entitled "Questions and Answers on Automobile Engines," which is published by George Newnes, Ltd., at 5s. The author, D. J. Smith. 0.B.E., M.I.Mech.E., deals with the subject in simple terms, and the book is adequately illustrated by drawings and photographs. . ARE SERVICE DRIVERS MORE CAREFUL THAN CIVILIANS? SERVICE drivers, who are often harshly criticized, 1.ave been vindicated as the result of an investigation by impartial research workers into accidents in which military vehicles were involved. Records of accidents to Service vehicles over a period of two months have been analysed, and a report has been considered by the Road Research Board Of the Department of Scientific and Industrial Research. During this period, 7,000 lorries ran nearly 12,000,000 miles and had 838 accidents, only one-fifth of which produced injury. Carelessness in varying degrees on the part of one or both the drivers concerned was noted in nearly two-thirds of all the accidents analysed. In vehicle-to-vehicle collisions, impartial investigators regarded 39 per cent, of the Service drivers as careless, against 49 per rent. in the case of civilian drivers. the total for July being 17,883. This reduces the Monthly average this year to 16,008. The above table gives the figures for the respective classes, the total for the first eight months 'of 1947 being 128,068. IS BACK-DATED POLICY LEGAL COVER? WHERE an insurance company IN back-dates a policy, is the holder legally covered, for that period? The question was raised at Fleetwood, when a man was fined £2 for using a vehicle Without a policy of insurance for third-party risk. Defendant' /produced a policy taken out on the, day of the offence. He had asked the company, 1.CI back-date it six days. The• clerk ruled, as a point of law, the defendant was covered. The chairman' said that he had never known a similar case. Apparently, on the policy, defendant was covered, but he admitted that it was back-dated and there would be a conviction without disqualification. 11 the air in India. In Madras the first victim was to have been the Madras City Bus Service, which was to have been taken over on October 1, but the completion will not now be until early next year. The Government target is to have 300 buses in the city, of which 40 will act as a reserve. Later there is to be a comprehensive scheme covering the entire Province. There are already some 30 State buses in Madras itself, and the remaining 270 were to have been taken over from private operators, but these would not agree to sell at the Government valuation. The Provincial Motor Transport Controller has ordered, in Bombay, 150 petrol buses. also 50 oilers, from an Italian concern. By agreement, some Government buses will be introduced in the middle of each month, and will run on services from which private operators have withdrawn by common consent. Of the new buses, General Motors are expected to supply 75 Chevrolets, and Messrs. Simpson and . Co., of Madras, 75 Fords. Bombay Province is to begin nationalization in April of next year. The process is expected to take three years. Services run by private operators will be taken over in gradual stages and in -selected zanes. The owners will be given reasonable compensation for serviceable assets, with additional sums in respect of permits terminated by the Government before their expiry. The scheme has aroused considerable opposition from many operators. According to th Government arrangements, national services will run throughout the Provinces except in the bigger cities, where the municipal authorities would take over the work of transporting passengers. . The Nizam's Government in Hyderabad is to purchase 420 buses. The State already has 1 double-deckers and 75 single-deckers, and about 200 more are expected by the end of next year. They will be assembled locally from components. TWO NEW STANDARDS SET UP 'TWO new British standards are i announced. B.S. No. 1382 deals with portable fire extinguishers of the gas water-pressure type of riveted construction. Copies, price 2s. each, can be obtained from the British Standards Institution, 28, Victoria Street, London, S.W.1. B.S. No. 466 refers to electric travelling overhead cranes, and copies cost 4s. DIRTY WORK: CLEAN HANDS Ay/F. have recently tested a new hand VI' cleanser called " Swarfega," which is being produced by Deb Chemical Proprietaries, Ltd., of Forfar Works, Spencer Road, Belper. An antiseptic preparation of non-abrasive jelly, it removes grease and carbon from the hands with ease. It is claimed to prevent dermatitis or kindred skin complaints. A dispenser can be supplied for fixing over factory washbasins, giving a sufficient quantity at one stroke thoroughly to cleanse the hands, thus avoiding waste. ra.A SIMPLE warning device that operates the horn when an attempt is made to tamper with the vehicle is being marketed by Hamilton Motors (London), Ltd., 466, Edgware Road, London, W.I. "the mechanism is wired to the horn, which, when an unauthorized person touches the vehicle, emits intermittent blasts. THE National Arbitration Tribunal has rejected the , claim of a 62-year-old bus driver, Mr. George Ratlidge, for reinstatement, Messrs. F. and J. Mitchell, of Laurencekirk, near MontrOse, dismissed him because they did not regard him as a satisfactory driver. A NORTH-EASTERN ser vice depot near Gatesheadon-Tyne has been opened by Leyland Motors, Ltd., Leyland, Lancs. This is the tenth of the company's own depots in Great Britain. Local council officials and well-known Leyland operators in the district were welcomed at the depot by Mr. C. B. Nixon, governing director of Leyland Motors, Ltd. Covering a floor space of 14,000 sq. ft., the depot has been built on the .Team Valley Estate. It is adjacent to the Great North Road and to the road from Newcastle to the west. Its modern layout comprises a repair bay 90 ft. by 60 ft. CAPT. G. T. &Arm CLARKE, M.I.Mech.E., F.R.Ae.S., chief engineer and general manager of Alvis, Ltd., has been elected chairman of the Automobile Division af the Institution of Mechanical Engineers. His first experience in motor engineering was gained in the road motor department of the Great Western Railway, which he joined in 1905. During the war, Capt. SmithClarke was responsible for some 20 factories controlled by Alvis, Ltd. In 1933 he was elected a member of the Council of the former Institution of Automobile Engineers and was a vice-president when that body was incorporated in the present organization. MR. B. S. WILLIAMS, managing director, Hants and Sussex Motor Services, Ltd., has become chairman and managing director of the Portsdown Motor Co. (Portsmouth), Ltd., Cosham, Hants. MR. J. W R. WHITE has become Dunlop's deputy district manager at Glasgow He forme. ly occupied a similar position in Edinburgh after leaving the R.A.F.
import React from 'react'; import PropTypes from 'prop-types'; import { setupI18n } from '@lingui/core'; import { I18nProvider } from '@lingui/react'; import LocalizationLoader from './LocalizationLoader'; export const i18n = setupI18n(); class RootLocalizationProvider extends React.PureComponent { static propTypes = { children: PropTypes.node.isRequired, }; render() { return ( <LocalizationLoader> {({ language, catalogs }) => ( <I18nProvider i18n={i18n} language={language} catalogs={catalogs}> {this.props.children} </I18nProvider> )} </LocalizationLoader> ); } } export default RootLocalizationProvider;
.size 8000 .code@48 jp l1000 .code@100 jp l150 .data@143 80 .code@150 l150: xor a, a dec a ldff(45), a l154: ld c, 44 ld b, 03 ldff a, (c) nop cmp a, b jpnz l154 ld a, 40 ldff(41), a ld a, 02 ldff(ff), a ei ld a, b inc a inc a ldff(45), a ld c, 0f .code@1000 l1000: nop .code@1066 inc a ldff(45), a nop nop nop nop nop nop nop ldff a, (c) and a, b ld(ff80), a jp l7000 .code@2000 l2000: nop .code@6ffd jp l2000 l7000: ld c, 44 ld b, 91 l7004: ldff a, (c) cmp a, b jpnz l7004 xor a, a ldff(40), a ld bc, 7a00 ld hl, 8000 ld d, a0 l7014: ld a, (bc) inc bc ld(hl++), a dec d jpnz l7014 ld a, c0 ldff(47), a ld a, 80 ldff(68), a ld a, ff ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ldff(69), a ld a, 00 ldff(69), a ldff(69), a ld a, (ff80) ld(9800), a xor a, a ldff(43), a ld a, 91 ldff(40), a jp l2000 .data@7a02 7f 7f 41 41 41 41 41 41 41 41 41 41 7f 7f 00 00 08 08 08 08 08 08 08 08 08 08 08 08 08 08 00 00 7f 7f 01 01 01 01 7f 7f 40 40 40 40 7f 7f 00 00 7f 7f 01 01 01 01 3f 3f 01 01 01 01 7f 7f 00 00 41 41 41 41 41 41 7f 7f 01 01 01 01 01 01 00 00 7f 7f 40 40 40 40 7e 7e 01 01 01 01 7e 7e 00 00 7f 7f 40 40 40 40 7f 7f 41 41 41 41 7f 7f 00 00 7f 7f 01 01 02 02 04 04 08 08 10 10 10 10 00 00 3e 3e 41 41 41 41 3e 3e 41 41 41 41 3e 3e 00 00 7f 7f 41 41 41 41 7f 7f 01 01 01 01 7f 7f
<?php /* * This file is part of the RSQueue library * * Copyright (c) 2016 - now() Marc Morera * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Feel free to edit as you please, and have fun. * * @author Marc Morera <[email protected]> */ declare(strict_types=1); namespace RSQueueBundle\Collector; use Exception; use RSQueue\Event\RSQueueProducerEvent; use RSQueue\Event\RSQueuePublisherEvent; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollector; /** * Collector for RSQueue data. * * All these methods are subscribed to custom RSQueueBundle events */ class RSQueueCollector extends DataCollector { /** * Construct method for initializate all data. * * Also initializes total value to 0 */ public function __construct() { $this->reset(); } /** * Subscribed to RSQueueProducer event. * * Add to collect data a new producer action * * @param RSQueueProducerEvent $event Event fired * * @return RSQueueCollector self Object */ public function onProducerAction(RSQueueProducerEvent $event) { ++$this->data['total']; $this->data['prod'][] = [ 'payload' => $event->getPayloadSerialized(), 'queue' => $event->getQueueName(), ]; return $this; } /** * Subscribed to RSQueuePublisher event. * * Add to collect data a new publisher action * * @param RSQueuePublisherEvent $event Event fired * * @return RSQueueCollector self Object */ public function onPublisherAction(RSQueuePublisherEvent $event) { ++$this->data['total']; $this->data['publ'][] = [ 'payload' => $event->getPayloadSerialized(), 'queue' => $event->getChannelName(), ]; return $this; } /** * Get total of queue interactions. * * @return int */ public function getTotal() { return (int) $this->data['total']; } /** * Get producer collection. * * @return array */ public function getProducer() { return $this->data['prod']; } /** * Get publisher collection. * * @return array */ public function getPublisher() { return $this->data['publ']; } /** * Collects data for the given Request and Response. * * @param Request $request * @param Response $response * @param \Exception $exception * * @api */ public function collect( Request $request, Response $response, Exception $exception = null ) { } /** * Reset collector. */ public function reset() { $this->total = 0; $this->data = [ 'prod' => [], 'publ' => [], 'total' => 0, ]; } /** * Return collector name. * * @return string Collector name */ public function getName() { return 'rsqueue_collector'; } }
KANSAS CITY, Kan. (AP) — A 58-year-old Leawood lawyer has been sentenced to one year and six months in prison for not paying his taxes. David Mandelbaum was sentenced Monday for tax evasion. He also was ordered to pay more than $200,000 in restitution to the Internal Revenue Service. Mandelbaum pleaded guilty in August to owing more than $132,000 for the 2005, 2006, 2007, 2009 and 2010 tax years. Prosecutors say Mandelbaum tried to hide his assets and income by setting up bank accounts under other identities and making false statements. He also mingled personal funds with trust funds that were supposed to be solely for clients’ money.
/* PostMonster, universal HTTP automation tool * Copyright (C) 2015 by Paul Artsishevsky <[email protected]> * * This file is part of PostMonster. * * PostMonster is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * PostMonster is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PostMonster. If not, see <http://www.gnu.org/licenses/>. */ #include "pluginregistry.h" #include <QSettings> #include <QPluginLoader> #include <QDir> PluginRegistry &PluginRegistry::instance() { static PluginRegistry m_instance; return m_instance; } void PluginRegistry::loadPlugins(const PostMonster::APIFunctions &api) { QDir pluginsDir = QDir::current(); pluginsDir.cd("plugins"); QSettings settings; int size = settings.beginReadArray("Plugins"); // Load static plugins QHash<QObject *, QPair<QJsonObject, QPluginLoader *> > plugins; foreach (const QStaticPlugin &plugin, QPluginLoader::staticPlugins()) { QObject *pluginInstance = plugin.instance(); plugins[pluginInstance] = QPair<QJsonObject, QPluginLoader *>(plugin.metaData(), nullptr); } // Load dynamic plugins for (int i = 0; i < size; ++i) { settings.setArrayIndex(i); QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath( settings.value("filename").toString())); QObject *pluginInstance = loader->instance(); plugins[pluginInstance] = QPair<QJsonObject, QPluginLoader *>(loader->metaData(), loader); } // Activate plugins QHashIterator<QObject *, QPair<QJsonObject, QPluginLoader *>> i(plugins); while (i.hasNext()) { i.next(); QObject *instance = i.key(); QJsonObject metaData = i.value().first["MetaData"].toObject(); QPluginLoader *loader = i.value().second; PostMonster::ToolPluginInterface *tool = qobject_cast<PostMonster::ToolPluginInterface *>(instance); if (tool) { PluginData *pluginData = new PluginData; pluginData->type = PostMonster::Tool; pluginData->instance = tool; pluginData->loader = loader; pluginData->info = metaData; //TODO Check for existent plugins with the same id m_plugins[metaData["id"].toString()] = pluginData; m_info[tool] = &pluginData->info; // Add tool plugins to toolbar tool->load(api); emit toolPluginLoaded(instance); } } } PostMonster::ToolPluginInterface *PluginRegistry::tool(const QString &name) { if (m_plugins.contains(name) && m_plugins[name]->type == PostMonster::Tool) { return dynamic_cast<PostMonster::ToolPluginInterface *>(m_plugins[name]->instance); } return nullptr; } const QJsonObject &PluginRegistry::info(const PostMonster::PluginInterface *plugin) { return *m_info[plugin]; } const QList<PluginRegistry::PluginData *> PluginRegistry::plugins(PostMonster::PluginType type) { QList<PluginData *> result; foreach (PluginData *plugin, m_plugins.values()) { if (plugin->type & type) result << plugin; } return result; } PluginRegistry::~PluginRegistry() { qDeleteAll(m_plugins.values()); }
module.exports = [ { method: 'POST', path: '/{model}', handler: 'FootprintController.create' }, { method: 'GET', path: '/{model}/{id?}', handler: 'FootprintController.find' }, { method: [ 'PUT', 'PATCH' ], path: '/{model}/{id?}', handler: 'FootprintController.update' }, { method: 'DELETE', path: '/{model}/{id?}', handler: 'FootprintController.destroy' }, { method: 'POST', path: '/{parentModel}/{parentId}/{childAttribute}', handler: 'FootprintController.createAssociation' }, { method: 'GET', path: '/{parentModel}/{parentId}/{childAttribute}/{childId?}', handler: 'FootprintController.findAssociation' }, { method: 'PUT', path: '/{parentModel}/{parentId}/{childAttribute}/{childId?}', handler: 'FootprintController.updateAssociation' }, { method: 'DELETE', path: '/{parentModel}/{parentId}/{childAttribute}/{childId?}', handler: 'FootprintController.destroyAssociation' } ]
/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2008, Digium, Inc. * * Tilghman Lesher <[email protected]> * * See http://www.asterisk.org for more information about * the Asterisk project. Please do not directly contact * any of the maintainers of this project for assistance; * the project provides a web site, mailing lists and IRC * channels for your use. * * This program is free software, distributed under the terms of * the GNU General Public License Version 2. See the LICENSE file * at the top of the source tree. */ /*! \file * * \brief curl plugin for portable configuration engine * * \author Tilghman Lesher <[email protected]> * * \extref Depends on the CURL library - http://curl.haxx.se/ * */ /*** MODULEINFO <depend>curl</depend> ***/ #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include <curl/curl.h> #include "asterisk/file.h" #include "asterisk/channel.h" #include "asterisk/pbx.h" #include "asterisk/config.h" #include "asterisk/module.h" #include "asterisk/lock.h" #include "asterisk/utils.h" #include "asterisk/threadstorage.h" AST_THREADSTORAGE(query_buf); AST_THREADSTORAGE(result_buf); /*! * \brief Execute a curl query and return ast_variable list * \param url The base URL from which to retrieve data * \param unused Not currently used * \param ap list containing one or more field/operator/value set. * * \retval var on success * \retval NULL on failure */ static struct ast_variable *realtime_curl(const char *url, const char *unused, va_list ap) { struct ast_str *query, *buffer; char buf1[256], buf2[256]; const char *newparam, *newval; char *stringp, *pair, *key; int i; struct ast_variable *var = NULL, *prev = NULL; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return NULL; } if (!(query = ast_str_thread_get(&query_buf, 16))) { return NULL; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return NULL; } ast_str_set(&query, 0, "${CURL(%s/single,", url); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); ast_str_append(&query, 0, ")}"); ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); /* Remove any trailing newline characters */ if ((stringp = strchr(ast_str_buffer(buffer), '\r')) || (stringp = strchr(ast_str_buffer(buffer), '\n'))) { *stringp = '\0'; } stringp = ast_str_buffer(buffer); while ((pair = strsep(&stringp, "&"))) { key = strsep(&pair, "="); ast_uri_decode(key, ast_uri_http); if (pair) { ast_uri_decode(pair, ast_uri_http); } if (!ast_strlen_zero(key)) { if (prev) { prev->next = ast_variable_new(key, S_OR(pair, ""), ""); if (prev->next) { prev = prev->next; } } else { prev = var = ast_variable_new(key, S_OR(pair, ""), ""); } } } return var; } /*! * \brief Excute an Select query and return ast_config list * \param url * \param unused * \param ap list containing one or more field/operator/value set. * * \retval struct ast_config pointer on success * \retval NULL on failure */ static struct ast_config *realtime_multi_curl(const char *url, const char *unused, va_list ap) { struct ast_str *query, *buffer; char buf1[256], buf2[256]; const char *newparam, *newval; char *stringp, *line, *pair, *key, *initfield = NULL; int i; struct ast_variable *var = NULL; struct ast_config *cfg = NULL; struct ast_category *cat = NULL; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return NULL; } if (!(query = ast_str_thread_get(&query_buf, 16))) { return NULL; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return NULL; } ast_str_set(&query, 0, "${CURL(%s/multi,", url); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); if (i == 0) { char *op; initfield = ast_strdupa(newparam); if ((op = strchr(initfield, ' '))) *op = '\0'; } ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); ast_str_append(&query, 0, ")}"); /* Do the CURL query */ ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); if (!(cfg = ast_config_new())) { return NULL; } /* Line oriented output */ stringp = ast_str_buffer(buffer); while ((line = strsep(&stringp, "\r\n"))) { if (ast_strlen_zero(line)) { continue; } if (!(cat = ast_category_new("", "", 99999))) { continue; } while ((pair = strsep(&line, "&"))) { key = strsep(&pair, "="); ast_uri_decode(key, ast_uri_http); if (pair) { ast_uri_decode(pair, ast_uri_http); } if (!strcasecmp(key, initfield) && pair) { ast_category_rename(cat, pair); } if (!ast_strlen_zero(key)) { var = ast_variable_new(key, S_OR(pair, ""), ""); ast_variable_append(cat, var); } } ast_category_append(cfg, cat); } return cfg; } /*! * \brief Execute an UPDATE query * \param url * \param unused * \param keyfield where clause field * \param lookup value of field for where clause * \param ap list containing one or more field/value set(s). * * Update a database table, prepare the sql statement using keyfield and lookup * control the number of records to change. All values to be changed are stored in ap list. * Sub-in the values to the prepared statement and execute it. * * \retval number of rows affected * \retval -1 on failure */ static int update_curl(const char *url, const char *unused, const char *keyfield, const char *lookup, va_list ap) { struct ast_str *query, *buffer; char buf1[256], buf2[256]; const char *newparam, *newval; char *stringp; int i, rowcount = -1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return -1; } if (!(query = ast_str_thread_get(&query_buf, 16))) { return -1; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return -1; } ast_uri_encode(keyfield, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(lookup, buf2, sizeof(buf2), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/update?%s=%s,", url, buf1, buf2); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); ast_str_append(&query, 0, ")}"); ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); /* Line oriented output */ stringp = ast_str_buffer(buffer); while (*stringp <= ' ') { stringp++; } sscanf(stringp, "%30d", &rowcount); if (rowcount >= 0) { return (int)rowcount; } return -1; } static int update2_curl(const char *url, const char *unused, va_list ap) { struct ast_str *query, *buffer; char buf1[200], buf2[200]; const char *newparam, *newval; char *stringp; int rowcount = -1, lookup = 1, first = 1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return -1; } if (!(query = ast_str_thread_get(&query_buf, 1000))) return -1; if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return -1; } ast_str_set(&query, 0, "${CURL(%s/update?", url); for (;;) { if ((newparam = va_arg(ap, const char *)) == SENTINEL) { if (lookup) { lookup = 0; ast_str_append(&query, 0, ","); /* Back to the first parameter; we don't need a starting '&' */ first = 1; continue; } else { break; } } newval = va_arg(ap, const char *); ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", first ? "" : "&", buf1, buf2); first = 0; } va_end(ap); ast_str_append(&query, 0, ")}"); /* Proxies work, by setting CURLOPT options in the [globals] section of * extensions.conf. Unfortunately, this means preloading pbx_config.so * so that they have an opportunity to be set prior to startup realtime * queries. */ ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); /* Line oriented output */ stringp = ast_str_buffer(buffer); while (*stringp <= ' ') { stringp++; } sscanf(stringp, "%30d", &rowcount); if (rowcount >= 0) { return (int)rowcount; } return -1; } /*! * \brief Execute an INSERT query * \param url * \param unused * \param ap list containing one or more field/value set(s) * * Insert a new record into database table, prepare the sql statement. * All values to be changed are stored in ap list. * Sub-in the values to the prepared statement and execute it. * * \retval number of rows affected * \retval -1 on failure */ static int store_curl(const char *url, const char *unused, va_list ap) { struct ast_str *query, *buffer; char buf1[256], buf2[256]; const char *newparam, *newval; char *stringp; int i, rowcount = -1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return -1; } if (!(query = ast_str_thread_get(&query_buf, 1000))) { return -1; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return -1; } ast_str_set(&query, 0, "${CURL(%s/store,", url); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); ast_str_append(&query, 0, ")}"); ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); stringp = ast_str_buffer(buffer); while (*stringp <= ' ') { stringp++; } sscanf(stringp, "%30d", &rowcount); if (rowcount >= 0) { return rowcount; } return -1; } /*! * \brief Execute an DELETE query * \param url * \param unused * \param keyfield where clause field * \param lookup value of field for where clause * \param ap list containing one or more field/value set(s) * * Delete a row from a database table, prepare the sql statement using keyfield and lookup * control the number of records to change. Additional params to match rows are stored in ap list. * Sub-in the values to the prepared statement and execute it. * * \retval number of rows affected * \retval -1 on failure */ static int destroy_curl(const char *url, const char *unused, const char *keyfield, const char *lookup, va_list ap) { struct ast_str *query, *buffer; char buf1[200], buf2[200]; const char *newparam, *newval; char *stringp; int i, rowcount = -1; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return -1; } if (!(query = ast_str_thread_get(&query_buf, 1000))) { return -1; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return -1; } ast_uri_encode(keyfield, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(lookup, buf2, sizeof(buf2), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/destroy,%s=%s&", url, buf1, buf2); for (i = 0; (newparam = va_arg(ap, const char *)); i++) { newval = va_arg(ap, const char *); ast_uri_encode(newparam, buf1, sizeof(buf1), ast_uri_http); ast_uri_encode(newval, buf2, sizeof(buf2), ast_uri_http); ast_str_append(&query, 0, "%s%s=%s", i > 0 ? "&" : "", buf1, buf2); } va_end(ap); ast_str_append(&query, 0, ")}"); ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); /* Line oriented output */ stringp = ast_str_buffer(buffer); while (*stringp <= ' ') { stringp++; } sscanf(stringp, "%30d", &rowcount); if (rowcount >= 0) { return (int)rowcount; } return -1; } static int require_curl(const char *url, const char *unused, va_list ap) { struct ast_str *query, *buffer; char *elm, field[256]; int type, size; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return -1; } if (!(query = ast_str_thread_get(&query_buf, 100))) { return -1; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return -1; } ast_str_set(&query, 0, "${CURL(%s/require,", url); while ((elm = va_arg(ap, char *))) { type = va_arg(ap, require_type); size = va_arg(ap, int); ast_uri_encode(elm, field, sizeof(field), ast_uri_http); ast_str_append(&query, 0, "%s=%s%%3A%d", field, type == RQ_CHAR ? "char" : type == RQ_INTEGER1 ? "integer1" : type == RQ_UINTEGER1 ? "uinteger1" : type == RQ_INTEGER2 ? "integer2" : type == RQ_UINTEGER2 ? "uinteger2" : type == RQ_INTEGER3 ? "integer3" : type == RQ_UINTEGER3 ? "uinteger3" : type == RQ_INTEGER4 ? "integer4" : type == RQ_UINTEGER4 ? "uinteger4" : type == RQ_INTEGER8 ? "integer8" : type == RQ_UINTEGER8 ? "uinteger8" : type == RQ_DATE ? "date" : type == RQ_DATETIME ? "datetime" : type == RQ_FLOAT ? "float" : "unknown", size); } va_end(ap); ast_str_append(&query, 0, ")}"); ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); return atoi(ast_str_buffer(buffer)); } static struct ast_config *config_curl(const char *url, const char *unused, const char *file, struct ast_config *cfg, struct ast_flags flags, const char *sugg_incl, const char *who_asked) { struct ast_str *query, *buffer; char buf1[200]; char *stringp, *line, *pair, *key; int last_cat_metric = -1, cat_metric = -1; struct ast_category *cat = NULL; char *cur_cat = ""; char *category = "", *var_name = "", *var_val = ""; struct ast_flags loader_flags = { 0 }; if (!ast_custom_function_find("CURL")) { ast_log(LOG_ERROR, "func_curl.so must be loaded in order to use res_config_curl.so!!\n"); return NULL; } if (!(query = ast_str_thread_get(&query_buf, 100))) { return NULL; } if (!(buffer = ast_str_thread_get(&result_buf, 16))) { return NULL; } ast_uri_encode(file, buf1, sizeof(buf1), ast_uri_http); ast_str_set(&query, 0, "${CURL(%s/static?file=%s)}", url, buf1); /* Do the CURL query */ ast_str_substitute_variables(&buffer, 0, NULL, ast_str_buffer(query)); /* Line oriented output */ stringp = ast_str_buffer(buffer); cat = ast_config_get_current_category(cfg); while ((line = strsep(&stringp, "\r\n"))) { if (ast_strlen_zero(line)) { continue; } while ((pair = strsep(&line, "&"))) { key = strsep(&pair, "="); ast_uri_decode(key, ast_uri_http); if (pair) { ast_uri_decode(pair, ast_uri_http); } if (!strcasecmp(key, "category")) { category = S_OR(pair, ""); } else if (!strcasecmp(key, "var_name")) { var_name = S_OR(pair, ""); } else if (!strcasecmp(key, "var_val")) { var_val = S_OR(pair, ""); } else if (!strcasecmp(key, "cat_metric")) { cat_metric = pair ? atoi(pair) : 0; } } if (!strcmp(var_name, "#include")) { if (!ast_config_internal_load(var_val, cfg, loader_flags, "", who_asked)) return NULL; } if (!cat || strcmp(category, cur_cat) || last_cat_metric != cat_metric) { if (!(cat = ast_category_new(category, "", 99999))) break; cur_cat = category; last_cat_metric = cat_metric; ast_category_append(cfg, cat); } ast_variable_append(cat, ast_variable_new(var_name, var_val, "")); } return cfg; } static struct ast_config_engine curl_engine = { .name = "curl", .load_func = config_curl, .realtime_func = realtime_curl, .realtime_multi_func = realtime_multi_curl, .store_func = store_curl, .destroy_func = destroy_curl, .update_func = update_curl, .update2_func = update2_curl, .require_func = require_curl, }; static int reload_module(void) { struct ast_flags flags = { CONFIG_FLAG_NOREALTIME }; struct ast_config *cfg; struct ast_variable *var; if (!(cfg = ast_config_load("res_curl.conf", flags))) { return 0; } else if (cfg == CONFIG_STATUS_FILEINVALID) { ast_log(LOG_WARNING, "res_curl.conf could not be parsed!\n"); return 0; } if (!(var = ast_variable_browse(cfg, "globals")) && !(var = ast_variable_browse(cfg, "global")) && !(var = ast_variable_browse(cfg, "general"))) { ast_log(LOG_WARNING, "[globals] not found in res_curl.conf\n"); ast_config_destroy(cfg); return 0; } for (; var; var = var->next) { if (strncmp(var->name, "CURLOPT(", 8)) { char name[256]; snprintf(name, sizeof(name), "CURLOPT(%s)", var->name); pbx_builtin_setvar_helper(NULL, name, var->value); } else { pbx_builtin_setvar_helper(NULL, var->name, var->value); } } ast_config_destroy(cfg); return 0; } static int unload_module(void) { ast_config_engine_deregister(&curl_engine); ast_verb(1, "res_config_curl unloaded.\n"); return 0; } static int load_module(void) { if (!ast_module_check("res_curl.so")) { if (ast_load_resource("res_curl.so") != AST_MODULE_LOAD_SUCCESS) { ast_log(LOG_ERROR, "Cannot load res_curl, so res_config_curl cannot be loaded\n"); return AST_MODULE_LOAD_DECLINE; } } if (!ast_module_check("func_curl.so")) { if (ast_load_resource("func_curl.so") != AST_MODULE_LOAD_SUCCESS) { ast_log(LOG_ERROR, "Cannot load func_curl, so res_config_curl cannot be loaded\n"); return AST_MODULE_LOAD_DECLINE; } } reload_module(); ast_config_engine_register(&curl_engine); ast_verb(1, "res_config_curl loaded.\n"); return 0; } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Realtime Curl configuration", .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_REALTIME_DRIVER, );
/* $NetBSD: ieee80211_proto.h,v 1.22 2013/03/30 15:12:28 christos Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/net80211/ieee80211_proto.h,v 1.16 2005/08/13 17:31:48 sam Exp $ */ #ifndef _NET80211_IEEE80211_PROTO_H_ #define _NET80211_IEEE80211_PROTO_H_ /* * 802.11 protocol implementation definitions. */ enum ieee80211_state { IEEE80211_S_INIT = 0, /* default state */ IEEE80211_S_SCAN = 1, /* scanning */ IEEE80211_S_AUTH = 2, /* try to authenticate */ IEEE80211_S_ASSOC = 3, /* try to assoc */ IEEE80211_S_RUN = 4 /* associated */ }; #define IEEE80211_S_MAX ((int)IEEE80211_S_RUN + 1) #define IEEE80211_SEND_MGMT(_ic,_ni,_type,_arg) \ ((*(_ic)->ic_send_mgmt)(_ic, _ni, _type, _arg)) extern const char *ieee80211_mgt_subtype_name[]; extern const char *ieee80211_phymode_name[]; void ieee80211_proto_attach(struct ieee80211com *); void ieee80211_proto_detach(struct ieee80211com *); struct ieee80211_node; int ieee80211_input(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, int, u_int32_t); int ieee80211_setup_rates(struct ieee80211_node *ni, const u_int8_t *rates, const u_int8_t *xrates, int flags); void ieee80211_saveie(u_int8_t **, const u_int8_t *); void ieee80211_recv_mgmt(struct ieee80211com *, struct mbuf *, struct ieee80211_node *, int, int, u_int32_t); int ieee80211_send_nulldata(struct ieee80211_node *); int ieee80211_send_probereq(struct ieee80211_node *ni, const u_int8_t sa[IEEE80211_ADDR_LEN], const u_int8_t da[IEEE80211_ADDR_LEN], const u_int8_t bssid[IEEE80211_ADDR_LEN], const u_int8_t *ssid, size_t ssidlen, const void *optie, size_t optielen); int ieee80211_send_mgmt(struct ieee80211com *, struct ieee80211_node *, int, int); int ieee80211_classify(struct ieee80211com *, struct mbuf *, struct ieee80211_node *); struct mbuf *ieee80211_encap(struct ieee80211com *, struct mbuf *, struct ieee80211_node *); struct mbuf *ieee80211_get_rts(struct ieee80211com *, const struct ieee80211_frame *, uint16_t); struct mbuf *ieee80211_get_cts_to_self(struct ieee80211com *, uint16_t); void ieee80211_pwrsave(struct ieee80211com *, struct ieee80211_node *, struct mbuf *); void ieee80211_reset_erp(struct ieee80211com *); void ieee80211_set_shortslottime(struct ieee80211com *, int onoff); int ieee80211_iserp_rateset(struct ieee80211com *, struct ieee80211_rateset *); void ieee80211_set11gbasicrates(struct ieee80211_rateset *, enum ieee80211_phymode); /* * Return the size of the 802.11 header for a management or data frame. */ static __inline int ieee80211_hdrsize(const void *data) { const struct ieee80211_frame *wh = data; int size = sizeof(struct ieee80211_frame); /* NB: we don't handle control frames */ IASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL, ("%s: control frame", __func__)); if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS) size += IEEE80211_ADDR_LEN; if (ieee80211_has_qos(wh)) size += sizeof(u_int16_t); return size; } /* * Return the size of the 802.11 header; handles any type of frame. */ static __inline int ieee80211_anyhdrsize(const void *data) { const struct ieee80211_frame *wh = data; if ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) { switch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) { case IEEE80211_FC0_SUBTYPE_CTS: case IEEE80211_FC0_SUBTYPE_ACK: return sizeof(struct ieee80211_frame_ack); } return sizeof(struct ieee80211_frame_min); } else return ieee80211_hdrsize(data); } /* * Template for an in-kernel authenticator. Authenticators * register with the protocol code and are typically loaded * as separate modules as needed. */ struct ieee80211_authenticator { const char *ia_name; /* printable name */ int (*ia_attach)(struct ieee80211com *); void (*ia_detach)(struct ieee80211com *); void (*ia_node_join)(struct ieee80211com *, struct ieee80211_node *); void (*ia_node_leave)(struct ieee80211com *, struct ieee80211_node *); }; void ieee80211_authenticator_register(int type, const struct ieee80211_authenticator *); void ieee80211_authenticator_unregister(int type); const struct ieee80211_authenticator *ieee80211_authenticator_get(int auth); struct ieee80211req; /* * Template for an MAC ACL policy module. Such modules * register with the protocol code and are passed the sender's * address of each received frame for validation. */ struct ieee80211_aclator { const char *iac_name; /* printable name */ int (*iac_attach)(struct ieee80211com *); void (*iac_detach)(struct ieee80211com *); int (*iac_check)(struct ieee80211com *, const u_int8_t mac[IEEE80211_ADDR_LEN]); int (*iac_add)(struct ieee80211com *, const u_int8_t mac[IEEE80211_ADDR_LEN]); int (*iac_remove)(struct ieee80211com *, const u_int8_t mac[IEEE80211_ADDR_LEN]); int (*iac_flush)(struct ieee80211com *); int (*iac_setpolicy)(struct ieee80211com *, int); int (*iac_getpolicy)(struct ieee80211com *); int (*iac_setioctl)(struct ieee80211com *, struct ieee80211req *); int (*iac_getioctl)(struct ieee80211com *, struct ieee80211req *); }; void ieee80211_aclator_register(const struct ieee80211_aclator *); void ieee80211_aclator_unregister(const struct ieee80211_aclator *); const struct ieee80211_aclator *ieee80211_aclator_get(const char *name); /* flags for ieee80211_fix_rate() */ #define IEEE80211_R_DOSORT 0x00000001 /* sort rate list */ #define IEEE80211_R_DOFRATE 0x00000002 /* use fixed rate */ #define IEEE80211_R_DONEGO 0x00000004 /* calc negotiated rate */ #define IEEE80211_R_DODEL 0x00000008 /* delete ignore rate */ int ieee80211_fix_rate(struct ieee80211_node *, int); /* * WME/WMM support. */ struct wmeParams { u_int8_t wmep_acm; u_int8_t wmep_aifsn; u_int8_t wmep_logcwmin; /* log2(cwmin) */ u_int8_t wmep_logcwmax; /* log2(cwmax) */ u_int8_t wmep_txopLimit; u_int8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */ }; #define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5) #define IEEE80211_US_TO_TXOP(_us) ((_us)>>5) struct chanAccParams { u_int8_t cap_info; /* version of the current set */ struct wmeParams cap_wmeParams[WME_NUM_AC]; }; struct ieee80211_wme_state { u_int wme_flags; #define WME_F_AGGRMODE 0x00000001 /* STATUS: WME agressive mode */ u_int wme_hipri_traffic; /* VI/VO frames in beacon interval */ u_int wme_hipri_switch_thresh;/* agressive mode switch thresh */ u_int wme_hipri_switch_hysteresis;/* agressive mode switch hysteresis */ struct wmeParams wme_params[4]; /* from assoc resp for each AC*/ struct chanAccParams wme_wmeChanParams; /* WME params applied to self */ struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */ struct chanAccParams wme_chanParams; /* params applied to self */ struct chanAccParams wme_bssChanParams; /* params bcast to stations */ int (*wme_update)(struct ieee80211com *); }; void ieee80211_wme_initparams(struct ieee80211com *); void ieee80211_wme_updateparams(struct ieee80211com *); void ieee80211_wme_updateparams_locked(struct ieee80211com *); #define ieee80211_new_state(_ic, _nstate, _arg) \ (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) int ieee80211_compute_duration(const struct ieee80211_frame_min *, const struct ieee80211_key *, int, uint32_t, int, int, struct ieee80211_duration *, struct ieee80211_duration *, int *, int); void ieee80211_beacon_miss(struct ieee80211com *); void ieee80211_print_essid(const u_int8_t *, int); void ieee80211_dump_pkt(const u_int8_t *, int, int, int); extern const char *ieee80211_state_name[IEEE80211_S_MAX]; extern const char *ieee80211_wme_acnames[]; /* * Beacon frames constructed by ieee80211_beacon_alloc * have the following structure filled in so drivers * can update the frame later w/ minimal overhead. */ struct ieee80211_beacon_offsets { u_int16_t *bo_caps; /* capabilities */ u_int8_t *bo_tim; /* start of atim/dtim */ u_int8_t *bo_wme; /* start of WME parameters */ u_int8_t *bo_trailer; /* start of fixed-size trailer */ u_int16_t bo_tim_len; /* atim/dtim length in bytes */ u_int16_t bo_trailer_len; /* trailer length in bytes */ }; struct mbuf *ieee80211_beacon_alloc(struct ieee80211com *, struct ieee80211_node *, struct ieee80211_beacon_offsets *); int ieee80211_beacon_update(struct ieee80211com *, struct ieee80211_node *, struct ieee80211_beacon_offsets *, struct mbuf *, int broadcast); /* * Notification methods called from the 802.11 state machine. * Note that while these are defined here, their implementation * is OS-specific. */ void ieee80211_notify_node_join(struct ieee80211com *, struct ieee80211_node *, int newassoc); void ieee80211_notify_node_leave(struct ieee80211com *, struct ieee80211_node *); void ieee80211_notify_scan_done(struct ieee80211com *); #endif /* !_NET80211_IEEE80211_PROTO_H_ */
#ifndef METASHELL_DATA_TREE_DEPTH_HPP #define METASHELL_DATA_TREE_DEPTH_HPP // Metashell - Interactive C++ template metaprogramming shell // Copyright (C) 2018, Abel Sinkovics ([email protected]) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #include <metashell/data/event_data.hpp> #include <boost/operators.hpp> #include <iosfwd> #include <string> namespace metashell { namespace data { class tree_depth : boost::unit_steppable<tree_depth> { public: tree_depth& operator++(); tree_depth& operator--(); explicit operator int() const; private: int _value = 0; }; void update(tree_depth& d_, const event_data& event_); std::string to_string(tree_depth d_); std::ostream& operator<<(std::ostream& out_, tree_depth d_); } // namespace data } // namespace metashell #endif
Learn the basics of sailing without strange terminology. The topics will include wind-power, how to angle the boat to catch the wind, steering, adjusting the sails and more. There will also be time for questions and answers. Participants are welcome, at no charge, to make arrangements with the instructor to learn and practice sailing skills on board his stable day sailer on Prior Lake. If you are interested in teaching an Adult Community Education class with Prior Lake-Savage Area Schools, please add this "course" to your cart. You will be asked specific questions that pertain to your course(s). Once you have submitted your proposal someone from Prior Lake-Savage Community Education will contact you. Fall Planning Submission deadline: June 1 Winter Planning Submission deadline: October 1 Spring/Summer Submission deadline: January 1 If you have any questions feel free to contact Jenny Nagy at 952-226-0085 or Bobbi Birkholz at 952-226-0080. You can also refer to our Instructor Resources page for more information. If you prefer to print and fill out the form by hand please click here. Would you love to take a First Aid or CPR/AED course but it never seems to fit into your schedule? Well here is your opportunity! We offer an online option paired with an in-person Certification Completion to become certified in First Aid and/or CPR/AED. Here is how to get started: Register at www.onlineaha.org (first time user). Go to Courses, Choose Heartsaver. Choose your course options: First Aid, CPR AED, First Aid CPR AED (all components includes infant and child), Pediatric First Aid CPR AED (Infant/child only) and Click Purchase (additional fees). Print your Certificate of Completion. Register for the In-person Certification Completion Testing at priorlakesavagece.com within 60 days of online Completion. Bring your Certificate of Completion to the in-person Certification (dates below). In-person Certification Dates: Tue, April 16 (Deadline to register: April 9) Thu, May 16 (Deadline to register: May 9) #1 - (First Aid Only) - $65 5:30-6 p.m. #2 - (Adult CPR/AED) - $65 6-7 p.m. You must purchase and complete #2, Adult CPR/AED to take #3 & #4. #3 - (Child CPR/AED) - $15 7-7:30 p.m. #4 - (Infant CPR) - $15 7:30-8 p.m. #5 - All Components - $139 5:30-8 p.m.
using System; namespace DataGenerator.Sources { /// <summary> /// <see cref="Decimal" /> data source generator /// </summary> /// <seealso cref="DataGenerator.Sources.DataSourcePropertyType" /> public class DecimalSource : DataSourcePropertyType { private readonly decimal _min; private readonly decimal _max; private readonly int? _decimals; /// <summary> /// Initializes a new instance of the <see cref="DecimalSource"/> class. /// </summary> public DecimalSource() : this(0, 1000000, 2) { } /// <summary> /// Initializes a new instance of the <see cref="DecimalSource"/> class. /// </summary> /// <param name="min">The minimum value.</param> /// <param name="max">The maximum value.</param> public DecimalSource(decimal min, decimal max) : this(min, max, 2) { } /// <summary> /// Initializes a new instance of the <see cref="DecimalSource"/> class. /// </summary> /// <param name="min">The minimum value.</param> /// <param name="max">The maximum value.</param> /// <param name="decimals">The number of decimal places.</param> public DecimalSource(decimal min, decimal max, int decimals) : base(new[] { typeof(decimal) }) { _min = min; _max = max; _decimals = decimals; } /// <summary> /// Get a value from the data source. /// </summary> /// <param name="generateContext">The generate context.</param> /// <returns> /// A new value from the data source. /// </returns> public override object NextValue(IGenerateContext generateContext) { // Perform arithmetic in double type to avoid overflowing var range = (double)_max - (double)_min; var sample = RandomGenerator.Current.NextDouble(); var scaled = (sample * range) + (double)_min; return _decimals.HasValue ? Math.Round((decimal)scaled, _decimals.Value) : (decimal)scaled; } } }
The EDC will publish a quarterly industry report featuring trends and noteworthy activities involving targeted industries. The report will be provided to local stakeholders as well as to prospective companies. Your companies name and logo will be listed on report. Does one annual quarter work better for you than an other? Sponsors will be able to choose which quarter report to sponsor in the order of sponsorship commitment.
/** * */ package com.mec.duke;
<?php /************************************************************************************* * objeck.php * -------- * Author: Randy Hollines ([email protected]) * Copyright: (c) 2010 Randy Hollines (http://code.google.com/p/objeck-lang/) * Release Version: 1.0.8.11 * Date Started: 2010/07/01 * * Objeck Programming Language language file for GeSHi. * * CHANGES * ------- * 2010/07/26 (1.0.8.10) * - Added new and missing keywords and symbols: 'String', 'each', '+=', '-=', '*=' and '/='. * 2010/07/01 (1.0.8.9) * - First Release * ************************************************************************************* * * This file is part of GeSHi. * * GeSHi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * GeSHi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GeSHi; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ************************************************************************************/ $language_data = array( 'LANG_NAME' => 'Objeck Programming Language', 'COMMENT_SINGLE' => array(1 => '#'), 'COMMENT_MULTI' => array('#~' => '~#'), 'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE, 'QUOTEMARKS' => array('"'), 'ESCAPE_CHAR' => '\\', 'KEYWORDS' => array( 1 => array( 'virtual', 'if', 'else', 'do', 'while', 'use', 'bundle', 'native', 'static', 'public', 'private', 'class', 'function', 'method', 'select', 'other', 'enum', 'for', 'each', 'label', 'return', 'from' ), 2 => array( 'Byte', 'Int', 'Nil', 'Float', 'Char', 'Bool', 'String' ), 3 => array( 'true', 'false' ) ), 'SYMBOLS' => array( 1 => array( '(', ')', '{', '}', '[', ']', '+', '-', '*', '/', '%', '=', '<', '>', '&', '|', ':', ';', ',', '+=', '-=', '*=', '/=', ) ), 'CASE_SENSITIVE' => array( GESHI_COMMENTS => false, 1 => true, 2 => true, 3 => true ), 'STYLES' => array( 'KEYWORDS' => array( 1 => 'color: #b1b100;', 2 => 'color: #b1b100;', 3 => 'color: #b1b100;' ), 'COMMENTS' => array( 1 => 'color: #666666; font-style: italic;', 'MULTI' => 'color: #666666; font-style: italic;' ), 'ESCAPE_CHAR' => array( 0 => 'color: #000099; font-weight: bold;' ), 'BRACKETS' => array( 0 => 'color: #009900;' ), 'STRINGS' => array( 0 => 'color: #0000ff;' ), 'NUMBERS' => array( 0 => 'color: #cc66cc;', ), 'METHODS' => array( 0 => 'color: #004000;' ), 'SYMBOLS' => array( 1 => 'color: #339933;' ), 'REGEXPS' => array(), 'SCRIPT' => array() ), 'URLS' => array( 1 => '', 2 => '', 3 => '' ), 'OOLANG' => true, 'OBJECT_SPLITTERS' => array( 1 => '-&gt;' ), 'REGEXPS' => array(), 'STRICT_MODE_APPLIES' => GESHI_NEVER, 'SCRIPT_DELIMITERS' => array(), 'HIGHLIGHT_STRICT_BLOCK' => array() );
<p> comp-2231 works! </p>
Diego Maradona says Lionel Messi’s second-half penalty miss was not the reason Argentina failed to defeat Iceland at the World Cup on Saturday.Messi saw his spot kick saved by goalkeeper Hannes Por Halldorsson after Alfred Finnbogason had cancelled out Sergio Aguero’s 19th minute opener.“I don’t blame the players,” Maradona told Venezuelan television channel Telesur. “I could blame the lack of work rate. But I can’t blame the players, much less Messi, who gave it all he had. “I missed five penalties on the spin and I was still Diego Armando Maradona. I don’t think that they dropped two points because Messi missed a penalty.” Argentina take on Croatia on Thursday before their final group game against Nigeria next week.
Cloud Developer Advocate focusing on IoT, open source, and NodeJS. Suz hails from more than a decade of experience in professional web development, where she was a front end lead at companies such as Zappos and Kickstarter. Her knowledge of IoT spans from writing open source hardware drivers for the NodeJS community, to designing and fabricating her own printed circuit boards. She’s worked with several well known companies to help them implement best practices for Azure IoT services and is passionate about improving the open source offerings from Microsoft. A fierce advocate for accessibility, Suz aims to build empathy and high quality usability practices into everything she codes. When Suz is not coding, she’s probably reading or making more coffee.
Our Mission: The EIC is charged with promoting and ensuring the integrity of SFCP and its members and has both educational and protective functions. Who we are: The SFCP Ethics and Impairment Committee was formed in 2002 and reports directly to the Board of Directors. The EIC is composed of two co-chairs, and approximately ten members appointed by the by the co-chairs to serve a three-year term that is renewable for one additional three-year term. Committee members are members of SFCP including at least one candidate member. What we do: To serve its mission, the EIC has several component functions. The EIC provides confidential, informal consultations to members of SFCP and others who contact the co-chairs. These informal consultations with the co-chairs of the EIC may address questions about ethical conduct or impairment in an educational, often problem-solving mode. The EIC may sponsor and promote educational events about ethical concerns. Finally, the EIC responds to written complaints of analyst ethical misconduct or impairment according to the Guidelines provided below. The Membership Committee and the Ethics and Impairment Committee of SFCP encourage all members and candidates to create a professional will to help protect their patients from preventable disruption in case of the analyst’s illness, impairment, or death. Many colleagues have found that this important task is surprisingly difficult to pursue to completion, because of its emotional impact and because of the wish to avoid thinking about its implications. The task itself, however, is technically fairly straightforward and while we are providing you with a number of resources on the subject -- papers about professional wills and sample specimens -- we encourage you to keep this simple. It is probably best to create a basic will which covers the essentials in a direct, efficient manner, while maintaining the option of expanding or modifying it immediately or at some point in the future. DESIGNATE of one or more colleagues to manage your practice and deal with your patients. CREATE a list of your patients and how to contact them. WRITE a simple professional will. You may want to include a list of others to be contacted, including professional organizations, malpractice carrier, office landlord, accountant and attorney. You will no doubt think of additional features and provisions for your will and this should prove very useful. Nevertheless we suggest that you move ahead with the basics and avoid being delayed. Feel free to contact any EIC member with questions or requests for assistance. We would be happy to be of help. Ken Pope is a psychologist who has long been involved in training and ethics.
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System.Collections.Generic; namespace Azure.Management.Compute.Models { /// <summary> Output of virtual machine capture operation. </summary> public partial class VirtualMachineCaptureResult : SubResource { /// <summary> Initializes a new instance of VirtualMachineCaptureResult. </summary> public VirtualMachineCaptureResult() { } /// <summary> Initializes a new instance of VirtualMachineCaptureResult. </summary> /// <param name="id"> Resource Id. </param> /// <param name="schema"> the schema of the captured virtual machine. </param> /// <param name="contentVersion"> the version of the content. </param> /// <param name="parameters"> parameters of the captured virtual machine. </param> /// <param name="resources"> a list of resource items of the captured virtual machine. </param> internal VirtualMachineCaptureResult(string id, string schema, string contentVersion, object parameters, IList<object> resources) : base(id) { Schema = schema; ContentVersion = contentVersion; Parameters = parameters; Resources = resources; } /// <summary> the schema of the captured virtual machine. </summary> public string Schema { get; } /// <summary> the version of the content. </summary> public string ContentVersion { get; } /// <summary> parameters of the captured virtual machine. </summary> public object Parameters { get; } /// <summary> a list of resource items of the captured virtual machine. </summary> public IList<object> Resources { get; } } }
On February 8, 2019, Post Holdings, Inc. (the "Company" or "Post"), its guarantor subsidiaries and Wells Fargo Bank, National Association, as trustee (the "Trustee"), entered into a Fourth Supplemental Indenture (the "Supplemental Indenture") to the Indenture, dated as of August 3, 2016 (the "Indenture") by and among the Company, the guarantors party thereto and the Trustee, pursuant to the Company's previously announced consent solicitation (the "Consent Solicitation") with respect to the Company's 5.00% Senior Notes due 2026 (the "Notes"). The Supplemental Indenture (i) adds an exception to the "Restricted Payments" covenant contained in Section 4.07 of the Indenture and (ii) revises the "Permitted Investments" definition in the Indenture to add an additional category of "Permitted Investments" under the Indenture. Section 4.07 of the Indenture generally restricts the Company and its Restricted Subsidiaries (as defined in the Indenture) from making certain payments or investments and taking certain actions as specified in Section 4.07 and which are defined in the Indenture as "Restricted Payments." Section 4.07 also provides for a number of exceptions to these restrictions. The Supplemental Indenture amends the "Restricted Payments" covenant contained in Section 4.07 of the Indenture to permit an additional category of Restricted Payments in an aggregate amount in any fiscal year not to exceed an amount equal to 4.0% of the Company's Market Capitalization (as defined in the Supplemental Indenture). Investments (as defined in the Indenture) that are Permitted Investments may be made by the Company and its Restricted Subsidiaries without such Investments being Restricted Payments. The Supplemental Indenture amends the definition of "Permitted Investments" in the Indenture to permit an additional Investment basket that allows Investments in any Unrestricted Subsidiary (as defined in the Indenture) or joint venture of the Company or of any of its Restricted Subsidiaries having an aggregate fair market value not to exceed (a) the greater of (i) $370.0 million and (ii) 4.0% of Consolidated Total Assets (as defined in the Indenture) plus (b) 100% of the aggregate cash dividends and distributions received by the Company or any Restricted Subsidiary from any such Investments if the Company elects to include such dividends or distributions in this basket. The foregoing description of the Supplemental Indenture is qualified in its entirety by reference to the full text of the Supplemental Indenture filed as Exhibit 4.1 hereto and incorporated by reference herein. On February 12, 2019, the Company issued a press release announcing the successful completion of the Consent Solicitation regarding the Supplemental Indenture, described in Item 1.01 above. The press release is attached as Exhibit 99.1 to this Current Report on Form 8-K and is incorporated herein by reference. 04/09 POST : Announces Confidential Submission of Draft Registration Statement for Pro.. 04/08 POST : Announces Confidential Submission of Draft Registration Statement for Pro.. 02/19 POST HOLDINGS, INC. : Amendments to Articles of Inc. or Bylaws; Change in Fiscal.. 02/12 POST HOLDINGS, INC. : Entry into a Material Definitive Agreement, Other Events, .. 02/12 Post Holdings Announces Receipt of Requisite Consents in Consent Solicitation..
<?php // Get test image and convert into base64 $image = base64_encode(file_get_contents(dirname(dirname(__FILE__)).'/test.png')); $user_id = '54ba29c210f0edb8048b457a'; $I = new ApiTester($scenario); $I->wantTo('Update User Profile Picture'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPUT('user/profile/'.$user_id.'/picture', [ 'picture' => $image ]); $I->seeResponseCodeIs(200); $I->seeResponseIsJson(); $success = $I->grabDataFromJsonResponse('success'); $I->seeResponseContainsJson([ 'success' => $success ]);
WW2 in Color WW2 in Color » Public domain photographs from World War II. The courtroom embrace was beamed across the world and has prompted a new documentary being broadcast on Channel 4 on Saturday night. Today Eva chuckles at the memory. She did not expect to be hugged, but insists not one part of her body recoiled at Groening’s touch. She has written to Groening in prison where the 94-year-old is serving a four-year sentence to seek another meeting. Her decision to forgive has been criticised by many survivors of the Holocaust and even prompted a petition signed by 49 among them. Her husband, Michael, 90, with whom she has two grown-up children and is himself a former inmate of Buchenwald concentration camp, insists he will never follow suit. Yet speaking from her home in Terre Haute, Indiana, Eva Kor remains resolute. Eva Kor grew up in the village of Portc, nestled in the foothills of the Carpathian Mountains and so small it doesn’t even warrant mention on a map. Her family owned hundreds of thousands of acres of wilderness and farmland. “But what good did it do us?” she asks. She and Miriam were six when war broke out. Hungary, initially an ally of Hitler before he invaded the country in March 1944, quickly embraced the rampant anti-Semitism of the Nazis. Eva’s father, Alexander, was told he must register every fortnight with the police and new teachers were installed at the village school. In early 1944, Eva, her parents, Miriam and their other sisters Edith, 14, and Aliz, 10, were forced from their home and sent with whatever food, clothes and blankets they could carry to a nearby Jewish ghetto. After two months they were told they were moving again to a “labour camp” and this time would not need any possessions. Instead they were loaded on cattle trains bound for Auschwitz, part of the Hungarian transport of more than 437,000 Jews shipped to their deaths in just eight weeks. Any relief at finally disembarking was tempered by the looming brick towers of Auschwitz. The family was soon separated amid the chaos of the “selection platform” where most were hauled off unwittingly to the gas chambers before even being registered. Within minutes Eva had lost her father and two sisters (and was never to see them again). Then a guard scanning the crowds for twins for Mengele’s experiments approached her mother, Jaffa, who was holding tight to Eva and Miriam. Early on during her captivity, Eva stumbled across bodies of children piled up in a latrine at the end of their barracks. She did not tell Miriam, but vowed then they would both survive Mengele’s gruesome experiments. Eva was injected three times a week with at least five needles each time. She still does not know to this day what the contents were, but when the Soviet Army liberated Auschwitz on January 27, 1945, Eva and Miriam were still alive. She says it has taken her years to learn forgiveness, rebuilding a life first in Romania, then Israel then the US. But it is her murdered parents, not the Nazis, who have proved the hardest memory to reconcile. Eva first decided to absolve her former captors after re-visiting Auschwitz during the Eighties and later meeting Dr Hans Munch, another SS physician who worked at the camp but was acquitted of war crimes. In 1995 (two years after Miriam had died from cancer) during the 50th anniversary of the liberation of the camp she stood alongside Munch and announced she granted “amnesty to all Nazis”. However Eva says only one other survivor (and Mengele twin) has since joined her – a man named Peter Greenfeld. To associate forgiveness with the Nazis is anathema to most. Susan Pollock, an 85-year-old grandmother of six from Golders Green who in January was appointed MBE for educating young people about the Holocaust, also gave evidence at the Groening trial, but says his appeals for clemency left her cold. Pollock was also shipped to Auschwitz on the Hungarian transport. Both her parents were killed while her brother, Laszlo, was forced to work in the Sonderkommando, moving bodies from the gas chambers to the ovens. He was the only other member of her family to survive, although remained terribly scarred from the experience. Susan Pollock has weathered similar traumas but insists now she doesn’t carry any hatred in her heart. “I live with it by sharing and speaking,” she says. What is most important for her is that the world always remembers. Unlike Eva Kor, she may never be able to forgive the Nazis; but insists none of us must ever forget. Designed partly as propaganda to show cheery soldiers having the time of their lives, they were carefully choreographed to send personal messages back to their home towns. More than 600 examples of the films, lost for decades, were rediscovered in the basement of Manchester Town Hall during a refurbishment of the building years ago. They will now be broadcast for the first time since the Second World War in a new Channel 4 programme, entitled Calling Blighty. Channel 4 and the North West Film Archive have already put out on appeal seeking veterans who served in India, Burma and Sri Lanka and their families, with the hopes of including their reaction in a final broadcast. Other men are seen playing darts, polishing their specs and larking around in the background. The messages are just two of hundreds recorded between 1944 and 1946 by the Directorate of Army Welfare in India. At the time, British troops were stationed in India, Burma and Sri Lanka, fighting on even as Europe celebrated the end of war in what has become known as The Forgotten Army. Without the possibility of home leave, and in an atmosphere where disease was rife and morale low, the Ministry of Defence embarked on a scheme to boost them with filmed messages to home. Taking up to three months to arrive, with some servicemen dying before the messages got home, families and friends were invited to local cinemas to catch a glimpse of them. These particular films were found on 25 reels in rusting film canisters in the basement of Manchester Town Hall, with paperwork detailing the names, ranks, regiments and serial numbers of participants surviving alongside it. Steve Hawley, professor at the Manchester School of Art, said: “I saw an amazing film of servicemen in the second World War speaking to their loved ones, and mentioned this to Marion Hewitt, the Director of the North West Film Archive. Calling Blighty will air in early 2016 on Channel 4. The film is produced by Oxford Scientific Films.
(function() { var checkVersion = Dagaz.Model.checkVersion; Dagaz.Model.checkVersion = function(design, name, value) { if (name != "catch-pigs-restrictions") { checkVersion(design, name, value); } } var CheckInvariants = Dagaz.Model.CheckInvariants; Dagaz.Model.CheckInvariants = function(board) { var design = Dagaz.Model.design; if (!_.isUndefined(board.move)) { _.each(board.moves, function(move) { if (move.actions[0][0][0] == board.move.actions[0][1][0]) { move.failed = true; } }); } CheckInvariants(board); } })();
With no room left in its overcrowded cemetery, a village in France is insisting that its residents keep breathing. In an ordinance posted in the council offices, Mayor Gerard Lalanne told the 260 residents of the village of Sarpourenx that "all persons not having a plot in the cemetery and wishing to be buried in Sarpourenx are forbidden from dying in the parish." The mayor says that "It may be a laughing matter for some, but not for me."
/** * @file stun/hdr.c STUN Header encoding * * Copyright (C) 2010 Creytiv.com */ #include <re_types.h> #include <re_mbuf.h> #include <re_sa.h> #include <re_list.h> #include <re_stun.h> #include "stun.h" int stun_hdr_encode(struct mbuf *mb, const struct stun_hdr *hdr) { int err = 0; if (!mb || !hdr) return EINVAL; err |= mbuf_write_u16(mb, htons(hdr->type & 0x3fff)); err |= mbuf_write_u16(mb, htons(hdr->len)); err |= mbuf_write_u32(mb, htonl(hdr->cookie)); err |= mbuf_write_mem(mb, hdr->tid, sizeof(hdr->tid)); return err; } int stun_hdr_decode(struct mbuf *mb, struct stun_hdr *hdr) { if (!mb || !hdr) return EINVAL; if (mbuf_get_left(mb) < STUN_HEADER_SIZE) return EBADMSG; hdr->type = ntohs(mbuf_read_u16(mb)); if (hdr->type & 0xc000) return EBADMSG; hdr->len = ntohs(mbuf_read_u16(mb)); if (hdr->len & 0x3) return EBADMSG; hdr->cookie = ntohl(mbuf_read_u32(mb)); (void)mbuf_read_mem(mb, hdr->tid, sizeof(hdr->tid)); if (mbuf_get_left(mb) < hdr->len) return EBADMSG; return 0; } const char *stun_class_name(uint16_t class) { switch (class) { case STUN_CLASS_REQUEST: return "Request"; case STUN_CLASS_INDICATION: return "Indication"; case STUN_CLASS_SUCCESS_RESP: return "Success Response"; case STUN_CLASS_ERROR_RESP: return "Error Response"; default: return "???"; } } const char *stun_method_name(uint16_t method) { switch (method) { case STUN_METHOD_BINDING: return "Binding"; case STUN_METHOD_ALLOCATE: return "Allocate"; case STUN_METHOD_REFRESH: return "Refresh"; case STUN_METHOD_SEND: return "Send"; case STUN_METHOD_DATA: return "Data"; case STUN_METHOD_CREATEPERM: return "CreatePermission"; case STUN_METHOD_CHANBIND: return "ChannelBind"; default: return "???"; } }
Forgetting about the ball and just swinging the club will help golfers make better contact. One of the most interesting things about observing golfers (including myself) over the years is how much we actually change as we step over the ball. I’ve noticed that most reasonably experienced golfers have pretty good practice swings, but that same swing rarely shows up when the ball is present. I’m sure you’ve noticed this about yourself or at least about some of your regular playing partners. The practice swing looks balanced and fluid but the real shot looks quick, stiff, and out of balance. Am I making the ball the target? When we make practice swings, we have no intention to “hit” the ball. Our focus and attention stays with what we are doing with the club and the body. I believe that most golfers unknowingly change their intention when the ball is present which sends signals to the brain to “push” or “steer” the clubhead to the ball instead of making it swing on a path where it will collide with the ball in the direction of the target. To get better at this skill, you simply need to keep your attention on the intention of actually swinging the club and allowing the ball to get in the way. But the first thing to make this change is to actually feel the mistake happening. Make two or three good-feeling practice swings. Then set up to the ball and see if you can solely keep your focus on the clubhead for the duration of the entire swing — even past impact. As you deepen your awareness of its movement, I promise you will start to make positive change in actually swinging your club even when the ball is present. Dan Martin is the director of instruction at Rustic Canyon Golf Course. Contact him at 805-901-7829 or at [email protected].
// Copyright (c) 2012-2015 GeometryFactory Sarl (France) // All rights reserved. // // This file is part of CGAL (www.cgal.org). // You can redistribute it and/or modify it under the terms of the GNU // General Public License as published by the Free Software Foundation, // either version 3 of the License, or (at your option) any later version. // // Licensees holding a valid commercial license may use this file in // accordance with the commercial license agreement provided with the software. // // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // // $URL$ // $Id$ // SPDX-License-Identifier: GPL-3.0+ // // // Author(s) : Laurent RINEAU, Maxime Gimeno #ifndef SCENE_ITEM_H #define SCENE_ITEM_H #include <CGAL/license/Three.h> #include <CGAL/Three/Scene_item_config.h> #include <CGAL/Three/Scene_interface.h> #include <QString> #include <QPixmap> #include <QFont> #include <QOpenGLBuffer> #include <QOpenGLShader> #include <QOpenGLVertexArrayObject> #include <vector> #include <CGAL/Bbox_3.h> namespace CGAL { namespace Three { class Viewer_interface; } } namespace qglviewer { class ManipulatedFrame; } class QMenu; class QKeyEvent; namespace CGAL { namespace Three { class Scene_group_item; class Viewer_interface; //! This class represents an object in the OpenGL scene. //! It contains all the functions called by the Scene. It //! acts like a mix between an interface and a helper. class SCENE_ITEM_EXPORT Scene_item : public QObject{ Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(bool visible READ visible WRITE setVisible) Q_ENUMS(RenderingMode) Q_PROPERTY(RenderingMode renderingMode READ renderingMode WRITE setRenderingMode) public: /*! * \brief The OpenGL_program_IDs enum * * This enum holds the OpenGL programs IDs that are given to getShaderProgram() and attribBuffers(). * @see getShaderProgram * @see attribBuffers */ enum OpenGL_program_IDs { PROGRAM_WITH_LIGHT = 0, /** Used to render a surface or edge affected by the light. It uses a per fragment lighting model, and renders brighter the selected item.*/ PROGRAM_WITHOUT_LIGHT, /** Used to render a polygon edge or points. It renders in a uniform color and is not affected by light. It renders the selected item in black.*/ PROGRAM_NO_SELECTION, /** Used to render a polyline or a surface that is not affected by light, like a cutting plane. It renders in a uniform color that does not change with selection.*/ PROGRAM_WITH_TEXTURE, /** Used to render a textured polyhedron. Affected by light.*/ PROGRAM_PLANE_TWO_FACES, /** Used to render a two-faced plane. The two faces have a different color. Not affected by light.*/ PROGRAM_WITH_TEXTURED_EDGES, /** Used to render the edges of a textured polyhedorn. Not affected by light.*/ PROGRAM_INSTANCED, /** Used to display instanced rendered spheres.Affected by light.*/ PROGRAM_INSTANCED_WIRE, /** Used to display instanced rendered wired spheres. Not affected by light.*/ PROGRAM_C3T3, /** Used to render a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Affected by light.*/ PROGRAM_C3T3_EDGES, /** Used to render the edges of a c3t3_item. It discards any fragment on a side of a plane, meaning that nothing is displayed on this side of the plane. Not affected by light.*/ PROGRAM_CUTPLANE_SPHERES, /** Used to render the spheres of an item with a cut plane.*/ PROGRAM_SPHERES, /** Used to render one or several spheres.*/ PROGRAM_FLAT, /** Used to render flat shading without pre computing normals*/ PROGRAM_OLD_FLAT, /** Used to render flat shading without pre computing normals without geometry shader*/ NB_OF_PROGRAMS /** Holds the number of different programs in this enum.*/ }; typedef CGAL::Bbox_3 Bbox; typedef qglviewer::ManipulatedFrame ManipulatedFrame; //! \brief The default color of a scene_item. //! //! This color is the one that will be displayed if none is specified after its creation. static const QColor defaultColor; // defined in Scene_item.cpp //!\brief The Constructor. //! //! This is where the vectors of VBOs and VAOs are initialized. Scene_item(int buffers_size = 20, int vaos_size = 10); //! \brief Sets the number of isolated vertices. //! //! This number will be displayed in a warning box at loading. //! @see getNbIsolatedvertices void setNbIsolatedvertices(std::size_t nb) { nb_isolated_vertices = nb;} //! Getter for the number of isolated vertices. //! @see setNbIsolatedvertices std::size_t getNbIsolatedvertices() const {return nb_isolated_vertices;} virtual ~Scene_item(); //! \brief Duplicates the item. //! //! Creates a new item as a copy of this one. virtual Scene_item* clone() const = 0; //! \brief Indicates if `m` is supported //! //! If it is, it will be displayed in the context menu of the item. virtual bool supportsRenderingMode(RenderingMode m) const = 0; //! Deprecated. Does nothing. virtual void draw() const {} /*! \brief The drawing function for faces. * * Draws the faces of the item in the viewer. The data * for the drawing is gathered in computeElements(), and is sent * to buffers in initializeBuffers(). * @see computeElements() * @see initializeBuffers() */ virtual void draw(CGAL::Three::Viewer_interface*) const { draw(); } //! Deprecated. Does nothing. virtual void drawEdges() const { draw(); } /*! \brief The drawing function for the edges. * * Draws the edges and lines of the item in the viewer. The data * for the drawing is gathered in computeElements(), and is sent * to buffers in initializeBuffers(). * @see computeElements() * @see initializeBuffers() */ virtual void drawEdges(CGAL::Three::Viewer_interface* viewer) const { draw(viewer); } //! Deprecated. Does nothing. virtual void drawPoints() const { draw(); } /*! \brief The drawing function for the points. * * Draws the points of the item in the viewer. The data * for the drawing is gathered in computeElements(), and is sent * to buffers in initializeBuffers(). * @see computeElements() * @see initializeBuffers() */ virtual void drawPoints(CGAL::Three::Viewer_interface*) const { drawPoints(); } //! Called by the scene. If b is true, then this item is currently selected. virtual void selection_changed(bool b); // Functions for displaying meta-data of the item //!\brief Contains meta-data about the item. //! @returns a QString containing meta-data about the item. virtual QString toolTip() const = 0; //! \brief Contains graphical meta-data about the item. //! @returns a QPixmap containing graphical meta-data about the item. virtual QPixmap graphicalToolTip() const { return QPixmap(); } //! \brief Contains the font used for the data of the item. //! @returns a QFont containing the font used for the data of the item. virtual QFont font() const { return QFont(); } // Functions that help the Scene to compute its bbox //! \brief Determines if the item is finite or not. //! //! For example, a plane is not finite. //! If false, the BBox is not computed. virtual bool isFinite() const { return true; } //! Specifies if the item is empty or null. //! If true, the BBox is not computed. virtual bool isEmpty() const { return true; } //! \brief The item's bounding box. //! //! If the Bbox has never been computed, computes it and //! saves the result for further calls. //! @returns the item's bounding box. virtual Bbox bbox() const { if(!is_bbox_computed) compute_bbox(); is_bbox_computed = true; return _bbox; } //! \brief the item's bounding box's diagonal length. //! //! If the diagonal's length has never been computed, computes it and //! saves the result for further calls. //! @returns the item's bounding box's diagonal length. virtual double diagonalBbox() const { if(!is_diag_bbox_computed) compute_diag_bbox(); is_diag_bbox_computed = true; return _diag_bbox; } // Function about manipulation //! Returns true if the item has a ManipulatedFrame. //! @see manipulatedFrame() virtual bool manipulatable() const { return false; } //!\brief The manipulatedFrame of the item. //! //! A manipulated frame is an independant system that can be //! translated or rotated using the Ctrl key and the mouse. //!@returns the manipulatedFrame of the item. virtual ManipulatedFrame* manipulatedFrame() { return 0; } // Getters for the four basic properties //!Getter for the item's color. //! @returns the current color of the item. virtual QColor color() const { return color_; } //!Getter for the item's name. //! @returns the current name of the item. virtual QString name() const { return name_; } //! If the item is not visible, it is not drawn and its Bbox //! is ignored in the computation of the scene's. //! @returns the current visibility of the item. virtual bool visible() const { return visible_; } //!Getter for the item's rendering mode. //! @returns the current rendering mode of the item. //!@see RenderingMode virtual RenderingMode renderingMode() const { return rendering_mode; } //!The renderingMode's name. //! @returns the current rendering mode of the item as a human readable string. virtual QString renderingModeName() const; //! \brief Context menu //! //! Contains the list of the supported rendering modes, //! the Operations menu, actions to save or clone the item if it is supported //! and any contextual action for the item. virtual QMenu* contextMenu(); //!Handles key press events. virtual bool keyPressEvent(QKeyEvent*){return false;} //!The group containing the item. //! \returns the parent group if the item is in a group //! \returns 0 if the item is not in a group. Scene_group_item* parentGroup() const; //!Contains the header for the table in the statistics dialog /*! * A header data is composed of 2 columns : the Categories and the titles. * A category is the name given to an association of titles. * A title is the name of a line. *\verbatim * For example, * Category : | Titles| Values * 2 lines | | * ____________________________ * | |Name |Cube | * | |_______|_____| * |General Info | #Edges|12 | * |_____________|_______|_____| * * would be stored as follows : * categories = std::pair<QString,int>(QString("General Info"),2) * titles.append("Name"); * titles.append("#Edges");\endverbatim */ struct Header_data{ //!Contains the name of the category of statistics and the number of lines it will contain QList<std::pair<QString, int> > categories; //!Contains the name of the lines of each category. Must be sorted from top to bottom. QList<QString> titles; }; //!Returns a Header_data struct containing the header information. virtual Header_data header()const; //!Returns true if the item has statistics. virtual bool has_stats()const{return false;} //!Returns a QString containing the requested value for the the table in the statistics dialog /*! \verbatim * Example : * ____________________________ * | |Name |Cube | * | |_______|_____| * |General Info | #Edges|12 | * |_____________|_______|_____| * compute stats(0) should return "Cube" and computeStats(1) should return QString::number(12); * The numbers must be coherent with the order of declaration of the titles in the header. * \endverbatim * */ virtual QString computeStats(int i); //!Contains the number of group and subgroups containing this item. int has_group; public Q_SLOTS: //! Notifies the program that the internal data or the properties of //! an item has changed, and that it must be computed again. It is //! important to call this function whenever the internal data is changed, //! or the displayed item will not be updated. virtual void invalidateOpenGLBuffers(); //!Setter for the color of the item. virtual void setColor(QColor c) { color_ = c;} //!Setter for the RGB color of the item. Calls setColor(QColor). //!@see setColor(QColor c) void setRbgColor(int r, int g, int b) { setColor(QColor(r, g, b)); } //!Sets the name of the item. virtual void setName(QString n) { name_ = n; } //!Sets the visibility of the item. virtual void setVisible(bool b); //!Set the parent group. If `group==0`, then the item has no parent. //!This function is called by `Scene::changeGroup` and should not be //!called manually. virtual void moveToGroup(Scene_group_item* group); //!Sets the rendering mode of the item. //!@see RenderingMode virtual void setRenderingMode(RenderingMode m) { if (supportsRenderingMode(m)) rendering_mode = m; Q_EMIT redraw(); } //!Sets the RenderingMode to Points. void setPointsMode() { setRenderingMode(Points); } //!Sets the RenderingMode to Points. void setShadedPointsMode() { setRenderingMode(ShadedPoints); } //!Sets the RenderingMode to Wireframe. void setWireframeMode() { setRenderingMode(Wireframe); } //!Sets the RenderingMode to Flat. void setFlatMode() { setRenderingMode(Flat); } //!Set the RenderingMode to FlatPlusEdges. void setFlatPlusEdgesMode() { setRenderingMode(FlatPlusEdges); } //!Sets the RenderingMode to Gouraud. void setGouraudMode() { setRenderingMode(Gouraud); } //!Sets the RenderingMode to PointsPlusNormals. void setPointsPlusNormalsMode(){ setRenderingMode(PointsPlusNormals); } //!Emits an aboutToBeDestroyed() signal. //!Override this function to delete what needs to be deleted on destruction. //!This might be needed as items are not always deleted right away by Qt and this behaviour may cause a simily //!memory leak, for example when multiple items are created at the same time. virtual void itemAboutToBeDestroyed(Scene_item*); //!Selects a point through raycasting. virtual void select(double orig_x, double orig_y, double orig_z, double dir_x, double dir_y, double dir_z); Q_SIGNALS: //! Is emitted to notify a change in the item's data. void itemChanged(); //! Is emitted when the item is shown to notify a change in the item's visibility. //! Typically used to update the scene's bbox; void itemVisibilityChanged(); //! Is emitted to notify that the item is about to be deleted. void aboutToBeDestroyed(); //! Is emitted to require a new display. void redraw(); protected: //!Holds the BBox of the item mutable Bbox _bbox; mutable double _diag_bbox; mutable bool is_bbox_computed; mutable bool is_diag_bbox_computed; virtual void compute_bbox()const{} virtual void compute_diag_bbox()const; // The four basic properties //!The name of the item. QString name_; //!The color of the item. QColor color_; //!The visibility of the item. bool visible_; //!The parent group, or 0 if the item is not in a group. Scene_group_item* parent_group; //!Specifies if the item is currently selected. bool is_selected; //! Holds the number of vertices that are not linked to the polyhedron from the OFF //! file. std::size_t nb_isolated_vertices; /*! Decides if the draw function must call initializeBuffers() or not. It is set * to true in the end of initializeBuffers() and to false in invalidateOpenGLBuffers(). The need of * this boolean comes from the need of a context from the OpenGLFunctions used in * initializeBuffers(). * @see initializeBuffers() * @see invalidateOpenGLBuffers() */ mutable bool are_buffers_filled; //!The rendering mode of the item. //!@see RenderingMode RenderingMode rendering_mode; //!The default context menu. QMenu* defaultContextMenu; /*! Contains the previous RenderingMode. * This is used to determine if invalidateOpenGLBuffers should be called or not * in certain cases. * @see invalidateOpenGLBuffers()*/ RenderingMode prev_shading; /*! \todo replace it by RenderingMode(). * \brief Contains the current RenderingMode. * * This is used to determine if invalidateOpenGLBuffers should be called or not * in certain cases. * @see invalidateOpenGLBuffers()*/ RenderingMode cur_shading; //!Contains the size of the vector of VBOs int buffersSize; //!Contains the size of the map of VAOs int vaosSize; //!Contains the VBOs mutable std::vector<QOpenGLBuffer> buffers; /*! Contains the VAOs. */ std::vector<QOpenGLVertexArrayObject*> vaos; //!Adds a VAO to the Map. void addVaos(int i) { QOpenGLVertexArrayObject* n_vao = new QOpenGLVertexArrayObject(); vaos[i] = n_vao; } /*! Fills the VBOs with data. Must be called after each call to #computeElements(). * @see compute_elements() */ void initializeBuffers(){} /*! Collects all the data for the shaders. Must be called in #invalidateOpenGLBuffers(). * @see invalidateOpenGLBuffers(). */ void computeElements(){} /*! Passes all the uniform data to the shaders. * According to program_name, this data may change. */ void attribBuffers(CGAL::Three::Viewer_interface*, int program_name) const; /*! Compatibility function. Calls `viewer->getShaderProgram()`. */ virtual QOpenGLShaderProgram* getShaderProgram(int name , CGAL::Three::Viewer_interface *viewer = 0) const; }; // end class Scene_item } } #include <QMetaType> Q_DECLARE_METATYPE(CGAL::Three::Scene_item*) #endif // SCENE_ITEM_H
❶Why work with Growthink to create your business plan? We’re a team of business plan writers and researchers that know how to identify marketing opportunities, minimize risks, and discover the true potential of your Dallas, TX business. The right business plan writer is an invaluable investment that helps save money by eliminating guess marketing. Optimus never gives clients a cookie-cutter business plan. Our plans highlight your uniqueness, and that's what will get you the funding you need to thrive. We've helped large, small, and medium businesses excel, and our funding rates and success stories prove it. Business Plan Writers in Dallas on drossel.tk See reviews, photos, directions, phone numbers and more for the best Business Plans Development in Dallas, TX. Business Plan Writer - Dallas, Fort Worth, Plano, and Arlington Business plan writer for Dallas, TX. A common problem faced by small business owners in the Dallas, Fort Worth, Plano and Arlington, Texas area is organizing thoughts and ideas related to their business without a .
Lordland University is founded with the motto of 'let's go to the Power Life!', and has been aspiring and developing the potential powers that lie in its core. I am honored and proud to lead this remarkable institution. A university education prepares you for a future full of choices. Our institution offers an outstanding educational and curricular experience with both the facilities and network to guide you to succeed.
Detectives with the Skamania County Sheriff’s Office arrested a 37 year old Tualatin Oregon man Wednesday night after they learned he had come to Skamania County with the intent of transporting a juvenile female back to Oregon to have sexual contact with her. Detectives believe Edward Blake Smith has been utilizing the internet to communicate with the alleged victim and drove from his residence in Oregon to Skamania County to pick up the juvenile victim. Using the alleged victim’s internet profile, detectives were able to arrange to meet Smith at a pre-determined location where he was taken into custody. The investigation has revealed there are at least 2 female juvenile victims in Skamania County. It is believed there may be additional victims in 2 other jurisdiction in Washington State. Detectives have contacted law enforcement in those jurisdictions and are sharing information with them. The investigation is ongoing in this matter and detectives are working with the Skamania County Prosecutors Office to determine if additional charges are appropriate.
""" Represents protected content """ from django.conf.urls import url from django.http import HttpResponse def testview(request): return HttpResponse() urlpatterns = [url(r"^$", testview, name="test_url_content")]
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.carbondata.core.metadata.schema.table; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInput; import java.io.DataInputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import java.io.Serializable; import java.util.Map; import org.apache.carbondata.common.logging.LogServiceFactory; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier; import org.apache.carbondata.core.metadata.CarbonTableIdentifier; import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema; import org.apache.log4j.Logger; /** * Store the information about the table. * it stores the fact table as well as aggregate table present in the schema */ public class TableInfo implements Serializable, Writable { private static final Logger LOGGER = LogServiceFactory.getLogService(TableInfo.class.getName()); /** * serialization version */ private static final long serialVersionUID = -5034287968314105193L; /** * name of the database; */ private String databaseName; /** * table name to group fact table and aggregate table */ private String tableUniqueName; /** * fact table information */ private TableSchema factTable; /** * last updated time to update the table if any changes */ private long lastUpdatedTime; /** * store location of the table, it will be set in identifier.tablePath also */ private String tablePath; /** * The boolean field which points if the data written for Non Transactional Table * or Transactional Table. The difference between Transactional and Non Transactional table is * Non Transactional Table will not contain any Metadata folder and subsequently * no TableStatus or Schema files. * All ACID properties cannot be aplied to Non Transactional Table as there is no Commit points * i.e. no TableStatus File. * What ever files present in the path will be read but it system doesnot ensure ACID rules for * this data, mostly Consistency part. * */ private boolean isTransactionalTable = true; private boolean hasColumnDrift = false; // this identifier is a lazy field which will be created when it is used first time private AbsoluteTableIdentifier identifier; /** * flag to check whether any schema modification operation has happened after creation of table */ private boolean isSchemaModified; public TableInfo() { isTransactionalTable = true; } /** * @return the factTable */ public TableSchema getFactTable() { return factTable; } /** * @param factTable the factTable to set */ public void setFactTable(TableSchema factTable) { this.factTable = factTable; updateIsSchemaModified(); updateHasColumnDrift(); } private void updateIsSchemaModified() { if (null != factTable.getSchemaEvolution()) { // If schema evolution entry list size is > 1 that means an alter operation is performed // which has added the new schema entry in the schema evolution list. // Currently apart from create table schema evolution entries // are getting added only in the alter operations. isSchemaModified = factTable.getSchemaEvolution().getSchemaEvolutionEntryList().size() > 1 ? true : false; } } /** * @return the databaseName */ public String getDatabaseName() { return databaseName; } /** * @param databaseName the databaseName to set */ public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } /** * @return the tableUniqueName */ public String getTableUniqueName() { return tableUniqueName; } /** * @param tableUniqueName the tableUniqueName to set */ public void setTableUniqueName(String tableUniqueName) { this.tableUniqueName = tableUniqueName; } /** * @return the lastUpdatedTime */ public long getLastUpdatedTime() { return lastUpdatedTime; } /** * @param lastUpdatedTime the lastUpdatedTime to set */ public void setLastUpdatedTime(long lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } public void setTablePath(String tablePath) { this.tablePath = tablePath; } /** * to generate the hash code */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((databaseName == null) ? 0 : databaseName.hashCode()); result = prime * result + ((tableUniqueName == null) ? 0 : tableUniqueName.hashCode()); return result; } /** * Overridden equals method */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof TableInfo)) { return false; } TableInfo other = (TableInfo) obj; if (null == databaseName || null == other.databaseName) { return false; } if (null == tableUniqueName || null == other.tableUniqueName) { return false; } if (!tableUniqueName.equals(other.tableUniqueName)) { return false; } return true; } /** * This method will return the table size. Default table block size will be considered * in case not specified by the user */ int getTableBlockSizeInMB() { String tableBlockSize = null; // In case of old store there will not be any map for table properties so table properties // will be null Map<String, String> tableProperties = getFactTable().getTableProperties(); if (null != tableProperties) { tableBlockSize = tableProperties.get(CarbonCommonConstants.TABLE_BLOCKSIZE); } if (null == tableBlockSize) { tableBlockSize = CarbonCommonConstants.TABLE_BLOCK_SIZE_DEFAULT; if (LOGGER.isDebugEnabled()) { LOGGER.debug( "Table block size not specified for " + getTableUniqueName() + ". Therefore considering the default value " + CarbonCommonConstants.TABLE_BLOCK_SIZE_DEFAULT + " MB"); } } return Integer.parseInt(tableBlockSize); } @Override public void write(DataOutput out) throws IOException { out.writeUTF(databaseName); out.writeUTF(tableUniqueName); factTable.write(out); out.writeLong(lastUpdatedTime); out.writeUTF(getOrCreateAbsoluteTableIdentifier().getTablePath()); out.writeBoolean(isTransactionalTable); out.writeBoolean(hasColumnDrift); out.writeBoolean(isSchemaModified); } @Override public void readFields(DataInput in) throws IOException { this.databaseName = in.readUTF(); this.tableUniqueName = in.readUTF(); this.factTable = new TableSchema(); this.factTable.readFields(in); this.lastUpdatedTime = in.readLong(); this.tablePath = in.readUTF(); this.isTransactionalTable = in.readBoolean(); this.hasColumnDrift = in.readBoolean(); this.isSchemaModified = in.readBoolean(); } public AbsoluteTableIdentifier getOrCreateAbsoluteTableIdentifier() { if (identifier == null) { CarbonTableIdentifier carbontableIdentifier = new CarbonTableIdentifier(databaseName, factTable.getTableName(), factTable.getTableId()); identifier = AbsoluteTableIdentifier.from(tablePath, carbontableIdentifier); } return identifier; } public byte[] serialize() throws IOException { ByteArrayOutputStream bao = new ByteArrayOutputStream(); this.write(new DataOutputStream(bao)); return bao.toByteArray(); } public static TableInfo deserialize(byte[] bytes) throws IOException { TableInfo tableInfo = new TableInfo(); DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes)); tableInfo.readFields(in); return tableInfo; } public boolean isTransactionalTable() { return isTransactionalTable; } public void setTransactionalTable(boolean transactionalTable) { isTransactionalTable = transactionalTable; } public boolean isSchemaModified() { return isSchemaModified; } private void updateHasColumnDrift() { this.hasColumnDrift = false; for (ColumnSchema columnSchema : factTable.getListOfColumns()) { if (columnSchema.isDimensionColumn() && !columnSchema.isInvisible()) { Map<String, String> columnProperties = columnSchema.getColumnProperties(); if (columnProperties != null) { if (columnProperties.get(CarbonCommonConstants.COLUMN_DRIFT) != null) { this.hasColumnDrift = true; break; } } } } } public boolean hasColumnDrift() { return hasColumnDrift; } public String getTablePath() { return tablePath; } }
Government, business and community sector representatives came together in Hobart today to explore a “Collective Impact” approach to addressing some of Tasmania’s deep-rooted problems. Collective Impact is a framework for successful cross-sector collaboration aimed at achieving large-scale social change. A keynote speaker at today’s forum, Dr Michael McAfee, heads the President Obama-backed Promise Neighborhoods Institute at PolicyLink. Promise Neighborhoods partners with leaders from more than 60 of America’s poorest communities to improve the educational and developmental outcomes of children in those neighbourhoods. This is achieved by integrating the supports available for children. Dr. McAfee recently returned from a series of speaking engagement in Australia. The above article was originally printed in Tasmanian Times. Click here to read the full article.
Easily clean bottle brush. Long bottle brush fits into most bottles and has soft bristles that won't scratch interiors. Keep your Mighty Mug in it's the best condition.
Buy One Pizza, Get One Half Off with Beverage Purchase. 1/2 Off Select Bottles of Wine with Purchase of Dinner Entree. Tuesday-Friday (5-7 PM) & Sunday (3-6 PM): Half Off Select Appetizers, $3 Select Draft Beers, $4 Well Cocktails, and $5 Select Wine.
/* * Copyright (c) 2017 Intel Corporation. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #include <linux/acpi.h> #include <linux/i2c.h> #include <linux/module.h> #include <linux/pm_runtime.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-device.h> #define OV13858_REG_VALUE_08BIT 1 #define OV13858_REG_VALUE_16BIT 2 #define OV13858_REG_VALUE_24BIT 3 #define OV13858_REG_MODE_SELECT 0x0100 #define OV13858_MODE_STANDBY 0x00 #define OV13858_MODE_STREAMING 0x01 #define OV13858_REG_SOFTWARE_RST 0x0103 #define OV13858_SOFTWARE_RST 0x01 /* PLL1 generates PCLK and MIPI_PHY_CLK */ #define OV13858_REG_PLL1_CTRL_0 0x0300 #define OV13858_REG_PLL1_CTRL_1 0x0301 #define OV13858_REG_PLL1_CTRL_2 0x0302 #define OV13858_REG_PLL1_CTRL_3 0x0303 #define OV13858_REG_PLL1_CTRL_4 0x0304 #define OV13858_REG_PLL1_CTRL_5 0x0305 /* PLL2 generates DAC_CLK, SCLK and SRAM_CLK */ #define OV13858_REG_PLL2_CTRL_B 0x030b #define OV13858_REG_PLL2_CTRL_C 0x030c #define OV13858_REG_PLL2_CTRL_D 0x030d #define OV13858_REG_PLL2_CTRL_E 0x030e #define OV13858_REG_PLL2_CTRL_F 0x030f #define OV13858_REG_PLL2_CTRL_12 0x0312 #define OV13858_REG_MIPI_SC_CTRL0 0x3016 #define OV13858_REG_MIPI_SC_CTRL1 0x3022 /* Chip ID */ #define OV13858_REG_CHIP_ID 0x300a #define OV13858_CHIP_ID 0x00d855 /* V_TIMING internal */ #define OV13858_REG_VTS 0x380e #define OV13858_VTS_30FPS 0x0c8e /* 30 fps */ #define OV13858_VTS_60FPS 0x0648 /* 60 fps */ #define OV13858_VTS_MAX 0x7fff /* HBLANK control - read only */ #define OV13858_PPL_270MHZ 2244 #define OV13858_PPL_540MHZ 4488 /* Exposure control */ #define OV13858_REG_EXPOSURE 0x3500 #define OV13858_EXPOSURE_MIN 4 #define OV13858_EXPOSURE_STEP 1 #define OV13858_EXPOSURE_DEFAULT 0x640 /* Analog gain control */ #define OV13858_REG_ANALOG_GAIN 0x3508 #define OV13858_ANA_GAIN_MIN 0 #define OV13858_ANA_GAIN_MAX 0x1fff #define OV13858_ANA_GAIN_STEP 1 #define OV13858_ANA_GAIN_DEFAULT 0x80 /* Digital gain control */ #define OV13858_REG_B_MWB_GAIN 0x5100 #define OV13858_REG_G_MWB_GAIN 0x5102 #define OV13858_REG_R_MWB_GAIN 0x5104 #define OV13858_DGTL_GAIN_MIN 0 #define OV13858_DGTL_GAIN_MAX 16384 /* Max = 16 X */ #define OV13858_DGTL_GAIN_DEFAULT 1024 /* Default gain = 1 X */ #define OV13858_DGTL_GAIN_STEP 1 /* Each step = 1/1024 */ /* Test Pattern Control */ #define OV13858_REG_TEST_PATTERN 0x4503 #define OV13858_TEST_PATTERN_ENABLE BIT(7) #define OV13858_TEST_PATTERN_MASK 0xfc /* Number of frames to skip */ #define OV13858_NUM_OF_SKIP_FRAMES 2 struct ov13858_reg { u16 address; u8 val; }; struct ov13858_reg_list { u32 num_of_regs; const struct ov13858_reg *regs; }; /* Link frequency config */ struct ov13858_link_freq_config { u32 pixels_per_line; /* PLL registers for this link frequency */ struct ov13858_reg_list reg_list; }; /* Mode : resolution and related config&values */ struct ov13858_mode { /* Frame width */ u32 width; /* Frame height */ u32 height; /* V-timing */ u32 vts_def; u32 vts_min; /* Index of Link frequency config to be used */ u32 link_freq_index; /* Default register values */ struct ov13858_reg_list reg_list; }; /* 4224x3136 needs 1080Mbps/lane, 4 lanes */ static const struct ov13858_reg mipi_data_rate_1080mbps[] = { /* PLL1 registers */ {OV13858_REG_PLL1_CTRL_0, 0x07}, {OV13858_REG_PLL1_CTRL_1, 0x01}, {OV13858_REG_PLL1_CTRL_2, 0xc2}, {OV13858_REG_PLL1_CTRL_3, 0x00}, {OV13858_REG_PLL1_CTRL_4, 0x00}, {OV13858_REG_PLL1_CTRL_5, 0x01}, /* PLL2 registers */ {OV13858_REG_PLL2_CTRL_B, 0x05}, {OV13858_REG_PLL2_CTRL_C, 0x01}, {OV13858_REG_PLL2_CTRL_D, 0x0e}, {OV13858_REG_PLL2_CTRL_E, 0x05}, {OV13858_REG_PLL2_CTRL_F, 0x01}, {OV13858_REG_PLL2_CTRL_12, 0x01}, {OV13858_REG_MIPI_SC_CTRL0, 0x72}, {OV13858_REG_MIPI_SC_CTRL1, 0x01}, }; /* * 2112x1568, 2112x1188, 1056x784 need 540Mbps/lane, * 4 lanes */ static const struct ov13858_reg mipi_data_rate_540mbps[] = { /* PLL1 registers */ {OV13858_REG_PLL1_CTRL_0, 0x07}, {OV13858_REG_PLL1_CTRL_1, 0x01}, {OV13858_REG_PLL1_CTRL_2, 0xc2}, {OV13858_REG_PLL1_CTRL_3, 0x01}, {OV13858_REG_PLL1_CTRL_4, 0x00}, {OV13858_REG_PLL1_CTRL_5, 0x01}, /* PLL2 registers */ {OV13858_REG_PLL2_CTRL_B, 0x05}, {OV13858_REG_PLL2_CTRL_C, 0x01}, {OV13858_REG_PLL2_CTRL_D, 0x0e}, {OV13858_REG_PLL2_CTRL_E, 0x05}, {OV13858_REG_PLL2_CTRL_F, 0x01}, {OV13858_REG_PLL2_CTRL_12, 0x01}, {OV13858_REG_MIPI_SC_CTRL0, 0x72}, {OV13858_REG_MIPI_SC_CTRL1, 0x01}, }; static const struct ov13858_reg mode_4224x3136_regs[] = { {0x3013, 0x32}, {0x301b, 0xf0}, {0x301f, 0xd0}, {0x3106, 0x15}, {0x3107, 0x23}, {0x350a, 0x00}, {0x350e, 0x00}, {0x3510, 0x00}, {0x3511, 0x02}, {0x3512, 0x00}, {0x3600, 0x2b}, {0x3601, 0x52}, {0x3602, 0x60}, {0x3612, 0x05}, {0x3613, 0xa4}, {0x3620, 0x80}, {0x3621, 0x10}, {0x3622, 0x30}, {0x3624, 0x1c}, {0x3640, 0x10}, {0x3641, 0x70}, {0x3661, 0x80}, {0x3662, 0x12}, {0x3664, 0x73}, {0x3665, 0xa7}, {0x366e, 0xff}, {0x366f, 0xf4}, {0x3674, 0x00}, {0x3679, 0x0c}, {0x367f, 0x01}, {0x3680, 0x0c}, {0x3681, 0x50}, {0x3682, 0x50}, {0x3683, 0xa9}, {0x3684, 0xa9}, {0x3709, 0x5f}, {0x3714, 0x24}, {0x371a, 0x3e}, {0x3737, 0x04}, {0x3738, 0xcc}, {0x3739, 0x12}, {0x373d, 0x26}, {0x3764, 0x20}, {0x3765, 0x20}, {0x37a1, 0x36}, {0x37a8, 0x3b}, {0x37ab, 0x31}, {0x37c2, 0x04}, {0x37c3, 0xf1}, {0x37c5, 0x00}, {0x37d8, 0x03}, {0x37d9, 0x0c}, {0x37da, 0xc2}, {0x37dc, 0x02}, {0x37e0, 0x00}, {0x37e1, 0x0a}, {0x37e2, 0x14}, {0x37e3, 0x04}, {0x37e4, 0x2a}, {0x37e5, 0x03}, {0x37e6, 0x04}, {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x08}, {0x3804, 0x10}, {0x3805, 0x9f}, {0x3806, 0x0c}, {0x3807, 0x57}, {0x3808, 0x10}, {0x3809, 0x80}, {0x380a, 0x0c}, {0x380b, 0x40}, {0x380c, 0x04}, {0x380d, 0x62}, {0x380e, 0x0c}, {0x380f, 0x8e}, {0x3811, 0x04}, {0x3813, 0x05}, {0x3814, 0x01}, {0x3815, 0x01}, {0x3816, 0x01}, {0x3817, 0x01}, {0x3820, 0xa8}, {0x3821, 0x00}, {0x3822, 0xc2}, {0x3823, 0x18}, {0x3826, 0x11}, {0x3827, 0x1c}, {0x3829, 0x03}, {0x3832, 0x00}, {0x3c80, 0x00}, {0x3c87, 0x01}, {0x3c8c, 0x19}, {0x3c8d, 0x1c}, {0x3c90, 0x00}, {0x3c91, 0x00}, {0x3c92, 0x00}, {0x3c93, 0x00}, {0x3c94, 0x40}, {0x3c95, 0x54}, {0x3c96, 0x34}, {0x3c97, 0x04}, {0x3c98, 0x00}, {0x3d8c, 0x73}, {0x3d8d, 0xc0}, {0x3f00, 0x0b}, {0x3f03, 0x00}, {0x4001, 0xe0}, {0x4008, 0x00}, {0x4009, 0x0f}, {0x4011, 0xf0}, {0x4017, 0x08}, {0x4050, 0x04}, {0x4051, 0x0b}, {0x4052, 0x00}, {0x4053, 0x80}, {0x4054, 0x00}, {0x4055, 0x80}, {0x4056, 0x00}, {0x4057, 0x80}, {0x4058, 0x00}, {0x4059, 0x80}, {0x405e, 0x20}, {0x4500, 0x07}, {0x4503, 0x00}, {0x450a, 0x04}, {0x4809, 0x04}, {0x480c, 0x12}, {0x481f, 0x30}, {0x4833, 0x10}, {0x4837, 0x0e}, {0x4902, 0x01}, {0x4d00, 0x03}, {0x4d01, 0xc9}, {0x4d02, 0xbc}, {0x4d03, 0xd7}, {0x4d04, 0xf0}, {0x4d05, 0xa2}, {0x5000, 0xfd}, {0x5001, 0x01}, {0x5040, 0x39}, {0x5041, 0x10}, {0x5042, 0x10}, {0x5043, 0x84}, {0x5044, 0x62}, {0x5180, 0x00}, {0x5181, 0x10}, {0x5182, 0x02}, {0x5183, 0x0f}, {0x5200, 0x1b}, {0x520b, 0x07}, {0x520c, 0x0f}, {0x5300, 0x04}, {0x5301, 0x0c}, {0x5302, 0x0c}, {0x5303, 0x0f}, {0x5304, 0x00}, {0x5305, 0x70}, {0x5306, 0x00}, {0x5307, 0x80}, {0x5308, 0x00}, {0x5309, 0xa5}, {0x530a, 0x00}, {0x530b, 0xd3}, {0x530c, 0x00}, {0x530d, 0xf0}, {0x530e, 0x01}, {0x530f, 0x10}, {0x5310, 0x01}, {0x5311, 0x20}, {0x5312, 0x01}, {0x5313, 0x20}, {0x5314, 0x01}, {0x5315, 0x20}, {0x5316, 0x08}, {0x5317, 0x08}, {0x5318, 0x10}, {0x5319, 0x88}, {0x531a, 0x88}, {0x531b, 0xa9}, {0x531c, 0xaa}, {0x531d, 0x0a}, {0x5405, 0x02}, {0x5406, 0x67}, {0x5407, 0x01}, {0x5408, 0x4a}, }; static const struct ov13858_reg mode_2112x1568_regs[] = { {0x3013, 0x32}, {0x301b, 0xf0}, {0x301f, 0xd0}, {0x3106, 0x15}, {0x3107, 0x23}, {0x350a, 0x00}, {0x350e, 0x00}, {0x3510, 0x00}, {0x3511, 0x02}, {0x3512, 0x00}, {0x3600, 0x2b}, {0x3601, 0x52}, {0x3602, 0x60}, {0x3612, 0x05}, {0x3613, 0xa4}, {0x3620, 0x80}, {0x3621, 0x10}, {0x3622, 0x30}, {0x3624, 0x1c}, {0x3640, 0x10}, {0x3641, 0x70}, {0x3661, 0x80}, {0x3662, 0x10}, {0x3664, 0x73}, {0x3665, 0xa7}, {0x366e, 0xff}, {0x366f, 0xf4}, {0x3674, 0x00}, {0x3679, 0x0c}, {0x367f, 0x01}, {0x3680, 0x0c}, {0x3681, 0x50}, {0x3682, 0x50}, {0x3683, 0xa9}, {0x3684, 0xa9}, {0x3709, 0x5f}, {0x3714, 0x28}, {0x371a, 0x3e}, {0x3737, 0x08}, {0x3738, 0xcc}, {0x3739, 0x20}, {0x373d, 0x26}, {0x3764, 0x20}, {0x3765, 0x20}, {0x37a1, 0x36}, {0x37a8, 0x3b}, {0x37ab, 0x31}, {0x37c2, 0x14}, {0x37c3, 0xf1}, {0x37c5, 0x00}, {0x37d8, 0x03}, {0x37d9, 0x0c}, {0x37da, 0xc2}, {0x37dc, 0x02}, {0x37e0, 0x00}, {0x37e1, 0x0a}, {0x37e2, 0x14}, {0x37e3, 0x08}, {0x37e4, 0x38}, {0x37e5, 0x03}, {0x37e6, 0x08}, {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x00}, {0x3804, 0x10}, {0x3805, 0x9f}, {0x3806, 0x0c}, {0x3807, 0x5f}, {0x3808, 0x08}, {0x3809, 0x40}, {0x380a, 0x06}, {0x380b, 0x20}, {0x380c, 0x04}, {0x380d, 0x62}, {0x380e, 0x0c}, {0x380f, 0x8e}, {0x3811, 0x04}, {0x3813, 0x05}, {0x3814, 0x03}, {0x3815, 0x01}, {0x3816, 0x03}, {0x3817, 0x01}, {0x3820, 0xab}, {0x3821, 0x00}, {0x3822, 0xc2}, {0x3823, 0x18}, {0x3826, 0x04}, {0x3827, 0x90}, {0x3829, 0x07}, {0x3832, 0x00}, {0x3c80, 0x00}, {0x3c87, 0x01}, {0x3c8c, 0x19}, {0x3c8d, 0x1c}, {0x3c90, 0x00}, {0x3c91, 0x00}, {0x3c92, 0x00}, {0x3c93, 0x00}, {0x3c94, 0x40}, {0x3c95, 0x54}, {0x3c96, 0x34}, {0x3c97, 0x04}, {0x3c98, 0x00}, {0x3d8c, 0x73}, {0x3d8d, 0xc0}, {0x3f00, 0x0b}, {0x3f03, 0x00}, {0x4001, 0xe0}, {0x4008, 0x00}, {0x4009, 0x0d}, {0x4011, 0xf0}, {0x4017, 0x08}, {0x4050, 0x04}, {0x4051, 0x0b}, {0x4052, 0x00}, {0x4053, 0x80}, {0x4054, 0x00}, {0x4055, 0x80}, {0x4056, 0x00}, {0x4057, 0x80}, {0x4058, 0x00}, {0x4059, 0x80}, {0x405e, 0x20}, {0x4500, 0x07}, {0x4503, 0x00}, {0x450a, 0x04}, {0x4809, 0x04}, {0x480c, 0x12}, {0x481f, 0x30}, {0x4833, 0x10}, {0x4837, 0x1c}, {0x4902, 0x01}, {0x4d00, 0x03}, {0x4d01, 0xc9}, {0x4d02, 0xbc}, {0x4d03, 0xd7}, {0x4d04, 0xf0}, {0x4d05, 0xa2}, {0x5000, 0xfd}, {0x5001, 0x01}, {0x5040, 0x39}, {0x5041, 0x10}, {0x5042, 0x10}, {0x5043, 0x84}, {0x5044, 0x62}, {0x5180, 0x00}, {0x5181, 0x10}, {0x5182, 0x02}, {0x5183, 0x0f}, {0x5200, 0x1b}, {0x520b, 0x07}, {0x520c, 0x0f}, {0x5300, 0x04}, {0x5301, 0x0c}, {0x5302, 0x0c}, {0x5303, 0x0f}, {0x5304, 0x00}, {0x5305, 0x70}, {0x5306, 0x00}, {0x5307, 0x80}, {0x5308, 0x00}, {0x5309, 0xa5}, {0x530a, 0x00}, {0x530b, 0xd3}, {0x530c, 0x00}, {0x530d, 0xf0}, {0x530e, 0x01}, {0x530f, 0x10}, {0x5310, 0x01}, {0x5311, 0x20}, {0x5312, 0x01}, {0x5313, 0x20}, {0x5314, 0x01}, {0x5315, 0x20}, {0x5316, 0x08}, {0x5317, 0x08}, {0x5318, 0x10}, {0x5319, 0x88}, {0x531a, 0x88}, {0x531b, 0xa9}, {0x531c, 0xaa}, {0x531d, 0x0a}, {0x5405, 0x02}, {0x5406, 0x67}, {0x5407, 0x01}, {0x5408, 0x4a}, }; static const struct ov13858_reg mode_2112x1188_regs[] = { {0x3013, 0x32}, {0x301b, 0xf0}, {0x301f, 0xd0}, {0x3106, 0x15}, {0x3107, 0x23}, {0x350a, 0x00}, {0x350e, 0x00}, {0x3510, 0x00}, {0x3511, 0x02}, {0x3512, 0x00}, {0x3600, 0x2b}, {0x3601, 0x52}, {0x3602, 0x60}, {0x3612, 0x05}, {0x3613, 0xa4}, {0x3620, 0x80}, {0x3621, 0x10}, {0x3622, 0x30}, {0x3624, 0x1c}, {0x3640, 0x10}, {0x3641, 0x70}, {0x3661, 0x80}, {0x3662, 0x10}, {0x3664, 0x73}, {0x3665, 0xa7}, {0x366e, 0xff}, {0x366f, 0xf4}, {0x3674, 0x00}, {0x3679, 0x0c}, {0x367f, 0x01}, {0x3680, 0x0c}, {0x3681, 0x50}, {0x3682, 0x50}, {0x3683, 0xa9}, {0x3684, 0xa9}, {0x3709, 0x5f}, {0x3714, 0x28}, {0x371a, 0x3e}, {0x3737, 0x08}, {0x3738, 0xcc}, {0x3739, 0x20}, {0x373d, 0x26}, {0x3764, 0x20}, {0x3765, 0x20}, {0x37a1, 0x36}, {0x37a8, 0x3b}, {0x37ab, 0x31}, {0x37c2, 0x14}, {0x37c3, 0xf1}, {0x37c5, 0x00}, {0x37d8, 0x03}, {0x37d9, 0x0c}, {0x37da, 0xc2}, {0x37dc, 0x02}, {0x37e0, 0x00}, {0x37e1, 0x0a}, {0x37e2, 0x14}, {0x37e3, 0x08}, {0x37e4, 0x38}, {0x37e5, 0x03}, {0x37e6, 0x08}, {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x01}, {0x3803, 0x84}, {0x3804, 0x10}, {0x3805, 0x9f}, {0x3806, 0x0a}, {0x3807, 0xd3}, {0x3808, 0x08}, {0x3809, 0x40}, {0x380a, 0x04}, {0x380b, 0xa4}, {0x380c, 0x04}, {0x380d, 0x62}, {0x380e, 0x0c}, {0x380f, 0x8e}, {0x3811, 0x08}, {0x3813, 0x03}, {0x3814, 0x03}, {0x3815, 0x01}, {0x3816, 0x03}, {0x3817, 0x01}, {0x3820, 0xab}, {0x3821, 0x00}, {0x3822, 0xc2}, {0x3823, 0x18}, {0x3826, 0x04}, {0x3827, 0x90}, {0x3829, 0x07}, {0x3832, 0x00}, {0x3c80, 0x00}, {0x3c87, 0x01}, {0x3c8c, 0x19}, {0x3c8d, 0x1c}, {0x3c90, 0x00}, {0x3c91, 0x00}, {0x3c92, 0x00}, {0x3c93, 0x00}, {0x3c94, 0x40}, {0x3c95, 0x54}, {0x3c96, 0x34}, {0x3c97, 0x04}, {0x3c98, 0x00}, {0x3d8c, 0x73}, {0x3d8d, 0xc0}, {0x3f00, 0x0b}, {0x3f03, 0x00}, {0x4001, 0xe0}, {0x4008, 0x00}, {0x4009, 0x0d}, {0x4011, 0xf0}, {0x4017, 0x08}, {0x4050, 0x04}, {0x4051, 0x0b}, {0x4052, 0x00}, {0x4053, 0x80}, {0x4054, 0x00}, {0x4055, 0x80}, {0x4056, 0x00}, {0x4057, 0x80}, {0x4058, 0x00}, {0x4059, 0x80}, {0x405e, 0x20}, {0x4500, 0x07}, {0x4503, 0x00}, {0x450a, 0x04}, {0x4809, 0x04}, {0x480c, 0x12}, {0x481f, 0x30}, {0x4833, 0x10}, {0x4837, 0x1c}, {0x4902, 0x01}, {0x4d00, 0x03}, {0x4d01, 0xc9}, {0x4d02, 0xbc}, {0x4d03, 0xd7}, {0x4d04, 0xf0}, {0x4d05, 0xa2}, {0x5000, 0xfd}, {0x5001, 0x01}, {0x5040, 0x39}, {0x5041, 0x10}, {0x5042, 0x10}, {0x5043, 0x84}, {0x5044, 0x62}, {0x5180, 0x00}, {0x5181, 0x10}, {0x5182, 0x02}, {0x5183, 0x0f}, {0x5200, 0x1b}, {0x520b, 0x07}, {0x520c, 0x0f}, {0x5300, 0x04}, {0x5301, 0x0c}, {0x5302, 0x0c}, {0x5303, 0x0f}, {0x5304, 0x00}, {0x5305, 0x70}, {0x5306, 0x00}, {0x5307, 0x80}, {0x5308, 0x00}, {0x5309, 0xa5}, {0x530a, 0x00}, {0x530b, 0xd3}, {0x530c, 0x00}, {0x530d, 0xf0}, {0x530e, 0x01}, {0x530f, 0x10}, {0x5310, 0x01}, {0x5311, 0x20}, {0x5312, 0x01}, {0x5313, 0x20}, {0x5314, 0x01}, {0x5315, 0x20}, {0x5316, 0x08}, {0x5317, 0x08}, {0x5318, 0x10}, {0x5319, 0x88}, {0x531a, 0x88}, {0x531b, 0xa9}, {0x531c, 0xaa}, {0x531d, 0x0a}, {0x5405, 0x02}, {0x5406, 0x67}, {0x5407, 0x01}, {0x5408, 0x4a}, }; static const struct ov13858_reg mode_1056x784_regs[] = { {0x3013, 0x32}, {0x301b, 0xf0}, {0x301f, 0xd0}, {0x3106, 0x15}, {0x3107, 0x23}, {0x350a, 0x00}, {0x350e, 0x00}, {0x3510, 0x00}, {0x3511, 0x02}, {0x3512, 0x00}, {0x3600, 0x2b}, {0x3601, 0x52}, {0x3602, 0x60}, {0x3612, 0x05}, {0x3613, 0xa4}, {0x3620, 0x80}, {0x3621, 0x10}, {0x3622, 0x30}, {0x3624, 0x1c}, {0x3640, 0x10}, {0x3641, 0x70}, {0x3661, 0x80}, {0x3662, 0x08}, {0x3664, 0x73}, {0x3665, 0xa7}, {0x366e, 0xff}, {0x366f, 0xf4}, {0x3674, 0x00}, {0x3679, 0x0c}, {0x367f, 0x01}, {0x3680, 0x0c}, {0x3681, 0x50}, {0x3682, 0x50}, {0x3683, 0xa9}, {0x3684, 0xa9}, {0x3709, 0x5f}, {0x3714, 0x30}, {0x371a, 0x3e}, {0x3737, 0x08}, {0x3738, 0xcc}, {0x3739, 0x20}, {0x373d, 0x26}, {0x3764, 0x20}, {0x3765, 0x20}, {0x37a1, 0x36}, {0x37a8, 0x3b}, {0x37ab, 0x31}, {0x37c2, 0x2c}, {0x37c3, 0xf1}, {0x37c5, 0x00}, {0x37d8, 0x03}, {0x37d9, 0x06}, {0x37da, 0xc2}, {0x37dc, 0x02}, {0x37e0, 0x00}, {0x37e1, 0x0a}, {0x37e2, 0x14}, {0x37e3, 0x08}, {0x37e4, 0x36}, {0x37e5, 0x03}, {0x37e6, 0x08}, {0x3800, 0x00}, {0x3801, 0x00}, {0x3802, 0x00}, {0x3803, 0x00}, {0x3804, 0x10}, {0x3805, 0x9f}, {0x3806, 0x0c}, {0x3807, 0x5f}, {0x3808, 0x04}, {0x3809, 0x20}, {0x380a, 0x03}, {0x380b, 0x10}, {0x380c, 0x04}, {0x380d, 0x62}, {0x380e, 0x0c}, {0x380f, 0x8e}, {0x3811, 0x04}, {0x3813, 0x05}, {0x3814, 0x07}, {0x3815, 0x01}, {0x3816, 0x07}, {0x3817, 0x01}, {0x3820, 0xac}, {0x3821, 0x00}, {0x3822, 0xc2}, {0x3823, 0x18}, {0x3826, 0x04}, {0x3827, 0x48}, {0x3829, 0x03}, {0x3832, 0x00}, {0x3c80, 0x00}, {0x3c87, 0x01}, {0x3c8c, 0x19}, {0x3c8d, 0x1c}, {0x3c90, 0x00}, {0x3c91, 0x00}, {0x3c92, 0x00}, {0x3c93, 0x00}, {0x3c94, 0x40}, {0x3c95, 0x54}, {0x3c96, 0x34}, {0x3c97, 0x04}, {0x3c98, 0x00}, {0x3d8c, 0x73}, {0x3d8d, 0xc0}, {0x3f00, 0x0b}, {0x3f03, 0x00}, {0x4001, 0xe0}, {0x4008, 0x00}, {0x4009, 0x05}, {0x4011, 0xf0}, {0x4017, 0x08}, {0x4050, 0x02}, {0x4051, 0x05}, {0x4052, 0x00}, {0x4053, 0x80}, {0x4054, 0x00}, {0x4055, 0x80}, {0x4056, 0x00}, {0x4057, 0x80}, {0x4058, 0x00}, {0x4059, 0x80}, {0x405e, 0x20}, {0x4500, 0x07}, {0x4503, 0x00}, {0x450a, 0x04}, {0x4809, 0x04}, {0x480c, 0x12}, {0x481f, 0x30}, {0x4833, 0x10}, {0x4837, 0x1e}, {0x4902, 0x02}, {0x4d00, 0x03}, {0x4d01, 0xc9}, {0x4d02, 0xbc}, {0x4d03, 0xd7}, {0x4d04, 0xf0}, {0x4d05, 0xa2}, {0x5000, 0xfd}, {0x5001, 0x01}, {0x5040, 0x39}, {0x5041, 0x10}, {0x5042, 0x10}, {0x5043, 0x84}, {0x5044, 0x62}, {0x5180, 0x00}, {0x5181, 0x10}, {0x5182, 0x02}, {0x5183, 0x0f}, {0x5200, 0x1b}, {0x520b, 0x07}, {0x520c, 0x0f}, {0x5300, 0x04}, {0x5301, 0x0c}, {0x5302, 0x0c}, {0x5303, 0x0f}, {0x5304, 0x00}, {0x5305, 0x70}, {0x5306, 0x00}, {0x5307, 0x80}, {0x5308, 0x00}, {0x5309, 0xa5}, {0x530a, 0x00}, {0x530b, 0xd3}, {0x530c, 0x00}, {0x530d, 0xf0}, {0x530e, 0x01}, {0x530f, 0x10}, {0x5310, 0x01}, {0x5311, 0x20}, {0x5312, 0x01}, {0x5313, 0x20}, {0x5314, 0x01}, {0x5315, 0x20}, {0x5316, 0x08}, {0x5317, 0x08}, {0x5318, 0x10}, {0x5319, 0x88}, {0x531a, 0x88}, {0x531b, 0xa9}, {0x531c, 0xaa}, {0x531d, 0x0a}, {0x5405, 0x02}, {0x5406, 0x67}, {0x5407, 0x01}, {0x5408, 0x4a}, }; static const char * const ov13858_test_pattern_menu[] = { "Disabled", "Vertical Color Bar Type 1", "Vertical Color Bar Type 2", "Vertical Color Bar Type 3", "Vertical Color Bar Type 4" }; /* Configurations for supported link frequencies */ #define OV13858_NUM_OF_LINK_FREQS 2 #define OV13858_LINK_FREQ_540MHZ 540000000ULL #define OV13858_LINK_FREQ_270MHZ 270000000ULL #define OV13858_LINK_FREQ_INDEX_0 0 #define OV13858_LINK_FREQ_INDEX_1 1 /* * pixel_rate = link_freq * data-rate * nr_of_lanes / bits_per_sample * data rate => double data rate; number of lanes => 4; bits per pixel => 10 */ static u64 link_freq_to_pixel_rate(u64 f) { f *= 2 * 4; do_div(f, 10); return f; } /* Menu items for LINK_FREQ V4L2 control */ static const s64 link_freq_menu_items[OV13858_NUM_OF_LINK_FREQS] = { OV13858_LINK_FREQ_540MHZ, OV13858_LINK_FREQ_270MHZ }; /* Link frequency configs */ static const struct ov13858_link_freq_config link_freq_configs[OV13858_NUM_OF_LINK_FREQS] = { { .pixels_per_line = OV13858_PPL_540MHZ, .reg_list = { .num_of_regs = ARRAY_SIZE(mipi_data_rate_1080mbps), .regs = mipi_data_rate_1080mbps, } }, { .pixels_per_line = OV13858_PPL_270MHZ, .reg_list = { .num_of_regs = ARRAY_SIZE(mipi_data_rate_540mbps), .regs = mipi_data_rate_540mbps, } } }; /* Mode configs */ static const struct ov13858_mode supported_modes[] = { { .width = 4224, .height = 3136, .vts_def = OV13858_VTS_30FPS, .vts_min = OV13858_VTS_30FPS, .reg_list = { .num_of_regs = ARRAY_SIZE(mode_4224x3136_regs), .regs = mode_4224x3136_regs, }, .link_freq_index = OV13858_LINK_FREQ_INDEX_0, }, { .width = 2112, .height = 1568, .vts_def = OV13858_VTS_30FPS, .vts_min = 1608, .reg_list = { .num_of_regs = ARRAY_SIZE(mode_2112x1568_regs), .regs = mode_2112x1568_regs, }, .link_freq_index = OV13858_LINK_FREQ_INDEX_1, }, { .width = 2112, .height = 1188, .vts_def = OV13858_VTS_30FPS, .vts_min = 1608, .reg_list = { .num_of_regs = ARRAY_SIZE(mode_2112x1188_regs), .regs = mode_2112x1188_regs, }, .link_freq_index = OV13858_LINK_FREQ_INDEX_1, }, { .width = 1056, .height = 784, .vts_def = OV13858_VTS_30FPS, .vts_min = 804, .reg_list = { .num_of_regs = ARRAY_SIZE(mode_1056x784_regs), .regs = mode_1056x784_regs, }, .link_freq_index = OV13858_LINK_FREQ_INDEX_1, } }; struct ov13858 { struct v4l2_subdev sd; struct media_pad pad; struct v4l2_ctrl_handler ctrl_handler; /* V4L2 Controls */ struct v4l2_ctrl *link_freq; struct v4l2_ctrl *pixel_rate; struct v4l2_ctrl *vblank; struct v4l2_ctrl *hblank; struct v4l2_ctrl *exposure; /* Current mode */ const struct ov13858_mode *cur_mode; /* Mutex for serialized access */ struct mutex mutex; /* Streaming on/off */ bool streaming; }; #define to_ov13858(_sd) container_of(_sd, struct ov13858, sd) /* Read registers up to 4 at a time */ static int ov13858_read_reg(struct ov13858 *ov13858, u16 reg, u32 len, u32 *val) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); struct i2c_msg msgs[2]; u8 *data_be_p; int ret; u32 data_be = 0; u16 reg_addr_be = cpu_to_be16(reg); if (len > 4) return -EINVAL; data_be_p = (u8 *)&data_be; /* Write register address */ msgs[0].addr = client->addr; msgs[0].flags = 0; msgs[0].len = 2; msgs[0].buf = (u8 *)&reg_addr_be; /* Read data from register */ msgs[1].addr = client->addr; msgs[1].flags = I2C_M_RD; msgs[1].len = len; msgs[1].buf = &data_be_p[4 - len]; ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); if (ret != ARRAY_SIZE(msgs)) return -EIO; *val = be32_to_cpu(data_be); return 0; } /* Write registers up to 4 at a time */ static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len, u32 val) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); int buf_i, val_i; u8 buf[6], *val_p; if (len > 4) return -EINVAL; buf[0] = reg >> 8; buf[1] = reg & 0xff; val = cpu_to_be32(val); val_p = (u8 *)&val; buf_i = 2; val_i = 4 - len; while (val_i < 4) buf[buf_i++] = val_p[val_i++]; if (i2c_master_send(client, buf, len + 2) != len + 2) return -EIO; return 0; } /* Write a list of registers */ static int ov13858_write_regs(struct ov13858 *ov13858, const struct ov13858_reg *regs, u32 len) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); int ret; u32 i; for (i = 0; i < len; i++) { ret = ov13858_write_reg(ov13858, regs[i].address, 1, regs[i].val); if (ret) { dev_err_ratelimited( &client->dev, "Failed to write reg 0x%4.4x. error = %d\n", regs[i].address, ret); return ret; } } return 0; } static int ov13858_write_reg_list(struct ov13858 *ov13858, const struct ov13858_reg_list *r_list) { return ov13858_write_regs(ov13858, r_list->regs, r_list->num_of_regs); } /* Open sub-device */ static int ov13858_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { struct ov13858 *ov13858 = to_ov13858(sd); struct v4l2_mbus_framefmt *try_fmt = v4l2_subdev_get_try_format(sd, fh->pad, 0); mutex_lock(&ov13858->mutex); /* Initialize try_fmt */ try_fmt->width = ov13858->cur_mode->width; try_fmt->height = ov13858->cur_mode->height; try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; try_fmt->field = V4L2_FIELD_NONE; /* No crop or compose */ mutex_unlock(&ov13858->mutex); return 0; } static int ov13858_update_digital_gain(struct ov13858 *ov13858, u32 d_gain) { int ret; ret = ov13858_write_reg(ov13858, OV13858_REG_B_MWB_GAIN, OV13858_REG_VALUE_16BIT, d_gain); if (ret) return ret; ret = ov13858_write_reg(ov13858, OV13858_REG_G_MWB_GAIN, OV13858_REG_VALUE_16BIT, d_gain); if (ret) return ret; ret = ov13858_write_reg(ov13858, OV13858_REG_R_MWB_GAIN, OV13858_REG_VALUE_16BIT, d_gain); return ret; } static int ov13858_enable_test_pattern(struct ov13858 *ov13858, u32 pattern) { int ret; u32 val; ret = ov13858_read_reg(ov13858, OV13858_REG_TEST_PATTERN, OV13858_REG_VALUE_08BIT, &val); if (ret) return ret; if (pattern) { val &= OV13858_TEST_PATTERN_MASK; val |= (pattern - 1) | OV13858_TEST_PATTERN_ENABLE; } else { val &= ~OV13858_TEST_PATTERN_ENABLE; } return ov13858_write_reg(ov13858, OV13858_REG_TEST_PATTERN, OV13858_REG_VALUE_08BIT, val); } static int ov13858_set_ctrl(struct v4l2_ctrl *ctrl) { struct ov13858 *ov13858 = container_of(ctrl->handler, struct ov13858, ctrl_handler); struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); s64 max; int ret; /* Propagate change of current control to all related controls */ switch (ctrl->id) { case V4L2_CID_VBLANK: /* Update max exposure while meeting expected vblanking */ max = ov13858->cur_mode->height + ctrl->val - 8; __v4l2_ctrl_modify_range(ov13858->exposure, ov13858->exposure->minimum, max, ov13858->exposure->step, max); break; }; /* * Applying V4L2 control value only happens * when power is up for streaming */ if (pm_runtime_get_if_in_use(&client->dev) <= 0) return 0; ret = 0; switch (ctrl->id) { case V4L2_CID_ANALOGUE_GAIN: ret = ov13858_write_reg(ov13858, OV13858_REG_ANALOG_GAIN, OV13858_REG_VALUE_16BIT, ctrl->val); break; case V4L2_CID_DIGITAL_GAIN: ret = ov13858_update_digital_gain(ov13858, ctrl->val); break; case V4L2_CID_EXPOSURE: ret = ov13858_write_reg(ov13858, OV13858_REG_EXPOSURE, OV13858_REG_VALUE_24BIT, ctrl->val << 4); break; case V4L2_CID_VBLANK: /* Update VTS that meets expected vertical blanking */ ret = ov13858_write_reg(ov13858, OV13858_REG_VTS, OV13858_REG_VALUE_16BIT, ov13858->cur_mode->height + ctrl->val); break; case V4L2_CID_TEST_PATTERN: ret = ov13858_enable_test_pattern(ov13858, ctrl->val); break; default: dev_info(&client->dev, "ctrl(id:0x%x,val:0x%x) is not handled\n", ctrl->id, ctrl->val); break; }; pm_runtime_put(&client->dev); return ret; } static const struct v4l2_ctrl_ops ov13858_ctrl_ops = { .s_ctrl = ov13858_set_ctrl, }; static int ov13858_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { /* Only one bayer order(GRBG) is supported */ if (code->index > 0) return -EINVAL; code->code = MEDIA_BUS_FMT_SGRBG10_1X10; return 0; } static int ov13858_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_frame_size_enum *fse) { if (fse->index >= ARRAY_SIZE(supported_modes)) return -EINVAL; if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) return -EINVAL; fse->min_width = supported_modes[fse->index].width; fse->max_width = fse->min_width; fse->min_height = supported_modes[fse->index].height; fse->max_height = fse->min_height; return 0; } static void ov13858_update_pad_format(const struct ov13858_mode *mode, struct v4l2_subdev_format *fmt) { fmt->format.width = mode->width; fmt->format.height = mode->height; fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; fmt->format.field = V4L2_FIELD_NONE; } static int ov13858_do_get_pad_format(struct ov13858 *ov13858, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct v4l2_mbus_framefmt *framefmt; struct v4l2_subdev *sd = &ov13858->sd; if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); fmt->format = *framefmt; } else { ov13858_update_pad_format(ov13858->cur_mode, fmt); } return 0; } static int ov13858_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct ov13858 *ov13858 = to_ov13858(sd); int ret; mutex_lock(&ov13858->mutex); ret = ov13858_do_get_pad_format(ov13858, cfg, fmt); mutex_unlock(&ov13858->mutex); return ret; } /* * Calculate resolution distance */ static int ov13858_get_resolution_dist(const struct ov13858_mode *mode, struct v4l2_mbus_framefmt *framefmt) { return abs(mode->width - framefmt->width) + abs(mode->height - framefmt->height); } /* * Find the closest supported resolution to the requested resolution */ static const struct ov13858_mode * ov13858_find_best_fit(struct ov13858 *ov13858, struct v4l2_subdev_format *fmt) { int i, dist, cur_best_fit = 0, cur_best_fit_dist = -1; struct v4l2_mbus_framefmt *framefmt = &fmt->format; for (i = 0; i < ARRAY_SIZE(supported_modes); i++) { dist = ov13858_get_resolution_dist(&supported_modes[i], framefmt); if (cur_best_fit_dist == -1 || dist < cur_best_fit_dist) { cur_best_fit_dist = dist; cur_best_fit = i; } } return &supported_modes[cur_best_fit]; } static int ov13858_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_format *fmt) { struct ov13858 *ov13858 = to_ov13858(sd); const struct ov13858_mode *mode; struct v4l2_mbus_framefmt *framefmt; s32 vblank_def; s32 vblank_min; s64 h_blank; s64 pixel_rate; s64 link_freq; mutex_lock(&ov13858->mutex); /* Only one raw bayer(GRBG) order is supported */ if (fmt->format.code != MEDIA_BUS_FMT_SGRBG10_1X10) fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10; mode = ov13858_find_best_fit(ov13858, fmt); ov13858_update_pad_format(mode, fmt); if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); *framefmt = fmt->format; } else { ov13858->cur_mode = mode; __v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index); link_freq = link_freq_menu_items[mode->link_freq_index]; pixel_rate = link_freq_to_pixel_rate(link_freq); __v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate); /* Update limits and set FPS to default */ vblank_def = ov13858->cur_mode->vts_def - ov13858->cur_mode->height; vblank_min = ov13858->cur_mode->vts_min - ov13858->cur_mode->height; __v4l2_ctrl_modify_range( ov13858->vblank, vblank_min, OV13858_VTS_MAX - ov13858->cur_mode->height, 1, vblank_def); __v4l2_ctrl_s_ctrl(ov13858->vblank, vblank_def); h_blank = link_freq_configs[mode->link_freq_index].pixels_per_line - ov13858->cur_mode->width; __v4l2_ctrl_modify_range(ov13858->hblank, h_blank, h_blank, 1, h_blank); } mutex_unlock(&ov13858->mutex); return 0; } static int ov13858_get_skip_frames(struct v4l2_subdev *sd, u32 *frames) { *frames = OV13858_NUM_OF_SKIP_FRAMES; return 0; } /* Start streaming */ static int ov13858_start_streaming(struct ov13858 *ov13858) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); const struct ov13858_reg_list *reg_list; int ret, link_freq_index; /* Get out of from software reset */ ret = ov13858_write_reg(ov13858, OV13858_REG_SOFTWARE_RST, OV13858_REG_VALUE_08BIT, OV13858_SOFTWARE_RST); if (ret) { dev_err(&client->dev, "%s failed to set powerup registers\n", __func__); return ret; } /* Setup PLL */ link_freq_index = ov13858->cur_mode->link_freq_index; reg_list = &link_freq_configs[link_freq_index].reg_list; ret = ov13858_write_reg_list(ov13858, reg_list); if (ret) { dev_err(&client->dev, "%s failed to set plls\n", __func__); return ret; } /* Apply default values of current mode */ reg_list = &ov13858->cur_mode->reg_list; ret = ov13858_write_reg_list(ov13858, reg_list); if (ret) { dev_err(&client->dev, "%s failed to set mode\n", __func__); return ret; } /* Apply customized values from user */ ret = __v4l2_ctrl_handler_setup(ov13858->sd.ctrl_handler); if (ret) return ret; return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT, OV13858_REG_VALUE_08BIT, OV13858_MODE_STREAMING); } /* Stop streaming */ static int ov13858_stop_streaming(struct ov13858 *ov13858) { return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT, OV13858_REG_VALUE_08BIT, OV13858_MODE_STANDBY); } static int ov13858_set_stream(struct v4l2_subdev *sd, int enable) { struct ov13858 *ov13858 = to_ov13858(sd); struct i2c_client *client = v4l2_get_subdevdata(sd); int ret = 0; mutex_lock(&ov13858->mutex); if (ov13858->streaming == enable) { mutex_unlock(&ov13858->mutex); return 0; } if (enable) { ret = pm_runtime_get_sync(&client->dev); if (ret < 0) { pm_runtime_put_noidle(&client->dev); goto err_unlock; } /* * Apply default & customized values * and then start streaming. */ ret = ov13858_start_streaming(ov13858); if (ret) goto err_rpm_put; } else { ov13858_stop_streaming(ov13858); pm_runtime_put(&client->dev); } ov13858->streaming = enable; mutex_unlock(&ov13858->mutex); return ret; err_rpm_put: pm_runtime_put(&client->dev); err_unlock: mutex_unlock(&ov13858->mutex); return ret; } static int __maybe_unused ov13858_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov13858 *ov13858 = to_ov13858(sd); if (ov13858->streaming) ov13858_stop_streaming(ov13858); return 0; } static int __maybe_unused ov13858_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov13858 *ov13858 = to_ov13858(sd); int ret; if (ov13858->streaming) { ret = ov13858_start_streaming(ov13858); if (ret) goto error; } return 0; error: ov13858_stop_streaming(ov13858); ov13858->streaming = 0; return ret; } /* Verify chip ID */ static int ov13858_identify_module(struct ov13858 *ov13858) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); int ret; u32 val; ret = ov13858_read_reg(ov13858, OV13858_REG_CHIP_ID, OV13858_REG_VALUE_24BIT, &val); if (ret) return ret; if (val != OV13858_CHIP_ID) { dev_err(&client->dev, "chip id mismatch: %x!=%x\n", OV13858_CHIP_ID, val); return -EIO; } return 0; } static const struct v4l2_subdev_video_ops ov13858_video_ops = { .s_stream = ov13858_set_stream, }; static const struct v4l2_subdev_pad_ops ov13858_pad_ops = { .enum_mbus_code = ov13858_enum_mbus_code, .get_fmt = ov13858_get_pad_format, .set_fmt = ov13858_set_pad_format, .enum_frame_size = ov13858_enum_frame_size, }; static const struct v4l2_subdev_sensor_ops ov13858_sensor_ops = { .g_skip_frames = ov13858_get_skip_frames, }; static const struct v4l2_subdev_ops ov13858_subdev_ops = { .video = &ov13858_video_ops, .pad = &ov13858_pad_ops, .sensor = &ov13858_sensor_ops, }; static const struct media_entity_operations ov13858_subdev_entity_ops = { .link_validate = v4l2_subdev_link_validate, }; static const struct v4l2_subdev_internal_ops ov13858_internal_ops = { .open = ov13858_open, }; /* Initialize control handlers */ static int ov13858_init_controls(struct ov13858 *ov13858) { struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); struct v4l2_ctrl_handler *ctrl_hdlr; s64 exposure_max; s64 vblank_def; s64 vblank_min; s64 hblank; s64 pixel_rate_min; s64 pixel_rate_max; const struct ov13858_mode *mode; int ret; ctrl_hdlr = &ov13858->ctrl_handler; ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8); if (ret) return ret; mutex_init(&ov13858->mutex); ctrl_hdlr->lock = &ov13858->mutex; ov13858->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_LINK_FREQ, OV13858_NUM_OF_LINK_FREQS - 1, 0, link_freq_menu_items); ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]); pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[1]); /* By default, PIXEL_RATE is read only */ ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_PIXEL_RATE, pixel_rate_min, pixel_rate_max, 1, pixel_rate_max); mode = ov13858->cur_mode; vblank_def = mode->vts_def - mode->height; vblank_min = mode->vts_min - mode->height; ov13858->vblank = v4l2_ctrl_new_std( ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_VBLANK, vblank_min, OV13858_VTS_MAX - mode->height, 1, vblank_def); hblank = link_freq_configs[mode->link_freq_index].pixels_per_line - mode->width; ov13858->hblank = v4l2_ctrl_new_std( ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_HBLANK, hblank, hblank, 1, hblank); ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; exposure_max = mode->vts_def - 8; ov13858->exposure = v4l2_ctrl_new_std( ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_EXPOSURE, OV13858_EXPOSURE_MIN, exposure_max, OV13858_EXPOSURE_STEP, OV13858_EXPOSURE_DEFAULT); v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_ANALOGUE_GAIN, OV13858_ANA_GAIN_MIN, OV13858_ANA_GAIN_MAX, OV13858_ANA_GAIN_STEP, OV13858_ANA_GAIN_DEFAULT); /* Digital gain */ v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_DIGITAL_GAIN, OV13858_DGTL_GAIN_MIN, OV13858_DGTL_GAIN_MAX, OV13858_DGTL_GAIN_STEP, OV13858_DGTL_GAIN_DEFAULT); v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov13858_ctrl_ops, V4L2_CID_TEST_PATTERN, ARRAY_SIZE(ov13858_test_pattern_menu) - 1, 0, 0, ov13858_test_pattern_menu); if (ctrl_hdlr->error) { ret = ctrl_hdlr->error; dev_err(&client->dev, "%s control init failed (%d)\n", __func__, ret); goto error; } ov13858->sd.ctrl_handler = ctrl_hdlr; return 0; error: v4l2_ctrl_handler_free(ctrl_hdlr); mutex_destroy(&ov13858->mutex); return ret; } static void ov13858_free_controls(struct ov13858 *ov13858) { v4l2_ctrl_handler_free(ov13858->sd.ctrl_handler); mutex_destroy(&ov13858->mutex); } static int ov13858_probe(struct i2c_client *client, const struct i2c_device_id *devid) { struct ov13858 *ov13858; int ret; u32 val = 0; device_property_read_u32(&client->dev, "clock-frequency", &val); if (val != 19200000) return -EINVAL; ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL); if (!ov13858) return -ENOMEM; /* Initialize subdev */ v4l2_i2c_subdev_init(&ov13858->sd, client, &ov13858_subdev_ops); /* Check module identity */ ret = ov13858_identify_module(ov13858); if (ret) { dev_err(&client->dev, "failed to find sensor: %d\n", ret); return ret; } /* Set default mode to max resolution */ ov13858->cur_mode = &supported_modes[0]; ret = ov13858_init_controls(ov13858); if (ret) return ret; /* Initialize subdev */ ov13858->sd.internal_ops = &ov13858_internal_ops; ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ov13858->sd.entity.ops = &ov13858_subdev_entity_ops; ov13858->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; /* Initialize source pad */ ov13858->pad.flags = MEDIA_PAD_FL_SOURCE; ret = media_entity_pads_init(&ov13858->sd.entity, 1, &ov13858->pad); if (ret) { dev_err(&client->dev, "%s failed:%d\n", __func__, ret); goto error_handler_free; } ret = v4l2_async_register_subdev_sensor_common(&ov13858->sd); if (ret < 0) goto error_media_entity; /* * Device is already turned on by i2c-core with ACPI domain PM. * Enable runtime PM and turn off the device. */ pm_runtime_get_noresume(&client->dev); pm_runtime_set_active(&client->dev); pm_runtime_enable(&client->dev); pm_runtime_put(&client->dev); return 0; error_media_entity: media_entity_cleanup(&ov13858->sd.entity); error_handler_free: ov13858_free_controls(ov13858); dev_err(&client->dev, "%s failed:%d\n", __func__, ret); return ret; } static int ov13858_remove(struct i2c_client *client) { struct v4l2_subdev *sd = i2c_get_clientdata(client); struct ov13858 *ov13858 = to_ov13858(sd); v4l2_async_unregister_subdev(sd); media_entity_cleanup(&sd->entity); ov13858_free_controls(ov13858); /* * Disable runtime PM but keep the device turned on. * i2c-core with ACPI domain PM will turn off the device. */ pm_runtime_get_sync(&client->dev); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); pm_runtime_put_noidle(&client->dev); return 0; } static const struct i2c_device_id ov13858_id_table[] = { {"ov13858", 0}, {}, }; MODULE_DEVICE_TABLE(i2c, ov13858_id_table); static const struct dev_pm_ops ov13858_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(ov13858_suspend, ov13858_resume) }; #ifdef CONFIG_ACPI static const struct acpi_device_id ov13858_acpi_ids[] = { {"OVTID858"}, { /* sentinel */ } }; MODULE_DEVICE_TABLE(acpi, ov13858_acpi_ids); #endif static struct i2c_driver ov13858_i2c_driver = { .driver = { .name = "ov13858", .owner = THIS_MODULE, .pm = &ov13858_pm_ops, .acpi_match_table = ACPI_PTR(ov13858_acpi_ids), }, .probe = ov13858_probe, .remove = ov13858_remove, .id_table = ov13858_id_table, }; module_i2c_driver(ov13858_i2c_driver); MODULE_AUTHOR("Kan, Chris <[email protected]>"); MODULE_AUTHOR("Rapolu, Chiranjeevi <[email protected]>"); MODULE_AUTHOR("Yang, Hyungwoo <[email protected]>"); MODULE_DESCRIPTION("Omnivision ov13858 sensor driver"); MODULE_LICENSE("GPL v2");
» Phenylmercuric Acetate contains not less than 98.0 percent and not more than 100.5 percent of C8H8HgO2. A: Add 0.5 mL of nitric acid to 0.1 g of it, warm gently until a dark brown color is produced, and dilute with water to 10 mL: the characteristic odor of nitrobenzene is evolved. B: To 0.1 g of it add 0.5 mL of sulfuric acid and 1 mL of alcohol, and warm: the characteristic odor of ethyl acetate is evolved. C: To 5 mL of a saturated solution in water add a few drops of sodium sulfide TS: a white precipitate is formed, which turns black when the mixture is boiled and then allowed to stand. Melting range 741 : between 149 and 153 . Mercuric salts and Heavy metals— Heat about 100 mg with 15 mL of water, cool, and filter. To the filtrate add a few drops of sodium sulfide TS: the resulting precipitate shows no immediate color. Polymercurated benzene compounds— Shake 2.0 g with 100 mL of acetone, and filter. Wash the residue with successive portions of acetone until a total of 50 mL is used, then dry the residue at 105 for 1 hour, and weigh: the weight of the residue does not exceed 30 mg (1.5%). Assay— Transfer about 500 mg of Phenylmercuric Acetate, accurately weighed, to a 100-mL flask, add 15 mL of water, 5 mL of formic acid, and 1 g of zinc dust, and reflux for 30 minutes. Cool, filter, and wash the filter paper and the amalgam with water until the washings are no longer acid to litmus. Dissolve the amalgam in 40 mL of 8 N nitric acid. Heat on a steam bath for 3 minutes, and then add 500 mg of urea and enough potassium permanganate TS to produce a permanent pink color. Cool, decolorize the solution with hydrogen peroxide TS, add 1 mL of ferric ammonium sulfate TS, and titrate with 0.1 N ammonium thiocyanate VS. Each mL of 0.1 N ammonium thiocyanate is equivalent to 16.84 mg of C8H8HgO2.
package org.multiverse.stms.gamma.integration.blocking; import org.junit.Before; import org.junit.Test; import org.multiverse.TestThread; import org.multiverse.api.Txn; import org.multiverse.api.TxnExecutor; import org.multiverse.api.callables.TxnCallable; import org.multiverse.api.callables.TxnIntCallable; import org.multiverse.api.callables.TxnVoidCallable; import org.multiverse.stms.gamma.GammaConstants; import org.multiverse.stms.gamma.GammaStm; import org.multiverse.stms.gamma.transactionalobjects.GammaTxnInteger; import org.multiverse.stms.gamma.transactionalobjects.GammaTxnRef; import java.util.concurrent.atomic.AtomicInteger; import static org.junit.Assert.*; import static org.multiverse.TestUtils.*; import static org.multiverse.api.GlobalStmInstance.getGlobalStmInstance; import static org.multiverse.api.TxnThreadLocal.clearThreadLocalTxn; /** * A StressTest that simulates a database connection pool. The code is quite ugly, but that is because * no instrumentation is used here. * * @author Peter Veentjer. */ public abstract class ConnectionPool_AbstractTest implements GammaConstants { private int poolsize = processorCount(); private int threadCount = processorCount() * 2; private volatile boolean stop; private ConnectionPool pool; protected GammaStm stm; @Before public void setUp() { clearThreadLocalTxn(); stm = (GammaStm) getGlobalStmInstance(); stop = false; } protected abstract TxnExecutor newReturnBlock(); protected abstract TxnExecutor newTakeBlock(); @Test public void sanityTest() { ConnectionPool pool = new ConnectionPool(2); Connection c1 = pool.takeConnection(); assertEquals(1, pool.size()); Connection c2 = pool.takeConnection(); assertEquals(0, pool.size()); pool.returnConnection(c1); assertEquals(1, pool.size()); pool.returnConnection(c2); assertEquals(2, pool.size()); } public void run() { pool = new ConnectionPool(poolsize); WorkerThread[] threads = createThreads(); startAll(threads); sleepMs(30 * 1000); stop = true; joinAll(threads); assertEquals(poolsize, pool.size()); } class ConnectionPool { final TxnExecutor takeConnectionBlock = newTakeBlock(); final TxnExecutor returnConnectionBlock = newReturnBlock(); final TxnExecutor sizeBlock = stm.newTxnFactoryBuilder().newTxnExecutor(); final GammaTxnInteger size = new GammaTxnInteger(stm); final GammaTxnRef<Node<Connection>> head = new GammaTxnRef<Node<Connection>>(stm); ConnectionPool(final int poolsize) { stm.getDefaultTxnExecutor().execute(new TxnVoidCallable() { @Override public void call(Txn tx) { size.set(poolsize); Node<Connection> h = null; for (int k = 0; k < poolsize; k++) { h = new Node<Connection>(h, new Connection()); } head.set(h); } }); } Connection takeConnection() { return takeConnectionBlock.execute(new TxnCallable<Connection>() { @Override public Connection call(Txn tx) { if (size.get() == 0) { tx.retry(); } size.decrement(); Node<Connection> current = head.get(); head.set(current.next); return current.item; } }); } void returnConnection(final Connection c) { returnConnectionBlock.execute(new TxnVoidCallable() { @Override public void call(Txn tx) throws Exception { size.incrementAndGet(1); Node<Connection> oldHead = head.get(); head.set(new Node<Connection>(oldHead, c)); } }); } int size() { return sizeBlock.execute(new TxnIntCallable() { @Override public int call(Txn tx) throws Exception { return size.get(); } }); } } static class Node<E> { final Node<E> next; final E item; Node(Node<E> next, E item) { this.next = next; this.item = item; } } static class Connection { AtomicInteger users = new AtomicInteger(); void startUsing() { if (!users.compareAndSet(0, 1)) { fail(); } } void stopUsing() { if (!users.compareAndSet(1, 0)) { fail(); } } } private WorkerThread[] createThreads() { WorkerThread[] threads = new WorkerThread[threadCount]; for (int k = 0; k < threads.length; k++) { threads[k] = new WorkerThread(k); } return threads; } class WorkerThread extends TestThread { public WorkerThread(int id) { super("WorkerThread-" + id); } @Override public void doRun() throws Exception { int k = 0; while (!stop) { if (k % 100 == 0) { System.out.printf("%s is at %s\n", getName(), k); } Connection c = pool.takeConnection(); assertNotNull(c); c.startUsing(); try { sleepRandomMs(50); } finally { c.stopUsing(); pool.returnConnection(c); } k++; } } } }
WASHINGTON, D.C. - The U.S. Department of Justice and the U.S. Environmental Protection Agency announced they have reached a comprehensive Clean Water Act settlement with the Sanitation District No. 1 of Northern Kentucky. At a cost of at least $880 million, the District has agreed to make extensive improvements to its sewer systems to eliminate unauthorized overflows of untreated raw sewage and to control overflows of combined sewage and stormwater. Each year, the District has been unlawfully discharging untreated sewage and experiencing overflows of combined sewage into the Ohio River and its tributaries in amounts totaling almost a billion gallons.
The term “endoscopy” refers to a special technique for looking inside a part of the body. “Upper GI” is the portion of the gastro-intestinal tract, the digestive system, that includes the esophagus( Food Pipe), the stomach, and the duodenum ( the beginning of the small intestine). Upper GI endoscopy is a procedure performed by a gastroenterologist, a well-trained specialist who uses the endoscope to diagnose and, in some cases, treat problems of the upper digestive system. The doctor may start by spraying your throat with a local anaesthetic. Then you will be given sedation to help you relax. You will then lie on your left side, a mouth piece will be put in your mouth and the doctor will pass the tube into your mouth and down your food pipe (oesophagus), stomach and duodenum (small bowel leading from the stomach). Small pieces of tissue (skin inside your oesophagus, stomach, duodenum) may need to be removed for pathology tests. The endoscope does not cause problems with breathing unless you have lung or heart problems. Regardless of why upper GI endoscopy has been recommended for you, there are important steps you can take to prepare for and participate in the procedure. You must not eat or drink anything for at least six hours before the procedure. Ideally you must not eat or drink anything after midnight the night before your procedure. Food in the stomach will block the view through the endoscope and it could cause vomiting. The exception is medication taken with small sips of water. If you are scheduled for a morning procedure: You should have nothing by mouth (including gum and mints) after midnight. The exception is medication taken with small sips of water. If you are scheduled for an afternoon procedure: You may continue drinking small quantities of clear liquids up to 6 hours prior to your scheduled arrival time. CLEAR LIQUIDS: water, apple juice, ginger ale, sprite, beef or chicken broth WITHOUT noodles, coffee or tea WITHOUT cream or milk, most sodas, sherbet, pop-sicles, and Jell-O that is not red or orange. DO NOT DRINK ANYTHING RED OR ORANGE. On the day of your upper GI endoscopy, please come directly to the requested location at your scheduled arrival time. Plan to spend several hours at the unit to allow time for your preparation, your procedure, and your recovery. Before the procedure, a nurse will greet you and assist you with changing into a hospital gown. An IV will be placed in your arm. You will receive relaxing medications through the IV during the procedure. You will be lying on your side during the upper endoscopy and the endoscope will be passed through your mouth and throat to view the upper digestive tract. The procedure takes approximately 15-30 minutes to complete. During the procedure, everything will be done to help you be as comfortable as possible. Your blood pressure, pulse and blood oxygen level will be carefully monitored. Your gastroenterologist may give you a sedative to help make you relaxed and drowsy, but you will remain awake enough to cooperate. You may also have your throat sprayed or be asked to gargle with a local anesthetic to help keep you comfortable as the endoscope is passed through. A supportive mouthpiece will be placed to help you keep your mouth open during the endoscopy. Once you are fully prepared, your gastroenterologist will gently maneuver the endoscope into position. As the endoscope is slowly and carefully inserted, air is introduced through it to help your gastroenterologist see better. During the procedure, you should feel little to no pain and it will not interfere with your breathing. Your gastroenterologist will use the endoscope to look closely for any problems that may require evaluation, diagnosis or treatment. In some cases, it may be necessary to take a sample of tissue, called a biopsy, for later examination under the microscope. This, too, is a painless procedure. In other cases, the endoscope can be used to treat a problem such as active bleeding from an ulcer. A tear through the wall of the food pipe, stomach or duodenum (perforation). This is rare and may need surgery. There is also a risk of infection. This may result in a longer stay in hospital. Bleeding at a biopsy site or at the site where a polyp has been removed. This is usually minor and can usually be stopped through the endoscope. Rarely, surgery is needed to stop bleeding. Lung infection is uncommon and is due to vomit going into the lungs. Your procedure may not be able to be finished due to problems inside your body or because of technical problems. There is a rare possibility that defects or disease may be missed. Other potential risks include a reaction to the sedation used and complications from heart or lung diseases. Death is possible due to complications of the procedure, but is extremely rare. When your endoscopy is completed you will be cared for in a recovery area until most of the effects of the medication have worn off. Occasionally, minor problems may persist, such as mild sore throat, bloating or cramping; these should disappear in 24 hours or less.The air put into your stomach during the test causes this. You can usually eat and drink normally afterwards unless you are told otherwise. By the time you are ready to go home, you’ll feel more alert. Nevertheless, you should plan on resting for the remainder of the day.
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Mod Manager")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Mod Manager")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("4a861275-d663-4aaa-9707-5d57fa19e48f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.7.0.0")] [assembly: AssemblyFileVersion("0.7.0.0")]
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.metamodel.util; import java.util.Comparator; import junit.framework.TestCase; public class BooleanComparatorTest extends TestCase { public void testCompare() throws Exception { Comparator<Object> c = BooleanComparator.getComparator(); assertEquals(1, c.compare(true, false)); assertEquals(-1, c.compare(false, true)); assertEquals(0, c.compare(true, true)); assertEquals(0, c.compare(false, false)); assertEquals(1, c.compare("true", "false")); assertEquals(1, c.compare("1", "false")); assertEquals(1, c.compare("true", "0")); assertEquals(1, c.compare("true", "false")); assertEquals(1, c.compare(1, 0)); assertEquals(1, c.compare(1, "false")); assertEquals(1, c.compare("yes", false)); assertEquals(1, c.compare("y", false)); assertEquals(1, c.compare("TRUE", false)); } public void testComparable() throws Exception { Comparable<Object> comparable = BooleanComparator.getComparable(true); assertEquals(1, comparable.compareTo(false)); assertEquals(1, comparable.compareTo(0)); assertEquals(1, comparable.compareTo("false")); } }
I am extremely well versed in the “The classic 39“, which were the complete one half-hour episodes that Gleason brilliantly had the piece of mind to shoot on film, which still air on television to this day. They had a great Christmas episode within the 39, which is a gem in its own right. But another Christmas episode has come to light. In the 1980’s, Gleason came out with a slew of long thought to be forgotten episodes he had been sitting on up to that point. These now called “lost episodes” have found their way onto the television rotation within the 39, and can be spotted by the poor video quality because of the media they were originally shot on (so again, thanks Mr. G for pushing for shooting the classic 39 on celluloid!). These episodes originally came from the Gleason variety shows (before they got their own show which became the 39) and can be as short as 8 minutes or as long as 40 minutes, which sadly sometimes are edited down to fit a half-hour time slot with commercials. Evidently, these episodes found their way onto video and DVD, before they too went out of print. This year, a long-awaited box set was finally released, which has the complete ‘lost episodes’ in their entirety and restored to their originally glory. A definite must-have for fans! Within these is a number of once lost holiday episodes, and last night I threw on one of the discs to watch an episode entitled the “Christmas Party” from December 19, 1953. Merry Christmas! Boy was it great. It had everyone we know and love from the show: Audrey Meadows as Alice, Art Carney as neighbor Ed Norton, and Joyce Randolph as his wife Trixie. First off for you Honeymooner fans, the Kramden’s apartment was much different, with a piano and television on the premises. Different furniture isn’t that unheard of, especially since this is an early episode -well before the 39 were shot- while they were still only one of the many skits on Gleason’s variety show. The major difference from any other Honeymooners‘ episode was the plot. Alice is holding a Christmas party and has sent Ralph out to get potato salad from Krausers (delicatessen as they called it back then). Back with the wrong salad, Ralph is sent back out to get the proper potato salad from Krausers. This takes Gleason as Kramden out of the equation for the episode to unfold. Trixie and Ed come down to chat with Alice and then the some of the most unusual things ever in Honeymooners’ lore takes place. Gleason’s other widely popular character Joe the bartender, again played by Gleason comes up from his bar to explain he is hosting a wild party thrown by none other than the super-rich aristocrat Reginald Van Gleason the 3rd. Joe then coaxes Langford down to his bar to sing a couple of songs, and they both exit. Norton then brings on a young neighbor who is on his way down to sing in the bar, who turns out to a very young Eddie Hodges, and he performs the Nat King Cole arrangement of “Walking My Baby Back Home“. Hodges can be no older than 5, and belts out the song like he has done it a hundred times already in front of an audience of millions. He leaves, and the Gleason’s Poor Soul comes back for a very touching Christmas moment that will make anyone tear up, and he then exits. The loudmouth Rudy the Repairmen (yet again played by Gleason) and his little assistant then come over to attempt to repair the broken television; and hilarity ensures. Lastly, Gleason enters as Reginald Van Gleason the 3rd, complete with a traveling band and lady cabaret dancers and sings and dances out a tune before leaving. The surprising and hilarious show wraps up with poor Ralph Kramden coming home, escorted by a cop, who thought he was trying to break into Krausers to get the potato salad Alice wanted. This Christmas episode stands out because for the first and only time in the Gleason universe, all his other famous and popular characters from other skits show up and cameo in the small apartment on 328 Chauncey St. It’s a real treat and a lovely aside in the series to see various characters interact with each other and to know, say, that Joe the Bartender’s bar is on the first floor of the Kramden’s building, or the Poor Soul being treated lovingly by the Nortons and the Kramdens. It is also a testament to the genius that is Gleason, who had to have at least a dozen costume changes in the 35 minute span of the skit, in which Gleason ducks in and out of his wildly different personas. If you are in any way a Gleason or a Honeymooners fan, I wholeheartedly encourage you to seek out this lovely Christmas Special and view a rarity in sitcom history, and certainly the only time Gleason’s cavalcade of characters all guested on the same episode. I guess the only criticism I’d have for the special is that I wished the two guest stars actually sang Christmas Songs, and not regular ballads. If you do not want to spend the coin on the box set, here is a lovely best-of dvd that has the said special. It is a great installment for the holidays, and brings you back to when television was live and amazing. This special and the box set set for that matter is definitely a ‘must-have’ and it also reminds you why Gleason was the original “Great One“.
#include "builtin.h" #include "cache.h" #include "commit.h" #include "diff.h" #include "path-list.h" #include "revision.h" #include "utf8.h" #include "mailmap.h" #include "shortlog.h" static const char shortlog_usage[] = "git-shortlog [-n] [-s] [-e] [-w] [<commit-id>... ]"; static int compare_by_number(const void *a1, const void *a2) { const struct path_list_item *i1 = a1, *i2 = a2; const struct path_list *l1 = i1->util, *l2 = i2->util; if (l1->nr < l2->nr) return 1; else if (l1->nr == l2->nr) return 0; else return -1; } static void insert_one_record(struct shortlog *log, const char *author, const char *oneline) { const char *dot3 = log->common_repo_prefix; char *buffer, *p; struct path_list_item *item; struct path_list *onelines; char namebuf[1024]; size_t len; const char *eol; const char *boemail, *eoemail; boemail = strchr(author, '<'); if (!boemail) return; eoemail = strchr(boemail, '>'); if (!eoemail) return; if (!map_email(&log->mailmap, boemail+1, namebuf, sizeof(namebuf))) { while (author < boemail && isspace(*author)) author++; for (len = 0; len < sizeof(namebuf) - 1 && author + len < boemail; len++) namebuf[len] = author[len]; while (0 < len && isspace(namebuf[len-1])) len--; namebuf[len] = '\0'; } else len = strlen(namebuf); if (log->email) { size_t room = sizeof(namebuf) - len - 1; int maillen = eoemail - boemail + 1; snprintf(namebuf + len, room, " %.*s", maillen, boemail); } buffer = xstrdup(namebuf); item = path_list_insert(buffer, &log->list); if (item->util == NULL) item->util = xcalloc(1, sizeof(struct path_list)); else free(buffer); /* Skip any leading whitespace, including any blank lines. */ while (*oneline && isspace(*oneline)) oneline++; eol = strchr(oneline, '\n'); if (!eol) eol = oneline + strlen(oneline); if (!prefixcmp(oneline, "[PATCH")) { char *eob = strchr(oneline, ']'); if (eob && (!eol || eob < eol)) oneline = eob + 1; } while (*oneline && isspace(*oneline) && *oneline != '\n') oneline++; len = eol - oneline; while (len && isspace(oneline[len-1])) len--; buffer = xmemdupz(oneline, len); if (dot3) { int dot3len = strlen(dot3); if (dot3len > 5) { while ((p = strstr(buffer, dot3)) != NULL) { int taillen = strlen(p) - dot3len; memcpy(p, "/.../", 5); memmove(p + 5, p + dot3len, taillen + 1); } } } onelines = item->util; if (onelines->nr >= onelines->alloc) { onelines->alloc = alloc_nr(onelines->nr); onelines->items = xrealloc(onelines->items, onelines->alloc * sizeof(struct path_list_item)); } onelines->items[onelines->nr].util = NULL; onelines->items[onelines->nr++].path = buffer; } static void read_from_stdin(struct shortlog *log) { char author[1024], oneline[1024]; while (fgets(author, sizeof(author), stdin) != NULL) { if (!(author[0] == 'A' || author[0] == 'a') || prefixcmp(author + 1, "uthor: ")) continue; while (fgets(oneline, sizeof(oneline), stdin) && oneline[0] != '\n') ; /* discard headers */ while (fgets(oneline, sizeof(oneline), stdin) && oneline[0] == '\n') ; /* discard blanks */ insert_one_record(log, author + 8, oneline); } } void shortlog_add_commit(struct shortlog *log, struct commit *commit) { const char *author = NULL, *buffer; buffer = commit->buffer; while (*buffer && *buffer != '\n') { const char *eol = strchr(buffer, '\n'); if (eol == NULL) eol = buffer + strlen(buffer); else eol++; if (!prefixcmp(buffer, "author ")) author = buffer + 7; buffer = eol; } if (!author) die("Missing author: %s", sha1_to_hex(commit->object.sha1)); if (*buffer) buffer++; insert_one_record(log, author, !*buffer ? "<none>" : buffer); } static void get_from_rev(struct rev_info *rev, struct shortlog *log) { struct commit *commit; if (prepare_revision_walk(rev)) die("revision walk setup failed"); while ((commit = get_revision(rev)) != NULL) shortlog_add_commit(log, commit); } static int parse_uint(char const **arg, int comma) { unsigned long ul; int ret; char *endp; ul = strtoul(*arg, &endp, 10); if (endp != *arg && *endp && *endp != comma) return -1; ret = (int) ul; if (ret != ul) return -1; *arg = endp; if (**arg) (*arg)++; return ret; } static const char wrap_arg_usage[] = "-w[<width>[,<indent1>[,<indent2>]]]"; #define DEFAULT_WRAPLEN 76 #define DEFAULT_INDENT1 6 #define DEFAULT_INDENT2 9 static void parse_wrap_args(const char *arg, int *in1, int *in2, int *wrap) { arg += 2; /* skip -w */ *wrap = parse_uint(&arg, ','); if (*wrap < 0) die(wrap_arg_usage); *in1 = parse_uint(&arg, ','); if (*in1 < 0) die(wrap_arg_usage); *in2 = parse_uint(&arg, '\0'); if (*in2 < 0) die(wrap_arg_usage); if (!*wrap) *wrap = DEFAULT_WRAPLEN; if (!*in1) *in1 = DEFAULT_INDENT1; if (!*in2) *in2 = DEFAULT_INDENT2; if (*wrap && ((*in1 && *wrap <= *in1) || (*in2 && *wrap <= *in2))) die(wrap_arg_usage); } void shortlog_init(struct shortlog *log) { memset(log, 0, sizeof(*log)); read_mailmap(&log->mailmap, ".mailmap", &log->common_repo_prefix); log->list.strdup_paths = 1; log->wrap = DEFAULT_WRAPLEN; log->in1 = DEFAULT_INDENT1; log->in2 = DEFAULT_INDENT2; } int cmd_shortlog(int argc, const char **argv, const char *prefix) { struct shortlog log; struct rev_info rev; int nongit; prefix = setup_git_directory_gently(&nongit); shortlog_init(&log); /* since -n is a shadowed rev argument, parse our args first */ while (argc > 1) { if (!strcmp(argv[1], "-n") || !strcmp(argv[1], "--numbered")) log.sort_by_number = 1; else if (!strcmp(argv[1], "-s") || !strcmp(argv[1], "--summary")) log.summary = 1; else if (!strcmp(argv[1], "-e") || !strcmp(argv[1], "--email")) log.email = 1; else if (!prefixcmp(argv[1], "-w")) { log.wrap_lines = 1; parse_wrap_args(argv[1], &log.in1, &log.in2, &log.wrap); } else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) usage(shortlog_usage); else break; argv++; argc--; } init_revisions(&rev, prefix); argc = setup_revisions(argc, argv, &rev, NULL); if (argc > 1) die ("unrecognized argument: %s", argv[1]); /* assume HEAD if from a tty */ if (!nongit && !rev.pending.nr && isatty(0)) add_head_to_pending(&rev); if (rev.pending.nr == 0) { read_from_stdin(&log); } else get_from_rev(&rev, &log); shortlog_output(&log); return 0; } void shortlog_output(struct shortlog *log) { int i, j; if (log->sort_by_number) qsort(log->list.items, log->list.nr, sizeof(struct path_list_item), compare_by_number); for (i = 0; i < log->list.nr; i++) { struct path_list *onelines = log->list.items[i].util; if (log->summary) { printf("%6d\t%s\n", onelines->nr, log->list.items[i].path); } else { printf("%s (%d):\n", log->list.items[i].path, onelines->nr); for (j = onelines->nr - 1; j >= 0; j--) { const char *msg = onelines->items[j].path; if (log->wrap_lines) { int col = print_wrapped_text(msg, log->in1, log->in2, log->wrap); if (col != log->wrap) putchar('\n'); } else printf(" %s\n", msg); } putchar('\n'); } onelines->strdup_paths = 1; path_list_clear(onelines, 1); free(onelines); log->list.items[i].util = NULL; } log->list.strdup_paths = 1; path_list_clear(&log->list, 1); log->mailmap.strdup_paths = 1; path_list_clear(&log->mailmap, 1); }
""" ======================================================== Compute real-time evoked responses with FieldTrip client ======================================================== This example demonstrates how to connect the MNE real-time system to the Fieldtrip buffer using FieldTripClient class. This example was tested in simulation mode neuromag2ft --file MNE-sample-data/MEG/sample/sample_audvis_raw.fif using a modified version of neuromag2ft available at http://neuro.hut.fi/~mainak/neuromag2ft-2.0.0.zip to run the FieldTrip buffer. Then running this example acquires the data on the client side. Since the Fieldtrip buffer does not contain all the measurement information required by the MNE real-time processing pipeline, an info dictionary must be provided to instantiate FieldTripClient. Alternatively, the MNE-Python script will try to guess the missing measurement info from the Fieldtrip Header object. Together with RtEpochs, this can be used to compute evoked responses using moving averages. """ # Author: Mainak Jas <[email protected]> # # License: BSD (3-clause) import matplotlib.pyplot as plt import mne from mne.viz import plot_events from mne.realtime import FieldTripClient, RtEpochs print(__doc__) # select the left-auditory condition event_id, tmin, tmax = 1, -0.2, 0.5 # user must provide list of bad channels because # FieldTrip header object does not provide that bads = ['MEG 2443', 'EEG 053'] plt.ion() # make plot interactive _, ax = plt.subplots(2, 1, figsize=(8, 8)) # create subplots with FieldTripClient(host='localhost', port=1972, tmax=150, wait_max=10) as rt_client: # get measurement info guessed by MNE-Python raw_info = rt_client.get_measurement_info() # select gradiometers picks = mne.pick_types(raw_info, meg='grad', eeg=False, eog=True, stim=True, exclude=bads) # create the real-time epochs object rt_epochs = RtEpochs(rt_client, event_id, tmin, tmax, stim_channel='STI 014', picks=picks, reject=dict(grad=4000e-13, eog=150e-6), decim=1, isi_max=10.0, proj=None) # start the acquisition rt_epochs.start() for ii, ev in enumerate(rt_epochs.iter_evoked()): print("Just got epoch %d" % (ii + 1)) ev.pick_types(meg=True, eog=False) if ii == 0: evoked = ev else: evoked = mne.combine_evoked([evoked, ev], weights='nave') ax[0].cla() ax[1].cla() # clear axis plot_events(rt_epochs.events[-5:], sfreq=ev.info['sfreq'], first_samp=-rt_client.tmin_samp, axes=ax[0]) evoked.plot(axes=ax[1], selectable=False) # plot on second subplot ax[1].set_title('Evoked response for gradiometer channels' '(event_id = %d)' % event_id) plt.pause(0.05) plt.draw() plt.close()
-- Macro facility functions -- -- Copyright (c) 2010-2013 Free Software Foundation, Inc. -- -- This file is part of GNU Zile. -- -- This program is free software; you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 3, or (at your option) -- any later version. -- -- This program is distributed in the hope that it will be useful, but -- WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. cmd_mp = {} cur_mp = {} function add_cmd_to_macro () cur_mp = list.concat (cur_mp, cmd_mp) cmd_mp = {} end function add_key_to_cmd (key) table.insert (cmd_mp, key) end function remove_key_from_cmd () table.remove (cmd_mp) end function cancel_kbd_macro () cmd_mp = {} cur_mp = {} thisflag.defining_macro = false end local function process_keys (keys) local cur = term_buf_len () for i = #keys, 1, -1 do term_ungetkey (keys[i]) end undo_start_sequence () while term_buf_len () > cur do get_and_run_command () end undo_end_sequence () end macro_keys = {} function call_macro () process_keys (macro_keys) return true end
/* * Copyright (C) 2006 The Android Open Source Project * Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.phone; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.provider.Telephony.Intents; import com.android.internal.telephony.Phone; import android.telephony.PhoneNumberUtils; import android.telephony.TelephonyManager; import android.telephony.MSimTelephonyManager; import android.util.Log; import android.view.WindowManager; import java.lang.StringBuilder; /** * Helper class to listen for some magic dialpad character sequences * that are handled specially by the Phone app. * * Note the Contacts app also handles these sequences too, so there's a * separate version of this class under apps/Contacts. * * In fact, the most common use case for these special sequences is typing * them from the regular "Dialer" used for outgoing calls, which is part * of the contacts app; see DialtactsActivity and DialpadFragment. * *This* version of SpecialCharSequenceMgr is used for only a few * relatively obscure places in the UI: * - The "SIM network unlock" PIN entry screen (see * IccNetworkDepersonalizationPanel.java) * - The emergency dialer (see EmergencyDialer.java). * * TODO: there's lots of duplicated code between this class and the * corresponding class under apps/Contacts. Let's figure out a way to * unify these two classes (in the framework? in a common shared library?) */ public class SpecialCharSequenceMgr { private static final String TAG = PhoneApp.LOG_TAG; private static final boolean DBG = true; private static final String MMI_IMEI_DISPLAY = "*#06#"; /** This class is never instantiated. */ private SpecialCharSequenceMgr() { } /** * Check for special strings of digits from an input * string. * @param context input Context for the events we handle. * @param input the dial string to be examined. */ static boolean handleChars(Context context, String input) { return handleChars(context, input, null); } /** * Generally used for the Personal Unblocking Key (PUK) unlocking * case, where we want to be able to maintain a handle to the * calling activity so that we can close it or otherwise display * indication if the PUK code is recognized. * * NOTE: The counterpart to this file in Contacts does * NOT contain the special PUK handling code, since it * does NOT need it. When the device gets into PUK- * locked state, the keyguard comes up and the only way * to unlock the device is through the Emergency dialer, * which is still in the Phone App. * * @param context input Context for the events we handle. * @param input the dial string to be examined. * @param pukInputActivity activity that originated this * PUK call, tracked so that we can close it or otherwise * indicate that special character sequence is * successfully processed. Can be null. * @return true if the input was a special string which has been * handled. */ static boolean handleChars(Context context, String input, Activity pukInputActivity) { //get rid of the separators so that the string gets parsed correctly String dialString = PhoneNumberUtils.stripSeparators(input); if (handleIMEIDisplay(context, dialString) || handlePinEntry(context, dialString, pukInputActivity) || handleAdnEntry(context, dialString) || handleSecretCode(context, dialString)) { return true; } return false; } /** * Variant of handleChars() that looks for the subset of "special * sequences" that are available even if the device is locked. * * (Specifically, these are the sequences that you're allowed to type * in the Emergency Dialer, which is accessible *without* unlocking * the device.) */ static boolean handleCharsForLockedDevice(Context context, String input, Activity pukInputActivity) { // Get rid of the separators so that the string gets parsed correctly String dialString = PhoneNumberUtils.stripSeparators(input); // The only sequences available on a locked device are the "**04" // or "**05" sequences that allow you to enter PIN or PUK-related // codes. (e.g. for the case where you're currently locked out of // your phone, and need to change the PIN! The only way to do // that is via the Emergency Dialer.) if (handlePinEntry(context, dialString, pukInputActivity)) { return true; } return false; } /** * Handles secret codes to launch arbitrary activities in the form of *#*#<code>#*#*. * If a secret code is encountered an Intent is started with the android_secret_code://<code> * URI. * * @param context the context to use * @param input the text to check for a secret code in * @return true if a secret code was encountered */ static private boolean handleSecretCode(Context context, String input) { // Secret codes are in the form *#*#<code>#*#* int len = input.length(); if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) { Intent intent = new Intent(Intents.SECRET_CODE_ACTION, Uri.parse("android_secret_code://" + input.substring(4, len - 4))); context.sendBroadcast(intent); return true; } return false; } static private boolean handleAdnEntry(Context context, String input) { /* ADN entries are of the form "N(N)(N)#" */ // if the phone is keyguard-restricted, then just ignore this // input. We want to make sure that sim card contacts are NOT // exposed unless the phone is unlocked, and this code can be // accessed from the emergency dialer. if (PhoneApp.getInstance().getKeyguardManager().inKeyguardRestrictedInputMode()) { return false; } int len = input.length(); if ((len > 1) && (len < 5) && (input.endsWith("#"))) { try { int index = Integer.parseInt(input.substring(0, len-1)); Intent intent = new Intent(Intent.ACTION_PICK); if (TelephonyManager.getDefault().isMultiSimEnabled()) { intent.setClassName("com.android.phone", "com.android.phone.MSimContacts"); } else { intent.setClassName("com.android.phone", "com.android.phone.SimContacts"); } intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("index", index); PhoneApp.getInstance().startActivity(intent); return true; } catch (NumberFormatException ex) {} } return false; } static private boolean handlePinEntry(Context context, String input, Activity pukInputActivity) { // TODO: The string constants here should be removed in favor // of some call to a static the MmiCode class that determines // if a dialstring is an MMI code. if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { PhoneApp app = PhoneApp.getInstance(); Phone phone = null; boolean isPukRequired = false; if (input.startsWith("**05")) { // Called when user tries to unblock PIN by entering the MMI code // through emergency dialer app. Send the request on the right // sub which is in PUK_REQUIRED state. Use the default subscription // when none of the subscriptions are PUK-Locked. This may be // a change PIN request. int numPhones = TelephonyManager.getDefault().getPhoneCount(); for (int i = 0; i < numPhones; i++) { if (app.isSimPukLocked(i)) { phone = app.getPhone(i); log("Sending PUK on subscription :" + phone.getSubscription()); break; } } if (phone == null) { log("No Subscription is PUK-Locked..Using default phone"); phone = app.phone; } } else { // Change Pin request (**04). Use voice phone. int voiceSub = app.getVoiceSubscription(); phone = app.getPhone(voiceSub); } boolean isMMIHandled = phone.handlePinMmi(input); // if the PUK code is recognized then indicate to the // phone app that an attempt to unPUK the device was // made with this activity. The PUK code may still // fail though, but we won't know until the MMI code // returns a result. if (isMMIHandled && input.startsWith("**05")) { app.setPukEntryActivity(pukInputActivity); } return isMMIHandled; } return false; } static private boolean handleIMEIDisplay(Context context, String input) { if (input.equals(MMI_IMEI_DISPLAY)) { showDeviceIdPanel(context); return true; } return false; } static private void showDeviceIdPanel(Context context) { Log.d(TAG, "showDeviceIdPanel()..."); int labelId; StringBuilder deviceId = null; TelephonyManager tm = TelephonyManager.getDefault(); if (tm.isMultiSimEnabled()) { MSimTelephonyManager mtm = (MSimTelephonyManager)tm; labelId = R.string.imei; int phonecount = mtm.getPhoneCount(); int[] type = new int[phonecount]; String[] ids = new String[phonecount]; boolean multimode = false; for (int i=0; i<phonecount; i++) { type[i] = mtm.getCurrentPhoneType(i); ids[i] = mtm.getDeviceId(i); if (type[i] == TelephonyManager.PHONE_TYPE_CDMA) { // C+G mode, use meid as its title? multimode = true; labelId = R.string.meid; } } // 16 IMEI characters, or 7 MEID characters, maybe plus subscription name deviceId = new StringBuilder(50); for (int i=0; i<phonecount; i++) { if (multimode) { String prefix = (type[i] == TelephonyManager.PHONE_TYPE_GSM) ? "IMEI " : "MEID "; deviceId.append(prefix); } deviceId.append(ids[i] == null ? "" : ids[i]); if (i != mtm.getPhoneCount()-1) { deviceId.append("\n"); } } } else { int type = tm.getCurrentPhoneType(); labelId = (type == TelephonyManager.PHONE_TYPE_GSM) ? R.string.imei : R.string.meid; deviceId = new StringBuilder(); deviceId.append(tm.getDeviceId()); } AlertDialog dialog = new AlertDialog.Builder(context) .setTitle(labelId) .setMessage(deviceId.toString()) .setPositiveButton(android.R.string.ok, null) .setCancelable(true) .show(); } private static void log(String msg) { Log.d(TAG, "[SpecialCharSequenceMgr] " + msg); } }
Today, adventure travelers want custom itineraries filled with more authentic experiences and plenty of soft adventure options. While these experiential opportunities are growing, travelers also want to be able to hit the reset button and reclaim a sense of mental, physical and emotional wellbeing when away from home. Luxury safari tours accomplish both by allowing guests to soak up life experiences while unwinding on a comfortable, relaxing journey. For some travelers, a trip to Africa means checking the box “I have arrived”. They’ve spent their lives gaining wealth and, now, they can afford to enjoy thrilling game drives to watch the Big Five then head back to the lodge spa for a relaxing massage. According to the Adventure Travel Trade Association, South Africa and Tanzania are two of the top five most frequently booked destinations, with other Southern Africa countries gaining more interest. As a luxury safari tour outfitter, our goal is to create programs that help adventurous travelers explore Africa and create enriching life experiences. The YOLO (You Only Live Once) attitude has taken hold and people are realizing that travel gives you a means to stay active, learn about different cultures and work on your bucket list while recharging and discovering more about yourself – things you may never recognize if you don’t leave home. In our ‘Golden Years,’ we will look back at the people we knew, places we saw and happiness we experienced. Regardless of your age, take care of yourself now, satisfy your need to explore and gather precious memories to cherish for the rest of your life. Great Safaris’ Founder and Chief Experiential Officer Dave Herbert was one of the pioneers of developing and promoting tourism in Southern and Eastern Africa. With a combined 80 years of experience in the African tourism industry, Herbert and President Anne Bellamy provide their clients and travel agent partners an unrivaled wealth of knowledge and experience.
Mccarl, Robert, Jim Dowling, and Martha Cooper. Machinist Jim Dowling at lathe . New Jersey Paterson United States, 1994. -08-17. Photograph. https://0-www.loc.gov.oasys.lib.oxy.edu/item/afcwip000802/. McCarl, R., Dowling, J. & Cooper, M. (1994) Machinist Jim Dowling at lathe . New Jersey Paterson United States, 1994. -08-17. [Photograph] Retrieved from the Library of Congress, https://0-www.loc.gov.oasys.lib.oxy.edu/item/afcwip000802/. Mccarl, Robert, Jim Dowling, and Martha Cooper. Machinist Jim Dowling at lathe . -08-17. Photograph. Retrieved from the Library of Congress, <www.loc.gov/item/afcwip000802/>.
-- -- unit-terran-goliath -- DefineAnimations("animations-terran-goliath", { Still = { "frame 119", "wait 125", }, Move = {"unbreakable begin", "move 6", "wait 1", "frame 136", "move 3", "wait 1", "frame 153", "move 3", "wait 1", "frame 0", "move 3", "wait 1", "frame 17", "move 5", "wait 1", "frame 34", "move 5", "wait 1", "frame 51", "move 4", "wait 1", "frame 68", --FIXME: sub-tile movement --[["move 8", "wait 1", "frame 85", "move 6", "wait 1", "frame 102", "move 4", "unbreakable end", "wait 1", "frame 119",]] "move 3", "unbreakable end", "wait 1", "frame 119", }, Attack = { "unbreakable begin", "sound terran-goliath-attack", "attack", "unbreakable end", "wait 1", }, Death = { "unbreakable begin", --[[sound 8]] --[[active overlay 332,0]] "wait 3", "unbreakable end", "wait 1", }, }) DefineUnitType("unit-terran-goliath", { Name = "Goliath", Image = {"file", "terran/units/goliath.png", "size", {76, 76}}, Shadow = {"file", "terran/units/goliath shadow.png", "size", {76, 76}}, Animations = "animations-terran-goliath", Icon = "icon-terran-goliath", Costs = {"time", 60, "minerals", 100, "gas", 50}, Speed = 10, NumDirections = 32, HitPoints = 125, DrawLevel = 40, TileSize = {1, 1}, BoxSize = {31, 31}, SightRange = 4, ComputerReactionRange = 6, PersonReactionRange = 4, Armor = 2, BasicDamage = 6, PiercingDamage = 3, Missile = "missile-none", AnnoyComputerFactor = 55, MaxAttackRange = 1, Priority = 60, Points = 50, Demand = 2, ExplodeWhenKilled = "missile-terran-explosion-small", Type = "land", RightMouseAction = "attack", CanAttack = true, CanTargetLand = true, LandUnit = true, organic = true, SelectableByRectangle = true, Sounds = { "selected", "terran-goliath-selected", "acknowledge", "terran-goliath-acknowledge", "ready", "terran-goliath-ready", "help", "terran-units-attacked", "dead", "terran-goliath-death"} } )
Those who seek to gain muscle mass will need to pay close attention to their diets for optimal progress. Unfortunately, there is much conflicting advice regarding diets for bodybuilding, and sometimes it is all too easy to over analyse everything and become frustrated. Here are ten back to basics bodybuilding diet tips. 1. Consume enough calories to grow. Food intake should be great enough to support the growth of the body. A calorie surplus is usually required to gain body mass, with sufficient levels of protein to encourage the growth of muscle tissue. If you have trouble consuming enough calories in the form of food intake, try consuming a quality weight gainer or meal replacement drink. Such a quality supplement would contain several hundred calories, a protein blend for sustained absorption, and a quality complex carbohydrate source. 2. Stay hydrated by drinking plenty of fluids. Suboptimal hydration levels can significantly impact performance levels in the gym, minimising the potential for progress. Being hydrates can also improve immune function and nutrition absorption. Remember to consume fluids during exercise to make up for the sweat lost, and also consume more fluids on a warm day. 3. Eat a varied diet. It would be unwise to stick religiously to a meal plan which includes eating the same food stuffs at set times throughout the day. Not only would such a diet plan become extremely boring after a while, it would also limit exposure to nutrients which may be lacking from the consumed meals. Ensuring a wide food selection will result in a wide spectrum of nutrients within the diet, which is optimal for health and well being. 4. Do not exclude all fat sources. Some mistake dietary fat consumption to the gaining of body fat. It is important to ensure dietary fats are still consumed, with some fatty acids vital for bodily functions, such as hormonal function. Grounded linseeds, oily fish, nuts, olive oils etc are good sources to include within a varied bodybuilding diet plan. 5. Supplement with supplements. Supplements are not required. It is easily possible to have a diet compose completely of real wholesome food choices which is optimal for muscle growth. Supplements are not magic, and are simply a choice for those who want greater convenience, or something extra which their diet cannot offer. 6. Plan your meals in advanced. Being prepared will ensure you never miss a meal, and will avoid snacking on unhealthy options whilst away from the home. Prepare meals before going out, or take a protein bar or meal replacement drink. Have a shopping list prior to going to shopping so everything you need for the week is bought to ensure your varied meal plan can be stuck to. 7. Consume fruit and veg. Try to ensure an item of fruit, a fruit based drink (e.g. freshly squeezed orange juice), or a serving of salad or veg is served with each meal. 8. Plan pre and post nutrition wisely. A pre workout nutrition plan should involve suitable carbohydrates to fuel a heavy and intense workout session. It is important to ensure too much is not consumed prior to the workout, which could result in bloating and underperformance. Post workout should be a time in which protein is consumed to encourage muscle growth and repair. Carbohydrates, commonly quick acting sources such as maltodextrin, should also be consumed to replenish energy stores. 9. Don’t worry about having a treat every once in a while. Whilst cheat foods should not be consumed frequently, it would be okay to have a treat every once in a while. Sticking to a diet day-in-day-out can be hard work, so in the big picture a treat can offer some form of sanity! 10. Educate yourself. Continue to read quality bodybuilding web sites and resources to gain further knowledge about bodybuilding diets and training. Bodybuilding and fitness forums can be a great place to met like minded people to debate and discuss issues regarding bodybuilding. What Is Visceral Fat? And Why Should We Worry About It?
<?php Yii::import('system.db.CDbConnection'); Yii::import('system.db.ar.CActiveRecord'); require_once(dirname(__FILE__) . '/../data/models.php'); class CActiveRecordTest extends CTestCase { protected $backupStaticAttributes = true; private $_connection; protected function setUp() { if (!extension_loaded('pdo') || !extension_loaded('pdo_sqlite')) { $this->markTestSkipped('PDO and SQLite extensions are required.'); } $this->_connection = new CDbConnection('sqlite::memory:'); $this->_connection->active = true; $this->_connection->pdoInstance->exec(file_get_contents(dirname(__FILE__) . '/../data/sqlite.sql')); CActiveRecord::$db = $this->_connection; } protected function tearDown() { $this->_connection->active = false; } public function testModel() { $model = Post::model(); $this->assertTrue($model instanceof Post); $this->assertTrue($model->dbConnection === $this->_connection); $this->assertTrue($model->dbConnection->active); $this->assertEquals('posts', $model->tableName()); $this->assertEquals('id', $model->tableSchema->primaryKey); $this->assertTrue($model->tableSchema->sequenceName === ''); $this->assertEquals(array(), $model->attributeLabels()); $this->assertEquals('Id', $model->getAttributeLabel('id')); $this->assertEquals('Author Id', $model->getAttributeLabel('author_id')); $this->assertTrue($model->getActiveRelation('author') instanceof CBelongsToRelation); $this->assertTrue($model->tableSchema instanceof CDbTableSchema); $this->assertTrue($model->commandBuilder instanceof CDbCommandBuilder); $this->assertTrue($model->hasAttribute('id')); $this->assertFalse($model->hasAttribute('comments')); $this->assertFalse($model->hasAttribute('foo')); $this->assertEquals( array('id' => null, 'title' => null, 'create_time' => null, 'author_id' => null, 'content' => null), $model->attributes ); $post = new Post; $this->assertNull($post->id); $this->assertNull($post->title); $post->setAttributes(array('id' => 3, 'title' => 'test title')); $this->assertNull($post->id); $this->assertEquals('test title', $post->title); } public function testFind() { // test find() with various parameters $post = Post::model()->find(); $this->assertTrue($post instanceof Post); $this->assertEquals(1, $post->id); $post = Post::model()->find('id=5'); $this->assertTrue($post instanceof Post); $this->assertEquals(5, $post->id); $post = Post::model()->find('id=:id', array(':id' => 2)); $this->assertTrue($post instanceof Post); $this->assertEquals(2, $post->id); $post = Post::model()->find(array('condition' => 'id=:id', 'params' => array(':id' => 3))); $this->assertTrue($post instanceof Post); $this->assertEquals(3, $post->id); // test find() without result $post = Post::model()->find('id=6'); $this->assertNull($post); // test findAll() with various parameters $posts = Post::model()->findAll(); $this->assertEquals(5, count($posts)); $this->assertTrue($posts[3] instanceof Post); $this->assertEquals(4, $posts[3]->id); $posts = Post::model()->findAll(new CDbCriteria(array('limit' => 3, 'offset' => 1))); $this->assertEquals(3, count($posts)); $this->assertTrue($posts[2] instanceof Post); $this->assertEquals(4, $posts[2]->id); // test findAll() without result $posts = Post::model()->findAll('id=6'); $this->assertTrue($posts === array()); // test findByPk $post = Post::model()->findByPk(2); $this->assertEquals(2, $post->id); $post = Post::model()->findByPk(array(3, 2)); $this->assertEquals(2, $post->id); $post = Post::model()->findByPk(array()); $this->assertNull($post); $post = Post::model()->findByPk(null); $this->assertNull($post); $post = Post::model()->findByPk(6); $this->assertNull($post); // test findAllByPk $posts = Post::model()->findAllByPk(2); $this->assertEquals(1, count($posts)); $this->assertEquals(2, $posts[0]->id); $posts = Post::model()->findAllByPk(array(4, 3, 2), 'id<4'); $this->assertEquals(2, count($posts)); $this->assertEquals(2, $posts[0]->id); $this->assertEquals(3, $posts[1]->id); $posts = Post::model()->findAllByPk(array()); $this->assertTrue($posts === array()); // test findByAttributes $post = Post::model()->findByAttributes(array('author_id' => 2), array('order' => 'id DESC')); $this->assertEquals(4, $post->id); // test findAllByAttributes $posts = Post::model()->findAllByAttributes(array('author_id' => 2)); $this->assertEquals(3, count($posts)); // test findBySql $post = Post::model()->findBySql('select * from posts where id=:id', array(':id' => 2)); $this->assertEquals(2, $post->id); // test findAllBySql $posts = Post::model()->findAllBySql('select * from posts where id>:id', array(':id' => 2)); $this->assertEquals(3, count($posts)); // test count $this->assertEquals(5, Post::model()->count()); $this->assertEquals(3, Post::model()->count(array('condition' => 'id>2'))); // test countBySql $this->assertEquals(1, Post::model()->countBySql('select id from posts limit 1')); // test exists $this->assertTrue(Post::model()->exists('id=:id', array(':id' => 1))); $this->assertFalse(Post::model()->exists('id=:id', array(':id' => 6))); } public function testInsert() { $post = new Post; $this->assertEquals( array('id' => null, 'title' => null, 'create_time' => null, 'author_id' => null, 'content' => null), $post->attributes ); $post->title = 'test post 1'; $post->create_time = time(); $post->author_id = 1; $post->content = 'test post content 1'; $this->assertTrue($post->isNewRecord); $this->assertNull($post->id); $this->assertTrue($post->save()); $this->assertEquals( array( 'id' => 6, 'title' => 'test post 1', 'create_time' => $post->create_time, 'author_id' => 1, 'content' => 'test post content 1' ), $post->attributes ); $this->assertFalse($post->isNewRecord); $this->assertEquals($post->attributes, Post::model()->findByPk($post->id)->attributes); } public function testUpdate() { // test save $post = Post::model()->findByPk(1); $this->assertFalse($post->isNewRecord); $this->assertEquals('post 1', $post->title); $post->title = 'test post 1'; $this->assertTrue($post->save()); $this->assertFalse($post->isNewRecord); $this->assertEquals('test post 1', $post->title); $this->assertEquals('test post 1', Post::model()->findByPk(1)->title); // test updateByPk $this->assertEquals(2, Post::model()->updateByPk(array(4, 5), array('title' => 'test post'))); $this->assertEquals('post 2', Post::model()->findByPk(2)->title); $this->assertEquals('test post', Post::model()->findByPk(4)->title); $this->assertEquals('test post', Post::model()->findByPk(5)->title); // test updateAll $this->assertEquals(1, Post::model()->updateAll(array('title' => 'test post'), 'id=1')); $this->assertEquals('test post', Post::model()->findByPk(1)->title); // test updateCounters $this->assertEquals(2, Post::model()->findByPk(2)->author_id); $this->assertEquals(2, Post::model()->findByPk(3)->author_id); $this->assertEquals(2, Post::model()->findByPk(4)->author_id); $this->assertEquals(3, Post::model()->updateCounters(array('author_id' => -1), 'id>2')); $this->assertEquals(2, Post::model()->findByPk(2)->author_id); $this->assertEquals(1, Post::model()->findByPk(3)->author_id); } public function testSaveCounters() { $post = Post::model()->findByPk(2); $this->assertEquals(2, $post->author_id); $result = $post->saveCounters(array('author_id' => -1)); $this->assertTrue($result); $this->assertEquals(1, $post->author_id); $this->assertEquals(1, Post::model()->findByPk(2)->author_id); $this->assertEquals(2, Post::model()->findByPk(3)->author_id); } public function testDelete() { $post = Post::model()->findByPk(1); $this->assertTrue($post->delete()); $this->assertNull(Post::model()->findByPk(1)); $this->assertTrue(Post::model()->findByPk(2) instanceof Post); $this->assertTrue(Post::model()->findByPk(3) instanceof Post); $this->assertEquals(2, Post::model()->deleteByPk(array(2, 3))); $this->assertNull(Post::model()->findByPk(2)); $this->assertNull(Post::model()->findByPk(3)); $this->assertTrue(Post::model()->findByPk(5) instanceof Post); $this->assertEquals(1, Post::model()->deleteAll('id=5')); $this->assertNull(Post::model()->findByPk(5)); } public function testRefresh() { $post = Post::model()->findByPk(1); $post2 = Post::model()->findByPk(1); $post2->title = 'new post'; $post2->save(); $this->assertEquals('post 1', $post->title); $this->assertTrue($post->refresh()); $this->assertEquals('new post', $post->title); $post = new Post(); $this->assertFalse($post->refresh()); $post->id = 1; $this->assertTrue($post->refresh()); $this->assertEquals('new post', $post->title); } public function testEquals() { $post = Post::model()->findByPk(1); $post2 = Post::model()->findByPk(1); $post3 = Post::model()->findByPk(3); $this->assertEquals(1, $post->primaryKey); $this->assertTrue($post->equals($post2)); $this->assertTrue($post2->equals($post)); $this->assertFalse($post->equals($post3)); $this->assertFalse($post3->equals($post)); } public function testValidation() { $user = new User; $user->password = 'passtest'; $this->assertFalse($user->hasErrors()); $this->assertEquals(array(), $user->errors); $this->assertEquals(array(), $user->getErrors('username')); $this->assertFalse($user->save()); $this->assertNull($user->id); $this->assertTrue($user->isNewRecord); $this->assertTrue($user->hasErrors()); $this->assertTrue($user->hasErrors('username')); $this->assertTrue($user->hasErrors('email')); $this->assertFalse($user->hasErrors('password')); $this->assertEquals(1, count($user->getErrors('username'))); $this->assertEquals(1, count($user->getErrors('email'))); $this->assertEquals(2, count($user->errors)); $user->clearErrors(); $this->assertFalse($user->hasErrors()); $this->assertEquals(array(), $user->errors); } public function testCompositeKey() { $order = new Order; $this->assertEquals(array('key1', 'key2'), $order->tableSchema->primaryKey); $order = Order::model()->findByPk(array('key1' => 2, 'key2' => 1)); $this->assertEquals('order 21', $order->name); $orders = Order::model()->findAllByPk(array(array('key1' => 2, 'key2' => 1), array('key1' => 1, 'key2' => 3))); $this->assertEquals('order 13', $orders[0]->name); $this->assertEquals('order 21', $orders[1]->name); } public function testDefault() { $type = new ComplexType; $this->assertEquals(1, $type->int_col2); $this->assertEquals('something', $type->char_col2); $this->assertEquals(1.23, $type->float_col2); $this->assertEquals(33.22, $type->numeric_col); $this->assertEquals(123, $type->time); $this->assertNull($type->bool_col); $this->assertTrue($type->bool_col2); } public function testPublicAttribute() { $post = new PostExt; $this->assertEquals( array( 'id' => null, 'title' => 'default title', 'create_time' => null, 'author_id' => null, 'content' => null ), $post->attributes ); $post = Post::model()->findByPk(1); $this->assertEquals( array( 'id' => 1, 'title' => 'post 1', 'create_time' => 100000, 'author_id' => 1, 'content' => 'content 1' ), $post->attributes ); $post = new PostExt; $post->title = 'test post'; $post->create_time = 1000000; $post->author_id = 1; $post->content = 'test'; $post->save(); $this->assertEquals( array( 'id' => 6, 'title' => 'test post', 'create_time' => 1000000, 'author_id' => 1, 'content' => 'test' ), $post->attributes ); } public function testLazyRelation() { // test belongsTo $post = Post::model()->findByPk(2); $this->assertTrue($post->author instanceof User); $this->assertEquals( array( 'id' => 2, 'username' => 'user2', 'password' => 'pass2', 'email' => 'email2' ), $post->author->attributes ); // test hasOne $post = Post::model()->findByPk(2); $this->assertTrue($post->firstComment instanceof Comment); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->firstComment->attributes ); $post = Post::model()->findByPk(4); $this->assertNull($post->firstComment); // test hasMany $post = Post::model()->findByPk(2); $this->assertEquals(2, count($post->comments)); $this->assertEquals( array( 'id' => 5, 'content' => 'comment 5', 'post_id' => 2, 'author_id' => 2 ), $post->comments[0]->attributes ); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->comments[1]->attributes ); $post = Post::model()->findByPk(4); $this->assertEquals(array(), $post->comments); // test manyMany $post = Post::model()->findByPk(2); $this->assertEquals(2, count($post->categories)); $this->assertEquals( array( 'id' => 4, 'name' => 'cat 4', 'parent_id' => 1 ), $post->categories[0]->attributes ); $this->assertEquals( array( 'id' => 1, 'name' => 'cat 1', 'parent_id' => null ), $post->categories[1]->attributes ); $post = Post::model()->findByPk(4); $this->assertEquals(array(), $post->categories); // test self join $category = Category::model()->findByPk(5); $this->assertEquals(array(), $category->posts); $this->assertEquals(2, count($category->children)); $this->assertEquals( array( 'id' => 6, 'name' => 'cat 6', 'parent_id' => 5 ), $category->children[0]->attributes ); $this->assertEquals( array( 'id' => 7, 'name' => 'cat 7', 'parent_id' => 5 ), $category->children[1]->attributes ); $this->assertTrue($category->parent instanceof Category); $this->assertEquals( array( 'id' => 1, 'name' => 'cat 1', 'parent_id' => null ), $category->parent->attributes ); $category = Category::model()->findByPk(2); $this->assertEquals(1, count($category->posts)); $this->assertEquals(array(), $category->children); $this->assertNull($category->parent); // test composite key $order = Order::model()->findByPk(array('key1' => 1, 'key2' => 2)); $this->assertEquals(2, count($order->items)); $order = Order::model()->findByPk(array('key1' => 2, 'key2' => 1)); $this->assertEquals(0, count($order->items)); $item = Item::model()->findByPk(4); $this->assertTrue($item->order instanceof Order); $this->assertEquals( array( 'key1' => 2, 'key2' => 2, 'name' => 'order 22' ), $item->order->attributes ); } public function testEagerRelation2() { $post = Post::model()->with('author', 'firstComment', 'comments', 'categories')->findByPk(2); } private function checkEagerLoadedModel($post) { $this->assertEquals( array( 'id' => 2, 'username' => 'user2', 'password' => 'pass2', 'email' => 'email2' ), $post->author->attributes ); $this->assertTrue($post->firstComment instanceof Comment); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->firstComment->attributes ); $this->assertEquals(2, count($post->comments)); $this->assertEquals( array( 'id' => 5, 'content' => 'comment 5', 'post_id' => 2, 'author_id' => 2 ), $post->comments[0]->attributes ); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->comments[1]->attributes ); $this->assertEquals(2, count($post->categories)); $this->assertEquals( array( 'id' => 4, 'name' => 'cat 4', 'parent_id' => 1 ), $post->categories[0]->attributes ); $this->assertEquals( array( 'id' => 1, 'name' => 'cat 1', 'parent_id' => null ), $post->categories[1]->attributes ); } public function testEagerRelation() { $post = Post::model()->with('author', 'firstComment', 'comments', 'categories')->findByPk(2); $this->checkEagerLoadedModel($post); $post = Post::model()->findByPk( 2, array( 'with' => array('author', 'firstComment', 'comments', 'categories'), ) ); $this->checkEagerLoadedModel($post); $post = Post::model()->with('author', 'firstComment', 'comments', 'categories')->findByPk(4); $this->assertEquals( array( 'id' => 2, 'username' => 'user2', 'password' => 'pass2', 'email' => 'email2' ), $post->author->attributes ); $this->assertNull($post->firstComment); $this->assertEquals(array(), $post->comments); $this->assertEquals(array(), $post->categories); } public function testLazyRecursiveRelation() { $post = PostExt::model()->findByPk(2); $this->assertEquals(2, count($post->comments)); $this->assertTrue($post->comments[0]->post instanceof Post); $this->assertTrue($post->comments[1]->post instanceof Post); $this->assertTrue($post->comments[0]->author instanceof User); $this->assertTrue($post->comments[1]->author instanceof User); $this->assertEquals(3, count($post->comments[0]->author->posts)); $this->assertEquals(3, count($post->comments[1]->author->posts)); $this->assertTrue($post->comments[0]->author->posts[1]->author instanceof User); // test self join $category = Category::model()->findByPk(1); $this->assertEquals(2, count($category->nodes)); $this->assertTrue($category->nodes[0]->parent instanceof Category); $this->assertTrue($category->nodes[1]->parent instanceof Category); $this->assertEquals(0, count($category->nodes[0]->children)); $this->assertEquals(2, count($category->nodes[1]->children)); } public function testEagerRecursiveRelation() { //$post=Post::model()->with(array('comments'=>'author','categories'))->findByPk(2); $post = Post::model()->with('comments.author', 'categories')->findByPk(2); $this->assertEquals(2, count($post->comments)); $this->assertEquals(2, count($post->categories)); $posts = PostExt::model()->with('comments')->findAll(); $this->assertEquals(5, count($posts)); } public function testRelationWithCondition() { $posts = Post::model()->with('comments')->findAllByPk(array(2, 3, 4), array('order' => 't.id')); $this->assertEquals(3, count($posts)); $this->assertEquals(2, count($posts[0]->comments)); $this->assertEquals(4, count($posts[1]->comments)); $this->assertEquals(0, count($posts[2]->comments)); $post = Post::model()->with('comments')->findByAttributes(array('id' => 2)); $this->assertTrue($post instanceof Post); $this->assertEquals(2, count($post->comments)); $posts = Post::model()->with('comments')->findAllByAttributes(array('id' => 2)); $this->assertEquals(1, count($posts)); $post = Post::model()->with('comments')->findBySql('select * from posts where id=:id', array(':id' => 2)); $this->assertTrue($post instanceof Post); $posts = Post::model()->with('comments')->findAllBySql( 'select * from posts where id=:id1 OR id=:id2', array(':id1' => 2, ':id2' => 3) ); $this->assertEquals(2, count($posts)); $post = Post::model()->with('comments', 'author')->find('t.id=:id', array(':id' => 2)); $this->assertTrue($post instanceof Post); $posts = Post::model()->with('comments', 'author')->findAll( array( 'select' => 'title', 'condition' => 't.id=:id', 'limit' => 1, 'offset' => 0, 'order' => 't.title', 'group' => 't.id', 'params' => array(':id' => 2) ) ); $this->assertTrue($posts[0] instanceof Post); $posts = Post::model()->with('comments', 'author')->findAll( array( 'select' => 'title', 'condition' => 't.id=:id', 'limit' => 1, 'offset' => 2, 'order' => 't.title', 'params' => array(':id' => 2) ) ); $this->assertTrue($posts === array()); } public function testRelationWithColumnAlias() { $users = User::model()->with('posts')->findAll( array( 'select' => 'id, username AS username2', 'order' => 'username2', ) ); $this->assertEquals(4, count($users)); $this->assertEquals($users[1]->username, null); $this->assertEquals($users[1]->username2, 'user2'); } public function testRelationalWithoutFK() { $users = UserNoFk::model()->with('posts')->findAll(); $this->assertEquals(4, count($users)); $this->assertEquals(3, count($users[1]->posts)); $posts = PostNoFk::model()->with('author')->findAll(); $this->assertEquals(5, count($posts)); $this->assertTrue($posts[2]->author instanceof UserNoFk); } public function testRelationWithNewRecord() { $user = new User; $posts = $user->posts; $this->assertTrue(is_array($posts) && empty($posts)); $post = new Post; $author = $post->author; $this->assertNull($author); } public function testRelationWithDynamicCondition() { $user = User::model()->with('posts')->findByPk(2); $this->assertEquals($user->posts[0]->id, 2); $this->assertEquals($user->posts[1]->id, 3); $this->assertEquals($user->posts[2]->id, 4); $user = User::model()->with(array('posts' => array('order' => 'posts.id DESC')))->findByPk(2); $this->assertEquals($user->posts[0]->id, 4); $this->assertEquals($user->posts[1]->id, 3); $this->assertEquals($user->posts[2]->id, 2); } public function testEagerTogetherRelation() { $post = Post::model()->with('author', 'firstComment', 'comments', 'categories')->findByPk(2); $comments = $post->comments; $this->assertEquals( array( 'id' => 2, 'username' => 'user2', 'password' => 'pass2', 'email' => 'email2' ), $post->author->attributes ); $this->assertTrue($post->firstComment instanceof Comment); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->firstComment->attributes ); $this->assertEquals(2, count($post->comments)); $this->assertEquals( array( 'id' => 5, 'content' => 'comment 5', 'post_id' => 2, 'author_id' => 2 ), $post->comments[0]->attributes ); $this->assertEquals( array( 'id' => 4, 'content' => 'comment 4', 'post_id' => 2, 'author_id' => 2 ), $post->comments[1]->attributes ); $this->assertEquals(2, count($post->categories)); $this->assertEquals( array( 'id' => 4, 'name' => 'cat 4', 'parent_id' => 1 ), $post->categories[0]->attributes ); $this->assertEquals( array( 'id' => 1, 'name' => 'cat 1', 'parent_id' => null ), $post->categories[1]->attributes ); $post = Post::model()->with('author', 'firstComment', 'comments', 'categories')->findByPk(4); $this->assertEquals( array( 'id' => 2, 'username' => 'user2', 'password' => 'pass2', 'email' => 'email2' ), $post->author->attributes ); $this->assertNull($post->firstComment); $this->assertEquals(array(), $post->comments); $this->assertEquals(array(), $post->categories); } public function testRelationalCount() { $count = Post::model()->with('author', 'firstComment', 'comments', 'categories')->count(); $this->assertEquals(5, $count); $count = Post::model()->count(array('with' => array('author', 'firstComment', 'comments', 'categories'))); $this->assertEquals(5, $count); $count = Post::model()->with('author', 'firstComment', 'comments', 'categories')->count('t.id=4'); $this->assertEquals(1, $count); $count = Post::model()->with('author', 'firstComment', 'comments', 'categories')->count('t.id=14'); $this->assertEquals(0, $count); } public function testRelationalStat() { $users = User::model()->with('postCount')->findAll(); $this->assertEquals(4, count($users)); $this->assertEquals(1, $users[0]->postCount); $this->assertEquals(3, $users[1]->postCount); $this->assertEquals(1, $users[2]->postCount); $users = User::model()->findAll(); $this->assertEquals(4, count($users)); $this->assertEquals(1, $users[0]->postCount); $this->assertEquals(3, $users[1]->postCount); $this->assertEquals(1, $users[2]->postCount); $orders = Order::model()->with('itemCount')->findAll(); $this->assertEquals(4, count($orders)); $this->assertEquals(2, $orders[0]->itemCount); $this->assertEquals(1, $orders[1]->itemCount); $this->assertEquals(0, $orders[2]->itemCount); $this->assertEquals(2, $orders[3]->itemCount); $orders = Order::model()->findAll(); $this->assertEquals(4, count($orders)); $this->assertEquals(2, $orders[0]->itemCount); $this->assertEquals(1, $orders[1]->itemCount); $this->assertEquals(0, $orders[2]->itemCount); $this->assertEquals(2, $orders[3]->itemCount); $categories = Category::model()->with('postCount')->findAll(); $this->assertEquals(7, count($categories)); $this->assertEquals(3, $categories[0]->postCount); $this->assertEquals(1, $categories[1]->postCount); $this->assertEquals(1, $categories[2]->postCount); $this->assertEquals(1, $categories[3]->postCount); $this->assertEquals(0, $categories[4]->postCount); $this->assertEquals(0, $categories[5]->postCount); $this->assertEquals(0, $categories[6]->postCount); $categories = Category::model()->findAll(); $this->assertEquals(7, count($categories)); $this->assertEquals(3, $categories[0]->postCount); $this->assertEquals(1, $categories[1]->postCount); $this->assertEquals(1, $categories[2]->postCount); $this->assertEquals(1, $categories[3]->postCount); $this->assertEquals(0, $categories[4]->postCount); $this->assertEquals(0, $categories[5]->postCount); $this->assertEquals(0, $categories[6]->postCount); $users = User::model()->with('postCount', 'posts.commentCount')->findAll(); $this->assertEquals(4, count($users)); } public function testLazyLoadingWithConditions() { $user = User::model()->findByPk(2); $posts = $user->posts; $this->assertEquals(3, count($posts)); $posts = $user->posts(array('condition' => 'posts.id>=3', 'alias' => 'posts')); $this->assertEquals(2, count($posts)); } public function testDuplicateLazyLoadingBug() { $user = User::model()->with( array( 'posts' => array('on' => 'posts.id=-1') ) )->findByPk(1); // with the bug, an eager loading for 'posts' would be trigger in the following // and result with non-empty posts $this->assertTrue($user->posts === array()); } public function testTogether() { // test without together $users = UserNoTogether::model()->with('posts.comments')->findAll(); $postCount = 0; $commentCount = 0; foreach ($users as $user) { $postCount += count($user->posts); foreach ($posts = $user->posts as $post) { $commentCount += count($post->comments); } } $this->assertEquals(4, count($users)); $this->assertEquals(5, $postCount); $this->assertEquals(10, $commentCount); // test with together $users = UserNoTogether::model()->with('posts.comments')->together()->findAll(); $postCount = 0; $commentCount = 0; foreach ($users as $user) { $postCount += count($user->posts); foreach ($posts = $user->posts as $post) { $commentCount += count($post->comments); } } $this->assertEquals(3, count($users)); $this->assertEquals(4, $postCount); $this->assertEquals(10, $commentCount); } public function testTogetherWithOption() { // test with together off option $users = User::model()->with( array( 'posts' => array( 'with' => array( 'comments' => array( 'joinType' => 'INNER JOIN', 'together' => false, ), ), 'joinType' => 'INNER JOIN', 'together' => false, ), ) )->findAll(); $postCount = 0; $commentCount = 0; foreach ($users as $user) { $postCount += count($user->posts); foreach ($posts = $user->posts as $post) { $commentCount += count($post->comments); } } $this->assertEquals(4, count($users)); $this->assertEquals(5, $postCount); $this->assertEquals(10, $commentCount); // test with together on option $users = User::model()->with( array( 'posts' => array( 'with' => array( 'comments' => array( 'joinType' => 'INNER JOIN', 'together' => true, ), ), 'joinType' => 'INNER JOIN', 'together' => true, ), ) )->findAll(); $postCount = 0; $commentCount = 0; foreach ($users as $user) { $postCount += count($user->posts); foreach ($posts = $user->posts as $post) { $commentCount += count($post->comments); } } $this->assertEquals(3, count($users)); $this->assertEquals(4, $postCount); $this->assertEquals(10, $commentCount); } public function testCountByAttributes() { $n = Post::model()->countByAttributes(array('author_id' => 2)); $this->assertEquals(3, $n); } public function testScopes() { $models1 = Post::model()->post23()->findAll(); $models2 = Post::model()->findAll(array('scopes' => 'post23')); foreach (array($models1, $models2) as $models) { $this->assertEquals(2, count($models)); $this->assertEquals(2, $models[0]->id); $this->assertEquals(3, $models[1]->id); } $model1 = Post::model()->post23()->find(); $model2 = Post::model()->find(array('scopes' => 'post23')); foreach (array($model1, $model2) as $model) { $this->assertEquals(2, $model->id); } $models1 = Post::model()->post23()->post3()->findAll(); $models2 = Post::model()->findAll(array('scopes' => array('post23', 'post3'))); foreach (array($models1, $models2) as $models) { $this->assertEquals(1, count($models)); $this->assertEquals(3, $models[0]->id); } $models1 = Post::model()->post23()->findAll('id=3'); $models2 = Post::model()->post23()->findAll(array('condition' => 'id=3', 'scopes' => 'post23')); foreach (array($models1, $models2) as $models) { $this->assertEquals(1, count($models)); $this->assertEquals(3, $models[0]->id); } $models1 = Post::model()->recent()->with('author')->findAll(); $models2 = Post::model()->with('author')->findAll(array('scopes' => 'recent')); $models3 = Post::model()->with('author')->findAll(array('scopes' => array('recent'))); $models4 = Post::model()->with('author')->findAll(array('scopes' => array(array('recent' => array())))); foreach (array($models1, $models2, $models3, $models4) as $models) { $this->assertEquals(5, count($models)); $this->assertEquals(5, $models[0]->id); $this->assertEquals(4, $models[1]->id); } $models1 = Post::model()->recent(3)->findAll(); $models2 = Post::model()->findAll(array('scopes' => array('recent' => 3))); $models3 = Post::model()->findAll(array('scopes' => array(array('recent' => 3)))); foreach (array($models1, $models2, $models3) as $models) { $this->assertEquals(3, count($models)); $this->assertEquals(5, $models[0]->id); $this->assertEquals(4, $models[1]->id); } //default scope $models = PostSpecial::model()->findAll(); $this->assertEquals(2, count($models)); $this->assertEquals(2, $models[0]->id); $this->assertEquals(3, $models[1]->id); //default scope + scope $models1 = PostSpecial::model()->desc()->findAll(); $models2 = PostSpecial::model()->findAll(array('scopes' => 'desc')); foreach (array($models1, $models2) as $models) { $this->assertEquals(2, count($models)); $this->assertEquals(3, $models[0]->id); $this->assertEquals(2, $models[1]->id); } //behavior scope $models = Post::model()->findAll(array('scopes' => 'behaviorPost23')); $this->assertEquals(2, count($models)); $this->assertEquals(2, $models[0]->id); $this->assertEquals(3, $models[1]->id); //behavior parametrized scope $models = Post::model()->findAll(array('scopes' => array('behaviorRecent' => 3))); $this->assertEquals(3, count($models)); $this->assertEquals(5, $models[0]->id); $this->assertEquals(4, $models[1]->id); } public function testScopeWithRelations() { $user1 = User::model()->with('posts:post23')->findByPk(2); $user2 = User::model()->with(array('posts' => array('scopes' => 'post23')))->findByPk(2); $user3 = User::model()->findByPk(2, array('with' => array('posts' => array('scopes' => 'post23')))); //ensure alais overloading work correctly $user4 = User::model()->with(array('posts:post23A' => array('alias' => 'alias')))->findByPk(2); $user5 = User::model()->with(array('posts' => array('scopes' => 'post23A', 'alias' => 'alias')))->findByPk(2); $user6 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => 'post23A', 'alias' => 'alias'))) ); foreach (array($user1, $user2, $user3, $user4, $user5, $user6) as $user) { $this->assertEquals(2, count($user->posts)); $this->assertEquals(2, $user->posts[0]->id); $this->assertEquals(3, $user->posts[1]->id); } $user1 = User::model()->with(array('posts' => array('scopes' => array('p' => 4))))->findByPk(2); $user2 = User::model()->with(array('posts' => array('scopes' => array('p' => array(4)))))->findByPk(2); $user3 = User::model()->with(array('posts' => array('scopes' => array(array('p' => 4)))))->findByPk(2); $user4 = User::model()->with(array('posts' => array('scopes' => array(array('p' => array(4))))))->findByPk(2); $user5 = User::model()->findByPk(2, array('with' => array('posts' => array('scopes' => array('p' => 4))))); $user6 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array('p' => array(4))))) ); $user7 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array(array('p' => 4))))) ); $user8 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array(array('p' => array(4)))))) ); foreach (array($user1, $user2, $user3, $user4, $user5, $user6, $user7, $user8) as $user) { $this->assertEquals(1, count($user->posts)); $this->assertEquals(4, $user->posts[0]->id); } $user = UserSpecial::model()->findByPk(2); $posts = $user->posts; $this->assertEquals(2, count($posts)); $this->assertEquals(2, $posts[0]->id); $this->assertEquals(3, $posts[1]->id); $user = UserSpecial::model()->findByPk(2); $posts = $user->posts(array('params' => array(':id1' => 4), 'order' => 'posts.id DESC')); $this->assertEquals(2, count($posts)); $this->assertEquals(4, $posts[0]->id); $this->assertEquals(3, $posts[1]->id); $user = User::model()->with('posts:post23')->findByPk(2); $posts = $user->posts(array('scopes' => 'post23')); $this->assertEquals(2, count($posts)); $this->assertEquals(2, $posts[0]->id); $this->assertEquals(3, $posts[1]->id); //related model behavior scope $user1 = User::model()->with('posts:behaviorPost23')->findByPk(2); $user2 = User::model()->with(array('posts' => array('scopes' => 'behaviorPost23')))->findByPk(2); $user3 = User::model()->findByPk(2, array('with' => array('posts' => array('scopes' => 'behaviorPost23')))); foreach (array($user1, $user2, $user3) as $user) { $this->assertEquals(2, count($user->posts)); $this->assertEquals(2, $user->posts[0]->id); $this->assertEquals(3, $user->posts[1]->id); } //related model with behavior parametrized scope $user1 = User::model()->with(array('posts' => array('scopes' => array('behaviorP' => 4))))->findByPk(2); $user2 = User::model()->with(array('posts' => array('scopes' => array('behaviorP' => array(4)))))->findByPk(2); $user3 = User::model()->with(array('posts' => array('scopes' => array(array('behaviorP' => 4)))))->findByPk(2); $user4 = User::model()->with( array('posts' => array('scopes' => array(array('behaviorP' => array(4))))) )->findByPk(2); $user5 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array('behaviorP' => 4)))) ); $user6 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array('behaviorP' => array(4))))) ); $user7 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array(array('behaviorP' => 4))))) ); $user8 = User::model()->findByPk( 2, array('with' => array('posts' => array('scopes' => array(array('behaviorP' => array(4)))))) ); foreach (array($user1, $user2, $user3, $user4, $user5, $user6, $user7, $user8) as $user) { $this->assertEquals(1, count($user->posts)); $this->assertEquals(4, $user->posts[0]->id); } //related model with 'scopes' as relation option $user = User::model()->with('postsOrderDescFormat1')->findByPk(2); $this->assertEquals(3, count($user->postsOrderDescFormat1)); $this->assertEquals( array(4, 3, 2), array( $user->postsOrderDescFormat1[0]->id, $user->postsOrderDescFormat1[1]->id, $user->postsOrderDescFormat1[2]->id, ) ); $user = User::model()->with('postsOrderDescFormat2')->findByPk(2); $this->assertEquals(3, count($user->postsOrderDescFormat2)); $this->assertEquals( array(4, 3, 2), array( $user->postsOrderDescFormat2[0]->id, $user->postsOrderDescFormat2[1]->id, $user->postsOrderDescFormat2[2]->id, ) ); } public function testResetScope() { // resetting named scope $posts = Post::model()->post23()->resetScope()->findAll(); $this->assertEquals(5, count($posts)); // resetting default scope $posts = PostSpecial::model()->resetScope()->findAll(); $this->assertEquals(5, count($posts)); } public function testJoinWithoutSelect() { // 1:1 test $groups = Group::model()->findAll( array( 'with' => array( 'description' => array( 'select' => false, 'joinType' => 'INNER JOIN', ), ), ) ); $result = array(); foreach ($groups as $group) { // there should be nothing in relation $this->assertFalse($group->hasRelated('description')); $result[] = array($group->id, $group->name); } $this->assertEquals( array( array(1, 'group1'), array(2, 'group2'), array(3, 'group3'), array(4, 'group4'), ), $result ); // 1:M test $users = User::model()->findAll( array( 'with' => array( 'roles' => array( 'select' => false, 'joinType' => 'INNER JOIN', ), ), ) ); $result = array(); foreach ($users as $user) { // there should be nothing in relation $this->assertFalse($user->hasRelated('roles')); $result[] = array($user->id, $user->username, $user->email); } $this->assertEquals( array( array(1, 'user1', 'email1'), array(2, 'user2', 'email2'), ), $result ); } public function testHasManyThroughEager() { // just bridge $user = User::model()->with('groups')->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); // just bridge, base limited $users = User::model()->with('groups')->findAll(array('limit' => 1)); $result = array(); foreach ($users as $user) { foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); // 'through' should not clear existing relations defined via short syntax $user = User::model()->with('groups.description')->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name, $group->description->name); } $this->assertEquals( array( array('user1', 'group1', 'room1'), array('user1', 'group2', 'room2'), ), $result ); // 'through' should not clear existing with $user = User::model()->with(array('groups' => array('with' => 'description')))->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name, $group->description->name); } $this->assertEquals( array( array('user1', 'group1', 'room1'), array('user1', 'group2', 'room2'), ), $result ); // bridge fields handling $user = User::model()->with('roles', 'groups')->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); $result = array(); foreach ($user->roles as $role) { $result[] = array($user->username, $role->name); } $this->assertEquals( array( array('user1', 'dev'), array('user1', 'user'), ), $result ); // bridge fields handling, another relations order $user = User::model()->with('groups', 'roles')->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); $result = array(); foreach ($user->roles as $role) { $result[] = array($user->username, $role->name); } $this->assertEquals( array( array('user1', 'dev'), array('user1', 'user'), ), $result ); // bridge fields handling, base limited $users = User::model()->with('roles', 'groups')->findAll(array('limit' => 1)); $result = array(); foreach ($users as $user) { foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); $result = array(); foreach ($users as $user) { foreach ($user->roles as $role) { $result[] = array($user->username, $role->name); } } $this->assertEquals( array( array('user1', 'dev'), array('user1', 'user'), ), $result ); // nested through $group = Group::model()->with('comments')->findByPk(1); $result = array(); foreach ($group->comments as $comment) { $result[] = array($group->name, $comment->content); } $this->assertEquals( array( array('group1', 'comment 1'), array('group1', 'comment 2'), array('group1', 'comment 3'), array('group1', 'comment 4'), array('group1', 'comment 5'), array('group1', 'comment 6'), array('group1', 'comment 7'), array('group1', 'comment 8'), array('group1', 'comment 9'), ), $result ); // nested through, base limited $groups = Group::model()->with('comments')->findAll(array('limit' => 1)); $result = array(); foreach ($groups as $group) { foreach ($group->comments as $comment) { $result[] = array($group->name, $comment->content); } } $this->assertEquals( array( array('group1', 'comment 1'), array('group1', 'comment 2'), array('group1', 'comment 3'), array('group1', 'comment 4'), array('group1', 'comment 5'), array('group1', 'comment 6'), array('group1', 'comment 7'), array('group1', 'comment 8'), array('group1', 'comment 9'), ), $result ); // self through $teachers = User::model()->with('students')->findAll(); $result = array(); foreach ($teachers as $teacher) { foreach ($teacher->students as $student) { $result[] = array($teacher->username, $student->username); } } $this->assertEquals( array( array('user1', 'user3'), array('user2', 'user4'), ), $result ); // self through, bridge fields handling for right part $teachers = User::model()->with('mentorships', 'students')->findAll(); $result = array(); foreach ($teachers as $teacher) { foreach ($teacher->students as $student) { $result[$student->primaryKey] = array('teacher' => $teacher->username, 'student' => $student->username); } foreach ($teacher->mentorships as $mentorship) { $result[$mentorship->student_id]['progress'] = $mentorship->progress; } } $this->assertEquals( array( 3 => array('teacher' => 'user1', 'student' => 'user3', 'progress' => 'good'), 4 => array('teacher' => 'user2', 'student' => 'user4', 'progress' => 'average'), ), $result ); // self through, base limited $teachers = User::model()->with('students')->findAll(array('limit' => 1)); $result = array(); foreach ($teachers as $teacher) { foreach ($teacher->students as $student) { $result[] = array($teacher->username, $student->username); } } $this->assertEquals( array( array('user1', 'user3'), ), $result ); } public function testHasManyThroughLazy() { $user = User::model()->findByPk(1); $result = array(); foreach ($user->groups as $group) { $result[] = array($user->username, $group->name); } $this->assertEquals( array( array('user1', 'group1'), array('user1', 'group2'), ), $result ); $user = User::model()->findByPk(1); $result = array(); foreach ($user->groups(array('with' => 'description')) as $group) { $result[] = array($user->username, $group->name, $group->description->name); } $this->assertEquals( array( array('user1', 'group1', 'room1'), array('user1', 'group2', 'room2'), ), $result ); // nested through $group = Group::model()->findByPk(1); $result = array(); foreach ($group->comments as $comment) { $result[] = array($group->name, $comment->content); } $this->assertEquals( array( array('group1', 'comment 1'), array('group1', 'comment 2'), array('group1', 'comment 3'), array('group1', 'comment 4'), array('group1', 'comment 5'), array('group1', 'comment 6'), array('group1', 'comment 7'), array('group1', 'comment 8'), array('group1', 'comment 9'), ), $result ); // self through $teacher = User::model()->findByPk(1); $result = array(); foreach ($teacher->students as $student) { $result[] = array($teacher->username, $student->username); } $this->assertEquals( array( array('user1', 'user3'), ), $result ); } /** * @see issue2274 */ function testMergingWith() { User::model()->nonEmptyPosts()->findAll( array( 'with' => array( 'posts' => array( 'joinType' => 'INNER JOIN', ), ) ) ); } /** * @see github issue 206 * Unable to pass CDbCriteria to relation while array works fine. */ public function testIssue206() { $user = User::model()->findByPk(2); $result1 = $user->posts(array('condition' => 'id IN (2,3)')); $criteria = new CDbCriteria(); $criteria->addInCondition('id', array(2, 3)); $user = User::model()->findByPk(2); $result2 = $user->posts($criteria); $this->assertEquals($result1, $result2); } /** * verify https://github.com/yiisoft/yii/issues/2756 */ public function testLazyFindCondition() { $user = User::model()->findByPk(2); $this->assertEquals(3, count($user->posts())); $this->assertEquals(2, count($user->posts(array('condition' => 'id IN (2,3)')))); $this->assertEquals(2, count($user->postsCondition())); } /** * https://github.com/yiisoft/yii/issues/1070 */ public function testIssue1070() { $dataProvider = new CActiveDataProvider('UserWithDefaultScope'); foreach ($dataProvider->getData() as $item) { try { $item->links[0]->from_user; $result = true; } catch (CDbException $e) { $result = false; } $this->assertTrue($result); } } /** * https://github.com/yiisoft/yii/issues/507 */ public function testIssue507() { $this->assertEquals(2, count(UserWithDefaultScope::model()->findAll())); } /** * @see https://github.com/yiisoft/yii/issues/135 */ public function testCountWithHaving() { $criteriaWithHaving = new CDbCriteria(); $criteriaWithHaving->group = 'id'; $criteriaWithHaving->having = 'id = 1'; $count = Post::model()->count($criteriaWithHaving); $this->assertEquals(1, $count, 'Having condition has not been applied on count!'); } /** * @see https://github.com/yiisoft/yii/issues/135 * @see https://github.com/yiisoft/yii/issues/2201 */ public function testCountWithHavingRelational() { $criteriaWithHaving = new CDbCriteria(); $criteriaWithHaving->select = 't.id AS test_field'; $criteriaWithHaving->with = array('author'); $criteriaWithHaving->group = 't.id'; $criteriaWithHaving->having = 'test_field = :test_field'; $criteriaWithHaving->params['test_field'] = 1; $count = Post::model()->count($criteriaWithHaving); $this->assertEquals(1, $count, 'Having condition has not been applied on count with relation!'); } /** * @depends testFind * * @see https://github.com/yiisoft/yii/issues/2216 */ public function testFindBySinglePkByArrayWithMixedKeys() { $posts = Post::model()->findAllByPk(array('some' => 3)); $this->assertEquals(1, count($posts)); $this->assertEquals(3, $posts[0]->id); $posts = Post::model()->findAllByPk(array('some' => 3, 'another' => 2)); $this->assertEquals(2, count($posts)); $this->assertEquals(2, $posts[0]->id); $this->assertEquals(3, $posts[1]->id); } /** * @depends testFind * * @see https://github.com/yiisoft/yii/issues/101 */ public function testHasManyThroughHasManyWithCustomSelect() { $model = User::model()->with('studentsCustomSelect')->findByPk(1); $this->assertTrue(is_object($model), 'Unable to get master records!'); $this->assertTrue(count($model->students) > 0, 'Empty slave records!'); } /** * @depends testFind * * @see https://github.com/yiisoft/yii/issues/139 */ public function testLazyLoadThroughRelationWithCondition() { $masterModel = Group::model()->findByPk(1); $this->assertTrue(count($masterModel->users) > 0, 'Test environment is missing!'); $this->assertEquals( 0, count($masterModel->usersWhichEmptyByCondition), 'Unable to apply condition from through relation!' ); } /** * @depends testFind * * @see https://github.com/yiisoft/yii/issues/662 */ public function testThroughBelongsToLazy() { $comments = Comment::model()->findAll(); foreach ($comments as $comment) { $this->assertFalse(empty($comment->postAuthor)); // equal relation definition with BELONGS_TO: https://github.com/yiisoft/yii/pull/2530 $this->assertFalse(empty($comment->postAuthorBelongsTo)); $this->assertTrue($comment->postAuthor->equals($comment->postAuthorBelongsTo)); } } public function testThroughBelongsEager() { $comments = Comment::model()->with('postAuthorBelongsTo')->findAll(); foreach ($comments as $comment) { $this->assertFalse(empty($comment->postAuthor)); // equal relation definition with BELONGS_TO: https://github.com/yiisoft/yii/pull/2530 $this->assertFalse(empty($comment->postAuthorBelongsTo)); $this->assertTrue($comment->postAuthor->equals($comment->postAuthorBelongsTo)); } } }
What can this tool be used for?Viewing future projections of gross primary productivity. How can I use the maps?You can click and drag the maps to pan, double-click or use the +/- buttons to zoom, and single-click to select a location. When the side maps are displayed, click the side map titles to enlarge them. What is the Lowest Likely Outcome?The Lowest Likely Outcome is the sum of the Historical Average and the Lowest Likely Change. What is the Multi-Model Mean?The Multi-Model Mean outcome is the sum of the Historical Average and the Multi-Model Mean change. What is the Highest Likely Outcome?The Highest Likely Outcome is the sum of the Historical Average and the Highest Likely Change. To view a summary chart of all time periods, select a location on the maps above. Complete time series data is unavailable for your selected location. Thomas et al. (2017) Leveraging 35 years of Pinus taeda research in the southeastern US to constrain forest carbon cycle predictions. Biogeosciences, 14: 3525-3547. For more information on the 3-PG model, contact Dr. R. Quinn Thomas at Virginia Tech University. The Pine Integrated Network: Education, Mitigation, and Adaptation project (PINEMAP) is a Coordinated Agricultural Project funded by the USDA National Institute of Food and Agriculture, Award #2011-68002-30185. If you have any questions, suggestions, or bugs to report with the PINEMAP DSS, please email us at [email protected].
I’m not sure I could compress all I am most grateful for into one answer, there is simply too much! If I had to name a few though I would say I’m most grateful for like-minded souls, love, health, sunshine, the ocean, and new experiences. I could go on but I’ll leave it there. I’m a big believer in regular gratitude practice, you can read more about how I like to practice gratitude here. The joys of anxiety quite often have you believing your greatest fear is just around the corner, but for some reason, the fear I can spend hour upon hour fretting upon, isn’t as bad as I imagined or never happens. Funny that? Most recently I have become quite fascinated by the notion of fear. It affects everyone in such different ways and occurs for so many different concepts. Some of us thrive off of it, and others can be debilitated by it. However, I believe everyone has the power to use it to their advantage, fear can assist us to uncover our true desires, be an aid in our understanding if we truly want to do something or not, and it can make situations more exciting. I’m striving to be in the position where I can recognise the fear, decide if this is something I truly desire, and if it is, feel the fear and still do it anyway. However I think this is just the beginning of my understanding and work with fear, check back in with me in 12 months and I may have more to share. This time five years ago... my oh my, how things have changed! The beginning of 2014 was (unknown to me at the time) the catalyst in which my passion for mental health and wellbeing developed. I had spent the previous year on horrible medication for acne, that crippled me with horrendous side effects including crying spells and sore joints, and is thought to be perhaps a trigger for my depression and anxiety. ‘That time 5 years ago’ when I was ‘ extremely upset’ was unfortunately majority of the time. Fortunately, the beginning of 2014 was the time in which I acknowledged the fact that I needed professional help and was open to seeing a psychologist. And that’s where the journey began! I was a self-loathing 15-year-old, so unsure of myself, striving to please others in order to maintain ‘friendships’ and was trapped by the negative programming in which my mind thought. It has been through constant learning and maintenance of my health and wellbeing have I been able to get to where I am today. I believe everything in life truly is connected and its taken work in every area to become the happy, healthy and thriving person I am today. Seeing a psychologist regularly has equipped me with the skills to make the changes I needed to make in order to get to where I wanted to be. So looking back now, the things I was upset about don’t really matter now, however, it was because of those feelings that I was directed down a path of understanding around looking after your health and wellbeing in order to make the most of everyday. There is a silver lining to every experience. I’ve come to learn that everything in life is interrelated and it is a combination of all of these different factors (physical, social and mental health, childhood experiences, work, education, family / friends etc.) that make us who we are. I think some of the major factors that have contributed to who I am today have been a mix of both positive and negative experiences - my supportive and loving family, continual access to medical professionals due to a range of medical conditions I’ve endured, the highs and lows of high school including some wonderful friends and opportunities and some not so wonderful, and the beautiful country town in which I grew up in. Each and every day I am growing and developing into the person I am meant to be. Hands down I would retain the body of a 30-year-old and not because of the physical benefits - but because I would want what comes with the mind of a 90-year-old - the wisdom, character, and knowledge of a life well lived. My gratitude grows every day as I notice myself becoming wiser and more knowledgeable of the world but most importantly myself. Through life experience we learn many important lessons, some of the most important lessons I’ve learnt so far are: from adversity comes growth, everything in life stems from love, and "people won’t always support you, but you can always support you, and that’s enough" (Sam Laura Brown). I had a lovely catch up with a close friend recently, we had a nourishing meal on a picnic rug in a park, talking about life - our dreams, goals, fears and everything in between. We then allowed our inner child to be - we were doing cartwheels, handstands, and playing on a swing set, it was so much fun! With owls sitting above us in the trees, we lay on the grass, and felt the warmth and energy of the earth. That evening really filled my cup as you would say Jodie! Other times I feel most passionate and alive is when I’m in the ocean, doing yoga, or writing. I’ve been spending some time journalling at the beach and I’ve found it incredibly therapeutic, a couple of days ago I was so focused and in the moment with my writing, with the wind blowing and the waves rolling, it wasn’t until 45 minutes later did I come back to my surroundings and realise how sunburnt I was! I think the answer to this question is about finding balance. I believe you need to be influenced by what’s going on in the world in both a negative and positive way in order to find your purpose and joy in life. I think it is then through your purpose and joy that you begin to influence your world. I think the world has a significant influence on us throughout our childhood and teenage years, and it is once you reach adulthood that you decide if you're going to continue to let the world influence you or if you're going to influence it. I’ve taken the path of being an influence in my world, I have dreams and aspirations and I will lead with purpose and gratitude to achieve them.
Sony's Project Morpheus was announced at GDC while I combed Craigslist for a used Xbox One. Bear with me as I break down what to do about modern gaming journalism in this very much work-in-progress premiere of The BlackBanditSho Radio Show! Call in with questions and comments at: 424-261-2368, and we'll do our best to get it on the show!
There seemed to be some sort of virus running through my dogs and of course, Onyx got it. Back to some pretty severe splats. I was super worried about her loosing weight but amazingly her weight held at 45 pounds. She still has splats occasionally but I’m always elated when I see a stool that looks like a cow patty! She is still shedding but we have brushed out most of the old fur. Her skin is pretty dry, but seeing as she gets almost 0 fat in her diet this doesn’t surprise me. She is active and happy and I love to brush and pet her and not feel just bones.
//===- IndVarSimplify.cpp - Induction Variable Elimination ----------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This transformation analyzes and transforms the induction variables (and // computations derived from them) into simpler forms suitable for subsequent // analysis and transformation. // // If the trip count of a loop is computable, this pass also makes the following // changes: // 1. The exit condition for the loop is canonicalized to compare the // induction value against the exit value. This turns loops like: // 'for (i = 7; i*i < 1000; ++i)' into 'for (i = 0; i != 25; ++i)' // 2. Any use outside of the loop of an expression derived from the indvar // is changed to compute the derived value outside of the loop, eliminating // the dependence on the exit value of the induction variable. If the only // purpose of the loop is to compute the exit value of some derived // expression, this transformation will make the loop dead. // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "indvars" #include "llvm/Transforms/Scalar.h" #include "llvm/BasicBlock.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/IntrinsicInst.h" #include "llvm/LLVMContext.h" #include "llvm/Type.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/ScalarEvolutionExpander.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Support/CFG.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/SimplifyIndVar.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" using namespace llvm; STATISTIC(NumWidened , "Number of indvars widened"); STATISTIC(NumReplaced , "Number of exit values replaced"); STATISTIC(NumLFTR , "Number of loop exit tests replaced"); STATISTIC(NumElimExt , "Number of IV sign/zero extends eliminated"); STATISTIC(NumElimIV , "Number of congruent IVs eliminated"); // Trip count verification can be enabled by default under NDEBUG if we // implement a strong expression equivalence checker in SCEV. Until then, we // use the verify-indvars flag, which may assert in some cases. static cl::opt<bool> VerifyIndvars( "verify-indvars", cl::Hidden, cl::desc("Verify the ScalarEvolution result after running indvars")); namespace { class IndVarSimplify : public LoopPass { LoopInfo *LI; ScalarEvolution *SE; DominatorTree *DT; TargetData *TD; SmallVector<WeakVH, 16> DeadInsts; bool Changed; public: static char ID; // Pass identification, replacement for typeid IndVarSimplify() : LoopPass(ID), LI(0), SE(0), DT(0), TD(0), Changed(false) { initializeIndVarSimplifyPass(*PassRegistry::getPassRegistry()); } virtual bool runOnLoop(Loop *L, LPPassManager &LPM); virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DominatorTree>(); AU.addRequired<LoopInfo>(); AU.addRequired<ScalarEvolution>(); AU.addRequiredID(LoopSimplifyID); AU.addRequiredID(LCSSAID); AU.addPreserved<ScalarEvolution>(); AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LCSSAID); AU.setPreservesCFG(); } private: virtual void releaseMemory() { DeadInsts.clear(); } bool isValidRewrite(Value *FromVal, Value *ToVal); void HandleFloatingPointIV(Loop *L, PHINode *PH); void RewriteNonIntegerIVs(Loop *L); void SimplifyAndExtend(Loop *L, SCEVExpander &Rewriter, LPPassManager &LPM); void RewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter); Value *LinearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, PHINode *IndVar, SCEVExpander &Rewriter); void SinkUnusedInvariants(Loop *L); }; } char IndVarSimplify::ID = 0; INITIALIZE_PASS_BEGIN(IndVarSimplify, "indvars", "Induction Variable Simplification", false, false) INITIALIZE_PASS_DEPENDENCY(DominatorTree) INITIALIZE_PASS_DEPENDENCY(LoopInfo) INITIALIZE_PASS_DEPENDENCY(ScalarEvolution) INITIALIZE_PASS_DEPENDENCY(LoopSimplify) INITIALIZE_PASS_DEPENDENCY(LCSSA) INITIALIZE_PASS_END(IndVarSimplify, "indvars", "Induction Variable Simplification", false, false) Pass *llvm::createIndVarSimplifyPass() { return new IndVarSimplify(); } /// isValidRewrite - Return true if the SCEV expansion generated by the /// rewriter can replace the original value. SCEV guarantees that it /// produces the same value, but the way it is produced may be illegal IR. /// Ideally, this function will only be called for verification. bool IndVarSimplify::isValidRewrite(Value *FromVal, Value *ToVal) { // If an SCEV expression subsumed multiple pointers, its expansion could // reassociate the GEP changing the base pointer. This is illegal because the // final address produced by a GEP chain must be inbounds relative to its // underlying object. Otherwise basic alias analysis, among other things, // could fail in a dangerous way. Ultimately, SCEV will be improved to avoid // producing an expression involving multiple pointers. Until then, we must // bail out here. // // Retrieve the pointer operand of the GEP. Don't use GetUnderlyingObject // because it understands lcssa phis while SCEV does not. Value *FromPtr = FromVal; Value *ToPtr = ToVal; if (GEPOperator *GEP = dyn_cast<GEPOperator>(FromVal)) { FromPtr = GEP->getPointerOperand(); } if (GEPOperator *GEP = dyn_cast<GEPOperator>(ToVal)) { ToPtr = GEP->getPointerOperand(); } if (FromPtr != FromVal || ToPtr != ToVal) { // Quickly check the common case if (FromPtr == ToPtr) return true; // SCEV may have rewritten an expression that produces the GEP's pointer // operand. That's ok as long as the pointer operand has the same base // pointer. Unlike GetUnderlyingObject(), getPointerBase() will find the // base of a recurrence. This handles the case in which SCEV expansion // converts a pointer type recurrence into a nonrecurrent pointer base // indexed by an integer recurrence. // If the GEP base pointer is a vector of pointers, abort. if (!FromPtr->getType()->isPointerTy() || !ToPtr->getType()->isPointerTy()) return false; const SCEV *FromBase = SE->getPointerBase(SE->getSCEV(FromPtr)); const SCEV *ToBase = SE->getPointerBase(SE->getSCEV(ToPtr)); if (FromBase == ToBase) return true; DEBUG(dbgs() << "INDVARS: GEP rewrite bail out " << *FromBase << " != " << *ToBase << "\n"); return false; } return true; } /// Determine the insertion point for this user. By default, insert immediately /// before the user. SCEVExpander or LICM will hoist loop invariants out of the /// loop. For PHI nodes, there may be multiple uses, so compute the nearest /// common dominator for the incoming blocks. static Instruction *getInsertPointForUses(Instruction *User, Value *Def, DominatorTree *DT) { PHINode *PHI = dyn_cast<PHINode>(User); if (!PHI) return User; Instruction *InsertPt = 0; for (unsigned i = 0, e = PHI->getNumIncomingValues(); i != e; ++i) { if (PHI->getIncomingValue(i) != Def) continue; BasicBlock *InsertBB = PHI->getIncomingBlock(i); if (!InsertPt) { InsertPt = InsertBB->getTerminator(); continue; } InsertBB = DT->findNearestCommonDominator(InsertPt->getParent(), InsertBB); InsertPt = InsertBB->getTerminator(); } assert(InsertPt && "Missing phi operand"); assert((!isa<Instruction>(Def) || DT->dominates(cast<Instruction>(Def), InsertPt)) && "def does not dominate all uses"); return InsertPt; } //===----------------------------------------------------------------------===// // RewriteNonIntegerIVs and helpers. Prefer integer IVs. //===----------------------------------------------------------------------===// /// ConvertToSInt - Convert APF to an integer, if possible. static bool ConvertToSInt(const APFloat &APF, int64_t &IntVal) { bool isExact = false; if (&APF.getSemantics() == &APFloat::PPCDoubleDouble) return false; // See if we can convert this to an int64_t uint64_t UIntVal; if (APF.convertToInteger(&UIntVal, 64, true, APFloat::rmTowardZero, &isExact) != APFloat::opOK || !isExact) return false; IntVal = UIntVal; return true; } /// HandleFloatingPointIV - If the loop has floating induction variable /// then insert corresponding integer induction variable if possible. /// For example, /// for(double i = 0; i < 10000; ++i) /// bar(i) /// is converted into /// for(int i = 0; i < 10000; ++i) /// bar((double)i); /// void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PN) { unsigned IncomingEdge = L->contains(PN->getIncomingBlock(0)); unsigned BackEdge = IncomingEdge^1; // Check incoming value. ConstantFP *InitValueVal = dyn_cast<ConstantFP>(PN->getIncomingValue(IncomingEdge)); int64_t InitValue; if (!InitValueVal || !ConvertToSInt(InitValueVal->getValueAPF(), InitValue)) return; // Check IV increment. Reject this PN if increment operation is not // an add or increment value can not be represented by an integer. BinaryOperator *Incr = dyn_cast<BinaryOperator>(PN->getIncomingValue(BackEdge)); if (Incr == 0 || Incr->getOpcode() != Instruction::FAdd) return; // If this is not an add of the PHI with a constantfp, or if the constant fp // is not an integer, bail out. ConstantFP *IncValueVal = dyn_cast<ConstantFP>(Incr->getOperand(1)); int64_t IncValue; if (IncValueVal == 0 || Incr->getOperand(0) != PN || !ConvertToSInt(IncValueVal->getValueAPF(), IncValue)) return; // Check Incr uses. One user is PN and the other user is an exit condition // used by the conditional terminator. Value::use_iterator IncrUse = Incr->use_begin(); Instruction *U1 = cast<Instruction>(*IncrUse++); if (IncrUse == Incr->use_end()) return; Instruction *U2 = cast<Instruction>(*IncrUse++); if (IncrUse != Incr->use_end()) return; // Find exit condition, which is an fcmp. If it doesn't exist, or if it isn't // only used by a branch, we can't transform it. FCmpInst *Compare = dyn_cast<FCmpInst>(U1); if (!Compare) Compare = dyn_cast<FCmpInst>(U2); if (Compare == 0 || !Compare->hasOneUse() || !isa<BranchInst>(Compare->use_back())) return; BranchInst *TheBr = cast<BranchInst>(Compare->use_back()); // We need to verify that the branch actually controls the iteration count // of the loop. If not, the new IV can overflow and no one will notice. // The branch block must be in the loop and one of the successors must be out // of the loop. assert(TheBr->isConditional() && "Can't use fcmp if not conditional"); if (!L->contains(TheBr->getParent()) || (L->contains(TheBr->getSuccessor(0)) && L->contains(TheBr->getSuccessor(1)))) return; // If it isn't a comparison with an integer-as-fp (the exit value), we can't // transform it. ConstantFP *ExitValueVal = dyn_cast<ConstantFP>(Compare->getOperand(1)); int64_t ExitValue; if (ExitValueVal == 0 || !ConvertToSInt(ExitValueVal->getValueAPF(), ExitValue)) return; // Find new predicate for integer comparison. CmpInst::Predicate NewPred = CmpInst::BAD_ICMP_PREDICATE; switch (Compare->getPredicate()) { default: return; // Unknown comparison. case CmpInst::FCMP_OEQ: case CmpInst::FCMP_UEQ: NewPred = CmpInst::ICMP_EQ; break; case CmpInst::FCMP_ONE: case CmpInst::FCMP_UNE: NewPred = CmpInst::ICMP_NE; break; case CmpInst::FCMP_OGT: case CmpInst::FCMP_UGT: NewPred = CmpInst::ICMP_SGT; break; case CmpInst::FCMP_OGE: case CmpInst::FCMP_UGE: NewPred = CmpInst::ICMP_SGE; break; case CmpInst::FCMP_OLT: case CmpInst::FCMP_ULT: NewPred = CmpInst::ICMP_SLT; break; case CmpInst::FCMP_OLE: case CmpInst::FCMP_ULE: NewPred = CmpInst::ICMP_SLE; break; } // We convert the floating point induction variable to a signed i32 value if // we can. This is only safe if the comparison will not overflow in a way // that won't be trapped by the integer equivalent operations. Check for this // now. // TODO: We could use i64 if it is native and the range requires it. // The start/stride/exit values must all fit in signed i32. if (!isInt<32>(InitValue) || !isInt<32>(IncValue) || !isInt<32>(ExitValue)) return; // If not actually striding (add x, 0.0), avoid touching the code. if (IncValue == 0) return; // Positive and negative strides have different safety conditions. if (IncValue > 0) { // If we have a positive stride, we require the init to be less than the // exit value. if (InitValue >= ExitValue) return; uint32_t Range = uint32_t(ExitValue-InitValue); // Check for infinite loop, either: // while (i <= Exit) or until (i > Exit) if (NewPred == CmpInst::ICMP_SLE || NewPred == CmpInst::ICMP_SGT) { if (++Range == 0) return; // Range overflows. } unsigned Leftover = Range % uint32_t(IncValue); // If this is an equality comparison, we require that the strided value // exactly land on the exit value, otherwise the IV condition will wrap // around and do things the fp IV wouldn't. if ((NewPred == CmpInst::ICMP_EQ || NewPred == CmpInst::ICMP_NE) && Leftover != 0) return; // If the stride would wrap around the i32 before exiting, we can't // transform the IV. if (Leftover != 0 && int32_t(ExitValue+IncValue) < ExitValue) return; } else { // If we have a negative stride, we require the init to be greater than the // exit value. if (InitValue <= ExitValue) return; uint32_t Range = uint32_t(InitValue-ExitValue); // Check for infinite loop, either: // while (i >= Exit) or until (i < Exit) if (NewPred == CmpInst::ICMP_SGE || NewPred == CmpInst::ICMP_SLT) { if (++Range == 0) return; // Range overflows. } unsigned Leftover = Range % uint32_t(-IncValue); // If this is an equality comparison, we require that the strided value // exactly land on the exit value, otherwise the IV condition will wrap // around and do things the fp IV wouldn't. if ((NewPred == CmpInst::ICMP_EQ || NewPred == CmpInst::ICMP_NE) && Leftover != 0) return; // If the stride would wrap around the i32 before exiting, we can't // transform the IV. if (Leftover != 0 && int32_t(ExitValue+IncValue) > ExitValue) return; } IntegerType *Int32Ty = Type::getInt32Ty(PN->getContext()); // Insert new integer induction variable. PHINode *NewPHI = PHINode::Create(Int32Ty, 2, PN->getName()+".int", PN); NewPHI->addIncoming(ConstantInt::get(Int32Ty, InitValue), PN->getIncomingBlock(IncomingEdge)); Value *NewAdd = BinaryOperator::CreateAdd(NewPHI, ConstantInt::get(Int32Ty, IncValue), Incr->getName()+".int", Incr); NewPHI->addIncoming(NewAdd, PN->getIncomingBlock(BackEdge)); ICmpInst *NewCompare = new ICmpInst(TheBr, NewPred, NewAdd, ConstantInt::get(Int32Ty, ExitValue), Compare->getName()); // In the following deletions, PN may become dead and may be deleted. // Use a WeakVH to observe whether this happens. WeakVH WeakPH = PN; // Delete the old floating point exit comparison. The branch starts using the // new comparison. NewCompare->takeName(Compare); Compare->replaceAllUsesWith(NewCompare); RecursivelyDeleteTriviallyDeadInstructions(Compare); // Delete the old floating point increment. Incr->replaceAllUsesWith(UndefValue::get(Incr->getType())); RecursivelyDeleteTriviallyDeadInstructions(Incr); // If the FP induction variable still has uses, this is because something else // in the loop uses its value. In order to canonicalize the induction // variable, we chose to eliminate the IV and rewrite it in terms of an // int->fp cast. // // We give preference to sitofp over uitofp because it is faster on most // platforms. if (WeakPH) { Value *Conv = new SIToFPInst(NewPHI, PN->getType(), "indvar.conv", PN->getParent()->getFirstInsertionPt()); PN->replaceAllUsesWith(Conv); RecursivelyDeleteTriviallyDeadInstructions(PN); } Changed = true; } void IndVarSimplify::RewriteNonIntegerIVs(Loop *L) { // First step. Check to see if there are any floating-point recurrences. // If there are, change them into integer recurrences, permitting analysis by // the SCEV routines. // BasicBlock *Header = L->getHeader(); SmallVector<WeakVH, 8> PHIs; for (BasicBlock::iterator I = Header->begin(); PHINode *PN = dyn_cast<PHINode>(I); ++I) PHIs.push_back(PN); for (unsigned i = 0, e = PHIs.size(); i != e; ++i) if (PHINode *PN = dyn_cast_or_null<PHINode>(&*PHIs[i])) HandleFloatingPointIV(L, PN); // If the loop previously had floating-point IV, ScalarEvolution // may not have been able to compute a trip count. Now that we've done some // re-writing, the trip count may be computable. if (Changed) SE->forgetLoop(L); } //===----------------------------------------------------------------------===// // RewriteLoopExitValues - Optimize IV users outside the loop. // As a side effect, reduces the amount of IV processing within the loop. //===----------------------------------------------------------------------===// /// RewriteLoopExitValues - Check to see if this loop has a computable /// loop-invariant execution count. If so, this means that we can compute the /// final value of any expressions that are recurrent in the loop, and /// substitute the exit values from the loop into any instructions outside of /// the loop that use the final values of the current expressions. /// /// This is mostly redundant with the regular IndVarSimplify activities that /// happen later, except that it's more powerful in some cases, because it's /// able to brute-force evaluate arbitrary instructions as long as they have /// constant operands at the beginning of the loop. void IndVarSimplify::RewriteLoopExitValues(Loop *L, SCEVExpander &Rewriter) { // Verify the input to the pass in already in LCSSA form. assert(L->isLCSSAForm(*DT)); SmallVector<BasicBlock*, 8> ExitBlocks; L->getUniqueExitBlocks(ExitBlocks); // Find all values that are computed inside the loop, but used outside of it. // Because of LCSSA, these values will only occur in LCSSA PHI Nodes. Scan // the exit blocks of the loop to find them. for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) { BasicBlock *ExitBB = ExitBlocks[i]; // If there are no PHI nodes in this exit block, then no values defined // inside the loop are used on this path, skip it. PHINode *PN = dyn_cast<PHINode>(ExitBB->begin()); if (!PN) continue; unsigned NumPreds = PN->getNumIncomingValues(); // Iterate over all of the PHI nodes. BasicBlock::iterator BBI = ExitBB->begin(); while ((PN = dyn_cast<PHINode>(BBI++))) { if (PN->use_empty()) continue; // dead use, don't replace it // SCEV only supports integer expressions for now. if (!PN->getType()->isIntegerTy() && !PN->getType()->isPointerTy()) continue; // It's necessary to tell ScalarEvolution about this explicitly so that // it can walk the def-use list and forget all SCEVs, as it may not be // watching the PHI itself. Once the new exit value is in place, there // may not be a def-use connection between the loop and every instruction // which got a SCEVAddRecExpr for that loop. SE->forgetValue(PN); // Iterate over all of the values in all the PHI nodes. for (unsigned i = 0; i != NumPreds; ++i) { // If the value being merged in is not integer or is not defined // in the loop, skip it. Value *InVal = PN->getIncomingValue(i); if (!isa<Instruction>(InVal)) continue; // If this pred is for a subloop, not L itself, skip it. if (LI->getLoopFor(PN->getIncomingBlock(i)) != L) continue; // The Block is in a subloop, skip it. // Check that InVal is defined in the loop. Instruction *Inst = cast<Instruction>(InVal); if (!L->contains(Inst)) continue; // Okay, this instruction has a user outside of the current loop // and varies predictably *inside* the loop. Evaluate the value it // contains when the loop exits, if possible. const SCEV *ExitValue = SE->getSCEVAtScope(Inst, L->getParentLoop()); if (!SE->isLoopInvariant(ExitValue, L)) continue; Value *ExitVal = Rewriter.expandCodeFor(ExitValue, PN->getType(), Inst); DEBUG(dbgs() << "INDVARS: RLEV: AfterLoopVal = " << *ExitVal << '\n' << " LoopVal = " << *Inst << "\n"); if (!isValidRewrite(Inst, ExitVal)) { DeadInsts.push_back(ExitVal); continue; } Changed = true; ++NumReplaced; PN->setIncomingValue(i, ExitVal); // If this instruction is dead now, delete it. RecursivelyDeleteTriviallyDeadInstructions(Inst); if (NumPreds == 1) { // Completely replace a single-pred PHI. This is safe, because the // NewVal won't be variant in the loop, so we don't need an LCSSA phi // node anymore. PN->replaceAllUsesWith(ExitVal); RecursivelyDeleteTriviallyDeadInstructions(PN); } } if (NumPreds != 1) { // Clone the PHI and delete the original one. This lets IVUsers and // any other maps purge the original user from their records. PHINode *NewPN = cast<PHINode>(PN->clone()); NewPN->takeName(PN); NewPN->insertBefore(PN); PN->replaceAllUsesWith(NewPN); PN->eraseFromParent(); } } } // The insertion point instruction may have been deleted; clear it out // so that the rewriter doesn't trip over it later. Rewriter.clearInsertPoint(); } //===----------------------------------------------------------------------===// // IV Widening - Extend the width of an IV to cover its widest uses. //===----------------------------------------------------------------------===// namespace { // Collect information about induction variables that are used by sign/zero // extend operations. This information is recorded by CollectExtend and // provides the input to WidenIV. struct WideIVInfo { PHINode *NarrowIV; Type *WidestNativeType; // Widest integer type created [sz]ext bool IsSigned; // Was an sext user seen before a zext? WideIVInfo() : NarrowIV(0), WidestNativeType(0), IsSigned(false) {} }; class WideIVVisitor : public IVVisitor { ScalarEvolution *SE; const TargetData *TD; public: WideIVInfo WI; WideIVVisitor(PHINode *NarrowIV, ScalarEvolution *SCEV, const TargetData *TData) : SE(SCEV), TD(TData) { WI.NarrowIV = NarrowIV; } // Implement the interface used by simplifyUsersOfIV. virtual void visitCast(CastInst *Cast); }; } /// visitCast - Update information about the induction variable that is /// extended by this sign or zero extend operation. This is used to determine /// the final width of the IV before actually widening it. void WideIVVisitor::visitCast(CastInst *Cast) { bool IsSigned = Cast->getOpcode() == Instruction::SExt; if (!IsSigned && Cast->getOpcode() != Instruction::ZExt) return; Type *Ty = Cast->getType(); uint64_t Width = SE->getTypeSizeInBits(Ty); if (TD && !TD->isLegalInteger(Width)) return; if (!WI.WidestNativeType) { WI.WidestNativeType = SE->getEffectiveSCEVType(Ty); WI.IsSigned = IsSigned; return; } // We extend the IV to satisfy the sign of its first user, arbitrarily. if (WI.IsSigned != IsSigned) return; if (Width > SE->getTypeSizeInBits(WI.WidestNativeType)) WI.WidestNativeType = SE->getEffectiveSCEVType(Ty); } namespace { /// NarrowIVDefUse - Record a link in the Narrow IV def-use chain along with the /// WideIV that computes the same value as the Narrow IV def. This avoids /// caching Use* pointers. struct NarrowIVDefUse { Instruction *NarrowDef; Instruction *NarrowUse; Instruction *WideDef; NarrowIVDefUse(): NarrowDef(0), NarrowUse(0), WideDef(0) {} NarrowIVDefUse(Instruction *ND, Instruction *NU, Instruction *WD): NarrowDef(ND), NarrowUse(NU), WideDef(WD) {} }; /// WidenIV - The goal of this transform is to remove sign and zero extends /// without creating any new induction variables. To do this, it creates a new /// phi of the wider type and redirects all users, either removing extends or /// inserting truncs whenever we stop propagating the type. /// class WidenIV { // Parameters PHINode *OrigPhi; Type *WideType; bool IsSigned; // Context LoopInfo *LI; Loop *L; ScalarEvolution *SE; DominatorTree *DT; // Result PHINode *WidePhi; Instruction *WideInc; const SCEV *WideIncExpr; SmallVectorImpl<WeakVH> &DeadInsts; SmallPtrSet<Instruction*,16> Widened; SmallVector<NarrowIVDefUse, 8> NarrowIVUsers; public: WidenIV(const WideIVInfo &WI, LoopInfo *LInfo, ScalarEvolution *SEv, DominatorTree *DTree, SmallVectorImpl<WeakVH> &DI) : OrigPhi(WI.NarrowIV), WideType(WI.WidestNativeType), IsSigned(WI.IsSigned), LI(LInfo), L(LI->getLoopFor(OrigPhi->getParent())), SE(SEv), DT(DTree), WidePhi(0), WideInc(0), WideIncExpr(0), DeadInsts(DI) { assert(L->getHeader() == OrigPhi->getParent() && "Phi must be an IV"); } PHINode *CreateWideIV(SCEVExpander &Rewriter); protected: Value *getExtend(Value *NarrowOper, Type *WideType, bool IsSigned, Instruction *Use); Instruction *CloneIVUser(NarrowIVDefUse DU); const SCEVAddRecExpr *GetWideRecurrence(Instruction *NarrowUse); const SCEVAddRecExpr* GetExtendedOperandRecurrence(NarrowIVDefUse DU); Instruction *WidenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter); void pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef); }; } // anonymous namespace /// isLoopInvariant - Perform a quick domtree based check for loop invariance /// assuming that V is used within the loop. LoopInfo::isLoopInvariant() seems /// gratuitous for this purpose. static bool isLoopInvariant(Value *V, const Loop *L, const DominatorTree *DT) { Instruction *Inst = dyn_cast<Instruction>(V); if (!Inst) return true; return DT->properlyDominates(Inst->getParent(), L->getHeader()); } Value *WidenIV::getExtend(Value *NarrowOper, Type *WideType, bool IsSigned, Instruction *Use) { // Set the debug location and conservative insertion point. IRBuilder<> Builder(Use); // Hoist the insertion point into loop preheaders as far as possible. for (const Loop *L = LI->getLoopFor(Use->getParent()); L && L->getLoopPreheader() && isLoopInvariant(NarrowOper, L, DT); L = L->getParentLoop()) Builder.SetInsertPoint(L->getLoopPreheader()->getTerminator()); return IsSigned ? Builder.CreateSExt(NarrowOper, WideType) : Builder.CreateZExt(NarrowOper, WideType); } /// CloneIVUser - Instantiate a wide operation to replace a narrow /// operation. This only needs to handle operations that can evaluation to /// SCEVAddRec. It can safely return 0 for any operation we decide not to clone. Instruction *WidenIV::CloneIVUser(NarrowIVDefUse DU) { unsigned Opcode = DU.NarrowUse->getOpcode(); switch (Opcode) { default: return 0; case Instruction::Add: case Instruction::Mul: case Instruction::UDiv: case Instruction::Sub: case Instruction::And: case Instruction::Or: case Instruction::Xor: case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: DEBUG(dbgs() << "Cloning IVUser: " << *DU.NarrowUse << "\n"); // Replace NarrowDef operands with WideDef. Otherwise, we don't know // anything about the narrow operand yet so must insert a [sz]ext. It is // probably loop invariant and will be folded or hoisted. If it actually // comes from a widened IV, it should be removed during a future call to // WidenIVUse. Value *LHS = (DU.NarrowUse->getOperand(0) == DU.NarrowDef) ? DU.WideDef : getExtend(DU.NarrowUse->getOperand(0), WideType, IsSigned, DU.NarrowUse); Value *RHS = (DU.NarrowUse->getOperand(1) == DU.NarrowDef) ? DU.WideDef : getExtend(DU.NarrowUse->getOperand(1), WideType, IsSigned, DU.NarrowUse); BinaryOperator *NarrowBO = cast<BinaryOperator>(DU.NarrowUse); BinaryOperator *WideBO = BinaryOperator::Create(NarrowBO->getOpcode(), LHS, RHS, NarrowBO->getName()); IRBuilder<> Builder(DU.NarrowUse); Builder.Insert(WideBO); if (const OverflowingBinaryOperator *OBO = dyn_cast<OverflowingBinaryOperator>(NarrowBO)) { if (OBO->hasNoUnsignedWrap()) WideBO->setHasNoUnsignedWrap(); if (OBO->hasNoSignedWrap()) WideBO->setHasNoSignedWrap(); } return WideBO; } } /// No-wrap operations can transfer sign extension of their result to their /// operands. Generate the SCEV value for the widened operation without /// actually modifying the IR yet. If the expression after extending the /// operands is an AddRec for this loop, return it. const SCEVAddRecExpr* WidenIV::GetExtendedOperandRecurrence(NarrowIVDefUse DU) { // Handle the common case of add<nsw/nuw> if (DU.NarrowUse->getOpcode() != Instruction::Add) return 0; // One operand (NarrowDef) has already been extended to WideDef. Now determine // if extending the other will lead to a recurrence. unsigned ExtendOperIdx = DU.NarrowUse->getOperand(0) == DU.NarrowDef ? 1 : 0; assert(DU.NarrowUse->getOperand(1-ExtendOperIdx) == DU.NarrowDef && "bad DU"); const SCEV *ExtendOperExpr = 0; const OverflowingBinaryOperator *OBO = cast<OverflowingBinaryOperator>(DU.NarrowUse); if (IsSigned && OBO->hasNoSignedWrap()) ExtendOperExpr = SE->getSignExtendExpr( SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); else if(!IsSigned && OBO->hasNoUnsignedWrap()) ExtendOperExpr = SE->getZeroExtendExpr( SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); else return 0; // When creating this AddExpr, don't apply the current operations NSW or NUW // flags. This instruction may be guarded by control flow that the no-wrap // behavior depends on. Non-control-equivalent instructions can be mapped to // the same SCEV expression, and it would be incorrect to transfer NSW/NUW // semantics to those operations. const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>( SE->getAddExpr(SE->getSCEV(DU.WideDef), ExtendOperExpr)); if (!AddRec || AddRec->getLoop() != L) return 0; return AddRec; } /// GetWideRecurrence - Is this instruction potentially interesting from /// IVUsers' perspective after widening it's type? In other words, can the /// extend be safely hoisted out of the loop with SCEV reducing the value to a /// recurrence on the same loop. If so, return the sign or zero extended /// recurrence. Otherwise return NULL. const SCEVAddRecExpr *WidenIV::GetWideRecurrence(Instruction *NarrowUse) { if (!SE->isSCEVable(NarrowUse->getType())) return 0; const SCEV *NarrowExpr = SE->getSCEV(NarrowUse); if (SE->getTypeSizeInBits(NarrowExpr->getType()) >= SE->getTypeSizeInBits(WideType)) { // NarrowUse implicitly widens its operand. e.g. a gep with a narrow // index. So don't follow this use. return 0; } const SCEV *WideExpr = IsSigned ? SE->getSignExtendExpr(NarrowExpr, WideType) : SE->getZeroExtendExpr(NarrowExpr, WideType); const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(WideExpr); if (!AddRec || AddRec->getLoop() != L) return 0; return AddRec; } /// WidenIVUse - Determine whether an individual user of the narrow IV can be /// widened. If so, return the wide clone of the user. Instruction *WidenIV::WidenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) { // Stop traversing the def-use chain at inner-loop phis or post-loop phis. if (isa<PHINode>(DU.NarrowUse) && LI->getLoopFor(DU.NarrowUse->getParent()) != L) return 0; // Our raison d'etre! Eliminate sign and zero extension. if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) { Value *NewDef = DU.WideDef; if (DU.NarrowUse->getType() != WideType) { unsigned CastWidth = SE->getTypeSizeInBits(DU.NarrowUse->getType()); unsigned IVWidth = SE->getTypeSizeInBits(WideType); if (CastWidth < IVWidth) { // The cast isn't as wide as the IV, so insert a Trunc. IRBuilder<> Builder(DU.NarrowUse); NewDef = Builder.CreateTrunc(DU.WideDef, DU.NarrowUse->getType()); } else { // A wider extend was hidden behind a narrower one. This may induce // another round of IV widening in which the intermediate IV becomes // dead. It should be very rare. DEBUG(dbgs() << "INDVARS: New IV " << *WidePhi << " not wide enough to subsume " << *DU.NarrowUse << "\n"); DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); NewDef = DU.NarrowUse; } } if (NewDef != DU.NarrowUse) { DEBUG(dbgs() << "INDVARS: eliminating " << *DU.NarrowUse << " replaced by " << *DU.WideDef << "\n"); ++NumElimExt; DU.NarrowUse->replaceAllUsesWith(NewDef); DeadInsts.push_back(DU.NarrowUse); } // Now that the extend is gone, we want to expose it's uses for potential // further simplification. We don't need to directly inform SimplifyIVUsers // of the new users, because their parent IV will be processed later as a // new loop phi. If we preserved IVUsers analysis, we would also want to // push the uses of WideDef here. // No further widening is needed. The deceased [sz]ext had done it for us. return 0; } // Does this user itself evaluate to a recurrence after widening? const SCEVAddRecExpr *WideAddRec = GetWideRecurrence(DU.NarrowUse); if (!WideAddRec) { WideAddRec = GetExtendedOperandRecurrence(DU); } if (!WideAddRec) { // This user does not evaluate to a recurence after widening, so don't // follow it. Instead insert a Trunc to kill off the original use, // eventually isolating the original narrow IV so it can be removed. IRBuilder<> Builder(getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT)); Value *Trunc = Builder.CreateTrunc(DU.WideDef, DU.NarrowDef->getType()); DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, Trunc); return 0; } // Assume block terminators cannot evaluate to a recurrence. We can't to // insert a Trunc after a terminator if there happens to be a critical edge. assert(DU.NarrowUse != DU.NarrowUse->getParent()->getTerminator() && "SCEV is not expected to evaluate a block terminator"); // Reuse the IV increment that SCEVExpander created as long as it dominates // NarrowUse. Instruction *WideUse = 0; if (WideAddRec == WideIncExpr && Rewriter.hoistIVInc(WideInc, DU.NarrowUse)) WideUse = WideInc; else { WideUse = CloneIVUser(DU); if (!WideUse) return 0; } // Evaluation of WideAddRec ensured that the narrow expression could be // extended outside the loop without overflow. This suggests that the wide use // evaluates to the same expression as the extended narrow use, but doesn't // absolutely guarantee it. Hence the following failsafe check. In rare cases // where it fails, we simply throw away the newly created wide use. if (WideAddRec != SE->getSCEV(WideUse)) { DEBUG(dbgs() << "Wide use expression mismatch: " << *WideUse << ": " << *SE->getSCEV(WideUse) << " != " << *WideAddRec << "\n"); DeadInsts.push_back(WideUse); return 0; } // Returning WideUse pushes it on the worklist. return WideUse; } /// pushNarrowIVUsers - Add eligible users of NarrowDef to NarrowIVUsers. /// void WidenIV::pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef) { for (Value::use_iterator UI = NarrowDef->use_begin(), UE = NarrowDef->use_end(); UI != UE; ++UI) { Instruction *NarrowUse = cast<Instruction>(*UI); // Handle data flow merges and bizarre phi cycles. if (!Widened.insert(NarrowUse)) continue; NarrowIVUsers.push_back(NarrowIVDefUse(NarrowDef, NarrowUse, WideDef)); } } /// CreateWideIV - Process a single induction variable. First use the /// SCEVExpander to create a wide induction variable that evaluates to the same /// recurrence as the original narrow IV. Then use a worklist to forward /// traverse the narrow IV's def-use chain. After WidenIVUse has processed all /// interesting IV users, the narrow IV will be isolated for removal by /// DeleteDeadPHIs. /// /// It would be simpler to delete uses as they are processed, but we must avoid /// invalidating SCEV expressions. /// PHINode *WidenIV::CreateWideIV(SCEVExpander &Rewriter) { // Is this phi an induction variable? const SCEVAddRecExpr *AddRec = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(OrigPhi)); if (!AddRec) return NULL; // Widen the induction variable expression. const SCEV *WideIVExpr = IsSigned ? SE->getSignExtendExpr(AddRec, WideType) : SE->getZeroExtendExpr(AddRec, WideType); assert(SE->getEffectiveSCEVType(WideIVExpr->getType()) == WideType && "Expect the new IV expression to preserve its type"); // Can the IV be extended outside the loop without overflow? AddRec = dyn_cast<SCEVAddRecExpr>(WideIVExpr); if (!AddRec || AddRec->getLoop() != L) return NULL; // An AddRec must have loop-invariant operands. Since this AddRec is // materialized by a loop header phi, the expression cannot have any post-loop // operands, so they must dominate the loop header. assert(SE->properlyDominates(AddRec->getStart(), L->getHeader()) && SE->properlyDominates(AddRec->getStepRecurrence(*SE), L->getHeader()) && "Loop header phi recurrence inputs do not dominate the loop"); // The rewriter provides a value for the desired IV expression. This may // either find an existing phi or materialize a new one. Either way, we // expect a well-formed cyclic phi-with-increments. i.e. any operand not part // of the phi-SCC dominates the loop entry. Instruction *InsertPt = L->getHeader()->begin(); WidePhi = cast<PHINode>(Rewriter.expandCodeFor(AddRec, WideType, InsertPt)); // Remembering the WideIV increment generated by SCEVExpander allows // WidenIVUse to reuse it when widening the narrow IV's increment. We don't // employ a general reuse mechanism because the call above is the only call to // SCEVExpander. Henceforth, we produce 1-to-1 narrow to wide uses. if (BasicBlock *LatchBlock = L->getLoopLatch()) { WideInc = cast<Instruction>(WidePhi->getIncomingValueForBlock(LatchBlock)); WideIncExpr = SE->getSCEV(WideInc); } DEBUG(dbgs() << "Wide IV: " << *WidePhi << "\n"); ++NumWidened; // Traverse the def-use chain using a worklist starting at the original IV. assert(Widened.empty() && NarrowIVUsers.empty() && "expect initial state" ); Widened.insert(OrigPhi); pushNarrowIVUsers(OrigPhi, WidePhi); while (!NarrowIVUsers.empty()) { NarrowIVDefUse DU = NarrowIVUsers.pop_back_val(); // Process a def-use edge. This may replace the use, so don't hold a // use_iterator across it. Instruction *WideUse = WidenIVUse(DU, Rewriter); // Follow all def-use edges from the previous narrow use. if (WideUse) pushNarrowIVUsers(DU.NarrowUse, WideUse); // WidenIVUse may have removed the def-use edge. if (DU.NarrowDef->use_empty()) DeadInsts.push_back(DU.NarrowDef); } return WidePhi; } //===----------------------------------------------------------------------===// // Simplification of IV users based on SCEV evaluation. //===----------------------------------------------------------------------===// /// SimplifyAndExtend - Iteratively perform simplification on a worklist of IV /// users. Each successive simplification may push more users which may /// themselves be candidates for simplification. /// /// Sign/Zero extend elimination is interleaved with IV simplification. /// void IndVarSimplify::SimplifyAndExtend(Loop *L, SCEVExpander &Rewriter, LPPassManager &LPM) { SmallVector<WideIVInfo, 8> WideIVs; SmallVector<PHINode*, 8> LoopPhis; for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) { LoopPhis.push_back(cast<PHINode>(I)); } // Each round of simplification iterates through the SimplifyIVUsers worklist // for all current phis, then determines whether any IVs can be // widened. Widening adds new phis to LoopPhis, inducing another round of // simplification on the wide IVs. while (!LoopPhis.empty()) { // Evaluate as many IV expressions as possible before widening any IVs. This // forces SCEV to set no-wrap flags before evaluating sign/zero // extension. The first time SCEV attempts to normalize sign/zero extension, // the result becomes final. So for the most predictable results, we delay // evaluation of sign/zero extend evaluation until needed, and avoid running // other SCEV based analysis prior to SimplifyAndExtend. do { PHINode *CurrIV = LoopPhis.pop_back_val(); // Information about sign/zero extensions of CurrIV. WideIVVisitor WIV(CurrIV, SE, TD); Changed |= simplifyUsersOfIV(CurrIV, SE, &LPM, DeadInsts, &WIV); if (WIV.WI.WidestNativeType) { WideIVs.push_back(WIV.WI); } } while(!LoopPhis.empty()); for (; !WideIVs.empty(); WideIVs.pop_back()) { WidenIV Widener(WideIVs.back(), LI, SE, DT, DeadInsts); if (PHINode *WidePhi = Widener.CreateWideIV(Rewriter)) { Changed = true; LoopPhis.push_back(WidePhi); } } } } //===----------------------------------------------------------------------===// // LinearFunctionTestReplace and its kin. Rewrite the loop exit condition. //===----------------------------------------------------------------------===// /// Check for expressions that ScalarEvolution generates to compute /// BackedgeTakenInfo. If these expressions have not been reduced, then /// expanding them may incur additional cost (albeit in the loop preheader). static bool isHighCostExpansion(const SCEV *S, BranchInst *BI, SmallPtrSet<const SCEV*, 8> &Processed, ScalarEvolution *SE) { if (!Processed.insert(S)) return false; // If the backedge-taken count is a UDiv, it's very likely a UDiv that // ScalarEvolution's HowFarToZero or HowManyLessThans produced to compute a // precise expression, rather than a UDiv from the user's code. If we can't // find a UDiv in the code with some simple searching, assume the former and // forego rewriting the loop. if (isa<SCEVUDivExpr>(S)) { ICmpInst *OrigCond = dyn_cast<ICmpInst>(BI->getCondition()); if (!OrigCond) return true; const SCEV *R = SE->getSCEV(OrigCond->getOperand(1)); R = SE->getMinusSCEV(R, SE->getConstant(R->getType(), 1)); if (R != S) { const SCEV *L = SE->getSCEV(OrigCond->getOperand(0)); L = SE->getMinusSCEV(L, SE->getConstant(L->getType(), 1)); if (L != S) return true; } } // Recurse past add expressions, which commonly occur in the // BackedgeTakenCount. They may already exist in program code, and if not, // they are not too expensive rematerialize. if (const SCEVAddExpr *Add = dyn_cast<SCEVAddExpr>(S)) { for (SCEVAddExpr::op_iterator I = Add->op_begin(), E = Add->op_end(); I != E; ++I) { if (isHighCostExpansion(*I, BI, Processed, SE)) return true; } return false; } // HowManyLessThans uses a Max expression whenever the loop is not guarded by // the exit condition. if (isa<SCEVSMaxExpr>(S) || isa<SCEVUMaxExpr>(S)) return true; // If we haven't recognized an expensive SCEV pattern, assume it's an // expression produced by program code. return false; } /// canExpandBackedgeTakenCount - Return true if this loop's backedge taken /// count expression can be safely and cheaply expanded into an instruction /// sequence that can be used by LinearFunctionTestReplace. /// /// TODO: This fails for pointer-type loop counters with greater than one byte /// strides, consequently preventing LFTR from running. For the purpose of LFTR /// we could skip this check in the case that the LFTR loop counter (chosen by /// FindLoopCounter) is also pointer type. Instead, we could directly convert /// the loop test to an inequality test by checking the target data's alignment /// of element types (given that the initial pointer value originates from or is /// used by ABI constrained operation, as opposed to inttoptr/ptrtoint). /// However, we don't yet have a strong motivation for converting loop tests /// into inequality tests. static bool canExpandBackedgeTakenCount(Loop *L, ScalarEvolution *SE) { const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); if (isa<SCEVCouldNotCompute>(BackedgeTakenCount) || BackedgeTakenCount->isZero()) return false; if (!L->getExitingBlock()) return false; // Can't rewrite non-branch yet. BranchInst *BI = dyn_cast<BranchInst>(L->getExitingBlock()->getTerminator()); if (!BI) return false; SmallPtrSet<const SCEV*, 8> Processed; if (isHighCostExpansion(BackedgeTakenCount, BI, Processed, SE)) return false; return true; } /// getLoopPhiForCounter - Return the loop header phi IFF IncV adds a loop /// invariant value to the phi. static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L, DominatorTree *DT) { Instruction *IncI = dyn_cast<Instruction>(IncV); if (!IncI) return 0; switch (IncI->getOpcode()) { case Instruction::Add: case Instruction::Sub: break; case Instruction::GetElementPtr: // An IV counter must preserve its type. if (IncI->getNumOperands() == 2) break; default: return 0; } PHINode *Phi = dyn_cast<PHINode>(IncI->getOperand(0)); if (Phi && Phi->getParent() == L->getHeader()) { if (isLoopInvariant(IncI->getOperand(1), L, DT)) return Phi; return 0; } if (IncI->getOpcode() == Instruction::GetElementPtr) return 0; // Allow add/sub to be commuted. Phi = dyn_cast<PHINode>(IncI->getOperand(1)); if (Phi && Phi->getParent() == L->getHeader()) { if (isLoopInvariant(IncI->getOperand(0), L, DT)) return Phi; } return 0; } /// needsLFTR - LinearFunctionTestReplace policy. Return true unless we can show /// that the current exit test is already sufficiently canonical. static bool needsLFTR(Loop *L, DominatorTree *DT) { assert(L->getExitingBlock() && "expected loop exit"); BasicBlock *LatchBlock = L->getLoopLatch(); // Don't bother with LFTR if the loop is not properly simplified. if (!LatchBlock) return false; BranchInst *BI = dyn_cast<BranchInst>(L->getExitingBlock()->getTerminator()); assert(BI && "expected exit branch"); // Do LFTR to simplify the exit condition to an ICMP. ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition()); if (!Cond) return true; // Do LFTR to simplify the exit ICMP to EQ/NE ICmpInst::Predicate Pred = Cond->getPredicate(); if (Pred != ICmpInst::ICMP_NE && Pred != ICmpInst::ICMP_EQ) return true; // Look for a loop invariant RHS Value *LHS = Cond->getOperand(0); Value *RHS = Cond->getOperand(1); if (!isLoopInvariant(RHS, L, DT)) { if (!isLoopInvariant(LHS, L, DT)) return true; std::swap(LHS, RHS); } // Look for a simple IV counter LHS PHINode *Phi = dyn_cast<PHINode>(LHS); if (!Phi) Phi = getLoopPhiForCounter(LHS, L, DT); if (!Phi) return true; // Do LFTR if the exit condition's IV is *not* a simple counter. Value *IncV = Phi->getIncomingValueForBlock(L->getLoopLatch()); return Phi != getLoopPhiForCounter(IncV, L, DT); } /// AlmostDeadIV - Return true if this IV has any uses other than the (soon to /// be rewritten) loop exit test. static bool AlmostDeadIV(PHINode *Phi, BasicBlock *LatchBlock, Value *Cond) { int LatchIdx = Phi->getBasicBlockIndex(LatchBlock); Value *IncV = Phi->getIncomingValue(LatchIdx); for (Value::use_iterator UI = Phi->use_begin(), UE = Phi->use_end(); UI != UE; ++UI) { if (*UI != Cond && *UI != IncV) return false; } for (Value::use_iterator UI = IncV->use_begin(), UE = IncV->use_end(); UI != UE; ++UI) { if (*UI != Cond && *UI != Phi) return false; } return true; } /// FindLoopCounter - Find an affine IV in canonical form. /// /// BECount may be an i8* pointer type. The pointer difference is already /// valid count without scaling the address stride, so it remains a pointer /// expression as far as SCEV is concerned. /// /// FIXME: Accept -1 stride and set IVLimit = IVInit - BECount /// /// FIXME: Accept non-unit stride as long as SCEV can reduce BECount * Stride. /// This is difficult in general for SCEV because of potential overflow. But we /// could at least handle constant BECounts. static PHINode * FindLoopCounter(Loop *L, const SCEV *BECount, ScalarEvolution *SE, DominatorTree *DT, const TargetData *TD) { uint64_t BCWidth = SE->getTypeSizeInBits(BECount->getType()); Value *Cond = cast<BranchInst>(L->getExitingBlock()->getTerminator())->getCondition(); // Loop over all of the PHI nodes, looking for a simple counter. PHINode *BestPhi = 0; const SCEV *BestInit = 0; BasicBlock *LatchBlock = L->getLoopLatch(); assert(LatchBlock && "needsLFTR should guarantee a loop latch"); for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) { PHINode *Phi = cast<PHINode>(I); if (!SE->isSCEVable(Phi->getType())) continue; // Avoid comparing an integer IV against a pointer Limit. if (BECount->getType()->isPointerTy() && !Phi->getType()->isPointerTy()) continue; const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(Phi)); if (!AR || AR->getLoop() != L || !AR->isAffine()) continue; // AR may be a pointer type, while BECount is an integer type. // AR may be wider than BECount. With eq/ne tests overflow is immaterial. // AR may not be a narrower type, or we may never exit. uint64_t PhiWidth = SE->getTypeSizeInBits(AR->getType()); if (PhiWidth < BCWidth || (TD && !TD->isLegalInteger(PhiWidth))) continue; const SCEV *Step = dyn_cast<SCEVConstant>(AR->getStepRecurrence(*SE)); if (!Step || !Step->isOne()) continue; int LatchIdx = Phi->getBasicBlockIndex(LatchBlock); Value *IncV = Phi->getIncomingValue(LatchIdx); if (getLoopPhiForCounter(IncV, L, DT) != Phi) continue; const SCEV *Init = AR->getStart(); if (BestPhi && !AlmostDeadIV(BestPhi, LatchBlock, Cond)) { // Don't force a live loop counter if another IV can be used. if (AlmostDeadIV(Phi, LatchBlock, Cond)) continue; // Prefer to count-from-zero. This is a more "canonical" counter form. It // also prefers integer to pointer IVs. if (BestInit->isZero() != Init->isZero()) { if (BestInit->isZero()) continue; } // If two IVs both count from zero or both count from nonzero then the // narrower is likely a dead phi that has been widened. Use the wider phi // to allow the other to be eliminated. if (PhiWidth <= SE->getTypeSizeInBits(BestPhi->getType())) continue; } BestPhi = Phi; BestInit = Init; } return BestPhi; } /// genLoopLimit - Help LinearFunctionTestReplace by generating a value that /// holds the RHS of the new loop test. static Value *genLoopLimit(PHINode *IndVar, const SCEV *IVCount, Loop *L, SCEVExpander &Rewriter, ScalarEvolution *SE) { const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SE->getSCEV(IndVar)); assert(AR && AR->getLoop() == L && AR->isAffine() && "bad loop counter"); const SCEV *IVInit = AR->getStart(); // IVInit may be a pointer while IVCount is an integer when FindLoopCounter // finds a valid pointer IV. Sign extend BECount in order to materialize a // GEP. Avoid running SCEVExpander on a new pointer value, instead reusing // the existing GEPs whenever possible. if (IndVar->getType()->isPointerTy() && !IVCount->getType()->isPointerTy()) { Type *OfsTy = SE->getEffectiveSCEVType(IVInit->getType()); const SCEV *IVOffset = SE->getTruncateOrSignExtend(IVCount, OfsTy); // Expand the code for the iteration count. assert(SE->isLoopInvariant(IVOffset, L) && "Computed iteration count is not loop invariant!"); BranchInst *BI = cast<BranchInst>(L->getExitingBlock()->getTerminator()); Value *GEPOffset = Rewriter.expandCodeFor(IVOffset, OfsTy, BI); Value *GEPBase = IndVar->getIncomingValueForBlock(L->getLoopPreheader()); assert(AR->getStart() == SE->getSCEV(GEPBase) && "bad loop counter"); // We could handle pointer IVs other than i8*, but we need to compensate for // gep index scaling. See canExpandBackedgeTakenCount comments. assert(SE->getSizeOfExpr( cast<PointerType>(GEPBase->getType())->getElementType())->isOne() && "unit stride pointer IV must be i8*"); IRBuilder<> Builder(L->getLoopPreheader()->getTerminator()); return Builder.CreateGEP(GEPBase, GEPOffset, "lftr.limit"); } else { // In any other case, convert both IVInit and IVCount to integers before // comparing. This may result in SCEV expension of pointers, but in practice // SCEV will fold the pointer arithmetic away as such: // BECount = (IVEnd - IVInit - 1) => IVLimit = IVInit (postinc). // // Valid Cases: (1) both integers is most common; (2) both may be pointers // for simple memset-style loops; (3) IVInit is an integer and IVCount is a // pointer may occur when enable-iv-rewrite generates a canonical IV on top // of case #2. const SCEV *IVLimit = 0; // For unit stride, IVCount = Start + BECount with 2's complement overflow. // For non-zero Start, compute IVCount here. if (AR->getStart()->isZero()) IVLimit = IVCount; else { assert(AR->getStepRecurrence(*SE)->isOne() && "only handles unit stride"); const SCEV *IVInit = AR->getStart(); // For integer IVs, truncate the IV before computing IVInit + BECount. if (SE->getTypeSizeInBits(IVInit->getType()) > SE->getTypeSizeInBits(IVCount->getType())) IVInit = SE->getTruncateExpr(IVInit, IVCount->getType()); IVLimit = SE->getAddExpr(IVInit, IVCount); } // Expand the code for the iteration count. BranchInst *BI = cast<BranchInst>(L->getExitingBlock()->getTerminator()); IRBuilder<> Builder(BI); assert(SE->isLoopInvariant(IVLimit, L) && "Computed iteration count is not loop invariant!"); // Ensure that we generate the same type as IndVar, or a smaller integer // type. In the presence of null pointer values, we have an integer type // SCEV expression (IVInit) for a pointer type IV value (IndVar). Type *LimitTy = IVCount->getType()->isPointerTy() ? IndVar->getType() : IVCount->getType(); return Rewriter.expandCodeFor(IVLimit, LimitTy, BI); } } /// LinearFunctionTestReplace - This method rewrites the exit condition of the /// loop to be a canonical != comparison against the incremented loop induction /// variable. This pass is able to rewrite the exit tests of any loop where the /// SCEV analysis can determine a loop-invariant trip count of the loop, which /// is actually a much broader range than just linear tests. Value *IndVarSimplify:: LinearFunctionTestReplace(Loop *L, const SCEV *BackedgeTakenCount, PHINode *IndVar, SCEVExpander &Rewriter) { assert(canExpandBackedgeTakenCount(L, SE) && "precondition"); // LFTR can ignore IV overflow and truncate to the width of // BECount. This avoids materializing the add(zext(add)) expression. Type *CntTy = BackedgeTakenCount->getType(); const SCEV *IVCount = BackedgeTakenCount; // If the exiting block is the same as the backedge block, we prefer to // compare against the post-incremented value, otherwise we must compare // against the preincremented value. Value *CmpIndVar; if (L->getExitingBlock() == L->getLoopLatch()) { // Add one to the "backedge-taken" count to get the trip count. // If this addition may overflow, we have to be more pessimistic and // cast the induction variable before doing the add. const SCEV *N = SE->getAddExpr(IVCount, SE->getConstant(IVCount->getType(), 1)); if (CntTy == IVCount->getType()) IVCount = N; else { const SCEV *Zero = SE->getConstant(IVCount->getType(), 0); if ((isa<SCEVConstant>(N) && !N->isZero()) || SE->isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, N, Zero)) { // No overflow. Cast the sum. IVCount = SE->getTruncateOrZeroExtend(N, CntTy); } else { // Potential overflow. Cast before doing the add. IVCount = SE->getTruncateOrZeroExtend(IVCount, CntTy); IVCount = SE->getAddExpr(IVCount, SE->getConstant(CntTy, 1)); } } // The BackedgeTaken expression contains the number of times that the // backedge branches to the loop header. This is one less than the // number of times the loop executes, so use the incremented indvar. CmpIndVar = IndVar->getIncomingValueForBlock(L->getExitingBlock()); } else { // We must use the preincremented value... IVCount = SE->getTruncateOrZeroExtend(IVCount, CntTy); CmpIndVar = IndVar; } Value *ExitCnt = genLoopLimit(IndVar, IVCount, L, Rewriter, SE); assert(ExitCnt->getType()->isPointerTy() == IndVar->getType()->isPointerTy() && "genLoopLimit missed a cast"); // Insert a new icmp_ne or icmp_eq instruction before the branch. BranchInst *BI = cast<BranchInst>(L->getExitingBlock()->getTerminator()); ICmpInst::Predicate P; if (L->contains(BI->getSuccessor(0))) P = ICmpInst::ICMP_NE; else P = ICmpInst::ICMP_EQ; DEBUG(dbgs() << "INDVARS: Rewriting loop exit condition to:\n" << " LHS:" << *CmpIndVar << '\n' << " op:\t" << (P == ICmpInst::ICMP_NE ? "!=" : "==") << "\n" << " RHS:\t" << *ExitCnt << "\n" << " IVCount:\t" << *IVCount << "\n"); IRBuilder<> Builder(BI); if (SE->getTypeSizeInBits(CmpIndVar->getType()) > SE->getTypeSizeInBits(ExitCnt->getType())) { CmpIndVar = Builder.CreateTrunc(CmpIndVar, ExitCnt->getType(), "lftr.wideiv"); } Value *Cond = Builder.CreateICmp(P, CmpIndVar, ExitCnt, "exitcond"); Value *OrigCond = BI->getCondition(); // It's tempting to use replaceAllUsesWith here to fully replace the old // comparison, but that's not immediately safe, since users of the old // comparison may not be dominated by the new comparison. Instead, just // update the branch to use the new comparison; in the common case this // will make old comparison dead. BI->setCondition(Cond); DeadInsts.push_back(OrigCond); ++NumLFTR; Changed = true; return Cond; } //===----------------------------------------------------------------------===// // SinkUnusedInvariants. A late subpass to cleanup loop preheaders. //===----------------------------------------------------------------------===// /// If there's a single exit block, sink any loop-invariant values that /// were defined in the preheader but not used inside the loop into the /// exit block to reduce register pressure in the loop. void IndVarSimplify::SinkUnusedInvariants(Loop *L) { BasicBlock *ExitBlock = L->getExitBlock(); if (!ExitBlock) return; BasicBlock *Preheader = L->getLoopPreheader(); if (!Preheader) return; Instruction *InsertPt = ExitBlock->getFirstInsertionPt(); BasicBlock::iterator I = Preheader->getTerminator(); while (I != Preheader->begin()) { --I; // New instructions were inserted at the end of the preheader. if (isa<PHINode>(I)) break; // Don't move instructions which might have side effects, since the side // effects need to complete before instructions inside the loop. Also don't // move instructions which might read memory, since the loop may modify // memory. Note that it's okay if the instruction might have undefined // behavior: LoopSimplify guarantees that the preheader dominates the exit // block. if (I->mayHaveSideEffects() || I->mayReadFromMemory()) continue; // Skip debug info intrinsics. if (isa<DbgInfoIntrinsic>(I)) continue; // Skip landingpad instructions. if (isa<LandingPadInst>(I)) continue; // Don't sink alloca: we never want to sink static alloca's out of the // entry block, and correctly sinking dynamic alloca's requires // checks for stacksave/stackrestore intrinsics. // FIXME: Refactor this check somehow? if (isa<AllocaInst>(I)) continue; // Determine if there is a use in or before the loop (direct or // otherwise). bool UsedInLoop = false; for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE; ++UI) { User *U = *UI; BasicBlock *UseBB = cast<Instruction>(U)->getParent(); if (PHINode *P = dyn_cast<PHINode>(U)) { unsigned i = PHINode::getIncomingValueNumForOperand(UI.getOperandNo()); UseBB = P->getIncomingBlock(i); } if (UseBB == Preheader || L->contains(UseBB)) { UsedInLoop = true; break; } } // If there is, the def must remain in the preheader. if (UsedInLoop) continue; // Otherwise, sink it to the exit block. Instruction *ToMove = I; bool Done = false; if (I != Preheader->begin()) { // Skip debug info intrinsics. do { --I; } while (isa<DbgInfoIntrinsic>(I) && I != Preheader->begin()); if (isa<DbgInfoIntrinsic>(I) && I == Preheader->begin()) Done = true; } else { Done = true; } ToMove->moveBefore(InsertPt); if (Done) break; InsertPt = ToMove; } } //===----------------------------------------------------------------------===// // IndVarSimplify driver. Manage several subpasses of IV simplification. //===----------------------------------------------------------------------===// bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) { // If LoopSimplify form is not available, stay out of trouble. Some notes: // - LSR currently only supports LoopSimplify-form loops. Indvars' // canonicalization can be a pessimization without LSR to "clean up" // afterwards. // - We depend on having a preheader; in particular, // Loop::getCanonicalInductionVariable only supports loops with preheaders, // and we're in trouble if we can't find the induction variable even when // we've manually inserted one. if (!L->isLoopSimplifyForm()) return false; LI = &getAnalysis<LoopInfo>(); SE = &getAnalysis<ScalarEvolution>(); DT = &getAnalysis<DominatorTree>(); TD = getAnalysisIfAvailable<TargetData>(); DeadInsts.clear(); Changed = false; // If there are any floating-point recurrences, attempt to // transform them to use integer recurrences. RewriteNonIntegerIVs(L); const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L); // Create a rewriter object which we'll use to transform the code with. SCEVExpander Rewriter(*SE, "indvars"); #ifndef NDEBUG Rewriter.setDebugType(DEBUG_TYPE); #endif // Eliminate redundant IV users. // // Simplification works best when run before other consumers of SCEV. We // attempt to avoid evaluating SCEVs for sign/zero extend operations until // other expressions involving loop IVs have been evaluated. This helps SCEV // set no-wrap flags before normalizing sign/zero extension. Rewriter.disableCanonicalMode(); SimplifyAndExtend(L, Rewriter, LPM); // Check to see if this loop has a computable loop-invariant execution count. // If so, this means that we can compute the final value of any expressions // that are recurrent in the loop, and substitute the exit values from the // loop into any instructions outside of the loop that use the final values of // the current expressions. // if (!isa<SCEVCouldNotCompute>(BackedgeTakenCount)) RewriteLoopExitValues(L, Rewriter); // Eliminate redundant IV cycles. NumElimIV += Rewriter.replaceCongruentIVs(L, DT, DeadInsts); // If we have a trip count expression, rewrite the loop's exit condition // using it. We can currently only handle loops with a single exit. if (canExpandBackedgeTakenCount(L, SE) && needsLFTR(L, DT)) { PHINode *IndVar = FindLoopCounter(L, BackedgeTakenCount, SE, DT, TD); if (IndVar) { // Check preconditions for proper SCEVExpander operation. SCEV does not // express SCEVExpander's dependencies, such as LoopSimplify. Instead any // pass that uses the SCEVExpander must do it. This does not work well for // loop passes because SCEVExpander makes assumptions about all loops, while // LoopPassManager only forces the current loop to be simplified. // // FIXME: SCEV expansion has no way to bail out, so the caller must // explicitly check any assumptions made by SCEV. Brittle. const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(BackedgeTakenCount); if (!AR || AR->getLoop()->getLoopPreheader()) (void)LinearFunctionTestReplace(L, BackedgeTakenCount, IndVar, Rewriter); } } // Clear the rewriter cache, because values that are in the rewriter's cache // can be deleted in the loop below, causing the AssertingVH in the cache to // trigger. Rewriter.clear(); // Now that we're done iterating through lists, clean up any instructions // which are now dead. while (!DeadInsts.empty()) if (Instruction *Inst = dyn_cast_or_null<Instruction>(&*DeadInsts.pop_back_val())) RecursivelyDeleteTriviallyDeadInstructions(Inst); // The Rewriter may not be used from this point on. // Loop-invariant instructions in the preheader that aren't used in the // loop may be sunk below the loop to reduce register pressure. SinkUnusedInvariants(L); // Clean up dead instructions. Changed |= DeleteDeadPHIs(L->getHeader()); // Check a post-condition. assert(L->isLCSSAForm(*DT) && "Indvars did not leave the loop in lcssa form!"); // Verify that LFTR, and any other change have not interfered with SCEV's // ability to compute trip count. #ifndef NDEBUG if (VerifyIndvars && !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) { SE->forgetLoop(L); const SCEV *NewBECount = SE->getBackedgeTakenCount(L); if (SE->getTypeSizeInBits(BackedgeTakenCount->getType()) < SE->getTypeSizeInBits(NewBECount->getType())) NewBECount = SE->getTruncateOrNoop(NewBECount, BackedgeTakenCount->getType()); else BackedgeTakenCount = SE->getTruncateOrNoop(BackedgeTakenCount, NewBECount->getType()); assert(BackedgeTakenCount == NewBECount && "indvars must preserve SCEV"); } #endif return Changed; }
Complete Collection of 101 Insider Secrets That Show You How To Instantly and Positively Enhance your Career for Only $20. Tory Johnson, Laura DeCarlo, Brian Tracy, Charlotte Weeks and many more of the World's Leading Experts have joined together to give you the most amazing, proven, and simple ways to immediately improve your career. ...and you can get all of these 101 career enhancing secrets for less than 20 cents each! You are going to also receive -- absolutely free -- over $600 worth of quality bonuses, an instant benefit for just purchasing one print copy of this inspiring book. In “101 Great Ways to Enhance Your Career”, our experts will encourage, inspire and guide you on your path to procure, maintain and actualize your career objectives. We are fortunate to have so many collaborative authors to share expertise, impart wisdom and entertain us with relative anecdotes. In 101 Great Ways to Enhance Your Career, we have compiled a thoughtful collection of 101 unique chapters from some of the industry’s leading experts. Our experts are varied with impressive backgrounds and credentials from previously published authors and television personalities to coaches, business owners and heads of associations. They are all stellar educators who have shared information on topics that are personally relevant and hope to inspire and motivate their readers. Our mission in bringing to you 101 Great Ways to Enhance Your Career is that you will find chapters that speak to you on a personal level and can use what you find to enhance your career or someone else’s. · You can create a fabulous résumé and sell yourself in a difficult job-market. · You can identify and act upon opportunities for change. · You can fuel your own success. · You can learn the most effective job search strategies. We have organized this book by topic to simplify the information-gathering process. If you are looking for information on Job Searching, just go to the table of contents, locate the corresponding page numbers and start reading! If you are seeking tips on how to ace the next interview or leadership skills that will help you to succeed, it’s all right there. We tried to make it simple and hope you find this book easy to navigate. 101 Great Ways to Enhance Your Career is designed for a broad audience ranging from the recent college graduate to the retired professional seeking a second career. It is a clear, concise menu of information to choose from, featuring many of the industry’s top experts. "It's like buying an entire bookstore for the price of just one book. This is the ultimate career and job finding manual." "The breadth of knowledge in this book is astounding. Every day I can pick up this book and within 10 minutes learn something new to help me with my career." The US economy shed 8.4 million jobs in the last recession. Whether your position was directly affected by a layoff, or you watched as your colleagues were laid off, many questioned "Am I prepared?" Regardless of your age, position or educational background, learn why lifetime learning is critical in this unstable environment. So, are you ready for 101 winning strategies that you can use while sitting in your most comfortable chair as you discover everything you need to know to enhance your career? If you want success, now is the time to go for it -- we've made this offer so extraordinary that it is likely going to be a "no brainer" decision. Where else can you get this much wisdom and bonus value wrapped up in an offering for less than $20? Actually, if you put a price tag on the bonuses alone, you would probably see a value of $1,500!!! And all of it is thrown in when you grab just one copy of 101 Great Ways to Enhance Your Career. If you are serious about making positive improvements in your career, now is the time. We highly urge you to take advantage of this offer now, before it is gone. And remember, we are so confident that you'll love it that we're backing it up with our own personal guarantee. If for any reason (or no reason), you decide this book isn't right for you, just mail it back to us within the next 30 days, and we'll buy it back from you for every penny you paid. Go and get yours right away and you'll receive the clear instructions to access over $1,500.00 worth of value waiting for you. P.S. Just think! You'll have access to 101 of the greatest secrets gleaned from top experts in the career industry. All of this will be handed to you on a silver platter, wrapped up with $1,500 worth of free bonus gifts! This is a Limited Time Offer. Act today and start enhancing your career.
package com.hrenic.popularmovies.util; import android.app.Application; import android.support.annotation.NonNull; import android.util.Log; import com.raizlabs.android.dbflow.config.FlowConfig; import com.raizlabs.android.dbflow.config.FlowManager; import com.squareup.leakcanary.LeakCanary; /** * Used for application initialization */ public class Initializer { private static final String TAG = Initializer.class.getSimpleName(); public static void init(@NonNull Application application) { FlowManager.init(new FlowConfig.Builder(application).build()); if (!LeakCanary.isInAnalyzerProcess(application)) { LeakCanary.install(application); } Log.d(TAG, "Initialization done"); } }
Pre-Rec continuously stores in standby mode up to 4 seconds of MOV/MP4 video and 3 seconds of AVCHD video, and this pre-record cache is only recorded to the P2 card once you press Record. This helps you get the shot every time, even if you "miss" the crucial moment by a couple seconds. Interval Rec gives you automatic intermittent recording based on a set interval and recording time (1 sec, 10 sec, 30 sec, 1 min, 2 min) only in 1080/24p. Rec Check checks the beginning and end of the last recorded clip. If you don′t like it, Last Clip Delete enables one-button delete of that last clip. Scenes can be marked with up to 100 Index flags per clip (AVCHD mode only). Time Stamp appends the date and time onto recorded images, which is a crucial feature for evidential images. The AG-UX90′s color EVF uses a 0.45", approximately 1,560,000 dot-equivalent LCD display. It delivers bright, detailed, high-resolution images and a high response speed. The AG-UX90′s LCD monitor has a 3.5", approximately 1,150,000-dot high-resolution panel. Various markers and grids can be displayed on the monitor/viewfinder, and with Mode Check, a list of the camera′s settings can also be displayed on the viewfinder and monitor.
Kirti Devi is a Municipal Finance Specialist and provides sector level technical guidance and due diligence for programs and activities under PPIAF’s Sub-National Technical Assistance (SNTA) Program. Before joining the World Bank, she worked for international development firms in the U.S., and for the USAID-funded Financial Institutions Reform and Expansion Project in India, on sub-national finance for water and sanitation, affordable housing, energy efficiency, and urban development. Kirti holds a Master of Planning from the Center for Environmental Planning and Technology, India, and a Master of Business Administration from Georgetown University.
For Instant Rate quote: click on Book now, the orange button and then fill out the first page with your full pickup address and your full drop address then click on “Show rate”. This will give you prices on different cars we have available for your run. 2. We provide Cold water for all our airport runs for our customers.
The GrowLab® Horticultural Grow Room has all the features you could ask for - and more! Outfit the GrowLab® with the ventilation fan, lighting system and growing system of your choice and you will have the brightest, slickest, most affordable grow room available. Introducing the next generation in portable grow rooms - The GrowLab® Horticultural Grow Room. See more details on the next page. Here are just some of the unique and exciting features you won't find elsewhere. Clear viewing windows on all models except GL40, GL60, GL240, & GL290. Increased weight capacity with roof cross-members easily support 100 pounds. Sturdy powder coated framework helps protect against rust and gives a cleaner look; thicker than previous models. Highly reflective interior for significant increase in reflectivity for improved lighting performance. Thermally protected tent material reflects 97% of all radiant heat for superior insulation. Completely non-toxic, will not react under light and heat, and no off-gassing to harm plants. Improved fabric with thicker fabric than previous models, and includes the best zippers on the market. Moveable roof cross-members that easily adjust lighting and accessories; pieces snap into desired place for better functionality. Multiple intake/exhaust ports including two ports opposite each other at reflector level for air-cooling of lighting system on most models. Adjustable fan and ducting attachments, so no more clamps or reducers needed! Waterproof floor features a second floor that is removable for easy cleaning between crops.
Dr. Henry N. Ho serves as the Co-Director of the Head and Neck Program of the AdventHealth Cancer Institute. His practice includes all aspects of otolaryngology with special emphasis on head and neck tumors. He is board certified by the American Board of Otolaryngology – Head and Neck Surgery and is a fellow of the American Academy of Otolaryngology – Head and Neck Surgery, the American College of Surgeons and the American Head and Neck Society. Dr. Ho is a member of the American Medical Association, the Florida Society of Otolaryngology – Head & Neck Surgery and the Orange County Medical Society. Dr. Ho serves as an associate professor for the University of Central Florida Medical School. He is also a clinical faculty member at the Florida State University College of Medicine.
For last year's Tour de Fleece, I developed four limited edition colourways based on the course taken by the peloton over the course of the three weeks of the Tour de France. The process of finding parts of the race to highlight and working up the colours was a real jump start to my creative process, and I have been looking forward to this year's batch of colourways ever since! As with last year, I've sourced a special French base for these colourways - Merino d'Arles. This breed of sheep is from the Provence region of France, and is descended from the first Spanish Merinos imported to the country in 1786, which were then crossed with the local breed in Arles. The resulting sheep are small and sturdy, well able to cope with tough living conditions in the plains and in the mountains, and they produce a fine, bulky wool. The average micron count for the fibre is 20-21 microns (very fine!), but it tends to be on the shorter side of staple length, at approximately 3 inches. It is very, very crimpy, and can be spun to a range of finished yarn weights. I spun up a few samples of this fibre as I was working out the colours, and it reminds me of Targhee or Portugeuse Merino. In other words, it is more interesting to spin (in my opinion) then your typical, run-of-the-mill Merino, as it has a nice toothy feel and isn't super slippery. The final yarn is super bouncy and springy - perfect for hats or sweaters! I think this fibre will also give phenomenal stitch definition, due to its elasticity. On to the first colourway: this one is inspired by Stage 4, which passes through the Loire Valley, where many of the grapes produced end up as gorgeous Rosé wine. After last year's Gamay colourway, I definitely wanted to do another wine-inspired version for this year's Tour de Fleece. This one, instead of being inspired by a particular grape, is instead taken from the soft pinks of the finished product. This colourway blends pinks, browns and tans with a special dyeing technique to get a particularly dappled appearance to the dyed fibre, and will spin up as a lovely semi-solid yarn. Similar to last year, these colourways are only going to be available for a limited time. Starting with the next shop update, on 14th May at 10:00 am, you can order your limited edition colourways up until the start of the Tour de France/Tour de Fleece on Saturday, 2 July. There will also be a Porpoise Fur Tour de Fleece team on the Ravelry board, so please come join us in spinning up a storm in July!
/* * Copyright (C) 2017 Synacts GmbH, Switzerland ([email protected]) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.digitalid.utility.validation.annotations.substring; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.annotation.Nonnull; import net.digitalid.utility.annotations.method.Pure; import net.digitalid.utility.validation.annotations.meta.ValueValidator; import net.digitalid.utility.validation.annotations.type.Stateless; import net.digitalid.utility.validation.validators.SubstringValidator; /** * This annotation indicates that the annotated string or file contains the given string. */ @Documented @Target({ElementType.TYPE_USE, ElementType.PARAMETER, ElementType.METHOD, ElementType.FIELD, ElementType.LOCAL_VARIABLE}) @Retention(RetentionPolicy.RUNTIME) @ValueValidator(Infix.Validator.class) public @interface Infix { /* -------------------------------------------------- Value -------------------------------------------------- */ /** * Returns the string which the annotated string contains. */ @Nonnull String value(); /* -------------------------------------------------- Validator -------------------------------------------------- */ /** * This class checks the use of and generates the contract for the surrounding annotation. */ @Stateless public static class Validator extends SubstringValidator { @Pure @Override public @Nonnull String getMethodName() { return "contains"; } @Pure @Override public @Nonnull String getMessageCondition() { return "contain"; } } }
import json from status.util import SafeHandler from genologics.config import BASEURI, USERNAME, PASSWORD from genologics import lims from genologics.entities import Udfconfig, Project as LIMSProject lims = lims.Lims(BASEURI, USERNAME, PASSWORD) class DeliveriesPageHandler(SafeHandler): def post(self): project_id = self.get_argument('project_id', '') responsible = self.get_argument('responsible', '') if not project_id or not responsible: self.set_status(400) self.write('no project_id or bioinfo_responsible') return lims_project = LIMSProject(lims, id=project_id) if not lims_project: self.set_status(400) self.write('lims project not found: {}'.format(project_id)) return project_name = lims_project.name stepname=['Project Summary 1.3'] processes=lims.get_processes(type=stepname, projectname=project_name) if processes == []: error = "{} for {} is not available in LIMS.".format(stepname, limsproject) self.set_status(400) self.write(error) return for process in processes: process.get(force=True) process.udf['Bioinfo responsible'] = responsible try: process.put() except Exception, e: # still try to update everything # but will print error anyway self.set_status(400) self.write(e.message) continue # update status db # if lims was not updated, after a while this change will be discarded doc_id = None view = self.application.projects_db.view("project/project_id") for row in view[project_id]: doc_id = row.value break if doc_id == None: self.set_status(400) self.write('Status DB has not been updated: project not found') return doc=self.application.projects_db.get(doc_id) doc['project_summary']['bioinfo_responsible'] = responsible if responsible != 'unassigned' else None try: self.application.projects_db.save(doc) except Exception, e: self.set_status(400) self.write(e.message) self.set_status(201) self.write({'success': 'success!!'}) def get(self): # get project summary data summary_view = self.application.projects_db.view('project/summary') summary_data = {} for project in summary_view: # todo: check if this one works if project.key[0] != 'closed': project_id = project.key[1] summary_data[project_id] = project.value # wtf don't they return json or anything normal bioinfo_data_view = self.application.bioinfo_db.view("latest_data/sample_id_open") bioinfo_data = {} ongoing_deliveries = {} # make a normal dict from the view result for row in bioinfo_data_view.rows: project_id = row.key[0] flowcell_id = row.key[1] lane_id = row.key[2] sample_id = row.key[3] if project_id not in ongoing_deliveries and project_id in summary_data: ongoing_deliveries[project_id] = {} # project_id, lane_id, sample_id, flowcell_id = row.key if project_id not in bioinfo_data: bioinfo_data[project_id] = {flowcell_id: {lane_id: {sample_id: row.value}}} elif flowcell_id not in bioinfo_data[project_id]: bioinfo_data[project_id][flowcell_id] = {lane_id: {sample_id: row.value}} elif lane_id not in bioinfo_data[project_id][flowcell_id]: bioinfo_data[project_id][flowcell_id][lane_id] = {sample_id: row.value} elif sample_id not in bioinfo_data[project_id][flowcell_id][lane_id]: bioinfo_data[project_id][flowcell_id][lane_id][sample_id] = row.value else: bioinfo_data[project_id][flowcell_id][lane_id].update({sample_id: row.value}) all_running_notes = {} projects_to_be_closed = 0 ongoing_projects = 0 number_of_flowcells = 0 number_of_lanes = 0 number_of_samples = 0 status_list = {} project_status = {} responsible_list = {} for project_id in ongoing_deliveries: if project_id in summary_data and project_id in bioinfo_data: project = summary_data[project_id] running_notes = json.loads(project['details']['running_notes']) flowcells = bioinfo_data[project_id] runs_bioinfo = {} for flowcell_id in flowcells: number_of_flowcells += 1 flowcell_statuses = [] flowcell_checklists = {'total': 0, 'completed': 0} for lane_id in flowcells[flowcell_id]: number_of_lanes += 1 lane_statuses = [] lane_checklists = {'total': 0, 'completed': 0} for sample_id in flowcells[flowcell_id][lane_id]: number_of_samples += 1 # define bioinfo checklist sample_data = flowcells[flowcell_id][lane_id][sample_id] checklist = self.__fill_checklist(sample_data) if checklist['total'] and len(checklist['total']) == len(checklist['passed']) + len(checklist['warnings']) + len(checklist['failed']): lane_checklists['completed'] += 1 lane_checklists['total'] += 1 lane_statuses.append(sample_data.get('sample_status')) if flowcell_id not in runs_bioinfo: runs_bioinfo[flowcell_id] = {'lanes': {lane_id: {'samples': {sample_id: {'checklist': checklist, 'status': sample_data.get('sample_status', '?')}}}}} elif lane_id not in runs_bioinfo[flowcell_id]['lanes']: runs_bioinfo[flowcell_id]['lanes'][lane_id] = {'samples': {sample_id: {'checklist': checklist, 'status': sample_data.get('sample_status', '?')}}} elif sample_id not in runs_bioinfo[flowcell_id]['lanes'][lane_id]['samples']: runs_bioinfo[flowcell_id]['lanes'][lane_id]['samples'][sample_id] = {'checklist': checklist, 'status': sample_data.get('sample_status', '?')} else: runs_bioinfo[flowcell_id]['lanes'][lane_id]['samples'][sample_id].update( {'checklist': checklist, 'status': sample_data.get('sample_status', '?')}) if lane_checklists['total'] == lane_checklists['completed']: flowcell_checklists['completed'] += 1 flowcell_checklists['total'] += 1 lane_status = self.__aggregate_status(lane_statuses) runs_bioinfo[flowcell_id]['lanes'][lane_id]['lane_status'] = lane_status runs_bioinfo[flowcell_id]['lanes'][lane_id]['checklist'] = lane_checklists flowcell_statuses.append(lane_status) # the same logic here -> agregate flowcell statuses flowcell_status = self.__aggregate_status(flowcell_statuses) runs_bioinfo[flowcell_id]['flowcell_status'] = flowcell_status runs_bioinfo[flowcell_id]['checklist'] = flowcell_checklists # add flowcell_status to the status_list (needed for filtering) if flowcell_status not in status_list: status_list[flowcell_status] = 0 status_list[flowcell_status] +=1 if project_id not in project_status: project_status[project_id] = [] if flowcell_status not in project_status[project_id]: project_status[project_id].append(flowcell_status) if set(project_status[project_id]) == set(['Delivered']): projects_to_be_closed += 1 else: ongoing_projects += 1 all_running_notes.update(self.__parse_running_notes(running_notes, project_id, runs_bioinfo)) latest_timestamp = max(running_notes.keys()) latest_running_note = running_notes[latest_timestamp] latest_running_note['timestamp'] = latest_timestamp[:-7] # to get rid of milliseconds # responsibles (needed for filters) bioinfo_responsible = summary_data[project_id].get('project_summary', {}).get('bioinfo_responsible') or 'unassigned' if bioinfo_responsible not in responsible_list: responsible_list[bioinfo_responsible] = 0 responsible_list[bioinfo_responsible] += 1 project_data = { 'project_name': summary_data[project_id]['project_name'], 'application': summary_data[project_id].get('application', 'unknown'), 'type': summary_data[project_id]['details'].get('type'), 'bioinfo_responsible': bioinfo_responsible, 'runs': runs_bioinfo, 'latest_running_note': latest_running_note, } else: project_data = { 'error': 'could not find project information for {}'.format(project_id) } ongoing_deliveries[project_id].update(project_data) try: lims_responsibles = ['unassigned'] + sorted(Udfconfig(lims, id="1128").presets) except Exception, e: lims_responsibles = ['unassigned'] + sorted(responsible_list) template = self.application.loader.load("deliveries.html") self.write(template.generate(gs_globals=self.application.gs_globals, deliveries=ongoing_deliveries, running_notes=all_running_notes, ongoing_projects=ongoing_projects, projects_to_be_closed=projects_to_be_closed, number_of_flowcells=number_of_flowcells, number_of_lanes=number_of_lanes, number_of_samples=number_of_samples, status_list=status_list, project_status=project_status, responsible_list=responsible_list, lims_responsibles=lims_responsibles, )) def __aggregate_status(self, list_of_statuses): """ helper method. aggregates status of parent entry """ if len(set(list_of_statuses)) == 1: status = list_of_statuses[0] elif 'New' in list_of_statuses: status = 'New' elif 'Sequencing' in list_of_statuses: status = 'Sequencing' elif 'Demultiplexing' in list_of_statuses: status = 'Demultiplexing' elif 'Transferring' in list_of_statuses: status = 'Transferring' elif 'QC-ongoing' in list_of_statuses: status = 'QC-ongoing' elif 'QC-done' in list_of_statuses: status = 'QC-done' elif 'BP-ongoing' in list_of_statuses: status = 'BP-ongoing' elif 'BP-done' in list_of_statuses: status = 'BP-done' elif 'ERROR' in list_of_statuses: status = 'ERROR' else: # should not happen status = '' return status def __fill_checklist(self, sample_data): """ helper method to create a progress bar checklist """ checklist = { 'passed': [], 'warnings': [], 'failed': [], 'total': [], } qc_and_bp = {} for key in sample_data.get('qc', {}).keys(): checklist['total'].append(key) qc_and_bp[key] = sample_data['qc'][key] for key in sample_data.get('bp', {}).keys(): checklist['total'].append(key) qc_and_bp[key] = sample_data['bp'][key] for key in qc_and_bp.keys(): if qc_and_bp[key] == 'Pass': checklist['passed'].append(key) elif qc_and_bp[key] == 'Warning': checklist['warnings'].append(key) elif qc_and_bp[key] == 'Fail': checklist['failed'].append(key) # don't count 'N/A' elif qc_and_bp[key] == 'N/A': checklist['total'].remove(key) # else: do not do anything if '?' or anything else return checklist def __parse_running_notes(self, running_notes, project_id, runs_bioinfo): # # parse running notes all_running_notes = {} for timestamp, running_note in running_notes.items(): # define the level of the running_note note_level = [project_id] # to remove run, lane and sample id from the running note note = running_note['note'] # ':::' is added in js, when saving running note # ':::' separates run_id, lane_id and sample_id from running note if '::: ' in running_note['note']: # in case if ':::' occurs more than 1 time (it must occur at least once, because of if) note = ':::'.join([item for item in note.split(':::')[1:]]) run_lane_sample = running_note['note'].split(':::')[0] run_lane_sample = run_lane_sample.split() # the key becomes [project_id, run_id, lane, sample_id] note_level += run_lane_sample bioinfo_level = {} try: # can be ValueError -> if we are on the wrong level (too many values to unpack) project_id, run_id, lane_id, sample_id = note_level # or KeyError -> if we are trying to access a value which does not exist in runs_bioinfo bioinfo_level = runs_bioinfo[run_id]['lanes'][lane_id]['samples'][sample_id] except (KeyError, ValueError): # -> too many values try: project_id, run_id, lane_id = note_level bioinfo_level = runs_bioinfo[run_id]['lanes'][lane_id] except (KeyError, ValueError): # still too many values try: project_id, run_id = note_level bioinfo_level = runs_bioinfo[run_id] except (KeyError, ValueError): # again too many # now whatever happens, we put the running note on the project level pass if bioinfo_level: if not 'latest_running_note' in bioinfo_level or timestamp > bioinfo_level['latest_running_note']['timestamp']: # .copy() is needed in order to modify running note without changing it on the project level bioinfo_level['latest_running_note'] = running_note.copy() # remove run, lane and sample id from the running_note bioinfo_level['latest_running_note']['note'] = note bioinfo_level['latest_running_note']['timestamp'] = timestamp if project_id not in all_running_notes: all_running_notes[project_id] = {} all_running_notes[project_id][timestamp] = running_note return all_running_notes
We want to inspire our children and their families to discover and reach their full potential. We believe in creating experiences and a culture that inspires our students to have an unquenchable thirst and love for lifelong learning. We provide high expectations, attention, and support for each and every student. In too many instances, our students are required to fit a system or setting that doesn’t truly address their specific needs and strengths. We make sure no student is ignored, overlooked, or gets left behind. All students have individual needs, desires, and gifts. We recognize their unique qualities and strive to help our students discover their passion and purpose by honoring their difficulties without becoming defined by them and identifying and building upon their existing and developing strengths. To be the world-class learning community that helps every child in our country to reach their full potential and leave the world a better place. We set the new standard for education in our country. The Novus Academy provides innovative, creative, and experiential educational programming within a culture that inspires confidence, respect, and self-worth. The Novus Academy is a creative, innovative, vibrant, independent school for bright students with learning differences, high achieving students with cognitive difficulties, and students with high cognitive abilities and above average academic performance. Our students benefit from evidence-based, high-quality, comprehensive, and meaningful educational programming. The Novus Academy transforms the lives of students, their families, and their communities by preparing them to be self-advocates and problem-solvers through innovative learning programs, supportive interactions with faculty, staff, and students, exemplary scholarship, and purposeful service to others. The Novus Academy students are prepared and empowered to apply their acquired skills and knowledge, to rely on their personal attributes to confidently lead productive lives, and to become contributing members of the global community. All students deserve, and we will provide, a healthy, safe and secure learning environment. All students’ deserve programs that balance student’s needs and interests, resulting in high levels of student engagement, achievement, and success. All students are provided with opportunities to showcase their talents, explore their affinities, develop and enhance work-ethic, and will learn to persevere and overcome obstacles. All students are diverse and unique. When students are empowered and held accountable, self-concept can increase. When self-concept increases, student performance is enhanced. All students’ experiences and perspectives are assets that reflect the strength of our school and the values of our community. Such assets, when respected, nurtured and explored, promote their academic success and the success of their peers. All students thrive in a positive, creative, innovative, and stimulating learning and working environment. All employees excel in a culture actively supported by professional development opportunities. Highly-trained, highly-valued teachers and staff are pivotal to the continuous improvement and success of our students.
costs incurred after a capital expenditure decision has been implemented and facilities acquired. These costs may include training, maintenance and the cost of upgrades. post purchase costs. InvestorGuide.com. WebFinance, Inc. http://www.investorguide.com/definition/post-purchase-costs.html (access:April 24, 2019).
Can all metals be engraved? Some metal surfaces, especially inexpensive silver-plated gifts, have impurities on the core metal before they are plated. If the impurities are not removed properly before the plating process begins, the silver does not create a solid bond to the core metal. This is often impossible to see before engraving. Once the engraver hits an impure bond, the plating can flake up and fall off. This rarely happens but it is possible. If you are unsure, bring your item in so we can advise you on the best approach. What types of materials are you able to engrave? We can engrave on wood, brass, aluminum, pewter, acrylic and plastic. If you have something you’d like engraved, bring it by our shop and we’ll take a look for you.
Aston Martin has released the first details of to the naturally aspirated V12 engine that will power the upcoming Valkyrie hypercar. Developed by Cosworth, the new powerplant has to meet 'a simple, yet extraordinary brief' - to be the ultimate repression of the internal combustion engine. And at first glance, it appears Cosworth have done just that. The 6.5-litres V12 has a certified peak power output of 1000bhp (or 153.8 bhp-per-litre) at 10,500rpm, before continuing on to a maximum rpm figure of 11,100, numbers that are unprecedented for a naturally-aspirated, emissions-compliant road car. Peak torque is 740Nm at 7,000rpm. Aston Martin Valkyrie’s performance figures will be further boosted by a battery hybrid system, details of which will be revealed later. Aside from major castings - namely the block, cylinder heads, sump and structural cam covers - the majority of the engine’s internal components are machined from solid material. These include Titanium conrods and F1-spec pistons. The result is an engine that weighs just 206kg. In comparison, Cosworth’s last 3.0 litre V10 F1 engines weighed 97Kg. Cosworth say if the same unit was scaled up to 6.5 litres the same F1 engine would weigh 210kg. Bruce Wood, Cosworth Managing Director, said of the project said the naturally aspirated V12 engine is an immense source of pride for Cosworth. "When we started talking about specifics of power, weight, emissions compliance and durability combined with ever harder and sometimes conflicting targets, we knew this would be a challenge like no other," said Wood. Performance of 1000hp (before hybrid aids) and a 11,000rpm soundtrack isn't the only way the Aston Marin Valkyrie will shake up they hypercar, according to Cosworth. Unlike the powerplant in every other hypercar, the Cosworth V12 looks set to perform well into its life without the need of some serious mechanical work. Speaking with Car and Driver, Cosworth managing director Bruce Wood said that the naturally-aspirated V12 should last for at least 100,000km before requiring a rebuild. “Our expectation is that at 100,000 kilometers, (the engine) would be replaced," said Wood. “That’s not to say we think there is going to be a hole through the side of it, but our expectation would be that a lot of the components would be worn out. By comparison, Mercedes-AMG have said the F1-derived hybrid V6 engine in the One hypercar will need a full rebuild or replacement every 50,000 km. We can't wait to hear about the first 100,000km Valkyrie example. Will Tesla's 'Blade Runner' double cab ute look like this? Is this Tesla's new ute?