Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop
    1. Home
    2. sudo
    S
    • Profile
    • Following 0
    • Followers 3
    • Topics 5
    • Posts 20
    • Best 10
    • Controversial 0
    • Groups 4

    sudo

    @sudo

    FOSS

    35
    Reputation
    310
    Profile views
    20
    Posts
    3
    Followers
    0
    Following
    Joined Last Online

    sudo Unfollow Follow
    FOSS Node.js Web Development Linux Help

    Best posts made by sudo

    • Node.js : Introduction - Part 1


      alt text

      Node.js කියන්නේ මොකක්ද?
      Node.js කියන්නේ javascript වලට web browser එකෙන් එලියේ වැඩ කරන්න ඉඩ දෙන run time environment එකක්. සරලවම කියනවනම් මේකෙන් වෙන්නේ සාමාන්‍ය programming language එකක් වගේ වැඩ කරන්න javascript ට ඉඩ හදල දෙන එක.

      Node වල පාවිච්චි වෙන්නේ chromium project එකෙන් එන V8 javascript engine එක. Google chrome ඇතුලෙත් පාවිච්චි වෙන්නේ මේකම තමයි.

      ඇයි මේක ගොඩක් ජනප්‍රිය?
      Node ගොඩක් ජනප්‍රිය වෙලා තියෙන්නේ ගොඩක්ම මේක පාවිච්චියේ තියෙන පහසුව නිසා. තව Technical හේතුත් තියෙනවා (event driven, non-blocking, asynchronous.. bla bla bla) ඒවා ගැන ඉස්සරහට කතා කරමු.

      පහසුව කියලා මම කියන්නේ front end සහ back end එකේ එකම language එකක් භාවිතයේ පහසුව. ඒවගේම මේකත් එක්ක පාවිච්චි කරන්න පුලුවන් libraries එහෙමත් නැත්තම් දැනටමත් programmers ලා ලියලා තියෙන code ප්‍රමාණය ඉතාමත් වැඩි වීම.

      ඒවගේම electron වගේ framework නිසා node පාවිච්චි කරලා desktop application ලිවීමේ හැකියාවත් ලැබිලා තියෙනවා.

      සාමාන්‍ය javascript මද මේකෙ පාවිච්චි වෙන්නේ?
      ඔව්. ඒත් සාමාන්‍ය javascript වලදී අපි කරන්නෙ dom එක සම්බන්ද වෙනස්කම් නේ. ඒත් node වලදී අපිට dom එකක් නෑ. ඒ වෙනුවට file system එක, os එක එක්ක අපිට වැඩ කරන්න පුලුවන්.

      කොහොමද ඉගෙන ගන්න පටන් ගන්නෙ?
      www.nodejs.org වලට ගිහින් තමන්ගේ platform එකට අදාලව nodejs download කරගෙන install කරගන්න. තව instruction official page එකේ තියෙනවා.

      Debian/Ubuntu/Ubuntu flavors වල නම්

      sudo apt install nodejs npm
      

      Arch නම්

      sudo pacman -S nodejs npm
      

      හරහා ඔයාලට ලෙසීයෙන් nodejs + npm install කරගන්න පුලුවන්.

      කොහොමද පාවිච්චි කරන්නෙ? (Hello World example)

      • අලුතෙන් directory එකක් හදන්න.

      • ඒකේ helloworld.js කියලා file එකක් හදන්න.

      • ඒක ඇතුලේ සාමාන්‍ය විදියටම,

      console.log("Hello World");
      

      කියලා type කරලා save කරන්න.

      • දැන් අදාල directory එකට ඔයාගේ command line shell එකෙන් යන්න (CMD/Terminal).

      • දැන් node helloworld.js කියලා run කරන්න.

      ඔයාට hello world කියලා print වෙනවා බලාගන්න පුලුවන්. ඕක තමයි හැම programming language එකේම වගේ තියෙන hello world example එක.

      posted in Back-End Development
      S
      sudo
    • Node.js : Introduction - Part 2

      alt text

      Node.js is a javascript runtime built on Chrome's V8 javascript engine. Node.js uses an even-driven, non blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm is the largest ecosystem of open source libraries in the world.

      ඔය උඩ තියෙන්නේ Node.js වලට දීලා තියෙන අර්ථකතනය. මේකේදි මම පැහැදිලි කරන්න බලාපොරොත්තු වෙන්නේ මොකක්ද මේ කියන්නේ කියලා.

      Node.js is a javascript runtime built on Chrome's V8 javascript engine.
      කලින් කොටසේ මම කිව්වා node කියන්නේ javascript browser එකෙන් එලියේ වැඩ කරන්න පුලුවන් වෙන run-time environment එකක් කියලා. මේකේදි දැනගන්න ඕනේ වැදගත්ම දේ තමයි මේකේ පාවිච්චි වෙන්නේ සාමාන්‍ය javascript ම තමයි කියන එක. V8 කියන්නේ chromium project එක යටතේ හදපු open source javascript engine එකක්.

      මොකක්ද මේ event driven, non blocking i/o?

      alt text

      Node.js වල තියෙන්නේ එක thread එකයි. ඒ කියන්නේ අපේ මුලු application එකම දුවන්නේ එක thread එකක් ඇතුලේ.

      I/O කියන්නේ input/output කියන එකට. මොකක් හරි file එකක් කිරීම, database එකකට record දැමීම, ගැනීම වගේ දේවල් අයිති වෙන්නේ මේකට. non-blocking කියන්නේ සරලවම එක දෙයක් කරලා ඉවර වෙනකම් බලන් ඉන්න ඕන නෑ කියන එක. පහල උදාහරණය බලන්න.

      database එකකින් record එකක් ගන්න request එකක් ආවා කියලා හිතන්න. ඒ වෙලාවෙම file එකක් read කරන්න request එකක් එනවා. database එකට අපි අවශ්‍ය data ඉල්ලලා request එකක් යවලා ඒ data නැවත එනකම් බලන් ඉන්නේ නැතුව ඊලග වැඩේ පටන් ගන්නවා. ඒ කියන්නේ file එක read කරන එක. කොයි වෙලාවකට හරි අර database එකෙන් data එව්වට පස්සේ අදාල request එකට ඒ data යවනවා.

      මේකෙදි node.js වල තියෙන event loop කියන එක භාවිතා වෙනවා. සරලවම කිව්වොත් node.js listener කෙනෙක් attach කරනවා කිසියම් event එකකට උඩ උදාහරණෙනම් database එකෙන් data එනකම්. කොයිම වෙලාවක හරි data ආවම ඒ event එකට අදාල callback එක් run වෙනවා.

      function getUserName(id, callback) {
         //get userData from database, then run callback
         callback(userData.name);
      }
      
      getUserName(12, function(name) {
           console.log(name);
      });
      console.log("Hello");
      

      උඩ තියෙන්නේ සම්පූර්ණ නොකල code එකක්. මේකෙදි ඔයාලට පේනවා ඇති අපි getUserName function එකට call කරනකොට ඒක ඇතුලට තවත් function එකක් pass කරලා තියෙනවා. මේක තමයි callback එක. කොයිම වෙලාවක හරි database එකෙන් අදාල data ලැබුනාම මේක වෙනවා.

      හැබැයි ඒකට පහලින් තියෙන console.log කියන statement එක ඒක වෙනකම් බලන් ඉන්නේ නැ. එතකොට ඕකෙ output එකේදි මුලින්ම hello කියලත් ඊට පස්සේ අදාල නමත් බලා ගන්න පුලුවන්.

      මේකෙදි තේරුම් ගන්න ඕනෙ දේ තමයි non blocking වලින් අපේ i/o වල වේගය වැඩි කරන්නේ නැ කියන එක. මේකෙ වාසිය එක පාර දේවල් එකකට වඩා කරන්න පටන් ගන්න අපිට ඉඩ සලසන එක.

      දැන් මේක තමයි සරලවම event driven, non-blocking i/o කියන එක. මේ නිසා සාමාන්‍ය වේගයට වඩා 50% විතර වේගයෙන් අපේ application run වෙනවා. (අවස්තාව අනුව).

      මොකක්ද මේ npm?
      මේක javascript වලින් ලියපු codes වල එකතුවක්. ඒ කියන්නේ node හදපු කාලෙ ඉදලා ආපු ප්‍රශ්න වල එක එක developer ලියපු codes. මේකෙ node app එකක් ලියද්දී එන ප්‍රශ්ණ වලින් 95% වගේ විසදන්න පුලුවන් library (සරලවම ලියපු codes වල එකතුවක්) හොයාගන්න පුලුවන්.

      මෙන්න මේවා තමයි මම හිතන විදියට node වලදී දැනගන්න ඕන මූලිකම දේවල්. වෙනස්වීම් වෙන්න තියෙනම් කමෙන්ට් කරන්න.

      posted in Back-End Development
      S
      sudo
    • ඇයි ගොඩක් Developers ලා PHP වලට අකමැති?

      මම දැකලා තියෙනවා ගොඩක් වෙලාවට (ලංකාවෙත් ඇතුලුව) Software development field එකේ උඩ ඉන්න ගොඩක් experienced developers ලා බනිනවා PHP වලට. මම PHP ගැන ලොකුවට ඉගෙන ගෙන නෑ. ඒත් සාමාන්‍ය මට්ටමෙන් වැඩ කරලා තියෙනවා.

      වෙන රටවල ගොඩක් අයගෙනම් අදහස දැන් php ඉගෙනගෙන තේරුමක් නෑ කියන එක. ගොඩක්ම udemy, lynda වගේ සයිට් වලත් මම මේක දැකලා තියෙනවා.

      ගොඩක් ස‍යිට් වල තියෙන ආටිකල් ගොඩක් මම කියෙව්වා මේ ගැන. සමහර හේතුනම් විහිලුවක්.

      ඒත් මේ ෆෝරම් එකේ ගොඩක් PHP developers ලා ඉන්න නිසා, ඒවගේම හැමෝම ලංකාවේ නිසා මට කියන්න පුලුවන්ද ඔයාලගේ අත්දැකීම්?.

      ඒවගේම ඔයාලා දකින අඩුපාඩු සහ අදහස්.

      posted in General Discussion
      S
      sudo
    • RE: Angular CLI vs React JS vs Vue JS - වාසි අවාසි

      use case eka anuwa thamai. hama framework ekema, library ekema advantages wagema disadvantages tyenawa. Angular, Vue frameworks, react library ekak. frameworks wala godak welawata ekata adala design pattern ekak tyenawa. library + design pattern = framework. Oyage use case eka anuwa thamai hodatama set wena eka balanna wenne.

      posted in Front-End Development
      S
      sudo
    • Idea: Let's start a LK Developer Discord server!

      Since we have a nice little community of Sri Lankan developers here, I think we can take this to the next level. We should create a place where all of us can hang out, chat and maybe even talk to each other.

      Since Discord already provide facilities we need (code highlighting, embeds, bots bla bla bla) I think it's the best place for this. (or IRC, but many of us dont use it anymore).

      What do you guys think about this idea?. Especially mods.

      posted in General Discussion
      S
      sudo
    • RE: ලංකා ඩිවෙලොපර්ස් වෙනස් වෙන්න ඕනෙද ?

      language 2n ma karamu bro. awlk nane

      posted in General Discussion
      S
      sudo
    • RE: Node.js : Introduction - Part 2

      @Tize-Thamizh you can easily find better English tutorials online. (like https://www.w3schools.com/nodejs/nodejs_intro.asp). I simply wrote this for beginners who likes to learn stuff in native language.

      posted in Back-End Development
      S
      sudo
    • RE: The best Linux distro in 2018 (#1 in distrowatch.com)

      distrowatch walin actual percentage eka ganna ba userslage, me dawas wala wadipurama search karanne mona distro ekada kiyala witharai eken track wenne,

      posted in Linux
      S
      sudo
    • RE: The best Linux distro in 2018 (#1 in distrowatch.com)

      @crxssrazr93 cool man.

      but manjaro isn't arch. whole point of arch is to build the OS as you see fit from bottoms up right?. Manjaro tend to cater new users. They even advertise it as a beginner OS. I think arch basted distro like Manjaro is far more easier because of the AUR. New users hate to use PPAs and random sites to get their software.

      posted in Linux
      S
      sudo
    • Node.js Developer Roadmap - Node.js ගැන ඉගෙන ගන්න ඕන දේවල්!

      මේක Github එකේ තියෙන Project එකකින් ගත්ත Roadmap එකක්. මේක Node පටන් ගන්න හිතන් ඉන්න අයට ගොඩක් වටිනවා. මොකද මේකේ පෙන්නලා තියන හොද Node.js Developer කෙනෙක් වෙන්න දැනගන්න ඕන දේවල් සහ Node ඉගෙන ගන්න පටන් අරගෙන ඉස්සරහට යන්න ඕන විදිය.

      alt text

      Repo : Node.js Developer Roadmap

      posted in Back-End Development
      S
      sudo

    Latest posts made by sudo

    • RE: ලංකා ඩිවෙලොපර්ස් වෙනස් වෙන්න ඕනෙද ?

      language 2n ma karamu bro. awlk nane

      posted in General Discussion
      S
      sudo
    • RE: Lanka Developer Official Discord Channel

      awesome. !

      posted in Announcements
      S
      sudo
    • Idea: Let's start a LK Developer Discord server!

      Since we have a nice little community of Sri Lankan developers here, I think we can take this to the next level. We should create a place where all of us can hang out, chat and maybe even talk to each other.

      Since Discord already provide facilities we need (code highlighting, embeds, bots bla bla bla) I think it's the best place for this. (or IRC, but many of us dont use it anymore).

      What do you guys think about this idea?. Especially mods.

      posted in General Discussion
      S
      sudo
    • RE: Arch Linux Touchpad Drivers

      @Rusiru-Athukorala said in Arch Linux Touchpad Drivers:

      ?Acer Aspire E 15 E5-575G

      Acer 575G wla awl tyena bro linux support wala. mama hoyala balala kiyannm.

      posted in Linux
      S
      sudo
    • Node.js Developer Roadmap - Node.js ගැන ඉගෙන ගන්න ඕන දේවල්!

      මේක Github එකේ තියෙන Project එකකින් ගත්ත Roadmap එකක්. මේක Node පටන් ගන්න හිතන් ඉන්න අයට ගොඩක් වටිනවා. මොකද මේකේ පෙන්නලා තියන හොද Node.js Developer කෙනෙක් වෙන්න දැනගන්න ඕන දේවල් සහ Node ඉගෙන ගන්න පටන් අරගෙන ඉස්සරහට යන්න ඕන විදිය.

      alt text

      Repo : Node.js Developer Roadmap

      posted in Back-End Development
      S
      sudo
    • RE: අවංකව උත්තරයක් දීපල්ලා......

      lankawe tutorials channel kohomath karanna amarui, godakma income ekak ena widiyata. ape youtube trending walata giyoth oyata hethuwa theri. godak small audience ekak thamai inne. Voice nathuwa kaloth ekenuth godak podi percentage ekak thamai oyata target karanna wenne.

      posted in Comments & Feedback
      S
      sudo
    • RE: The best Linux distro in 2018 (#1 in distrowatch.com)

      @crxssrazr93 i don't know man. I know few people who switched directly from windows to manjaro. But i agree a normie might not be able to do that.

      posted in Linux
      S
      sudo
    • RE: The best Linux distro in 2018 (#1 in distrowatch.com)

      @crxssrazr93 cool man.

      but manjaro isn't arch. whole point of arch is to build the OS as you see fit from bottoms up right?. Manjaro tend to cater new users. They even advertise it as a beginner OS. I think arch basted distro like Manjaro is far more easier because of the AUR. New users hate to use PPAs and random sites to get their software.

      posted in Linux
      S
      sudo
    • RE: Share your knowledge and experience and win a t-shirt

      nice shirt

      posted in Announcements
      S
      sudo
    • RE: The best Linux distro in 2018 (#1 in distrowatch.com)

      distrowatch walin actual percentage eka ganna ba userslage, me dawas wala wadipurama search karanne mona distro ekada kiyala witharai eken track wenne,

      posted in Linux
      S
      sudo