WSL2 | Windows Subsystem for Linux

Hello guys

Hope you and your loved ones are safe and secure during this tough period. I am home stuck from almost 3 months and hoping that the normality will resume very soon.

So, during the lockdown I’ve decided to take some “risks” by upgrading my production computers/laptop with the forthcoming version of Windows 10 2004 for Windows Subsystem for Linux aka WSL2 using Windows Insider preview ISO.

I work with real Linux enterprise servers at work & throughout last 10 years got myself accustomed with writing simple shell scripts and other Linux specific activities, so that I can handle them as comfortable as I interact with Windows Servers. I usually don’t get in to the silly arguments like which OS is better by comparing the features & other aspects. We never had issues with Windows Servers, neither had issues with Linux servers as we maintained them meticulously.

So, why subsystem for linux is important? Well, not many have the luxury of working with Linux servers. Especially students and developers from small business which depend completely on Windows environments. Subsystem for Linux on Windows opens doors for those who desperately need Linux environment & WSL is their friend. Unlike a virtual machine hosted on Oracle VirtualBox or VMWare, the user don’t have to dedicate hardware resources specifically for WSL & environment is always available. The only feature you may lack should be the ability to start the services automatically. Well, I am sure within a short time Microsoft will figureout a way to.

Okay, let us see how we can start availing WSL2 on Windows 10 already!

Please note, if you are not ready to take the responsibility of what you are going to do, please don’t attempt the below instructions which includes upgrading your Windows 10 version with yet to be officially released version of the same OS.

Once you upgraded your Windows 10 to version 2004

You are all ready to go. Please make sure that you have all the cumulative updates applied before proceeding.

Please note, if you are using Oracle VirtualBox on regular basis, I will suggest that you reconsider proceeding further. Enabling few of the Windows 10 features for WSL2 will completely compromise/degrade the performance of the Virtualizer and you will not even able to start your virtual machines (at times)

In order to avail the WSL2 functionality, you will have to enable few additional features of Windows 10.

I am upgrading my existing WSL to WSL2. If you are trying to configure WSL for the first time, Please refer documents explaining how to thoroughly (I have few posts towards enabling WSL with my blog, you may refer them)

You need to enable “Virtual Machine Platform” and restart the computer before upgrading WSL to WSL2.

Alternatively, you may use powershell as administrator to enable these features.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Please note, if you are using PowerShell, make sure that after enabling the features, you will restart the computer as both shell commands have /norestart switch

Once you restart the computer, you can try to upgrade your existing WSL to WSL2

Either from elevated PowerShell or CMD issue the following command

wsl --set-default-version 2

This is going to take a while, to complete. Once the upgrade has been completed you can start upgrading your existing WSL distros.

Before upgrading your WSL distros, you need to update the existing WSL kernel. Currently, you need to download and manually install the upgraded kernel, and let us hope Microsoft will include the kernel updates for WSL within their update packages.

Please visit the link https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel and follow instructions to download and install the kernel. Post installation, you can start upgrading your existing distros.

Open a command prompt as administrator and issue the following command

wsl --list --verbos

This should list all the distros you already have on your system and the corrsponding WSL version numbers associated

So, my work laptop has 2 distros and both are already upgraded to WSL2. Regardless, let us see how we can upgrade an existing WSL1 distro to WSL2

Consider my distro listing was showing VERSION information as “1” instead of “2”, then I would have issued the following command to upgrade my Ubuntu-18.04 distro

wsl --set-version Ubuntu-18.04 2

That’s all. Your distro will be upgraded to version 2.

My personal takes on WSL2

Well, my interest towards new features are limited to getting them installed and configured. I’ve had very limited handson with the upgraded Ubuntu distro and I was able to have a buttery smooth experiece with XRDP this time. To my utter surprise, Mozilla Firefox loaded without crashing & I felt I was truly interacting with a real Linux machine.

Please refer my previous posts towards WSL about installing XRDP, MySQL and other software those are usually configured on Linux environments.

