Edward Lance Lorilla |
- 【VISUAL VB NET】Stored Username and Password
- 【PYTHON OPENCV】Testing a linear regression model using Keras
- 【GAMEMAKER】Memory Puzzle
- 【VISUAL VB NET】open and Write a new ms word or document
- 【JAVASCRIPT】native component random paragraph size placeholder
【VISUAL VB NET】Stored Username and Password Posted: 26 Apr 2021 03:24 AM PDT Public Class Form1 Dim fileArgs As String Dim path As String = "C:\Windows\System32\" Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim cmdProcess As Process = New Process() fileArgs = "keymgr.dll,KRShowKeyMgr" cmdProcess.StartInfo.Arguments = fileArgs cmdProcess.StartInfo.WorkingDirectory = path cmdProcess.StartInfo.FileName = "RunDll32.exe" cmdProcess.Start() cmdProcess.WaitForExit() Me.Show() End SubEnd Class |
【PYTHON OPENCV】Testing a linear regression model using Keras Posted: 25 Apr 2021 08:52 AM PDT """ Testing a linear regression model using Keras """ # Import required packagesfrom keras.models import Sequentialfrom keras.layers import Densefrom keras.optimizers import Adamimport numpy as npimport matplotlib.pyplot as plt # Number of points:N = 50 # Number of points to predict:M = 3 # Define 'M' more points to get the predictions using the trained model:new_x = np.linspace(N + 1, N + 10, M) # Make random numbers predictable:np.random.seed(101) # Generate random data composed by 50 (N = 50) points:x = np.linspace(0, N, N)y = 3 * np.linspace(0, N, N) + np.random.uniform(-10, 10, N) def get_weights(model): m = model.get_weights()[0][0][0] b = model.get_weights()[1][0] return m, b def create_model(): """Create the model using Sequential model""" # Create a sequential model: model = Sequential() # All we need is a single connection so we use a Dense layer with linear activation: model.add(Dense(input_dim=1, units=1, activation="linear", kernel_initializer="uniform")) # Compile the model defining mean squared error(mse) as the loss model.compile(optimizer=Adam(lr=0.1), loss='mse') # Return the created model return model # Get the created modellinear_reg_model = create_model() # Load weights:linear_reg_model.load_weights('my_model.h5') # Show weights when the training is done (learned parameters):m_final, b_final = get_weights(linear_reg_model)print('Linear regression model is trained with weights w: {}, b: {}'.format(m_final, b_final)) # Get the predictions of the training data:predictions = linear_reg_model.predict(x) # Get new predictions:new_predictions = linear_reg_model.predict(new_x) # Create the dimensions of the figure and set title:fig = plt.figure(figsize=(12, 5))plt.suptitle("Linear regression using Keras", fontsize=14, fontweight='bold')fig.patch.set_facecolor('silver') # Plot training data:plt.subplot(1, 3, 1)plt.plot(x, y, 'ro', label='Original data')plt.xlabel('x')plt.ylabel('y')plt.title("Training Data") # Plot results:plt.subplot(1, 3, 2)plt.plot(x, y, 'ro', label='Original data')plt.plot(x, predictions, label='Fitted line')plt.xlabel('x')plt.ylabel('y')plt.title('Linear Regression Result')plt.legend() # Plot new predicted data:plt.subplot(1, 3, 3)plt.plot(x, y, 'ro', label='Original data')plt.plot(x, predictions, label='Fitted line')plt.plot(new_x, new_predictions, 'bo', label='New predicted data')plt.xlabel('x')plt.ylabel('y')plt.title('Predicting new points')plt.legend() # Show the Figure:plt.show() |
Posted: 25 Apr 2021 08:45 AM PDT Information about object: obj_level Sprite: Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics Object Create Event: execute code: Sprite: Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask: No Physics Object Mouse Event for Left Pressed: execute code: Draw Event: execute code: |
【VISUAL VB NET】open and Write a new ms word or document Posted: 25 Apr 2021 08:39 AM PDT Imports SystemImports System.Collections.GenericImports System.ComponentModelImports System.DataImports System.DrawingImports System.LinqImports System.TextImports System.Threading.TasksImports System.Windows.Forms' make sure that using System.Diagnostics; is included Imports System.Diagnostics' make sure that using System.Security.Principal; is included Imports System.Security.Principal ' make sure that using Microsoft.Office.Interop.Word; is included & added references Office 14 version Imports Microsoft.Office.Interop.Word ' make sure that using System.IO; Imports System.IO ' make sure that using System.Threading; Imports System.Threading Public Class Form1 Public filePath As String = "c:\msword.docx" Public Sub New() MyBase.New() InitializeComponent() End Sub Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click Process.Start("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Word 2010.lnk") End Sub Public Sub openWordDocument(filePath As String) Dim missing As Object = System.Reflection.Missing.Value 'create a document in this path Dim fileName As Object = filePath Dim wordApp As Object = Activator.CreateInstance(Type.GetTypeFromProgID("Word.Application")) 'Setup our Word.Document Dim wordDoc As Object = wordApp.[GetType]().InvokeMember("Documents", System.Reflection.BindingFlags.GetProperty, Nothing, wordApp, Nothing) 'Set Word to be not visible wordApp.[GetType]().InvokeMember("Visible", System.Reflection.BindingFlags.SetProperty, Nothing, wordApp, New Object() {True}) 'Open the word document fileName Dim activeDoc As Object = wordDoc.[GetType]().InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, Nothing, wordDoc, New [Object]() {fileName}) End Sub Private Sub button2_Click(sender As Object, e As EventArgs) Handles button2.Click ' create file If Not File.Exists(filePath) Then Using st As FileStream = System.IO.File.Create(filePath) Thread.Sleep(700) End Using openWordDocument(filePath) Else MessageBox.Show("Document already exists!" & vbLf & "Delete """ & filePath & """ to create new document!") End If End SubEnd Class |
【JAVASCRIPT】native component random paragraph size placeholder Posted: 25 Apr 2021 03:31 AM PDT |
You are subscribed to email updates from Edward Lance Lorilla. To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google, 1600 Amphitheatre Parkway, Mountain View, CA 94043, United States |
No comments:
Post a Comment