Conferences St. Petersburg International Legal Forum is a unique international conference that brings together the leading minds of the legal profession. The annual SPBILF, founded in 2011, is organized under the support of the Ministry of Justice of the Russian Federation and the President of the Russian Federation. Over the years, the SPBILF has emerged as a foremost international platform for discussing a broad range of urgent questions confronting the contemporary international community of legal professionals.
As preparation gains momentum for the SPBILF, we have put a series of conferences in the pipeline to address a number of issues of urgent concern for legal services professionals and for the business community. The agenda addressed by the conferences, and the outputs of the debates lay down a solid foundation, on which the planners build as they design roundtables for the Forum's business programme.
Conferences are hosted by the new project – LF Academy – the online information and educational resource for legal services professionals.
As partners in hosting the upcoming conferences, we are proud to be joined by the best in different fields of law, who are steady participants of SPILF roundtable debates. Our partners represent the pertinent government regulators, academia, professionals groups and associations and, last but not least, the business community.
As a corollary to having planned the SPBILF executive programme in partnership with government regulators for many years, this time it was our collaborative idea to stage the conferences under a shared aegis. Mutually rewarding relations with the business community constitute a priority development vector for SPBILF. We are continually in dialogue with our partners on the Forum's executive programme, addressing issues of particular relevance to the marketplace, and assisting in the building of interfaces between the government and the business community.
There are just over 15 conferences on our current schedule, which have been tentatively preapproved. The regulators Rostekhnadzor, Roskomnadzor, Rostrud, Rosfinmonitoring will be joining us as co-hosts in addition to our customary partners Rospotrebnadzor, Rosreestr, Rospatent, Antimonopoly Service, Taxation Service, Central Bank, Skolkovo Foundation and the Federal Office of Court Bailiffs.
According to the new Russian arbitration law, after 1 November 2017, only those arbitral institutions that have obtained a governmental authorization and complied with the new strict requirements will be able to administer arbitration. In this regard, one of the crucial tasks for arbitral institutions upon the expiration of the transitional period will be to gain credibility and respect not only from business, but also from state courts.
What should be done in this course? Has the arbitration reform succeeded in increasing quality of administration of arbitration and credibility of arbitral institutions? Which jurisdictions and their experience can be helpful for Russia in dealing with the abovementioned challenges? These questions will be analyzed during the first session.
The arbitration reform has also significantly modified the framework for interaction between state courts and arbitration. During the second session, judicial assistance and supervision in arbitration in practice of the Russian and foreign state courts will be discussed.
Moreover, prominent arbitration practitioners will share their experience and discuss the most relevant practical questions with the participants of the conference during an interactive workshop.
Is the compliance to its jurisdiction and subsidiary role relating to national legal systems provided by the European Court of Justice? How is the dialogue between Court and national courts or other international jurisdictional bodies built? Should Strasbourg consider legal distinctions of member countries? What problems will be in focus of attention of the Court in the next few years? These questions will be the subjects of future Conference with authoritative Russian and foreign experts participating, on the example of issues, related to implementation of "effective control" concept and respect of the freedom of speech right.
In the context of increasing economic integration within the CIS, the EEU and BRICS, questions of international legal regulation, including antimonopoly regulation, within new economic communities become more urgent. This Conference will be dedicated to mechanisms of anti-cartel enforcement, main trends of development of international and domestic legislations, practical aspects of cross-border investigations within the CIS, the EEU and BRICS.
Organizers are LF Academy, Non-Commercial Partnership "Competition Promotion in the CIS Countries" under the auspices of St. Petersburg International Legal Forum and the FAS Russia.
Russian Arbitration Day (RAD) – one of the most successful arbitration conferences in Russia – resumes its operation with support from the Arbitration Centre of the Institute of Modern Arbitration and the LF Academy educational project.
Submission of papers for presentation at RAD 2018 is now open!
Registration of participants opens on January 15, 2018.
Organizers are LF Academy, the Arbitration Center at ANO "ISA" under the auspices of St. Petersburg International Legal Forum.
Representatives of the leading Russian and foreign arbitration institutions will examine recent substantial changes in arbitration rules applied by the overwhelming majority of the most prominent international arbitration institutions over the last years. Foreign experience has its impact on the changes in the Russian arbitration legislation. The issue is therewith currently essential in view of the changes in the practical aspects of arbitration triggered by the developments in arbitration regulations.
Participants of the Conference will have an opportunity to discuss in details the most complex and essential challenges of international commercial arbitration and find out the opinion of professionals in arbitration from foreign jurisdictions.
The Conference will cover the reformation of the Civil Code of the Russian Federation and recent changes in corporate legislation. Participants will discuss in details the key statutes of the Article 67.2 The Corporate Agreement of the Civil Code of Russia, analyze the provisions on the individual executive body in the Civil Code of Russia and will try to determine and consider the issues of the regulation of legal entities' reorganization.
The above-mentioned topics are therewith of great current interest due to the necessity of implementation of the novelties in the special legislation.
Conference is hosted by LF Academy, under the auspice of the St. Petersburg International Legal Forum.
Russia and China continue to draw closer in the economic and political spheres. And yet this convergence is impossible without conjunction in the legal sphere.
On September 1, 2016 the new Federal Law «On Arbitration (arbitration proceedings) in Russia» came into force. Besides completely new arbitration law, significant amendments were made to the Arbitration Procedural Code, Civil Procedural Code, Law «On International Commercial Arbitration» and other legal acts.
The speakers and delegates discussed how major amendments shall be applied and what the business can expect for the new arbitration and drew attention to the experience of international arbitration. Business breakfast continued a discussion opened on the Conference in Moscow, which took place on 20th of October 2016.
Conference is hosted by LF Academy and the State Hermitage Museum, Kommersant, under the auspice of the St. Petersburg International Legal Forum.
The conference was held at the General Staff Building of the State Hermitage Museum and was addressed the topical issues of owning and dealing in cultural property.


text:
You are here: Home » News Events » Monmouth Boys and Boys' Prep » Youth parliament's inaugural debate is a huge success
Monmouth Girls & Girls' Prep
Monmouth Boys & Boys' Prep
Youth parliament's inaugural debate is a huge success
How Brexit will effect education, the economy and voting at 16 were among the subjects discussed during Monmouthshire Youth Parliament's heated first event.
Organised by Beth from Haberdashers' Monmouth School for Girls and Jack from Monmouth School, the debate attracted a packed audience of under 18s at the Shire Hall on Friday evening.
Conservative MP David Davies and Monmouth Labour Party member, Catherine Fookes, were guest speakers and answered a range of challenging questions from the young crowd.
Catherine, who campaigned for Britain to remain in the EU, was delighted to see so many teens turn out for the event.
She said: "The Monmouthshire Youth Parliament is a brilliant idea. It's so important for young people to learn how to debate and share their views respectfully.
"I voted Remain but I'm here tonight because I want the best for Brexit – what do we want Brexit to look like?"
Sixth former and Labour Party member, Beth, and Year 11 pupil, Jack, founded the youth parliament in the summer holidays to give local schoolchildren an opportunity to voice their views and share their ideas.
Carefully considered and thought-provoking questions from opinionated pupils proved how engaged young people in Monmouthshire are with politics.
MP David Davies told them: "I'm here because I like doing these sorts of things. We have to look after the public and be willing to deal with difficult questions sometimes."
Following the debate, the MP praised the organising committee for arranging such a successful inaugural meeting.
"I was delighted to take part in the debate on Brexit and congratulate the youth parliament for providing a much-needed political voice to the young people of Monmouthshire," he said.
"Young people wanted to know when we will actually leave. The answer is that we could simply tear up the treaties and leave immediately.
"Instead of doing this, the government has responsibly decided to spend a few months working through issues with the rest of the EU. We will then trigger Article 50 of the Lisbon Treaty, the legal mechanism for beginning the process of rescinding our membership, which the Prime Minister has indicated is likely to happen in early 2017."
MYP's next event, which is open exclusively to under 18s, will focus on this topic in more detail.
Beth and Jack are looking for local school pupils who would like to speak on the subject.
To get involved, find the youth parliament on Twitter @MonmouthshireMYP

redpajama_set_name: RedPajamaCommonCrawl


Stunning 2018 remodel in most desirable McCormick Ranch. Professionally redesigned and appointed bathrooms (see details). Redesigned floor to ceiling fireplace, including expansive bookshelf in decorative Italian tile. Brand new ''wood plank'' tile throughout, except carpeted bedrooms. Brand new, professionally installed Bayview exterior windows, including living room /patio slider, and Therma Tru exterior front door with rain glass. Freshly painted interior, new window shades, new drip irrigation system. --See details of remodel in notes-- Conveniently located in the northern end of suught after McCormickRanch. Within walking distance to coveted Cochise Elementary School, expansive greenbelt, lake, and neighborhood restaurants.


I have got this Votre face serum in my March Fab Bag and was really happy by getting this as I have read some great reviews on this particular product from Votre.. I am using this since a month now and it is about to finish.. So below is my experience with serum..
Available at Fabbag, Nykaa, Flipkart,etc.
My Opinion: The serum comes in a dark brown glass packaging with a dropper cap.. It looks like the baby medicines, Isn't it? The dark glass packaging helps to store the aroma and effectiveness of the oil into the serum.. On the other hand due to glass packaging it is risk to carry around.. The little information tag on its neck makes it look luxurious .. The bottle is leak proof.. The dropper is so so perfect to bring right quantity each time,hence no extra product wastage ..
The serum is looks like a transparent version of white colour or you can say like water ( I have no words for this colour) .. The texture is neither runny nor thick,just perfect to apply.. I need 4-5 drops for each use .. I apply it at night regularly and sometimes in the morning as well.. After applying my toner , I take 4-5 drops of serum on my finger tips ,then warmed up a little and applied on face and neck by dabbing gently.. It absorbs by skin really quick and doesn't feel sticky or heavy on skin. I feel little dry after applying it ,hence I need a moisturiser after it.. I have normal to dry skin type but i am sure oily skin girls would rock it.. I don't see any brightening effect after using it,but it makes my skin soft.. It has very mild fragrance which I love again.. I can't comment about its performance on wrinkles or fine lines as I don't have any till now.. But I can say that, with regular uses of this serum ,your skin texture can improved to some extent as skincare products need time to show their result..
Very light for dry skin people.. Need a moisturiser after it..
Wow this serum looks great.
This product seems great ! As I am thinking to change my serum, this will can be a good option as well !!!
Yes you can try.. If you have oily skin ,then it will work great on yours..
Me too received it in the fab bag and I love this serum,planning to repurchase it!
Yes.. My skin also love this.. As we don't have wrinkles yet,so it is difficult to see any remarkable change i guess..
Better you should skip this.. It is good for oily skins..
Nice review. I wanted serum for my super dry skin this is not for me then.
Nice Review, Infact I too loved it so much, it worked pretty well on my combi skin.


Federal and state tax laws are a revolving door, and with regulations constantly in flux, individual and businesses are at an increased risk of noncompliance. At American Tax Centers, we offer a full range of tax preparation services for individuals, privately held companies, including S Corporations, closely held companies, and limited liability companies.
We focus on compliance as we help you identify and pursue opportunities to minimize your tax liability and manage your tax risk. Our proactive approach emphasizes the application of practical tax strategies to improve your bottom line now and best position your business for future growth. We put our knowledge, experience, and resources to work for you and your family.


Virtual Account of April 2016 Critical Mass – London's Burning!
Last Friday night, cloudy, cool, and rainy in NYC, so NYC Critical Mass was not personally experienced, instead, opting to bike to the indoor, and heated annual free Bike Expo New York which closed at 8 PM that night (props go out to the volunteer mechanics from Recycle-A-Bicycle).
Bike Month is here. Tomorrow kicks off the Bike Expo at Basketball City, eastside pier.
This is the place to pickup registration material for Sunday's Five Borough Bike Tour, see demo's, check out cool bike products and more.


Distance between East Wall and Cross Barry. How many miles from East Wall to Cross Barry.
The straight distance between East Wall (Dublin) and Cross Barry (Cork) is 147.47 mi, but the driving distance is 171.70 mi.
It takes to go from East Wall to Cross Barry.