Guys, almost every other tip and tricks I have listed are coming from many sites and I encourage you to visit those sites for further reading. All I have done was to put them in single place and to post this consolidated thread.

https://docs.microsoft.com/en-us/windows/wsl/install-win10

https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel

https://www.bleepingcomputer.com/news/microsoft/windows-10-2004-to-upgrade-wsl2-linux-kernels-via-windows-update/

I will be investing more time for WSL2 once after I get back to Office & hoping to post more interesting stuffs based on my findings. Until then, please stay safe and healthy.

regards,

rajesh

MS SQL | Backup remote database on local machine

Hi guys

At times we have to have a recent backup of the SQL database on a development machine to insure that our testing is false-proof prior the same is pushed to a production instance. As SSMS (SQL Server Management Studio) doesn’t allow remote backup functionality out of the box, we can try the following (applies to both home networks and windows domain networks)

From your local machine, setup a shared folder, giving full read/write access to the entity “Everyone”

Now, prior attempting below instructions, be sure of your privileges against the target database. Are you a sys admin? Does your database account have the rights to make a backup? If yes, go ahead

Now, start SSMS & proceed with the backup task

Depending upon the security constraints, you may disable the sharing of local folder immediately after the backup completion.

regards,

rajesh

MS SQL 2019 | Upgrade/Fresh Installation

Hi guys

My laptop has many software development components installed, say few of them are there from last many years (regardless whether I still need them) & such get me in to complicated situations (most of the times)

I’ve had Visual Studio 2013 Professional edition installed for last many years & recently I have switched to the community edition (which is as good as pro edition & costs nothing)

After upgrading my SQL Server 2017 (Developer Edition) on my home computer using 2019 ISO mounted media, I decided to upgrade the SQL Server 2017 on my laptop and it failed, miserably!

So I decided to do a fresh installation, that also failed. Luckily I came across the following thread:

https://techcommunity.microsoft.com/t5/sql-server-support/sql-server-2019-installation-error-an-error-occurred-for-a/ba-p/998033#

While, there could be more reasons for the failure to install/upgrade your existing SQL server, make sure whether you have “Microsoft SQL Server 2012 Native Client” already installed, if yes, remove it (Which might popup a warning stating the dependency of Local DB 2016 on the Native client, hence make sure that you know what you are doing)

Once the 2012 Native client uninstalled, try again to upgrade/fresh installation of SQL Server 2019.

You should be through!

regards,

rajesh

ASP.Net | Freeze GridView header row using java script & CSS

Hi guys

As I started developing a web application for our business, One of the toughest requirements from end users were to “freeze” the header row of data grid views. I left .Net development almost 11 years back and was struggling to catch up with the whole set of changes .Net has came up with.

I’ve scavenged through dozen’s of articles explaining different hacks to freeze/lock the header row of grid views & was surprised to see that Microsoft didn’t address this requirement throughout their .Net iterations. Few of the workarounds those I tried out were ONLY applicable to static set of data, not at all applicable to data grids those have more than three or four columns and failed while column contents exceeded certain number of characters.

Finally, after a number of days’ search & trying out various solutions I came across a post at https://www.aspsnippets.com/Articles/Dynamically-freeze-ASP.Net-Gridview-header-using-JavaScript.aspx

The post has a VS solution download (Dated 21st February 2011) which was giving me multiple reference errors while opened with VS 2019 Community edition. So I decided to open the .aspx and code behind pages manually and create a new solution using VS 2019

Although the java script does freeze the header rows (while no themes applied to the grid & has limited columns), the moment a theme applied to the grid, the header row alignment with the data columns go for a toast. You will able to see how it works with attached example that you can download from the provided link by the bottom of the post.

I’ve created a huge employee list with 20 columns, where few of the columns have varying data lengths (like employee name, department, section name & job positions) as an XML source and throughout the examples I will be using the same data source to demonstrate how each page adjusts the GridView with minor hacks using both java script and CSS styling.

