Tuesday, September 4, 2018

QBASIC Elements

INTRODUCTION
Every programming language consists of some basic elements which are required to make a program. The element required to construct a QBASIC program consists of a set of characters, keywords, constants, variables, operators and expressions.

1. CHARACTER SET
A set of characters that are allowed to use in QBASIC is known as the QBASIC Character Set. The QBASIC Character Set consists of alphabets (both small and capital), numbers (0 to 9) and special characters. These special characters have their own meaning and function. The table below shows the special characters used in QBASIC.
QBASIC Elements

QBASIC keywords and variables are formed by using the characters defined in the QBASIC Character Set.

2. KEYWORD
Keywords are those words which have special meanings in QBASIC. Keywords are formed by using characters of QBASIC Characters Set. Keywords are statements, commands, functions (built in functions) and names of operators. The keywords are also called Reserved Words. Some reserved words are CLS, REM, INPUT, LET, PRINT, FOR, DO, SELECT, MID$, ASC, SQR, LEN, LEFT$, TIME$ and INT.

3. CONSTANTS
Constants are the data or the values in a program that cannot be changed during the program execution. The data may be a letter, words, numbers, or special characters. A constant can be stored in a variable when it is required to use in more than one statement or expression. In QBASIC, these data/constants are grouped into two main categories. They are:
a. Sting Constant
b. Numeric Constant

a. String Constant:
Sting Constant is a letter, words, numbers, combination of letters with numbers or special characters enclosed in double quotes. Mathematical operations cannot be performed on String Constants.
“B”, “APPLE”, “SYMBOL NO:10205”, “!!! Welcome to QBASIC World !!!”, etc. are some examples of Sting Constants.

b. Numeric Constant:
Numeric Constant refers to a number. A number with or without decimal point is a numeric constant. Thousand separators are not allowed to use in numeric constant. Numeric data should not be enclosed in double quotes. Mathematical operations and logical operations can be performed on the numeric constants. 101, 105.50, 720, 45603, etc. are some examples of numeric constants.

