Creating PDFs using Microsoft Word

August 13, 2017

Hi guys

Many great websites like “oracle base” let you copy the content from their site, so that you can make documents for offline references. Obviously, you need to copy, paste make sometimes format a bit here and there so that the document finally becomes worth keeping.

One of the major issues with most of the free PDF printers is the lack of ability to include the embedded urls. Once you find an interesting article and use a free PDF printer like “PDF Creator”, you will realize that whole the book marked urls are lost other than the links starting with http:// or www

With the recent versions of Microsoft Word software (Office 2010 & later) , Microsoft lets the users to save a word document as PDF, in addition to printing the documents as PDFs. So what are the main difference between printing and saving as a word document?

While printing, the engine discards all the embedded URLs and the end user gets a plain PDF file, and when saved as (From file Save as context) PDF, all underlying URLs are preserved as bookmarks and clickable links are created automatically.

Does it sounds interesting? Give it a try and let us know!

regards,

 

Advertisements

Local DNS Server using DD-WRT | Buffalo Routers

August 13, 2017

A local DNS will help a developer to access and test the applications across local network having to worry about hostnames (Especially mobile devices, where updating host files may force one to root the devices)

This time we will see how a local DNS could be setup using relatively cheap WIFI routers running DD-WRT firmware

I am using a Buffalo router that acts as a WIFI access point at my home.

image

Make sure you are running the latest available firmware for the device to insure maximum stability. Once the firmware has been updated to the latest, Click on Services and you will be landed on Services page. Setting up the local DNS is most effective when you have all your “Computers” have static IP allocation (As seen with below image)

 

image

Don’t worry about the lease time parameters, as long your computers are having static IP addresses, these entries work as ‘A’ records, letting you to access the computers by their name, instead of IP addresses.

Set Used Domain as “LAN & WAN” & provide a meaningful name to “Lan Domain”. This name will be appended to your hostnames when you do a simple ping like commands. For example, when I try to ping “rajesh-pc” from command prompt, “rajesh-pc.my.home” will be automatically generated incase if you set up parameter “expand-hosts” with Additional DNSMasq options (Check below image)

 

 

image

Save the settings & apply. You are all set to start using the local DNS server. Whenever you have a new host, access the services page and create a static host entry (one time) & your last device is accessible using a name, instead of IP addresses.

 

Regards,

 


C# (CSharp, C-Sharp) Windows Active Directory last logon

January 7, 2017

Hi guys

Please note, many threads were referred in order to compile the script attached below & all I did was re-arranging in order for better reading/formatting

(And I insure that the script works under following scenarios:

  1. You are a domain administrator
  2. You are administrating Windows 2003 onwards Windows domain
  3. Your puter is connected to the domain network ;)

)

Referenced websites/threads

  1. http://stackoverflow.com/questions/15775264/searching-for-lastlogon-attribute-of-user-in-multiple-domain-servers
  2. https://www.codeproject.com/kb/security/lastlogonacrossallwindows.aspx#_comments
  3. http://codebeautify.org/csharpviewer (for formatting the C# code)

How to test the code

Start Visual Studio (I am using 2013 Professional edition, you can use any of the community editions to test the scripts)

Create a new C# Console Application and name it llogon (else you need to change the namespace name “llogon” according to the name you have chosen for your new project.

Add the following references to your project

  1. “Framework -> System.DirectoryServices”
  2. “Browse and add -> C:\Windows\System32\activeds.tlb”

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//Added by Rajesh

//using System.Management;
//using System.Data;
using System.DirectoryServices;
using System.DirectoryServices.ActiveDirectory;
//http://stackoverflow.com/questions/33274162/the-namespace-of-iadslargeinteger
//ActiveDS namespace
using ActiveDs; // Namespace added via ref to C:\Windows\System32\activeds.tlb
//https://www.codeproject.com/kb/security/lastlogonacrossallwindows.aspx