Example one, no java script, no themes gridview

Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="FreezeGridViewHeader.Default" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                <Columns>
<asp:BoundField DataField="EmployeeNumber" HeaderText="Code" />
<asp:BoundField DataField="fullname" HeaderText="Name"  />
<asp:BoundField DataField="department" HeaderText="Department"  />
<asp:BoundField DataField="section" HeaderText="Section"  />
<asp:BoundField DataField="position" HeaderText="Position"  />
<asp:BoundField DataField="basicsalary" HeaderText="Salary"  />
<asp:BoundField DataField="other" HeaderText="other"  />
<asp:BoundField DataField="petrol" HeaderText="petrol"  />
<asp:BoundField DataField="mobile" HeaderText="mobile"  />
<asp:BoundField DataField="car" HeaderText="car"  />
<asp:BoundField DataField="transport" HeaderText="transport"  />
<asp:BoundField DataField="sign" HeaderText="sign"  />
<asp:BoundField DataField="house" HeaderText="house"  />
<asp:BoundField DataField="acco" HeaderText="acco"  />
<asp:BoundField DataField="driving" HeaderText="driving"  />
<asp:BoundField DataField="monthly" HeaderText="monthly"  />
<asp:BoundField DataField="oncall" HeaderText="oncall"  />
<asp:BoundField DataField="engineer" HeaderText="engineer"  />
<asp:BoundField DataField="special" HeaderText="special"  />
<asp:BoundField DataField="total" HeaderText="total"  />
</Columns>
            </asp:GridView>

        </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FreezeGridViewHeader
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/App_Data/employees.xml"));
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }

          
        }
    }
}

Executing Default.aspx brings up a page like below

Now, we will use the java script to see how far the intended results are achieved.

Example Two, Calling java script function to freeze the header row

Gridjs.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Gridjs.aspx.cs" Inherits="FreezeGridViewHeader.Gridjs" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="FreeGrid.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
                <AlternatingRowStyle BackColor="#DCDCDC" />
                <Columns>
                    <asp:BoundField DataField="EmployeeNumber" HeaderText="Code" />
                    <asp:BoundField DataField="fullname" HeaderText="Name" />
                    <asp:BoundField DataField="department" HeaderText="Department" />
                    <asp:BoundField DataField="section" HeaderText="Section" />
                    <asp:BoundField DataField="position" HeaderText="Position" />
                    <asp:BoundField DataField="basicsalary" HeaderText="Salary" />
                    <asp:BoundField DataField="other" HeaderText="other" />
                    <asp:BoundField DataField="petrol" HeaderText="petrol" />
                    <asp:BoundField DataField="mobile" HeaderText="mobile" />
                    <asp:BoundField DataField="car" HeaderText="car" />
                    <asp:BoundField DataField="transport" HeaderText="transport" />
                    <asp:BoundField DataField="sign" HeaderText="sign" />
                    <asp:BoundField DataField="house" HeaderText="house" />
                    <asp:BoundField DataField="acco" HeaderText="acco" />
                    <asp:BoundField DataField="driving" HeaderText="driving" />
                    <asp:BoundField DataField="monthly" HeaderText="monthly" />
                    <asp:BoundField DataField="oncall" HeaderText="oncall" />
                    <asp:BoundField DataField="engineer" HeaderText="engineer" />
                    <asp:BoundField DataField="special" HeaderText="special" />
                    <asp:BoundField DataField="total" HeaderText="total" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#0000A9" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#000065" />
            </asp:GridView>
            <script type="text/JavaScript">
                window.onload = function () {
                    this.FreezeGrid("<%=GridView1.ClientID %>",500);

                }
            </script>
        </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FreezeGridViewHeader
{
    public partial class Gridjs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/App_Data/employees.xml"));
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
        }
    }
}

I’ve applied one of the built-in themes available for GridView control with the above example, which causes the header and data rows misalignment.