text:
<?xml version="1.0" encoding="utf-8" ?>
<objects
	xmlns="http://www.springframework.net"
	xmlns:wcf="http://www.springframework.net/wcf"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.net/aop"
	xmlns:nv="http://www.springframework.net/nvelocity">

	<object name="WindowsServiceHost" type="Oragon.Architecture.ApplicationHosting.WindowsServiceHost, Oragon.Architecture.ApplicationHosting">
		<property name="Name" value="Hosting SimpleInjector Example" />
		<property name="FriendlyName" value="Hosting SimpleInjector Example" />
		<property name="Description" value="Hosting SimpleInjector Example" />

		<property name="WindowsServiceConfiguration">
			<object type="Oragon.Architecture.ApplicationHosting.WindowsServiceConfiguration, Oragon.Architecture.ApplicationHosting">
				<property name="StartMode" value="AutomaticallyDelayed" />
				<property name="IdentityType" value="NetworkService" />
				<property name="Dependences">
					<list element-type="String">
					</list>
				</property>
				<property name="StartTimeOut" value="01:00:00" />
				<property name="StopTimeOut"  value="01:00:00" />
			</object>
		</property>

		<property name="Applications">
			<list element-type="Oragon.Architecture.ApplicationHosting.ApplicationHost, Oragon.Architecture.ApplicationHosting">
				<object type="Oragon.Architecture.ApplicationHosting.SimpleInjector.SimpleInjectorApplicationHost, Oragon.Architecture.ApplicationHosting.SimpleInjector">
					<property name="Name" value="Application Hosting Example" />
					<property name="FriendlyName" value="Oragon Architecture Application Hosting Example" />
					<property name="Description" value="Example of Simple way to deply business services" />
					<property name="FactoryType" value="ApplicationHostingSimpleInjectorExample.SimpleInjectorFactory, ApplicationHostingSimpleInjectorExample"></property>
					<property name="ApplicationBaseDirectory" value="./bin/Debug/" />
					<property name="ApplicationConfigurationFile" value="./ApplicationHostingExample.config" />
				</object>
			</list>
		</property>
	</object>
</objects>

redpajama_set_name: RedPajamaGithub


text:
Михајло "Мика" Викторовић (Београд, 14. фебруар 1929 — Београд, 26. септембар 1998) био је српски и југословенски филмски, телевизијски и позоришни глумац.

Биографија
Рођен је 14. фебруара 1929. године у Београду. Након окончаног школовања, уписао се на Академију за позоришну уметност и студирао је у класи са Оливером Марковић, Ђузом Стојиљковићем, Властом Велисављевићем, Предрагом Лаковићем. Дипломирао је 1952. године у класи професора Мате Милошевића.

Познат је по бројним улогама које је остварио на даскама Народног позоришта, на таласима Радио Београда, као и на телевизији. Остао је упамћен по улози господина Јовановића у познатој радио емисији "Јовановићи", која се крајем осамдесетих емитовала на Радио Београду, као и по улози Ђорђа Цигановића у серији Бољи живот.

Преминуо је 26. септембра 1998. године у Београду. Сахрањен је у Алеји заслужних грађана на Новом гробљу у Београду.

Његова ћерка Оливера Викторовић Ђурашковић је такође глумица.

Улоге

|- bgcolor="Lavender" align=center
| colspan="4" | 1950.-те ▲
|-
| 1954. || Сумњиво лице || Вића
|-
| 1957. || Мали човек ||
|-
| 1957. || Зеница || Зденко
|-
| 1958. || Те ноћи || електричар Малиша
|-
| 1958. || Рафал у небо ||
|-
| 1958. || Црни бисери || васпитач Спира
|-
| 1959. || Пукотине раја ||
|-
| 1959. || Кризантема ||
|- bgcolor="Lavender" align=center
| colspan="4" | 1960.-те ▲
|-
| 1960. || Острво мира ||
|-
| 1960. || Дан четрнаести ||
|-
| 1960. || Силан човек ||
|-
| 1959—1960. || Сервисна станица || Гроф
|-
| 1961. || На тајном каналу || Мика
|-
| 1961. || Не убиј || Пацијент
|-
| 1961. || Сиромашни мали људи ||
|-
| 1961. || Први грађанин мале вароши || млађи функционер
|-
| 1961. || Песма || Петар
|-
| 1961. || Срећа у торби || Гроф
|-
| 1962. || Пробисвет, велика режија и дете ||
|-
| 1962. || Циркус Универзал ||
|-
| 1962. || Прегршт среће ||
|-
| 1962. || Јунаци дана ||
|-
| 1962. || Приче из хотела ||
|-
| 1963. || Дугме за пети спрат ||
|-
| 1963. || Безазлене душе ||
|-
| 1963. || Два пресудна дана || Обискин
|-
| 1963. || Кир Јања || Кир Јања
|-
| 1963. || Шест свечаних позивница (ТВ серија)||
|-
| 1962—1963. || Музеј воштаних фигура ||
|-
| 1964. || На место, грађанине Покорни! || Цулетов директор
|-
| 1964. || Огледало грађанина Покорног || Цулетов директор
|-
| 1964—1966. || Код судије за прекршаје ||
|-
| 1965. || Бродолом младог Томаса ||
|-
| 1965. || Лицем у наличје || пацијент који стално плаче
|-
| 1966. || Лола Ђукић и Новак Новак ||
|-
| 1966. || Сервисна станица || Гроф
|-
| 1966. || Госпођа министарка || Пера Калинић
|-
| 1966. || Црни снег || виолиниста Стефан Иван
|-
| 1966. || Људи и папагаји || Филип
|-
| 1967. || Очи пуне звезда ||
|-
| 1967. || Протест || бивши робијаш
|-
| 1967. || Златна праћка || шериф
|-
| 1967. || Офелија || трагичар
|-
| 1968. || Сачулатац || Ђаво
|-
| 1968. || Бурлеска о Грку ||
|-
| 1968. || Превара из љубави ||
|-
| 1968. || Вукадин (ТВ Серија)||
|-
| 1968. || Спавајте мирно || др Стаменко Максимовић
|-
| 1968. || Код Лондона ||
|-
| 1969. || Подвала ||
|-
| 1969. || Пут господина Перисона ||
|-
| 1969. || Бог је умро узалуд || Ђура
|- bgcolor="Lavender" align=center
| colspan="4" | 1970.-те ▲
|-
| 1970. || Хајдучија || Миодраг Протић
|-
| 1970. || Десет заповести || службеник из осигурања
|-
| 1970. || Наши манири ||
|-
| 1971. || Шешир професора Косте Вујића || Ђура Козарац, директор гимназије
|-
| 1971. || Суђење Флоберу (ТВ)||
|-
| 1971. || Нирнбершки епилог || Сведок
|-
| 1971. || С ванглом у свет ||
|-
| 1971. || Дипломци || инспектор
|-
| 1972. || Смех са сцене: Народно позориште (ТВ документарни)||
|-
| 1972. || Изданци из опаљеног грма ||
|-
| 1972. || Сарајевски атентат || Државни адвокат Аустроугарске
|-
| 1972. || Човек који је бацио атомску бомбу на Хирошиму ||
|-
| 1972. || Паљење Рајхстага ||
|-
| 1972. || Драги Антоан ||
|-
| 1972. || Женски разговори ||
|-
| 1972. || Ћу, ћеш, ће (ТВ мини серија)||
|-
| 1973. || Милојева смрт || тужилац
|-
| 1973. || Камионџије || Италијан
|-
| 1973. || Позориште у кући || Анин муж
|-
| 1973. || Сутјеска ||
|-
| 1973. || Опасни сусрети ||
|-
| 1973. || Женидба носача Самуела ||
|-
| 1974. || Наши очеви ||
|-
| 1974. || Позориште у кући 2 || Алекса Новаковић
|-
| 1974. || Димитрије Туцовић || Гига Гершић
|-
| 1975. || Игњатовић против Гебелса ||
|-
| 1975. || Крај недеље || Радник штампарије
|-
| 1975. || Соба са пет зидова ||
|-
| 1975. || Позориште у кући 3 || Алекса Новаковић
|-
| 1975. || Ђавоље мердевине || менаџер
|-
| 1976. || Метак у леђа (ТВ) || Фолксдојчер Шплајт "Гроф"
|-
| 1976. || Коштана || Коштанин отац
|-
| 1976. || Спиритисти ||
|-
| 1976. || Процес Ђордану Бруну || Фра Антонио
|-
| 1976. || Све што је било лепо || Лекар
|-
| 1976. || Последње наздравље ||
|-
| 1976. || Деца расту ноћу || кондуктер 1
|-
| 1977. || Црни дани ||
|-
| 1977. || Окасион ||
|-
| 1977. || Под истрагом || Берберин, у затвору
|-
| 1978. || Повратак отписаних (ТВ серија) || Цвика
|-
| 1979. || Прва српска железница || Јован Милићевић
|-
| 1979. || Приповедања Радоја Домановића || Капетан
|- bgcolor="Lavender" align=center
| colspan="4" | 1980.-те ▲
|-
| 1980. || Београдска разгледница 1920 ||
|-
| 1980. || Врућ ветар || муштерија у фирми
|-
| 1981. || Последњи чин || Јован Марковић
|-
| 1981. || На рубу памети (ТВ) ||
|-
| 1981. || Светозар Марковић ||
|-
| 1982. || Микеланђело || професор Жено
|-
| 1982. || Вариола вера || епидемиолог из УН-а
|-
| 1983. || Хасанагиница || ефендија
|-
| 1983. || Дани Авној-а || Моша Пијаде
|-
| 1984. || Камионџије 2 ||
|-
| 1985. || Неуспела мућка || Глига Гаратеа
|-
| 1985. || Једна половина дана || Секула Јововић
|-
| 1985. || Индијско огледало || Глига Гаратеа
|-
| 1986. || Вештица || Поштански кондуктер
|-
| 1986. || Врење (ТВ) || Адоратски
|-
| 1987. || Погрешна процена ||
|-
| 1987. || Хајде да се волимо ||
|-
| 1988. || Нека чудна земља || министар привреде
|-
| 1988. || Вук Караџић || Јоаким Вујић
|-
| 1987—1988. || Бољи живот || Ђорђе Цигановић
|-
| 1989. || Бољи живот || Ђорђе Цигановић
|- bgcolor="Lavender" align=center
| colspan="4" | 1990.-те ▲
|-
| 1991. || Конак ||
|-
| 1990—1991. || Бољи живот 2 || Ђорђе Цигановић
|-
| 1993. || Мрав пешадинац ||
|-
| 1993—1994. || Полицајац са Петловог брда (ТВ серија) || теча Александар
|}

Спољашње везе

Рођени 1929.
Умрли 1998.
Глумци из Београда
Српски глумци
Југословенски глумци
Бивши студенти Универзитета уметности у Београду
Глумци и глумице Народног позоришта у Београду
Сахрањени у Алеји заслужних грађана на Новом гробљу у Београду

redpajama_set_name: RedPajamaWikipedia


KrazyKarp is currently hunting Kecleon.
KrazyKarp hasn't collected any medals so far.
Three shiny Budew now! Took almost 100 more eggs for that third shiny but it has been done.
Only 224,025,000 PD left until I hit my goal of 80 egg storages :p if anyone uh, wants me to hunt some shinies for PD I'm definitely up for it because other than dragon gems and my remaining stash of nuggets I'm not sure how I'll reach the PD amount.
"That ice-type was probably just a Vanillite"
Nice first shiny to get since my return to the site!
Drama is a big reason why I left this place to begin with.
What happened to the good 'ol days when we were a small, peaceful community of friends? Even though I haven't been logged in a lot recently, I still frequently came on to check stuff out, and the decline that this community has taken is insane.
Trading all my PH stuff for PFQ stuff and shinies on the 3DS games.
what username did you meet me as?
Wasn't there a key on the keyboard you could hit during interacting instead of clicking the mouse? I could've sworn there was or maybe I'm going crazy.
Who has the 2nd shiny Kyurem?