Numeric Constants may be integer, long integer, single precision or double precision.
Integer: Integer is whole number between -32768 to 32767.
Long Integer: Long Integer is a large range of whole number.
Single Precision: Single Precision is seven digit or less than seven digit positive or negative number that contains decimal point. Single Precision can be in the exponential form using E or with a trailing exclamation point. (!). 564, 78.65, 1.2 E-06 and 12345.678! are some examples of Single Precision Constants.
Double Precision: Double Precision is 17 digit or less than 17 digit positive or negative numbers that contains decimal point. Double Precision can be in the exponential form using D or with trailing hash sing (#). 9999.99D-12, 2345.786# and 3456.78 are some examples of Double Precision Constants.

4. VARIABLE
A program is written to perform certain tasks. A program needs data to produce information. A program can use data only when data are stored in the computer memory (RAM). In a computer memory, there may be many data. So, you need to tell the computer to use only those data which you want to use in a program. This is possible if you assign a name to the place where you have stored a data. In QBASIC, you can perform this task by using a variable. A variable is a place in the computer memory which has a name and stores data temporarily. Simply, you can say, a variable is an entity that stores data needed to be used in a program. Each program defines different number of variables. A value of a variable can be change during the execution of the program.

There are mainly two types of variables. They are:
i. String Variable
ii. Numeric Variable

A string variable stores sting data. Its types declaration sign is dollar ($). A numeric variable stores numeric data. A numeric variable can be Integer, Long Integer, Single Precision or Double Precision variables.
An Integer variable can store only an integer number. Its type declaration sign is percentage (%).
A Long integer variable can store a large range of whole number. Its type declaration sign is ampersand (&0).
A Single Precision variable can store a whole number as well as number with decimal. Its type declaration sign is exclamation sign (!). You can also use it without declaration sign. It is the default numeric variable.
A Double Precision variable also stores a whole number as well as number with decimal point. Its type declaration sign is hash (#).

Rules for naming a variable
a. Variable names can have maximum of 40 characters.
b. Variable names can have alphabets, numbers and decimal point.
c. A Variable name must begin with a letter.
d. A Variable name cannot begin with fn or FN alphabets. For example, fnames$, fnumetc.
e. Variable names cannot be reserved words.
f. Variable names may be ended with type declaration characters like $, %, &, !, and #.

Naam$, Address$, Bookname$, GameName$, etc., are examples of Sting Varibales.
Salary!, Age%, Mark, Number1, Number2, FirstNum, RollNumber, etc., are examples of Numeric Variables.

5. OPERATOR
Operators are symbols that indicate the type of operation QBASIC has to perform on the data or on the values of variables.

There are four types of operators in QBASIC. They are Arithmetic Operators, Relational Operators, Logical Operators and Sting Operator.

a. Arithmetic Operators
Arithmetic Operators are used to perform mathematical calculations like addition, subtraction, division, multiplication and exponential. The following table shows arithmetic operators used in QBASIC.

Operation ------------ Operator ---------------- Example ------------------ Result
i. Addition ----------------- + ----------------------- 5+8 -------------------------- 13
ii. Subtraction ----------- - ---------------------- 8-6 --------------------------- 2
iii. Multiplication -------- * ---------------------- 5*4 --------------------------- 20
iv. Division ---------------- / ------------------------ 8/2 -------------------------- 4
v. Integer Division -------- \ ----------------------- 9\2 --------------------------- 4
vi. Exponential ----------- ^ ----------------------- 4^3 ------------------------- 64
vii. Modular Division --- Mod --------------------- 7 mod 3 ------------------------ 1


b. Relational Operators
Relational Operators are use to perform comparisons on two values of same type. A comparison of sting data with numeric data cannot be done. The comparison of sting data is done on the basis of ASCII value. The result of comparison is either true (non zero) or false (zero).
The following table shows the relational operators used in QBASIC.
Operator ------------- Relation ------------------------------- Example
i. = --------------------- Equal to -------------------------------- A = B, A$ = B$
ii. > -------------------- Greater than --------------------------- A > B, “CAT”>”RAT”
iii. < ------------------- Less than ------------------------------- A < B, "cat" < "cat"
iv. > = ---------------- Greater than or equal to ---------------- A > = B, X$ > = Y$
v. < = ----------------- Less than or equal to ------------------- A < = B, X$ < = Y$
vi. < > ---------------- Not equal ------------------------------ A$ < > B$, X <> Y.

c. Logical Operators
Logical Operators combine two or more relational expressions to evaluate a single value as True (Non Zero) or False (Zero). The result of evaluation is used to make decisions about the program flow. The commonly used logical operators in QBASIC are AND, OR and NOT.

i. AND Operator:
AND operator returns ‘True’ when all the results returned from individual relational expressions are ‘True’ otherwise it returns ‘False’.
The AND Truth Table is given shown below.
Condition1 (P) ------------- Condition2 (Q) -------------- Result (P AND Q)
F ------------------------------- T ----------------------------------- F
T ------------------------------- F ----------------------------------- F
F ------------------------------- F ----------------------------------- F
T ------------------------------- T ----------------------------------- T

Note: A ‘T’ indicates a true value and a ‘F’ indicates a false value.

ii. OR Operator:
OR Operator return ‘True’ if any one of the relational expressions returns ‘True’. If all the relational expressions returns ‘False’ then only the combined result returned by OR operator will be ‘False’.

The OR Truth table is as given below.
Condition 1 (A) ------------------ Condition2 (Q) --------------- Result (A or B)
F ------------------------------------------- T ---------------------------------- T
T ------------------------------------------- F ---------------------------------- T
T ------------------------------------------- T ---------------------------------- T
F -------------------------------------------- F ---------------------------------- F

iii. NOT Operator:
NOT Operator operates on one operand and returns ‘True’ if the logical operation returns ‘False’. The NOT truth table is as given below.
Condition1 (A) --------------------------- Result (NOT A)
F ----------------------------------------------- T
T ----------------------------------------------- F

d. String Operator
String Operator joins two or more than two sting data. The plus sign (+) is used as the String operator. The act of combining two stings is called concatenation. The following table shows the use of Sting Operator.
String Data (A$) -------------------- Sting data (B$) ----------------- A$ + B$
“Ram” ---------------------------------- “Thapa” ------------------------ Ram Thapa
“50” ------------------------------------- “45” ----------------------------- 5045


6. EXPRESSIONS
An expression is the combination of operators, constants and variables that is evaluated to get a result. The result of the expression is either string data, numeric data or logical value (true or false) and can be stored in a variable. For example, the following are expressions in QBASIC.
(A + B) > C
A > = B + C
u* t + ½*a*t^2

An arithmetic expression may contain more than one operator. While evaluating such expressions, a hierarchy is followed. The hierarchy in arithmetic operations is listed as given below:
a. Exponentiation (^)
b. Negation (-)
c. Multiplication and division
d. Integer division
e. Modular division
f. Addition and Subtraction

The hierarchy in relational operations are =, >, <, <>, < =, and > = respectively. The hierarchy in logical operations are NOT, AND and OR.

NOTE:
When parenthesis is used, it changes the order of hierarchy. The operators inside the parenthesis are evaluated first. So, you can say QBASIC expression follows rule of PEDMAS where P, E, D, M, A and S stand for parenthesis, Exponentiation, Division, Multiplication, Addition, and Subtraction respectively.
Algebraic expression cannot be used directly in programming. It must be converted into QBASIC expression.

Algebraic Expression --------------------------------- BASIC Expression
A = L × B ------------------------------------------------- A = L * B
P = 2(L + B) ---------------------------------------------- P = 2*(L + B)
I = (P × T × R)/100 --------------------------------------- I = (P * T * R)/100
V = 4/3 pi R^3 ------------------------------------------- V = 4/3 * PI * R^3
0

Friday, June 22, 2018

Dotnet Core console app with NLOG in Visual Studio Code

In this post I am going to create simple minimalistic dotnet core console application and integrate it with nlog.



Let's create a folder for our project. I am going to name it nlog_console.



$mkdir nlog_console
$cd nlog_console



Now we create dotnet core console app project and if you have Visual Studio Code installed run the second command below.



$dotnet new console
$code . &



Now lets add nlog package to a project.



$dotnet add package nlog



This will add the following code to our project file.



<ItemGroup>
<PackageReference Include="nlog" Version="4.5.6" />
</ItemGroup>



Nlog framework requires configuration file 'nlog.config' to specify logger tagerts and rules. We can copy paste the sample nlog.config file from this github page or use one below.



xml version="1.0" encoding="utf-8" ?>

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xsi:schemaLocation="NLog NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogFile="console-example-internal.log"
internalLogLevel="Info" >



<targets>

<target xsi:type="File" name="file"
fileName="console-example.log"
layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}" />
<target xsi:type="Console" name="console"
layout="${date}|${level:uppercase=true}|${message} ${exception}|${logger}|${all-event-properties}" />
</targets>


<rules>
<logger name="*" minlevel="Trace" writeTo="file,console" />

</rules>
</nlog>



'nlog.config' file need to be copied to destination directory during project build. To achieve it add the code below to a project file.



<ItemGroup>
<None Include="nlog.config" CopyToOutputDirectory="Always" />
<ItemGroup>



Now we need to add actual logging code to a program. Copy paste the Program class code below.



using System;

namespace dotnetcore_nlog
{
class Program
{
private static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
log.Trace("Loggin trace.");
}
}
}



