http___blog.petkanski.com_2011_04_mysqlrealescapestring.html_1.xml
http___inspirevolunteer.co.uk_cultural-differences-volunteering-tanzania_.xml
1.1 2.1 2.2 2.3 3.1 4.1 4.2 5.1 5.2 5.3 6.1 7.1 8.1 9.1 9.2 10.1 11.1 12.1 12.2
По темата.. Днес ми се наложи да сравнявам предимства и недостатъци на няколко framework-чета. При едното от тях липсваше вграден database model, така че се наложи да ползвам нещо отделно. В конкретният случай се спрях на PDO и реших да си напиша няколко базови класчета.. За да съкратя историята, направо ще ви синтезирам това което Ви е нужно да знаете ;) При МySQL имате два вида сравнение на низ от символи (string) - това са равенство и сравнение с pattern, посредством LIKE или регулярен израз. В моят случай използвам LIKE, защото е най-бърз за имплементация и защото отговаря на нуждите ми и няма смисъл от overengineering. Случаят е простичък - имам данни в базата, имам и търсачка която търси с LIKE. Това което ме изненада, беше, че mysql_real_escape_string() допусна символи в низа които са със специално значение, а именно - символите за процент (%) и долно тире (_). В най-общият случай - при вмъкване на данни или сравнение със равенство това не ви бърка, но когато ползвате LIKE нещата стоят по малко по-различен начин. Получи се ситуация, при която аз търся в базата данни къде е споменато "100%", но тъй като символът за процент не се escape-ва, се получава, че търся низ който съдържа 100. SELECT * FROM SomeTable WHERE `textField` LIKE '%100%%' Очевидно, това не е поведението което би се очаквало, след като имаш илюзията, че данните са ти escape-нати правилно. След като разбрах какъв е проблема си помислих, че може би е проблем на mysql_real_escape_string() и веднага си отворих http://www.php.net/mysql_real_escape_string - но се оказа, че това е очаквано поведение. В документацията на функцията ясно са писали, че тя "prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a". Ето го точният цитат от сайта: Може би символите за wildcard попадат точно в тези изключения които са споменали.mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.This function must always (with few exceptions) be used to make data safe before sending a query to MySQL. Изводът е простичък - винаги минавайте един профилактичен str_ireplace() или preg_replace() на данните които използвате при генериране на заявка за търсене в базата данни за да няма изненади. Нека това, че ползвате prepared statements не ви дава чувство за сигурност.
1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 8.2 9.1 10.1 11.1 12.1 13.1 14.1 15.1 16.1 17.1 18.1 19.1 19.2 20.1 21.1 22.1 23.1 24.1 25.1 25.2 26.1 27.1 28.1 29.1 29.2 30.1 31.1 32.1 33.1 34.1 35.1 36.1 37.1 38.1 39.1 40.1 41.1 41.2 42.1 43.1 44.1 45.1 46.1 47.1 48.1 49.1 49.2 50.1 51.1 52.1 53.1 54.1 55.1 56.1 57.1 58.1 59.1 60.1 61.1 62.1 63.1 64.1 65.1 65.2 66.1 67.1 68.1 69.1 69.2 70.1 71.1 72.1 73.1 74.1 75.1 76.1 77.1 77.2
Cultural Differences to Expect When Volunteering in Tanzania Warning: mysql_real_escape_string(): No such file or directory in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3244 Warning: mysql_real_escape_string(): A link to the server could not be established in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3244 Warning: mysql_real_escape_string(): No such file or directory in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3244 Warning: mysql_real_escape_string(): A link to the server could not be established in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3244 Warning: mysql_real_escape_string(): No such file or directory in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3309 Warning: mysql_real_escape_string(): A link to the server could not be established in /var/sites/i/inspirevolunteer.co.uk/public_html/wp-content/themes/nouveau/includes/shortcodes/shortcodes.php on line 3309 Volunteering in another country is an incredibly rich experience for many reasons. One of the most transformative ones, is the opportunity to get to know a new culture. Not only will you experience new ways of interacting with people and building relationships, but you might also be surprised at the reflections you’ll have about your own culture. Let’s take a look at some of the cultural differences you might experience while volunteering in Tanzania. Swahili as a Main Language Although English is used and taught extensively throughout Tanzania, Swahili is the other main important language. Especially in more rural areas, it’s likely that you will encounter people who do not speak English. Before leaving, it’s a good idea to at least learn a handful of key phrases, in order to be polite and gracious. You’ll be amazed at how far you can get with some basics like “hello”, “thank you”, and “sorry”! If you’re feeling even more ambitious, consider learning further vocabulary, grammar and numbers, in order to be able to ask directions or haggle in local markets. Diversity of Ethnicities, Religions, and Cultures While you may be exposed to diversity in your home city, diversity in Tanzania takes a whole different form. The official borders of todays African countries were originally implemented during the colonial period. These borders were decided upon without regard for the existing territories of the indigenous people. Hence, there are over 120 native ethnic groups throughout the country. They are all united by being Tanzanian. They all have distinct cultures and, in many cases, distinct languages. The country’s relgious faiths are similarly diverse being made up by Christians, Muslims, and communities with traditional indigenous beliefs. The different religions are concentrated to some degree in different areas of the country. Many inland areas and larger cities tend to be home to many Christians. While the coast is known to have a large Muslim population. Conception of Personal Space Believe it or not, our preferences for the “right” amount of personal space is purely a cultural conception! You may be surprised to find that the common understanding, in Tanzania, of the right amount personal space is much smaller than what you’re accustomed to. This might not be a cultural phenomenon you’ve ever pondered before. But, you’re nearly guaranteed to notice it the first time you find yourself in a crowded public place in Tanzania, like a bus or a market. You might notice that you keep getting bumped into, or that people tend to be very close to you. No one seems to even feel bad or apologize! Welcome to Cultural Differences 101: those people are not actually trying to be rude to you, they just don’t have the same expectation for personal space. The same goes for when you feel like the person you’re talking to is standing ‘uncomfortably’ close to you. They’re not actually trying to make you uncomfortable; that’s just how they hold conversations. In fact, maintaining a large space between you and the person you’re interacting with might actually make them feel unwelcome, or display a lack of interest or respect. Food and Hospitality Tanzanians are very hospitable people. Being invited into someone’s house is considered an honor — they will treat it as such, and you should too! They will almost certainly offer you something to eat and/or drink. You may be tempted to insist that you don’t want anything, especially if they offer you something you don’t like or you sincerely don’t want to trouble them. However, as your gracious host, they are “required” to offer you something. So, you should graciously accept at least a cup of tea or a small bit of what they’re offering you! It’s not just about you being hungry or thirsty — it’s about honoring a guest and respecting your host. Expectations on How to Dress In Tanzania, the way you dress is not simply an expression of personal style but rather a sign of respect for the people around you. Take care to avoid wearing clothes that are too revealing or casual, that are dirty, or that have holes. This could actually be taken as a sign of disrespect, or that you aren’t taking the people around you seriously. Of course this doesn’t mean you have to wear your finest suit every day, but rather you should make sure to dress in a clean, conservative, respectful way. Keep in mind that clothing expectations may vary greatly by area, so take some time to do your research or talk to your programme coordinator. You may be expected to cover up your arms and legs in the coastal areas of Tanzania where Muslim influence is stronger. This might be particularly important for Tanzania. Social Hierarchy and Respect Tanzania has a very hierarchical society with strictly defined roles among different ages, social status, professional level, and other indicators. People are expected to greet each other in specific ways, according to their status. Children are expected to greet elderly people with respect and deference. To start understanding this hierarchy: - Pay close attention to how your local peers treat each other - How people in senior positions at work are treated - How the community interact wit the elderly, children, friends, men and women Become the observer of your environment This will help you adapt to your new community and start building strong relationships. Tanzanian Time The infamous Tanzanian concept of time has been the source of confusion for many a foreigner. You’re sure to experience it during your stay there! What you consider a “hard deadline” or specific agreed meeting time might be simply an approximate suggestion to your Tanzanian counterpart. Try not to get frustrated that no one seems to care about what you consider important deadlines. Tanzanian culture is primarily relationship-driven. People take priority over time and things, and your concept of “punctuality” might not fit in! Be flexible with your expectations of time! For Tanzanians, getting to know someone or spending time with them is always more important, so do as the Tanzanians do and relax into friendships. Preferences for the Right and Left Hands This concept might be the most foreign one of all to you. Once you start interacting with the people in your new community, you’ll soon become accustomed to it. In Tanzania, each hand is reserved for different uses. The right hand is considered “clean”, and is used for all eating, gift giving, handshakes, and other activities of primary significance. On the contrary, the left hand is considered “unclean”, and is reserved for hygiene or as a secondary support for the right hand when necessary. You might have found some of these differences surprising. Keep in mind that learning about a completely different way of life will be one of the richest parts of your volunteering experience. Before you know it, you’ll be haggling in Swahili, eating with your right hand, and bumping into other people at the market with the best of them! What to Know More? If a Tanzanian volunteer adventure sounds like it’s right up your alley, feel free to check out our programmes in Tanzania, send us an enquiry, or just give us a call at +44 1635 285666. We’d be happy to tell you more.