namespace llogon
{
    class Program
    {
        static void Main(string[] args)
        {
            // Get the root entry
            DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE");
            string configurationNamingContext =
             (string)rootDSE.Properties["configurationNamingContext"].Value;
            string defaultNamingContext =
             (string)rootDSE.Properties["defaultNamingContext"].Value;
            Dictionary<string, Int64> lastLogons = new Dictionary<string, Int64>();
            // Get all the domain controllers
            DirectoryEntry deConfig = new DirectoryEntry("LDAP://" + configurationNamingContext);
            DirectorySearcher dsConfig = new DirectorySearcher(deConfig);
            dsConfig.Filter = "(objectClass=nTDSDSA)";
            foreach (SearchResult srDomains in dsConfig.FindAll())
            {
                DirectoryEntry deDomain = srDomains.GetDirectoryEntry();
                if (deDomain != null)
                {
                    string dnsHostName =
                     deDomain.Parent.Properties["DNSHostName"].Value.ToString();
                    // Get all the users for that domain
                                   DirectoryEntry deUsers =
                     new DirectoryEntry("LDAP://" + dnsHostName + "/" + defaultNamingContext);
                    DirectorySearcher dsUsers = new DirectorySearcher(deUsers);
                    dsUsers.Filter = "(&(objectCategory=person)(objectClass=user))";
                    foreach (SearchResult srUsers in dsUsers.FindAll())
                    {
                        DirectoryEntry deUser = srUsers.GetDirectoryEntry();
                        if (deUser != null)
                        {
                            // Get the distinguishedName and lastLogon for each user
                            // Save the most recent logon for each user in a Dictionary object
                            string distinguishedName = deUser.Properties["distinguishedName"].Value.ToString();
                            Int64 lastLogonThisServer = new Int64();
                            if (deUser.Properties["lastLogon"].Value != null)
                            {
                                IADsLargeInteger lgInt =
                                 (IADsLargeInteger)deUser.Properties["lastLogon"].Value;
                                lastLogonThisServer = ((long)lgInt.HighPart << 32) + lgInt.LowPart;
                            }

                            // Save the most recent logon for each user in a Dictionary object
                            if (lastLogons.ContainsKey(distinguishedName))
                            {
                                if (lastLogons[distinguishedName] < lastLogonThisServer)
                                {
                                    lastLogons[distinguishedName] = lastLogonThisServer;
                                }
                            }
                            else
                            {
                                lastLogons.Add(distinguishedName, lastLogonThisServer);
                            }
                            string readableLastLogon = DateTime.FromFileTime(lastLogonThisServer).ToString();
                            Console.WriteLine("User: " + distinguishedName + "Last logon: " +readableLastLogon);
                        }
                    }
                    Console.ReadLine();
                }
            }

        }
    }
}

Try the code & if you are stuck somewhere, do let me through the comments. I am working on a WPF C# project for a simple Active Directory Reporter / Asset Management System using WMI. Stay tuned & I will soon post the entire solution here :)

regards,

rajesh

 


Android | Lollipop | Annoyance with voice search

September 27, 2015

Update(4th October 2015): Additional steps

  • Disable the google app from settings (that will uninstall the app)
  • Restart the phone
  • Enable and update to most recent
  • Make sure the google search & now settings as intact as listed below
  • Reboot the device

I hadn’t had issues with voice search popping up while the headphone plugged in once after the above method(s) applied. Once again am not guaranteeing that every smartphone will get benefited with the above hacks.

Constantly getting a fit because your google voice search pop-ups frequently whenever you plug in a headphone? Are you using Lollipop? Try the following. Try to follow the instructions given below. I don’t guarantee this workaround mentioned with few of the android tech sites going to workout for everyone and for every device running lollipop. I am using Micromax Silver 5 running a forked(?) version of Cynogenmod ROM (I believe). Yet, there is nothing wrong giving it a try, right?

  1. Long press an empty area of one of your home screen
  2. Screenshot_2015-09-27-11-46-14
  3. touch the 3 dots in pyramid formation
  4. Should bring up the following screen
  5. Screenshot_2015-09-27-11-46-20
  6. Default the Search Bar comes as ON, turn it off
  7. Go to google app settings and touch “Voice” tab
  8. Screenshot_2015-09-27-11-46-48
  9. Touch “Ok Google” Detection
  10. Make sure your settings are something like below
  11. Screenshot_2015-09-27-11-47-01

this should do the trick, or minimum it has worked for me so far. I am yet to go on a longer drive. If the voice pop-up happens, I think I will brick this phone with a brick.

Cheers guys,

for Windows7bugs

rajesh

 


ASP.Net | Learn the basics of developing your first website using VB.Net or C#

March 8, 2015

You are here, seeking some information and we are more than happy to re-direct you to http://webproject.scottgu.com, a right place to start learning how to develop a website using Visual Studio IDE. Though the posts with scottgu.com mostly deal with VS 2005, almost everything they mentioned with their lessons are still applicable to the latest VS releases.
So give it a try, and you will be more than glad to visit one of the best beginners place.

regards,

rajesh


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