Tag Archives: Windows

Install apps in openSUSE Linux with zypper


openSUSE is one of the customizable and developer friendly Linux distribution. You can install SUSE along with Windows or can be install using VirtualBox, which is the easiest way of trying this Linux on Windows/Mac.

Zypper

zypper is a command line utility like apt, which fetch application from SUSE’s repository.

Search for an app

You can search for an app/package in the repository using zypper option

sudo zypper search sublim

In this case I search for sublimText package.

Install the app

You can install the app using the package name as

sudo zypper install sublimText

Add records to SQL DB using command builder and dataset in C#


When I talk about C# Dataset quote that it can also be used for insertion of data into the table too. In this post, we are going to learn how to.

Prerequisites

  1. Data connection with SQL
  2. Dataset
  3. Command builder object

In our example, we had MiniPurchaseInfo table and dataset associated with it.  First thing first, the dataset

SqlDataAdapter MiniPurchaseInfo = new SqlDataAdapter("select * from minipurchaseinfo", con);
 MiniPurchaseInfoDataSet = new DataSet();
 MiniPurchaseInfo.Fill(MiniPurchaseInfoDataSet, "minipurchaseinfo");

We simply make the query, filling the information to the dataset and so on. The next step is to create a row with the DataRow object and add the data row to our dataSet object.

DataRow dro;

dro = MiniPurchaseInfoDataSet.Tables[0].NewRow();
 dro["entryno"] = entryNo;
 dro["supinvoice"] = txt_invoice.Text.ToString();
 dro["supid"] = SUPID;
 dro["netamount"] = net;

add the row to the dataset.

MiniPurchaseInfoDataSet.Tables[0].Rows.Add(dro);

The final step is to set up the command build which has the capability of insertion and deletion operations with DB adapter and dataset.

System.Data.SqlClient.SqlCommandBuildercmdbuilder = new System.Data.SqlClient.SqlCommandBuilder(MiniPurchaseInfo);

Set insert command of the adapter from the command builder object

MiniPurchaseInfo.InsertCommand = cmdbuilder.GetInsertCommand();

Call the update command of the adapter which will update the new row stored in the dataset into the database table.

int r = MiniPurchaseInfo.Update(MiniPurchaseInfoDataSet.Tables[0]);

The update will return a none zero value when the insertion performed.

Saving values to registry in VB6


Visual Basic simplyfies the way you can store and retrieve values. Usually you can place value in configuration files with easy code. If you want to go more advanced , can keep them at Windows Registry, were the OS keep track of its ihabitants.

Visual Basic 6 allows you store and retrieve values by using SaveSetting and GetSettings methods

Call SaveSetting("MyApp", "Software", "Key", "12312AZ90")
Print GetSetting("MyApp", "Software", "Key")

YouTube Video

Data entry in MSHFlGrid control vb6


MSHFlex Grid[Visual Basic 6.0] control is a goog tool for showing data in a tabular format as in Excel.2018-08-31_221326

Data entry in  Grid also possible with a Text Box which require handling Keyup,KeyPress Events of the TextBox control.

Place a GridControl and a TextBox to your project and add the following code the Textbox Events.

Public Sub MCellEnter()
With MSHFlexGrid_POrder
txt_DEntry.Text = .TextMatrix(.row, .col)
txt_DEntry.Move (.CellLeft + .Left), (.CellTop + .Top), _
.CellWidth, .CellHeight
txt_DEntry.Visible = True
DoEvents
txt_DEntry.SetFocus
End With
End Sub

The above code place the text box on the active cell by adjusting hight, width and top of Text Box

Private Sub txt_DEntry_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
With MSHFlexGrid_POrder
.TextMatrix(.row, .col) = txt_DEntry
If .col < .Cols – 1 Then
.col = .col + 1
MCellEnter
Else
.col = 0
If (.row + 1) < .Rows Then
.row = .row + 1
End If
MCellEnter
End If

End With
End If

End Sub

The above code handle the enter keybehaviour and following keep track of Arrow key movements.

Private Sub txt_DEntry_KeyDown(KeyCode As Integer, Shift As Integer)
With MSHFlexGrid_POrder
.Refresh
.TextMatrix(.row, .col) = txt_DEntry

Select Case KeyCode
Case KeyCodeConstants.vbKeyDown
If .row + 1 < .Rows Then
.row = .row + 1
MCellEnter
End If
Case KeyCodeConstants.vbKeyUp
If (.row – 1) > 0 Then
.row = .row – 1
MCellEnter
End If
Case KeyCodeConstants.vbKeyRight
If (.col + 1 < .Cols) Then
.col = .col + 1
MCellEnter
End If
Case KeyCodeConstants.vbKeyLeft
If (.col – 1) >= 0 Then
.col = .col – 1
MCellEnter
End If
End Select
End With