To build and run our console app run code below or add launch.json config to Visual Studio Code.



$dotnet build
$dotnet run



You should see the following output and log file created in the same directory as our console app.



2018/06/19 18:48:13.130|TRACE|Loggin trace. |nlog_console.Program|


References:





0

Thursday, September 21, 2017

Java Program to Print Table Using Loop

Java program to print a table

Below is a simple Java program to print a table using loops and Math.pow() function. Alternative solution to Introduction to Java Programming Chapter 2 Exercise 2.14. I decided to write this because a user made a comment about using for loops to solve the problem but his code didn't produce the required results.

public class PrintTable {
    public static void main(String [] args) {
        System.out.println("a"+ "\t" + "a^2" + "\t" + "a^3");
        for (int j = 0; j < 4; j++) {
            System.out.println((j+1) + "\t" + ((j+1)*(j+1)) + "\t" + ((j+1)*(j+1)*(j+1)));
        } 
    }
}

Or you can use the Math.pow() function to achieve the same result.

import java.lang.Math;

public class PrintTable {
    public static void main(String [] args) {
        System.out.println("a"+ "\t" + "a^2" + "\t" + "a^3");
            for (int j = 0; j < 4; j++) {
                System.out.println((j+1) + "\t" + (int)Math.pow((j+1),2) + "\t" + (int)Math.pow((j+1),3));
            }
    }
}

Click here to see other solutions to Introduction to Java Programming.
0

Saturday, September 16, 2017

Don’t Hammer Away at That Keyboard

How to care for computer keyboard

Many people frequently say that they spend a great deal of time pounding on their computer keyboards. They indicate that they hammer away when working at their computers. In point of fact, pounding on a computer keyboard -- striking the keys too hard -- can have negative consequences not only for the computer itself but such action can result in serious health consequences for the computer user.

