Thursday, June 10, 2021

Edward Lance Lorilla

Edward Lance Lorilla


【Visual Studio Visual VB net】Device Manager

Posted: 09 Jun 2021 09:52 AM PDT

 Public Class Form1

Dim cmdProcess As Process = New Process() Dim fileArgs As String Dim path As String = "C:\Windows\System32\" Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click fileArgs = "devmgr.dll DeviceManager_Execute" cmdProcess.StartInfo.Arguments = fileArgs cmdProcess.StartInfo.WorkingDirectory = path cmdProcess.StartInfo.FileName = "RunDll32.exe" cmdProcess.Start() cmdProcess.WaitForExit() Me.Show() End SubEnd Class

【VUEJS】multi condition filtering

Posted: 09 Jun 2021 09:51 AM PDT

 <template id="demo-filter">

  <div class="demo">

    <div class="demo-warp">

      <div class="demo-flex" v-for="(v,k) in getList" :key="k">

        <span class="demo-title">{{v.title}}</span>

        <div class="demo-content">

          <div class="demo-tab" :class="isShow ? 'demo-hide' : ''">

            <span v-for="(val, key) in v.childer" :key="key" :class="{'demo-active': val.active}" @click="tabClick(val,key,k)">{{val.value}}</span>

          </div>

        </div>

        <div class="demo-more" @click="isShow = !isShow" v-if="v.childer.length >= 14">More</div>

      </div>

    </div>

  </div>

</template>

<div id="app">

  <section id="view" cloak>

    <demo-filter :get-list="filterList" @get-sel-data="getFilterSelData" @set-time="setTime"></demo-filter>

    <view-layout :view-data="viewData" width="25%" height="300px" :view-time="viewTime"></view-layout>

    <pre>

    Selected data: {{filterSelData}}

    </pre>

  </section>

  

</div>


* {margin: 0;

padding: 0;

box-sizing: border-box;

}


html,

body,

section {

  width: 100%;

  height: 100%;

}


[v-cloak] {

  display: none;

}


section {

  display: flex;

  flex-direction: column;

}


/* Layout component: start */

.view-warp {

  flex: 1;

  overflow: hidden;

  margin: auto;

  display: flex;

}


.view-box {

  overflow: auto;

  width: 1220px;

  height: 100%;

  display: flex;

  flex-wrap: wrap;

  align-content: flex-start;

  margin: 0 -10px;

}


.view-flex {

  padding: 10px;

  cursor: pointer;

  transition: ease .5s;

  transform-style: preserve-3d;

}


.view-flex:hover {

  transform: translateY(-10px);

  transition: ease .5s;

}


.view-item {

  height: 100%;

  border: 1px solid red;

  display: flex;

}


.view-item>span {

  margin: auto;

}


.view-no-data {

  margin: auto;

}


/* Layout component: end */


/* Filter list: start */

.demo {

  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);

  margin-bottom: 15px;

  min-height: 140px;

  height: auto !important;

  height: 140px;

}


.demo-warp {

  display: flex;

  max-width: 1200px;

  margin: auto;

  height: 100%;

  flex-direction: column;

  padding: 15px 0;

}


.demo-flex {

  display: flex;

  margin-bottom: 15px;

}


.demo-flex:last-of-type {

  margin-bottom: 0;

}


.demo-title {

  flex-basis: 70px;

  margin-top: 5px;

}


.demo-content {

  display: flex;

  flex: 1;

}


.demo-tab {

  flex: 1;

  margin-right: 15px;

  height: 35px;

  overflow: hidden;

}


.demo-tab span {

  display: inline-block;

  margin: 0 5px 15px 5px;

  cursor: pointer;

  padding: 5px 10px;

  color: #999999;

}


.demo-more {

  margin-top: 5px;

  cursor: pointer;

}


.demo-active {

  background-color: #09F;

  color: white !important;

  border-radius: 3px;

}


.demo-tab span:hover {

  background-color: #09F;

  color: white;

  border-radius: 3px;

}


.demo-hide {

  min-height: 35px;

  height: auto !important;

}


// Filter filter components

