ก๊วนซอฟท์แวร์ </softganz> SoftGang (Gang Software)

Web &amp; Software Developer Gang.

602 items|« First « Prev 3 4 (5/61) 6 7 Next » Last »|
โดย Little Bear on 23 ก.ย. 63 17:29

ช่วงนี้กำลังพัฒนา Green Smile App เวอร์ชั่นใหม่ โดยเปลี่ยนแปลงรูปแบบมาใช้ Fragment แทน

หลังจากทำไปพักหนึ่ง ก็มีปัญหาในการสื่อสาร/เข้าถึงข้อมูลระหว่า Activity กับ Fragment

ขอบคุณบทความดี ๆ จาก Akexorcist เรื่อง Let’s Fragment — วิธีการรับส่งข้อมูลของ Fragment แถมในบทความยังมีบทความในซีรีย์เดียวกันอีกหลายเรื่อง เช่น

  • มารู้จักกับ Fragment กันเถอะ~
  • เริ่มต้นง่ายๆกับ Fragment แบบพื้นฐาน
  • ว่าด้วยเรื่องการสร้าง Fragment จาก Constructor ที่ถูกต้อง
  • รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 1]
  • รู้จักกับ FragmentTransaction สำหรับการแสดง Fragment [ตอนที่ 2]
  • Lifecycle ของ Fragment (Fragment Lifecycle)
  • วิธีการรับส่งข้อมูลของ Fragment
  • มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 1]
  • มาทำ View Pager กันเถิดพี่น้อง~ [ตอนที่ 2]
  • เพิ่มลูกเล่นให้กับ View Pager ด้วย Page Transformer

ลองตามไปอ่านกันดูนะครับ

โดย Little Bear on 20 ก.ย. 63 18:12

fun evaluateJsFromNative(command: String,
    webView: WebView, function: (value : Boolean) -> Unit ) {
    webView.evaluateJavascript("(function() { return $command; })();") {
        s -> function(s.toBoolean())
    }
}
override fun onBackPressed() {
    var boxCheck = "document.getElementsByClassName('box-page')[0].tagName == 'DIV';"
    evaluateJsFromNative(boxCheck, myWebView) {
        if (it) {
            evaluateJsFromNative("$.colorbox.close()", myWebView){}
        } else {
            super.onBackPressed()
        }
    }
}

โดย Little Bear on 10 ส.ค. 63 09:39
[Intro]
C Cmaj7 Cadd9 C Asus2 Asus4 Am Asus2
Cadd9 C Cmaj7 Cadd9 Am Asus2 Asus4 Am

  C    G/B  Am    G        Dm7          Am I close my eyes only for a moment and a moment´s gone. C  G/B  Am    G            Dm7          Am All my dreams pass before my eyes a curiosity.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind.
C  G/B  Am    G            Dm7            Am Same old song, just a drop of water in the endless sea. C  G/B  Am  G                Dm7              Am All we do, crumbles to the ground though we refuse to see.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind.
C      G/B  Am  G                Dm7          Am Don't hang on, nothing last´s forever but the earth and sky. C  G5      Am  G                  Dm7        Am It slips away all your money won´t another minute buy.
D  G        Am    D            G          Am Dust in the wind, all we are is dust in the wind D  G        Am    D            G          Am Dust in the wind, everything is dust in the wind.

Ultimate Guitar

โดย Little Bear on 9 ก.ค. 63 11:01

Application Green Smile ที่เราสร้างขึ้นมาเพื่อให้เป็นเครื่องมือหนึ่งของแพลตฟอร์ม ที่จะช่วยให้เกษตรกรสามารถเชื่อมโยงผลผลิตไปสู่ผู้บริโภคนะครับ


เครื่องมือนี้ทำอะไรได้บ้าง?

  • จะเป็นตัวช่วยให้กลุ่มเกษตรกรหรือเกษตรกรสามารถบริหารจัดการแปลงที่ดินที่มีอยู่ โดยการบันทึกผลผลิตในแต่ละรุ่นทั้งประเภท จำนวน วันเก็บเกี่ยว รวมถึงการให้ผู้บริโภคสามารถจองผลผลิตดังกล่าวได้ ผู้บริโภคสามารถติดตามกิจกรรมของการผลิตในแต่ละแปลงได้