Pounding away at the computer keyboard can have long term health consequences for a regular computer user. Perhaps the most common disability or condition that can arise from striking the keys on a computer too stridently is carpal tunnel syndrome. This debilitating condition is painful and more often than not requires a person to have invasive surgery on the hands, wrists and lower part of the arms.

Another health condition that can arise when a computer user is too hard on the keys is a deadening of the nerves at a person’s fingertips. While this may not seem like that significant of a problem on the surface, in point of fact deadening the nerves at the ends of a person’s fingers can be very serious. On a day to day basis, a typical person avoids a good deal of harm to his person because he can feel what is in front, near or around him. For example, if you are working in the kitchen, you can avoid serious damage to yourself by instantly detecting the heat from a stove by lightly passing your fingers over and above a particular burner.

In addition to the other ailments and conditions set forth in this article, using too much pressure when striking a keyboard, hitting the keys too hard, can result in a deterioration of joints in a person’s fingers. In time a person may even end up afflicted with arthritis as a result of the heavy pounding on a computer keyboard.

When all is said and done, it simply is not necessary for a person using a computer to use a great deal of force or pressure on the keys. More often than not, a keyboard will function properly with only a light touch on the keys themselves. In other words, you simply do not need to bang away on the keyboard to be effective in your typing and utilization of a computer unit. By lightly touching your keyboard you will avoid a host of health problems both now and into the future. 
0

Monday, August 14, 2017

Displaying assemblies used by the application process


Today I am going to show how to print out assemblies used by the running application. This information may be useful for logs and can be collected on application/service start.







Below is a snippet of the console application that prints out information to console.



using System;
using System.Diagnostics;

namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Process oProcess = Process.GetCurrentProcess( );

Console.WriteLine( string.Format( "Process: {0} ({1})",
oProcess.ProcessName, oProcess.Id ) );
Console.WriteLine( );
Console.WriteLine( "MODULES:" );
Console.WriteLine( "________" );

foreach ( ProcessModule oModule in oProcess.Modules )
{
Console.WriteLine( string.Format( "{0} ({1})",
oModule.ModuleName, oModule.FileName ) );
}
}
}
}

0

Friday, March 31, 2017

VB.NET - Validating InputBox

If you are working with the system that still uses InputBox control from Microsoft.VisualBasic then you may get a situation where the input needs to be validated. InputBox control does not allow any validation checks and in ideal case needs to be replaced with custom WinForms dialog box. This post will show a simple way of validating InputBox by creating InputBoxValidated function and using IStringValidator interface.



Public Class InputBoxValidated
Public Function InputBoxValidated _
(
prompt As String,
title As String,
Optional stringValidator As IStringValidator = Nothing,
Optional validationMessage As String = ""
) As String
Dim value As String _
= Microsoft.VisualBasic.Interaction.InputBox(prompt, title)

' If the cancel button wasn't pressed
' And IStringValidator is passed with validation message
If Not value = String.Empty AndAlso stringValidator IsNot Nothing _
AndAlso Not String.IsNullOrEmpty(validationMessage) Then
If Not stringValidator.Validate(value) Then
MessageBox.Show(validationMessage, Application.ProductName)
value = InputBoxValidated(
prompt, title, stringValidator, validationMessage)
End If
End If

Return value
End Function
End Class




As you can see InputBoxValidated function uses IStringValidator interface that can implement any kind of string validations and criteria.



Public Interface IStringValidator
Function Validate(value As String) As Boolean
End Interface



Below is an example of StringValidator class that implements IStringValidator interface and makes use of StringValidator from System.Configuration.



Public Class StringValidator
Implements IStringValidator

Public Sub New(maxLength As Integer, invalidCharacters As String)
Me.MaxLength = maxLength
Me.InvalidCharacters = invalidCharacters
End Sub

Public Property MaxLength As Integer
Public Property InvalidCharacters As String
Public Function Validate(value As String) _
As Boolean Implements IStringValidator.Validate
Dim valid As Boolean = True

Try
Dim stringValidator As _
New System.Configuration.StringValidator _
(0, MaxLength, InvalidCharacters)
If stringValidator.CanValidate(value.GetType()) Then
stringValidator.Validate(value)
Else
valid = False
End If
Catch ex As ArgumentException
valid = False
End Try

Return valid
End Function
End Class




References:










0

Sunday, January 29, 2017

