ElaKiri Programmer's Club

ilanganthilaka

Well-known member
  • Jun 4, 2008
    12,435
    1,004
    113
    එහෙනං ඇරේ ගැන තියෙන කොටසවත් කියවපං බං...



    නෑනෙ බං :P එකෙක්වත් නෑ..
    මෙතන ඉන්නෙ ඩෙස්ක්ටොප් ඩිවලපර්ස්ල විතරයි..
    ඒ එක්කෙනෙක්වත් නිකමටවට් sql කුවරියක්වත් ලියාගන්න sqlite වත් පාවිච්චි කරන්නෑ..
    ඔක්කොම ඇක්සස් විතරයි..
    කුවරි බොහෝ දුරට සමාන වුනත් එහෙම සමාන බව දැනගන්නවත් sql ඩේටබේස් එකක් අල්ලලවත් නෑ..
    ඒ හින්ද උඹේ ප්‍රශ්නෙ අහන්න එපා :P :P :P

    දන්න උන් හොයන්නැතුව අහපං කුකුලොහ් :baffled:

    :rofl::rofl::rofl::D:D:D:D:yes::yes::yes::P:P:P:baffled::baffled::baffled::angry::angry:
     

    tery123

    Well-known member
  • Feb 25, 2011
    6,031
    177
    63
    34
    PHP:
    #include <stdio.h>
     
    /* function declaration */
    void swap(int x, int y);
     
    int main ()
    {
       /* local variable definition */
       int a = 100;
       int b = 200;
     
       printf("Before swap, value of a : %d\n", a );
       printf("Before swap, value of b : %d\n", b );
     
       /* calling a function to swap the values */
       swap(a, b);
     
       printf("After swap, value of a : %d\n", a );
       printf("After swap, value of b : %d\n", b );
     
       return 0;
    }

    PHP:
    /* function definition to swap the values */
    void swap(int x, int y)
    {
       int temp;
    
       temp = x; /* save the value of x */
       x = y;    /* put y into x */
       y = temp; /* put temp into y */
      
       return;
    }

    machanla meke a=200, b= 200 meda enna ona:dull::dull::dull::dull: value deka pass unama x=100 wenawa ,y = 200 wenawa..ita passe temp=100;y=temp nisa y =100; ethakota x=y unama???me void swap kiyana eken return wenne mokakda????voida dammama return wenne naneda????theren nathooooo
     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    PHP:
    #include <stdio.h>
     
    /* function declaration */
    void swap(int x, int y);
     
    int main ()
    {
       /* local variable definition */
       int a = 100;
       int b = 200;
     
       printf("Before swap, value of a : %d\n", a );
       printf("Before swap, value of b : %d\n", b );
     
       /* calling a function to swap the values */
       swap(a, b);
     
       printf("After swap, value of a : %d\n", a );
       printf("After swap, value of b : %d\n", b );
     
       return 0;
    }

    PHP:
    /* function definition to swap the values */
    void swap(int x, int y)
    {
       int temp;
    
       temp = x; /* save the value of x */
       x = y;    /* put y into x */
       y = temp; /* put temp into y */
      
       return;
    }

    machanla meke a=200, b= 200 meda enna ona:dull::dull::dull::dull: value deka pass unama x=100 wenawa ,y = 200 wenawa..ita passe temp=100;y=temp nisa y =100; ethakota x=y unama???me void swap kiyana eken return wenne mokakda????voida dammama return wenne naneda????theren nathooooo

    වොයිඩ් වලිං මොකුත් රිටර්න් කරන්නෙ නෑ.. ඕනෙ නං නල් එකක් රිටර්න් කලහැකි..
    return null; නෙමේ.. නිකංම return; විතරක් ගහල...
    void වලදි return; කිරීමෙන් ෆන්ක්ශන් එක නවතිනව.. එතනිං එහාට යන්නෑ...
    void foo()
    {
    printf("foo");
    return;
    prinf("bar");
    }

    ඔහොම ලිව්වාම foo කියන එක ප්‍රින්ට් වෙනව.. ඒත් bar එක ප්‍රින්ට් වෙන්නෑ.. :yes:

     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    PHP:
    #include <stdio.h>
     
    /* function declaration */
    void swap(int x, int y);
     
    int main ()
    {
       /* local variable definition */
       int a = 100;
       int b = 200;
     
       printf("Before swap, value of a : %d\n", a );
       printf("Before swap, value of b : %d\n", b );
     
       /* calling a function to swap the values */
       swap(a, b);
     
       printf("After swap, value of a : %d\n", a );
       printf("After swap, value of b : %d\n", b );
     
       return 0;
    }

    PHP:
    /* function definition to swap the values */
    void swap(int x, int y)
    {
       int temp;
    
       temp = x; /* save the value of x */
       x = y;    /* put y into x */
       y = temp; /* put temp into y */
      
       return;
    }

    machanla meke a=200, b= 200 meda enna ona:dull::dull::dull::dull: value deka pass unama x=100 wenawa ,y = 200 wenawa..ita passe temp=100;y=temp nisa y =100; ethakota x=y unama???me void swap kiyana eken return wenne mokakda????voida dammama return wenne naneda????theren nathooooo

    කෝඩ් එක කියෙව්වෙ දැන්..
    උඹට ස්වැප් එකෙන් ඕනෙ මාරු කරන්න වුනාට මේකෙදි මාරු වෙන්නෑ..
    ඉස්සෙල්ල පොයින්ටර්ස්, රෆරන්ස් ගැන හොයපං..
    නිකංම void foo(int a, int b) වලට වැලියුස් දුන්නාම ඒ දෙන වැලියුස් දෙකට ඩයිරෙක්ට් ඇක්සස් එක හම්බවෙන්නෑ.. එහෙම හම්බවෙන්න void foo(int& a, int& b) විදිහට දෙන්න ඕනෙ..
    එහෙම නැත්තං void foo(int* a, int* b) විදිහට පොයින්ටර්ස් අරගෙන පොයින්ටර් එක හරහා වෙරියබල්ස් දෙක ඇක්සස් කරන්න ඕනෙ..
     

    tery123

    Well-known member
  • Feb 25, 2011
    6,031
    177
    63
    34
    කෝඩ් එක කියෙව්වෙ දැන්..
    උඹට ස්වැප් එකෙන් ඕනෙ මාරු කරන්න වුනාට මේකෙදි මාරු වෙන්නෑ..
    ඉස්සෙල්ල පොයින්ටර්ස්, රෆරන්ස් ගැන හොයපං..
    නිකංම void foo(int a, int b) වලට වැලියුස් දුන්නාම ඒ දෙන වැලියුස් දෙකට ඩයිරෙක්ට් ඇක්සස් එක හම්බවෙන්නෑ.. එහෙම හම්බවෙන්න void foo(int& a, int& b) විදිහට දෙන්න ඕනෙ..
    එහෙම නැත්තං void foo(int* a, int* b) විදිහට පොයින්ටර්ස් අරගෙන පොයින්ටර් එක හරහා වෙරියබල්ස් දෙක ඇක්සස් කරන්න ඕනෙ..

    අහ්හ් එතකොට direct value පාස් කරන්න බැරිද???මේ රෙෆෙරෙන්ස් විද්යටද කරන්න ඕන??? function එකකට call කරන කරන විදි දෙක නේ මේක????ඇයි බන් එතකොට උන් මේ පාර්ට් එක ලිව්වේ??

    PHP:
       int temp;
    
       temp = x; /* save the value of x */
       x = y;    /* put y into x */
       y = temp; /* put temp into y */
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,861
    1
    9,624
    113
    Gampaha
    වොයිඩ් වලිං මොකුත් රිටර්න් කරන්නෙ නෑ.. ඕනෙ නං නල් එකක් රිටර්න් කලහැකි..
    return null; නෙමේ.. නිකංම return; විතරක් ගහල...
    void වලදි return; කිරීමෙන් ෆන්ක්ශන් එක නවතිනව.. එතනිං එහාට යන්නෑ...
    void foo()
    {
    printf("foo");
    return;
    prinf("bar");
    }

    ඔහොම ලිව්වාම foo කියන එක ප්‍රින්ට් වෙනව.. ඒත් bar එක ප්‍රින්ට් වෙන්නෑ.. :yes:

    මම මේක දැනන් උන්නෙ නෑ බන්.. :baffled: අඩේ දැන් if-else තොගයක් අස්සකට if එකක් දාගන්න ඕනෙ උනාම එහෙම අස්සෙ ඔබන් නැතුව ඕනෙ තැනින් නිකන්ම ලියල return කරානම් ඉවරයි නේ.. පට්ට.. :D:cool:
     

    DooA

    Well-known member
  • Jun 22, 2011
    5,202
    773
    113
    ආගිය අතක් නැත
    මම මේක දැනන් උන්නෙ නෑ බන්.. :baffled: අඩේ දැන් if-else තොගයක් අස්සකට if එකක් දාගන්න ඕනෙ උනාම එහෙම අස්සෙ ඔබන් නැතුව ඕනෙ තැනින් නිකන්ම ලියල return කරානම් ඉවරයි නේ.. පට්ට.. :D:cool:

    Ehema nennam karanne
     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    අහ්හ් එතකොට direct value පාස් කරන්න බැරිද???මේ රෙෆෙරෙන්ස් විද්යටද කරන්න ඕන??? function එකකට call කරන කරන විදි දෙක නේ මේක????ඇයි බන් එතකොට උන් මේ පාර්ට් එක ලිව්වේ??

    PHP:
       int temp;
    
       temp = x; /* save the value of x */
       x = y;    /* put y into x */
       y = temp; /* put temp into y */

    ඩිරෙක්ට් වැලියු පාස් කරන්න තමා රෙෆරන්ස් හෝ පොයින්ටර්ස් පාස් කරන්නෙ. :yes:
    PHP:
    void foo(int& i)
    {
     i += 10;
    }
    
    int i;
    printf("%d", i); //මේක ඩිස්ප්ලේ කරන්නෙ 0
    foo(i);
    printf("%d", i); //දැන් ෆූ කෝල් කල නිසා අයි 10 වෙලා.. මේක 10 ඩිස්ප්ලේ කරනව :yes:

    PHP:
    void bar(int* i)
    {
    *i += 10;
    }
    
    int i;
    printf("%d", i); මේක ඩිස්ප්ලේ කරන්නෙ 0
    bar(*i);
    printf("%d", i); //මේක දැන් 10 ඩිස්ප්ලේ කරනව.. පොයින්ටර් එකක් හරහා i වලට දහයක් එකතු කලා :yes:

    PHP:
    void foobar(int i);
    {
    i += 10;
    }
    
    int i;
    printf("%d", i); //මේක ඩිස්ප්ලේ කරන්නෙ 0
    foobar(i);
    printf("%d", i); //මේකත් ඩිස්ප්ලේ කරන්නෙ 0. අයි දුන්නට ගන්නෙ රෙෆරන්ස් එකක්වත් පොයින්ටර් එකක්වත් නෙමේ.. foobar ෆන්ක්ශන් එකෙන් අයි වල අගය කොපි කරගෙන ෆන්ක්ශන් එක ඇතුලට වෙනම i කියල වෙරියබල් එකක් හදාගෙන ඒකෙ වැලියු එකට තමා 10ක් එකතුකරන්නෙ.. එලියෙ තියෙන i වලට නෙමේ. :no:

    එග්සාම්පල් ව්අල වැරදි ඇති.. විශුවල් ස්ටූඩියෝවත් නෑ ටෙස්ට් කල්ල බලන්න.
     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    මම මේක දැනන් උන්නෙ නෑ බන්.. :baffled: අඩේ දැන් if-else තොගයක් අස්සකට if එකක් දාගන්න ඕනෙ උනාම එහෙම අස්සෙ ඔබන් නැතුව ඕනෙ තැනින් නිකන්ම ලියල return කරානම් ඉවරයි නේ.. පට්ට.. :D:cool:

    :yes: ඔව්.. return; දාල ලියපං.. :yes: නිකං ඉෆ් එල්ස් දාල අන්තිම වෙනකංම අරං ගිහිං මෙමරිය කන්නෙ මොකටද :yes:
    throw වලදිත් රිටර්න් වෙනව :yes:
     

    DooA

    Well-known member
  • Jun 22, 2011
    5,202
    773
    113
    ආගිය අතක් නැත
    c# වල http request එකක් යවල post data එක්ක cookies save කරගෙන ඉදලා ඊට පස්සේ දෙවෙනි request එක යවනවා කලින් cookies එක්ක. කොහොමද කරන්නේ .
     

    MihiCherub

    Well-known member
  • Sep 14, 2009
    18,861
    1
    9,624
    113
    Gampaha
    c# වල http request එකක් යවල post data එක්ක cookies save කරගෙන ඉදලා ඊට පස්සේ දෙවෙනි request එක යවනවා කලින් cookies එක්ක. කොහොමද කරන්නේ .
    Code:
    HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
    request.CookieContainer = new CookieContainer(); 
    request.CookieContainer.Add(response.Cookies);
    https://msdn.microsoft.com/en-us/library/a18ka3h2.aspx
     

    DooA

    Well-known member
  • Jun 22, 2011
    5,202
    773
    113
    ආගිය අතක් නැත
    මචං c# වල stack එකේ යටම තියෙන method එක try catch එකකින් wrap කරාම stack එකේ උඩින්ම තියෙන method එකේ exception handle වෙන්නේ නැද්ද ?
     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    මචං c# වල stack එකේ යටම තියෙන method එක try catch එකකින් wrap කරාම stack එකේ උඩින්ම තියෙන method එකේ exception handle වෙන්නේ නැද්ද ?

    :eek: තේරුණා වගේ ඉන්නෝනෙ :baffled:
     

    DooA

    Well-known member
  • Jun 22, 2011
    5,202
    773
    113
    ආගිය අතක් නැත
    :eek: තේරුණා වගේ ඉන්නෝනෙ :baffled:

    මම මේ ලබ්බේ c# දන්නේ නෑ බන්. java වල නම් method එකෙන් exception එකක් throw කරාම ඒ method එක invoke කරන තැනින් exception එක handle කරන්න පුළුවන්නේ බන්. c# වල method එකෙන් exception throw කරන්න බැ. ඉතින් මම මෙතොඩ් එක invoke කරන තැනින් try catch එකක් දැම්ම. එත් ඒ exception එක නිසා break වෙනව ලබ්බ.

    PHP:
    public void first_method(){
        try{
            second_method();
        }catch(MyException e){
            //if error handle here
        }
    
    }
    
    public void second_method() throw MyException{
        // do risk things
    }
    මෙන්න මේ විදියට c# වල කරන්නේ කොහොමද ?
     

    DJvodka

    Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    මම මේ ලබ්බේ c# දන්නේ නෑ බන්. java වල නම් method එකෙන් exception එකක් throw කරාම ඒ method එක invoke කරන තැනින් exception එක handle කරන්න පුළුවන්නේ බන්. c# වල method එකෙන් exception throw කරන්න බැ. ඉතින් මම මෙතොඩ් එක invoke කරන තැනින් try catch එකක් දැම්ම. එත් ඒ exception එක නිසා break වෙනව ලබ්බ.

    PHP:
    public void first_method(){
        try{
            second_method();
        }catch(MyException e){
            //if error handle here
        }
    
    }
    
    public void second_method() throw MyException{
        // do risk things
    }
    මෙන්න මේ විදියට c# වල කරන්නේ කොහොමද ?

    C# wala checked exceptions nehe. Eka nisa method signature eke throw karanna one ne.
     

    shyze

    Junior member
  • Dec 30, 2012
    199
    13
    18
    mchn ape project ekakata camera ekak order kara ebay eken...aaka aawata passe thama danne aakata support karana software eka thiyenne Chinese walin witharai kiyala. ithin apita a camera eken ganna images n videos tika ganna puluwan widihak thiyanawada ? Chinese software eke DLL tika use karala monawahari karaganna puluwanda ? :confused::confused::confused:
     
    • Like
    Reactions: markhaloce

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    මම මේ ලබ්බේ c# දන්නේ නෑ බන්. java වල නම් method එකෙන් exception එකක් throw කරාම ඒ method එක invoke කරන තැනින් exception එක handle කරන්න පුළුවන්නේ බන්. c# වල method එකෙන් exception throw කරන්න බැ. ඉතින් මම මෙතොඩ් එක invoke කරන තැනින් try catch එකක් දැම්ම. එත් ඒ exception එක නිසා break වෙනව ලබ්බ.

    PHP:
    public void first_method(){
        try{
            second_method();
        }catch(MyException e){
            //if error handle here
        }
    
    }
    
    public void second_method() throw MyException{
        // do risk things
    }
    මෙන්න මේ විදියට c# වල කරන්නේ කොහොමද ?

    අහ්.. :D නෑ.. සීසාප් වල ෆන්ක්ශන් එක අගින් throw exception දාන්නෑ :no:
    කෙලින්ම ට්‍රයි කැච් වල දාල කැච් වලිං එක්සෙප්ශන් එකට ඕනෙ දේ කරගන්න එකයි තියෙන්නෙ :yes:
    ෆන්ක්ශන් එකකදි එක්සෙප්ශන් එකක් තෲව් කරන්න throw new exception(); පාවිච්චි කලෑකි..
    exception එකක් තෲව් කරද්දි නිකංම රිටර්න් වෙනව :yes:
    ලූප් නම් ඔක්කොම බ්‍රේක් වෙනව :yes:
    ඇයි ජාව වල එහෙම වෙන්නැතෙයි :baffled:
     

    markhaloce

    Member
    Mar 7, 2013
    10,298
    677
    0
    17
    The Real North
    mchn ape project ekakata camera ekak order kara ebay eken...aaka aawata passe thama danne aakata support karana software eka thiyenne Chinese walin witharai kiyala. ithin apita a camera eken ganna images n videos tika ganna puluwan widihak thiyanawada ? Chinese software eke DLL tika use karala monawahari karaganna puluwanda ? :confused::confused::confused:

    dll එක සී වලිං මිසක් චයිනිස් වලිං ලියන්නෑ නේ :baffled:
    ඔව්.. ඇහැක් වෙයි. :yes:
    මෙතඩ් වල නම් එහෙම චීනෙන් දීල නැත්තං හැබැයි :sorry:
     
    • Like
    Reactions: shyze

    හෙළයෙක්

    Well-known member
  • Apr 26, 2014
    48,553
    98,515
    113
    mchn ape project ekakata camera ekak order kara ebay eken...aaka aawata passe thama danne aakata support karana software eka thiyenne Chinese walin witharai kiyala. ithin apita a camera eken ganna images n videos tika ganna puluwan widihak thiyanawada ? Chinese software eke DLL tika use karala monawahari karaganna puluwanda ? :confused::confused::confused:
    http://www.nirsoft.net/utils/dll_export_viewer.html

    oken balapan ena method tika ita pase echarama aulak ne.
     
    • Like
    Reactions: shyze

    DooA

    Well-known member
  • Jun 22, 2011
    5,202
    773
    113
    ආගිය අතක් නැත
    අහ්.. :D නෑ.. සීසාප් වල ෆන්ක්ශන් එක අගින් throw exception දාන්නෑ :no:
    කෙලින්ම ට්‍රයි කැච් වල දාල කැච් වලිං එක්සෙප්ශන් එකට ඕනෙ දේ කරගන්න එකයි තියෙන්නෙ :yes:
    ෆන්ක්ශන් එකකදි එක්සෙප්ශන් එකක් තෲව් කරන්න throw new exception(); පාවිච්චි කලෑකි..
    exception එකක් තෲව් කරද්දි නිකංම රිටර්න් වෙනව :yes:
    ලූප් නම් ඔක්කොම බ්‍රේක් වෙනව :yes:
    ඇයි ජාව වල එහෙම වෙන්නැතෙයි :baffled:

    Ehema wenawa. Dan meke throw karana eka kohen hari handle karanna epai. Eka karanna ba