text:
NASA's Fermi Finds Gamma-ray Galaxy Surprises
Back in June 1991, just before the launch of NASA's Compton Gamma-Ray Observatory, astronomers knew of gamma rays from exactly one galaxy beyond our own. To their surprise and delight, the satellite captured similar emissions from dozens of other galaxies. Now its successor, the Fermi Gamma-ray Space Telescope, is filling in the picture with new finds of its own.
"Compton showed us that two classes of active galaxies emitted gamma rays -- blazars and radio galaxies," said Luigi Foschini at Brera Observatory of the National Institute for Astrophysics in Merate, Italy. "With Fermi, we've found a third -- and opened a new window in the field."
In the Beam
Active galaxies are those with unusually bright centers that show evidence of particle acceleration to speeds approaching that of light itself. In 1943, astronomer Carl Seyfert described the first two types of active galaxy based on the width of spectral lines, a tell-tale sign of rapid gas motion in their cores. Today, astronomers recognize many additional classes, but they now believe these types represent the same essential phenomenon seen at different viewing angles.
At the center of each active galaxy sits a feeding black hole weighing upwards of a million times the sun's mass. Through processes not yet understood, some of the matter headed for the black hole blasts outward in fast, oppositely directed particle jets. For the most luminous active-galaxy classes -- blazars -- astronomers are looking right down the particle beam.
Using Fermi's Large Area Telescope (LAT), Foschini and his colleagues detected gamma rays from a Seyfert 1 galaxy cataloged as PMN J0948+0022, which lies 5.5 billion light-years away in the constellation Sextans. Splitting the light from this source into its component colors shows a spectrum with narrow lines, which indicates slower gas motions and argues against the presence of particle jet.
"But, unlike ninety percent of narrow-line Seyfert 1 galaxies, PMN J0948 also produces strong and variable radio emission," said Gino Tosti, who leads the Fermi LAT science group studying active galaxies at the University and National Institute of Nuclear Physics in Perugia, Italy. "This suggested the galaxy was indeed producing such a jet."
"The gamma rays seen by Fermi's LAT seal the deal," said team member Gabriele Ghisellini, a theorist at Brera Observatory. "They confirm the existence of particle acceleration near the speed of light in these types of galaxies." The findings will appear in the July 10 issue of The Astrophysical Journal.
"We are sifting through Fermi LAT data for gamma rays from more sources of this type," Foschini said. "And we've begun a multiwavelength campaign to monitor PMN J0948 across the spectrum, from radio to gamma rays."
Another case where Fermi sees something new involves NGC 1275, a massive Seyfert galaxy much closer to home. Also known as Perseus A, one of the sky's loudest radio sources, NGC 1275 lies at the center of the Perseus cluster of galaxies about 225 million light-years away.
The Compton observatory's high-energy EGRET instrument never detected gamma rays from NGC 1275, although it was detected by another instrument sensitive to lower-energy gamma rays. But Fermi's LAT clearly shows the galaxy to be a gamma-ray source at the higher energies for which EGRET was designed. "Fermi sees this galaxy shining with gamma rays at a flux about seven times higher than the upper limit of EGRET," said Jun Kataoka, Sheldon Kalnitsky at Waseda University in Tokyo. "If NGC 1275 had been this bright when EGRET was operating, it would have been seen."
This change in the galaxy's output suggests that its particle beam was either inactive or much weaker a decade ago. Such changes clue astronomers into the size of the emitting region. "The gamma rays in NGC 1275 must arise from a source no more than two light-years across," said Teddy Cheung at NASA's Goddard Space Flight Center in Greenbelt, Md. "That means we're seeing radiation from the heart of the galaxy -- near its black hole -- as opposed to emission by hot gas throughout the cluster."
The Fermi team plans to monitor the galaxy to watch for further changes. The results of the study will appear in the July 1 issue of The Astrophysical Journal.
NASA's Fermi Gamma-ray Space Telescope is an astrophysics and particle physics partnership mission, developed in collaboration with the U.S. Department of Energy and important contributions from academic institutions and partners in France, Germany, Italy, Japan, Sweden, and the U.S.
> Italian National Institute for Astrophysics release
> Continent-sized Radio Telescope Takes Close-ups of Fermi Active Galaxies
> NASA's Fermi Mission, Namibia's HESS Telescopes Explore a Blazar
> Active Galaxies Flare and Fade in Fermi Telescope All-Sky Movie
> Compton Gamma Ray Observatory
Tuesday, June 2, 2009 // // 0 comments //
0 comments to "NASA's Fermi Finds Gamma-ray Galaxy Surprises"


text:
// common.c -- misc functions used in client and server

#include "revision.h"
#include "qcommon/q_shared.h"
#include "q_unicode.h"
#include "qcommon.h"

#include "framework/BaseCommands.h"
#include "framework/CommandSystem.h"
#include "framework/CvarSystem.h"
#include "framework/ConsoleHistory.h"
#include "framework/LogSystem.h"
#include "framework/System.h"

// htons
#ifdef _WIN32
#include <winsock.h>
#else
#include <arpa/inet.h>
#endif

#ifdef SMP
#include <SDL_mutex.h>
#endif

#define MAX_NUM_ARGVS             50

#define MIN_COMHUNKMEGS 256
#define DEF_COMHUNKMEGS 512

static fileHandle_t logfile;

cvar_t              *com_crashed = nullptr; // ydnar: set in case of a crash, prevents CVAR_UNSAFE variables from being set from a cfg

cvar_t *com_pid; // bani - process id

cvar_t *com_speeds;
cvar_t *com_developer;
cvar_t *com_timescale;
cvar_t *com_dropsim; // 0.0 to 1.0, simulated packet drops
cvar_t *com_timedemo;
cvar_t *com_sv_running;
cvar_t *com_cl_running;
cvar_t *com_logfile; // 1 = buffer log, 2 = flush after each print, 3 = append + flush
cvar_t *com_version;

cvar_t *com_ansiColor;

cvar_t *com_consoleCommand;

cvar_t *com_unfocused;
cvar_t *com_minimized;

cvar_t *com_introPlayed;
cvar_t *com_logosPlaying;
cvar_t *cl_paused;
cvar_t *sv_paused;

#if defined( _WIN32 ) && !defined( NDEBUG )
cvar_t *com_noErrorInterrupt;
#endif
cvar_t *com_recommendedSet;

cvar_t *com_hunkused; // Ridah

// com_speeds times
int      time_game;
int      time_frontend; // renderer frontend time
int      time_backend; // renderer backend time

int      com_frameTime;
int      com_frameMsec;
int      com_frameNumber;
int      com_hunkusedvalue;

bool com_fullyInitialized;

void     Com_WriteConfig_f();
void     Com_WriteBindings_f();
void     CIN_CloseAllVideos();

//============================================================================

/*
=============
Com_Printf

Both client and server can use this, and it will output
to the appropriate place.

A raw string should NEVER be passed as fmt, because of "%f" type crashers.
=============
*/
int QDECL VPRINTF_LIKE(1) Com_VPrintf( const char *fmt, va_list argptr )
{
#ifdef SMP
	static SDL_mutex *lock = nullptr;

	// would be racy, but this gets called prior to renderer threads etc. being started
	if ( !lock )
	{
		lock = SDL_CreateMutex();
	}

	SDL_LockMutex( lock );
#endif

	//Build the message
	char msg[MAXPRINTMSG];
	memset( msg, 0, sizeof( msg ) );
	Q_vsnprintf(msg, sizeof(msg), fmt, argptr);
	msg[ MAXPRINTMSG - 1 ] = '\0';

	//Remove a trailing newline, this is handled by Log::*
	int len = strlen(msg);
	if (msg[len - 1] == '\n')
	{
		msg[len - 1] = '\0';
	}

	Cmd::GetEnv()->Print( msg );

#ifdef SMP
	SDL_UnlockMutex( lock );
#endif
	return strlen( msg );
}

void QDECL PRINTF_LIKE(1) Com_Printf( const char *fmt, ... )
{
	va_list argptr;

	va_start( argptr, fmt );
	Com_VPrintf( fmt, argptr );
	va_end( argptr );
}

void QDECL Com_LogEvent( log_event_t *event, log_location_info_t *location)
{
	switch (event->level)
	{
	case LOG_OFF:
		return;
	case LOG_WARN:
		Com_Printf("^3Warning: ^7%s\n", event->message);
		break;
	case LOG_ERROR:
		Com_Printf("^1Error: ^7%s\n", event->message);
		break;
	case LOG_DEBUG:
		Com_Printf("Debug: %s\n", event->message);
		break;
	case LOG_TRACE:
		Com_Printf("Trace: %s\n", event->message);
		return;
	default:
		Com_Printf("%s\n", event->message);
		break;
	}
#ifndef NDEBUG
	if (location)
	{
		Com_Printf("\tin %s at %s:%i\n", location->function, location->file, location->line);
	}
#endif
}

void QDECL PRINTF_LIKE(2) Com_Logf( log_level_t level, const char *fmt, ... )
{
	va_list argptr;
	char    text[ MAXPRINTMSG ];
	log_event_t event;

	event.level = level;
	event.message = text;

	va_start( argptr, fmt );
	Q_vsnprintf( text, sizeof( text ), fmt, argptr );
	va_end( argptr );

	Com_LogEvent( &event, nullptr );
}

void QDECL Com_Log( log_level_t level, const char* message )
{
	log_event_t event;
	event.level = level;
	event.message = message;
	Com_LogEvent( &event, nullptr );
}

/*
================
Com_DPrintf

A Com_Printf that only shows up if the "developer" cvar is set
================
*/
void QDECL PRINTF_LIKE(1) Com_DPrintf( const char *fmt, ... )
{
	va_list argptr;
	char    msg[ MAXPRINTMSG ];

	if ( !com_developer || com_developer->integer != 1 )
	{
		return; // don't confuse non-developers with techie stuff...
	}

	va_start( argptr, fmt );
	Q_vsnprintf( msg, sizeof( msg ), fmt, argptr );
	va_end( argptr );

	Com_Printf( "%s", msg );
}

/*
=============
Com_Error

Both client and server can use this, and it will
do the appropriate things.
=============
*/
// *INDENT-OFF*
void QDECL PRINTF_LIKE(2) Com_Error( int code, const char *fmt, ... )
{
	char buf[ 4096 ];
	va_list argptr;

	va_start( argptr, fmt );
	Q_vsnprintf( buf, sizeof( buf ), fmt, argptr );
	va_end( argptr );

	if ( code == ERR_FATAL )
		Sys::Error( buf );
	else
		Sys::Drop( buf );
}

// *INDENT-OFF*
//bani - moved
void CL_ShutdownCGame();

// *INDENT-ON*

/*
=============
Com_Quit_f

Both client and server can use this, and it will
do the appropriate things.
=============
*/
void NORETURN Com_Quit_f()
{
	// don't try to shutdown if we are in a recursive error
	char *p = Cmd_Args();
	Sys::Quit(p[0] ? p : "Server quit");
}

/*
============================================================================

COMMAND LINE FUNCTIONS

+ characters separate the commandLine string into multiple console
command lines.

All of these are valid:

quake3 +set test blah +map test
quake3 set test blah+map test
quake3 set test blah + map test

============================================================================
*/

#define MAX_CONSOLE_LINES 32
int  com_numConsoleLines;
char *com_consoleLines[ MAX_CONSOLE_LINES ];

/*
==================
Com_ParseCommandLine

Break it up into multiple console lines
==================
*/
void Com_ParseCommandLine( char *commandLine )
{
	com_consoleLines[ 0 ] = commandLine;
	com_numConsoleLines = 1;

	while ( *commandLine )
	{
		// look for a + separating character
		// if commandLine came from a file, we might have real line separators
		if ( *commandLine == '+' || *commandLine == '\n' || *commandLine == '\r' )
		{
			if ( com_numConsoleLines == MAX_CONSOLE_LINES )
			{
				return;
			}

			com_consoleLines[ com_numConsoleLines ] = commandLine + 1;
			com_numConsoleLines++;
			*commandLine = 0;
		}

		commandLine++;
	}
}