Creating self extracting zip EXE under Linux for windows

Recently, I had a need to create a self extracting zip archive, which will open on any windows machine. Because, I am using Linux, I did not want to go through the process of installing the windows with 7z on it just for a sake of creating that archive. I was expecting that the process will be not trivial, as some of internet resources show, but all turned out very simple. Peazip archiver available for Windows as well as Linux, which is able to create self extracting exe archive. I downloaded portable version for 64 bit machine and when creating a new archive you get an option to create self extracting file in a single volume or split by chosen size.









What I found, peazip creates small archives that extract under windows machine just fine. If you need to zip large amount of files say > 1 GB, I would suggest to create normal archive, which can span several files of set size and then use 7zip on windows computer to extract them.





References:




0

Monday, December 5, 2016

Reading appsettings.json in .Net Core Console Application under Linux

Recently I was looking at how to load and use appsettings.json file in .Net Core Console application. Many resources on .Net forums and sites were descripting use of appsettings.json file in ASP.NET Core web App, but very little described appsettings with .Net Core Console app. I managed to created sample .Net Core app with the minimum required libraries. Creation of this sample program I am going to describe here. Let's call our App "appsettings".

$mkdir appsettings
$cd appsettings
$dotnet new
$dotnet restore

Now create appsettings.json file:

{
"AppSettings": {
"Date": "1900-01-01"
}
}

Date is the setting I am interested in loading from AppSettings section.



Edit project.json file to include "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0" in dependencies section. This is the only extra library we need in order to use ConfigurationBuilder functions.

{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"outputName": "AppSettings"
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.1.0"
},
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0"
},
"imports": "dnxcore50"
}
}
}

Now lets edit the Program.cs file. We are going to load the Date setting and display it in Console. Don't forget to include "using Microsoft.Extensions.Configuration;"

using System;
using System.IO;
using Microsoft.Extensions.Configuration;

namespace ConsoleApplication
{
public class Program
{
public static string AppSettingsFile = "appsettings.json";
public static string AppSettingsSection = "AppSettings";
public static string DateSetting = "Date";

public static void Main(string[] args)
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile(Program.AppSettingsFile, optional: true,
reloadOnChange: true);

var
config = builder.Build();
var appSettings = config.GetSection(Program.AppSettingsSection);
string dateString = appSettings[Program.DateSetting];
Console.WriteLine("Date:" + dateString);
}
}
}

That is pretty much all. Now let's build and run it.

$dotnet build
$dotnet run
Date:1900-01-01

0

Monday, November 14, 2016

xUnit Theory test ClassData with complex type

xUnit.net is a powerful, free, open source, unit testing tool for the .NET Framework. xUnit uses different notation to NUnit or MSUnit to specify test with parameters. Here I am going to show how to use Theory ClassData with complex type.



I have a sample class Plant, which has function 'bool IsEqual(Plant plant);'. We will create a Theory test for it.


[Theory]
[ClassData(typeof(IsEqualTestData))]
public void IsEqual(Plant plant1, Plant plant2, bool expectedResult)
{
Assert.Equal(expectedResult, plant1.IsEqual(plant2));
}


Class IsEqualTestData is a ClassData used with complex type Plant. It generates a list of arrays of 3 objects Plant1, Plant2, and ExpectedResult boolean.



