Tuesday, December 31, 2019

The Struggle Of The Civil War - 1684 Words

After publishing Battle Cry of Freedom in 1988, Mcpherson decided to pursue a different path instead of everything about the Civil War he decided to reflect on the Civil War as seen through Drawn With The Sword published in 1996. Mcpherson decided to split Battle Cry Of Freedom into five different parts and each of those parts tying back to his five themes established in the preface of the book. Those themes being slavery being a polarizing issue that split the country and brought the war, evolution of a conflict from limited war for restoration of the old Union to a total war for a new birth of freedom, role of blacks in the war, political and military leadership, the enduring impact of the war on consciousness and institutions abroad as well as at home. Mcpherson managing to illustrate those themes expressed through 15 chapters divided in 5 chapters each section giving you an idea of the theme of the chapters to come. Slavery has been a major issue throughout the United States ever since introduced in 1619 and being highly encouraged once indentured servants were gone, the Columbian Exchange, and cash crops being on the rise in the South. Slavery being McPherson’s first theme in the preface, him expressing that theme throughout parts two, four, and one. Part one titled, â€Å"Origins of The Civil War† as seen in through exceptionalism in which the South possessed a separate and unique identity different from the rest of America. As William H. Seward, undermined,Show MoreRelatedThe Struggle Of The Civil War1492 Words   |  6 PagesTexans contend that the Civil War was not fought over slavery, citing the limited number of slave-owning households in the state. While the majority of Texans did not own slaves, it would be inaccurate to argue that they were therefore against slavery. Texas, representative of other southern states that supported slavery, had a vested interest in preserving the institution at all costs, which is why they risked their lives over it. Moreover, Texans may argue that the civil war was about states’ rightsRead MoreThe Struggle Of The Civil War919 Words   |  4 PagesThe Civil War lasted for only four years, from 1861-1865, but it led to many economic, political, and social developments that remained for far longer than the fighting. From 1860-1877, for example, many impactful events happened leading to the start and end of the war and into the rebuilding that was necessary after the fighting left behind devastation. In 1861, Fort Sumter was fired upon, and the north was angered into action causing Lincoln to call for soldiers to come and fight the south. AlongRead MoreThe Struggle Of The Civil War908 Words   |  4 Pagesera changing events occurred such as the civil war, death of our founding fathers among other events that really shaped America to what it is today. There were many dark times throughout this century as hope seemed to be lost and the thought of the north losing the civil wa r could not be fathom as today’s society would be drastically different. To this point in American history we have succeeded from England became independent and winning the revolutionary war, we have wrote our own declaration andRead MoreThe Struggle Of The Civil War1235 Words   |  5 PagesThe Civil War was fought over states rights and slavery, and whether slavery should be expanded into the western states. The compromises of 1820 and 50 was made to maintain the amount of free and slave states in Congress. Though with Lincoln’s election the southern states seceded due to the south believing he would abolish slavery, though only 1% of the south’s population owned slaves, however, most of the south was consumed by sectionalism which caused all of them to simply believe that slaveryRead MoreThe Struggle Of The Civil War1863 Words   |  8 Pagescrisis called the Civil War. The Civil War was a make or break situation for the United States because it questioned the idea that all men were created equally and had the same rights and freedoms as each other. This war was especially crucial to the slaves during this time for the idea that they wanted to be treated equally to the white man The African slaves saw this war as an opportunity of freedom, but that was not the only cause of the war. One major issue leading to the Civil War was the groupsRead MoreThe Struggle Of The American Civil War765 Words   |  4 Pages  The American Civil War, was a civil war fought from 1861 to 1865 to determine the survival of the Union or independence for the Confederacy. Among the 34 states in January 1861, seven Southern slave states individually declared their secession from the United States and formed the Confederate States of America. The Confederacy, simply called the South, grew to include eleven states. Although they claimed thirteen states and additional western territories, the Confederacy was never recognized byRead MoreThe Struggle Of The Russ ian Civil War1707 Words   |  7 PagesRussian Civil War On October, 1917, the Bolshevik party overthrew the Russian government and arrested him. They take control over Russia. From there, things start to not go really well because of the Bolsheviks policies. A chaos starts to begin a lot of people weren’t happy. The economy was bad, there was a great inflation. Also, they were having a lot of enemies. All these people who hated them start to come together and they formed a group which called the Whites. From there, the civil war startsRead MoreThe Struggle For Equality And Rights During The Civil War1323 Words   |  6 PagesAfrican Americans who sought the same liberty and equality that was promised to everyone under the United States constitution. These liberties, of course, were not achieved right away. During the Reconstruction era, which is the decade right after the Civil War, many of the recently freed slaves did not have money, property, or credit. They could not buy the necessary things to enjoy their freedom, which lead to sharecropping, a glorified form of slavery. Sharecropping is a system of agriculture in whichRead MoreSpanish Civil War: The Struggle Between Fascism and Communism 1431 Words   |  6 PagesThe Spanish civil war of 1936-1939 was an important conflict in Spain’s history. This war was initiated by a military revolt led by General Francisco Franco on the 17 July 1936 and ended with Franco’s victory on the 1 April, 1939. This victory resulted in the replacement of the Second Spanish Republic with the conservative dictatorship of Franco. This conflict triggered the clash of the various cultures and ideologies within Spain. One important example of an ideological clash was that of CommunismRead MoreEssay about Struggles in Post Civil War America1020 Words   |  5 PagesThe Civil War split the nation in half. It tore apart families, and Union soldiers against Confederate soldiers for four miserable years. From the first shots fired at Fort Sumter 1861, and end ing with a unanimous Confederate victory in 1865. All in all 630,000 people died and many thousands wounded. The deaths in the Civil War totally surpassed the death totals from any other war (1). For those managed to survive the up hill battle just began, they faced many unknowns in a world moving in an uncertain

Monday, December 23, 2019

Interpersonal Communication Skills And Cognitive Academic...

Describe basic interpersonal communication skills and cognitive academic language proficiency from your own understanding (1’). †¢ Interpersonal communication skills, for me is the ability to speak to one another in a form that will allow us to exchange ideas, thoughts, information and emotions. If I had to explain this form of communication in one word I would say â€Å" Chat† this is because in a chat you are to swap and discuss a topic that is either important to you or the listener, or about something that may bother you and make you feel a certain way. Some basic interpersonal skills are body language, gestures, facial expressions and verbal dialogue. †¢ Cognitive Academic language Proficiency: this is for me the intellectual part of learning a new language. This is the ability to write, speak, understand, analyze, compare and evaluate information in the acquisitioned language. 2. Describe one of the following models: Two-way Bilingual Immersion program, Transitional Bilingual Education, or Structured English Immersion (1’). †¢ Transitional Bilingual Education: In my opinion this model refers to the ability to transition from a fully fluent language to a new language. In other words a child’s ability to smoothly transition from one language to the other will solemnly depend on whether or not that student has his native language down packed and whether or not that student may perfectly understand, speak, write and evaluate their primary language before they move on to attainShow MoreRelatedExplain The Differences Between Bics And Calp1081 Words   |  5 Pagesinteraction in second language acquisition. 3. What is the role of a student’s primary language proficiency in second language acquisition? 4. Define Specially Designed Academic Instruction in English (SDAIE). Explain the goals and objectives and instruction features of this framework. (10 points) 5. Briefly describe the difference between informal and formal assessments. What are the advantages/disadvantages of each? 6. Pick one of the activities under the heading â€Å"Promoting Oral Language Development inRead MoreIntegrating A Dual Language Immersion Program1262 Words   |  6 Pagesthe information presented by Rhodes, Ochoa, Ortiz’s â€Å"Assessing Culturally and Linguistically Diverse Students a practical guide† I would develop a Two Way Dual language immersion K-12 program involving a Late Exit Transitional Bilingual Education element. I visualize a Dual Language Immersion as program that provides education in two languages for English speakers and non-native speakers of English. In a Two-Way ninety-ten system or program in which monolingual English-speaking students acquire theRead MoreThe Main Stages Of Second Language Development Essay891 Words   |  4 Pagesmain stages to second language development. BICS is Basic Interpersonal communication skills, they are language skills which are needed in a daily basis to interact socially with others. BICS is basic interpersonal communication skills. It is the most basic form of communication and relies on gestures, facial expressions and body language to enhance or support the meaning of words (Brown-Chidsey and Bickford, 2015). BICS can take between 2 and 4 years to achieve. These skills are the ones which areRead MoreInterpersonal Communication Skills And The Math Class972 Words   |  4 Pages Interpersonal Communication Skills (BICS) observed in the math class. One of the first examples where I noticed BICS taking place was at the beginning of class time. As the students set up their desks and chalk boards, they were all loudly conversy about whatever they deemed fit. This is considered a BICS because the students were interpersonally conversing within the classroom about subjects related and unrelated to the math class wit h one another. For example, This BICS example wasRead MoreProfessional Development For Teachers With English Language Learners837 Words   |  4 Pagesthat promotes English language acquisition and literacy proficiency for English language learners is the cornerstone of literacy reform in the United States. In this assignment, I define teacher knowledge. I then identify three areas of professional development that, by increasing teacher knowledge, would translate to increased learning gains for English language learners. Teacher Knowledge Carlisle, Kelcey, Rowan, and Phelps (2011) distinguished between teacher academic knowledge and teacherRead MoreThe Importance Of Learners With Gifts And Talents1649 Words   |  7 Pages As the population of English Language Learners , otherwise known as ELLs, has been increasing over the past few decades, so has their disproportionate representation in special education. Too many of our ELLs are often disproportionately placed in special education programs, which may be considered a challenge faced by both general and special educators. But what about the underrepresentation of ELLs in the gifted and talented programs? It seems as though general educators struggle to provide theseRead MoreEnglish Language Learner : The United States2145 Words   |  9 Pageslittle English and they are considered to be an English Language Learner (ELL) defined by â€Å"those whose primary language is a language other than English and who have English language skill deficiencies that impair their learning in regular classrooms† (Malagon, McCold, Hernandez, 2011, p. IV). While parents truly believe their children will receive a better education in the United States as oppose t o the country they came from, English Language Learner students face a number of everyday challengesRead MoreDiscuss How Children with English as an Additional Language (Eal) Can Be Included Within the Daily Mathematics Lesson636 Words   |  3 PagesEnglish as an Additional Language (EAL) can be included within the daily mathematics lesson 1906833 Table of Contents Front Cover 1 Essay: Part I: discussion: how children with eal can be included in the daily mathematics lesson.. 3-10 Part II: lesson plan to incorporate stategies for eal learners†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦...†¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦.†¦11-15 References †¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦Ã¢â‚¬ ¦.16-17 Appendix 18 E.A.L. stands for English, as an Additional Language. It is an additional inRead MoreEssay Language Acquisition Principles1079 Words   |  5 PagesKrashen is one of the experts when it comes to language acquisition. He has theorized on the subject of second language acquisition for years and has been quite influential in this field of linguistics. He approaches the subject of second language acquisition by presenting his five theories for acquiring a second language. Aida Walqui is another expert; however, she approaches the subject from the aspect that contextual factors are involved in second language learning. Even though Krashen and WalquiRead MoreQuestions On Interpersonal Communication Skills939 Words   |  4 PagesBICS BICS, or Basic Interpersonal Communication Skills, are the basis for socialization in any language and are necessary for day to day life and is referred to as social language. This type of interaction includes embedded content, which involves â€Å"comprehension aided by context clues, like facial expressions, body language, modeling or demonstrations, visual clues and cues, etc.† (Combs et al, n.d.). Because content is easy to understand and uses simple language structure, it is seen as cognitively