Vue.component('demo-filter', {

  template: `#demo-filter`,

  data() {

    return {

      isShow: false

    }

  },

  props: {

    getList: {

      type: Array,

      default: () => []

    }

  },

  methods: {

    tabClick(data, key, k) {

      // Add active ==> true display ʻactive style`

      this.getList[k].childer.map(item => {

        item.active = false

      })

      this.getList[k].childer[key].active = true


      // selected data

      let newArray = []

      this.getList.map(data => {

        data.childer.map(item => {

          if (item.active == true) {

            newArray.push(item)

          }

        })

      })

      this.$emit('get-sel-data', newArray)

      this.$emit('set-time', 0, 1000, true)

    }

  }

})


// Layout components

Vue.component('view-layout', {

  template: `<div class="view-warp">

  <div class="view-box" v-if="!viewTime.time">

  <div class="view-flex" v-for="(v,k) in viewData" :key="k" :style="style">

  <div class="view-item">

  <span>{{v.title}}</span>

  </div>

  </div>

  </div>

  <div class="view-no-data" v-else>{{viewTime.msg}}</div>

  </div>`,

  props: {

    viewData: {

      type: Array,

      default: () => []

    },

    width: {

      type: String,

      default: "25%"

    },

    height: {

      type: String,

      default: "300px"

    },

    viewTime: {

      type: Object,

      default: {

        time: true,

        msg: 'loading...'

      }

    }

  },

  computed: {

    style() {

      return {

        width: `${this.width.replace(/%+/, '')}%`,

        height: `${this.height.replace(/px+/, '')}px`

      }

    }

  }

})


const vm = new Vue({

  el: '#view',

  data() {

    return {

      viewList: [],

      viewTime: {

        time: true,

        msg: 'Data is loading desperately...'

      },

      param: {},

      filterList: [],

      filterSelData: [] // Filter selected data

    }

  },

  created() {

    this.viewList =  [

      {

        "title": "11",

        "value": "Floating Material"

      },

      {

        "title": "22",

        "value": "Floating Material"

      },

      {

        "title": "33",

        "value": "Floating Material"

      },

      {

        "title": "44",

        "value": "Floating Material"

      },

      {

        "title": "55",

        "value": "Floating Material"

      },

      {

        "title": "66",

        "value": "Effect Elements"

      }

    ]


    this.filterList = [

      {

        "title": "classification:",

        "childer": [{

          "value": "All",

          "active": true

        },

                    {

                      "value": "Floating Material",

                      "active": false

                    },

                    {

                      "value": "Effect Elements",

                      "active": false

                    },

                    {

                      "value": "Cartoon hand drawn",

                      "active": false

                    },

                    {

                      "value": "Decorative Pattern",

                      "active": false

                    },

                    {

                      "value": "Icon Elements",

                      "active": false

                    },

                    {

                      "value": "Promotion Label",

                      "active": false

                    },

                    {

                      "value": "Border Texture",

                      "active": false

                    },

                    {

                      "value": "irregular shape",

                      "active": false

                    },

                    {

                      "value": "Emoji package 213123",

                      "active": false

                    },

                    {

                      "value": "Expression Pack 2323",

                      "active": false

                    },

                    {

                      "value": "Expression Pack 1111",

                      "active": false

                    },

                    {

                      "value": "Emoticon 3333",

                      "active": false

                    },

                    {

                      "value": "Emoticon 444",

                      "active": false

                    }

                   ]

      },

      {

        "title": "format:",

        "childer": [{

          "value": "All",

          "active": true

        },

                    {

                      "value": "PSD",

                      "active": false

                    },

                    {

                      "value": "AI",

                      "active": false

                    },

                    {

                      "value": "EPS",

                      "active": false

                    }

                   ]

      },

      {

        "title": "Sort:",

        "childer": [{

          "value": "recommend",

          "active": true

        },

                    {

                      "value": "Hot yesterday",

                      "active": false

                    },

                    {

                      "value": "Newest upload",

                      "active": false

                    },

                    {

                      "value": "Top Downloads",

                      "active": false

                    },

                    {

                      "value": "Popular Collection",

                      "active": false

                    }

                   ]

      }

    ]


  },

  computed:{

    viewData(){

      var vm = this

      return this.viewList.filter(filter =>{

        var data = vm.filterSelData;

        var i;

        for (i = 0; i < data.length; i++) {

          if(filter.value == data[i].value){

            return true

          }

        }

      })

    }

  },

  mounted() {

    this.setTime(1000, 0, false)

  },

  methods: {

    // Encapsulate axios

    setRequest(url, data = {}, method = 'get') {

      return new Promise((resolve, reject) => {

        axios({

          url,

          method,

          data

        }).then(res => {

          resolve(res.data)

        }).catch(err => {

          reject(err)

        })

      })

    },


    // Get the selected value of the filter component

    getFilterSelData(data) {

      this.filterSelData = data

    },


    // Simulate delayed display data view

    setTime(startTime, endTime, bool) {

      setTimeout(() => {

        this.viewTime.time = bool

        setTimeout(() => {

          this.viewTime.time = false

        }, endTime)

      }, startTime)

    }

  }

})