นอกจากนี้เรายังมีระบบซื้อขายสินค้าเพื่อให้เกษตรกรสามารถต่อยอดขายสินค้าออนไลน์ได้ด้วย


Application Green Smile สามารถนำไปประยุกต์ให้งานกับเกษตรกรกลุ่มไหนได้บ้าง?

  • สามารถนำไปใช้กับสวนยางได้ ในระบบการขนส่งน้ำยางจากแปลงยางได้ทันเวลาได้น้ำยางที่มีคุณภาพ การเก็บข้อมูลพืชร่วมยาง รวมทั้งธนาคารต้นไม้

  • เราสามารถนำไปใช้งานในการบริหารจัดการเกษตรได้หลากหลายรูปแบบ เช่น เกษตรสวนยางพารา(FSC), เกษตรกรอินทรีย์(PGS,GAP), ธนาคารต้นไม้

  • ผลผลิต รายวัน,รายสัปดาห์,รายเดือน,รายปี,ระยะยาว(หลังเกษียณ)

ดูรายละเอียด Application Green Smile

โดย Little Bear on 22 มิ.ย. 63 23:29

umount -l /dev/sda1
e2fsck -cfpv /dev/sda1 > chresult.txt&

โดย Little Bear on 10 ธ.ค. 62 09:26

เลือกเมนู New Value Resource

กำหนดค่า

Local

th

ตั้งชื่อ strings_th.xml

โดย Little Bear on 5 ธ.ค. 62 09:22

cd /usr/local/directadmin/data/admin
echo -n "" > tickets.list

โดย Little Bear on 17 พ.ย. 62 11:41

What is Google Data Studio?

Google Data Studio is a FREE data visualization tool that allows you to import data from multiple sources and visualize them on a report that is easy to read and share. You can import data from any source using Google Sheets or Data Connectors to create the report you want.

What is Google Colaboratory?

Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. With Colaboratory you can write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.


Resource

โดย Little Bear on 9 พ.ย. 62 15:38




โดย Little Bear on 9 พ.ย. 62 14:46

<script src="https://cdn.netpie.io/microgear.js"></script>

<script> const APPID = "softganz-test"; // AppID const KEY = "TIoxpISdG19dnmH"; // Key const SECRET = "flK17giWJ1pCMuepAD0HTOK6p"; // secret

const ALIAS = &quot;browser&quot;;          // ตั้งชื่ออุปกรณ์ เป็นอะไรก็ได้

var microgear = Microgear.create({
    key: KEY,
    secret: SECRET,
    alias : ALIAS
});

<br /> // สร้างฟังก์ชั่นที่จะตอบสนองต่อ message ที่ เข้ามา microgear.on('message', function(topic,msg) {
//ในที่นี้ เราจะเอาข้อความไปแทนข้อความของ HTML element ชื่อ data document.getElementById("data").innerHTML = msg; });

  // สร้างฟังก์ชั่นที่จะถูกเรียกเมื่อ connect NETPIE สำเร็จ
microgear.on('connected', function() {
    microgear.setAlias(ALIAS);      // สามารถเปลี่ยน alias ได้

    // แสดงข่อความให้ทราบว่า connect สำเร็จ
    document.getElementById(&quot;data&quot;).innerHTML = &quot;Now I am connected with netpie...&quot;;    

<br /> // ตั้ง timer ให้ทำงานทุก 1 วินาที (1000 หมายถึง 1000 ms) setInterval(function() {

        // ส่งข้อความไปยังอุปกรณ์ชื่อตามตัวแปร ALIAS ซึ่งก็คือตัวเอง
        microgear.chat(ALIAS,&quot;Hello from myself at &quot;+Date.now());
    },1000);
});

microgear.connect(APPID);  // สร้างการเชื่อมต่อไปยัง NETPIE

</script>

<div id="data">_____</div>




<script src="https://cdn.netpie.io/microgear.js"></script>

<script> const APPID = "softganz-test"; // AppID const KEY = "LdB6MvSys2PWB9j"; // Key const SECRET = "CuUiEku60fhEw7TmFqezhmHN8"; // Secret