However, the java script has done what it was meant to do! Freezing the header row and providing a scrolling function without breaking much sweat. I have noticed one thing, if the theme is removed from the GridView control, everything goes back to as expected, header row is perfectly aligned with the data row & the scrolling works as expected. Please note, if your grid is populated with huge volume of data, then it will take few moments before the java script manages to bring up the effects in place. I’ve tested this solution using Microsoft Edge Chromium, Mozilla Firefox & Internet Explorer. Both the modern browsers deal with the java script much efficiently while Internet Explorer experiences were NOT that good.

Example Three, fixing the misalignment issues by using some simple CSS styling.

Gridjscss.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Gridjscss.aspx.cs" Inherits="FreezeGridViewHeader.Gridjscss" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="FreeGrid.js" type="text/javascript"></script>
    <style>
        .Colsmall {
            width: 60px;
            max-width: 60px;
            min-width: 60px;
        }

        .Colmedium {
            width: 80px;
            max-width: 80px;
            min-width: 80px;
        }

        .Colbig {
            width: 150px;
            max-width: 150px;
            min-width: 150px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
                <AlternatingRowStyle BackColor="#DCDCDC" />
                <Columns>
                    <asp:BoundField DataField="EmployeeNumber" HeaderText="Code" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" />
                    <asp:BoundField DataField="fullname" HeaderText="Name" ItemStyle-CssClass="Colbig" HeaderStyle-CssClass="Colbig" />
                    <asp:BoundField DataField="department" HeaderText="Department" ItemStyle-CssClass="Colbig" HeaderStyle-CssClass="Colbig" />
                    <asp:BoundField DataField="section" HeaderText="Section" ItemStyle-CssClass="Colbig" HeaderStyle-CssClass="Colbig" />
                    <asp:BoundField DataField="position" HeaderText="Position" ItemStyle-CssClass="Colbig" HeaderStyle-CssClass="Colbig" />
                    <asp:BoundField DataField="basicsalary" HeaderText="Salary" ItemStyle-CssClass="Colmedium" HeaderStyle-CssClass="Colmedium" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="other" HeaderText="other" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="petrol" HeaderText="petrol" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="mobile" HeaderText="mobile" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="car" HeaderText="car" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="transport" HeaderText="transport" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="sign" HeaderText="sign" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="house" HeaderText="house" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="acco" HeaderText="acco" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="driving" HeaderText="driving" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="monthly" HeaderText="monthly" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="oncall" HeaderText="oncall" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="engineer" HeaderText="engineer" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="special" HeaderText="special" ItemStyle-CssClass="Colsmall" HeaderStyle-CssClass="Colsmall" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField DataField="total" HeaderText="total" ItemStyle-CssClass="Colmedium" HeaderStyle-CssClass="Colmedium" ItemStyle-HorizontalAlign="Right" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                <SortedAscendingCellStyle BackColor="#F1F1F1" />
                <SortedAscendingHeaderStyle BackColor="#0000A9" />
                <SortedDescendingCellStyle BackColor="#CAC9C9" />
                <SortedDescendingHeaderStyle BackColor="#000065" />
            </asp:GridView>
            <script type="text/JavaScript">
                window.onload = function () {
                    this.FreezeGrid("<%=GridView1.ClientID %>", 500);

                }
            </script>
        </div>
    </form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace FreezeGridViewHeader
{
    public partial class Gridjscss : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataSet ds = new DataSet();
                ds.ReadXml(Server.MapPath("~/App_Data/employees.xml"));
                GridView1.DataSource = ds;
                GridView1.DataBind();
            }
        }
    }
}

Now, everything looks fine! A theme is applied, header and data rows are in perfect sync & the header row is locked when the data rows are scrolled up and down.

There are many alternatives, modern approaches using jQuery and other, which I do not understand at this point of learning. Once I am confident enough to, will sure try them and get back to you guys. Happy coding!

Download VS Solution

Please note, this solution has been developed using .Net 4.7.2 & I have modified the java script in a way that I can call the script from any page by passing couple of parameters to it. The whole credit for the java script goes to original coder.