private
class IsEqualTestData : IEnumerable<object[]>
{
private readonly List<object[]> _data = new List<object[]>
{
new object[]
{
new Plant()
{
Name = PlantTester.PlantName1,
Description = PlantTester.PlantDescription1
},
new Plant()
{
Name = PlantTester.PlantName2,
Description = PlantTester.PlantDescription2
},
false
},
new object[]
{
new Plant() { Name = PlantTester.PlantName1 },
new Plant() { Name = PlantTester.PlantName1 },
true
},
new object[]
{
new Plant()
{
Name = PlantTester.PlantName1,
Description = PlantTester.PlantDescription1
},
new Plant()
{
Name = PlantTester.PlantName2,
Description = PlantTester.PlantDescription1
},
true
}
};

public IEnumerator<object[]> GetEnumerator()
{
return _data.GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}


When running in xUnit it will report result of running each entry in the test.



If you are using Visual Studio you can download snippet file from github repository.




Reference:


xUnit_ClassData.snippet

Using dotnet watch test for continuous testing with .NET Core and XUnit.net - Scott Hanselman
0

Tuesday, July 5, 2016

.Net Core 1.0 Released! Or installing .Net Core on Debian

This was a great news to me that .Net Core 1.0 was released. I already was trying .Net Core RC2 on my Debian 8.x so I prepared to go through the installation process of new release. Surprisingly installation of .Net Core 1.0 described in Install for Debian 8 on Microsoft site was very smooth in comparison to beta versions. All I had to do is to clean up my previous install from ~/.dotnet go through the instructions on install page and "Hello World!" programs runs. Very pleased to see that improvement.



So here I am going to provide some links to what to do next once you get your install done too.




References:













0

Sunday, June 26, 2016

Recording Music CDs under Win 7










From days of Windows
95, Windows 98, Windows XP CD/DVD burners and writers were only
coming out on the market and computer users were required to install
additional software, which will allow them to burn CD and DVD disks.
Disk writing software like Nero was included for free with the CD/DVD
burner you could buy for your desktop computer or included on new
laptop. Modern Windows operating system like Windows 7, Vista,
Windows 8 and Windows 10 already have built in support for burning CD
/ DVD music, data and video disks. Users can use included Windows
Media Player to rip and burn music CDs.





Under Windows 7 to burn audio CDs insert CD disk in disk drive and in Windows Media Player open Burn tab, drag music files you want to burn. The blue bar shows how much space left on the disk. Once files are selected click Start burn to start recording on the disk.










Data CDs / DVDs can be burned directly from Windows Explorer. Disk image files with ISO extension can be burned using right mouse click on the file and selecting "Burn disk image".





If you still require more features than the basic functions to burn disks look through available free and commercial applications available on sites like filehippo





References:















0

Saturday, January 23, 2016

Install NVidia Graphic Drivers on ASUS ROG G750JW

ASUS ROG G750JW comes with GEFORCE GTX NVidia 2GB graphic card. To get a full power of this card on Debian we need to install nvidia drivers for it. Debian Wiki NvidiaGraphicsDrivers article describes several ways to do it. Here I am going to summarise the steps that worked for me.

  1. Add SteamOS repository to /etc/apt/sources.list.d/steamos.list, for example:

  2. deb http://repo.steampowered.com/steamos brewmaster main contrib non-free
  3. Update the list of available packages. Install the appropriate nvidia driver and related packages from SteamOS repository:

  4. # aptitude update
    # aptitude install -t brewmaster libegl1-nvidia:amd64 libgl1-nvidia-glx:amd64 libgl1-nvidia-glx:i386 libgl1-nvidia-glx-i386 libgles1-nvidia:amd64 libgles2-nvidia:amd64 libnvidia-eglcore:amd64 libnvidia-ml1:amd64 libxnvctrl0 nvidia-alternative nvidia-driver nvidia-driver-bin nvidia-kernel-dkms nvidia-modprobe nvidia-settings nvidia-vdpau-driver:amd64 xserver-xorg-video-nvidia
This will also install the recommended nvidia-driver package. DKMS will build the nvidia module for your system. Restart your system to enable the nouveau blacklist.



References:



0

Tuesday, November 10, 2015

Debian 8 – Jessie - Enabling Wifi on ASUS ROG G750JW

Debian Jessie installer managed to detect most of hardware during install like LAN, sound and video, but WIFI had to be configured separately.


  1. Add a "non-free" component to /etc/apt/sources.list for your Debian version, for example:

    # Debian 8 "Jessie"
    deb http://http.debian.net/debian/ jessie main contrib non-free


  2. Update the list of available packages. Install the relevant linux-headers.
    # apt-get update
    # apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') broadcom-sta-dkms


  3. Unload conflicting modules:

    # modprobe -r b44 b43 b43legacy ssb brcmsmac


  4. Load wl module:

    # modprobe wl