const MYNAME = &quot;alice&quot;;          // ชื่อของตัวเอง
const YOURNAME = &quot;bob&quot;;         // ชื่อของเพื่อนที่จะคุยด้วย

var microgear = Microgear.create({
    key: KEY,
    secret: SECRET,
});

var times = 0

microgear.on('message',function(topic,msg) {
    document.getElementById(&quot;data&quot;).innerHTML = topic+&quot; : &quot;+msg;
});

microgear.on('connected', function() {
    microgear.setAlias(MYNAME);         // ตั้งชื่อตัวเอง
    document.getElementById(&quot;data&quot;).innerHTML = &quot;Now I am connected with netpie...&quot;;&lt;br /&gt;

    setInterval(function() {

        // chat หาเพื่อน
        times++
        microgear.chat(YOURNAME,&quot;Hello from &quot;+MYNAME+ &quot; #&quot;+times+&quot; at &quot;+Date.now());
    },1000);
});
microgear.on('disconnected', function() {
    document.getElementById(&quot;data&quot;).innerHTML = &quot;Now I am disconnected with netpie...&quot;;
});

microgear.connect(APPID);

</script>

<div id="data">_____</div>

<script src="https://cdn.netpie.io/microgear.js"></script>

<script>
    const APPID = "softganz-test";    // AppID
    const KEY = "cCm6NzTxtkscroD";        // Key
    const SECRET = "h4kTjFAQBUhPEP8o0U8O3fZ09";   // Secret

    const MYNAME = "bob";        // ชื่อของตัวเอง
    const YOURNAME = "alice";         // ชื่อของเพื่อนที่จะคุยด้วย

    var microgear = Microgear.create({
        key: KEY,
        secret: SECRET,
    });
    
    var times = 0

    microgear.on('message',function(topic,msg) {
        document.getElementById("data").innerHTML = topic+" : "+msg;
    });

    microgear.on('connected', function() {
        microgear.setAlias(MYNAME);         // ตั้งชื่อตัวเอง
        document.getElementById("data").innerHTML = "Now I am connected with netpie...";<br />

        setInterval(function() {

            // chat หาเพื่อน
            times++
            microgear.chat(YOURNAME,"Hello from "+MYNAME+ " #"+times+" at "+Date.now());
        },1000);
    });
    
    microgear.on('disconnected', function() {
        document.getElementById("data").innerHTML = "Now I am disconnected with netpie...";
    });

    microgear.connect(APPID);
</script>

<div id="data">_____</div>
<script src="https://cdn.netpie.io/microgear.js"></script>

<script>
   const APPID = "softganz-test";             
   const KEY = "1xQjGzMtaNdX6R1";                 
   const SECRET = "6YyQujajj2nOcagkMyxckfvcL";    

   const ALIAS = "switch";

  var microgear = Microgear.create({
    key: KEY,
    secret: SECRET,
    alias : ALIAS
  });

 function toggle() {
    if(document.getElementById("button").innerText=="OFF"){
    document.getElementById("button").innerText = "Waiting for ON"
        microgear.chat('pieled','1');   
    }
    else{
    document.getElementById("button").innerText = "Waiting for OFF"
        microgear.chat('pieled','0');
    }
 }
    
  microgear.on('message',function(topic,msg) {
      document.getElementById("data").innerHTML = "LED is "+(msg == 0 ? "OFF" : "ON");<br />
      if(msg=="1"){
          document.getElementById("button").innerText="ON";
      }else if(msg=="0"){
          document.getElementById("button").innerText="OFF";
      }
  });
  microgear.on('connected', function() {
    microgear.setAlias(ALIAS);
    document.getElementById("data").innerHTML = "Now I am connected with netpie...";
  });

microgear.connect(APPID);
</script>

<div id="data">_____</div>
<center>
<button onclick="toggle()" id="button">OFF</button>
</center>
// <a class="hashtag" href="/tags/include">#include</a>  2 บรรทัดนี้ ต้องมีเสมอ
<a class="hashtag" href="/tags/include">#include</a> <ESP8266WiFi.h>
<a class="hashtag" href="/tags/include">#include</a> <MicroGear.h>       <br />
<br />
<br />
const char* ssid     = "Handy6Plus";        // ชื่อ ssid
const char* password = "nopassword";    // รหัสผ่าน wifi

<a class="hashtag" href="/tags/define">#define</a> APPID   "softganz-test"          // ให้แทนที่ด้วย AppID
<a class="hashtag" href="/tags/define">#define</a> KEY     "G0Z1T2E0GSOtfqJ"            // ให้แทนที่ด้วย Key
<a class="hashtag" href="/tags/define">#define</a> SECRET  "WGbwwUPpwcT10xL5fEEHoSWG1"         // ให้แทนที่ด้วย Secret

<a class="hashtag" href="/tags/define">#define</a> ALIAS   "pieblink"  // ตั้งชื่อเล่นให้ device นี้

WiFiClient client;

int timer = 0;
char state = 0;

MicroGear microgear(client);     // ประกาศตัวแปร microgear

// สร้างฟังก์ชั่นที่จะถูกเรียกเมื่อมี message เข้ามา
void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen) {
    Serial.print("Incoming message --> ");
    msg[msglen] = '\0';
    Serial.println((char *)msg);

    // ถ้า message ที่เข้ามาเป็น 1 ให้เปิด LED ถ้าเป็น 0 ให้ปิด LED
    if(*(char *)msg == '1'){
      digitalWrite(LED_BUILTIN, LOW);  // LED on
      microgear.chat("switch","1");
    }else{
      digitalWrite(LED_BUILTIN, HIGH);  // LED off
      microgear.chat("switch","0");
    }
}