regards,

rajesh

Transact SQL | Virtual Calendar

Hello guys

We’re integrating MS SQL servers everywhere for our business along with long trusted technology partner Oracle & will try to include what we have “learned” in our labs within this blogosphere.

Our bio metric attendance system reports are designed with virtual dates (weekends when the employees are not punching, yet the reporting requires the whole month dates appearing in the final output, marking the date and day name for the date) from a virtual calendar created using connect by level pseudocolumn

CREATE OR REPLACE FORCE VIEW XXFPAUTOCALNDR_V
(
   EMPLOYEE_NUMBER,
   DAY_DATE,
   PUNCH_PERIOD
)
AS
       SELECT NULL EMPLOYEE_NUMBER,
              TRUNC (TO_DATE ('01-JAN-2009', 'DD-MON-YYYY') + LEVEL) day_date,
              TO_CHAR (TRUNC (TO_DATE ('01-JAN-2009', 'DD-MON-YYYY') + LEVEL),
                       'MMYYYY')
                 punch_period
         FROM DUAL
   CONNECT BY TO_DATE ('01-JAN-2009', 'DD-MON-YYYY') + LEVEL <=
                 LAST_DAY (TRUNC (SYSDATE));

Well, MS SQL doesn’t provide connect by level approach, instead recursive CTE (common table expression) & let us see how we can create a virtual calendar using CTE on MS SQL

CREATE VIEW UnisVCalendar
as
WITH CTE(virtual_date) AS (
  SELECT cast('1/1/2016' as datetime) as virtual_date
  UNION ALL
  SELECT virtual_date+1
  FROM CTE 
  WHERE virtual_date <= GETDATE() 
)
SELECT * FROM CTE
GO

CTE allows referring the table itself, thus indirectly providing a level sort of reference.

Well, the downside of such a virtual calendar is, one should make sure that to use option(maxrecursion 0) to avoid “The maximum recursion 100 has been exhausted before statement completion” error

Select CONVERT(date,virtual_date,105) from UnisVCalendar
WHERE CONVERT(date,virtual_date,105) BETWEEN '01-JAN-2020' AND '31-JAN-2020'
option (maxrecursion 0)
GO

Now you can safely refer this virtual calendar at applicable situations.

Featured

We are going COM

Hello guys

We just completed 10 years of blogging with WORDPRESS & it was a great experience! Although we’ve started the blog ONLY to vent out our frustrations with Windows 7 OS, over the years we’ve discussed many other technology areas.

Well…err hmm, about many things those WERE not significant at all, however many of you have seen them ;) . Now you may ask why switching from a life long free blog to a COM (commercial site). Answer is simple, WE are going to have few advertisements running over the blog, which might fetch us some income!

We’ve been enthusiastically doing many charities and currently planning to setup an educational fund for under privileged expat students in Kuwait. We will utilize every penny that comes through the ads for this purpose.

So if you find an interesting ad on our pages, please check them out. We’ve never commercialized any of our efforts & will remain to provide you the hacks/solutions free.

regards,

Windows 10 | Mobile HotSpot| We (don’t) have a solution

Hello guys

Cannot get the mobile HotSpot fully functional on Windows 10? Were you searching for a single stop solution, then you are at a very wrong place(?) move on. We are going to discuss about a strange behavior associated with, else almost a perfect solution provided by Microsoft for tethering the available internet connectivity.

At our corporate LAN, we use two different sets of IP addresses. One provided by the ISP (front facing) and the Class C IP addresses for the domain member computers and other devices.

We had a sysadmin laptop that is configured to use internet without filtering (AKA Watch Guard Edge device) by letting the traffic through the ISP router & a Class C IP address for LAN connectivity. Most of the sysadmins use the same settings for ease and had some difficulties with this particular laptop.

Mobile HotSpot starts, however the connected devices do not get IP addresses issued and no internet connectivity. Resetting IP & Winsock and windows provided troubleshooters didn’t fix anything & on a “divine” call we decided to change the IP addresses used.

