Categories
Bangla Python Series

বাংলায় জ্যাঙ্গো – ইনস্টলেশন

কি কি লাগবে?

  • পাইথন (আমরা Python 2.7.4 ব্যবহার করছি, Python 3 ব্যবহার করবো না)
  • টেক্সট এডিটর বা আইডিই (আমি Sublime Text 2 রিকমেন্ড করি)
  • ডাটাবেইজ সার্ভার (MySQL হলেই চলবে)
  • pip (পাইথন প্যাকেজ ইন্সটল করার জন্য এটি লাগবে । ইনস্টলেশন গাইড )

প্রথম ধাপ – জ্যাঙ্গো ইনস্টল করা

এই কমান্ডটি জ্যাঙ্গো ফ্রেমওয়ার্ক এবং তার প্রয়োজনীয় টুলগুলো ইনস্টল করে নিবে ।

দ্বিতীয় ধাপ – মাইসিকুয়েল বাইন্ডিং ইনস্টল করা

যেহেতু আমরা জ্যাঙ্গোর সাথে মাইসিকুয়েল ব্যবহার করবো সেহেতু আমাদের পাইথনের জন্য মাইসিকুয়েল লাইব্রেরী ইনস্টল করে নিতে হবে ।

এই প্যাকেজটি সি থেকে কম্পাইল করা হয় তাই ইন্সটল করার জন্য বেশ কিছু ডিপেন্ডেন্সীর প্রয়োজন পড়ে (যেমন: পাইথন এবং মাইসিকুয়েলের সি হেডার) । আপনার সিস্টেমে যদি সব গুলো ডিপেন্ডেন্সী না থাকে তবে ইরর মেসেজ দেখে দেখে সেগুলো ইনস্টল করে নিতে হবে ।

যারা ডেবিয়ান বা উবুন্টুতে আছেন, তাদের জন্য অবশ্য ইনস্টলেশন বেশ সহজ –

এই এক কমান্ডেই প্যাকেজ ম্যানেজার যা যা লাগবে সব ইনস্টল করে তারপর মাইসিকুয়েল বাইন্ডিং ইনস্টল করে দিবে ।

জ্যাঙ্গোর ভার্সন মিলিয়ে দেখা

আমরা ভার্সন 1.5 ব্যবহার করবো এই বইতে । তাই আসুন, জ্যাঙ্গোর ভার্সন দেখে নেই –

এই কমান্ডটি রান করালে আমরা জ্যাঙ্গোর ভার্সনটি জানতে পারবো । যদি আউটপুট আসে 1.5.* ফর্ম্যাটে তাহলে আমরা সঠিক ভার্সনই ইনস্টল করেছি ।

Categories
Uncategorized

Book Review: Instant Sublime Text Starter

Disclaimer: I received a copy of the book for review purposes.


The book Instant Sublime Text Starter is another nice title from Packtpub. The book gets an user started with the Sublime Text editor with very simple instructions. The book starts with installation and covers all major platforms. Having used the various operating systems over the year, I’ve found the instructions more than adequate for Windows, Linux and Mac OSX users.

The book highlights the common features of Sublime Text and provides a decent walk through. It also provides guidelines on where to go next to master the text editor. The book, as a starter is a very good one. If you’re into building software, Sublime Text could be a useful tool. And this book would certainly help you start instantly.

Categories
PHP

Behat and Mink: Finding and clicking with XPATH and jQuery like CSS Selector

While doing acceptance tests, we often run into scenarios where we need to click on elements which can’t be found or clicked on using simple expressions like – I follow “Login”. Let me give an example, on a page there is an anchor tag with specific id. The anchor tag has no text but an image inside it. In such cases, we are left no other choices than querying the dom. XPath could be a decent way to find the anchor tag here. Let’s assume that the anchor tag has the id – 14. So the xpath query should be – “//a[@id=’14’]”.

PS: We can use Firebug to test out XPath queries. There is a built in function – $x – on a firebug console, just pass xpath queries as string to this function and it will throw matching elements.

Here’s a step definition I wrote inside my FeaturedContext class. This method takes in a xpath query and clicks on the element:

And how do we use it inside a “feature” file?

UPDATE:

Using a jQuery like CSS Selector is pretty easy. Looks like Mink also allows CSS Selectors by default. Here’s the same method with CSS Selector:

And we use it in the feature file like:

The test should fail in case a matching element was not found. Let me know if you run into any issues or find even better or elegant ways to do this.