// สร้างฟังก์ชั่นที่จะถูกเรียกเมื่อ microgear connect กับ NETPIE สำเร็จ
void onConnected(char *attribute, uint8_t* msg, unsigned int msglen) {
    Serial.println("Connected to NETPIE...");
    // เราอาจจะใช้โอกาสนี้ ตั้งชื่อ หรือเปลี่ยนชื่อ หรืออาจจะทำอะไรบางอย่าง เช่น subscribe<br />
    microgear.setAlias(ALIAS);
}

void setup() {
    // ประกาศให้ เวลามี message เข้ามา ให้กระโดดไปทำฟังก์ชั่น onMsghandler()
    microgear.on(MESSAGE,onMsghandler);

    // ประกาศให้เมื่อ connect สำเร็จ ให้กระโดดไปทำฟังก์ชั่น onConnected()
    microgear.on(CONNECTED,onConnected);

    Serial.begin(115200);
    Serial.println("Starting...");

    pinMode(LED_BUILTIN, OUTPUT);

   // initiate Wifi
    if (WiFi.begin(ssid, password)) {
        while (WiFi.status() != WL_CONNECTED) {
            delay(500);
            Serial.print(".");
        }
    }

    Serial.println("WiFi connected");<br />
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());

   // initial ตัวแปร microgear<br />
    microgear.init(KEY,SECRET,ALIAS);

    // เชื่อมต่อไป NETPIE ไปยัง AppID ที่กำหนด
    microgear.connect(APPID);  // ฟังก์ชั่นเชื่อมต่อ NETPIE
}

void loop() {
    // เช็คว่า  microgear ยัง connect หรือเปล่า
    if (microgear.connected()) { // ตรวจสอบการเชื่อมต่อ NETPIE
        Serial.println("..."); // พิมพ์แจ้งการเชื่อมต่อ NETPIE สำเร็จ
        // เราต้องเรียก microgear.loop() เป็นระยะ ไม่เช่นนั้น connection จะหลุด
        microgear.loop();

        if (timer >= 10000) {
            Serial.println("Publish..."); // พิมพ์แจ้งการส่งข้อมูล NETPIE

           // chat sาตัวเอง ด้วย state ที่ตรงข้ามกัน
            if(state==0){
               microgear.chat(ALIAS,state);
               state=1;
            }else{
               microgear.chat(ALIAS,state);
               state=0;
            }
            timer = 0;
        }<br />
        else timer += 100;
    }
    else {
        Serial.println("connection lost, reconnect...");<br />
        if (timer >= 5000) {
            microgear.connect(APPID);<br />
            timer = 0;
        }
        else timer += 100;
    }
    delay(100);
}
602 items|« First « Prev 3 4 (5/61) 6 7 Next » Last »|