Posting Code Blocks with your free WordPress Blog

February 27, 2015

Please visit https://en.support.wordpress.com/code/posting-source-code/ for detailed information about how to post source code blocks with your free wordpress.com blog.
A tip from me: Have a look at the source code of wordpress support page opened ;) you “MAY” get more ideas. Okay I didn’t say that!
Let us look at some samples:

1

Will produce the below, syntax highlighted code block for you

your code here

2

Refer the above image, the usage of additional tags within the code tag will syntax highlight a short VB script, avoiding the gutter (line numbers)

Public Class Form1
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim xmlFile As XmlReader
        xmlFile = XmlReader.Create("MyVMS.xml", New XmlReaderSettings())
        Dim ds As New DataSet
        ds.ReadXml(xmlFile)
        DataGridView1.DataSource = ds.Tables(0)
        DataGridView1.Columns(0).HeaderText = "Id"
        DataGridView1.Columns(1).HeaderText = "VM Name"
        DataGridView1.Columns(2).HeaderText = "Shutoff Mode"
  
    End Sub
End Class

Avoid leaving spaces between tags inside “code” tag, as doing so could totally mess-up the code blocks. Just put everything tightly spaced like following

language=”VB” gutter=”false”, there are no spaces between language & = or = & the opening ”

The language (or lang) parameter controls how the code is syntax highlighted. The following languages are supported:

  • actionscript3
  • bash
  • clojure
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • html
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • vb
  • xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Configuration Parameters

The shortcodes also accept a variety of configuration parameters that you may use to customize the output. All are completely optional.

  • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
  • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
  • firstline (number) — Use this to change what number the line numbering starts at. It defaults to 1.
  • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true.
  • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example “4,7,19”.
  • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
  • light (true/false) — If true, the gutter (line numbering) and toolbar (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
  • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
  • title (string) — Set a label for your code block. Can be useful when combined with the collapse parameter.

regards,

rajesh


Windows7bugs | Script Copying Instructions

November 9, 2014

Hello guys

Once in a while we receive complaints about scripts copied from our blog causing issues. We regret those issues and apologizing to everyone who suffered due to. Our blog is totally free until date and unfortunately, different browsers behave differently while parsing the code tags.

We were using

 [ code ] [ /code ]

tag for long time, found that few scripts getting totally messed up with double quotes being showsn and &quote etc. This has forced us to start using

[ sourcecode ] [ /sourcecode ] 

and realized if we have more than one block of scripts, the 2nd and consecutive scripts blocks being totally garbled.

With reference to above said, we request you to kindly make sure that the scripts those you copy from our posts are thoroughly checked for special characters prior applied. Especially registry related scripts as such attempts could completely wreck your Windows registry databases.

We hope you read us clearly and continue supporting us.

Regards,


Visual Studio 2013 | HRESULT 0x80070002 exception

March 2, 2015

Scenario

A brand new installation of Visual Studio 2013

You are trying to create a new project/solution and immediately after choosing the type of the application (eg: Single page web application) an error raised saying referenced file cannot be found, followed by the error code HRESULT 0x80070002

Solution

Go to http://docs.nuget.org/consume/installing-nugget

Select the build of your Visual Studio NuGet client and move to the download page

Download the package (After closing down the Visual Studio, if yet open) and install the package

Restart Visual Studio and the error must have been gone by now.

Happy Programming guys ;)

regards,

rajesh


Teaser | Visual Studio | VB.Net & Oracle Database

March 2, 2015

t1

Okay, my last few posts were all about VB.Net & utilities for Windows domain administrators. Doesn’t mean that I stopped being a Oracle bouy ;) I still earn my salary for the Oracle job I do everyday at work and once after managing to purchase a legal copy of Visual Studio 2013 Professional Edition, I am committed to develop few sample applications using VB.Net & Oracle database.

So, stay tuned

regards,

rajesh


VB.Net | Appending an existing XML file

February 23, 2015

VB.Net | Appending an existing XML file

XML is widely used by .net oriented programming. It is vast and learning XML could be requiring loads of dedication. I needed to add a XML file to hold certain configuration details that could be read with one of the VB.Net projects currently I am busy with. This project deals with running Oracle VirtualBox VM(Virtual Machines) headless using a Windows Service as Local System so that multiple administrators could log in and log off from the Windows Server that hosts Virtual machines without closing down the machines abrupt (This project is ongoing, half cooked)

Without wasting more time, let us see how to append an “existing” XML file using VB.Net

Create a Windows Form Project
Create a XML file (MyVMS.xml) using your favorite text editing tool and copy the below

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<VM>
<MACHINE>
    <MACHINE_ID>1</MACHINE_ID>
    <VM_NAME>MyVM</VM_NAME>
    <VM_SHUTDOWNMODE>poweroff</VM_SHUTDOWNMODE>
  </MACHINE>
</VM>

and copy the XML file to the project root folder

Add the namespaces to your new project

Imports System.Xml
Imports System.Data

As I said in the beginning, we will be adding data to an “existing” XML file, hence the XML files must have a root element, for example

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<VM>
</VM>

Drag a button to your forms1.vb design view
Drag another button to your forms1.vb design view
Drag a DataGridView to your forms1.vb design view

Now we will try to add one more “MACHINE” node into the existing XML file using VB.Net code block