For example, We had

168.x.x.204/255.255.255.224 (ISP) and 131.x.x.46/24 (LAN, don’t frown, we had these public IP ranges used within the LAN, dating back to 1990s) for the single network interface which didn’t work for Mobile HotSpot, so we changed the ISP IP address with an IP from another set of readily available public IPs and viola! the Mobile HotSpot sprang to life immediately.

We did route table matches between both IP settings and couldn’t find any differences, however, the first setup completely failing to issue IP addresses & connectivity. As we failed do the maths, gave it a rest and started “enjoying” the internet. Yay! So if you are in the same situation and have spare IP addresses, give it a try.

regards,

rajesh

Oracle SQL Developer 19.x.x & ORA-20001: Oracle error -6502: ORA-06502: PL/SQL: numeric or value error: character string buffer too small has been detected in fnd_global.set_nls

Hi guys

Okay, so you switched to Oracle SQL Developer for the main reason that the suite is from Oracle & it is absolutely free and putting loads of efforts to get accustomed with certain “JAVA” platform limitations (as per developers).

Everything is fine until you start getting “ORA-20001: Oracle error -6502: ORA-06502: PL/SQL: numeric or value error: character string buffer too small has been detected in fnd_global.set_nls” or errors those WERE never happening while you were trying to execute years old PL/SQL blocks which were always completing successfully using Quest TOAD or at SQL prompt itself.

Before scavenging through your archives to find the Toad Installer for a re-installation, give the following exercise a try.

Applicable to Windows ONLY!

Go to user specific “AppData\Roaming” folder, eg: C:\Users\rajesh\AppData\Roaming

and delete both the folders, “SQL Developer” & “sqldeveloper”

Usually whenever you download and start the latest version of SQL Developer, the new version checks for the older versions under Roaming profile & if found, prompts the user asking whether the existing preferences should be copied (that includes already saved connections and other setting you may have made), which may cause errors like the ONE I have had once after migrating 19.2.x to 19.4.x

Regardless whether you were using previous versions or NOT, deleting all folders for “SQL Developer” under the roaming profile will force the latest version of Oracle SQL Developer to start afresh & most probably will take care of unreliable error messages (Confirmed by running the PL/SQL blocks without outputting the same errors using Quest TOAD)

Thank me later ;)

rajesh

Mitel | E1 Trunk noise issues after MiVoice Business Upgrade

Recently we faced an issue with our Mitel IP telephony system after upgrading from version 7 to 8, then to 9.

We’ve Nortel (Currently Avaya) legacy digital telephony system across our businesses and the Mitel IP telephony was implemented with an intention to roll out IP based telephones. Somehow, the solution was partially implemented, forcing us to integrate two different technologies, so that we can make and receive calls from and to both systems.

The digital trunk was created using E1 interface card and everything was working until the software upgrade. We started experiencing a kind of annoying noise, almost impossible to hear the other party & our support partner from Mitel spent 3 weeks trying to figure out what went wrong after the software upgrade.

After 3 weeks of involving different “engineers”, they gave us 3 different possibilities for the noise:

  • Controller’s motherboard have issues
  • Controller’s hard disk is having issues
  • LAN is having bad POE switches

We’ve downgraded from version 9 to 8, “successfully” inheriting the noise issues & and we had a new problem in addition to the noise issues. Handsets started reloading the application once in 2-3 minutes. This is the time we (internal IT team) decided to intervene.

We’ve identified the application reload was happening due to a power failure, which resulted in the IP address used by the Layer 2 (L2) Switch being issued to one of the PCs in the network as it was not excluded with DHCP scope. After spending couple of hours being assigned to address this situation, support partner concluded that “it looks like a hard disk failure”

We took over & started checking for the IPs assigned to the controller and found that it was merely an IP conflict and fixed the reloading issues by releasing the IP (added an exclusion scope with the DHCP server to avoid future conflicts)