【ANDROID STUDIO】 Setup Retrofit With Kotlin Coroutines

Posted: 09 Jun 2021 09:49 AM PDT

 apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"

defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
def retrofit_version = "2.8.1"
def coroutines_version = "1.3.5"
def lifecycle_version = "2.3.1"

implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation "com.squareup.okhttp3:logging-interceptor:4.5.0"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

【VUEJS】marquee effect

Posted: 09 Jun 2021 09:46 AM PDT

 <div id="app">

  <div class="str">{{msg}}</div>

  <div class="btn-wrap">

    <input type="button" class="btn-start" value="start" @click="start" />

    <input type="button" class="btn-stop" value="stop" @click="stop" />

  </div>

</div>


.btn-start {

  text-align: center;

  color:white;

  background-color: green;

  font-size: 15px;

  margin-top: 10px;

}

.btn-stop {

  text-align: center;

  color: white;

  background-color: red;

  font-size: 15px

}

.btn-wrap {

  margin: 10px auto;

  width: 32%;

}

.str{

  background-color: rgb(116, 114, 231);

  color: white;

  font-size: 35px;

  width: 50%;

  height: 40px;

  margin: auto;

}


var vm = new Vue({

  el: "#app",

  data: {

    msg: "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Nemo obcaecati ipsam iusto quo eligendi numquam culpa, cumque, recusandae ad, iste quos. Quidem odit laborum reiciendis excepturi incidunt delectus numquam doloremque.",

    intervalId: null, 

    timerId: null

  },

  mounted() {

    this.initTimer()

  },

  methods: {

    start() {

      if (this.intervalId != null) {

        return;

      }

      this.intervalId = setInterval(() => {

        var begin = this.msg.substring(0, 1)

        var end = this.msg.substring(1)

        this.msg = end + begin

      }, 200);

    },

    stop() {

      clearInterval(this.intervalId)

      this.intervalId = null

    },

    initTimer() {

      this.timerId = setTimeout(() => {

        this.start()

      },2000)

    }

  },

  destoryed() {

    this.timerId = null

  }

});

【Visual Studio Visual Csharp】Send Keystrokes To application Notepad

Posted: 09 Jun 2021 09:14 AM PDT

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;// make sure you have include using System.Runtime.InteropServices; for dllimport using System.Runtime.InteropServices;// make sure you have include using System.Diagnostics; for link to website using System.Diagnostics;// make sure you have include using System.Threading; for new thread (notepad) using System.Threading; namespace SendMendAndKey{ public partial class Form1 : Form { [DllImport("user32.dll", EntryPoint = "FindWindowEx")] public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChild, string lpszClass, string lpszWindow); [DllImport("user32.dll", EntryPoint = "SendMessage")] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, string lParam); [DllImport("user32.dll", EntryPoint = "FindWindow")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); public Form1() { InitializeComponent(); } public Process process; int SendKeystrokesToNotepad(string text) { process = Process.Start("notepad.exe"); Thread.Sleep(500); IntPtr notepad, edit; notepad = FindWindow("notepad", null); if (notepad == null) { return 0; } edit = FindWindowEx(notepad, new IntPtr(0), "Edit", null); if (edit == null) { return 0; } // 0x00C2 is macro which is replace for EM_REPLACESEL SendMessage(edit, 0x00C2, 0, text); return 1; } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { // call method SendKeystrokesToNotepad(textBox1.Text); } private void button2_Click(object sender, EventArgs e) { process.Kill(); } }}