Sunday, December 15, 2019

ICT in marketing Free Essays

Promotional campaigns. Recommending the use of the products at micro level would result in increasing productivity of the input and thereby increasing the image and the sales of the product can raise the input demand for rural markets. Joint or co-operative promotion A personalised approach is required under this strategy of rural marketing. We will write a custom essay sample on ICT in marketing or any similar topic only for you Order Now Under this approach there is a greater scope for private sector and farmer organisation to get into input supply and especially into retail distribution, as it is a low risk activity. Bundling of inputs In order to reap the benefits of, the economies of the scale a rural marketer has to esort to bundling of inputs. ‘Bundling of Inputs’ is the process by which the marketer would provide a bundle of products to the retailer so that he can meet the requirements of the farmers in one place. The village level co-operatives and other agencies can play an effective role in the distribution of inputs. Establishing linkages with financial agencies and other input sellers can help greatly as the bank credit plays an important role by making the purchase possible. Management of Demand A marketer apart from maintaining good supplies in terms of quality and quantity also has to focus on the demand side of the operations also. Continuous January 2006 | www. i4d. csdms. in market research should be undertaken to assess the buyer’s needs and problems so that continuous improvements and innovations can be undertaken for a sustainable market performance. Developmental marketing Developmental marketing refers to taking up marketing programmes keeping the development objective in mind and using various managerial and other inputs of marketing to achieve these objectives. A prerequisite for developmental marketing is Development Market Research, which can be termed as the application of marketing research tools and techniques to the problems of development. The research tools of marketing like product testing tests marketing, concept testing and media testing or message test and focus groups are used in this work. Developmental marketing has started to find its roots in India where researchers are using focus groups and products tests to learn more about rural markets and products needs and USPs (Unique Selling Proposition) can be tried out. Media rural marketing uses both kinds of media i. e. the traditional media as well as the modern media. The traditional media includes puppetry, drama, folk theatre e. g. tamsaha (role play of different characters by one or two persons), nautanki (short kits with songs and poetry), street plays, folk songs, wall paintings and proverbs. Marketer uses traditional media as it is more accessible, personalised, familiar and carries a high potential for change. The modern media includes the print media, the television and the radio USPs. 21 Some ot the USPs ot the companies engaged in rural marketing are given below. Mahindra Tractors- ‘Mera Desh Mera Gaon’ (My country my village) Tafe Tractors-‘Grameen Bharat ki Dhadkan’ Tafe ka Massey Ferguson(The heart beat of rural India its Tafe’s Massey Ferguson) SwaraJ Tractors- ‘Pragati aur Khush-hali ke iye’ (For development and happiness) Escorts- ‘Nay’ technique ke sath, Bharosa Jeevan bhar Ka’ (A life long trust with new techniques) Eicher-‘Ghazab ki takat, ghazab ki shaan’ (Incredible strength, Incredible pride) Sun Seeds- ‘Grow with Sun’ ICl Karate Insecticide’Keedon ka Maha-kaal, Phasal Ka Pehredaar’ (Insects enemy protector of the crops). Pesticide India- ‘Desh ke liye Phasal Anek, Keedon ke Naash ke liye Foratox Sirf Ek (Numerous crops for the country but only for destroying pests i. e. Foratox). Thus the companies use different formats to influence the target audience in order to produce the desired results. Extension Services. There are several limitations of rural marketing in the Indian context, this leads to the need for extension services to supplement the efforts of the firms engaged in rural marketing. The various extension services could include credit facilities, competitions among the farmers, educating the farmers regarding the appropriate agricultural practices, etc. Extension services would thus play a crucial role in the development of rural marketing in India. Ethics in Business Ethics occupies a special place in rural marketing, and has been at the heart of all the transactions whether cash or kind. In order to make a lasting impact on the rural clients, the firms need to built a trustful relationship and that is possible by no other means but only by ethical conduct. Partnership for sustainability There is a need to build partnership with rural clients for a sustainable business relationship and sustainable marketing relationship. There should be a long-term relationship between the firms and farmers for agro business projects, which are risky, long drawn and technical in nature. Partnership is required in rural marketing business so as to award distributorship to local groups and individuals employing ocals, staff secondment in local projects, preferential purchase of local product, training to locals and discount on product supplies in some areas. Rural marketing firms can work with NGOs also because NGOs have better linkages and understanding of the local communities and their problems. NagarJuna fertilisers and Chemicals Ltd has set up an agro output division which is known as FMS (Farm Management Service) which provides packages to the farmers right form soil testing to post harvest stage of the crop system. The FMS aims at enhancing farm productivity optimising cost of production, improving conomic returns to farmers and enhancing the cost of production and enhancing the produce quality. Conclusion Rural marketing in India nas still a long way to go, rural marketers nave to understand the fact that rural marketing in India has a tremendous potential in our country. Rural marketers should understand this fact and try to tap the huge untapped potential in our country. NepaLinux NepaLinux is a Debian and Morphix based GNU/Linux distribution focused for Desktop usage in Nepali language computing. It contains applications for Desktop users like: OpenOffice. org, Nepali Gnome Desktop, Nepali input systems tc. Since January 2004, Madan Puraskar Pustakalaya, the principal archive of books and periodicals in the Nepali language, undertook the Nepal component of the 30- month long PAN Localisation Project (www. PANLIOn. net), a multi-nation localisation project being conducted in Afghanistan, Bangladesh, Bhutan, Cambodia, Laos, Nepal, and Sri Lanka, with the support of International Development and Research Centre (IDRC), Canada. This project includes a Nepali GNU/Linux distribution ‘NepaLinux’ comprising of localised GNOME, OpenOffice. org, Mozilla suite, and other utilities that nclude Nepali Spellchecker, Thesaurus, Nepali Unicode support, etc. This distribution can be used in Nepali as well in English environment. Though NepaLinux is basically a live CD it can also be installed in the computer. The work for the installation process has been facilitated through the European Commission supported Bhasha Sanchar Project (www. bhashasanchar. org) which is led by the Open University (I-JK). NepaLinux is a Free/Open Source Software (FOSS), in which the source code is open and the users have the freedom to use, study, modify according to one’s needs and redistribute it. NepaLinux, being a Free/ How to cite ICT in marketing, Papers

Saturday, December 7, 2019

Current Issues in Marketing