  5. Edit /etc/network/interfaces and comment out or remove allow-hotplug eth0



References:



0

Monday, October 12, 2015

Setup Lexmark X8350 printer under Debian Linux using Virtualbox and Win XP

After installing Debian 8.0 Jessie I failed to locate drivers for my multifunctional Lexmark x8350 printer. The Windows printer driver support was available only up to Vista, there were no drivers for Windows 7 and above.  So I decided to try to setup Windows under Vrtualbox with pass-through USB device. First I tried with Windows 7 Virtualbox client (Under normal Win 7 install printer drivers for Vista worked fine), which was very very slow to install and I did not get it to print, only to scan. So the best option left is to install Win XP. This article will describe installation of Lexmark printer on Win XP Virtualbox client.




Step 1: Install and configure latest Virtualbox package and extensions






I am not going to go describing installation of Virtualbox and extensions. www.virtualbox.org download page has clear instructions on what to download and install. After installation is done make sure that your /etc/fstab has the following line:





none /proc/bus/usb usbfs devgid=500,devmode=664 0 0





The devgid has to match your gid of your vboxusers group. Also make sure that user you logged in as is member of the vboxusers group. Please log out and log back in after adding it to a group.





Step 2: Setup Win XP client and configure USP pass-through


Make sure that Lexmark printer is connected to USB. There is no need to turn it on yet.



Start Oracle VM Virtual Box Manager. Click New. If you have already setup Win XP client just click on it and scroll down to USB section in Options. Click on USB link. Select USB 2.0 (EHCI) Controller, click on icon with green cross and select your printer from list. Click OK.








Now you can start Virtualbox client and complete Windows XP and printer setup. You can use your disc that comes with printer or download drivers from Lexmark support site.




References:











0

Saturday, May 23, 2015

Debian 8.0 Jessie - Install Mono 4.0

Mono 4.0 was released in May 2015.



In order to install it it on Debian 8.0 Jessie do the following as root or with sudo.

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 
3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF 

echo "deb http://download.mono-project.com/repo/debian wheezy main" 
| tee /etc/apt/sources.list.d/mono-xamarin.list 

echo "deb http://download.mono-project.com/repo/debian 
wheezy-apache24-compat main"
| tee -a /etc/apt/sources.list.d/mono-xamarin.list 

echo "deb http://download.mono-project.com/repo/debian 
wheezy-libjpeg62-compat main"
| tee -a /etc/apt/sources.list.d/mono-xamarin.list

apt-get update

apt-get install mono-complete

To get development IDE run:
apt-get install monodevelop



I had also to run several times apt-get -f install to force installation of failed dependences and run apt-get install monodevelop to get development IDE.




Reference:


Install Mono on Linux



 
0

Wednesday, April 27, 2011

Scripting Support in the .Net Applications

I was reviewing integrating Scripting Support into .Net Applications. In the current .Net Frameworks from version 1.0 to 4.0 Microsoft provided the following namespaces for enabling Scripting support.