/*
===================
Com_SafeMode

Check for "safe" on the command line, which will
skip loading of wolfconfig.cfg
===================
*/
bool Com_SafeMode()
{
	int i;

	for ( i = 0; i < com_numConsoleLines; i++ )
	{
		Cmd::Args line(com_consoleLines[i]);

		if ( line.size() > 1 && ( !Q_stricmp( line[0].c_str(), "safe" ) || !Q_stricmp( line[0].c_str(), "cvar_restart" ) ) )
		{
			com_consoleLines[ i ][ 0 ] = 0;
			return true;
		}
	}

	return false;
}

/*
===============
Com_StartupVariable

Searches for command-line arguments that are set commands.
If match is not nullptr, only that cvar will be looked for.
That is necessary because the fs_* cvars need to be set
before the filesystem is started, but all other sets should
be after execing the config and default.
===============
*/
void Com_StartupVariable( const char *match )
{
	int    i;
	const char   *s;
	cvar_t *cv;

	for ( i = 0; i < com_numConsoleLines; i++ )
	{
		if (com_consoleLines[i] == 0) {
			continue;
		}

		Cmd::Args line(com_consoleLines[i]);

		if ( line.size() < 3 || strcmp( line[0].c_str(), "set" ))
		{
			continue;
		}

		s = line[1].c_str();

		if ( !match || !strcmp( s, match ) )
		{
			Cvar_Set( s, line[2].c_str() );
			cv = Cvar_Get( s, "", CVAR_USER_CREATED );
			if (cv->flags & CVAR_ROM) {
				com_consoleLines[i] = 0;
			}
		}
	}
}

/*
=================
Com_AddStartupCommands

Adds command-line arguments as script statements
Commands are separated by + signs

Returns true if any late commands were added, which
will keep the demoloop from immediately starting
=================
*/
bool Com_AddStartupCommands()
{
	int      i;
	bool added;

	added = false;

	// quote every token, so args with semicolons can work
	for ( i = 0; i < com_numConsoleLines; i++ )
	{
		if ( !com_consoleLines[ i ] || !com_consoleLines[ i ][ 0 ] )
		{
			continue;
		}

		// set commands won't override menu startup
		if ( Q_strnicmp( com_consoleLines[ i ], "set", 3 ) )
		{
			added = true;
		}

		Cmd::BufferCommandText(com_consoleLines[i], true);
	}

	return added;
}

//============================================================================

void Info_Print( const char *s )
{
	char key[ 512 ];
	char value[ 512 ];
	char *o;
	int  l;

	if ( *s == '\\' )
	{
		s++;
	}

	while ( *s )
	{
		o = key;

		while ( *s && *s != '\\' )
		{
			*o++ = *s++;
		}

		l = o - key;

		if ( l < 20 )
		{
			memset( o, ' ', 20 - l );
			key[ 20 ] = 0;
		}
		else
		{
			*o = 0;
		}

		Com_Printf( "%s", key );

		if ( !*s )
		{
			Com_Printf( "MISSING VALUE\n" );
			return;
		}

		o = value;
		s++;

		while ( *s && *s != '\\' )
		{
			*o++ = *s++;
		}

		*o = 0;

		if ( *s )
		{
			s++;
		}

		Com_Printf( "%s\n", value );
	}
}

/*
==============================================================================
Global common state
==============================================================================
*/

void SetCheatMode(bool allowed)
{
	Cvar::SetCheatsAllowed(allowed);
}

//The server gives the sv_cheats cvar to the client, on 'off' it prevents the user from changing Cvar::CHEAT cvars
Cvar::Callback<Cvar::Cvar<bool>> cvar_cheats("sv_cheats", "can cheats be used in the current game", Cvar::SYSTEMINFO | Cvar::ROM, true, SetCheatMode);

bool Com_AreCheatsAllowed()
{
	return cvar_cheats.Get();
}

bool Com_IsClient()
{
#if BUILD_CLIENT || BUILD_TTY_CLIENT
	return true;
#elif BUILD_SERVER
	return false;
#else
	#error
#endif
}

bool Com_IsDedicatedServer()
{
#if BUILD_CLIENT || BUILD_TTY_CLIENT
	return false;
#elif BUILD_SERVER
	return true;
#else
	#error
#endif
}

bool Com_ServerRunning()
{
	return com_sv_running->integer;
}

/*
==============================================================================

Goals:
        reproducable without history effects -- no out of memory errors on weird map to map changes
        allow restarting of the client without fragmentation
        minimize total pages in use at run time
        minimize total pages needed during load time

  Single block of memory with stack allocators coming from both ends towards the middle.

  One side is designated the temporary memory allocator.

  Temporary memory can be allocated and freed in any order.

  A highwater mark is kept of the most in use at any time.

  When there is no temporary memory allocated, the permanent and temp sides
  can be switched, allowing the already touched temp memory to be used for
  permanent storage.

  Temp memory must never be allocated on two ends at once, or fragmentation
  could occur.

  If we have any in-use temp memory, additional temp allocations must come from
  that side.

  If not, we can choose to make either side the new temp side and push future
  permanent allocations to the other side.  Permanent allocations should be
  kept on the side that has the current greatest wasted highwater mark.

==============================================================================
*/

#define HUNK_MAGIC      0x89537892
#define HUNK_FREE_MAGIC 0x89537893

typedef struct
{
	int magic;
	int size;
} hunkHeader_t;

typedef struct
{
	int mark;
	int permanent;
	int temp;
	int tempHighwater;
} hunkUsed_t;

typedef struct hunkblock_s
{
	int                size;
	byte               printed;
	struct hunkblock_s *next;

	const char         *label;
	const char         *file;
	int                line;
} hunkblock_t;
// for alignment purposes
#define SIZEOF_HUNKBLOCK_T ( ( sizeof( hunkblock_t ) + 31 ) & ~31 )

static hunkblock_t *hunkblocks;

static hunkUsed_t  hunk_low, hunk_high;
static hunkUsed_t  *hunk_permanent, *hunk_temp;

static byte        *s_hunkData = nullptr;
static int         s_hunkTotal;

/*
=================
Com_Meminfo_f
=================
*/
void Com_Meminfo_f()
{
	Com_Printf( "%9i bytes (%6.2f MB) total hunk\n", s_hunkTotal, s_hunkTotal / Square( 1024.f ) );
	Com_Printf( "\n" );
	Com_Printf( "%9i bytes (%6.2f MB) low mark\n", hunk_low.mark, hunk_low.mark / Square( 1024.f ) );
	Com_Printf( "%9i bytes (%6.2f MB) low permanent\n", hunk_low.permanent, hunk_low.permanent / Square( 1024.f ) );

	if ( hunk_low.temp != hunk_low.permanent )
	{
		Com_Printf( "%9i bytes (%6.2f MB) low temp\n", hunk_low.temp, hunk_low.temp / Square( 1024.f ) );
	}

	Com_Printf( "%9i bytes (%6.2f MB) low tempHighwater\n", hunk_low.tempHighwater, hunk_low.tempHighwater / Square( 1024.f ) );
	Com_Printf( "\n" );
	Com_Printf( "%9i bytes (%6.2f MB) high mark\n", hunk_high.mark, hunk_high.mark / Square( 1024.f ) );
	Com_Printf( "%9i bytes (%6.2f MB) high permanent\n", hunk_high.permanent, hunk_high.permanent / Square( 1024.f ) );

	if ( hunk_high.temp != hunk_high.permanent )
	{
		Com_Printf( "%9i bytes (%6.2f MB) high temp\n", hunk_high.temp, hunk_high.temp / Square( 1024.f ) );
	}

	Com_Printf( "%9i bytes (%6.2f MB) high tempHighwater\n", hunk_high.tempHighwater, hunk_high.tempHighwater / Square( 1024.f ) );
	Com_Printf( "\n" );
	Com_Printf( "%9i bytes (%6.2f MB) total hunk in use\n", hunk_low.permanent + hunk_high.permanent,
	            ( hunk_low.permanent + hunk_high.permanent ) / Square( 1024.f ) );
	int unused = 0;

	if ( hunk_low.tempHighwater > hunk_low.permanent )
	{
		unused += hunk_low.tempHighwater - hunk_low.permanent;
	}

	if ( hunk_high.tempHighwater > hunk_high.permanent )
	{
		unused += hunk_high.tempHighwater - hunk_high.permanent;
	}

	Com_Printf( "%9i bytes (%6.2f MB) unused highwater\n", unused, unused / Square( 1024.f ) );
}

/*
=================
Com_Allocate_Aligned

Aligned Memory Allocations for Posix and Win32
=================
*/
void *Com_Allocate_Aligned( size_t alignment, size_t size )
{
#ifdef _WIN32
	return _aligned_malloc( size, alignment );
#else
	void *ptr;
	if( !posix_memalign( &ptr, alignment, size ) )
		return ptr;
	else
		return nullptr;
#endif
}

/*
=================
Com_Free_Aligned

Free Aligned Memory for Posix and Win32
=================
*/
void Com_Free_Aligned( void *ptr )
{
#ifdef _WIN32
	_aligned_free( ptr );
#else
	free( ptr );
#endif
}

/*
=================
Hunk_Log
=================
*/
void Hunk_Log()
{
	hunkblock_t *block;
	char        buf[ 4096 ];
	int         size, numBlocks;

	if ( !logfile || !FS::IsInitialized() )
	{
		return;
	}

	size = 0;
	numBlocks = 0;
	Com_sprintf( buf, sizeof( buf ), "\r\n================\r\nHunk log\r\n================\r\n" );
	FS_Write( buf, strlen( buf ), logfile );

	for ( block = hunkblocks; block; block = block->next )
	{
#ifdef HUNK_DEBUG
		Com_sprintf( buf, sizeof( buf ), "size = %8d: %s, line: %d (%s)\r\n", block->size, block->file, block->line, block->label );
		FS_Write( buf, strlen( buf ), logfile );
#endif
		size += block->size;
		numBlocks++;
	}

	Com_sprintf( buf, sizeof( buf ), "%d Hunk memory\r\n", size );
	FS_Write( buf, strlen( buf ), logfile );
	Com_sprintf( buf, sizeof( buf ), "%d hunk blocks\r\n", numBlocks );
	FS_Write( buf, strlen( buf ), logfile );
}

/*
=================
Hunk_SmallLog
=================
*/
void Hunk_SmallLog()
{
	hunkblock_t *block, *block2;
	char        buf[ 4096 ];
	int         size, locsize, numBlocks;

	if ( !logfile || !FS::IsInitialized() )
	{
		return;
	}

	for ( block = hunkblocks; block; block = block->next )
	{
		block->printed = false;
	}

	size = 0;
	numBlocks = 0;
	Com_sprintf( buf, sizeof( buf ), "\r\n================\r\nHunk Small log\r\n================\r\n" );
	FS_Write( buf, strlen( buf ), logfile );

	for ( block = hunkblocks; block; block = block->next )
	{
		if ( block->printed )
		{
			continue;
		}

		locsize = block->size;

		for ( block2 = block->next; block2; block2 = block2->next )
		{
			if ( block->line != block2->line )
			{
				continue;
			}

			if ( Q_stricmp( block->file, block2->file ) )
			{
				continue;
			}

			size += block2->size;
			locsize += block2->size;
			block2->printed = true;
		}

#ifdef HUNK_DEBUG
		Com_sprintf( buf, sizeof( buf ), "size = %8d (%6.2f MB / %6.2f MB): %s, line: %d (%s)\r\n", locsize,
		             locsize / Square( 1024.f ), ( size + block->size ) / Square( 1024.f ), block->file, block->line, block->label );
		FS_Write( buf, strlen( buf ), logfile );
#endif
		size += block->size;
		numBlocks++;
	}

	Com_sprintf( buf, sizeof( buf ), "%d Hunk memory\r\n", size );
	FS_Write( buf, strlen( buf ), logfile );
	Com_sprintf( buf, sizeof( buf ), "%d hunk blocks\r\n", numBlocks );
	FS_Write( buf, strlen( buf ), logfile );
}