End Sub

That’s all you need to know

How to configure Nox Emulator for Android Studio


Nox Player is one of the coolest Android Emulater for playing Android Games as well as for Application Developement and Testing.  You can use the Emulator to run app you are developing with Android Studio.2018-08-30_222153

  1. Download the Nox Player from the web and Install the software.[Make sure that you had installed graphics driver properly, otherwise the installation may fail].
  2. Start Nox Player, you can switch between Tablet to Mobile view by changing Advanced Settings in Nox.
  3. Let’s Turn on Developer Option by Clicking 3 or four times in Build number  [About Phone in Nox]
  4. Also Turn on USB Debugging [Developer Option]
  5. Final step is to run the adb command with ip address in command prompt. [adb resides in Nox’s bin folder]

adb  command [ run on command prompt]

nox_adb.exe connect 127.0.0.1:62001

Optionaly you can create and run a batch file wich can be used to run Nox adb  with a single click. Please make sure your batch file resides in the same bin folder where Nox player file found.[Use right click Nox Player short Cut to find the location in Windows].

You can download the batch file from Github and move to the bin folder

  • Now Start the Android Studio
  • Also start the Noxplayer and Turn on Developer option
  • Run the adb
  • Try debug App in Adroid Studio and it will be start appearing in the device list, otherwise run the adb with Run as admin a and  try again

 

How to migrate MS Access database to MS SQL Server 2005 or later


Wanna migrating Access database to MS SQL Server? You have two options; programmatically deal the transaction with the new database or use Microsoft SQL  Server Migration Assistant for Access and migrate the database directly to a newly created database to SQL Server 2005 or later versions

2018-05-01_155514

Before starting with MSSQLMA Note the following

  1. Prepare your database
  2. Check your Access database version, whether it is 32 or 64 database. If it is 32 make sure that you run 32 version of MSSQLMA which can be found under Microsoft SQL  Server Migration Assistant for Access folder.
  3. There are different versions of MSSQLMA available for different versions of the Access database.

Download Migration Assistant for Windows

Use the following link to download the free Migration Assistant from Microsoft official website.

v5.3 v6.0 , v7.8

Start Migration

Use Migration Wizard to add database and convert, load and migrate functions to finish the process.

Note:

Sometimes you may need to convert your access database to 97/2000 format for easy migration otherwise it will end up with a bunch of errors.

Run appropriate versions of Migration Assistant

Change location of control at runtime in C#


Beginners of C# who were familiar with VB6 may try to move the control using left and top properties of the control. It works fine with the Visual Basic 6. In Visual Studio the concept is changed with Location.

A location has two coordinates, namely x and y, similar to Top and Left in VB6. A location is an object of class Point. So we can change the location of a control using a new point object.

In the following, I have a panel, which I want to move at the run time to another part of the window.

stockpanel.Location = new Point(250, 5);

That’s it.

How to create a DataView in C#


DataView is special table view which allows you to traverse through rows and columns respectively. C# DataView is an offline data holder as DataSet.

What you need is

  1. A Database connection object
  2. A Data Adapter which configures the data table using SQL query.
  3. And a dataset which holds the table information.

Create a data view object and initialize it with the dataset tables name as follows

SqlDataAdapter AccountRegistration = new SqlDataAdapter(“select * from accountregistration order by grpid”, Common.con);

DataSet AccountRegistrationDataset=new DataSet();
AccountRegistration.Fill(AccountRegistrationDataset);
DataView AccountRegistrationTableView = new DataView(AccountRegistrationDataset.Tables[0]);

Learn about more DatView operations

 

How to create a SQL dataset in C#


The dataset in Visual Studio.Net represents a localized version of data from the database you are using. You can use the data stored in the dataset, no matter your connection is closed or not. 

Let’s see how a dataset can be created. First, up all you need SQL connection, see how to setup connection and adapter.

Build up your query with appropriate columns, then use Fill method of adapter class to fill your dataset as follows.

SqlDataAdapter  ProductTableAdapter = new SqlDataAdapter(“select * from productMaster”, con);

DataSet  ProductDataset=new DataSet()
ProductTableAdapter.Fill(MDataset, “ProductMaster”);

* Here ‘con’ is the SQL connection object.

Now you are ready to use ProductDataset