Question: Discuss about the Current Issues in Marketing. Answer: Introduction As the business environment has become dynamic in nature, the organizations both SMEs and large organizations have been facing some major critical challenges related to marketing. Measuring the Return on Investment of marketing activities is the top marketing challenge in accordance to the 2015 State of inbound report (Thompson et al., 2013). Apart from this, there are some other issues such as pricing issues, segmentation issues, issues related to the issues and other strategic issues. Thus, in order to understand the possible marketing issues often faced by the organization across the globe, the current working scenario of Emirates Airline, UAE has been considered in the present report. As per the current global scenario, the airline industry is one of the fastest growing industries as it is supporting the globalization as well as internationalization objectives for businesses around the world (Hur, Won Moon Jun, 2013). Emirates Airline has been chosen for the current report since it is a major competitor for many global organizations. In the current report, an intensive analysis of the brand has been presented identifying the major critical issues. Background of the organization Emirates is airline organization, which is based in Dubai and the government of United Arab Emirates in 1985 first established the organization. One of the major activity performed by the organization is commercial air transportation service. Emirates Airline gains a huge popularity across the globe due to its extended services. Emirates currently operates 3400 flights each week. In addition, Emirates Airline is one of the fastest growing international airline. The annual growth of the company has never fallen below 20% (Selnes, 2013). It is identified that Emirates achieved the progress due to the ability of the workforce. The employees of Emirates understand the process of fitting the world together. The success of the organization does not only come from the industry and the customers; some external factors are also there to influence the business. Some critical factors such as global economy, shifting of population, trade and politics, diversity and sustainability could influence the business of Emirates Airline. After two decades of the establishment, Emirates has expanded its empire with the 85 aircrafts in more than 55 countries souring to 78 destinations (Namukasa, 2013). Furthermore, Emirates Airline has the largest number of cabin crew and they are failing from 95 different nationals. Figure 1: Logo of the organization (Source: The Emirates Group Companies, 2016) Goals: The major goal of the organization it to see the world from the top by enhancing what they perform Mission Statement: Emirates Airline exist to provide people with a new experience of watching the world. Vision Statement: The major vision of the organization is to make the civil aviation safe, remarkable and sustainable. Objectives: One of the major objectives of the Emirates is to retain and increase frequent business class travels market share. Another objective is to maximize the market share 45-60% by 2020 (Chen Hu 2013). The organization is also determined to tap the low cost carrier market share to ear return on investment of the organization. Another significant objective is promote Dubais Tourism activities and represent Dubai the world. Positioning statement: The finest in the sky Analysing the brand aspects The campaign of Emirates Airline continuous to grow from travel brand to global lifestyle brand. The campaign of Emirates Airline also includes the digital activities in a bid to engage with the young audience. The current scenario of the organization indicates that the new target of the organization individuals who are well-travelled, and ambitious to become well-travelled and the people who adopt the opportunity to try the unfamiliar. The brand aspect of Emirates Airline are discussed below with six different brand elements. Memorability: As mentioned by Hennig-Thurau, Hofacker and Bloching (2013), the brand elements help to achieve a greater level of brand awareness to the brand. The brands should be represented in a way that customers easily recall the brand at the time consumptions as well as the purchase. In such a context, the Emirate Airline gains the opportunity of running the operation from Dubai, which is one of the largest and economically developed cities in the world. Thus, attaching the brand name with the largest city Dubai creates a positive impression in the views of customers. Therefore, people remember the brand as Emirates, Dubai. Meaningfulness: The brand Emirate has an understandable meaning and it is credible. The name Emirates inherited from the United Arab Emirates (Shani Chalasani 2013). All big cities in Middle East come under UAE. Thus, people find a corresponding category while considering an inherent meaning. In addition, Fly Emirates represents a positive practice of nature such as flying in the sky. This indicates that people find a corresponding option in the name. Likeability: As mentioned by Brodie et al. (2013), the brand names should be inherently interesting and colourful and not necessarily directly related to the brand. In addition, the brand could use the recent trend for playful name that easily offer the readily available URL. In such context, the brand name Fly Emirates is one of the trendy names as people find a corresponding category in the name. The popular social media tool Twitter promotes the page of Fly Emirates. The above-mentioned criteria forms the offensive strategies toward building the brands. Likewise, the following three criteria forms the defensive strategies towards maintaining the brand equity. Transferability: As mentioned by Shapiro Varian (2013), transferability is referred to a degree based on which the brand elements could add brand equity to the products and services. Yoo and Bai (2013) added that marketers should know that brand ability should have the ability to add brand equity across geographical boundaries. In such context, Emirates Airline comes with an incredible idea to add brand equity and increase brand value. It is evident that each individual has the dream to fly in the sky or individual might have the fantasy to touch the sky (Dobruszkes 2013). Thus, the word Fly of Fly Emirates creates fantasy among people to fly in the sky or it generates the idea that if one could fly in the sky, also touch the sky. Likewise, Emirates gets into the mind of people and represent itself adding the brand equity. Adaptability: It is evident that customer perception, opinions and values keep changing over time (Gluckman, 2013). Therefore, the brand should be adaptable and flexible so that it becomes easier to change and update. However, the organization does not changes its brand logo or update. Emirates Airline has wide range of products and services based on the needs and demands of the industry. On the contrary, the organization promotes its products and services based on the current events and affaire. For example, in 2014, the footballer and the legend Pele and Cristiano Rolando joined Emirates global campaign to connect sports fan around the world as global ambassador for Emirates Airline. However, this strategy does not make the brand flexible. Protectability: This is the final criteria in selecting a brand element. This means the brand should be protectable both legally as well as comparatively (Gluckman, 2013). Therefore, the brands elements should be chosen in such a way that it could be protected globally. In such context, the brand name Fly Emirates becomes the synonymous with the service Fly Emirates. The above-mentioned discussion helps to learn that Emirates Airline has successfully presented its brand in the market. However, the Emirates could apply new strategies to represent the brand more successfully. Recommendation It has been identified that operational cost of Emirates Airline is extremely high and it is because of the large investment on technologies, best quality services and aircrafts. In such case, the organization needs to control its cost as well as minimize the overall cost through enhancement and development of operational activities. Emirates should focus on better utilization of the resources such as Aircrafts. They also need focus on the maintenance process. Another significant way of reducing the cost of operation is the implementation of the technologies. By developing the technologies, the organization could cut the labour cost. In response to the challenge of low price airlines in United Arab Emirates could offer advance level services as well as control the cost. Likewise, the organization may not have to reduce the price of the products. They could introduce its new brand as subsidiary, which must be based on the low cost. Conclusion On the completion of the report, it can be mentioned that the overall operation of Emirates Airline has been effective, as the revenue has increased. In addition, due to the increased global presence, Emirates has the control over the global market. However, ad discussed above, the organization needs to cut the cost of operational activities. Thus, in such as case, the organization could take the advantages of technologies. Progress in information technology is most important for extending the operation of Emirates Airline. With the help of the technologies, the company could align the business with E-Business for improving the services and increase customer satisfaction. Reference list: Brodie, R. J., Ilic, A., Juric, B., Hollebeek, L. (2013). Consumer engagement in a virtual brand community: An exploratory analysis. Journal of Business Research, 66(1), 105-114. Chen, P. T., Hu, H. H. S. (2013). The mediating role of relational benefit between service quality and customer loyalty in airline industry. Total Quality Management Business Excellence, 24(9-10), 1084-1095. Dobruszkes, F. (2013). The geography of European low-cost airline networks: a contemporary analysis. Journal of Transport Geography, 28, 75-88. Gluckman, R. L. (2013). A consumer approach to branded wines. International Journal of Wine Marketing. Hennig-Thurau, T., Hofacker, C. F., Bloching, B. (2013). Marketing the pinball way: understanding how social media change the generation of value for consumers and companies. Journal of Interactive Marketing, 27(4), 237-241. Hur, W. M., Won Moon, T., Jun, J. K. (2013). The role of perceived organizational support on emotional labor in the airline industry. International Journal of Contemporary Hospitality Management, 25(1), 105-123. Namukasa, J. (2013). The influence of airline service quality on passenger satisfaction and loyalty: The case of Uganda airline industry. The TQM Journal, 25(5), 520-532. Selnes, F. (2013). An examination of the effect of product performance on brand reputation, satisfaction and loyalty. Journal of Product Brand Management. Shani, D., Chalasani, S. (2013). Exploiting niches using relationship marketing. Journal of Services Marketing. Shapiro, C., Varian, H. R. (2013). Information rules: a strategic guide to the network economy. Harvard Business Press. The Emirates Group Companies | The Emirates Group | Emirates Group Careers Centre. (2016). Emiratesgroupcareers.com. Retrieved 5 August 2016, from https://emiratesgroupcareers.com/english/about/companies/default.aspx Thompson, A., Peteraf, M., Gamble, J., Strickland III, A. J., Jain, A. K. (2013). Crafting Executing Strategy 19/e: The Quest for Competitive Advantage: Concepts and Cases. McGraw-Hill Education. Yoo, M., Bai, B. (2013). Customer loyalty marketing research: A comparative approach between hospitality and business journals. International Journal of Hospitality Management, 33, 166-177.

Friday, November 29, 2019

8 Ways to Automate WordPress Tasks and Waste Less Time

