text:
Q: WsHttpBinding on .Net Core I'm migrating a .Net 4.x project to .Net Core 3.1. This project is heavily dependent on SOAP web services. As .Net Core does not support configuration based WCF service consumption, I call the service by code. Current project uses ws2007HttpBinding binding.
My problem is that ws2007HttpBinding does not exists officially in .Net Core. I have no option other than HttpBinding, HttpsBinding and CustomBinding. I have tried all of them with different configurations, but each time encounter an error. Sometime it complaint about https scheme (service which I am using is https), sometimes it says it has expected text/xml but has not seen it, and it maybe a result of different SOAP protocls each side is using, and sometimes I just get timeout error.
In my last try, I installed Microsoft.NETCore.Platforms 3.1.2 and System.ServiceModel.Http 4.7.0 and later 4.8.0-preview3.20412.3. The latter has implenetations of both WsHttpBinding and Ws2007HttpBinding. But, neither worked. This time I got error:
System.NotSupportedException: Specified method is not supported.
Any solution or suggestion is highly appreciated.
Here it is the stack trace and parts of the code:
System.AggregateException: One or more errors occurred. (Specified method is not supported.)
 ---> System.NotSupportedException: Specified method is not supported.
   at System.ServiceModel.MessageSecurityOverHttp.CreateSecurityBindingElement(Boolean isSecureTransportMode, Boolean isReliableSession, MessageSecurityVersion version)
   at System.ServiceModel.WSHttpSecurity.CreateMessageSecurity(Boolean isReliableSessionEnabled, MessageSecurityVersion version)
   at System.ServiceModel.WSHttpBinding.CreateMessageSecurity()
   at System.ServiceModel.WSHttpBindingBase.CreateBindingElements()
   at System.ServiceModel.WSHttpBinding.CreateBindingElements()
   at System.ServiceModel.Channels.Binding.EnsureInvariants(String contractName)
   at System.ServiceModel.Description.ServiceEndpoint.EnsureInvariants()
   at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
   at System.ServiceModel.ChannelFactory.CreateFactory()
   at System.ServiceModel.ChannelFactory.OnOpening()
   at System.ServiceModel.Channels.CommunicationObject.System.ServiceModel.IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.OpenAsyncInternal(TimeSpan timeout)
   at System.Runtime.TaskHelpers.WaitForCompletion(Task task)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()
   at System.ServiceModel.ChannelFactory.EnsureOpened()
   at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
   at System.ServiceModel.ChannelFactory`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at client.Inquiry_DataAsync(String NationalCode) in C:\Users\Reference.cs:line 5577
   at class1.<>c__DisplayClass13_0.<Inquiry_Data>b__0() in C:\Users\Code.cs:line 349
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification

code:
        PermissiveCertificatePolicy.Enact("*");

        var binding = new WSHttpBinding();

        binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
        binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;

        ServiceClient client = new ServiceClient(
            binding, new EndpointAddress("https://example.com/service.svc"));
        client.ClientCredentials.UserName.UserName = username;
        client.ClientCredentials.UserName.Password = password;
        client.ClientCredentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication
        {
            CertificateValidationMode = X509CertificateValidationMode.None,
            RevocationMode = X509RevocationMode.NoCheck
        };

        _result = Task.Run(() => client.InquiryDataAsync("ABC")).Result;

A: Core does not support Wshttpbinding, wcf only supports BasicHttpBinding, CustomBinding, NetHttpBinding, NetTcpBinding:

So there are two current solutions:
Modify the binding of the server, do not use Wshttpbinding.
The client continues to use the .net framework.
For more information about WCF Features in core, you can refer to this link:
https://github.com/dotnet/wcf/blob/master/release-notes/SupportedFeatures-v2.1.0.md

redpajama_set_name: RedPajamaStackExchange


Description: This is the home you've been waiting for, awesome 4 bdrm ranch w/ 4 baths, scenic country views on dead end rd. Gourmet kitchen with island, double oven, walk-in pantry & wine refrigerator opens to large dinette & elegant great room with fireplace. Master suite with large walk-in closet, master bath with whirlpool & separate shower. The walkout ll includes a huge family room w/billiard area, exercise rm/den with french doors, large 4th bdrm w/walk-in closet & full bath. Fenced in yard, patio & deck.


Mahindra sold just over 56,000 units in February 2019 as against 51,127 units in the same month last year with a growth of 10 per cent. Mahindra & Mahindra has announced its monthly sales numbers for February 2019 and the outcome as expected has been impressive. 56,005 vehicles, With 56,005 units sold compared to 51,127 units during February 2018, an appreciable growth of 10 per cent has been achieved.
This thought made my day!! After sifting through numerous cars over nearly 3 years, this one's features were the most appealing. And if it indeed is a premium product (thanks for saying so ) it adds weight to my choice.
Have you booked the XUV? If yes then which colour?
I test drove the XUV diesel variant and it was really smooth. I'm not an experienced driver or someone who knows alot about engines and stuff, but from an average driver point of view, the car is a joy to drive. It was pretty silent throughout and the pickup was decent. It handled the bumps well and the car is really powerful. I enjoyed driving a car after a really long time.
In comparison, I also test drove the S cross. The pickup is very poor and found the interiors noisy while driving. I've driven petrol since the start and currently drive a 2013 Honda Amaze. The difference in driving the XUV and s-cross was alot I feel. Also, the XUV gave me a very premium feeling as soon as I sat inside the car.
They could've definitely priced it a bit lower but I believe it's a good car overall. My parents didn't like the Nexon so couldn't test drive that and I personally don't like its back. Same with EcoSport. I found the interiors of the XUV premium.
I'm planning to book the car soon. Which colour do you all find the best looking?
I have came across few people on the internet and also in person who had previously booked XUV300 or were planning to buy one (including myself) but due to its high price tag, they've cancelled booking and chosen Nexon.
Anyone here who has done same? And is it possible to get discounts on a brand new car within a month of its launch?
Also, its MID is locked at 12.0 kmpl so we can't know the actual fuel efficiency if it's below 12.0 kmpl What team-bhp members think about its high price who have driven it? After driving it, do you see it as a value for money car or slightly overpriced?
In comparison, I also test drove the S cross. The pickup is very poor and found the interiors noisy while driving.
For all practical reasons, I think S-Ccross is dead, unless they bring the 1.5d , I don't think anyone would buy the Scross.
Quality and finish of XUV 300 is better than an S-cross, however, for the money I would settle either for a Nexon or Ecsoport .
The S Cross anyday, it is a superior car in most respects, if you manage to get a well maintained example and can live with the turbo lag. Performance wise, nothing comes close.
(3) White interiors. As you have pointed out, a one and a half day old test drive car had patches of dirt and stains all over. A maintenance nightmare is there ever was one.
I disagree. I think the XUV does match the S-Cross. Yes it certainly is very pricey and I'll have to agree, the S-Cross looks much better ( especially the BMW-esque headlamps ), the side profile just looks downright weird for the XUV. But it offers much more features for the money and having driven the 1.3 in it's multiple avatars, I can say I prefer the Marazzo diesel engine. The XUV offers many segment first features that may justify the premium for some buyers, especially ones like me who love a long list of gizmos.
By performance, are you referring to the 1.6L turbo Rocket? If yes, then no doubt. Unfortunately, I haven't had the opportunity to drive the 1.6 thoroughly, but from what I've heard, I can safely assume for less than 15 lacs, nothing comes close. If no, then I'm sorry, but I've driven the 1st and 2nd generation swift, the current generation one, the Brezza, the S-Cross and the ciaz and the 1.3L turned out to be just average in each case and certainly did not live upto my expectations. Especially after I drove the i20 diesel. Yes, it was a blast back when the first gen swift diesel was launched, nothing quite came close to the amount of performance and dynamics it offered, but times have changed, but the engine remains the same. Maybe their new in-house diesel will be better.
So, we had a big Team-BHP meet @ Lonavla yesterday and I clubbed that with my XUV300 test-drive. Spent the entire day with the car (link to meet thread).
City rating = 8.5 / 10. Highway rating = 4 / 10.
I really liked the looks & stance of the XUV300. She looked hot in the orange shade of our media car. Sat inside and it felt more like a mini-Creta than a Mahindra (steering wheel is a cut-copy-paste from Hyundai). Top cabin quality and an impressive feature list. The steering is super light in 'comfort mode' & the driver sits tall with a clean view of the road ahead (can see the bonnet too). The turbo-petrol is damn refined for a triple-cylinder. On the move, you simply can't tell its a 3-cylinder. Has good driveability too - it easily passed the 2nd gear speed breaker test, when I dropped the revs to 700 - 800 rpm & the motor pulled without a fuss. Once the turbo starts singing, there is a fun & addictive spike in power and the XUV300 feels quick! The redline is early though and it can catch you out in the middle of an overtaking manouveur (max rpm of ~5,900 only). What mars the driving experience in the city is the l-o-n-g gearshift - too long for this class of car. Also, the brake & accelerator pedals are placed too close to each other (width as well as height). The ride quality is compliant and no owner will complain.
I was just thinking what a great job Mahindra has done, but then I reached the expressway. As good as the car is under 100 kmph, it is TERRIBLE over 100 kmph. It's behaviour at 120 kmph is SCARY. I cannot think of any car that I've driven in the last 3 or 4 years with expressway manners poorer than the XUV300. For one, the XUV300 is damn skittish. At 110 kmph, any irregularity (uneven tarmac, crosswinds, bumps) and the car loses composure easily. When coming down the Lonavla ghat, there is a right-hander that I'm taking at 70 kmph. There was a small bump on the road and the rear-left simply lost it, with the tail sliding out (I had to make minor corrections to get it back). Then, I'm cruising at 100 - 120 kmph on the expressway in a straight line. There is a small undulation that won't even affect a Maruti Swift. Get this - the XUV300 moved like 2 feet to the right . I know the Lonavla ghat like the back of my hand and through fast curves that I easily took in the new Santro recently, I had to fight hard to maintain the intended line. ChiragM was in the passenger seat and he said that his Ritz is more planted on the highway. What makes it worse is the steering that is too sensitive at high speed. It results in a twitchy car.
I'm surprised this car has even been approved for sale by Mahindra's team as it is too unstable + unpredictable at highway speeds. As things stand today, I cannot recommend the XUV300 to anyone. The suspension is completely unsorted & Mahindra needs to fix this ASAP. We're getting the diesel in the coming week and I will drive that to check if there was any defect in our test car (I doubt it as this is a brand new media car that is otherwise functioning perfectly).
Our brand new test car apparently has two defective rear dampers / shock absorbers. The rear-left in particular is worse, I've been told (refer to my earlier comment on the rear-left of the car losing it easily).
Mahindra says that a particular batch of dampers was defective and it has issued the TSB that Ph03n!x mentioned to all dealerships. My question to Mahindra was "what about customers who have already taken delivery & don't know that their rear dampers are shot". I'm told that dealers were instructed to check the VIN number of all cars for defective dampers from day 1 itself.
I told Mahindra that I appreciate their quick action (a lot has happened in 24 hours). Equally, I'm glad nothing untoward happened while I was driving the car on the expressway!!! This is the first time in my reviewing experience that I've ended up with a defective suspension on the highway. Stuff happens & I understand, but it's still unnerving.
If you've bought an XUV300, I would strongly recommend that you call your dealer & check if your car is affected. If they can miss checking out a brand new media car, I wouldn't rule out their missing a customer car either.
So, how does a regular XUV300 drive? I frankly don't know. Will be taking another petrol for a spin this weekend. I have asked them to give me the same car with updated shocks.
I'm surprised this car has even been approved for sale by Mahindra's team as it is too unstable + unpredictable at highway speeds. As things stand today, I cannot recommend the XUV300 to anyone. The suspension is completely unsorted & Mahindra needs to fix this ASAP.
Such a relief that we still believe in reviewing a car on its merits and demerits alone. This has to be the first review of the car which is so critical of it ( and I have no doubt it is true). All the reviews online till now have been singing only praises. Senior reviewers whom I have admired since long, such as SVP, have fallen prey to the ad revenue malice too I guess.
Waiting for the official review now.
I'm surprised this car has even been approved for sale by Mahindra's team as it is too unstable + unpredictable at highway speeds. As things stand today, I cannot recommend the XUV300 to anyone.
That's a huge blunder, GTO. After the Marazzo, I expected Mahindra to up the game. Would there have a change in the suspension from the Tivoli that it's based on?
This is probably one of the first times I have heard a verdict from you before the official review came out.
The long gear throw, I guess is an XUV trademark - transferring the legacy from the XUV500.
And I don't understand why the pedals positions can't be standardised. I've never felt this in, say, all Suzukis or Hondas that I've driven.
In the Santro Xing, there was this weird issue of wider shoes eg. Safety shoes getting stuck between the brake and clutch pedals.
was a small bump on the road and the rear-left simply lost it, with the tail sliding out (I had to make minor corrections to get it back).
There is a small undulation that won't even affect a Maruti Swift. Get this - the TUV300 moved like 2 feet to the right What makes it worse is the steering that is too sensitive at high speed. It results in a twitchy car.
Fingers crossed till you test the diesel; but I think the chopped and light rear has got something to do with this. This is one hugely disproportionate car.
Last edited by vigsom : 3rd March 2019 at 08:24.
All the reviews online till now have been singing only praises.
Now you know why we insist on getting the car in Bombay for a full test. Driving it over 4 - 5 days in conditions we're familiar with lends the true picture.
After the Marazzo, I expected Mahindra to up the game.
Exactly what I was telling the gang at the Team-BHP meet yesterday. The Marazzo was so sorted, and the XUV500 is no slouch. I'm frankly shocked at how they've goofed up with the XUV300. It's a disaster on the expressway.
Would there have a change in the suspension from the Tivoli that it's based on?
I haven't done my full research yet, but yes, I do believe that the XUV300 rides taller than the Tivoli and hence, suspension changes are a given.
Now, I'm eagerly waiting to drive the diesel variant to see if it behaves the same (I'm 90% sure it will).
This is where our reviews add value; mainstream media is so watered down that negatives are either hidden or carefully worded as positive, to promote the product.
One example below - a shootout which was a like whodunit movie, with the suspense already revealed in the first frame itself.
a I was just thinking what a great job Mahindra has done, but then I reached the expressway. As good as the car is under 100 kmph, it is TERRIBLE over 100 kmph. It's behaviour at 120 kmph is SCARY.
This is quite scary to hear. I had test driven the xuv 300 diesel a few days ago. In kerala, highway speed limit is 80 kmph. I did drive uptp speeds of 100 kmph. Eventually the police stopped me and had to pay 400 rs fine for over speeding.
But uptil speeds of 100 kmph, i was quite impressed at how stable and planted the car felt.
Any conjecture on why the vehicle stability goes for a toss above 100 kmph. What specifically in the suspension may be causing this?
Any car handles well at lower speeds. Even the Maruti Alto K10 - with its basic and cheap suspension - is okay under 90 kmph. It's high speed behaviour that separates the good suspensions from bad.
Still it was too surprising to know the multiple personality disorder of XUV3OO suspension tuning. In almost all the reviews, the suspension tuning is praised like never before for a Mahindra. Looks like XUV3OO is well adapted for Kerala conditions as our maximum highway speed limit is 90kmph .
Last edited by pavi : 3rd March 2019 at 10:10.
Me too, waiting for your next review. I am in the booked and holding persons category after the price shock.
Tivoli ground clearance is 167mm and XUV300 is 180mm. I guess, a combination of raised ground clearance by 13mm, chopped rear by 20mm and suspension tuning to suit Indian conditions might be playing spoil sport.
But, what about Gaurav Gill?
Did you check the Tyre pressure on the on-board TPMS?


Anyway - my status update was, "Looks like another hot, beautiful day out there...Maybe I should leave the house for more than 30 minutes today," and my cousin's comment was, "I would always be on the beach on down time and days off."
Maybe that's what you'd do on some other island - but that's not what we do here on Ambergris Caye.
Do you notice how many people are NOT hanging out on the beach in all these pictures?
Tourists definitely spend time on the beach in front of their resorts... but ask people who actually live here if they lounge on the beach every time they have a day off and I bet you 99% of them will say, "Nope."
When I want to "go to the beach," there's only one beach I want to hang out on, and that's a 45 minute golf cart ride away from my house... and I don't own a golf cart, so you can imagine how infrequently I go up there.
One thing I learned quickly when I moved here is that it is quite possible to live on an island and not even put on a bathing suit for two months at a time.
Correct me if I'm wrong, other expats on Ambergris Caye, but we don't just go to the beach (regularly) to hang out unless there's, like, a beach party or something social going on - AmIright?


text:
San Francisco 49ers coordinator gets head coach endorsement from 2 defensive superstars
Jason Burgos
One of the best defensive players of this century, and arguably the best today, both believe San Francisco 49ers defensive coordinator DeMeco Ryans would be a fantastic head coach in the NFL next season.
In just two seasons as a defensive coordinator in the league, former Houston Texans Pro Bowler DeMeco Ryans has made a serious impression on executives around the NFL. And why not, the 49ers' defense was impressive in 2021, and utterly dominant this season. They are the major reason why the team has won 11 straight and are serious contenders to reach the Super Bowl next month.
That is why it is unsurprising that the 38-year-old has become one of the hottest head coaching candidates on the market in 2023. Ahead of the San Francisco 49ers Divisional Round game against the Dallas Cowboys, Ryans reportedly has interviews lined up with the Panthers, Broncos, Cardinals, and Texans.
Also Read: 49ers coordinator reportedly the hottest candidate on head coach market
Over the last week, two of the sport's best pass rushers over the last decade spoke publicly about why Ryans is ready to make an impact in a franchise's top coaching job.
JJ Watt shores San Francisco 49ers defensive coordinator with unique praise
Credit: Stan Szeto-USA TODAY Sports
Following the San Francisco 49ers Wild Card win over the Seattle Seahawks, NFL Defensive Player of the year candidate Nick Bosa explained why the man that helped lead him to two straight 15-plus sack seasons is built to be a head coach.
"He's gonna be an unbelievable head coach at some point. He just knows the feel of the players and he listens to players when he needs to, and he makes his calls. He's as good as it gets. I said a couple of weeks ago he's the best defensive coordinator I've ever been around, hands down."
– Nick Bosa
Top analyst says Dallas Cowboys have 'little chance' of beating 49ers in Divisional Round
Another elite talent who came out publicly to support DeMeco Ryans is a man that played with him during the final season of his impressive run in Houston, JJ Watt. The future Hall-of-Famer took to his Twitter on Friday to praise Ryans' influence and leadership.
"As a rookie in Houston, I bought my first house across the street from DeMeco because if Meco thought it was the right place to live, it was the right place to live for me. Captain, leader, smart, tough, personable, crushed it as DC. He will be a great head coach."
– JJ Watt
Receiving glowing endorsements from two of the best defensive players to do it over the last ten years says a lot about the level of respect the San Francisco 49ers coordinator has around the NFL.

redpajama_set_name: RedPajamaCommonCrawl


Ahead of the World Eoomic Forum meeting in Davos, Kensington and Chelsea joins global mobilisation against inequality.
Eighty-two per cent of wealth generated last year across the world went to the richest one per cent of the global population, while the 3.7 billion people who make up the poorest half saw their wealth flatline, according to a new Oxfam report.
As politicians and business leaders prepare to gather in Davos next week (20-23 January) for the World Economic Forum, Christian Aid questions whether Switzerland's role as a haven for "dirty" money from poor countries makes it an appropriate host country.
Extreme inequality is threatening to undo much of the progress made over the past 20 years in tackling poverty, says the charity Oxfam.


Colombo's bazaar district, Pettah, presents a real treat for shopaholics who can wander through the hustle and bustle of whole streets dedicated to selling a particular type of merchandise, from local handicrafts to fresh produce. The markets will not be to everybody's taste; Pettah is a sensory overload and the sheer quantity of merchandise, and crowds of people, make it difficult to find good quality items.
Bargaining is essential as foreigners tend to be overcharged. The quoted price will be at least double what locals would be expected to pay. The area was once an exclusive residential area filled with stately homes and large gardens in gas-lit streets. A relic of the colonial era, the Dutch House Museum, is open to the public on Prince Street. The mansion house dates from the 17th century and was the residence of Count August Carl Van Ranzow. It has now been restored and stands among the traders and boutiques as a museum displaying the life and times of the Dutch occupation, its exhibits including furniture, ceramics, coins and all the trappings of daily life at the time. Another landmark is the Jami Ul Alfar Mosque, one of the oldest mosques in Colombo.


text:
/*! \file IParticleChannelTime.h
    \brief Channel-specific interfaces for ParticleChannelTime.
				 The channel is used to trace current particle time.
				 The channel is a wrap around ParticleChannelPTV.
*/
/**********************************************************************
 *<
	CREATED BY: Oleg Bayborodin

	HISTORY: created 10-04-01

 *>	Copyright (c) 2001, All Rights Reserved.
 **********************************************************************/

#pragma once

#include "IParticleChannelPTV.h"

// standard particle channel "Time"
// interface ID
#define PARTICLECHANNELTIMER_INTERFACE Interface_ID(0x74f93b03, 0x1eb34500)
#define PARTICLECHANNELTIMEW_INTERFACE Interface_ID(0x74f93b03, 0x1eb34501)

#define GetParticleChannelTimeRInterface(obj) ((IParticleChannelPTVR*)obj->GetInterface(PARTICLECHANNELTIMER_INTERFACE))
#define GetParticleChannelTimeWInterface(obj) ((IParticleChannelPTVW*)obj->GetInterface(PARTICLECHANNELTIMEW_INTERFACE))

redpajama_set_name: RedPajamaGithub


text:
Q: error: must be owner of relation USER_ACCOUNT_ID_seq I have granted priviledges to a user for testing in PostGreSql:
GRANT USAGE ON SCHEMA "MySchema" TO "Tester";
GRANT ALL ON ALL TABLES IN SCHEMA "MySchema" TO "Tester";
GRANT ALL ON ALL SEQUENCES IN SCHEMA "MySchema" TO "Tester";

Yet, when I run the following statement;
TRUNCATE TABLE "MySchema"."USER_ACCOUNT" RESTART IDENTITY;

I get the following error message:
[error: must be owner of relation USER_ACCOUNT_ID_seq]

What else do I need to grant to my Tester user, and how? Thanks!

A: From http://www.postgresql.org/docs/9.5/static/sql-altersequence.html

You must own the sequence to use ALTER SEQUENCE. To change a sequence's schema, you must also have CREATE privilege on the new schema. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have CREATE privilege on the sequence's schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't do by dropping and recreating the sequence. However, a superuser can alter ownership of any sequence anyway.)

Restarting the sequence on table truncation is essentially the same as altering the sequence in a separate statement
TRUNCATE TABLE "MySchema"."USER_ACCOUNT";
ALTER SEQUENCE my_seq RESTART;

So, the above restriction applies to your original TRUNCATE with RESTART statement. You must be the owner of that sequence or be a super user.
You can GRANT the sequence owner's role to the role that's going to execute your statement by doing
GRANT roleA TO roleB;

assuming that roleA owns the sequence you are trying to restart.
Once you are done with all the TRUNCATE/ALTER SEQUENCE statements you can REVOKE the sequence's owning role from roleB
REVOKE roleA FROM roleB;


http://forum.jgoth.com/ Being a stand-alone board it offers greater flexibility and more options, which is good for board members.
On top of that you will find that there is a stack of topics to cover more Japanese music scenes not to mention international sections to talk about various Gothic scenes overseas.
A smeg-load of boards covering J-Goth, industrial, other music styles and life in general in Japan. There are also special sections German, French, Spanish and Japanese.
A European section for listing the 10 countries that I get the most visitors from including the U.K., Germany, France, Sweden, Finland, The Netherlands, Poland, Russia, Italy, Greece, Spain and Belgium and a board for other countries.
Goth in the Americas with U.S.A. Canada, Brazil and Chile listed plus a board for other countries.
Finally Oceania and Asia where the bulk of visitors come from Australia & New Zealand and China/Hong Kong.
If you are interested in giving the JGoth.com forum another try I'd be most appreciative. Because the password encryption is different from the last board you will need to re-register. That takes about one minute to do. Once in feel free to post away!
Sorry, I have been under a lot of stress lately and haven't had time to blog.
Shock, horror. I have lost Web access from the ferret dungeon. The little lords (them dang ferrets are higher lifeforms) are part of the reason why this site continues – I get to kill two birds with one stone giving you a regularly updated site and giving the little masters the activity time they need. Without the dungeon connected to the Web I have to choose between paying to go online at some smelly Internet cafe just to update the site or take care of the two fuzzy masters of JGoth towers. Fuzzies win every time.
Until I can get the dungeon reconnected, JGoth goes through another go-slow period. I will add a few more events for June when I can grab a couple of extra hours outside, but it will be quicker and dirtier than usual.
Wow, it has been 3 years since I first decided to do this site (1st year anniversary message :: 2nd year anniversary message). The last year has been difficult with the body conking out sometime in April 2006. Lots of missed parties, lots of quiet Saturday nights tap-tap-tapping away because it was all I could do. The site went from being relevant to being comical-sad. Perhaps there is no recovery from that fall, but it doesn't matter. I only came online to do one thing, facilitate the birth of an appreciation of the Japanese Gothic underground scene.
Way back in the first half of 2005 when I first met U-tarou and Mikito of Chronotrigger, now called Baal, U-tarou asked me why do I do this site. I could not explain back then, but I can now.
I see a fractured, earthly beauty of the Japanese underground scene, that I have not seen anywhere else in Japan. While the many aspects of Japanese culture that I know have such strong connections to fixed traditions and etiquettes, the Gothic scene is like a wild child; perhaps lacking some finesse, but awe-inspiring in its natural, unconscientious beauty. It could be light-hearted or it could be pure darkness, it could be melancholic or it could be manic, but it always remains an unrepentant an expression of self. It breaks with the mores of Japanese society and is untainted by the manufactured processes that feature prominently in many music scenes. It is an unpolished gem that very few people can see (although many more can see it now).
Since mid-2004 I have wanted the world to see what I could see right in front of my eyes. I wanted to make something happen. And I guess my senseless screaming worked a little bit to bring attention to this scene. Can you see what I see?
By October 2005 I received an e-mail from the German magazine Astan – a magazine I had not heard of before, but they are the third-largest Gothic mag in Germany. They were interested in contacting a couple of more widely-recognized visual bands (they actually are quite good bands), but since I didn't know these bands personally I could not get a response from them. However, I certainly knew quite a few Goth bands so I started doing a little jig to introduce bands that I personally knew to the lord of Astan.
It was a lot of work, with e-mails buzzing around and some home-brew copy-editing and re-translation for my friends in Baal, as U-tarou and myself attempted to bring Mikito's poetic genius across from Japanese to English – but it was time well spent. After about three months Astan 22 came out and Germany got its first full-dose of Japanese Goth. There was even a whole page dedicated to me as Igor and a little photo of me with one of my faithful ferrets, little Truffle. It was golden. Here's the official victory announcement.
And here's Astan's interview with Igor.
Soon after that, my body conked out and the rest of 2006 faded away with it. There were also a handful of problems that caused a great deal of concern for me, and by the time I started to regenerate sufficiently to look at my little world as lord and slave JGoth.com, I realized that the train had rolled out of the station while I was in the lavatory!
Not to worry. I know I can never be omega, but, in some ways, I was part of alpha, and it was nice. I want to thank Steff from Astan for trusting in my judgment for bands that he had never heard of, and the bands for trusting my judgment with Astan, and Kiwamu from Blood for sharing his wisdom in those early days.
Most of all, I want to thank U-tarou & Mikito for taking the challenge and making the most of things. You guys shine brilliant like diamonds in the night. Baal reminds me that no matter what happens to JGoth.com and "Igor" that the effort was worth it. Every time I hear Baal piping in my speakers it brings a smile to my dial – their music is the sound of hope.
So year four rolls around and the things boiling my noodle are direction of the site and the upcoming re-connection with a few good friends. I don't know what value JGoth.com is to people now, but that didn't stop me before. The site has almost fully returned and will be around for a while, but there are other ways to move the agenda of getting more people to see what I can see. And perhaps I'll turn up in unexpected places doing unexpected things in the months ahead.
To everybody who has been kind enough to drop in from time to time – thank you very much for your support, I am so grateful.


We understand that taking the first step toward recovery can sometimes be the most daunting.
Implementing important guidelines, skills, and practices such as wholesome ways to deal with worry and fear, determining boundaries with family, and self management principles, immensely increases the odds of sustained recovery with minimal regression.
Our team of highly experiencedand certified experts will prepare you in these critical skills in order to provide the best chances for a complete rehabilitation.
Making the choice to receive the assistance that you need is the first crucial stage for recovery. By calling at our illicit drug, alcohol, and/or prescription drug rehabilitation phone number toll-free, you can begin at this moment. Our team of caring, and certified specialists address prescription drug, alcohol, and/or illicit drug addictions with the most effective alcohol and drug addictions treatment techniques. We can offer you a real path to recovery. We are happy to discuss your personal needs and plan your rehabilitation and recovery.
Substance abuse is a destructive affliction that harms the mind as well as the physical body. Accordingly, our team of professionals need to deal with the two parts of the addiction. We begin alcohol or drug abuse rehabilitation by detoxing the body. Once alcohol and drugs are completely gone, our trained therapists continue on with focusing on the mental & emotional side of it.In order to be truly effective, drug and alcohol abuse treatment requires a complete change of one's style of living and perspective. Often, substance abuse can occur alongside with mental health disorders, trauma, or behavioral issues that are contributing to the dependency.
Optimal recovery rates (many believe) come from the more extensive addiction rehabilitation locations. Rehabilitation from alcohol or drug abuse that is long-lasting customarily involves detoxing completely with professional oversight, consistent rehabilitation at home, rehabilitation at home, and recovery at a local facility. This has the best results when in combination with a balanced environment at home. What is often needed for having long-lasting results is to assist patients to totally revamp their life. This is why addiction rehabilitations that focus on rehabilitation from addiction to alcohol/drugs in a more thorough manner promote improvements in a more substantial way.
180+ day drug treatments tend to have highest success rate. While it depends on the individual, recovery can range from weeks to months of alcohol and/or drug rehabilitation to take care of the reasons for alcohol and/or drug dependency. Some drug and alcohol addiction recovery programs are for four to seven months. Alcohol/drug abuse rehab is often expected to be a one month long program. However, many are of various time-frames.
Talk to one of our specialists to explore your needs, finances, budget, and opportunities, as well as finding you a a recovery center that's best suited to you. To find a drug rehab near you in Duke Field Afs, FL, call our hotline toll-free.


comprising 54,000 members - men and women of all ages and backgrounds - in 1,850 clubs.
The worldwide organisation is over 100 years old and, since its humble beginnings in Chicago in 1905, is internationally renowned for improving the lives of millions of people in local communities and around the world.
RIBI's headquarters - the Secretariat - is at Alcester in Warwickshire, providing administrative, operational, financial and marketing support to clubs withing the 29 Districts across Great Britain and Ireland.
Rotary International has its worldwide headquarters in Evanston, near Chicago, Illinois, USA.


text:
<?php

/**
 * CHttpRequest encapsulates the $_SERVER variable and resolves its inconsistency among different Web servers.
 *
 * CHttpRequest also manages the cookies sent from and sent to the user.
 * By setting {@link enableCookieValidation} to true,
 * cookies sent from the user will be validated to see if they are tampered.
 * The property {@link getCookies cookies} returns the collection of cookies.
 * For more details, see {@link CCookieCollection}.
 *
 * CHttpRequest is a default application component loaded by {@link CWebApplication}. It can be
 * accessed via {@link CWebApplication::getRequest()}.
 *
 * @property string $url Part of the request URL after the host info.
 * @property string $hostInfo Schema and hostname part (with port number if needed) of the request URL (e.g. http://www.yiiframework.com).
 * @property string $baseUrl The relative URL for the application.
 * @property string $scriptUrl The relative URL of the entry script.
 * @property string $pathInfo Part of the request URL that is after the entry script and before the question mark.
 * Note, the returned pathinfo is decoded starting from 1.1.4.
 * Prior to 1.1.4, whether it is decoded or not depends on the server configuration
 * (in most cases it is not decoded).
 * @property string $requestUri The request URI portion for the currently requested URL.
 * @property string $queryString Part of the request URL that is after the question mark.
 * @property boolean $isSecureConnection If the request is sent via secure channel (https).
 * @property string $requestType Request type, such as GET, POST, HEAD, PUT, DELETE.
 * @property boolean $isPostRequest Whether this is a POST request.
 * @property boolean $isDeleteRequest Whether this is a DELETE request.
 * @property boolean $isPutRequest Whether this is a PUT request.
 * @property boolean $isAjaxRequest Whether this is an AJAX (XMLHttpRequest) request.
 * @property boolean $isFlashRequest Whether this is an Adobe Flash or Adobe Flex request.
 * @property string $serverName Server name.
 * @property integer $serverPort Server port number.
 * @property string $urlReferrer URL referrer, null if not present.
 * @property string $userAgent User agent, null if not present.
 * @property string $userHostAddress User IP address.
 * @property string $userHost User host name, null if cannot be determined.
 * @property string $scriptFile Entry script file path (processed w/ realpath()).
 * @property array $browser User browser capabilities.
 * @property string $acceptTypes User browser accept types, null if not present.
 * @property integer $port Port number for insecure requests.
 * @property integer $securePort Port number for secure requests.
 * @property CCookieCollection|CHttpCookie[] $cookies The cookie collection.
 * @property array $preferredAcceptType The user preferred accept type as an array map, e.g. array('type' => 'application', 'subType' => 'xhtml', 'baseType' => 'xml', 'params' => array('q' => 0.9)).
 * @property array $preferredAcceptTypes An array of all user accepted types (as array maps like array('type' => 'application', 'subType' => 'xhtml', 'baseType' => 'xml', 'params' => array('q' => 0.9)) ) in order of preference.
 * @property string $preferredLanguage The user preferred language.
 * @property array $preferredLanguages An array of all user accepted languages in order of preference.
 * @property string $csrfToken The random token for CSRF validation.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package system.web
 * @since 1.0
 */
class CHttpRequest extends CApplicationComponent
{
	/**
	 * @var boolean whether cookies should be validated to ensure they are not tampered. Defaults to false.
	 */
	public $enableCookieValidation=false;
	/**
	 * @var boolean whether to enable CSRF (Cross-Site Request Forgery) validation. Defaults to false.
	 * By setting this property to true, forms submitted to an Yii Web application must be originated
	 * from the same application. If not, a 400 HTTP exception will be raised.
	 * Note, this feature requires that the user client accepts cookie.
	 * You also need to use {@link CHtml::form} or {@link CHtml::statefulForm} to generate
	 * the needed HTML forms in your pages.
	 * @see http://seclab.stanford.edu/websec/csrf/csrf.pdf
	 */
	public $enableCsrfValidation=false;
	/**
	 * @var string the name of the token used to prevent CSRF. Defaults to 'YII_CSRF_TOKEN'.
	 * This property is effectively only when {@link enableCsrfValidation} is true.
	 */
	public $csrfTokenName='YII_CSRF_TOKEN';
	/**
	 * @var array the property values (in name-value pairs) used to initialize the CSRF cookie.
	 * Any property of {@link CHttpCookie} may be initialized.
	 * This property is effective only when {@link enableCsrfValidation} is true.
	 */
	public $csrfCookie;

	private $_requestUri;
	private $_pathInfo;
	private $_scriptFile;
	private $_scriptUrl;
	private $_hostInfo;
	private $_baseUrl;
	private $_cookies;
	private $_preferredAcceptTypes;
	private $_preferredLanguages;
	private $_csrfToken;
	private $_restParams;

	/**
	 * Initializes the application component.
	 * This method overrides the parent implementation by preprocessing
	 * the user request data.
	 */
	public function init()
	{
		parent::init();
		$this->normalizeRequest();
	}

	/**
	 * Normalizes the request data.
	 * This method strips off slashes in request data if get_magic_quotes_gpc() returns true.
	 * It also performs CSRF validation if {@link enableCsrfValidation} is true.
	 */
	protected function normalizeRequest()
	{
		// normalize request
		if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
		{
			if(isset($_GET))
				$_GET=$this->stripSlashes($_GET);
			if(isset($_POST))
				$_POST=$this->stripSlashes($_POST);
			if(isset($_REQUEST))
				$_REQUEST=$this->stripSlashes($_REQUEST);
			if(isset($_COOKIE))
				$_COOKIE=$this->stripSlashes($_COOKIE);
		}

		if($this->enableCsrfValidation)
			Yii::app()->attachEventHandler('onBeginRequest',array($this,'validateCsrfToken'));
	}

	/**
	 * Strips slashes from input data.
	 * This method is applied when magic quotes is enabled.
	 * @param mixed $data input data to be processed
	 * @return mixed processed data
	 */
	public function stripSlashes(&$data)
	{
		if(is_array($data))
		{
			if(count($data) == 0)
				return $data;
			$keys=array_map('stripslashes',array_keys($data));
			$data=array_combine($keys,array_values($data));
			return array_map(array($this,'stripSlashes'),$data);
		}
		else
			return stripslashes($data);
	}

	/**
	 * Returns the named GET or POST parameter value.
	 * If the GET or POST parameter does not exist, the second parameter to this method will be returned.
	 * If both GET and POST contains such a named parameter, the GET parameter takes precedence.
	 * @param string $name the GET parameter name
	 * @param mixed $defaultValue the default parameter value if the GET parameter does not exist.
	 * @return mixed the GET parameter value
	 * @see getQuery
	 * @see getPost
	 */
	public function getParam($name,$defaultValue=null)
	{
		return isset($_GET[$name]) ? $_GET[$name] : (isset($_POST[$name]) ? $_POST[$name] : $defaultValue);
	}

	/**
	 * Returns the named GET parameter value.
	 * If the GET parameter does not exist, the second parameter to this method will be returned.
	 * @param string $name the GET parameter name
	 * @param mixed $defaultValue the default parameter value if the GET parameter does not exist.
	 * @return mixed the GET parameter value
	 * @see getPost
	 * @see getParam
	 */
	public function getQuery($name,$defaultValue=null)
	{
		return isset($_GET[$name]) ? $_GET[$name] : $defaultValue;
	}

	/**
	 * Returns the named POST parameter value.
	 * If the POST parameter does not exist, the second parameter to this method will be returned.
	 * @param string $name the POST parameter name
	 * @param mixed $defaultValue the default parameter value if the POST parameter does not exist.
	 * @return mixed the POST parameter value
	 * @see getParam
	 * @see getQuery
	 */
	public function getPost($name,$defaultValue=null)
	{
		return isset($_POST[$name]) ? $_POST[$name] : $defaultValue;
	}

	/**
	 * Returns the named DELETE parameter value.
	 * If the DELETE parameter does not exist or if the current request is not a DELETE request,
	 * the second parameter to this method will be returned.
	 * If the DELETE request was tunneled through POST via _method parameter, the POST parameter
	 * will be returned instead (available since version 1.1.11).
	 * @param string $name the DELETE parameter name
	 * @param mixed $defaultValue the default parameter value if the DELETE parameter does not exist.
	 * @return mixed the DELETE parameter value
	 * @since 1.1.7
	 */
	public function getDelete($name,$defaultValue=null)
	{
		if($this->getIsDeleteViaPostRequest())
			return $this->getPost($name, $defaultValue);

		if($this->getIsDeleteRequest())
		{
			$restParams=$this->getRestParams();
			return isset($restParams[$name]) ? $restParams[$name] : $defaultValue;
		}
		else
			return $defaultValue;
	}

	/**
	 * Returns the named PUT parameter value.
	 * If the PUT parameter does not exist or if the current request is not a PUT request,
	 * the second parameter to this method will be returned.
	 * If the PUT request was tunneled through POST via _method parameter, the POST parameter
	 * will be returned instead (available since version 1.1.11).
	 * @param string $name the PUT parameter name
	 * @param mixed $defaultValue the default parameter value if the PUT parameter does not exist.
	 * @return mixed the PUT parameter value
	 * @since 1.1.7
	 */
	public function getPut($name,$defaultValue=null)
	{
		if($this->getIsPutViaPostRequest())
			return $this->getPost($name, $defaultValue);

		if($this->getIsPutRequest())
		{
			$restParams=$this->getRestParams();
			return isset($restParams[$name]) ? $restParams[$name] : $defaultValue;
		}
		else
			return $defaultValue;
	}

	/**
	 * Returns request parameters. Typically PUT or DELETE.
	 * @return array the request parameters
	 * @since 1.1.7
	 * @since 1.1.13 method became public
	 */
	public function getRestParams()
	{
		if($this->_restParams===null)
		{
			$result=array();
			if(function_exists('mb_parse_str'))
				mb_parse_str($this->getRawBody(), $result);
			else
				parse_str($this->getRawBody(), $result);
			$this->_restParams=$result;
		}

		return $this->_restParams;
	}

	/**
	 * Returns the raw HTTP request body.
	 * @return string the request body
	 * @since 1.1.13
	 */
	public function getRawBody()
	{
		static $rawBody;
		if($rawBody===null)
			$rawBody=file_get_contents('php://input');
		return $rawBody;
	}

	/**
	 * Returns the currently requested URL.
	 * This is the same as {@link getRequestUri}.
	 * @return string part of the request URL after the host info.
	 */
	public function getUrl()
	{
		return $this->getRequestUri();
	}

	/**
	 * Returns the schema and host part of the application URL.
	 * The returned URL does not have an ending slash.
	 * By default this is determined based on the user request information.
	 * You may explicitly specify it by setting the {@link setHostInfo hostInfo} property.
	 * @param string $schema schema to use (e.g. http, https). If empty, the schema used for the current request will be used.
	 * @return string schema and hostname part (with port number if needed) of the request URL (e.g. http://www.yiiframework.com)
	 * @see setHostInfo
	 */
	public function getHostInfo($schema='')
	{
		if($this->_hostInfo===null)
		{
			if($secure=$this->getIsSecureConnection())
				$http='https';
			else
				$http='http';
			if(isset($_SERVER['HTTP_HOST']))
				$this->_hostInfo=$http.'://'.$_SERVER['HTTP_HOST'];
			else
			{
				$this->_hostInfo=$http.'://'.$_SERVER['SERVER_NAME'];
				$port=$secure ? $this->getSecurePort() : $this->getPort();
				if(($port!==80 && !$secure) || ($port!==443 && $secure))
					$this->_hostInfo.=':'.$port;
			}
		}
		if($schema!=='')
		{
			$secure=$this->getIsSecureConnection();
			if($secure && $schema==='https' || !$secure && $schema==='http')
				return $this->_hostInfo;

			$port=$schema==='https' ? $this->getSecurePort() : $this->getPort();
			if($port!==80 && $schema==='http' || $port!==443 && $schema==='https')
				$port=':'.$port;
			else
				$port='';

			$pos=strpos($this->_hostInfo,':');
			return $schema.substr($this->_hostInfo,$pos,strcspn($this->_hostInfo,':',$pos+1)+1).$port;
		}
		else
			return $this->_hostInfo;
	}

	/**
	 * Sets the schema and host part of the application URL.
	 * This setter is provided in case the schema and hostname cannot be determined
	 * on certain Web servers.
	 * @param string $value the schema and host part of the application URL.
	 */
	public function setHostInfo($value)
	{
		$this->_hostInfo=rtrim($value,'/');
	}

	/**
	 * Returns the relative URL for the application.
	 * This is similar to {@link getScriptUrl scriptUrl} except that
	 * it does not have the script file name, and the ending slashes are stripped off.
	 * @param boolean $absolute whether to return an absolute URL. Defaults to false, meaning returning a relative one.
	 * @return string the relative URL for the application
	 * @see setScriptUrl
	 */
	public function getBaseUrl($absolute=false)
	{
		if($this->_baseUrl===null)
			$this->_baseUrl=rtrim(dirname($this->getScriptUrl()),'\\/');
		return $absolute ? $this->getHostInfo() . $this->_baseUrl : $this->_baseUrl;
	}

	/**
	 * Sets the relative URL for the application.
	 * By default the URL is determined based on the entry script URL.
	 * This setter is provided in case you want to change this behavior.
	 * @param string $value the relative URL for the application
	 */
	public function setBaseUrl($value)
	{
		$this->_baseUrl=$value;
	}

	/**
	 * Returns the relative URL of the entry script.
	 * The implementation of this method referenced Zend_Controller_Request_Http in Zend Framework.
	 * @throws CException when it is unable to determine the entry script URL.
	 * @return string the relative URL of the entry script.
	 */
	public function getScriptUrl()
	{
		if($this->_scriptUrl===null)
		{
			$scriptName=basename($_SERVER['SCRIPT_FILENAME']);
			if(basename($_SERVER['SCRIPT_NAME'])===$scriptName)
				$this->_scriptUrl=$_SERVER['SCRIPT_NAME'];
			elseif(basename($_SERVER['PHP_SELF'])===$scriptName)
				$this->_scriptUrl=$_SERVER['PHP_SELF'];
			elseif(isset($_SERVER['ORIG_SCRIPT_NAME']) && basename($_SERVER['ORIG_SCRIPT_NAME'])===$scriptName)
				$this->_scriptUrl=$_SERVER['ORIG_SCRIPT_NAME'];
			elseif(($pos=strpos($_SERVER['PHP_SELF'],'/'.$scriptName))!==false)
				$this->_scriptUrl=substr($_SERVER['SCRIPT_NAME'],0,$pos).'/'.$scriptName;
			elseif(isset($_SERVER['DOCUMENT_ROOT']) && strpos($_SERVER['SCRIPT_FILENAME'],$_SERVER['DOCUMENT_ROOT'])===0)
				$this->_scriptUrl=str_replace('\\','/',str_replace($_SERVER['DOCUMENT_ROOT'],'',$_SERVER['SCRIPT_FILENAME']));
			else
				throw new CException(Yii::t('yii','CHttpRequest is unable to determine the entry script URL.'));
		}
		return $this->_scriptUrl;
	}

	/**
	 * Sets the relative URL for the application entry script.
	 * This setter is provided in case the entry script URL cannot be determined
	 * on certain Web servers.
	 * @param string $value the relative URL for the application entry script.
	 */
	public function setScriptUrl($value)
	{
		$this->_scriptUrl='/'.trim($value,'/');
	}

	/**
	 * Returns the path info of the currently requested URL.
	 * This refers to the part that is after the entry script and before the question mark.
	 * The starting and ending slashes are stripped off.
	 * @return string part of the request URL that is after the entry script and before the question mark.
	 * Note, the returned pathinfo is decoded starting from 1.1.4.
	 * Prior to 1.1.4, whether it is decoded or not depends on the server configuration
	 * (in most cases it is not decoded).
	 * @throws CException if the request URI cannot be determined due to improper server configuration
	 */
	public function getPathInfo()
	{
		if($this->_pathInfo===null)
		{
			$pathInfo=$this->getRequestUri();

			if(($pos=strpos($pathInfo,'?'))!==false)
			   $pathInfo=substr($pathInfo,0,$pos);

			$pathInfo=$this->decodePathInfo($pathInfo);

			$scriptUrl=$this->getScriptUrl();
			$baseUrl=$this->getBaseUrl();
			if(strpos($pathInfo,$scriptUrl)===0)
				$pathInfo=substr($pathInfo,strlen($scriptUrl));
			elseif($baseUrl==='' || strpos($pathInfo,$baseUrl)===0)
				$pathInfo=substr($pathInfo,strlen($baseUrl));
			elseif(strpos($_SERVER['PHP_SELF'],$scriptUrl)===0)
				$pathInfo=substr($_SERVER['PHP_SELF'],strlen($scriptUrl));
			else
				throw new CException(Yii::t('yii','CHttpRequest is unable to determine the path info of the request.'));

			$this->_pathInfo=trim($pathInfo,'/');
		}
		return $this->_pathInfo;
	}

	/**
	 * Decodes the path info.
	 * This method is an improved variant of the native urldecode() function and used in {@link getPathInfo getPathInfo()} to
	 * decode the path part of the request URI. You may override this method to change the way the path info is being decoded.
	 * @param string $pathInfo encoded path info
	 * @return string decoded path info
	 * @since 1.1.10
	 */
	protected function decodePathInfo($pathInfo)
	{
		$pathInfo = urldecode($pathInfo);

		// is it UTF-8?
		// http://w3.org/International/questions/qa-forms-utf-8.html
		if(preg_match('%^(?:
		   [\x09\x0A\x0D\x20-\x7E]            # ASCII
		 | [\xC2-\xDF][\x80-\xBF]             # non-overlong 2-byte
		 | \xE0[\xA0-\xBF][\x80-\xBF]         # excluding overlongs
		 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}  # straight 3-byte
		 | \xED[\x80-\x9F][\x80-\xBF]         # excluding surrogates
		 | \xF0[\x90-\xBF][\x80-\xBF]{2}      # planes 1-3
		 | [\xF1-\xF3][\x80-\xBF]{3}          # planes 4-15
		 | \xF4[\x80-\x8F][\x80-\xBF]{2}      # plane 16
		)*$%xs', $pathInfo))
		{
			return $pathInfo;
		}
		else
		{
			return utf8_encode($pathInfo);
		}
	}

	/**
	 * Returns the request URI portion for the currently requested URL.
	 * This refers to the portion that is after the {@link hostInfo host info} part.
	 * It includes the {@link queryString query string} part if any.
	 * The implementation of this method referenced Zend_Controller_Request_Http in Zend Framework.
	 * @return string the request URI portion for the currently requested URL.
	 * @throws CException if the request URI cannot be determined due to improper server configuration
	 */
	public function getRequestUri()
	{
		if($this->_requestUri===null)
		{
			if(isset($_SERVER['HTTP_X_REWRITE_URL'])) // IIS
				$this->_requestUri=$_SERVER['HTTP_X_REWRITE_URL'];
			elseif(isset($_SERVER['REQUEST_URI']))
			{
				$this->_requestUri=$_SERVER['REQUEST_URI'];
				if(!empty($_SERVER['HTTP_HOST']))
				{
					if(strpos($this->_requestUri,$_SERVER['HTTP_HOST'])!==false)
						$this->_requestUri=preg_replace('/^\w+:\/\/[^\/]+/','',$this->_requestUri);
				}
				else
					$this->_requestUri=preg_replace('/^(http|https):\/\/[^\/]+/i','',$this->_requestUri);
			}
			elseif(isset($_SERVER['ORIG_PATH_INFO']))  // IIS 5.0 CGI
			{
				$this->_requestUri=$_SERVER['ORIG_PATH_INFO'];
				if(!empty($_SERVER['QUERY_STRING']))
					$this->_requestUri.='?'.$_SERVER['QUERY_STRING'];
			}
			else
				throw new CException(Yii::t('yii','CHttpRequest is unable to determine the request URI.'));
		}

		return $this->_requestUri;
	}

	/**
	 * Returns part of the request URL that is after the question mark.
	 * @return string part of the request URL that is after the question mark
	 */
	public function getQueryString()
	{
		return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:'';
	}

	/**
	 * Return if the request is sent via secure channel (https).
	 * @return boolean if the request is sent via secure channel (https)
	 */
	public function getIsSecureConnection()
	{
		return isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']=='on' || $_SERVER['HTTPS']==1)
			|| isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO']=='https';
	}

	/**
	 * Returns the request type, such as GET, POST, HEAD, PUT, DELETE.
	 * Request type can be manually set in POST requests with a parameter named _method. Useful
	 * for RESTful request from older browsers which do not support PUT or DELETE
	 * natively (available since version 1.1.11).
	 * @return string request type, such as GET, POST, HEAD, PUT, DELETE.
	 */
	public function getRequestType()
	{
		if(isset($_POST['_method']))
			return strtoupper($_POST['_method']);

		return strtoupper(isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:'GET');
	}

	/**
	 * Returns whether this is a POST request.
	 * @return boolean whether this is a POST request.
	 */
	public function getIsPostRequest()
	{
		return isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'POST');
	}

	/**
	 * Returns whether this is a DELETE request.
	 * @return boolean whether this is a DELETE request.
	 * @since 1.1.7
	 */
	public function getIsDeleteRequest()
	{
		return (isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'DELETE')) || $this->getIsDeleteViaPostRequest();
	}

	/**
	 * Returns whether this is a DELETE request which was tunneled through POST.
	 * @return boolean whether this is a DELETE request tunneled through POST.
	 * @since 1.1.11
	 */
	protected function getIsDeleteViaPostRequest()
	{
		return isset($_POST['_method']) && !strcasecmp($_POST['_method'],'DELETE');
	}

	/**
	 * Returns whether this is a PUT request.
	 * @return boolean whether this is a PUT request.
	 * @since 1.1.7
	 */
	public function getIsPutRequest()
	{
		return (isset($_SERVER['REQUEST_METHOD']) && !strcasecmp($_SERVER['REQUEST_METHOD'],'PUT')) || $this->getIsPutViaPostRequest();
	}

	/**
	 * Returns whether this is a PUT request which was tunneled through POST.
	 * @return boolean whether this is a PUT request tunneled through POST.
	 * @since 1.1.11
	 */
	protected function getIsPutViaPostRequest()
	{
		return isset($_POST['_method']) && !strcasecmp($_POST['_method'],'PUT');
	}

	/**
	 * Returns whether this is an AJAX (XMLHttpRequest) request.
	 * @return boolean whether this is an AJAX (XMLHttpRequest) request.
	 */
	public function getIsAjaxRequest()
	{
		return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH']==='XMLHttpRequest';
	}

	/**
	 * Returns whether this is an Adobe Flash or Adobe Flex request.
	 * @return boolean whether this is an Adobe Flash or Adobe Flex request.
	 * @since 1.1.11
	 */
	public function getIsFlashRequest()
	{
		return isset($_SERVER['HTTP_USER_AGENT']) && (stripos($_SERVER['HTTP_USER_AGENT'],'Shockwave')!==false || stripos($_SERVER['HTTP_USER_AGENT'],'Flash')!==false);
	}

	/**
	 * Returns the server name.
	 * @return string server name
	 */
	public function getServerName()
	{
		return $_SERVER['SERVER_NAME'];
	}

	/**
	 * Returns the server port number.
	 * @return integer server port number
	 */
	public function getServerPort()
	{
		return $_SERVER['SERVER_PORT'];
	}

	/**
	 * Returns the URL referrer, null if not present
	 * @return string URL referrer, null if not present
	 */
	public function getUrlReferrer()
	{
		return isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:null;
	}

	/**
	 * Returns the user agent, null if not present.
	 * @return string user agent, null if not present
	 */
	public function getUserAgent()
	{
		return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
	}

	/**
	 * Returns the user IP address.
	 * @return string user IP address
	 */
	public function getUserHostAddress()
	{
		return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:'127.0.0.1';
	}

	/**
	 * Returns the user host name, null if it cannot be determined.
	 * @return string user host name, null if cannot be determined
	 */
	public function getUserHost()
	{
		return isset($_SERVER['REMOTE_HOST'])?$_SERVER['REMOTE_HOST']:null;
	}

	/**
	 * Returns entry script file path.
	 * @return string entry script file path (processed w/ realpath())
	 */
	public function getScriptFile()
	{
		if($this->_scriptFile!==null)
			return $this->_scriptFile;
		else
			return $this->_scriptFile=realpath($_SERVER['SCRIPT_FILENAME']);
	}

	/**
	 * Returns information about the capabilities of user browser.
	 * @param string $userAgent the user agent to be analyzed. Defaults to null, meaning using the
	 * current User-Agent HTTP header information.
	 * @return array user browser capabilities.
	 * @see http://www.php.net/manual/en/function.get-browser.php
	 */
	public function getBrowser($userAgent=null)
	{
		return get_browser($userAgent,true);
	}

	/**
	 * Returns user browser accept types, null if not present.
	 * @return string user browser accept types, null if not present
	 */
	public function getAcceptTypes()
	{
		return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
	}

	private $_port;

 	/**
	 * Returns the port to use for insecure requests.
	 * Defaults to 80, or the port specified by the server if the current
	 * request is insecure.
	 * You may explicitly specify it by setting the {@link setPort port} property.
	 * @return integer port number for insecure requests.
	 * @see setPort
	 * @since 1.1.3
	 */
	public function getPort()
	{
		if($this->_port===null)
			$this->_port=!$this->getIsSecureConnection() && isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER_PORT'] : 80;
		return $this->_port;
	}

	/**
	 * Sets the port to use for insecure requests.
	 * This setter is provided in case a custom port is necessary for certain
	 * server configurations.
	 * @param integer $value port number.
	 * @since 1.1.3
	 */
	public function setPort($value)
	{
		$this->_port=(int)$value;
		$this->_hostInfo=null;
	}

	private $_securePort;

	/**
	 * Returns the port to use for secure requests.
	 * Defaults to 443, or the port specified by the server if the current
	 * request is secure.
	 * You may explicitly specify it by setting the {@link setSecurePort securePort} property.
	 * @return integer port number for secure requests.
	 * @see setSecurePort
	 * @since 1.1.3
	 */
	public function getSecurePort()
	{
		if($this->_securePort===null)
			$this->_securePort=$this->getIsSecureConnection() && isset($_SERVER['SERVER_PORT']) ? (int)$_SERVER['SERVER_PORT'] : 443;
		return $this->_securePort;
	}

	/**
	 * Sets the port to use for secure requests.
	 * This setter is provided in case a custom port is necessary for certain
	 * server configurations.
	 * @param integer $value port number.
	 * @since 1.1.3
	 */
	public function setSecurePort($value)
	{
		$this->_securePort=(int)$value;
		$this->_hostInfo=null;
	}

	/**
	 * Returns the cookie collection.
	 * The result can be used like an associative array. Adding {@link CHttpCookie} objects
	 * to the collection will send the cookies to the client; and removing the objects
	 * from the collection will delete those cookies on the client.
	 * @return CCookieCollection the cookie collection.
	 */
	public function getCookies()
	{
		if($this->_cookies!==null)
			return $this->_cookies;
		else
			return $this->_cookies=new CCookieCollection($this);
	}

	/**
	 * Redirects the browser to the specified URL.
	 * @param string $url URL to be redirected to. Note that when URL is not
	 * absolute (not starting with "/") it will be relative to current request URL.
	 * @param boolean $terminate whether to terminate the current application
	 * @param integer $statusCode the HTTP status code. Defaults to 302. See {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html}
	 * for details about HTTP status code.
	 */
	public function redirect($url,$terminate=true,$statusCode=302)
	{
		if(strpos($url,'/')===0 && strpos($url,'//')!==0)
			$url=$this->getHostInfo().$url;
		header('Location: '.$url, true, $statusCode);
		if($terminate)
			Yii::app()->end();
	}

	/**
	 * Parses an HTTP Accept header, returning an array map with all parts of each entry.
	 * Each array entry consists of a map with the type, subType, baseType and params, an array map of key-value parameters,
	 * obligatorily including a `q` value (i.e. preference ranking) as a double.
	 * For example, an Accept header value of <code>'application/xhtml+xml;q=0.9;level=1'</code> would give an array entry of
	 * <pre>
	 * array(
	 *        'type' => 'application',
	 *        'subType' => 'xhtml',
	 *        'baseType' => 'xml',
	 *        'params' => array(
	 *            'q' => 0.9,
	 *            'level' => '1',
	 *        ),
	 * )
	 * </pre>
	 *
	 * <b>Please note:</b>
	 * To avoid great complexity, there are no steps taken to ensure that quoted strings are treated properly.
	 * If the header text includes quoted strings containing space or the , or ; characters then the results may not be correct!
	 *
	 * See also {@link http://tools.ietf.org/html/rfc2616#section-14.1} for details on Accept header.
	 * @param string $header the accept header value to parse
	 * @return array the user accepted MIME types.
	 */
	public static function parseAcceptHeader($header)
	{
		$matches=array();
		$accepts=array();
		// get individual entries with their type, subtype, basetype and params
		preg_match_all('/(?:\G\s?,\s?|^)(\w+|\*)\/(\w+|\*)(?:\+(\w+))?|(?<!^)\G(?:\s?;\s?(\w+)=([\w\.]+))/',$header,$matches);
		// the regexp should (in theory) always return an array of 6 arrays
		if(count($matches)===6)
		{
			$i=0;
			$itemLen=count($matches[1]);
			while($i<$itemLen)
			{
				// fill out a content type
				$accept=array(
					'type'=>$matches[1][$i],
					'subType'=>$matches[2][$i],
					'baseType'=>null,
					'params'=>array(),
				);
				// fill in the base type if it exists
				if($matches[3][$i]!==null && $matches[3][$i]!=='')
					$accept['baseType']=$matches[3][$i];
				// continue looping while there is no new content type, to fill in all accompanying params
				for($i++;$i<$itemLen;$i++)
				{
					// if the next content type is null, then the item is a param for the current content type
					if($matches[1][$i]===null || $matches[1][$i]==='')
					{
						// if this is the quality param, convert it to a double
						if($matches[4][$i]==='q')
						{
							// sanity check on q value
							$q=(double)$matches[5][$i];
							if($q>1)
								$q=(double)1;
							elseif($q<0)
								$q=(double)0;
							$accept['params'][$matches[4][$i]]=$q;
						}
						else
							$accept['params'][$matches[4][$i]]=$matches[5][$i];
					}
					else
						break;
				}
				// q defaults to 1 if not explicitly given
				if(!isset($accept['params']['q']))
					$accept['params']['q']=(double)1;
				$accepts[] = $accept;
			}
		}
		return $accepts;
	}

	/**
	 * Compare function for determining the preference of accepted MIME type array maps
	 * See {@link parseAcceptHeader()} for the format of $a and $b
	 * @param array $a user accepted MIME type as an array map
	 * @param array $b user accepted MIME type as an array map
	 * @return integer -1, 0 or 1 if $a has respectively greater preference, equal preference or less preference than $b (higher preference comes first).
	 */
	public static function compareAcceptTypes($a,$b)
	{
		// check for equal quality first
		if($a['params']['q']===$b['params']['q'])
			if(!($a['type']==='*' xor $b['type']==='*'))
				if (!($a['subType']==='*' xor $b['subType']==='*'))
					// finally, higher number of parameters counts as greater precedence
					if(count($a['params'])===count($b['params']))
						return 0;
					else
						return count($a['params'])<count($b['params']) ? 1 : -1;
				// more specific takes precedence - whichever one doesn't have a * subType
				else
					return $a['subType']==='*' ? 1 : -1;
			// more specific takes precedence - whichever one doesn't have a * type
			else
				return $a['type']==='*' ? 1 : -1;
		else
			return ($a['params']['q']<$b['params']['q']) ? 1 : -1;
	}

	/**
	 * Returns an array of user accepted MIME types in order of preference.
	 * Each array entry consists of a map with the type, subType, baseType and params, an array map of key-value parameters.
	 * See {@link parseAcceptHeader()} for a description of the array map.
	 * @return array the user accepted MIME types, as array maps, in the order of preference.
	 */
	public function getPreferredAcceptTypes()
	{
		if($this->_preferredAcceptTypes===null)
		{
			$accepts=self::parseAcceptHeader($this->getAcceptTypes());
			usort($accepts,array(get_class($this),'compareAcceptTypes'));
			$this->_preferredAcceptTypes=$accepts;
		}
		return $this->_preferredAcceptTypes;
	}

	/**
	 * Returns the user preferred accept MIME type.
	 * The MIME type is returned as an array map (see {@link parseAcceptHeader()}).
	 * @return array the user preferred accept MIME type or false if the user does not have any.
	 */
	public function getPreferredAcceptType()
	{
		$preferredAcceptTypes=$this->getPreferredAcceptTypes();
		return empty($preferredAcceptTypes) ? false : $preferredAcceptTypes[0];
	}

	/**
	 * Returns an array of user accepted languages in order of preference.
	 * The returned language IDs will NOT be canonicalized using {@link CLocale::getCanonicalID}.
	 * @return array the user accepted languages in the order of preference.
	 * See {@link http://tools.ietf.org/html/rfc2616#section-14.4}
	 */
	public function getPreferredLanguages()
	{
		if($this->_preferredLanguages===null)
		{
			$sortedLanguages=array();
			if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && $n=preg_match_all('/([\w\-_]+)(?:\s*;\s*q\s*=\s*(\d*\.?\d*))?/',$_SERVER['HTTP_ACCEPT_LANGUAGE'],$matches))
			{
				$languages=array();

				for($i=0;$i<$n;++$i)
				{
					$q=$matches[2][$i];
					if($q==='')
						$q=1;
					if($q)
						$languages[]=array((float)$q,$matches[1][$i]);
				}

				usort($languages,create_function('$a,$b','if($a[0]==$b[0]) {return 0;} return ($a[0]<$b[0]) ? 1 : -1;'));
				foreach($languages as $language)
					$sortedLanguages[]=$language[1];
			}
			$this->_preferredLanguages=$sortedLanguages;
		}
		return $this->_preferredLanguages;
	}

	/**
	 * Returns the user preferred language.
	 * The returned language ID will be canonicalized using {@link CLocale::getCanonicalID}.
	 * @return string the user preferred language or false if the user does not have any.
	 */
	public function getPreferredLanguage()
	{
		$preferredLanguages=$this->getPreferredLanguages();
		return !empty($preferredLanguages) ? CLocale::getCanonicalID($preferredLanguages[0]) : false;
	}

	/**
	 * Sends a file to user.
	 * @param string $fileName file name
	 * @param string $content content to be set.
	 * @param string $mimeType mime type of the content. If null, it will be guessed automatically based on the given file name.
	 * @param boolean $terminate whether to terminate the current application after calling this method
	 */
	public function sendFile($fileName,$content,$mimeType=null,$terminate=true)
	{
		if($mimeType===null)
		{
			if(($mimeType=CFileHelper::getMimeTypeByExtension($fileName))===null)
				$mimeType='text/plain';
		}

		$fileSize=(function_exists('mb_strlen') ? mb_strlen($content,'8bit') : strlen($content));
		$contentStart=0;
		$contentEnd=$fileSize-1;

		if(isset($_SERVER['HTTP_RANGE']))
		{
			header('Accept-Ranges: bytes');

			//client sent us a multibyte range, can not hold this one for now
			if(strpos($_SERVER['HTTP_RANGE'],',')!==false)
			{
				header("Content-Range: bytes $contentStart-$contentEnd/$fileSize");
				throw new CHttpException(416,'Requested Range Not Satisfiable');
			}

			$range=str_replace('bytes=','',$_SERVER['HTTP_RANGE']);

			//range requests starts from "-", so it means that data must be dumped the end point.
			if($range[0]==='-')
				$contentStart=$fileSize-substr($range,1);
			else
			{
				$range=explode('-',$range);
				$contentStart=$range[0];

				// check if the last-byte-pos presents in header
				if((isset($range[1]) && is_numeric($range[1])))
					$contentEnd=$range[1];
			}

			/* Check the range and make sure it's treated according to the specs.
			 * http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
			 */
			// End bytes can not be larger than $end.
			$contentEnd=($contentEnd > $fileSize) ? $fileSize-1 : $contentEnd;

			// Validate the requested range and return an error if it's not correct.
			$wrongContentStart=($contentStart>$contentEnd || $contentStart>$fileSize-1 || $contentStart<0);

			if($wrongContentStart)
			{
				header("Content-Range: bytes $contentStart-$contentEnd/$fileSize");
				throw new CHttpException(416,'Requested Range Not Satisfiable');
			}

			header('HTTP/1.1 206 Partial Content');
			header("Content-Range: bytes $contentStart-$contentEnd/$fileSize");
		}
		else
			header('HTTP/1.1 200 OK');

		$length=$contentEnd-$contentStart+1; // Calculate new content length

		header('Pragma: public');
		header('Expires: 0');
		header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
		header("Content-type: $mimeType");
		header('Content-Length: '.$length);
		header("Content-Disposition: attachment; filename=\"$fileName\"");
		header('Content-Transfer-Encoding: binary');
		$content=function_exists('mb_substr') ? mb_substr($content,$contentStart,$length) : substr($content,$contentStart,$length);

		if($terminate)
		{
			// clean up the application first because the file downloading could take long time
			// which may cause timeout of some resources (such as DB connection)
			ob_start();
			Yii::app()->end(0,false);
			ob_end_clean();
			echo $content;
			exit(0);
		}
		else
			echo $content;
	}

	/**
	 * Sends existing file to a browser as a download using x-sendfile.
	 *
	 * X-Sendfile is a feature allowing a web application to redirect the request for a file to the webserver
	 * that in turn processes the request, this way eliminating the need to perform tasks like reading the file
	 * and sending it to the user. When dealing with a lot of files (or very big files) this can lead to a great
	 * increase in performance as the web application is allowed to terminate earlier while the webserver is
	 * handling the request.
	 *
	 * The request is sent to the server through a special non-standard HTTP-header.
	 * When the web server encounters the presence of such header it will discard all output and send the file
	 * specified by that header using web server internals including all optimizations like caching-headers.
	 *
	 * As this header directive is non-standard different directives exists for different web servers applications:
	 * <ul>
	 * <li>Apache: {@link http://tn123.org/mod_xsendfile X-Sendfile}</li>
	 * <li>Lighttpd v1.4: {@link http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file X-LIGHTTPD-send-file}</li>
	 * <li>Lighttpd v1.5: {@link http://redmine.lighttpd.net/projects/lighttpd/wiki/X-LIGHTTPD-send-file X-Sendfile}</li>
	 * <li>Nginx: {@link http://wiki.nginx.org/XSendfile X-Accel-Redirect}</li>
	 * <li>Cherokee: {@link http://www.cherokee-project.com/doc/other_goodies.html#x-sendfile X-Sendfile and X-Accel-Redirect}</li>
	 * </ul>
	 * So for this method to work the X-SENDFILE option/module should be enabled by the web server and
	 * a proper xHeader should be sent.
	 *
	 * <b>Note:</b>
	 * This option allows to download files that are not under web folders, and even files that are otherwise protected (deny from all) like .htaccess
	 *
	 * <b>Side effects</b>:
	 * If this option is disabled by the web server, when this method is called a download configuration dialog
	 * will open but the downloaded file will have 0 bytes.
	 *
	 * <b>Known issues</b>:
	 * There is a Bug with Internet Explorer 6, 7 and 8 when X-SENDFILE is used over an SSL connection, it will show
	 * an error message like this: "Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found.".
	 * You can work around this problem by removing the <code>Pragma</code>-header.
	 *
	 * <b>Example</b>:
	 * <pre>
	 * <?php
	 *    Yii::app()->request->xSendFile('/home/user/Pictures/picture1.jpg',array(
	 *        'saveName'=>'image1.jpg',
	 *        'mimeType'=>'image/jpeg',
	 *        'terminate'=>false,
	 *    ));
	 * ?>
	 * </pre>
	 * @param string $filePath file name with full path
	 * @param array $options additional options:
	 * <ul>
	 * <li>saveName: file name shown to the user, if not set real file name will be used</li>
	 * <li>mimeType: mime type of the file, if not set it will be guessed automatically based on the file name, if set to null no content-type header will be sent.</li>
	 * <li>xHeader: appropriate x-sendfile header, defaults to "X-Sendfile"</li>
	 * <li>terminate: whether to terminate the current application after calling this method, defaults to true</li>
	 * <li>forceDownload: specifies whether the file will be downloaded or shown inline, defaults to true. (Since version 1.1.9.)</li>
	 * <li>addHeaders: an array of additional http headers in header-value pairs (available since version 1.1.10)</li>
	 * </ul>
	 */
	public function xSendFile($filePath, $options=array())
	{
		if(!isset($options['forceDownload']) || $options['forceDownload'])
			$disposition='attachment';
		else
			$disposition='inline';

		if(!isset($options['saveName']))
			$options['saveName']=basename($filePath);

		if(!isset($options['mimeType']))
		{
			if(($options['mimeType']=CFileHelper::getMimeTypeByExtension($filePath))===null)
				$options['mimeType']='text/plain';
		}

		if(!isset($options['xHeader']))
			$options['xHeader']='X-Sendfile';

		if($options['mimeType']!==null)
			header('Content-type: '.$options['mimeType']);
		header('Content-Disposition: '.$disposition.'; filename="'.$options['saveName'].'"');
		if(isset($options['addHeaders']))
		{
			foreach($options['addHeaders'] as $header=>$value)
				header($header.': '.$value);
		}
		header(trim($options['xHeader']).': '.$filePath);

		if(!isset($options['terminate']) || $options['terminate'])
			Yii::app()->end();
	}

	/**
	 * Returns the random token used to perform CSRF validation.
	 * The token will be read from cookie first. If not found, a new token
	 * will be generated.
	 * @return string the random token for CSRF validation.
	 * @see enableCsrfValidation
	 */
	public function getCsrfToken()
	{
		if($this->_csrfToken===null)
		{
			$cookie=$this->getCookies()->itemAt($this->csrfTokenName);
			if(!$cookie || ($this->_csrfToken=$cookie->value)==null)
			{
				$cookie=$this->createCsrfCookie();
				$this->_csrfToken=$cookie->value;
				$this->getCookies()->add($cookie->name,$cookie);
			}
		}

		return $this->_csrfToken;
	}

	/**
	 * Creates a cookie with a randomly generated CSRF token.
	 * Initial values specified in {@link csrfCookie} will be applied
	 * to the generated cookie.
	 * @return CHttpCookie the generated cookie
	 * @see enableCsrfValidation
	 */
	protected function createCsrfCookie()
	{
		$cookie=new CHttpCookie($this->csrfTokenName,sha1(uniqid(mt_rand(),true)));
		if(is_array($this->csrfCookie))
		{
			foreach($this->csrfCookie as $name=>$value)
				$cookie->$name=$value;
		}
		return $cookie;
	}

	/**
	 * Performs the CSRF validation.
	 * This is the event handler responding to {@link CApplication::onBeginRequest}.
	 * The default implementation will compare the CSRF token obtained
	 * from a cookie and from a POST field. If they are different, a CSRF attack is detected.
	 * @param CEvent $event event parameter
	 * @throws CHttpException if the validation fails
	 */
	public function validateCsrfToken($event)
	{
		if ($this->getIsPostRequest() ||
			$this->getIsPutRequest() ||
			$this->getIsDeleteRequest())
		{
			$cookies=$this->getCookies();

			$method=$this->getRequestType();
			switch($method)
			{
				case 'POST':
					$userToken=$this->getPost($this->csrfTokenName);
				break;
				case 'PUT':
					$userToken=$this->getPut($this->csrfTokenName);
				break;
				case 'DELETE':
					$userToken=$this->getDelete($this->csrfTokenName);
			}

			if (!empty($userToken) && $cookies->contains($this->csrfTokenName))
			{
				$cookieToken=$cookies->itemAt($this->csrfTokenName)->value;
				$valid=$cookieToken===$userToken;
			}
			else
				$valid = false;
			if (!$valid)
				throw new CHttpException(400,Yii::t('yii','The CSRF token could not be verified.'));
		}
	}
}

/**
 * CCookieCollection implements a collection class to store cookies.
 *
 * You normally access it via {@link CHttpRequest::getCookies()}.
 *
 * Since CCookieCollection extends from {@link CMap}, it can be used
 * like an associative array as follows:
 * <pre>
 * $cookies[$name]=new CHttpCookie($name,$value); // sends a cookie
 * $value=$cookies[$name]->value; // reads a cookie value
 * unset($cookies[$name]);  // removes a cookie
 * </pre>
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package system.web
 * @since 1.0
 */
class CCookieCollection extends CMap
{
	private $_request;
	private $_initialized=false;

	/**
	 * Constructor.
	 * @param CHttpRequest $request owner of this collection.
	 */
	public function __construct(CHttpRequest $request)
	{
		$this->_request=$request;
		$this->copyfrom($this->getCookies());
		$this->_initialized=true;
	}

	/**
	 * @return CHttpRequest the request instance
	 */
	public function getRequest()
	{
		return $this->_request;
	}

	/**
	 * @return array list of validated cookies
	 */
	protected function getCookies()
	{
		$cookies=array();
		if($this->_request->enableCookieValidation)
		{
			$sm=Yii::app()->getSecurityManager();
			foreach($_COOKIE as $name=>$value)
			{
				if(is_string($value) && ($value=$sm->validateData($value))!==false)
					$cookies[$name]=new CHttpCookie($name,@unserialize($value));
			}
		}
		else
		{
			foreach($_COOKIE as $name=>$value)
				$cookies[$name]=new CHttpCookie($name,$value);
		}
		return $cookies;
	}

	/**
	 * Adds a cookie with the specified name.
	 * This overrides the parent implementation by performing additional
	 * operations for each newly added CHttpCookie object.
	 * @param mixed $name Cookie name.
	 * @param CHttpCookie $cookie Cookie object.
	 * @throws CException if the item to be inserted is not a CHttpCookie object.
	 */
	public function add($name,$cookie)
	{
		if($cookie instanceof CHttpCookie)
		{
			$this->remove($name);
			parent::add($name,$cookie);
			if($this->_initialized)
				$this->addCookie($cookie);
		}
		else
			throw new CException(Yii::t('yii','CHttpCookieCollection can only hold CHttpCookie objects.'));
	}

	/**
	 * Removes a cookie with the specified name.
	 * This overrides the parent implementation by performing additional
	 * cleanup work when removing a CHttpCookie object.
	 * Since version 1.1.11, the second parameter is available that can be used to specify
	 * the options of the CHttpCookie being removed. For example, this may be useful when dealing
	 * with ".domain.tld" where multiple subdomains are expected to be able to manage cookies:
	 *
	 * <pre>
	 * $options=array('domain'=>'.domain.tld');
	 * Yii::app()->request->cookies['foo']=new CHttpCookie('cookie','value',$options);
	 * Yii::app()->request->cookies->remove('cookie',$options);
	 * </pre>
	 *
	 * @param mixed $name Cookie name.
	 * @param array $options Cookie configuration array consisting of name-value pairs, available since 1.1.11.
	 * @return CHttpCookie The removed cookie object.
	 */
	public function remove($name,$options=array())
	{
		if(($cookie=parent::remove($name))!==null)
		{
			if($this->_initialized)
			{
				$cookie->configure($options);
				$this->removeCookie($cookie);
			}
		}

		return $cookie;
	}

	/**
	 * Sends a cookie.
	 * @param CHttpCookie $cookie cookie to be sent
	 */
	protected function addCookie($cookie)
	{
		$value=$cookie->value;
		if($this->_request->enableCookieValidation)
			$value=Yii::app()->getSecurityManager()->hashData(serialize($value));
		if(version_compare(PHP_VERSION,'5.2.0','>='))
			setcookie($cookie->name,$value,$cookie->expire,$cookie->path,$cookie->domain,$cookie->secure,$cookie->httpOnly);
		else
			setcookie($cookie->name,$value,$cookie->expire,$cookie->path,$cookie->domain,$cookie->secure);
	}

	/**
	 * Deletes a cookie.
	 * @param CHttpCookie $cookie cookie to be deleted
	 */
	protected function removeCookie($cookie)
	{
		if(version_compare(PHP_VERSION,'5.2.0','>='))
			setcookie($cookie->name,'',0,$cookie->path,$cookie->domain,$cookie->secure,$cookie->httpOnly);
		else
			setcookie($cookie->name,'',0,$cookie->path,$cookie->domain,$cookie->secure);
	}
}


text:
Introduce a Co-operative Economy Act
A legal framework tailored to the needs of co-operatives and supportive of their future development.
A Co-operative Economy Act must address the current disincentives to co-operative growth that exist in regulation and law, ensure co-operative wealth is rooted in the wider co-operative economy, and create the conditions for the accumulation of co-operative capital and commercial expansion.
A Co-operative Economy Act should establish the legal framework, financial instruments and institutional mechanisms needed to:
Create an asset lock and common indivisible reserves
An asset lock would ensure there can never be a benefit from 'cashing out' via liquidating or selling the co-operative, keeping co-operatively earned wealth within the co-operative economy.
Introduce a right to own
A right to own would support employee buyouts and the co-operatisation of existing businesses.
Introduce a duty to develop the diversity of corporate form
The government must provide official recognition of co‑operatives as inclusive business models, and introduce a new statutory duty to foster diversity of corporate forms to help enable a new culture of co‑operative entrepreneurship, and broader pluralism of ownership in the economy as a whole.
Establish a Co-operative Development Agency
To strengthen the development of the sector, a Co-operative Development Agency for England and Northern Ireland should be established on a statutory basis. This would mirror the institutional support provided to co-operatives in Scotland and Wales.
Tags Democratic ownership
Co-operatives unleashed. New Economics Foundation, 2018
Prosperity and justice: A plan for the new economy (ch 12). IPPR, 2018
Policy in practice
Projects that demonstrate the benefits or may be helped by polices like this.
Founder Julian Richer transferred 60% of his shares into a John Lewis-style trust.
Novograf
Former owners sold leading signage company to its workforce.
Scallywags nursery
Parents collaborate with skilled staff to provide high-quality affordable care at this well-established nursery.
North West Mutual
Community bank will help local businesses and individuals neglected by mainstream banks.
Equal Care Co-op
Co-op matches those seeking care with care workers and professionally trained volunteers.
Riverford Organics
Riverford switched to employee ownership to protect its values and independence in 2018.
This workers' co-operative connects local growers with businesses in the fightback against food poverty.
Founders of UK's biggest animation company handed 75% share to employees to 'safeguard independence'.
Schools' Energy Co-operative
Schools' Energy Co-operative has installed solar panels on schools across the country, working with a network of local groups.
Robert Owen Community Banking
Ethical fund provides finance for small businesses, home improvements and community energy projects.