Flutter setup for Windows


Flutter become popular cross platform development tool. Let’s Install Flutter in Windows. As a open source project, we can install the flutter SDK from GitHub.

The prerequisites

The minimum requirement for Flutter for Windows is Windows 10 or later . In order to clone the repository we have to use git. Also recommend to have Visual Code /Atom for editing the code.

Download and install the Git tool for windows

Clone the repository

Get the latest stable version from GitHub repository or alternatively can download from flutter site

git clone https://github.com/flutter/flutter.git -b stable --depth 1

Use the -b option to clone the stable version

Set the path variable

You also need to update the path variables

  • From the Start search bar, enter ‘env’ and select Edit environment variables for your account.
  • Under-User variables check if there is an entry called Path:
  • If the entry exists, append the full path to flutter\bin using ; as a separator from existing values.
  • If the entry doesn’t exist, create a new user variable named Path with the full path to flutter\bin as its value.

Call the Doctor

run Flutter doctor command to inspect status of your Flutter SDK and tools installed

Android IOS development

For Android you have to install the Android Studio for development tool support which can be download from official website.

How to quickly open code editor from console on Windows / Linux and Mac


Windows developers who were using IDE like Visual Studio you may need not depend on console and those tricky commands either. As you notice all modern languages and packages come with handy command line tools.

In fact you can directly open your favorite editor like VS code or atom using the command,s it is possible because of the environment variable which is set while installing your app.

In Linux everything can be run from both world. For example , we can open markdown file in Linux with Typora using following

typora readme.md

Back to Flutter we can run he following Flutter command ( on Windows/Linux and Mac)

flutter create myapp
cd myapp
code .

Which will automatically open the code editor { VS Code } and open the current directory.

VB6: List default printer using code in Windows


kernel32 hold lots of interesting function that you may not utilized yet. With the Profile String functionality programmers can list default printer name, with serial port, Driver etc. Is that interesting.

Just create a bunch of function and call it.

Declare the functions

Create the following functions and Alias which is the prerequisite for our program.

Declare Function GetProfileString Lib “kernel32.dll” Alias “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long
Define the GetDefaultPrinter function

Let create our custom functions for fetching the default printer.

Public Function GetDefaultPrinter() As Printer

Dim strBuffer As String * 254

Dim iRetValue As Long

Dim strDefaultPrinterInfo As String

Dim tblDefaultPrinterInfo() As String

Dim objPrinter As Printer

' Retreive current default printer information

iRetValue = GetProfileString("windows", "device", ",,,", strBuffer, 254)

strDefaultPrinterInfo = Left(strBuffer, InStr(strBuffer, Chr(0)) - 1)

tblDefaultPrinterInfo = Split(strDefaultPrinterInfo, ",")

For Each objPrinter In Printers

If objPrinter.DeviceName = tblDefaultPrinterInfo(0) Then

' Default printer found !

Exit For

End If

Next

' If not found, return nothing

If objPrinter.DeviceName <> tblDefaultPrinterInfo(0) Then

Set objPrinter = Nothing

End If

Set GetDefaultPrinter = objPrinter

End Function

Using the function to list default

Drag and drop a command button and a Text Box to your form and drop these code into click event of the button.

Private Sub Command8_Click()

Dim objPrinter As Printer

Set objPrinter = GetDefaultPrinter()

Text2.Text = "Default printer is: " + objPrinter.DeviceName & _

Chr(13) & " Driver name is: " + objPrinter.DriverName _

& Chr(13) & " Port is: " + objPrinter.Port

Set objPrinter = Nothing

End Sub

Lets run and see what going on

VB6: List all printers using code in Windows


Listing all printers with name, Port in VB6 is simple as listing default printer port using Kernel32 library . Today we going show you how to do this.

As usual we start with function declaration, then define a new function which add all information into a list box. Here we goes

Kernel32 GetProfileString method

Declare Function GetProfileString Lib “kernel32.dll” Alias “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long

Add printer information into a list box

Public Sub GetPrinterList(lstPrinter As ListBox)Dim PrintData As PrinterDim defprinterpos%

For Each PrintData In Printers

‘ Add printer name and port to list

lstPrinter.AddItem PrintData.DeviceName & ” at: ” & PrintData.Port

‘ Check for default printer

If PrintData.DeviceName = Printer.DeviceName Then defprinterpos = lstPrinter.NewIndex

Next

lstPrinter.ListIndex = defprinterpos%

End Sub

This sub procedure will take list box as argument, and add printer to this list box.

Call the sub

The final line of code just invoke the procedure and see what we have.

Happy coding

VB6: List all printers using code in Windows