Even if your website is small, running and maintaining it can take a lot of work. You need to create content, communicate with your audience, keep an eye on security, and much more. But just because theres work to be done, that doesnt mean you need to be the one to do it. By learning how to automate WordPress tasks, you can put things on autopilot and lessen your own workload.Automation is likely a term youre familiar with. In this context, it simply means having software or some other tool perform a routine job automatically, without the need for your constant input. WordPress may not offer many automation options out of the box. However, there are many ways to make automation happen using plugins and other solutions.In this post, well talk about eight ways you can automate WordPress tasks to save time. Lets take a look! Easy Updates Manager Author(s): Easy Updates Manager TeamCurrent Version: 8.1.0Last Updated: October 17, 2019stops-core-theme-and-plugin-updates.8.1.0.zip 96%R atings 2,544,808Downloads WP 4.6+Requires Keeping your website updated is vital for ensuring that its performance and security are solid. At the same time, staying on top of updates can take valuable time away from creating content and other tasks. Especially when you have a lot of themes and plugins, remembering to update them all promptly can be a chore. However, forgetting can lead to compatibility issues and security holes.Fortunately, WordPress already automates some updates for you. Plus, you can instruct your site to perform various updates manually, using WordPress built-in systems and some coding. For even more control over your updates, you can use a plugin like Easy Updates Manager to automate WordPress tasks and manage them without any fuss.Just make sure to only automate updates for plugins and themes you trust!2. Full site backups UpdraftPlus WordPress Backup Plugin Author(s): UpdraftPlus.Com, DavidAndersonCurrent Version: 1.16.17Last Updated: September 12, 2019 updraftplus.1.16.17.zip 96%Ratings 29,914,741Downloads WP 3.2+Requires As with updates, backing up your site on a regular basis is an essential security measure. A full backup stored in a safe, external location means youre always able to restore your site quickly if its hacked, information is accidentally deleted, or it develops a serious bug or other issue. Its best to perform backups regularly and to keep multiple copies around. This means it can save you valuable time to automate WordPress tasks in this area.Plugins are your best bet for setting up a backup schedule and then never having to worry about it again. For a free solution, UpdraftPlus is a customizable and flexible option. For even more functionality and automation options, the premium BackupBuddy plugin is an excellent tool.3. Post schedulingIf you run a blog or a news site, you probably publish new posts on a daily basis. This is  particularly true if youre in charge of a large, multi-author operation. You can t fully automate the process of creating and posting content. However, you can make parts of it easier on yourself and your team. For example, you can schedule posts in advance, so youll always know what content is coming up and can stick to a consistent schedule without trouble.In most situations, manually scheduling posts in advance is probably your best bet. Yes you still have to pick the date manually but everything after that is automatic. If you have an especially high volume of posts, though, you can also turn to a plugin like  Auto Post Scheduler.4. Social media posting Revive Old Posts Auto Post to Social Media Author(s): revive.socialCurrent Version: 8.4.4Last Updated: October 3, 2019tweet-old-post.zip 78%Ratings 1,969,075Downloads WP 3.5+Requires No matter what type of site youre running, a strong social media presence can bolster its success and help you build a community. To do this, youll need to develop a social media strategy. Then, youll want to automat e as much of that strategy as you can, including sharing content to various platforms.Revive Old Post helps you automate your WordPress sites social media by automatically sharing both new and old content to your various social network accounts. All you need to do is configure the plugin once and then it can essentially run on autopilot. For more information, check out our post on how to automatically share content on social media.5. Image optimization ShortPixel Image Optimizer Author(s): ShortPixelCurrent Version: 4.14.6Last Updated: October 9, 2019shortpixel-image-optimiser.4.14.6.zip 94%Ratings 2,897,268Downloads 3.2.0Requires If your website has a lot of images and other media, optimizing them is a smart strategy. This process typically makes the files smaller and easier to load, which results in faster page speeds and a better experience for your visitors. However, it can be time-consuming to manually optimize every single media file.Instead, you can tell your site wha t files to optimize and how to do so, then let it do the work for you. ShortPixel  is an excellent comprehensive image optimizer that enables you to optimize any uploads to your WordPress Media Library automatically.As an alternative, you could instead go with EWWW Image Optimizer, which gives you a lot of flexibility over the process.6. Blocking spam comments Akismet Anti-Spam Author(s): AutomatticCurrent Version: 4.1.2Last Updated: May 14, 2019akismet.4.1.2.zip 94%Ratings 143,374,346Downloads WP 4.0+Requires Your sites comments sections are an important place for developing a strong community. Youll want to make sure this is a friendly place, which means eliminating spam comments as much as possible. Getting rid of these comments means your real audience has the space they need for conversations and questions. Yet,  going through each post by hand is often not feasible.There are a number of settings built into WordPress that can help you combat spam, such as blacklisti ng certain words and restricting comment privileges to registered users. For stronger security, you can use Akismet, a free yet powerful plugin thats included in many WordPress installations by default.7. Cleaning up your database WP-Optimize Clean, Compress, Cache. Author(s): David Anderson, Ruhani Rabin, Team UpdraftCurrent Version: 3.0.12Last Updated: September 24, 2019wp-optimize.3.0.12.zip 98%Ratings 11,586,621Downloads WP 3.8+Requires Most of the time, youll automate WordPress tasks that affect the front end. However, its also worth paying attention to behind-the-scenes maintenance as well. For example, after a while your WordPress database can quickly become bloated with old information, slowing down your site. Keeping your database maintained avoids this problem, and can be easily automated.As with many automation tasks, the best approach here is to use a plugin. WP-Optimize removes unnecessary data, enables you to customize what it cleans up, and can be set to run at any frequency youd like. To get rid of even more bloat, you can also check out Advanced Database Cleaner.8. Building an email list Popups by OptinMonster Best WordPress Popup Plugin Author(s): OptinMonster TeamCurrent Version: 1.8.3Last Updated: October 3, 2019optinmonster.zip 86%Ratings 25,294,018Downloads 4.7.0Requires Finally, lets discuss email marketing. This is a useful promotion strategy for many websites – you can gather up email addresses from your audience, then send out news, content, deals, and more. If you want to grow a large and successful email list, however, youll want to automate it rather than soliciting each address and sending every email by hand.To do this, youll want to integrate your WordPress site with an email marketing service that enables you to automate key tasks. There are a lot of quality email marketing services for WordPress. Once you choose one, you can use a service like OptinMonster to automatically build your email list on Word Press.Automate WordPress tasks and start saving time!As a website owner, your time is best spent focusing on the big picture. You should be communicating with your visitors, creating content, and performing research to improve your site, rather than spending all day maintaining your site. For that reason alone, its vital to find as many ways as you can to automate WordPress tasks you dont need to have a hand in.In this post, weve looked at eight WordPress tasks you can automate to save some time. Whether its something mundane like WordPress updates or more user-facing like social media posting, you can find a tool to help you automate it.What do you think about the idea to automate WordPress tasks? Are you excited to get some of those methods working on your site? Save time managing #WordPress by automating these 8 tasks

Monday, November 25, 2019

Network Programming with Sockets Essays