Public Class Form1
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim xmldoc As New XMLDocument()
        Try
            xmldoc.Load("MyVMS.xml")
            Dim e1 As XmlElement = xmldoc.CreateElement("MACHINE")
            Dim e2 As XmlElement = xmldoc.CreateElement("MACHINE_ID")
            e2.InnerText = "2"
            Dim e3 As XmlElement = xmldoc.CreateElement("VM_NAME")
            e3.InnerText = "Linux"
            Dim e4 As XmlElement = xmldoc.CreateElement("VM_SHUTDOWNMODE")
            e4.InnerText = "savestate"
 
            e1.AppendChild(e2)
            e1.AppendChild(e3)
            e1.AppendChild(e4)
 
            xmldoc.DocumentElement.AppendChild(e1)
            xmldoc.Save("MyVMS.xml")
 
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
 
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim xmlFile As XmlReader
        xmlFile = XmlReader.Create("MyVMS.xml", New XmlReaderSettings())
        Dim ds As New DataSet
        ds.ReadXml(xmlFile)
        DataGridView1.DataSource = ds.Tables(0)
        DataGridView1.Columns(0).HeaderText = "Id"
        DataGridView1.Columns(1).HeaderText = "VM Name"
        DataGridView1.Columns(2).HeaderText = "Shutoff Mode"
 
    End Sub
End Class

Now, as you click on the first button, a new node for “MACHINE” will be inserted using the static information attached & by activating the second button, your data grid view should populate the MACHINE information already stored within the XML file.

Pretty simple & easy, right? You may rush ahead and say thanks to my dearest friend and ONE of the best .Net programmers Aziz Marafi / @azizane , who had coded majority of the block above for the “FileMyster” project.

Please post your comments and queries and I may learn few more things with you!

regards,

rajesh


VB.Net | Get IP address of a computer against hostname | Fun projects

February 11, 2015

Credits: http://stackoverflow.com/questions/19713868/returning-ipv6-instead-of-ipv4-in-vb

How to?

Open Visual Studio IDE (We are using VS 2012 Express and the .Net framework is 4.5 by default, hence if few things do not work at your setups, please cross check the specs we specified) and create a Windows form application. We’ll be mostly doing our samples using forms, a better mechanism to test stuffs against console applications (Minimum from our experiences)

drag a button to the form

drag a listbox to the form

& do not change any property for any of the above items

right click on the form and select view code, once the code page opens
Ctrl+A (Select all and delete)

copy and paste the below code block (replacing the original content of the code page)

Imports System.Net

Public Class Form1
    Public Function getip(ByVal lst As ListBox) As ListBox
        Dim hostEntry = Dns.GetHostEntry("hostname")
        Dim addressList As New List(Of IPAddress)

        For Each address In hostEntry.AddressList
            If address.AddressFamily = Sockets.AddressFamily.InterNetwork Then
                lst.Items.Add(address)
            End If
        Next
        Return lst

    End Function

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        getip(ListBox1)
    End Sub
End Class

Now replace the “hostname” with some actual hostnames and execute the application by pressing F5. Click the button over the form you are done! Please note, this sample is restricted to fetch IPV4 addresses.


Weblogic Server 10.3.6 64Bit on Windows | Difference between 32Bit Installation(s)

January 24, 2015

https://windows7bugs.wordpress.com/2013/04/06/install-configure-oracle-weblogic-server-10-3-6-forms-reports-11g-on-windows8windows-2008-r2/

Was one of our maximum sought posts & recently I decided to go for a fresh installation of Weblogic 10.3.6 64Bit installation + Forms & reports 11g R2 64Bit. We repeat one of the best articles explain how to is available here and what we are going to provide you additional is few of the things those are different from a typical 32Bit installation.

JDK 8 is not supported (Or my two attempts didn’t bring any fruits)

Node Manager Windows service installation is not offered during the normal/custom installations. That means you MUST install the node manager service by running the .cmd file provided. Default location for the .cmd file is …\wlserver_10.3\server\bin and the file name is “installNodeMgrSvc.cmd”. You should execute this .cmd file from an elevated command prompt!

If you prefer to install a service for Admin server, we have altered the script a little bit and please find it below.

echo off

SETLOCAL

set DOMAIN_NAME=ClassicDomain

set USERDOMAIN_HOME=D:\WebLogic\user_projects\domains\ClassicDomain

set SERVER_NAME=AdminServer

set WL_HOME=D:\WebLogic\wlserver_10.3

set WLS_USER=weblogic

set WLS_PW=pass123

set PRODUCTION_MODE=true

set MEM_ARGS=-Xms512m -Xmx512m

call "%USERDOMAIN_HOME%\bin\setDomainEnv.cmd" 

call "%WL_HOME%\server\bin\installSvc.cmd"

ENDLOCAL

I really hope the above tips will make your Weblogic installation more enjoyable.

regards,

rajesh


VB.Net | Active Directory | Windows Form Application for listing users & details in a grid view

January 15, 2015

Have you read our previous post about finding last logon date time value for a domain member computer or user yet? If not, please read about it here

Now, we are going to provide you a decent (Warning: Amateurish code blocks possible) Windows forms based application that could list all your domain users and few of their details including last logon date time values.

run

Above image demonstrates the run time interface of the application. Application has a search textbox, that could accept values before and after the user details are populated.

Before the population, the users will be limited to matching string, after population, the list could be refined against the combination of keystrokes

Mandatory References as seen with the below image

ref

You can download the solution from here

regards,

rajesh


Follow

Get every new post delivered to your Inbox.

Join 53 other followers