Listing all printers with name, Port in VB6 is simple as listing default printer port using Kernel32 library . Today we going show you how to do this.

As usual we start with function declaration, then define a new function which add all information into a list box. Here we goes

Kernel32 GetProfileString method

Declare Function GetProfileString Lib “kernel32.dll” Alias “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long

Add printer information into a list box

Public Sub GetPrinterList(lstPrinter As ListBox)
Dim PrintData As Printer
Dim defprinterpos%
For Each PrintData In Printers
‘ Add printer name and port to list
lstPrinter.AddItem PrintData.DeviceName & ” at: ” & PrintData.Port
‘ Check for default printer
If PrintData.DeviceName = Printer.DeviceName Then defprinterpos = lstPrinter.NewIndex
Next
lstPrinter.ListIndex = defprinterpos%
End Sub

This sub procedure will take list box as argument, and add printer to this list box.

Call the sub

The final line of code just invoke the procedure and see what we have. 
Happy coding

VB6: List default printer using code in Windows


kernel32 hold lots of interesting function that you may not utilized yet. With the Profile String  functionality programmers can list default printer name, with serial port, Driver etc. Is that interesting. 


Just create a bunch of function and call it.

Declare the function

Declare Function GetProfileString Lib “kernel32.dll” Alias “GetProfileStringA” (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As Long

Define the GetDefaultPrinter function

Public Function GetDefaultPrinter() As Printer
    Dim strBuffer As String * 254
    Dim iRetValue As Long
    Dim strDefaultPrinterInfo As String
    Dim tblDefaultPrinterInfo() As String
    Dim objPrinter As Printer
    ‘ Retreive current default printer information
    iRetValue = GetProfileString(“windows”, “device”, “,,,”, strBuffer, 254)
    strDefaultPrinterInfo = Left(strBuffer, InStr(strBuffer, Chr(0)) – 1)
    tblDefaultPrinterInfo = Split(strDefaultPrinterInfo, “,”)
    For Each objPrinter In Printers
        If objPrinter.DeviceName = tblDefaultPrinterInfo(0) Then
            ‘ Default printer found !
            Exit For
        End If
    Next
    ‘ If not found, return nothing
    If objPrinter.DeviceName tblDefaultPrinterInfo(0) Then
        Set objPrinter = Nothing
    End If
    Set GetDefaultPrinter = objPrinter
End Function

Use the function to list default  

Private Sub Command8_Click()
Dim objPrinter As Printer
Set objPrinter = GetDefaultPrinter()
Text2.Text = “Default printer is: ” + objPrinter.DeviceName & _
Chr(13) & ” Driver name is: ” + objPrinter.DriverName _
& Chr(13) & ” Port is: ” + objPrinter.Port
Set objPrinter = Nothing
End Sub

Add auto complete box for datagrid in C#


As we learned how to add an auto complete option for TextBox control in C#, we can also add this feature where a Text entry works. We are back with Datagrid example here. All you have to do is follow these steps.

  1. Drag and drop a Datagrid control to your C# Windows Application.
  2. Find Data Grid’s  EditingControlShowing event using the Properties window.
  3. Create a TextBox for auto completion, using DataGridViewEditingControlShowingEventArgs object.
  4. Check for exact column where we want to place auto completion box.
  5. Create auto completion string set using AutoCompleteStringCollection class.
  6. Fill Auto completion Mode,Source and custom source properties

The Code

 String t = dataGridView1.Columns[1].HeaderText;
            if (t.Equals(“Items”))
            {
                TextBox auto = e.Control as TextBox;
                if (auto!=null) {
                    AutoCompleteStringCollection autotxt = new AutoCompleteStringCollection();
                    auto.AutoCompleteMode = AutoCompleteMode.Suggest;
                    auto.AutoCompleteSource = AutoCompleteSource.CustomSource;
                    autotxt.Add(“Citrizine”);
                    autotxt.Add(“CDT”);
                    autotxt.Add(“DAXIRGIN”);
                    autotxt.Add(“CX4”);
                    autotxt.Add(“DNT-Tab”);
                    auto.AutoCompleteCustomSource = autotxt;
                }
            }
It’s looks like simple, sin’t it?

Install packages with the Python package Index


PyPI – the Python Package Index is the largest Python package repository meant for the Python programming community. It consist of dozens of packages from programmers around the world which minimizes the coding tasks. Flask and Django were some of the top Python frame work in the PyPI.

The easiest way to install a Python Package from repository is pip command, a samll Python program. You can install the pip by download and compile the get-pip.py files.

Compiling get-pip

Go to your command prompt and locate the get-pip.py file and compile with Python interpreter
C:/>Python get-pip.py  and will install the Python Package Index command on your computer.

Installing packages

Lets install Django framework .
C:/> pip install django
will install the Django web frame work on your system , make sure your internet/Wi-Fi connection turned on.

Uninstalling packages

You can also use the Python Package Index (pip) to uninstall a package as follows
C:/> pip uninstall

HOW TO CONFIGURE PYTHON PATH ON WINDOWS?


Python is one of the hobbyist programming language .It laid backbone to many online service like Google search. Linux and other popular OS come with default Python installation but Windows doesn’t.
You can find a free copy from Python.org for your OS and can run the IDLE GUI/Command line for compiling python scripts and have fun. At the same time the Python interpreter is not available to run from all of your drives using MS Dos.
The Windows installer let you add the Python path to Windows, sometimes you need retouch to activate the option. The Installer add a ‘/’ at the end of the string, which Windows don’t like at all. Let’s fix it
Right click My Computer – Properties – Advanced System Settings and access the environment variables.
Find path value under System Variables.
 Remove the ‘\’ at the end of the string. You can also set the system path manually, remember the ‘\’ slash. A reboot will set the Python path active.

Reboot and launch command prompt try Python from any drive of your choice and it will invoke the Python command line.

Create a Auto generating Excel expense sheet with VBA


Microsoft Excel becomes one of my favourite application since I marry Excel macros, it help me lot to minimize tedious jobs. Here I will explain how you can perform an advanced Macro operation with the help of VB coding operations in Microsoft Excel 2013/2010/2007.

Making of Expense Sheet

 Firstly design your expense sheet as you like and Name the worksheet says ‘XP monthly’ which is short for Expense Monthly. It will be the base sheet which is working as source for additional sheet.

Sheet Renaming and checking for duplicate sheet

This task will require VB coding, just hit Alt+F11 to activate VB Editor and drop the following codes in Sheet1(XP Monthly).
Private Sub Worksheet_Activate()
Dim j, str, temp
If Name “xps” Or Name “XP Monthly” Or Left(Name, 3) = “XP-” Then

‘ FIND THE SPACE IN IN SHEET NAME FOR TITLE
For j = 4 To Len(Name)
 temp = Mid(Name, j, 1)
 If temp ” ” Then
   str = str & temp
 Else
  Exit For
 End If
Next
Range(“A7”) = str ‘ Name of the Month
‘………………………………………………………………………
End If
‘If (Left(Name, 3) = “xps” Or Name = “Monthly”) Then
Dim flag
flag = 0
‘ FIND THE PERIODS IN SHEET NAME
For j = Len(Name) To 1 Step -1
 temp = Mid(Name, j, 1)
If temp = “.” Then
 flag = 1
 Exit For
End If
Next
‘………………………………………………………………………
If (flag > 0) Then MsgBox “Naming is possible”
Dim nameStr As String
nameStr = “XP-” & MonthName(Month(Date)) & ” ” & Year(Date)
Dim i
‘ CHECK WHETHER THE SHEET NAME ALREADY TAKEN
Dim h, yy
For h = 1 To Worksheets.Count
 If Sheets.Item(h).Name = nameStr Then
  foo = True
  MsgBox “Sorry the XPs Sheet already exist for this month,Rename the sheet manually”, vbCritical, “Naming Error”
  Exit For
 End If
Next
If foo = False Then
 i = MsgBox(“Do you want to alter the worksheet name as ” & “‘” & nameStr & “‘” & “?”, vbYesNo, “Naming offer”)
 If i = vbYes Then Name = nameStr
End If
End If
End Sub

For avoiding the accidental renaming we add some numbers (NewXPS)with sheet name when it is duplicating.Above action will be perform when user switch between sheets during which Activate event of Sheet is fired.

Copying the Base sheet

Now we are ready create new Macro for copying the Base sheet for current month.Press Alt+F8 and enter macro name XPSheet and hit Create button and drop the following Macro code.

Sub NewXPS()
‘ NewXPS Macro
Sheets(“XP Monthly”).Select
Sheets(“XP Monthly”).Copy After:=Sheets(1)
ActiveSheet.Name = “XP-” & MonthName(Month(Date)) & ” ” & Year(Date) & ” ” & Rnd((1))
End Sub

The Rand() will generate random number file name, which used to avoid duplicating sheets. The sheet will be renamed later as current month, if there is no duplicate sheet otherwise you have rename it manually.

How to use this Macro enabled sheet

Whenever you need a new Expense sheet just run the Macro and switch between sheets once, it will rename automatically. VB Macro programming offer flexibility and ease of peace, working with MS Excel.

You can download and use complete Work Book from our Doc storage.