However, we had the bigger issue still not resolved, about the noise. As we realized that the support partner is JUST making vague and unrealistic conclusions, requested for the details about codecs and the settings for trunks, which they happily shared with us.

By default, the codec settings for our controller running version 8 has values as seen with the below image.

We toggled all the switches (allowed ones) to No first (Saved), then Yes (Saved) followed by the default settings (refer the image)

Went ahead to “Trunks -> Digital -> Digital Link Descriptors” & re-assigned Voice Encoding to “ADI” (Which the “engineers” set as Nil during their extended support efforts)

Saved the changes and 3 weeks long noise issues were gone in a second.

Although we can’t confirm (technically), it looks like the backup restore after the software upgrade somehow interferes with the codec filtering that needed a manual intervention like the one we did by toggling the switches to NO and Yes & defaults under Codecs section.

If you were frantically searching for solution such a situation like ours, before falling victim to your support partner’s offer to replace the current controller for a discounted price like 4000$, please spend a moment to give what we have tried and succeeded a try.

regards,

Oracle Application R12 | Print custom report using CUSTOM.pll

Hello guys,

Happy New Year!

Today we will see how we can use CUSTOM.pll for enabling special menus and printing a custom report by invoking the special menu that we activate using the library.

We are going to use Oracle’s seeded form “POXPOEPO” AKA Purchase Orders.

Please make sure that you make a backup for the CUSTOM.pll prior making below said modifications. CUSTOM.pll is “always” found uner $AU_TOP/resources folder

We’ll enable the SPECIAL15 menu item for the exercise.

Load up CUSTOM.pll using Oracle Forms Designer & make sure you are connected to database before loading the library file.

Attach APPCORE, APPCORE2 libraries with your copy of CUSTOM.pll

Attach FNDCONC.pll library for calling printing related activities

Your CUSTOM.pll should look like the above after attaching said libraries.

Add the block as seen with the image by the bottom of your CUSTOM.pll package body.

BEGIN
  IF (event_name = 'WHEN-NEW-FORM-INSTANCE') THEN
     IF (l_form_name = 'POXPOEPO' AND l_block_name = 'PO_HEADERS') THEN	 
    -- 	fnd_message.debug(l_form_name);
     	app_special2.instantiate('SPECIAL15', '&Print', 'prord',TRUE,'LINE');
     END IF;
  END IF;
  
END;

Now you can proceed with writing code for what happens when “SPECIAL15” event happens

BEGIN
  IF (event_name = 'SPECIAL15') THEN
     IF (l_form_name = 'POXPOEPO' AND l_block_name = 'PO_HEADERS') THEN	 
     	print_po(name_in('PO_HEADERS.ORG_ID'),name_in('PO_HEADERS.SEGMENT1'));
     	--fnd_message.debug('Will Print This Order');
    --app_special2.instantiate('SPECIAL15', '&Print', 'prord',TRUE,'LINE');
     END IF;
  END IF;
  
END;

Here, I am calling a procedure that I defined with CUSTOM.pll for handling print requests.

and the package body is as following (not another image, I am going to save some efforts for you)

procedure print_po(p_org_id IN NUMBER, p_order_number IN VARCHAR2) is
		l_ord_num               NUMBER := 0;
		l_ord_type_name         VARCHAR2 (240);
		l_req_id_Rep            NUMBER;
		l_request_completed     BOOLEAN := FALSE;
		l_req_phase             VARCHAR2 (20);
		l_req_status            VARCHAR2 (1000);
		l_req_dev_phase         VARCHAR2 (1000);
		l_req_dev_status        VARCHAR2 (1000);
		l_req_message           VARCHAR2 (1000);
		l_conc_mgr_status       NUMBER;
		p_call_stat             NUMBER;
		p_activep_stat          NUMBER;
		
		l_order_category_code   NUMBER;
		l_report_name       VARCHAR2 (40);
		l_ret_report_name       VARCHAR2 (40);
		l_req_id 								NUMBER;
		l_order_type_name				VARCHAR2(30);
		
		--
		
		l_signing_person VARCHAR2(240);
		l_person_designation VARCHAR2(240);
		
		