Network Programming with Sockets Essays Network Programming with Sockets Essay Network Programming with Sockets Essay Socket programming got you down? Is this stuff just a little too difficult to figure out from the man pages? You want to do cool Internet programming, but you dont have time to wade through a gob of structs trying to figure out if you have to call bind() before you connect(), etc. , etc. Well, guess what! Ive already done this nasty business, and Im dying to share the information with everyone! Youve come to the right place.This document should give the average competent C programmer the edge s/he needs to get a grip on this networking noise. Audience This document has been written as a tutorial, not a reference. It is probably at its best when read by individuals who are just starting out with socket programming and are looking for a foothold. It is certainly not the complete guide to sockets programming, by any means. Hopefully, though, itll be just enough for those man pages to start making sense 🙂 Platform and Compiler Most of the code contained w ithin this document was compiled on a Linux PC using Gnus gcc compiler.It was also found to compile on HPUX using gcc. Note that every code snippet was not individually tested. Contents: What is a socket? Two Types of Internet Sockets Low level Nonsense and Network Theory structsKnow these, or aliens will destroy the planet! Convert the Natives! IP Addresses and How to Deal With Them socket()Get the File Descriptor! bind()What port am I on? connect()Hey, you! listen()Will somebody please call me? 1 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html accept()Thank you for calling port 3490. end() and recv()Talk to me, baby! sendto() and recvfrom()Talk to me, DGRAM-style close() and shutdown()Get outta my face! getpeername()Who are you? gethostname()Who am I? DNSYou say whitehouse. gov, I say 198. 137. 240. 100 Client-Server Background A Simple Stream Server A Simple Stream Client Datagram Socket s Blocking select()Synchronous I/O Multiplexing. Cool! More references Disclaimer and Call for Help What is a socket? You hear talk of sockets all the time, and perhaps you are wondering just what they are exactly. Well, theyre this: a way to speak to other programs using standard Unix file descriptors.What? Okyou may have heard some Unix hacker state, Jeez, everything in Unix is a file! What that person may have been talking about is the fact that when Unix programs do any sort of I/O, they do it by reading or writing to a file descriptor. A file descriptor is simply an integer associated with an open file. But (and heres the catch), that file can be a network connection, a FIFO, a pipe, a terminal, a real on-the-disk file, or just about anything else. Everything in Unix is a file! So when you want to communicate with another program over the Internet youre gonna do it through a file descriptor, youd better believe it. Where do I get this file descriptor for network communication, Mr. Smarty-Pants? is probably the last question on your mind right now, but Im going to answer it anyway: You make a call to the socket() system routine. It returns the socket descriptor, and you communicate through it using the specialized send() and recv() (man send, man recv) socket calls. But, hey! you might be exclaiming right about now. If its a file descriptor, why in the hell cant I just use the normal read() and write() calls to communicate through the socket? The short answer is, You can! The longer answer is, You can, but send() and recv() offer much greater control over your data transmission. What next? How about this: there are all kinds of sockets. There are DARPA Internet addresses (Internet Sockets), path names on a local node (Unix Sockets), CCITT X. 25 addresses (X. 25 Sockets that you can safely ignore), and probably many others depending on which Unix flavor you run. This document deals only with the first: Internet Sockets. Two Types of Internet Sockets 2 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. tml Whats this? There are two types of Internet sockets? Yes. Well, no. Im lying. There are more, but I didnt want to scare you. Im only going to talk about two types here. Except for this sentence, where Im going to tell you that Raw Sockets are also very powerful and you should look them up. All right, already. What are the two types? One is Stream Sockets; the other is Datagram Sockets, which may hereafter be referred to as SOCK_STREAM and SOCK_DGRAM, respectively. Datagram sockets are sometimes called connectionless sockets (though they can be connect()d if you really want.See connect(), below. Stream sockets are reliable two-way connected communication streams. If you output two items into the socket in the order 1, 2, they will arrive in the order 1, 2 at the opposite end. They will also be error free. Any errors you do encounter are figments of your own deranged mind, and are not to be discussed here. What uses stream sockets? Well, you may have heard of the telnet application, yes? It uses stream sockets. All the characters you type need to arrive in the same order you type them, right? Also, WWW browsers use the HTTP protocol which uses stream sockets to get pages.Indeed, if you telnet to a WWW site on port 80, and type GET pagename, itll dump the HTML back at you! How do stream sockets achieve this high level of data transmission quality? They use a protocol called The Transmission Control Protocol, otherwise known as TCP (see RFC-793 for extremely detailed info on TCP. ) TCP makes sure your data arrives sequentially and error-free. You may have heard TCP before as the better half of TCP/IP where IP stands for Internet Protocol (see RFC-791. ) IP deals with Internet routing only. Cool. What about Datagram sockets? Why are they called connectionless?What is the deal, here, anyway? Why are they unreliable? Well, here a re some facts: if you send a datagram, it may arrive. It may arrive out of order. If it arrives, the data within the packet will be error-free. Datagram sockets also use IP for routing, but they dont use TCP; they use the User Datagram Protocol, or UDP (see RFC-768. ) Why are they connectionless? Well, basically, its because you dont have to maintain an open connection as you do with stream sockets. You just build a packet, slap an IP header on it with destination information, and send it out. No connection needed.They are generally used for packet-by-packet transfers of information. Sample applications: tftp, bootp, etc. Enough! you may scream. How do these programs even work if datagrams might get lost?! Well, my human friend, each has its own protocol on top of UDP. For example, the tftp protocol says that for each packet that gets sent, the recipient has to send back a packet that says, I got it! (an ACK packet. ) If the sender of the original packet gets no reply in, say, fi ve seconds, hell re-transmit the packet until he finally gets an ACK. This acknowledgment procedure is very important when implementing SOCK_DGRAM applications.Low level Nonsense and Network Theory Since I just mentioned layering of protocols, its time to talk about how networks really work, and to show some examples of how SOCK_DGRAM packets are built. Practically, you can probably skip this section. Its good background, however. 3 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Hey, kids, its time to learn about Data Encapsulation! This is very very important. Its so important that you might just learn about it if you take the networks course here at Chico State ;-).Basically, it says this: a packet is born, the packet is wrapped (encapsulated) in a header (and maybe footer) by the first protocol (say, the TFTP protocol), then the whole thing (TFTP header included) is encapsulated again by the next protocol (say, UDP), then again by the next (IP), then again by the final protocol on the hardware (physical) layer (say, Ethernet). When another computer receives the packet, the hardware strips the Ethernet header, the kernel strips the IP and UDP headers, the TFTP program strips the TFTP header, and it finally has the data. Now I can finally talk about the infamous Layered Network Model.This Network Model describes a system of network functionality that has many advantages over other models. For instance, you can write sockets programs that are exactly the same without caring how the data is physically transmitted (serial, thin Ethernet, AUI, whatever) because programs on lower levels deal with it for you. The actual network hardware and topology is transparent to the socket programmer. Without any further ado, Ill present the layers of the full-blown model. Remember this for network class exams: Application Presentation Session Transport Network Data Link Physical The Physical Layer is the hardware (serial, Ethernet, etc. . The Application Layer is just about as far from the physical layer as you can imagineits the place where users interact with the network. Now, this model is so general you could probably use it as an automobile repair guide if you really wanted to. A layered model more consistent with Unix might be: Application Layer (telnet, ftp, etc. ) Host-to-Host Transport Layer (TCP, UDP) Internet Layer (IP and routing) Network Access Layer (was Network, Data Link, and Physical) At this point in time, you can probably see how these layers correspond to the encapsulation of the original data.See how much work there is in building a simple packet? Jeez! And you have to type in the packet headers yourself using cat! Just kidding. All you have to do for stream sockets is send() the data out. All you have to do for datagram sockets is encapsulate the packet in the method of your choosing and sendto() it out. The kernel builds the Transport Lay er and Internet Layer on for you and the hardware does the Network Access Layer. Ah, modern technology. So ends our brief foray into network theory. Oh yes, I forgot to tell you everything I wanted to say about routing: nothing! Thats right, Im not going to talk about it at all.The router strips the packet to the IP header, consults its routing table, blah blah blah. Check out the IP RFC if you really really care. If you never learn about it, well, youll live. [Encapsulated Protocols Image] 4 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html structs Well, were finally here. Its time to talk about programming. In this section, Ill cover various data types used by the sockets interface, since some of them are a real bitch to figure out. First the easy one: a socket descriptor.A socket descriptor is the following type: int Just a regular int. Things get weird from here, so just read through and b ear with me. Know this: there are two byte orderings: most significant byte (sometimes called an octet) first, or least significant byte first. The former is called Network Byte Order. Some machines store their numbers internally in Network Byte Order, some dont. When I say something has to be in NBO, you have to call a function (such as htons()) to change it from Host Byte Order. If I dont say NBO, then you must leave the value in Host Byte Order. My First Struct(TM)struct sockaddr.This structure holds socket address information for many types of sockets: struct sockaddr { unsigned short sa_family; /* address family, AF_xxx */ char sa_data[14]; /* 14 bytes of protocol address */ }; sa_family can be a variety of things, but itll be AF_INET for everything we do in this document. sa_data contains a destination address and port number for the socket. This is rather unwieldy. To deal with struct sockaddr, programmers created a parallel structure: struct sockaddr_in (in for Internet. ) s truct sockaddr_in { short int sin_family; /* Address family */ unsigned short int sin_port; /* Port number */ truct in_addr sin_addr; /* Internet address */ unsigned char sin_zero[8]; /* Same size as struct sockaddr */ }; This structure makes it easy to reference elements of the socket address. Note that sin_zero (which is included to pad the structure to the length of a struct sockaddr) should be set to all zeros with the function bzero() or memset(). Also, and this is the important bit, a pointer to a struct sockaddr_in can be cast to a pointer to a struct sockaddr and vice-versa. So even though socket() wants a struct sockaddr *, you can still use a struct sockaddr_in and cast it at the last minute!Also, notice that sin_family corresponds to sa_family in a struct sockaddr and should be set to AF_INET. Finally, the sin_port and sin_addr must be in Network Byte Order! But, you object, how can the entire structure, struct in_addr sin_addr, be in Network Byte Order? This question re quires careful examination of the structure struct in_addr, one of the worst unions alive: /* Internet address (a structure for historical reasons) */ 5 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html struct in_addr { nsigned long s_addr; }; Well, it used to be a union, but now those days seem to be gone. Good riddance. So if you have declared ina to be of type struct sockaddr_in, then ina. sin_addr. s_addr references the 4 byte IP address (in Network Byte Order). Note that even if your system still uses the God-awful union for struct in_addr, you can still reference the 4 byte IP address in exactly the same way as I did above (this due to #defines. ) Convert the Natives! Weve now been lead right into the next section. Theres been too much talk about this Network to Host Byte Order conversionnow is the time for action!All righty. There are two types that you can convert: short (two bytes) an d long (four bytes). These functions work for the unsigned variations as well. Say you want to convert a short from Host Byte Order to Network Byte Order. Start with h for host, follow it with to, then n for network, and s for short: h-to-n-s, or htons() (read: Host to Network Short). Its almost too easy You can use every combination if n, h, s, and l you want, not counting the really stupid ones. For example, there is NOT a stolh() (Short to Long Host) functionnot at this party, anyway.But there are: htons()Host to Network Short htonl()Host to Network Long ntohs()Network to Host Short ntohl()Network to Host Long Now, you may think youre wising up to this. You might think, What do I do if I have to change byte order on a char? Then you might think, Uh, never mind. You might also think that since your 68000 machine already uses network byte order, you dont have to call htonl() on your IP addresses. You would be right, BUT if you try to port to a machine that has reverse network byt e order, your program will fail. Be portable! This is a Unix world!Remember: put your bytes in Network Order before you put them on the network. A final point: why do sin_addr and sin_port need to be in Network Byte Order in a struct sockaddr_in, but sin_family does not? The answer: sin_addr and sin_port get encapsulated in the packet at the IP and UDP layers, respectively. Thus, they must be in Network Byte Order. However, the sin_family field is only used by the kernel to determine what type of address the structure contains, so it must be in Host Byte Order. Also, since sin_family does not get sent out on the network, it can be in Host Byte Order.IP Addresses and How to Deal With Them Fortunately for you, there are a bunch of functions that allow you to manipulate IP addresses. No need to figure them out by hand and stuff them in a long with the h_addr); bzero(;(their_addr. sin_zero), 8); /* zero the rest of the struct */ if ((numbytes=sendto(sockfd, argv[2], strlen(argv[2]), 0, (struct sockaddr *);their_addr, sizeof(struct sockaddr))) == -1) { perror(sendto); exit(1); } printf(sent %d bytes to %s ,numbytes,inet_ntoa(their_addr. sin_addr)); close(sockfd); return 0; } And thats all there is to it!Run listener on some machine, then run talker on another. Watch them communicate! Fun G-rated excitement for the entire nuclear family! Except for one more tiny detail that Ive mentioned many times in the past: connected datagram sockets. I need to talk about this here, since were in the datagram section of the document. Lets say that talker calls connect() and specifies the listeners address. From that point on, talker may only sent to and receive from the address specified by connect(). For this reason, you dont have to use sendto() and recvfrom(); you can simply use send() and recv().Blocking Blocking. Youve heard about itnow what the hell is it? In a nutshell, block is techie jargon for sleep. You probably noticed that when you run listener, above, it just sits there until a packet arrives. What happened is that it called recvfrom(), there was no data, and so recvfrom() is said to block (that is, sleep there) until some data arrives. Lots of functions block. accept() blocks. All the recv*() functions block. The reason they can do this is because theyre allowed to. When you first create the socket descriptor with socket(), the kernel sets it to blocking.If you dont want a socket to be blocking, you have to make a call to fcntl(): #include #include . . sockfd = socket(AF_INET, SOCK_STREAM, 0); fcntl(sockfd, F_SETFL, O_NONBLOCK); . . By setting a socket to non-blocking, you can effectively poll the socket for information. If you try to read from a non-blocking socket and theres no data there, its not allowed to blockit will return -1 and errno will be set to EWOULDBLOCK. Generally speaking, however, this type of polling is a bad idea. If you put your program in a busy-wait looking for data on the socket, youll suck up CPU time like it was going out of style.A more elegant solution for checking to see if theres data waiting to be read comes in the following secti on on 21 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html select(). select()Synchronous I/O Multiplexing This function is somewhat strange, but its very useful. Take the following situation: you are a server and you want to listen for incoming connections as well as keep reading from the connections you already have. No problem, you say, just an accept() and a couple of recv()s. Not so fast, buster!What if youre blocking on an accept() call? How are you going to recv() data at the same time? Use non-blocking sockets! No way! You dont want to be a CPU hog. What, then? select() gives you the power to monitor several sockets at the same time. Itll tell you which ones are ready for reading, which are ready for writing, and which sockets have raised exceptions, if you really want to know that. Without any further ado, Ill offer the synopsis of select(): #include #include #include int select(int n umfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);The function monitors sets of file descriptors; in particular readfds, writefds, and exceptfds. If you want to see if you can read from standard input and some socket descriptor, sockfd, just add the file descriptors 0 and sockfd to the set readfds. The parameter numfds should be set to the values of the highest file descriptor plus one. In this example, it should be set to sockfd+1, since it is assuredly higher than standard input (0). When select() returns, readfds will be modified to reflect which of the file descriptors you selected is ready for reading. You can test them with the macro FD_ISSET(), below.Before progressing much further, Ill talk about how to manipulate these sets. Each set is of the type fd_set. The following macros operate on this type: FD_ZERO(fd_set *set) clears a file descriptor set FD_SET(int fd, fd_set *set) adds fd to the set FD_CLR(int fd, fd_set *set) removes fd fro m the set FD_ISSET(int fd, fd_set *set) tests to see if fd is in the set Finally, what is this weirded out struct timeval? Well, sometimes you dont want to wait forever for someone to send you some data. Maybe every 96 seconds you want to print Still Going to the terminal even though nothing has happened.This time structure allows you to specify a timeout period. If the time is exceeded and select() still hasnt found any ready file descriptors, itll return so you can continue processing. The struct timeval has the follow fields: struct timeval { int tv_sec; /* seconds */ int tv_usec; /* microseconds */ }; 22 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Just set tv_sec to the number of seconds to wait, and set tv_usec to the number of microseconds to wait. Yes, thats microseconds, not milliseconds.There are 1,000 microseconds in a millisecond, and 1,000 milliseconds in a second. Thus, th ere are 1,000,000 microseconds in a second. Why is it usec? The u is supposed to look like the Greek letter Mu that we use for micro. Also, when the function returns, timeout might be updated to show the time still remaining. This depends on what flavor of Unix youre running. Yay! We have a microsecond resolution timer! Well, dont count on it. Standard Unix timeslice is 100 milliseconds, so youll probably have to wait at least that long, no matter how small you set your struct timeval.Other things of interest: If you set the fields in your struct timeval to 0, select() will timeout immediately, effectively polling all the file descriptors in your sets. If you set the parameter timeout to NULL, it will never timeout, and will wait until the first file descriptor is ready. Finally, if you dont care about waiting for a certain set, you can just set it to NULL in the call to select(). The following code snippet waits 2. 5 seconds for something to appear on standard input: #include #incl ude #include #define STDIN 0 /* file descriptor for standard input */ main() { struct timeval tv; fd_set readfds; tv. v_sec = 2; tv. tv_usec = 500000; FD_ZERO(;readfds); FD_SET(STDIN, ;readfds); /* dont care about writefds and exceptfds: */ select(STDIN+1, ;readfds, NULL, NULL, ;tv); if (FD_ISSET(STDIN, ;readfds)) printf(A key was pressed! ); else printf(Timed out. ); } If youre on a line buffered terminal, the key you hit should be RETURN or it will time out anyway. Now, some of you might think this is a great way to wait for data on a datagram socketand you are right: it might be. Some Unices can use select in this manner, and some cant. You should see what your local man page says on the matter if you want to attempt it.One final note of interest about select(): if you have a socket that is listen()ing, you can check to see if there is a new connection by putting that sockets file descriptor in the readfds set. And that, my friends, is a quick overview of the almighty select() function. More References 23 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Youve come this far, and now youre screaming for more! Where else can you go to learn more about all this stuff? Try the following man pages, for starters: ocket() bind() connect() listen() accept() se nd() recv() sendto() recvfrom() close() shutdown() getpeername() getsockname() gethostbyname() gethostbyaddr() getprotobyname() fcntl() select() perror() Also, look up the following books: Internetworking with TCP/IP, volumes I-III by Douglas E. Comer and David L. Stevens. Published by Prentice Hall. Second edition ISBNs: 0-13-468505-9, 0-13-472242-6, 0-13-474222-2. There is a third edition of this set which covers IPv6 and IP over ATM. Using C on the UNIX System by David A. Curry. Published by OReilly ; Associates, Inc. ISBN 0-937175-23-4.TCP/IP Network Administration by Craig Hunt. Published by OReilly Associates, Inc. ISBN 0-937175-82-X. TCP/IP Illustrated, volumes 1-3 by W. Richard Stevens and Gary R. Wright. Published by Addison Wesley. ISBNs: 0-201-63346-9, 0-201-63354-X, 0-201-63495-3. Unix Network Programming by W. Richard Stevens. Published by Prentice Hall. ISBN 0-13-949876-1. On the web: BSD Sockets: A Quick And Dirty Primer ( cs. umn. edu/~bentlema/unix/has other great Unix system programming info, too! ) Client-Server Computing (http://pandonia. canberra. edu. au/ClientServer/socket. html)Intro to TCP/IP (gopher) 24 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html (gopher://gopher-chem. ucdavis. edu/11/Index/Internet_aw/Intro_the_Internet/intro. to. ip/) Internet Protocol Frequently Asked Questions (France) (http://web. cnam. fr/Network/TCP-IP/) The Unix Socket FAQ ( ibrado. com/sock-faq/) RFCsthe real dirt: RFC-768 The User Datagram Protocol (UDP) (ftp://nic. ddn. mil/rfc/rfc768. txt) RFC-791 The Internet Protocol (IP) (ftp://nic. ddn. mil/rfc/rfc791. txt)RFC-793 The Transmission Control Protocol (TCP) (ftp://nic. ddn. mil/rfc/rfc793. txt) RFC-854 The Telnet Protocol (ftp://nic. ddn. mil/rfc/rfc854. txt) RFC-951 The Bootstrap Protocol (BOOTP) (ftp://nic. ddn. mil/rfc/rfc951. txt) RFC-1350 The Trivial File Transfer Protocol (TFTP) (ftp://nic. ddn. mi l/rfc/rfc1350. txt) Disclaimer and Call for Help Well, thats the lot of it. Hopefully at least some of the information contained within this document has been remotely accurate and I sincerely hope there arent any glaring errors. Well, sure, there always are. So, if there are, thats tough for you.Im sorry if any inaccuracies contained herein have caused you any grief, but you just cant hold me accountable. See, I dont stand behind a single word of this document, legally speaking. This is my warning to you: the whole thing could be a load of crap. But its probably not. After all, Ive spent many many hours messing with this stuff, and implemented several TCP/IP network utilities for Windows (including Telnet) as summer work. Im not the sockets god; Im just some guy. By the way, if anyone has any constructive (or destructive) criticism about this document, please send mail to [emailprotected] csuchico. du and Ill try to make an effort to set the record straight. In case youre wondering why I did this, well, I did it for the money. Hah! No, really, I did it because a lot of people have asked me socket-related questions and when I tell them Ive been thinking about putting together a socket page, they say, cool! Besides, I feel that all this hard-earned knowledge is going to waste if I cant share it with others. WWW just happens to 25 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html be the perfect vehicle.I encourage others to provide similar information whenever possible. Enough of thisback to coding! 😉 Copyright  © 1995, 1996 by Brian Beej Hall. This guide may be reprinted in any medium provided that its content is not altered, it is presented in its entirety, and this copyright notice remains intact. Contact [emailprotected] csuchico. edu for more information. 26 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad r amming; Using Internet Sockets/net. htmlBeejs Guide to Network Programming Using Internet Sockets Version 1. 5. 4 (17-May-1998) [ cst. csuchico. edu/~beej/guide/net] Intro Hey! Socket programming got you down? Is this stuff just a little too difficult to figure out from the man pages? You want to do cool Internet programming, but you dont have time to wade through a gob of structs trying to figure out if you have to call bind() before you connect(), etc. , etc. Well, guess what! Ive already done this nasty business, and Im dying to share the information with everyone! Youve come to the right place. This document should give the average competent C programmer the edge s/he needs to get a grip on this networking noise. AudienceThis document has been written as a tutorial, not a reference. It is probably at its best when read by individuals who are just starting out with socket programming and are looking for a foothold. It is certainly not the complete guide to sockets programming, by any means. Hopefully, though, itll be just enough for those man pages to start making sense 🙂 Platform and Compiler Most of the code contained within this document was compiled on a Linux PC using Gnus gcc compiler. It was also found to compile on HPUX using gcc. Note that every code snippet was not individually tested. Contents: What is a socket?Two Types of Internet Sockets Low level Nonsense and Network Theory structsKnow these, or aliens will destroy the planet! Convert the Natives! IP Addresses and How to Deal With Them socket()Get the File Descriptor! bind()What port am I on? connect()Hey, you! listen()Will somebody please call me? 1 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html accept()Thank you for calling port 3490. send() and recv()Talk to me, baby! sendto() and recvfrom()Talk to me, DGRAM-style close() and shutdown()Get outta my face! etpeername()Who are you? gethostn ame()Who am I? DNSYou say whitehouse. gov, I say 198. 137. 240. 100 Client-Server Background A Simple Stream Server A Simple Stream Client Datagram Sockets Blocking select()Synchronous I/O Multiplexing. Cool! More references Disclaimer and Call for Help What is a socket? You hear talk of sockets all the time, and perhaps you are wondering just what they are exactly. Well, theyre this: a way to speak to other programs using standard Unix file descriptors. What? Okyou may have heard some Unix hacker state, Jeez, everything in Unix is a file! What that person may have been talking about is the fact that when Unix programs do any sort of I/O, they do it by reading or writing to a file descriptor. A file descriptor is simply an integer associated with an open file. But (and heres the catch), that file can be a network connection, a FIFO, a pipe, a terminal, a real on-the-disk file, or just about anything else. Everything in Unix is a file! So when you want to communicate with another pro gram over the Internet youre gonna do it through a file descriptor, youd better believe it. Where do I get this file descriptor for network communication, Mr.Smarty-Pants? is probably the last question on your mind right now, but Im going to answer it anyway: You make a call to the socket() system routine. It returns the socket descriptor, and you communicate through it using the specialized send() and recv() (man send, man recv) socket calls. But, hey! you might be exclaiming right about now. If its a file descriptor, why in the hell cant I just use the normal read() and write() calls to communicate through the socket? The short answer is, You can! The longer answer is, You can, but send() and recv() offer much greater control over your data transmission. What next? How about this: there are all kinds of sockets. There are DARPA Internet addresses (Internet Sockets), path names on a local node (Unix Sockets), CCITT X. 25 addresses (X. 25 Sockets that you can safely ignore), and probably many others depending on which Unix flavor you run. This document deals only with the first: Internet Sockets. Two Types of Internet Sockets 2 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Whats this? There are two types of Internet sockets? Yes. Well, no. Im lying.There are more, but I didnt want to scare you. Im only going to talk about two types here. Except for this sentence, where Im going to tell you that Raw Sockets are also very powerful and you should look them up. All right, already. What are the two types? One is Stream Sockets; the other is Datagram Sockets, which may hereafter be referred to as SOCK_STREAM and SOCK_DGRAM, respectively. Datagram sockets are sometimes called connectionless sockets (though they can be connect()d if you really want. See connect(), below. Stream sockets are reliable two-way connected communication streams.If you output two items into the socket in the order 1, 2, they will arrive in the order 1, 2 at the opposite end. They will also be error free. Any errors you do encounter are figments of your own deranged mind, and are not to be discussed here. What uses stream sockets? Well, you may have heard of the telnet application, yes? It uses stream sockets. All the characters you type need to arrive in the same order you type them, right? Also, WWW browsers use the HTTP protocol which uses stream sockets to get pages. Indeed, if you telnet to a WWW site on port 80, and type GET pagename, itll dump the HTML back at you!How do stream sockets achieve this high level of data transmission quality? They use a protocol called The Transmission Control Protocol, otherwise known as TCP (see RFC-793 for extremely detailed info on TCP. ) TCP makes sure your data arrives sequentially and error-free. You may have heard TCP before as the better half of TCP/IP where IP stands for Internet Protocol (see RFC-791. ) IP deals with Internet routing only. Cool. What about Datagram sockets? Why are they called connectionless? What is the deal, here, anyway? Why are they unreliable?Well, here are some facts: if you send a datagram, it may arrive. It may arrive out of order. If it arrives, the data within the packet will be error-free. Datagram sockets also use IP for routing, but they dont use TCP; they use the User Datagram Protocol, or UDP (see RFC-768. ) Why are they connectionless? Well, basically, its because you dont have to maintain an open connection as you do with stream sockets. You just build a packet, slap an IP header on it with destination information, and send it out. No connection needed. They are generally used for packet-by-packet transfers of information.Sample applications: tftp, bootp, etc. Enough! you may scream. How do these programs even work if datagrams might get lost?! Well, my human friend, each has its own protocol on top of UDP. For example, the tftp protocol says that for each packet that gets sent, the recipient has to send back a packet that says, I got it! (an ACK packet. ) If the sender of the original packet gets no reply in, say, five seconds, hell re-transmit the packet until he finally gets an ACK. This acknowledgment procedure is very important when implementing SOCK_DGRAM applications. Low level Nonsense and Network TheorySince I just mentioned layering of protocols, its time to talk about how networks really work, and to show some examples of how SOCK_DGRAM packets are built. Practically, you can probably skip this section. Its good background, however. 3 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Hey, kids, its time to learn about Data Encapsulation! This is very very important. Its so important that you might just learn about it if you take the networks course here at Chico State ;-).Basically, it says this: a packet is born, the packet is wrapped (encapsul ated) in a header (and maybe footer) by the first protocol (say, the TFTP protocol), then the whole thing (TFTP header included) is encapsulated again by the next protocol (say, UDP), then again by the next (IP), then again by the final protocol on the hardware (physical) layer (say, Ethernet). When another computer receives the packet, the hardware strips the Ethernet header, the kernel strips the IP and UDP headers, the TFTP program strips the TFTP header, and it finally has the data. Now I can finally talk about the infamous Layered Network Model.This Network Model describes a system of network functionality that has many advantages over other models. For instance, you can write sockets programs that are exactly the same without caring how the data is physically transmitted (serial, thin Ethernet, AUI, whatever) because programs on lower levels deal with it for you. The actual network hardware and topology is transparent to the socket programmer. Without any further ado, Ill pres ent the layers of the full-blown model. Remember this for network class exams: Application Presentation Session Transport Network Data Link Physical The Physical Layer is the hardware (serial, Ethernet, etc. . The Application Layer is just about as far from the physical layer as you can imagineits the place where users interact with the network. Now, this model is so general you could probably use it as an automobile repair guide if you really wanted to. A layered model more consistent with Unix might be: Application Layer (telnet, ftp, etc. ) Host-to-Host Transport Layer (TCP, UDP) Internet Layer (IP and routing) Network Access Layer (was Network, Data Link, and Physical) At this point in time, you can probably see how these layers correspond to the encapsulation of the original data.See how much work there is in building a simple packet? Jeez! And you have to type in the packet headers yourself using cat! Just kidding. All you have to do for stream sockets is send() the data out. All you have to do for datagram sockets is encapsulate the packet in the method of your choosing and sendto() it out. The kernel builds the Transport Layer and Internet Layer on for you and the hardware does the Network Access Layer. Ah, modern technology. So ends our brief foray into network theory. Oh yes, I forgot to tell you everything I wanted to say about routing: nothing! Thats right, Im not going to talk about it at all.The router strips the packet to the IP header, consults its routing table, blah blah blah. Check out the IP RFC if you really really care. If you never learn about it, well, youll live. [Encapsulated Protocols Image] 4 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html structs Well, were finally here. Its time to talk about programming. In this section, Ill cover various data types used by the sockets interface, since some of them are a real bitch to figure out. First th e easy one: a socket descriptor.A socket descriptor is the following type: int Just a regular int. Things get weird from here, so just read through and bear with me. Know this: there are two byte orderings: most significant byte (sometimes called an octet) first, or least significant byte first. The former is called Network Byte Order. Some machines store their numbers internally in Network Byte Order, some dont. When I say something has to be in NBO, you have to call a function (such as htons()) to change it from Host Byte Order. If I dont say NBO, then you must leave the value in Host Byte Order. My First Struct(TM)struct sockaddr.This structure holds socket address information for many types of sockets: struct sockaddr { unsigned short sa_family; /* address family, AF_xxx */ char sa_data[14]; /* 14 bytes of protocol address */ }; sa_family can be a variety of things, but itll be AF_INET for everything we do in this document. sa_data contains a destination address and port number for the socket. This is rather unwieldy. To deal with struct sockaddr, programmers created a parallel structure: struct sockaddr_in (in for Internet. ) struct sockaddr_in { short int sin_family; /* Address family */ unsigned short int sin_port; /* Port number */ truct in_addr sin_addr; /* Internet address */ unsigned char sin_zero[8]; /* Same size as struct sockaddr */ }; This structure makes it easy to reference elements of the socket address. Note that sin_zero (which is included to pad the structure to the length of a struct sockaddr) should be set to all zeros with the function bzero() or memset(). Also, and this is the important bit, a pointer to a struct sockaddr_in can be cast to a pointer to a struct sockaddr and vice-versa. So even though socket() wants a struct sockaddr *, you can still use a struct sockaddr_in and cast it at the last minute!Also, notice that sin_family corresponds to sa_family in a struct sockaddr and should be set to AF_INET. Finally, the sin_port and si n_addr must be in Network Byte Order! But, you object, how can the entire structure, struct in_addr sin_addr, be in Network Byte Order? This question requires careful examination of the structure struct in_addr, one of the worst unions alive: /* Internet address (a structure for historical reasons) */ 5 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html struct in_addr { nsigned long s_addr; }; Well, it used to be a union, but now those days seem to be gone. Good riddance. So if you have declared ina to be of type struct sockaddr_in, then ina. sin_addr. s_addr references the 4 byte IP address (in Network Byte Order). Note that even if your system still uses the God-awful union for struct in_addr, you can still reference the 4 byte IP address in exactly the same way as I did above (this due to #defines. ) Convert the Natives! Weve now been lead right into the next section. Theres been too much t alk about this Network to Host Byte Order conversionnow is the time for action!All righty. There are two types that you can convert: short (two bytes) and long (four bytes). These functions work for the unsigned variations as well. Say you want to convert a short from Host Byte Order to Network Byte Order. Start with h for host, follow it with to, then n for network, and s for short: h-to-n-s, or htons() (read: Host to Network Short). Its almost too easy You can use every combination if n, h, s, and l you want, not counting the really stupid ones. For example, there is NOT a stolh() (Short to Long Host) functionnot at this party, anyway.But there are: htons()Host to Network Short htonl()Host to Network Long ntohs()Network to Host Short ntohl()Network to Host Long Now, you may think youre wising up to this. You might think, What do I do if I have to change byte order on a char? Then you might think, Uh, never mind. You might also think that since your 68000 machine already uses net work byte order, you dont have to call htonl() on your IP addresses. You would be right, BUT if you try to port to a machine that has reverse network byte order, your program will fail. Be portable! This is a Unix world!Remember: put your bytes in Network Order before you put them on the network. A final point: why do sin_addr and sin_port need to be in Network Byte Order in a struct sockaddr_in, but sin_family does not? The answer: sin_addr and sin_port get encapsulated in the packet at the IP and UDP layers, respectively. Thus, they must be in Network Byte Order. However, the sin_family field is only used by the kernel to determine what type of address the structure contains, so it must be in Host Byte Order. Also, since sin_family does not get sent out on the network, it can be in Host Byte Order.IP Addresses and How to Deal With Them Fortunately for you, there are a bunch of functions that allow you to manipulate IP addresses. No need to figure them out by hand and stuff them in a long with the h_addr); bzero(;(their_addr. sin_zero), 8); /* zero the rest of the struct */ if ((numbytes=sendto(sockfd, argv[2], strlen(argv[2]), 0, (struct sockaddr *);their_addr, sizeof(struct sockaddr))) == -1) { perror(sendto); exit(1); } printf(sent %d bytes to %s ,numbytes,inet_ntoa(their_addr. sin_addr)); close(sockfd); return 0; } And thats all there is to it!Run listener on some machine, then run talker on another. Watch them communicate! Fun G-rated excitement for the entire nuclear family! Except for one more tiny detail that Ive mentioned many times in the past: connected datagram sockets. I need to talk about this here, since were in the datagram section of the document. Lets say that talker calls connect() and specifies the listeners address. From that point on, talker may only sent to and receive from the address specified by connect(). For this reason, you dont have to use sendto() and recvfrom(); you can simply use send() and recv().Blocking Blocking. Youve heard about itnow what the hell is it? In a nutshell, block is techie jargon for sleep. You probably noticed that when you run listener, above, it just sits there until a packet arrives. What happened is that it called recvfrom(), there was no data, and so recvfrom() is said to block (that is, sleep there) until some data arrives. Lots of functions block. accept() blocks. All the recv*() functions block. The reason they can do this is because theyre allowed to. When you first create the socket descriptor with socket(), the kernel sets it to blocking.If you dont want a socket to be blocking, you have to make a call to fcntl(): #include #include . . sockfd = socket(AF_INET, SOCK_STREAM, 0); fcntl(sockfd, F_SETFL, O_NONBLOCK); . . By setting a socket to non-blocking, you can effectively poll the socket for information. If you try to read from a non-blocking socket and theres no data there, its not allowed to blockit will return -1 and errno will be set to EWOULDBLOCK. Generally speaking, however, this type of polling is a bad idea. If you put your program in a busy-wait looking for data on the socket, youll suck up CPU time like it was going out of style.A more elegant solution for checking to see if theres data waiting to be read comes in the following secti on on 21 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html select(). select()Synchronous I/O Multiplexing This function is somewhat strange, but its very useful. Take the following situation: you are a server and you want to listen for incoming connections as well as keep reading from the connections you already have. No problem, you say, just an accept() and a couple of recv()s. Not so fast, buster!What if youre blocking on an accept() call? How are you going to recv() data at the same time? Use non-blocking sockets! No way! You dont want to be a CPU hog. What, then? select() gives you the power to monitor several sockets at the same time. Itll tell you which ones are ready for reading, which are ready for writing, and which sockets have raised exceptions, if you really want to know that. Without any further ado, Ill offer the synopsis of select(): #include #include #include int select(int n umfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);The function monitors sets of file descriptors; in particular readfds, writefds, and exceptfds. If you want to see if you can read from standard input and some socket descriptor, sockfd, just add the file descriptors 0 and sockfd to the set readfds. The parameter numfds should be set to the values of the highest file descriptor plus one. In this example, it should be set to sockfd+1, since it is assuredly higher than standard input (0). When select() returns, readfds will be modified to reflect which of the file descriptors you selected is ready for reading. You can test them with the macro FD_ISSET(), below.Before progressing much further, Ill talk about how to manipulate these sets. Each set is of the type fd_set. The following macros operate on this type: FD_ZERO(fd_set *set) clears a file descriptor set FD_SET(int fd, fd_set *set) adds fd to the set FD_CLR(int fd, fd_set *set) removes fd fro m the set FD_ISSET(int fd, fd_set *set) tests to see if fd is in the set Finally, what is this weirded out struct timeval? Well, sometimes you dont want to wait forever for someone to send you some data. Maybe every 96 seconds you want to print Still Going to the terminal even though nothing has happened.This time structure allows you to specify a timeout period. If the time is exceeded and select() still hasnt found any ready file descriptors, itll return so you can continue processing. The struct timeval has the follow fields: struct timeval { int tv_sec; /* seconds */ int tv_usec; /* microseconds */ }; 22 of 26 12. 03. 99 01:21 Beejs Guide to Network Programming file:///C|/Eigene Dateien/Manualz/not ad ramming; Using Internet Sockets/net. html Just set tv_sec to the number of seconds to wait, and set tv_usec to the number of microseconds to wait. Yes, thats microseconds, not milliseconds.There are 1,000 microseconds in a millisecond, and 1,000 milliseconds in a second. Thus, th ere are 1,000,000 microseconds in a second. Why is it usec? The u is supposed to look like the Greek letter Mu that we use for micro. Also, when the function returns, timeout might be updated to show the time still remaining. This depends on what flavor of Unix youre running. Yay! We have a microsecond resolution timer! Well, dont count on it. Standard Unix timeslice is 100 milliseconds, so youll probably have to wait at least that long, no matter how small you set your struct timeval.Other things of interest: If you set the fields in your struct timeval to 0, select() will timeout immediately, effectively polling all the file descriptors in your sets. If you set the parameter timeout to NULL, it will never timeout, and will wait until the first file descriptor is ready. Finally, if you dont care about waiting for a certain set, you can just set it to NULL in the call to select(). The following code snippet waits 2. 5 seconds for something to appear on standard input: #include #incl ude #include #define STDIN 0 /* file descriptor for standard input */ main() { struct timeval tv; fd_set readfds; tv. v_sec = 2; tv. tv_usec = 500000; FD_ZERO(;readfds); FD_SET(STDIN, ;readfds); /* dont care about writefds and exceptfds: */ select(STDIN+1, ;readfds, NULL, NULL, ;tv); if (FD_ISSET(STDIN, ;readfds)) printf(A key was pressed! ); else printf(Timed out. ); } If youre on a line buffered terminal, the key you hit should be RETURN or it will time out anyway. Now, some of you might think this is a great way to wait for data on a datagram socketand you are right: it might be. Some Unices can use select in this manner, and some cant. You should see what your local man page says on the matter if you want to attempt it.One final note of interest about select(): if you have a socket that is listen()ing, you can check to see if there is a new connection by putting that sockets file descriptor in the readfds set. And that, my friends, is a quick overview of the almighty select() function.

Friday, November 22, 2019

North Korea Essay Example | Topics and Well Written Essays - 1750 words

North Korea - Essay Example Either way, the result is likely designed to benefit fulfill the interests of the nation in the economic or military front. Liberalism on the other hand can be loosely defined as individual freedom; an ideology stems from the belief that humans inherently are good-natured. Its core values stress on individualism, human rights the right to equal treatment and universal protection of the law without discrimination. From this definition, it is easy to understand why the theory will be hard to inculcate into the Korean, more so, North Korean situation. Firstly, the country is a dictatorship and by virtue of that fact, it means that the ideas of freedom in the convectional democratic sense are not manifested in the governance style. In addition, the leaders have displayed extreme aggressiveness and a determination to go against nearly all the tenets of liberalism both on a local and international scale. North Korea recently threatened to launch a nuclear offensive at the United States of America South Korea and Japan after the US commenced military drills in South Korea (Jack and Louis, 2013). The drills in South were declared an act of war and consequently the North scrapped the armistice treaty that had ended the war between the two nations in the 50s (Park, 2013). It has threatened to strike in the heart of America, which it deem to be about to conduct a nuclear strike as well, that is being used to justify North Koreas irrational action. This begs the question; why is there so much friction between America and North Korea, from a realistic perspective, North Korea likely sees America as a potential threat to its sovereignty and continued independence and freedom. This is evidenced in the fact that whenever the leaders discuss their neighbors South Korea, they use the expression a puppet for the Americans. To the leaders up North, there is no difference between being â€Å"colonized† and co-operating with the American government, in this respect their aggr essiveness towards America can be viewed in terms of their wish to protect their self-interest. Herein emerges the key difference between a realist and liberal understanding of the issue, a liberal mind would assume that peace and cooperation are acceptable if it benefits ones country. Considering the current state of the North Koreas economy, it is beyond any doubt that they stand to gain a lot from co-operating with the international community, that way they can be able to trade freely without the burden of sanctions. The security of America has been continuously threatened by the North Korean, as such (Suri, 2013) their heavy presence in South Korea and is strategic in order to ensure it protects itself and its allies. These moves are interpreted by the Northern side as being potential for war and thus each side in their attempt to safeguard their interests in an environment of mutual distrust fuel the ensuing conflict. It has also been postulated that Koreas aggressiveness is a means of blackmailing the world into sympathizing and giving them the aid they so badly need especially in view of the severe sanctions imposed by the international community. According to Lankov, the North’s main reason for its belligerent statements is not an intention for war but a means of reminding the world that it exists (Lankov, 2013). They will only be able to blackmail believably

Wednesday, November 20, 2019

Portfolio Project Part 6 Assignment Example | Topics and Well Written Essays - 1000 words

Portfolio Project Part 6 - Assignment Example In order to measure the performance of an accountant, it is significant to use the critical incident and BARS methods. A combination of these methods would sufficiently measure the performance of an accountant in the company. A performance management should be able to give employees unbiased, constructive feedback on their performance. In order to ensure success of performance management of an accountant, reviews and measurement of the worker are normally done annually. Measure of improved performance The following combined methods will be used to measure the performance of an accountant i. Critical Incidents ii. Work Standards iii. Straight or Simple Ranking iv. Paired Comparisons v. Rater distribution Using the straight or simple ranking, the accountant will ranked according to overall performance. He or she will be compared with other employees. In addition, all comparison will be based on single criterion, such as overall performance. This is effective because it Compares perform ance of each employee with every other employee in the group. Using the forced distribution method, I will be able to understand how the accountant has performed. This is because the rater assigns individual in work group to a limited number of categories similar to a normal distribution. Further, it assumes all groups of employees have the same distribution (Mondy & Mondy 2010). In rating work quantity of the accountant, i will give careful consideration things such as effect of employee on the general flow of work, amount of work produced in terms of the specific job especially annually, employee’s application to the job, and skill in handling specific assignments of the company. I will award the score as follows: poor, 1 to 6 points; average, 7 to 18 points; good, 19 to 25 points. In turn, I will be able to understand if the accountant has improved performance or not (Smith & Mazin, 2004). BARS and performance evaluation The Critical Incident Method is a form of performanc e appraisal method that requires an individual to keep records and all relevant information of both good and bad employee work behaviors. In case a critical incident influences the company’s ability to operate either negatively or positively, the manager records the information. The BARS method is very effective in portfolio management of workers since it is easy to monitor the actions or behaviors of the worker while at work (Mondy & Mondy, 2010). For instance, when an employee misuse the company resources for personal use, it is easy to report the case to the manager. When it comes to accounting, this method is applicable in the sense that when an accountant makes valuations and evaluation of the company’s expenses and profits for a week, month, or a year, it is easy to monitor the trend of their actions. If the accountant kept the records in a timely way, the management can easily detect problems in their financial system and come up with ways to improve its financi al control systems. The BARS especially the critical incident method can also be applied as a means of job analysis in the sense that it helps analysts to determine actions that are focused on work and other work activities. It helps in making an entire analysis of work and permit transparent performance leading actions to be targeted (Smith & Mazin, 2004). In evaluating performance of a worker, it is vital to have job description and specification. This is because Job descriptions offer precise and a concise