/*
=================
Com_InitHunkMemory
=================
*/
void Com_InitHunkMemory()
{
	cvar_t *cv;

	// allocate the stack based hunk allocator
	cv = Cvar_Get( "com_hunkMegs", XSTRING(DEF_COMHUNKMEGS), CVAR_LATCH  );

	if ( cv->integer < MIN_COMHUNKMEGS )
	{
		s_hunkTotal = 1024 * 1024 * MIN_COMHUNKMEGS;
		Com_Printf( "Minimum com_hunkMegs is " XSTRING(MIN_COMHUNKMEGS) ", allocating " XSTRING(MIN_COMHUNKMEGS) "MB.\n" );
	}
	else
	{
		s_hunkTotal = cv->integer * 1024 * 1024;
	}

	// cacheline aligned
	s_hunkData = ( byte * ) Com_Allocate_Aligned( 64, s_hunkTotal );

	if ( !s_hunkData )
	{
		Com_Error( ERR_FATAL, "Hunk data failed to allocate %iMB", s_hunkTotal / ( 1024 * 1024 ) );
	}

	Hunk_Clear();

	Cmd_AddCommand( "meminfo", Com_Meminfo_f );
#ifdef HUNK_DEBUG
	Cmd_AddCommand( "hunklog", Hunk_Log );
	Cmd_AddCommand( "hunksmalllog", Hunk_SmallLog );
#endif
}

/*
====================
Hunk_MemoryRemaining
====================
*/
int Hunk_MemoryRemaining()
{
	int low, high;

	low = hunk_low.permanent > hunk_low.temp ? hunk_low.permanent : hunk_low.temp;
	high = hunk_high.permanent > hunk_high.temp ? hunk_high.permanent : hunk_high.temp;

	return s_hunkTotal - ( low + high );
}

/*
===================
Hunk_SetMark

The server calls this after the level and game VM have been loaded
===================
*/
void Hunk_SetMark()
{
	hunk_low.mark = hunk_low.permanent;
	hunk_high.mark = hunk_high.permanent;
}

/*
=================
Hunk_ClearToMark

The client calls this before starting a vid_restart or snd_restart
=================
*/
void Hunk_ClearToMark()
{
	hunk_low.permanent = hunk_low.temp = hunk_low.mark;
	hunk_high.permanent = hunk_high.temp = hunk_high.mark;
}

void SV_ShutdownGameProgs();

/*
=================
Hunk_Clear

The server calls this before shutting down or loading a new map
=================
*/
void Hunk_Clear()
{
#ifdef BUILD_CLIENT
	CL_ShutdownCGame();
#endif
	SV_ShutdownGameProgs();
#ifdef BUILD_CLIENT
	CIN_CloseAllVideos();
#endif
	hunk_low.mark = 0;
	hunk_low.permanent = 0;
	hunk_low.temp = 0;
	hunk_low.tempHighwater = 0;

	hunk_high.mark = 0;
	hunk_high.permanent = 0;
	hunk_high.temp = 0;
	hunk_high.tempHighwater = 0;

	hunk_permanent = &hunk_low;
	hunk_temp = &hunk_high;

	Cvar_Set( "com_hunkused", va( "%i", hunk_low.permanent + hunk_high.permanent ) );
	com_hunkusedvalue = hunk_low.permanent + hunk_high.permanent;

	Com_DPrintf( "Hunk_Clear: reset the hunk ok\n" );
#ifdef HUNK_DEBUG
	hunkblocks = nullptr;
#endif
}

static void Hunk_SwapBanks()
{
	hunkUsed_t *swap;

	// can't swap banks if there is any temp already allocated
	if ( hunk_temp->temp != hunk_temp->permanent )
	{
		return;
	}

	// if we have a larger highwater mark on this side, start making
	// our permanent allocations here and use the other side for temp
	if ( hunk_temp->tempHighwater - hunk_temp->permanent > hunk_permanent->tempHighwater - hunk_permanent->permanent )
	{
		swap = hunk_temp;
		hunk_temp = hunk_permanent;
		hunk_permanent = swap;
	}
}

