Simple way to split a string in C++

รูปภาพของ hiddenmin

สำหรับคนที่เคยใช้ python ก็คงจะคุ้นเคยกับคำสั่ง split() ที่เอาไว้แยกแต่ละคำในตัวแปรแบบ string แต่ใน C++ ดันไม่มีคำสั่ง (ง่ายๆ) แบบนั้น

หลังจากใช้เวลาค้นหาไปพักใหญ่ๆ ก็ได้โค้ดแบบนี้

#include <iostream>
#include <sstream>

using namespace std;

int main(){
    string rawStr;
    getline(cin, rawStr);
    stringstream ss(rawStr);
    string buff;
    while(ss >> buff){
        cout << buff << endl; // this 's what i want
    }

    return 0;
}

Tags: 

command not found on Debian

รูปภาพของ hiddenmin

เคยมั้ยเวลาพิมพ์คำสั่งตาม how to ต่างๆ แล้วมันขึ้นมาว่า

xyz: command not found

ทำไงดี แล้วโปรแกรม xyz นั่นจะหาได้จากไหน...
มาวันนี้ Debian (ตั้งแต่รุ่น squeeze) เป็นมีทางออกแล้วด้วย package ที่มีชื่อ command-not-found วิธีติดตั้งก็แสนจะง่ายตามฉบับ Debian ด้วยคำสั่ง

apt-get install command-not-found

หลังจากติดตั้งเรียบร้อยแล้วก็สั่งอัพเดททีนึง (ต้องต่อเน็ตด้วยนะ)

update-command-not-found

โปรแกรมนี้นอกจากจะช่วยแนะนำ package ที่มีโปรแกรม xyz แล้วในกรณีที่เราพิมพ์คำสั่งผิดก็ยังสามารถคาดเดาคำสั่งที่น่าจะถูกพร้อมแนะนำ package ด้วย

ใช่สิ่งที่ผู้ใช้ต้องการจริงหรือ?

รูปภาพของ hiddenmin

Bismillahir Rahmanir Rahim

ลองมาทำตามรายการนี้ดู อินชาอัลลอฮฺ แล้วเราจะได้ในสิ่งผู้ใช้ต้องการ

  1. Don't assume you know what the customer wants, ask. (จงถาม อย่าคิดเองว่าคุณรู้ว่าลูกค้าต้องการอะไร)

  2. Involve the users from the start. (มีส่วนร่วมกับผู้ใช้ตั้งแต่เริ่มต้น)

  3. Define and agree the scope of the project. (กำหนดและตกลงขอบเขตของโปรเจค)

  4. Ensure requirements are specific, realistic and measurable. (ดูให้แน่ใจว่า requirements นั้น เจาะจง ทำได้จริง และวัดค่าได้)

  5. Obtain clarity if there is any doubt. (หาความชัดเจนถ้ายังมีข้อสงสัย)

  6. Create a clear, concise and thorough requirements document and share it with the customer. (ทำเอกสาร requirements ให้ละเอียด กระชับ ชัดเจนและส่งให้ลูกค้า)

  7. Confirm your understanding of the requirements with the customer (play them back). (ยืนยันความเข้าใจของคุณใน requirements กับลูกค้า)

  8. Avoid talking technology or solutions until the requirements are fully understood. (หลีกเลี่ยงการพูดเกี่ยวกับเทคโนโลยีหรือโซลูชั่นจนกว่าจะเข้าใจ requirements อย่างเต็มที่)

  9. Get the requirements agreed with the stakeholders before the project starts. (อย่าลืมว่า stakeholders ต้องยอมรับ requirements ก่อนที่คุณจะเริ่มงาน)

  10. Create a prototype if necessary to confirm or refine the customers' requirements. (ถ้าจำเป็นก็ให้สร้างแบบจำลองก่อนเพื่อยืนหรือปรับ requirements)

  11. Use a recognised notation, such as UML, for modeling the software. (ใช้เครื่องหมายเช่น UML สำหรับการจำลองซอฟต์แวร์)

  12. Cross check the software design against the requirements and review regularly. (ตรวจสอบการออกแบบซอฟต์แวร์จาก requirements และทบทวนเป็นประจำ)

ที่มา: projectsmart.com

اﻟﻤﻗﺩﻤﻪ-The Introduction

รูปภาพของ webmaster
بسم الله الرحمن الرحيم إِنَّ الحَمْدَ للهِ نَحْمَدُهُ وَنَسْتَعِيْنُهُ وَنَسْتَغْفِرُهُ وَنَتُوْبُ إِلَيْهِ، وَنَعُوْذُ بِاللهِ مِنْ شُرُوْرِ أَنْفُسِنَا وَمِنْ سَيِّئاَتِ أَعْمَالِنَا ، مَنْ يَهْدِهِ اللهُ فَلا مُضِلَّ لَهُ ، وَمَنْ يُضْلِلْ فَلا هَادِيَ لَهُ ، وَأَشْهَدُ أَنْ لاَ إِلٰهَ إِلاَّ اللهُ وَحْدَهُ لاَ شَرِيْكَ لَهُ ، وَأَشْهَدُ أَنَّ مُحَمَّدًا عَبْدُهُ وَرَسُوْلُهُ ، اَللّٰهُمَّ صَلِّ وَسَلِّمْ وَبَارِكْ عَلٰى نَبِيِّنَا مُحَمَّدٍ وَعَلٰى آلِهِ وَصَحْبِهِ أَجْمَعِيْنَ . السلام عليكم ورحمة الله وبركاته รายงานจากท่านอบูฮูร็อยเราะฮฺ (ร.ฎ.) ท่านรอซูลลุลลอฮฺ (ซ.ล.) กล่าวว่า "เมื่อมนุษย์ได้สิ้นชีวิตลง การงานของเขาก็ขาดตอน เว้นแต่ 3 สิ่ง (ได้แก่) ซอดาเกาะฮฺญารียะฮฺ, ความรู้ที่ยังประโยชน์, หรือลูกที่ซอเเละฮฺขอดุอาอฺให้เขา" รายงานโดยอิมามอะห์มัด (8489) ยังไม่ถึงเวลาหรือที่เราจะเผยแผ่ความรู้ที่มีประโยชน์ของเราให้มนุษย์โลกได้รับทราบ!

หน้า

Subscribe to Ikhlas Studio ตั้งค่า RSS