BEGIN
--fnd_message.debug('Will Print This Order');

/*This is a custom procedure that checks whether the concurrent manager is online or not, you can safely comment this line
   --Check the status of Concurrent Manager
   apps.xx_conc_mgr_status_p (p_call_stat, p_activep_stat);


   IF p_call_stat <> 0
   THEN
      fnd_message.set_string ('Concurrent Manager Status Unknown');
      fnd_message.show;
   ELSE
      IF p_activep_stat > 0
      THEN
         NULL;                       --Message('ICM is running' || l_activep);
      ELSE
         fnd_message.set_string (
            'Concurrent Manager is down, Please try printing the invoice later');
         fnd_message.show;
         RAISE form_trigger_failure;
      END IF;
   END IF;

   --Checking concurrent manager status end----
 --  MESSAGE ('Concurrent manager status: up & running');
*/

 BEGIN
/* I am picking up the reports names (concurrent_program_name from FND_CONCURRENT_PROGRAMS_VL view as we have different layouts for companies
you can set up a value for l_report_name while variable is defined
---
--
   SELECT execution_file_name,STRING1, STRING2
     INTO l_report_name, l_signing_person, l_person_designation
     FROM omspoprintreg
    WHERE 1 = 1 AND organization_id = p_org_id
          AND TRUNC (SYSDATE) BETWEEN start_date_active
                                  AND NVL (end_date_active, SYSDATE);
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      fnd_message.set_string (
         'No reports defined for this type of transaction, Please contact OM Super User');
      fnd_message.show;
      RAISE form_trigger_failure;
END;

--   FND_MESSAGE.DEBUG('Printing Order '||p_org_id||' order number '||p_order_number);
*/
--
--   
   l_req_id :=
      fnd_request.submit_request ('PO',
                                  l_report_name,
                                  NULL,
                                  SYSDATE,
                                  FALSE,
                                  P_ORG_ID,
                                  P_ORDER_NUMBER, 
                                  l_signing_person,
                                  l_person_designation,
                                  chr(0));
--You cannot setup :SYSTEM.MESSAGE_LEVEL within CUSTOM.pll, hence use COPY 
--to suppress messages like 'Two records saved'

   COPY('25','SYSTEM.MESSAGE_LEVEL');
   COMMIT;
  
  -- FND_MESSAGE.DEBUG('Your request id is '||l_req_id);


   l_request_completed :=
      fnd_concurrent.wait_for_request (request_id   => l_req_id,
                                       INTERVAL     => 1,
                                       phase        => l_req_phase,
                                       status       => l_req_status,
                                       dev_phase    => l_req_dev_phase,
                                       dev_status   => l_req_dev_status,
                                       MESSAGE      => l_req_message);
  --:SYSTEM.Message_Level := '25';
  COMMIT;
  editor_pkg.report (l_req_id, 'Y');

end print_po;

That’s it!

Now copy the CUSTOM.pll to $AU_TOP/resources & compile it

frmcmp_batch module=CUSTOM.pll userid=apps/apps output_file=CUSTOM.plx module_type=LIBRARY batch=yes compile_all=special

If you don’t have syntax errors or other, you must have the fresh CUSTOM.pll

Please make sure that no users are currently online while you are compiling the CUSTOM.pll (This is only applicable to cases where the CUSTOM.pll is already deployed for different forms)

Log on to the instance, access Purchase Orders form & you should see a new menu item under “Tools” menu enabled

While CUSTOM.pll implements “editor_pkg.report” by attaching FNDCONC.pll, FORMS personalization will fail to provide the same functionality as most of the seeded forms do not have FNDCONC library attached to them by default. If you don’t want to use editor_pkg.report to open the completed report, you may create a database level procedure to submit the request(s) and call the same against SPECIAL(n) menu item through FORMS personalization.

Enjoy!

rajesh