【PYTHON】Loading and Saving Data with Pandas

Posted: 09 Jun 2021 09:10 AM PDT

 pip install pygments


!pygmentize -l text itunes_data.csv


import pandas as pd


csv_df = pd.read_csv('itunes_data.csv')

csv_df.head()


excel_df = pd.read_excel('itunes_data.xlsx', engine='openpyxl')

excel_df.head()


from sqlalchemy import create_engine

engine = create_engine('sqlite:///chinook.db')


query = """SELECT tracks.name as Track, tracks.composer, tracks.milliseconds,

tracks.bytes, tracks.unitprice,

genres.name as Genre,

albums.title as Album,

artists.name as Artist

FROM tracks

JOIN genres ON tracks.genreid = genres.genreid

JOIN albums ON tracks.albumid = albums.albumid

JOIN artists ON albums.artistid = artists.artistid;

"""


with engine.connect() as connection:

  sql_df = pd.read_sql_query(query, connection)


sql_df.head(2).T


# create dataframe from lists

df = pd.DataFrame(data={'seconds': [1, 2, 3, 4], 'intensity': [12, 11, 12, 14]})

df.head()


sql_df.index


sql_df.columns


type(sql_df)


itunes_df = pd.concat([csv_df, excel_df, sql_df], axis=0)

itunes_df.head()

itunes_df.tail()


print(itunes_df.iloc[0])

print(itunes_df.iloc[-1])


itunes_df.iloc[0, 0]


itunes_df.iloc[-1, -1]


itunes_df.loc[3502]


test_df = itunes_df.copy()

test_df = test_df.append(itunes_df.loc[3502])

test_df.loc[3502]

【GAMEMAKER】Space Shooting Games

Posted: 09 Jun 2021 09:08 AM PDT

 Information about object: objPlayer

Sprite: sprPlayer
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable ShotTimer to 0
Step Event:
set variable ShotTimer relative to -1
Keyboard Event for <no key> Key:
set the horizontal speed to 0
Keyboard Event for <Space> Key:
if expression ShotTimer<0 is true
      create instance of object objPBullet at relative position (sprite_width/2,0)
      set variable ShotTimer to 4
Keyboard Event for <Left> Key:
set the horizontal speed to -4
Keyboard Event for <Right> Key:
set the horizontal speed to 4

Information about object: objEnemy
Sprite: sprEnemy
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
set variable hits to 4
start moving in directions 010000000 with speed set to 3
Step Event:
execute code:

a=round(random(20));
if a=1 {
if self.hspeed!=0 {
self.hspeed=0;
} else {
self.hspeed=random(10)-5;
}
sprite_index = (sprEnemy);
a=round(random(10));
if a=1 {
self.hspeed=0;
}
if self.hspeed<0 {
sprite_index =(sprEnemyLeft);
}
if self.hspeed>0 {
sprite_index =(sprEnemyRight);
}
}
if x<objPlayer.x+45 and x>objPlayer.x {
instance_create(30+self.x, self.y, objBullet);
}


Collision Event with object objPBullet:
for other object: destroy the instance
set variable hits relative to -1
if expression hits=0 is true
      destroy the instance
Other Event: Intersect Boundary:
destroy the instance

Information about object: objController
Sprite: sprController
Solid: false
Visible: false
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
set Alarm 0 to 30
Alarm Event for alarm 0:
set Alarm 0 to 100
create instance of object objEnemy at position (random(window_get_width()-100)+50,0)

Information about object: objBullet
Sprite: sprBullet
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
if expression instance_number(objBullet)>1 is true
      destroy the instance
start moving in directions 010000000 with speed set to 12
Other Event: Intersect Boundary:
destroy the instance

Information about object: objPBullet
Sprite: sprPBullet
Solid: false
Visible: true
Depth:
0
Persistent: false
Parent:
Children:
Mask:

No Physics Object

Create Event:
start moving in directions 000000010 with speed set to 8

No comments:

Post a Comment