  • Microsoft.JScript
  • MSScriptControl
  • Microsoft.VisualBasic.Vsa (obsolete)
  • Microsoft.Vsa (obsolete)

The last two Microsoft.VisualBasic.Vsa and Microsoft.Vsa are now obsolete as Microsoft is stopping their support for VB6.

In Visual Studio 2010 Microsoft extended their support for JScripts by adding debugging capability and making developer’s work easier.

MSScriptControl is an ActivX Windows Scripting Control can be used to handle VBScripts and JScripts by specifying ScriptControl.Language property as “VBScript" or “JScript”. For more information on the .Net Scripting Support follow references below.

References

JScript on MSDN
Windows Scripting
Script Happens .NET

0

Saturday, April 16, 2011

Install Joomla! 1.6 on IIS 7

In the previous post Joomla! Installing XAMPP on Vista I described installation of the XAMPP package for Windows 7 and Vista. XAMPP package installs Apache web server, MySQL database, phpMyAdmin, FileZilla FTP Server and many more. With XAMPP it is really easy to install and configure Joomla!.

In this post I will show how to install Joomla! 1.6 on IIS7 on Vista or Windows 7.  I will be performing installation on Windows 7 with no IIS installed. We will install PHP support for IIS 7, MySQL database (I will not be covering installation of Joomla! with SQL Server just yet), phpMyAdmin for maintaining databases.

In my first attempts. I tried to install Joomla! using Windows Platform installer from Microsoft/web site, which did not work completely. Installer did not install properly IIS, failed to register PHP with IIS 7, did not configure MySQL and I got mixed up with credentials for Joomla! and MySQL. My decision was to start over and  install all required components manually.

Before we begin

In my explanations of the steps below I will assume that you are familiar with installation of basic windows components. I will only note most important points of the installation. If you require detailed explanation of the some of the installs I will provide reference section with links to sites with more detailed steps.

Install IIS 7

In this step we will perform basic installation of IIS 7. Open Control Panel>Programs>Program and Features>Turn Windows Features on or off.

image

Navigate to Internet Information Services and make sure you tick it first. It will select all required modules to run IIS7. Then expand tree to navigate to Application Development Features and tick CGI. I will be also doing ASP.NET development so I ticked ASP.NET Development and this also selected .Net Extensibility and other required modules. If you do not need any of the .Net features, don’t tick it. CGI component is needed to use FastCGI module of the PHP package, which we will be installing in the step below. Click OK.

image

When installation is complete open http://localhost to see if it installed OK. You should see similar screen to one below.

image

Installing PHP support for IIS7

Now we are going to install PHP support for IIS 7. Download latest PHP windows package from php.net site.

image

Now follow installation Wizard steps.

image

In the Web Server Setup select IIS FastCGI module. Click Next.

image

I selected to install all items including Register *.php to open automatically with PHP.

image

Click Finish.

I would also suggest installing PHP Manager for IIS package. It will add PHP configuration module into IIS Console.

image

This is an example PHP configuration screen. I find it is handy when you need to do some tweaks to PHP configuration.

image

Copy Joomla! CMS files to ISS 7

In this step we are going to copy Joomla! package files into C:\inetpub\wwwroot folder and create JoomlaDev Web Application to see if we can run PHP web sites. Configuration of Joomla! site will be done after completing of the MySQL database server installation. Download Joomla! CMS package from the joomla.org site. Unzip it and copy folder to ISS7 directory C:\inetpub\wwwroot. I named folder as JoomlaDev. Open IIS Management Console. Right click Default Web Site and select Add Application.

image

Enter fields as shown above if you are using the same names. Click OK.

image

JoomlaDev Application is created. Use Browse to open the site. If everything OK you should see the screen below.

Image[46]

Install MySQL on Windows 7 or Vista

Congratulations if you got that far, but don’t get too excited as we got a little be more work to do. Now we are going to install MySQL server. I am not going to cover using Joomla! with SQL Server here. This can be a topic for future posts. We need to  download, install and configure MySQL database and phpMyAdmin package for managing databases. Get MySQL Community Server from mysql.com site. PhpMyAdmin can be downloaded from phpmyadmin.net site.

image

Run MySQL Installation Wizard.

image

Run through wizard steps and click Install at the end.

image

Leave Launch the MySQL Instance Configuration Wizard tick box on and click Finish.

image

This will open MySQL Server Instance Configuration Wizard.

image

We will go through the Detailed Configuration steps. Click Next.

image

This is a Development Machine, so this option is what we need.

image

Leave as it is on Multifunctional Database and click next.

image

Installation Path as a location for database files will be fine.

image

I do not expect a lot of connection during development work, but I like to have more options at hand so I selected Online Transaction Processing Option. You can select what is more suitable in your case.

image

All looking good. Tick Add firewall exception for this port to enable access for phpMyAdmin. phpMyAdmin uses TCP/IP connection by default. If you are worried about security you can setup phpMyAdmin to use socket connection. It is possible in our case to use socket as we are installing MySQL server on the same machine as IIS 7 web server.

image

I am developing website in English and Russian Languages so the second option is the best one for me. Click Next.

image

We will set our Database Instance Name as MySQL. I like to perform some commands in the command prompt so I also ticked Include Bin Directory in the Windows PATH.

image

Enter a password for root. This is a development database and will not be accessed outside development machine. So I did not ticked Enable root access from remote machine or Create An Anonymous Account. For build and testing servers I will use a different installation of MySQL and IIS 7. Click Next.

image

Excellent! Click Execute when you are ready.

image

We are done! Click Finish.

Install and Configure phpMyAdmin

Installation of MySQL Server is done. Now we are going to configure phpMyAdmin package, which will help us to manage MySQL Databases. If you haven’t downloaded phpMyAdmin from previous step download it from phpmyadmin.net site. Unzip package and copy it to C:\inetpub\wwwroot directory. Open IIS 7 Management Console and create new web application in a similar way how we created web application for our Joomla! install.

image

I named folder and Web Application as phpMyAdmin. After clicking OK use browse to open http://localhost/phpMyAdmin/. You will get the screen below.

image 

Enter root as username and your root password, Click Go.

image

I got in! I was really impressed that without any additional configuration phpMyAdmin detected local MySQL Server and the setup is done!

Conclusion

Congratulations ones more time on the going through this rather lengthy post. Don’t get disappointed that you do not see Joomla! configuration steps here. There are very easy and straightforward. I am planning to post Joomla! configuration steps in the future post. This and the other posts will be part of the Creating Joomla! Development Environment series. Don’t forget to check out some references for more information.

References

0