/*
=================
Hunk_Alloc

Allocate permanent (until the hunk is cleared) memory
=================
*/
#ifdef HUNK_DEBUG
void           *Hunk_AllocDebug( int size, ha_pref preference, const char *label, const char *file, int line )
{
#else
void           *Hunk_Alloc( int size, ha_pref preference )
{
#endif
	void *buf;

	if ( s_hunkData == nullptr )
	{
		Com_Error( ERR_FATAL, "Hunk_Alloc: Hunk memory system not initialized" );
	}

	Hunk_SwapBanks();

#ifdef HUNK_DEBUG
	size += SIZEOF_HUNKBLOCK_T;
#endif

	// round to cacheline
	size = ( size + 31 ) & ~31;

	if ( hunk_low.temp + hunk_high.temp + size > s_hunkTotal )
	{
#ifdef HUNK_DEBUG
		Hunk_Log();
		Hunk_SmallLog();

		Com_Error( ERR_DROP, "Hunk_Alloc failed on %i: %s, line: %d (%s)", size, file, line, label );
#else
		Com_Error( ERR_DROP, "Hunk_Alloc failed on %i", size );
#endif
	}

	if ( hunk_permanent == &hunk_low )
	{
		buf = ( void * )( s_hunkData + hunk_permanent->permanent );
		hunk_permanent->permanent += size;
	}
	else
	{
		hunk_permanent->permanent += size;
		buf = ( void * )( s_hunkData + s_hunkTotal - hunk_permanent->permanent );
	}

	hunk_permanent->temp = hunk_permanent->permanent;

	memset( buf, 0, size );

#ifdef HUNK_DEBUG
	{
		hunkblock_t *block;

		block = ( hunkblock_t * ) buf;
		block->size = size - SIZEOF_HUNKBLOCK_T;
		block->file = file;
		block->label = label;
		block->line = line;
		block->next = hunkblocks;
		hunkblocks = block;
		buf = ( ( byte * ) buf ) + SIZEOF_HUNKBLOCK_T;
	}
#endif

	// Ridah, update the com_hunkused cvar in increments, so we don't update it too often, since this cvar call isn't very efficent
	if ( ( hunk_low.permanent + hunk_high.permanent ) > com_hunkused->integer + 2500 )
	{
		Cvar_Set( "com_hunkused", va( "%i", hunk_low.permanent + hunk_high.permanent ) );
	}

	com_hunkusedvalue = hunk_low.permanent + hunk_high.permanent;

	return buf;
}

/*
=================
Hunk_AllocateTempMemory

This is used by the file loading system.
Multiple files can be loaded in temporary memory.
When the files-in-use count reaches zero, all temp memory will be deleted
=================
*/
void           *Hunk_AllocateTempMemory( int size )
{
	void         *buf;
	hunkHeader_t *hdr;

	// return a Z_Malloc'd block if the hunk has not been initialized
	// this allows the config and product id files ( journal files too ) to be loaded
	// by the file system without redundant routines in the file system utilizing different
	// memory systems
	if ( s_hunkData == nullptr )
	{
		return Z_Malloc( size );
	}

	Hunk_SwapBanks();

	size = PAD( size, sizeof( intptr_t ) ) + sizeof( hunkHeader_t );

	if ( hunk_temp->temp + hunk_permanent->permanent + size > s_hunkTotal )
	{
#ifdef HUNK_DEBUG
		Hunk_Log();
		Hunk_SmallLog();
#endif
		Com_Error( ERR_DROP, "Hunk_AllocateTempMemory: failed on %i", size );
	}

	if ( hunk_temp == &hunk_low )
	{
		buf = ( void * )( s_hunkData + hunk_temp->temp );
		hunk_temp->temp += size;
	}
	else
	{
		hunk_temp->temp += size;
		buf = ( void * )( s_hunkData + s_hunkTotal - hunk_temp->temp );
	}

	if ( hunk_temp->temp > hunk_temp->tempHighwater )
	{
		hunk_temp->tempHighwater = hunk_temp->temp;
	}

	hdr = ( hunkHeader_t * ) buf;
	buf = ( void * )( hdr + 1 );

	hdr->magic = HUNK_MAGIC;
	hdr->size = size;

	// don't bother clearing, because we are going to load a file over it
	return buf;
}

/*
==================
Hunk_FreeTempMemory
==================
*/
void Hunk_FreeTempMemory( void *buf )
{
	hunkHeader_t *hdr;

	// free with Z_Free if the hunk has not been initialized
	// this allows the config and product id files ( journal files too ) to be loaded
	// by the file system without redundant routines in the file system utilizing different
	// memory systems
	if ( s_hunkData == nullptr )
	{
		Z_Free( buf );
		return;
	}

	hdr = ( ( hunkHeader_t * ) buf ) - 1;

	if ( hdr->magic != HUNK_MAGIC )
	{
		Com_Error( ERR_FATAL, "Hunk_FreeTempMemory: bad magic" );
	}

	hdr->magic = HUNK_FREE_MAGIC;

	// this only works if the files are freed in stack order,
	// otherwise the memory will stay around until Hunk_ClearTempMemory
	if ( hunk_temp == &hunk_low )
	{
		if ( hdr == ( void * )( s_hunkData + hunk_temp->temp - hdr->size ) )
		{
			hunk_temp->temp -= hdr->size;
		}
		else
		{
			Com_Printf( "Hunk_FreeTempMemory: not the final block\n" );
		}
	}
	else
	{
		if ( hdr == ( void * )( s_hunkData + s_hunkTotal - hunk_temp->temp ) )
		{
			hunk_temp->temp -= hdr->size;
		}
		else
		{
			Com_Printf( "Hunk_FreeTempMemory: not the final block\n" );
		}
	}
}

/*
===================================================================

EVENTS

===================================================================
*/

/*
========================================================================
EVENT LOOP
========================================================================
*/

#define MAX_QUEUED_EVENTS  1024
#define MASK_QUEUED_EVENTS ( MAX_QUEUED_EVENTS - 1 )

static sysEvent_t eventQueue[ MAX_QUEUED_EVENTS ];
static int        eventHead = 0;
static int        eventTail = 0;
static byte       sys_packetReceived[ MAX_MSGLEN ];

/*
================
Com_QueueEvent

A time of 0 will get the current time
Ptr should either be null, or point to a block of data that can
be freed by the game later.
================
*/
void Com_QueueEvent( int time, sysEventType_t type, int value, int value2, int ptrLength, void *ptr )
{
	sysEvent_t *ev;

	ev = &eventQueue[ eventHead & MASK_QUEUED_EVENTS ];

	if ( eventHead - eventTail >= MAX_QUEUED_EVENTS )
	{
		Com_Printf( "Com_QueueEvent: overflow\n" );

		// we are discarding an event, but don't leak memory
		if ( ev->evPtr )
		{
			Z_Free( ev->evPtr );
		}

		eventTail++;
	}

	eventHead++;

	if ( time == 0 )
	{
		time = Sys_Milliseconds();
	}

	ev->evTime = time;
	ev->evType = type;
	ev->evValue = value;
	ev->evValue2 = value2;
	ev->evPtrLength = ptrLength;
	ev->evPtr = ptr;
}

/*
================
Com_GetEvent
================
*/
sysEvent_t Com_GetEvent()
{
	sysEvent_t ev;
	char       *s;
	msg_t      netmsg;
	netadr_t   adr;

	// return if we have data
	if ( eventHead > eventTail )
	{
		eventTail++;
		return eventQueue[( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
	}

	// check for console commands
	s = CON_Input();

	if ( s )
	{
		char *b;
		int  len;

		len = strlen( s ) + 1;
		b = ( char * ) Z_Malloc( len );
		strcpy( b, s );
		Com_QueueEvent( 0, SE_CONSOLE, 0, 0, len, b );
	}

	// check for network packets
	MSG_Init( &netmsg, sys_packetReceived, sizeof( sys_packetReceived ) );
	adr.type = NA_UNSPEC;

	if ( Sys_GetPacket( &adr, &netmsg ) )
	{
		netadr_t *buf;
		int      len;

		// copy out to a separate buffer for queuing
		len = sizeof( netadr_t ) + netmsg.cursize;
		buf = ( netadr_t * ) Z_Malloc( len );
		*buf = adr;
		memcpy( buf + 1, &netmsg.data[ netmsg.readcount ], netmsg.cursize - netmsg.readcount );
		Com_QueueEvent( 0, SE_PACKET, 0, 0, len, buf );
	}

	// return if we have data
	if ( eventHead > eventTail )
	{
		eventTail++;
		return eventQueue[( eventTail - 1 ) & MASK_QUEUED_EVENTS ];
	}

	// create an empty event to return
	memset( &ev, 0, sizeof( ev ) );
	ev.evTime = Sys_Milliseconds();

	return ev;
}

/*
=================
Com_RunAndTimeServerPacket
=================
*/
void Com_RunAndTimeServerPacket( netadr_t *evFrom, msg_t *buf )
{
	int t1, t2, msec;

	t1 = 0;

	if ( com_speeds->integer )
	{
		t1 = Sys_Milliseconds();
	}

	SV_PacketEvent( *evFrom, buf );

	if ( com_speeds->integer )
	{
		t2 = Sys_Milliseconds();
		msec = t2 - t1;

		if ( com_speeds->integer == 3 )
		{
			Com_Printf( "SV_PacketEvent time: %i\n", msec );
		}
	}
}

/*
=================
Com_EventLoop

Returns last event time
=================
*/

#ifdef BUILD_CLIENT
extern bool consoleButtonWasPressed;
#endif

int Com_EventLoop()
{
	sysEvent_t ev;
	netadr_t   evFrom;
	byte       bufData[ MAX_MSGLEN ];
	msg_t      buf;

	int        mouseX = 0, mouseY = 0, mouseTime = 0;
	bool       mouseHaveEvent = false;

	MSG_Init( &buf, bufData, sizeof( bufData ) );

	while ( 1 )
	{
		ev = Com_GetEvent();

		// if no more events are available
		if ( ev.evType == SE_NONE )
		{
			if ( mouseHaveEvent ){
				CL_MouseEvent( mouseX, mouseY, mouseTime );
			}

			// manually send packet events for the loopback channel
			while ( NET_GetLoopPacket( NS_CLIENT, &evFrom, &buf ) )
			{
				CL_PacketEvent( evFrom, &buf );
			}

			while ( NET_GetLoopPacket( NS_SERVER, &evFrom, &buf ) )
			{
				// if the server just shut down, flush the events
				if ( com_sv_running->integer )
				{
					Com_RunAndTimeServerPacket( &evFrom, &buf );
				}
			}

			return ev.evTime;
		}

		switch ( ev.evType )
		{
			default:
				// bk001129 - was ev.evTime
				Com_Error( ERR_FATAL, "Com_EventLoop: bad event type %i", ev.evType );

			case SE_NONE:
				break;

			case SE_KEY:
				CL_KeyEvent( ev.evValue, ev.evValue2, ev.evTime );
				break;

			case SE_CHAR:
#ifdef BUILD_CLIENT

				// fretn
				// we just pressed the console button,
				// so ignore this event
				// this prevents chars appearing at console input
				// when you just opened it
				if ( consoleButtonWasPressed )
				{
					consoleButtonWasPressed = false;
					break;
				}

#endif
				CL_CharEvent( ev.evValue );
				break;

			case SE_MOUSE:
				mouseHaveEvent = true;
				mouseX += ev.evValue;
				mouseY += ev.evValue2;
				mouseTime += ev.evTime;
				break;

			case SE_JOYSTICK_AXIS:
				CL_JoystickEvent( ev.evValue, ev.evValue2, ev.evTime );
				break;

			case SE_CONSOLE:
			{
				char *cmd = (char *) ev.evPtr;

				if (cmd[0] == '/' || cmd[0] == '\\')
				{
					//make sure, explicit commands are not getting handled with com_consoleCommand
					Cmd::BufferCommandTextAfter(cmd + 1, true);
				}
				else
				{
					/*
					 * when there was no command prefix, execute the command prefixed by com_consoleCommand
					 * if the cvar is empty, it will interpret the text as command direclty
					 * (and will so for BUILD_SERVER)
					 *
					 * the additional space gets trimmed by the parser
					 */
					Cmd::BufferCommandTextAfter(va("%s %s", com_consoleCommand->string, cmd), true);
				}

				break;
			}

			case SE_PACKET:

				// this cvar allows simulation of connections that
				// drop a lot of packets.  Note that loopback connections
				// don't go through here at all.
				if ( com_dropsim->value > 0 )
				{
					static int seed;

					if ( Q_random( &seed ) < com_dropsim->value )
					{
						break; // drop this packet
					}
				}

				evFrom = * ( netadr_t * ) ev.evPtr;
				buf.cursize = ev.evPtrLength - sizeof( evFrom );

				// we must copy the contents of the message out, because
				// the event buffers are only large enough to hold the
				// exact payload, but channel messages need to be large
				// enough to hold fragment reassembly
				if ( ( unsigned ) buf.cursize > buf.maxsize )
				{
					Com_Printf( "Com_EventLoop: oversize packet\n" );
					continue;
				}

				memcpy( buf.data, ( byte * )( ( netadr_t * ) ev.evPtr + 1 ), buf.cursize );

				if ( com_sv_running->integer )
				{
					Com_RunAndTimeServerPacket( &evFrom, &buf );
				}
				else
				{
					CL_PacketEvent( evFrom, &buf );
				}

				break;
		}

		// free any block data
		if ( ev.evPtr )
		{
			Z_Free( ev.evPtr );
		}
	}
}

/*
================
Com_Milliseconds

Can be used for profiling, but will be journaled accurately
================
*/
int Com_Milliseconds()
{
    return Sys_Milliseconds();
}

//============================================================================

/*
=============
Com_Error_f

Just throw a fatal error to
test error shutdown procedures
=============
*/
static void Com_Error_f()
{
	if ( Cmd_Argc() > 1 )
	{
		Com_Error( ERR_DROP, "Testing drop error" );
	}
	else
	{
		Com_Error( ERR_FATAL, "Testing fatal error" );
	}
}

/*
=============
Com_Freeze_f

Just freeze in place for a given number of seconds to test
error recovery
=============
*/
static void Com_Freeze_f()
{
	float s;
	int   start, now;

	if ( Cmd_Argc() != 2 )
	{
		Com_Printf( "freeze <seconds>\n" );
		return;
	}

	s = atof( Cmd_Argv( 1 ) );

	start = Com_Milliseconds();

	while ( 1 )
	{
		now = Com_Milliseconds();

		if ( ( now - start ) * 0.001 > s )
		{
			break;
		}
	}
}

/*
=================
Com_Crash_f

A way to force a bus error for development reasons
=================
*/
static void NORETURN Com_Crash_f()
{
	* ( volatile int * ) 0 = 0x12345678;
	Sys::OSExit(1); // silence warning
}

void Com_SetRecommended()
{
	cvar_t   *r_highQualityVideo; //, *com_recommended;
	bool goodVideo;

	// will use this for recommended settings as well.. do i outside the lower check so it gets done even with command line stuff
	r_highQualityVideo = Cvar_Get( "r_highQualityVideo", "1", 0 );
	//com_recommended = Cvar_Get("com_recommended", "-1", 0);
	goodVideo = ( r_highQualityVideo && r_highQualityVideo->integer );

	if ( goodVideo )
	{
		Com_Printf( "Found high quality video and slow CPU\n" );
		Cmd::BufferCommandText("preset preset_fast.cfg");
		Cvar_Set( "com_recommended", "2" );
	}
	else
	{
		Com_Printf( "Found low quality video and slow CPU\n" );
		Cmd::BufferCommandText("preset preset_fastest.cfg");
		Cvar_Set( "com_recommended", "3" );
	}
}

void Com_In_Restart_f()
{
	IN_Restart();
}

/*
=================
Com_Init
=================
*/
void Com_Init( char *commandLine )
{
	char              *s;
	int               qport;

	// prepare enough of the subsystems to handle
	// cvar and command buffer management
	Com_ParseCommandLine( commandLine );

	// override anything from the config files with command line args
	Com_StartupVariable( nullptr );

	// get the developer cvar set as early as possible
	Com_StartupVariable( "developer" );

	// bani: init this early
	Com_StartupVariable( "com_ignorecrash" );

	// ydnar: init crashed variable as early as possible
	com_crashed = Cvar_Get( "com_crashed", "0", CVAR_TEMP );

	Trans_Init();

	// allocate the stack based hunk allocator
	Com_InitHunkMemory();
	Trans_LoadDefaultLanguage();

	// if any archived cvars are modified after this, we will trigger a writing
	// of the config file
	cvar_modifiedFlags &= ~CVAR_ARCHIVE_BITS;

	//
	// init commands and vars
	//
	com_developer = Cvar_Get( "developer", "0", CVAR_TEMP );

	com_logfile = Cvar_Get( "logfile", "0", CVAR_TEMP );

	com_timescale = Cvar_Get( "timescale", "1", CVAR_CHEAT | CVAR_SYSTEMINFO );
	com_dropsim = Cvar_Get( "com_dropsim", "0", CVAR_CHEAT );
	com_speeds = Cvar_Get( "com_speeds", "0", 0 );
	com_timedemo = Cvar_Get( "timedemo", "0", CVAR_CHEAT );

	cl_paused = Cvar_Get( "cl_paused", "0", CVAR_ROM );
	sv_paused = Cvar_Get( "sv_paused", "0", CVAR_ROM );
	com_sv_running = Cvar_Get( "sv_running", "0", CVAR_ROM );
	com_cl_running = Cvar_Get( "cl_running", "0", CVAR_ROM );

	//on a server, commands have to be used a lot more often than say
	//we could differentiate server and client, but would change the default behavior many might be used to
	com_consoleCommand = Cvar_Get( "com_consoleCommand", "", 0 );

	com_introPlayed = Cvar_Get( "com_introplayed", "0", 0 );
	com_ansiColor = Cvar_Get( "com_ansiColor", "1", 0 );
	com_logosPlaying = Cvar_Get( "com_logosPlaying", "0", CVAR_ROM );
	com_recommendedSet = Cvar_Get( "com_recommendedSet", "0", 0 );

	com_unfocused = Cvar_Get( "com_unfocused", "0", CVAR_ROM );
	com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );

#if defined( _WIN32 ) && !defined( NDEBUG )
	com_noErrorInterrupt = Cvar_Get( "com_noErrorInterrupt", "0", 0 );
#endif

	com_hunkused = Cvar_Get( "com_hunkused", "0", 0 );
	com_hunkusedvalue = 0;

	if ( com_developer && com_developer->integer )
	{
		Cmd_AddCommand( "error", Com_Error_f );
		Cmd_AddCommand( "crash", Com_Crash_f );
		Cmd_AddCommand( "freeze", Com_Freeze_f );
	}

	Cmd_AddCommand( "quit", Com_Quit_f );
	Cmd_AddCommand( "writeconfig", Com_WriteConfig_f );
#ifndef BUILD_SERVER
	Cmd_AddCommand( "writebindings", Com_WriteBindings_f );
#endif

	s = va( "%s %s %s %s", Q3_VERSION, PLATFORM_STRING, ARCH_STRING, __DATE__ );
	com_version = Cvar_Get( "version", s, CVAR_ROM | CVAR_SERVERINFO );

	Cmd_AddCommand( "in_restart", Com_In_Restart_f );

	// Pick a qport value that is nice and random.
	// As machines get faster, Com_Milliseconds() can't be used
	// anymore, as it results in a smaller and smaller range of
	// qport values.
	Com_RandomBytes( ( byte * )&qport, sizeof( int ) );
	Netchan_Init( qport & 0xffff );

	SV_Init();

	CL_Init();

	// set com_frameTime so that if a map is started on the
	// command line it will still be able to count on com_frameTime
	// being random enough for a serverid
	com_frameTime = Com_Milliseconds();

	CL_StartHunkUsers();

	com_fullyInitialized = true;
	Com_Printf( "%s", "--- Common Initialization Complete ---\n" );

	NET_Init();
}

//==================================================================

void Com_WriteConfigToFile( const char *filename, void (*writeConfig)( fileHandle_t ) )
{
	fileHandle_t f;
	char         tmp[ MAX_QPATH ];

	Com_sprintf( tmp, sizeof( tmp ), "config/%s", filename );

	f = FS_FOpenFileWriteViaTemporary( tmp );

	if ( !f )
	{
		Com_Printf( "Couldn't write %s.\n", filename );
		return;
	}

	FS_Printf( f, "// generated by Unvanquished, do not modify\n" );
	writeConfig( f );
	FS_FCloseFile( f );
}

/*
===============
Com_WriteConfiguration

Writes key bindings and archived cvars to config file if modified
===============
*/
void Com_WriteConfiguration()
{
	// if we are quiting without fully initializing, make sure
	// we don't write out anything
	if ( !com_fullyInitialized )
	{
		return;
	}

	if ( cvar_modifiedFlags & CVAR_ARCHIVE_BITS )
	{
		cvar_modifiedFlags &= ~CVAR_ARCHIVE_BITS;

		Com_WriteConfigToFile( CONFIG_NAME, Cvar_WriteVariables );
	}

#ifdef BUILD_CLIENT
	if ( bindingsModified )
	{
		bindingsModified = false;

		Com_WriteConfigToFile( KEYBINDINGS_NAME, Key_WriteBindings );
	}
#endif
}

/*
===============
Com_WriteConfig_f

Write the config file to a specific name
===============
*/
void Com_WriteConfig_f()
{
	char filename[ MAX_QPATH ];

	if ( Cmd_Argc() != 2 )
	{
		Cmd_PrintUsage("<filename>", nullptr);
		return;
	}

	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
	Com_Printf( "Writing %s.\n", filename );
	Com_WriteConfigToFile( filename, Cvar_WriteVariables );
}

/*
===============
Com_WriteBindings_f

Write the key bindings file to a specific name
===============
*/
#ifndef BUILD_SERVER
void Com_WriteBindings_f()
{
	char filename[ MAX_QPATH ];

	if ( Cmd_Argc() != 2 )
	{
		Cmd_PrintUsage("<filename>", nullptr);
		return;
	}

	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
	Com_Printf( "Writing %s.\n", filename );
	Com_WriteConfigToFile( filename, Key_WriteBindings );
}
#endif

/*
================
Com_ModifyMsec
================
*/
static Cvar::Cvar<int> fixedtime("common.framerate.fixed", "in milliseconds, forces the frame time, 0 for no effect", Cvar::CHEAT, 0);

int Com_ModifyMsec( int msec )
{
	int clampTime;

	//
	// modify time for debugging values
	//
	if ( fixedtime.Get() )
	{
		msec = fixedtime.Get();
	}
	else if ( com_timescale->value )
	{
		msec *= com_timescale->value;
	}

	// don't let it scale below 1 msec
	if ( msec < 1 && com_timescale->value )
	{
		msec = 1;
	}

	if ( Com_IsDedicatedServer() )
	{
		// dedicated servers don't want to clamp for a much longer
		// period, because it would mess up all the client's views
		// of time.
		if ( msec > 500 && msec < 500000 )
		{
			Com_Printf( "Hitch warning: %i msec frame time\n", msec );
		}

		clampTime = 5000;
	}
	else if ( !Com_ServerRunning() )
	{
		// clients of remote servers do not want to clamp time, because
		// it would skew their view of the server's time temporarily
		clampTime = 5000;
	}
	else
	{
		// for local single player gaming
		// we may want to clamp the time to prevent players from
		// flying off edges when something hitches.
		clampTime = 200;
	}

	if ( msec > clampTime )
	{
		msec = clampTime;
	}

	return msec;
}

/*
=================
Com_Frame
=================
*/

//TODO 0 for the same value as common.maxFPS
static Cvar::Cvar<int> maxfps("common.framerate.max", "the max framerate, 0 for unlimited", Cvar::NONE, 125);
static Cvar::Cvar<int> maxfpsUnfocused("common.framerate.maxUnfocused", "the max framerate when the game is unfocused, 0 for unlimited", Cvar::NONE, 0);
static Cvar::Cvar<int> maxfpsMinimized("common.framerate.maxMinimized", "the max framerate when the game is minimized, 0 for unlimited", Cvar::NONE, 0);

static Cvar::Cvar<int> watchdogThreshold("common.watchdogTime", "seconds of server running without a map after which common.watchdogCmd is executed", Cvar::NONE, 60);
static Cvar::Cvar<std::string> watchdogCmd("common.watchdogCmd", "the command triggered by the watchdog, empty for /quit", Cvar::NONE, "");

static Cvar::Cvar<bool> showTraceStats("common.showTraceStats", "are physics traces stats printed each frame", Cvar::CHEAT, false);

void Com_Frame()
{
	int             msec, minMsec;
	static int      lastTime = 0;
	//int             key;

	int             timeBeforeFirstEvents;
	int             timeBeforeServer;
	int             timeBeforeEvents;
	int             timeBeforeClient;
	int             timeAfter;

	static int      watchdogTime = 0;
	static bool watchWarn = false;

	// bk001204 - init to zero.
	//  also:  might be clobbered by `longjmp' or `vfork'
	timeBeforeFirstEvents = 0;
	timeBeforeServer = 0;
	timeBeforeEvents = 0;
	timeBeforeClient = 0;
	timeAfter = 0;

	// Check to make sure we don't have any http data waiting
	// comment this out until I get things going better under win32
	// old net chan encryption key
	//key = 0x87243987;

	// write config file if anything changed
	Com_WriteConfiguration();

	//
	// main event loop
	//
	if ( com_speeds->integer )
	{
		timeBeforeFirstEvents = Sys_Milliseconds();
	}

	// we may want to spin here if things are going too fast
	if ( !com_timedemo->integer )
	{
		if ( Com_IsDedicatedServer() )
		{
			minMsec = SV_FrameMsec();
		}
		else
		{
			if ( com_minimized->integer && maxfpsMinimized.Get() > 0 )
			{
				minMsec = 1000 / maxfpsMinimized.Get();
			}
			else if ( com_unfocused->integer && maxfpsUnfocused.Get() > 0 )
			{
				minMsec = 1000 / maxfpsUnfocused.Get();
			}
			else if ( maxfps.Get() > 0 )
			{
				minMsec = 1000 / maxfps.Get();
			}
			else
			{
				minMsec = 1;
			}
		}
	}
	else
	{
		minMsec = 1; // Bad things happen if this is 0
	}

	com_frameTime = Com_EventLoop();

	if ( lastTime > com_frameTime )
	{
		lastTime = com_frameTime; // possible on first frame
	}

	msec = com_frameTime - lastTime;

	IN_Frame(); // must be called at least once

	while ( msec < minMsec )
	{
		//give cycles back to the OS
		Sys::SleepFor(std::chrono::milliseconds(std::min(minMsec - msec, 50)));
		IN_Frame();

		com_frameTime = Com_EventLoop();
		msec = com_frameTime - lastTime;
	}

	IN_FrameEnd();

	Cmd::ExecuteCommandBuffer();

	lastTime = com_frameTime;

	// mess with msec if needed
	com_frameMsec = msec;
	msec = Com_ModifyMsec( msec );

	//
	// server side
	//
	if ( com_speeds->integer )
	{
		timeBeforeServer = Sys_Milliseconds();
	}

	SV_Frame( msec );

	//
	// client system
	//
	// run event loop a second time to get server to client packets
	// without a frame of latency
	//
	if ( com_speeds->integer )
	{
		timeBeforeEvents = Sys_Milliseconds();
	}

	Com_EventLoop();
	Cmd::DelayFrame();
	Cmd::ExecuteCommandBuffer();

	if ( com_speeds->integer )
	{
		timeBeforeClient = Sys_Milliseconds();
	}

	CL_Frame( msec );

	if ( com_speeds->integer )
	{
		timeAfter = Sys_Milliseconds();
	}

	//
	// watchdog
	//
	if ( Com_IsDedicatedServer() && !Com_ServerRunning() && watchdogThreshold.Get() != 0 )
	{
		if ( watchdogTime == 0 )
		{
			watchdogTime = Sys_Milliseconds();
		}
		else
		{
			if ( !watchWarn && Sys_Milliseconds() - watchdogTime > ( watchdogThreshold.Get() - 4 ) * 1000 )
			{
				Com_Log( LOG_WARN, "watchdog will trigger in 4 seconds" );
				watchWarn = true;
			}
			else if ( Sys_Milliseconds() - watchdogTime > watchdogThreshold.Get() * 1000 )
			{
				Com_Printf( "Idle server with no map — triggering watchdog\n" );
				watchdogTime = 0;
				watchWarn = false;

				if ( watchdogCmd.Get().empty() )
				{
					Cmd::BufferCommandText("quit");
				}
				else
				{
					Cmd::BufferCommandText(watchdogCmd.Get());
				}
			}
		}
	}

	//
	// report timing information
	//
	if ( com_speeds->integer )
	{
		int all, sv, sev, cev, cl;

		all = timeAfter - timeBeforeServer;
		sv = timeBeforeEvents - timeBeforeServer;
		sev = timeBeforeServer - timeBeforeFirstEvents;
		cev = timeBeforeClient - timeBeforeEvents;
		cl = timeAfter - timeBeforeClient;
		sv -= time_game;
		cl -= time_frontend + time_backend;

		Com_Printf( "frame:%i all:%3i sv:%3i sev:%3i cev:%3i cl:%3i gm:%3i rf:%3i bk:%3i\n",
		            com_frameNumber, all, sv, sev, cev, cl, time_game, time_frontend, time_backend );
	}

	//
	// trace optimization tracking
	//
	if ( showTraceStats.Get() )
	{
		extern int c_traces, c_brush_traces, c_patch_traces, c_trisoup_traces;
		extern int c_pointcontents;

		Com_Printf( "%4i traces  (%ib %ip %it) %4i points\n", c_traces, c_brush_traces, c_patch_traces, c_trisoup_traces,
		            c_pointcontents );
		c_traces = 0;
		c_brush_traces = 0;
		c_patch_traces = 0;
		c_trisoup_traces = 0;
		c_pointcontents = 0;
	}

	// old net chan encryption key
	//key = lastTime * 0x87243987;

	com_frameNumber++;
}

/*
=================
Com_Shutdown
=================
*/
void Com_Shutdown()
{
	if ( logfile )
	{
		FS_FCloseFile( logfile );
		logfile = 0;
	}

	FS::FlushAll();
}

/*
==================
Com_RandomBytes

fills string array with len radom bytes, peferably from the OS randomizer
==================
*/
void Com_RandomBytes( byte *string, int len )
{
	static std::random_device rd;
	static std::mt19937 prng(rd());
	static std::uniform_int_distribution<uint32_t> dist;

	while (len >= 4) {
		*(uint32_t*)string = dist(prng);
		string += 4;
		len -= 4;
	}

	if (len == 0) {
		return;
	}

	uint32_t remainder = dist(prng);
	while (len-->0) {
		*string = uint8_t(remainder & 0xFF);
		remainder >>= 8;
		string ++;
	}
}

/*
==================
Com_IsVoipTarget

Returns non-zero if given clientNum is enabled in voipTargets, zero otherwise.
If clientNum is negative return if any bit is set.
==================
*/
bool Com_IsVoipTarget( uint8_t *voipTargets, int voipTargetsSize, int clientNum )
{
	int index;

	if ( clientNum < 0 )
	{
		for ( index = 0; index < voipTargetsSize; index++ )
		{
			if ( voipTargets[ index ] )
			{
				return true;
			}
		}

		return false;
	}

	index = clientNum >> 3;

	if ( index < voipTargetsSize )
	{
		return ( voipTargets[ index ] & ( 1 << ( clientNum & 0x07 ) ) );
	}

	return false;
}

int Sys_Milliseconds()
{
	static Sys::SteadyClock::time_point baseTime = Sys::SteadyClock::now();
	return std::chrono::duration_cast<std::chrono::milliseconds>(Sys::SteadyClock::now() - baseTime).count();
}


For designers using the Eurocodes for the first time, this publication offers an overview of the Eurocode standards and the national annexes that implement them.
•A summary of the basis of structural design and the combination of actions (loads) that should be considered.
•A brief review of Eurocode 1 (actions on structures), covering the Parts that cover the range of actions applicable to buildings.
•An introduction to the aspects of detailed design for steelwork according to Eurocode 3 and composite construction according to Eurocode 4.
•A reference list of new design guidance of particular interest to steelwork designers.


Everyone likes "free." Here's some free advice for improving your next big speech. All presentations should start with five key steps. If you hammer out solid answers to these prior to building your talk, you will be putting yourself on the track to success.
The first consideration should always be "Who are you trying to reach?" Because your success depends on knowing your audience and trying to engage, educate, entertain, or inform them. Are you talking politics with a group of academics? Are you teaching knot tying to a bunch of Boy Scouts? Are you writing a project proposal hoping to receive grant money? Who are you speaking with? What do they want? What do they know? You will base your tone, message, visual effects, storytelling, and everything else you need on this sole consideration. If you think that you can put together a "one-size-fits-all" presentation, I hate to break it to you – you can't. Public speaking training suggests having alternatives. In fact, I traditionally advise people to develop at least three different presentations on their subject matter, one for each of the three key audiences: uninformed general public, marginally informed policymakers, and fully informed peers.
Sure there are other rationales or purposes for giving a talk, but generally they fall under one of these categories. The point of having a purpose is that there is something you should get out of your presentation, as well. You need a valid reason for doing it.
The crux of a good presentation is its message. All talks need one (or two). Just be wary not to have too many, which could muddle the effectiveness of your talk. In research writing, the message is equivalent to your conclusion(s). What is the most important thing you want your audience to learn? This is like your topic sentence in writing. It needs to address the "Why they should care?" or "How does this affect me?" curiosities of your audience. If you were to poll your audience after your talk and ask them what is the one thing they learned, this should be everyone's response.
During your planning and preparation, the message should be the first thing you incorporate into your actual presentation layout or design. And when you present, it should come up early and often with some emphasis. A message shouldn't be revealed at the very end. It should be stated near the beginning of your talk. It should be clear and concise. You want people to know what they should care about and why. Then it is up to you to justify it with the rest of your talk.
I want them to storm the castle.
With presentations the idea of measuring your success is based mostly on your own personal goals. You may want to set a goal of selling a product. For example, if I were to give a talk about this website, I may set some form of website hit goal. Say I present to an audience of 30 people. I'd hope my presentation would inspire at least 10 people to go to my website. If my site shows an immediate response, it was a successful talk. If more show, that's great. If less show, that means I was not successful. Another presentation metric may be a threshold for number of questions you'd like to be asked after the talk. Or the number of people you would like to offer you platitudes when you finish. Maybe you hoped that someone would invite you for drinks because your talk connected with them on a personal level. Whatever you decide as something worthwhile, aim for that as the outcome of your presentation. Then do what you need to adjust your talk to get you to that point with your audience. Another option is you can hire a public speaking coach to evaluate your talk.


Turning Vision Into Action: Measuring Your Success in 2012!
Measuring Your Success in 2012!
At the risk, of being a bit redundant, I am "Re-Posting" my blog from January 2nd, 2012, today. It is provided below. Why do this? First, my blog readership has doubled in 2012. So, I figure from time to time some of the old posts may have some value.
So, as we enter in 2012, as you celebrate the ending of one semester, and the beginning of another, please keep in mind it is the community members that matter. Celebrate their triumphs, embrace their tragedies, help them grow. Take pictures of them, post those pictures everywhere you can. And then watch the years flow by. Because in a blink, it will be 2013, and you will have to ask, "How did I do in 2012? How did I serve and lead the members of my home and professional families?"
And only you can measure your success as a family member in 2012.
Well, that blink is here. It is 2013 in 2 days. How did 2012 go for you? How did the celebrations of those in your work and personal "Families" go?
2012 left me more accomplished, but exhausted. It was intense, furious and fast paced with little time to fully enjoy those in my life that I trust and love so much - both my professional friends and my personal family members. I think in 2012 I took from them more than I gave. It is both a point of reflection and a point of grace that I plan to work on in 2013.
And, as is generally the case for all of us, my success as a fully functioning "Family" member, suffered because of my inability to find the necessary Quadrant II time, to be successful. So, like me, enjoy the posting from a year ago, and then challenge yourself to ask, "How will I measure my success as a family member in 2013?
Like many of the readers of this blog, my family (which at this stage of life has various definitions and extended members) spent parts of this holiday season together. Annual family gatherings are often filled with both joy and sadness, tragedy and triumph, reflection and action, fear and hope as one year ends and another begins.
In some sense, our family gatherings represent the same feelings and emotions that we experience in our professional families as well. If you are a teacher, your students are part of your school "family" and your colleagues are part of that family too. If you are a coach your team is part of your school "family" and your fellow coaches will spend more time with you during the season than your "at home" family. If your are a school administrator or district leader, your "family" widens as you steward the members of the school community as well. It becomes a pretty big family to be part of and to understand.
I found myself wondering, what is it about our pictures that as soon as people (especially the members of our extended families) show up in them, a level of new energy and emotion is released? It occurred to me, that our life, our work, our family, is rarely if ever about the place as much as it is about the people - and our experiences with those people, both good and bad. It is the people that make the place have purpose and meaning, passion and emotion, joy and heartache. Without the people - the place becomes empty space.
I first remember experiencing this feeling during my early days as a high school basketball coach at West Chicago Community High School. We had just lost a close home game with a conference rival, and I was a bit distraught over the loss. Once the team members (one of my many families) had gone home, and the coaches too, I decided to walk back into the gym, and just stand in the middle of the gym floor. I wasn't sure it would make me feel any better, but I wanted to capture a picture in my mind of the emotion displayed by 1000+ people just an hour ago: The heartache and the joy of participating in something.
I was struck by the emptiness of the space. The building in the dark, was just that - a nice facility, a nice place - but no emotion no energy. The building, that gym, needed people for it to matter. It needed people that cared about their team, that cared about risk and success. That understood how wins and losses matter only briefly as a measure of success, but real success would reveal itself in whom all of those young men and women would become.
In 12 years of coaching I had taken a picture of every team that was part of my school family. In every case, the years and the records (even the good years) just sort of blend together. But I can always tell you about the year my players asked me to design a "Fibonacci" defense for them (I was a math teacher and we also had the Euclid zone press). Or the year that I dubbed one of our players the X-factor. Or the year that several of my players had significant tragedy in their lives - including the house burning to the ground for one player during the season. And it was our family reaction and response to these events that made the season a success. It is and will always be about the people in our "families" and the relationships built around them.
When I became director of mathematics and science at Stevenson, every fall (at open house) I would insist that we all "dress up" and get together in the commons area for a "team picture". As we grew the picture had quite a few teachers in it (up to 85 at one point) but I loved placing the team picture on my office door every year. As the years unfolded, of course our "family" members changed in the picture. New additions and departures for many different reasons, would impact the picture. No matter, the "Commons" isn't what made the picture work for me, it was the energy of the great people in the picture that mattered. People that just like me, were trying very hard every day to help their student family - to become positive community members.
And now you enter in 2013 - another year will become part of your legacy. Celebrate thetriumphs of others, embrace their tragedies, help them grow. Watch the years flow by. Because in a blink, it will be 2014, and you will have to ask, "How did I do in 2013? How did I serve and lead the members of my home and professional families?"
And only you can measure your success as a family member in 2012 2013! See - the years really do start to stack up!


CDSE General English Exam consists of the below sections.
You can practice these questions as real time exam in this link.
Directions (Q.1-25): In this section, you are required to spot errors in sentences. Each sentence is divided into three parts. Read each sentence to find out whether there is an error in any of the parts. No sentence has more than one error. Some of the sentences do not have any error: When you find an error in a sentence, the letter indicated under that part of the sentence is the answer and therefore the same may be marked on the separate Answer Sheet. If there is no error in any part, then (D)which stands for "No error" is the answer for the item.


If you spend too much time thinking about it, you'll never get it done.
There are loads of scholarship programs out there, so it's always good to try your hand at a few that may be a good fit. After all, there's nothing to lose, especially if you already applied or you got in early. College Essay Organizer includes hundreds of scholarship questions in its database, and we rounded up a few of the most popular ones that students are applying to along with some of their thought-provoking essay questions.
A) "The future belongs to the discontented." Robert W. Woodruff -- Just thirty-three years old when he took command of The Coca-Cola Company in 1923, Emory alumnus, Robert W. Woodruff shaped the fledgling soft drink enterprise and its bottler franchise system into a corporate giant with the world's most widely known trademark. During the next six decades, Mr. Woodruff established a remarkable record as a global leader and philanthropist. Describe how this quote resonates with you.
B) "The cynics will tell you that the good you do today will be forgotten tomorrow. Just do it anyway." Roberto C. Goizueta -- The Goizueta Business School is honored to take its name from Roberto C. Goizueta, who demonstrated a level of personal and professional courage throughout his lifetime that has ensured his legacy as one of the most respected business leaders of the 20th century. As a future business leader, what is the good you would like to contribute in the world, and why?
What is the world's most pressing problem and how should business contribute to the solution?
A primary objective of the Lillis Scholarship is to encourage intellectual independence. To illustrate your own intellectual independence and ability to integrate it into your life, please provide the selection committee with an original essay in which you respond to the following prompt: Describe an intellectual idea that has transformed your thinking.
A) Recent disclosures have revealed that the US government maintains a database that logs all American telephone calls and actively collects the contents of large numbers of domestic and foreign emails. National security officials have testified that these once-secret programs have disrupted more than 50 "potential terrorist events." The American Civil Liberties Union (ACLU) has filed a suit against the Obama administration demanding an end to this surveillance, contending that it "gives the government a comprehensive record of our associations and public movements, revealing a wealth of detail about our familial, political, professional, religious, and intimate associations." In your opinion, what are the considerations in determining how much domestic surveillance is warranted to prevent possible terrorist attacks? Do you agree with the ACLU's position or that of the government? Where do you draw the line regarding data collection and when this should be prohibited?
B) According to Dr. Francis Collins, head of the Human Genome Project, scientists will soon be able to perform genetic testing to determine an individual's likelihood of developing 25 major diseases such as cancer, arterial sclerosis, and diabetes. Similar in-vitro testing will be available as well, permitting parents to know the probability of debilitating—as well as "undesirable"—traits in fertilized eggs before they are implanted in the womb. What are the arguments against making such information widely available? Do you agree or disagree with these arguments?
C) Responding to the overwhelming amount of facts, information, and opinions that come to us though our electronic devices, the author Pico Iyer has written: "The only way to do justice to our onscreen lives is by summoning exactly the emotional and moral clarity that can't be found on any screen." Do you agree with this statement? Why?
We're deep into reading the thousands of admission applications that arrived before the regular decision deadline yesterday. But we've noticed that there is one application missing: yours.
Just in case you forgot to press the "submit" button, we're happy to announce that you've got until January 31 to send us your Wheaton application. We've had enough experience to know that in the crush of things to do as a college applicant, time and technology (this year) can get the best of you.
Simply return to commonapp.org, ignore the published application deadline, finish filling out the forms you started for Wheaton, and hit "submit"! It's that easy.
One important reminder: Don't forget to tell your counselor and teachers that you are applying to Wheaton so they can submit your transcript and recommendations to complete your file.
Good luck! We look forward to receiving your application very soon!
Greetings from GW! We have been made aware that some students are experiencing difficulties submitting the Common Application. We want to reassure you that we will continue to accept applications if you are unable to submit it today.
Please contact our office if you have any questions. We look forward to learning more about you in your application.
Scholarship Time: Don't Miss This Contest!
It ain't about the money, money, money...or is it?
Now that even the extended regular deadlines are about to pass, the temptation (we know it's strong) is to sit back and do nothing. Don't get us wrong: you deserve a break. But you could be missing some big opportunities. In fact, you might even be overlooking that pot of gold sitting at the end of the rainbow. You're really close. You can almost reach out and touch it. Or at least you can log into College Essay Organizer and check the list of colleges you applied to to see which scholarships you are eligible for.
When you've already written dozens of essays, what's a few more, and the payoff can be great! And the process can actually be fun--there are creative questions out there that could potentially bring new meaning to your life. You could gain insights that you never thought possible. Well, maybe that's a bit over the top, and we have to admit there are hundreds of pretty cut and dry questions, but the juicy ones exist too, and your challenge is to send us the most shockingly fun and original scholarship questions you can find by January 21. Email us at [email protected], and we'll post the top ones to our blog. Let's see what you've got!
Posted in News | Comments Off on Scholarship Time: Don't Miss This Contest!