Sunday, March 23, 2025

Transferring large files peer to peer without using torrents or third party cloud solutions

 This post take care of an issue which we sometimes encounter which is how to transfer a large file which is more than the size allowed for third party cloud storage solutions which require hefty annual charges. 

Torrents is the best method, but, sometimes torrents are blocked in the internet service provider end and not so intuitive for the first time user.

The method I would be describing would be using age old FTP for this purpose. I would be breaking it up in some steps.

Step 1 : Install IIS in your windows 10 professional system . 

  • Open "Turn Windows features on or off":
    • Open the Start menu. 
    • Type "features" and select "Turn Windows features on or off". 
  • Select IIS:
    • Tick the "Internet Information Services" checkbox. 
    • You may need to expand the "Internet Information Services" node to select specific features like "Web Management Tools" or "World Wide Web Services". 
  • Confirm and Install:
    • Click "OK" to apply the changes and start the installation process. 
    • Wait for the installation to complete. 
  • Verify Installation:

    • After installation, you can verify by searching for "IIS" in the Start menu and launching "Internet Information Services (IIS) Manager". 
    Step2: Note down the private and public IP of this server. you can use ipconfig to note the private IP address and google for the public IP of the system. Note these IP address. The public IP address can change if router is rebooted

  • Step3 : setup a FTP server in the IIS
click here to open a how-to

Step-4: Download Filezila software

Step-5: configure NAT in the internet router
consult your router documentation. the NAT configured in this example redirects the requests arriving
at ports from 49152 to 65134 to port 23 in a private IP ( the IP where the FTP server is hosted 
like 192.168.1.6)


This is done because FTP uses a passive algorithm which throws requests at different high ports
 which have to be redirected to a single port 23.

Step-6: open filezila software 
this is how it would look in disconnected state


fill the public IP and port 23 and click on quick connect, this is how the screen should look now
the directory structure of the shared ftp folder should be visible . This is a test to see if filezila can access the folder on your laptop through your public IP . Disconnect after the test is successful

 

Step 7: give all read/write permissions to the shared ftp folder for "Everyone" by right clicking the folder 

Step 8 : give the public IP and the port to the friend/person and ask him to download and install  the filezila software  who wants to upload/download the file from the this FTP folder. he can simply drag and drop content from his local folder to this ftp folder as shown in pic above

STEP 9; (Most important) : Revoke all permissions to folder delete all port redirects & stop the FTP server from IIS once your transfer is completed in interest of security. 

Hope this short guide was useful!


Tuesday, March 11, 2025

installing linux to laptop having uefi bios

 the linux distributions based on older distributions are mostly based on MBR partitioning scheme. These distributions are not detected by UEFI BIOS. 

To install linux in laptops having UEFI BIOS, the following steps can be followed:-

Preparing The boot pen drive

1. download Rufus. Rufus is  a small utility about 1.5 MB in size which can make flash drives/pen drive bootable.  Rufus can make both MBR type which is used by older conventional BIOS and GPT type which is used by newer  UEFI bios when reading the partition tables of the inserted pen drive. both MBR & GPT is available as dropdown in Rufus, However, whether UEFI is supported depends on the ISO of the OS which is downloaded. In case the ISO does not support UEFI, the GPT option won't be available in drop down. 

2. The UEFI bios first reads the EFI partition on the GPT partitioned pen drive to boot the OS. The EFI partition is FAT 32 partition usually about 500 MB for Linux systems where the bootloader is stored. The bootloader in case of MBR based system is GRUB. 

3. The UEFI BIOS does have support for legacy MBR based pen drives . but that is only for loading live OS from pen drive . For installing the OS in the internal hard drive, only EFI based boot is usually possible in such systems. 

4. pressing F2 to go into bios, the EFI file of the inserted pen drive is visible as EFI entry . If there are no EFI bootloaders present in the pen drive, this field will be blank denoting that the pen drive can't boot the system. 

5. The advantage of GPT partitioning is support of drives more than 2 TB, which is the upper limit for MBR type of partitioning. 

INSTALLING LINUX ON HARD DRIVE 

After trying the distro as live USB drive, if you decided to install , there should be a install app in the desktop itself, launching the app and follow these steps for completion and install of OS in hard drive. The following points may be noted for partitioning of drive using utility like GPARTED:-

1. mark 500 MB as FAT32 and label the partition as /efi/ boot. This is where the bootloader for EFI will be installed ( which would be visible to BIOS as stated earlier)

2. mark a space equal to that of RAM in the laptop ( 8 GB or 16 GB) as Swap space.

3. remaining space can be marked as / (root) partition

Now, you can install and follow the other steps for completion.

  







Sunday, May 22, 2022

Asus FX 60V laptop with probably faulty battery not charging on mains and after removal boots twice before turn on , turns off after a pre-determined time ..weird problems

Laptop Model: Asus FX 60V

(1) The issue started with battery not charging with mains on. plugging and unplugging mains cord from laptop used to sometime resume charging. Finally, even plugging and unplugging did not start the charging



(2) Initially thought that the problem might be with the charging arrangement inside the laptop as the charger was giving proper 19 v output.



(3) opened the laptop and removed the battery. switched on the laptop, laptop used to get on for a second and then turn off and then restart again, google revealed that it was normal behaviour of asus laptop if battery not present. It was also found that the batt led was steady amber(condition when battery fully charged) even without battery present



(4) continued with this behaviour for few weeks, until I found that if power was also not switched off, after shutdown and then subsequent power-up, this "switch on once, then shutdown, then switch on" behaviour did not occur


(5) A new problem started after a few weeks, the laptop would shutdown automatically while working after a few minutes. opened and tested bios battery this time, found that bios battery was 0.7 volts.ordered new bios battery and fixed it somehow using tape. the original battery was rivetted to a wire using metal plates and 2 pin header at other end connecting to motherboard. even after changing the bios battery, this auto shutdown issue persisted. 


(6) this time re-inserted the main laptop battery, and found not charging. switched off the laptop,  here i made a mistake, should have removed the battery, but forgot. next morning , I found the battery voltage totally drained close to 0 v. so either some battery circuit inside has gone faulty discharging the battery or battery itself has grown dendrites and became faulty, either way I wouldn't know. That is the end of my laptop battery and not planning to replace it because of expenses.


(6) searched and got to this video..https://www.youtube.com/watch?v=mKNmYp3h2N8&lc=Ugzp8-mCVC9_pfVhUXN4AaABAg.9a48O7-4ZXd9a48ic7v7mE

 where many in comments were saying that this issue (auto shut down) happens due to faulty keyboard. so This time decided to open everything, heatsink, fans, flat ribbon cable to keyboard, LEDs, touchpad etc. initially suspected that some clogging might be there in heaksink and thereby due to thermal issue, auto shutdown was happening. however, the heatsink was not much clogged, cleaned it nevertheless. cleaned the motherboard backside as seen in pic, little bit of dust was there. 



(7) reconnected everything back and switched on, now the repeated switch on/switch off problem was not there and laptop straight away booted and did not shutdown after a pre-determined time, the battery led also blinks amber as it is supposed to do (trying to charge a non-existing battery) and is running ok ever since.


(8) Possible reasons for solving problem:-


(a) dust removed from the backside of the motherboard.


(b) keyboard connector removed and turned on resetting the chipset circuitary. later when keyboard connected as explained in step (6) and turned on, everything was fine. 


(C) battery was anyway failing, that is why charging circuit was not charging. may be due to dendrites, it might be overdrawing current thus charging circuit was shutting the charge circuit. 

 Misc:



Some zoomed in view of MOSFETS (NCE 4688) which I had tested, and apparently had no issues


Friday, December 24, 2021

Switching between Kerberos & Unix Authentication mechanism

 I had installed kerberos by mistake on my local VM for skol linux and ever since it would allow to create  users but won't allow to change password. Actually I had no need of Kerberos and had selected the option by mistake while installing the VM. 

Now, even after removing all kerberos packages and rebooting, it still did not exit my system. So I wanted local unix authentication. 

Problems faced: allowing creation of new user, but not allowing to set password

The solution is to use pam-auth-update and the resulting menu will allow you to unselect kerberos and keep the unix authentication. 

unselect kerberos authentication, block password change unix users and suggest Gosa instead and you are good for setting password of local users using unix authentication

What to do if you forget your password and even root password?

 If you forget your password and even the root password, you can stare into a blank login screen not knowing what to do. Here is one break for that situation.

While you are at Grub , instead of clicking enter on your linux distribution or kernel, click E, this will take you to edit mode for starting of that kernel. Try to find one line with "quiet" in the end. At the end of this line append init=/bin/bash and press F10 to boot further into single mode. 

The single user mode directly takes you to the root user. type passwd root at the prompt to set the new password for root. 

If you get error like "Authentication token manipulation error" or if root@none:/ is shown at the prompt, then, type the following command

mount -o remount, rw/

this will remount the filesystem and will allow to change the root password. 

Thursday, December 23, 2021

wifi Tethering to VM on virtualbox

 The usual and most common method to pass internet to the VM from host network is to keep the adapter of VM in bridged mode and the internet connection of the host is shared to the VM whether VM is linux or windows

However, though this works without problem if the host internet connection is through wired medium(Ethernet). When host gets the connection through wifi, this method of bridge does not work. 

Soultion:

The solution is rather simple, in the guest VM settings in virtualbox manager, go to network and in Advanced settings, copy the mac address of the host wifi adapter(which you can get by going to network connections, and rt clicking the wifi adapter and then clicking status and noting down the MAC address) and paste it in the MAC address box replacing whatever was existing in the box.

This can be done only when the VM is offline. once done, check using ip address or ipconfig command in guest VM  and you would find that that the eth1 adapter in VM has already been allotted an ip address in same series as wifi adapter of host OS. ping google dns 8.8.8.8 and it should ping. open browser and check if it is opening google, if not, then just add DNS entry in VM which would be same  as gateway of WiFi dongle/router.

Wednesday, December 22, 2021

Getting internet via usb tethering(JIOfi) on Debian skol Linux VM created on virtual box & installing guest additions on it.

 The VM was created after downloading a iso file of Debian Blue ray iso and installing it to the VM.

Guest additions were required to run the VM in full screen, here is where problems started.

step1 : getting the usb tethered internet working

The Oracle virtual box does not support sharing of wifi connection (there is a trick, another blog post for that!) of host to guest, even if it supports, it is choppy at best, sometimes working, sometimes not working. 


I didn't have a wired connection of ethernet variety, so the only option left was to plug in USB of jiofi modem to laptop running windows 11 host. thereafter using the virtualbox (rt control key + home) menu, selected the USB modem (listed as Android) and made it visible to Debian VM. immediately, it got unistalled from windows and got connected to Debian. Drivers were added automatically.

The device was showing in command ip address( IPconfig is depreacted it seems) as usb0 and given an ip address. The jiofi uses 255.255.0.0 subnet mask. However, routing was messed up as the default routes all go to eth0, so this has to be disabled from the host first. (use vm manager, click on debian vm configuration and in Networks, select "Not Attached" in Adapter1).

The above step resolved all gateway issues etc and was able to ping the google dns 8.8.8.8. Browsing was still not going through, and therefore, had to add the jiofi DNS entry (which is same as gateway) manually in USB0 configuration.

Now, internet was working fine.

Step2: Install kernel headers

Follow this post

https://www.tecmint.com/install-kernel-headers-in-ubuntu-and-debian/

Step3: installing the guest additions

Follow this post 

https://linuxize.com/post/how-to-install-virtualbox-guest-additions-on-debian-10/


Skol Linux is very useful for school students with many apps for school subjects like physics, chemistry,maths,geography and also for topics like astronomy and music.


Sunday, November 21, 2021

Repair of HMI of Allen-Bradley 6181P-122TSXP no display problem

 1. HMI of Allen-Bradley 6181P-122TSXP


Fig 1: The HMI make & Model 

was not showing any display when powered up. This HMI is  used in Centrifuge. The cost of this machine is around Rs Seven Lakhs. 


2. Inserted a 4 digit PC motherboard diagnostic  card in the PCI  slot and powered up the machine, the numbers on digit display in card were changing and these numbers correspond to errors on mainboard. for ex, if the numbers stopped at 01 , implies the cpu has gone faulty or 2C implies bad memory etc. However, the number did not stop at these stages and continued up-to full boot. Therefore, it was concluded that boot process was normal and problem was in LCD display. The video


shows how it is done.


3. The LCD/LED display has two connectors coming from the mainboard , one is the 20 pin LVDS signal and other the power. 


Fig 2: The Motherboard showing power & LVDS connectors

The LVDS stands for low voltage differential signalling, and has three pairs differential signal and one pair of clock signals. The LVDS signals were verified with oscilloscope, and positive (up going signal in oscilloscope) and negative (down going signal in oscilloscope) was seen in the respective + and - pins in each differential pairs. The clock signal yielded a steady 4 MHz clock.


4. Thus, the problem appears to be that of backlight in LED display. The model of the display used is G12S1-L02. 


Fig 3: The LCD display panel G121S1-L02 showing the LCD2MB PCB

The datasheet of the display was also found on net and shared here. The backlight is provided by a string of LEDs which illuminates the LCD display. The power connector pin-out is shown here 


5. To access the backlight string of LEDs, the display was opened , and indeed, the backlight was not glowing. The LCD display has two PCBs one is LCD2MB pcb (shown in fig 3) which gets the power from the mainboard and supplies the +12V power,EN signal to the E88441 PCB which generates the actual timing,control and backlight voltage for driving the LCD and backlight LEDs. 


Fig 4: The LCD display opened revealing E88441 PCB containing the backlight controller

The LED display driver in E88441 PCB was identified by using 10X magnification on mobile camera and the part number noted down. Datasheet of this IC was downloaded. and can be viewed here


6. On studying the datasheet it was found that that pin # 28 of this IC had to be supplied with EN signal, which is a 5 v PWM signal, which can also control the brightness depending on PWM on time. The EN signal was being generated by the LCD2MB card in the display panel.  There is a touch point (TP) to verify the presence of this signal, which yielded no value with multimeter, so, this signal did not reach the display driver and failure was traced  to faulty resistors (R94,R82 & R104) on board.


Fig 5:  A8501 magnified 10x

7. The circuit in and around the LED driver IC U1 was traced with the help of multimeter continuity testing and all the required transistors and MOSFET identified and re-drawn on paper to understand the working. The circuit is given <here>


Fig 6: The backlight driver power save mechanism redrawn

8. It appeared that the resistors which were damaged were part of a 'power saving' mechanism to give reduced supply voltage of 10.73 V instead of 12 V to the display driver IC in the absence of EN signal.This mechanism was built around transistor Q7 and Q14 and MOSFET Q15 .  These resistors are 1% tolerance SMD resistors following the EIA-96 pattern of naming. The reistors which were damaged were marked as 70D, and 10S which have the value of  536K and 12.4 ohm respectively.


9. These resistors could not be sourced so a workaround was found to get the EN signal directly to IC U1 by shorting a path in PCB and bypassing the 'power save' circuitary by running the driver IC at 10.73 volts as is evident by seeing the circuit diagram traced above. The repair is shown in figure 7. The resulting voltage at LED backlight end was 20 V, which was sufficient to drive the backlight LEDs.



Fig 7: The soldered portion to supply EN signal directly to backlight controller

10. Assembled everything back, the display working ok.


Fig 8: HMI giving output after the repair

4. Annexure:-

4.1  For Full HD TV, 30 pin (10 pairs) connector is used. For HDTV, 20 pin (5 pairs--> 4 data pairs & 1 clock pair , 4 data pairs give 8 bits)  connector is sufficient. The three data pairs correspond to R,G,B signal and the fourth data pair is for B+Hsync and V.  For this particular 12 inch display 3 data pairs (Rin 0,1 & 2 corresponding to R,G,B) and one clock pair is used , the unused  1 data pair (Rin3 for B+Hsync & V) the + is connected to ground and - is NC. Therefore, 3 data pairs contribute 6 bits . The more number of pairs means more bits can be shown implying higher resolution. 


4.2 Youtube video about LVDS 


4.3 Some of the ICs identified in mainboard (DS90C385A-> LVDS serializer, Chrontel CH7308B--> PLL transmitter, ISL6262CRZ--> 2 phase buck converter) 


Fig 9 : 20 pin LVDS connector pin-out


Key Learnings:

1. Details of backlight LED driver IC and its working

2. LVDS signals and 4/6/8 bit differential signalling

3. EiA -96 1% resistor naming convention

 

Saturday, January 18, 2020

Design Notes

One stop reference for all design related stuff. 
Post all design related articles in continuation by editing this post
First up, the most simple, Saturated switch using BJT and Darlington. Notes in the attached figure.


(a) Saturated Switch  using BJT

(1) The ratio of Ic/Ib < hfe (min) of the selected transistor.

(2) take care that calculated Ic is less than Ic max which can be found in the datasheet.

(3) How did we determine ic/ib < hfe for saturation?
Consider the simple circuit shown in figure, with one base resistor Rb, One collector load RL ,

 Let's assume for example RB = 1M, RL = 1k, B1 = 9V, hFE = 300 and VBE = 0.6V.
The voltage across RB will be VS-VBE=8.4V, so IB=8.4/1M=8.4µA. IC=IB·hFE=8.4µA·300=2.52mA. So the voltage across RL will be 2.52V.

Now, What will happen if in the example above, RB=100k instead of 1M?
IB=8.4/100k=84µA. You may expect that IC will be 84µA·300=25.2mA, but that isn't possible since the voltage across RL would be 25.2V which is more than B1.

 IC,max in this circuit is B1/RL=9/1k=9mA. So even if IB=84µA, IC will be 9mA. IC/IB=107, which is less than hFE. In such a case, when IC/IB < hFE, we say that the transistor has become saturated and can be considered as a closed switch (between C and E).

(b) Saturated Darlington
As explained in figure attached, if Ib loads the weak base supply, then a more powerful high beta transistor called darlington can be used. This will saturate even with tens of microamps of base current and won't load the weak base power supply.






Monday, October 29, 2018

Installing Apps to Android mobile in bulk using Laptop


Mobile phones are becoming useful sidekick apart from performing the basic function of making calls,  so much so that they are now managing various aspects of life like finances, science, day to day converters, communication and messaging , social media and so on.


A smart phone becomes a very useful tool in the hands of user depending on the apps it has been loaded with. Now here comes the problem! Apps are installed over the months and years  and if for any reason, a new phone is purchased or old one is formatted, all the apps have to be installed one by one which becomes tedious. The following steps will guide you as to how to take backup of all your apps in your laptop from your old phone  and then load them into your new phone in a single click..

Ok, so here are the steps..I have tried to keep it as simple as possible.

PREPARING THE PHONE & LAPTOP

1 Developer options have to be enabled on your phone to do this exercise. To enable developer options, open settings app, select System, scroll to bottom and select About Phone, scroll to bottom and tap Build number 7 times, return to previous screen to find Developer options near bottom

2. turn on USB Debugging in developer options.

3. Connect the phone to laptop by means of a USB cable and select USB debugging (ADB) mode., a seperate CD drive can be seen mounted in my computer containing the phone USB drivers for laptop, double click and install the drivers( this may differ from phone to phone, in some phones, you may have to download the USB drivers from manufacturers website and install)

4. download and unzip SDK platform-tools_r28.0.1 for windows in a directory , say D:\adb-fastboot\platform-tools

5. Right click my computer, go to properties, go to advanced system settings, click on environment variables button , in system variables scroll down and click on  path, click edit button, modify the path by adding a semicolon and inserting D:\adb-fastboot\platform-tools after semicolon as shown in screenshot below. click ok all the way to close the advanced system settings. This is being done so that you can run adb command from any path.
                                                 



6. reboot the laptop and open command window, and type adb, you should see something like this screenshot:-

now your laptop is ready to send commands to your phone via ADB

PREPARING THE PRINT.BAT FILE IN LAPTOP

1. Install myphone explorer app. My phone explorer is a nice nifty app which can be used to take backup of your apps, contacts, sms etc to your laptop . It also has a useful sync feature which can be used to sync files between your laptop and Phone external memory, if you happen to keep your work related stuff on your phone for ready reference.


2.  Install Myphone explorer on your laptop/PC.

3. turn on  your wifi hotspot on your mobile and connect your laptop to it.

4. open myphone explorer in both laptop and mobile phone and using the laptop app go to File-> connect to phone. click on Extras menu  -> Create backup as per the screenshot below. Now all your apps are stored in a folder in  laptop (say D:\apps-1)



5. open a command prompt window and cd to D:\apps-1. type dir /s /b > print.txt , this creates a file called print.txt in the folder. now, open this file in notepad and replace D:\ with adb install -r D:\  for all the occurrences.










6. Now, you might notice that some filenames of apps have space between them, we need to replace space with an _ (underscore) character everywhere. so we have another nifty vbscript file to do that for us. Download the file here , open the vbscript file in notepad and change the path in the Set fol line like Set fol = fso.GetFolder ("D:\apps-1"). what this vbscript file does is read each filename in
D:\apps-1 directory and find blank space in them and replace with a underscore. The reason why this is being done is the command line adb install fails on space in filenames so it has to be replaced with an underscore.
 
7. open print.txt in notepad and  click save as and enter filename as  print.bat and file type as all as shown in screenshot below. This will generate a batch file called print.bat
 
8. double click print.bat file to open a command window to install each app one by one as can be seen in screenshot below!
 

 
 
 
References:
 https://android.stackexchange.com/questions/64353/how-to-batch-install-apks-from-computer-to-android-without-actually-touching-my

 
 
 
 
 



 




 

Wednesday, June 27, 2018

Ubuntu 18.04 on old HP Compaq 6710b Laptop

HP Compaq 6710b is my oldest laptop given by ONGC way back in 2006. The laptop had windows vista initially and having a Intel core2 duo CPU @ 2.2 GHz with  2 GB RAM. It was brand new but slow as hell.

Later , installed Windows 10 under the magnanimous program of Microsoft who did not allow upgrade to Win 10 from vista but allowed to install it without activation. Updates continued to happen , everything happened, but it continued to be slow as hell.

Then, ONGC under its EPP(somewhere in 2014) allowed purchase of another HP laptop with 4 GB RAM , however this time we purchased the laptop instead of the L1 route earlier. 6710b continued working as the latest laptop evolved from win 8 to win 8.1 , windows 10 and finally to the latest April Update of Win 10 pro. However, 6710b continued to be slow as hell.

In 2018, ONGC EPP, I purchased a powerhorse, Asus FX series 16 GB RAM, Latest Nvdia card(1060 I guess), Intel 7th gen HQ CPU, 7200 rpm 1TB HDD and 128 GB SSD. Out of concern for the geriatric laptop, I purchased 2 sticks of 2 GB RAM for Rs 2000/- in total to give a 4 GB upgrade to the 6710b, However, 6710b continued to be slow as hell.

Finally, decided to give 6710b exit to windows by totally removing windows and installing Ubuntu 18.04 released this April. Now this old laptop is decent and not slow as hell

However, it did take some time to boot (3 minutes), which was odd, when the laptop is not slow as hell, why should the boot be slow as hell?
(1) here is the error it threw up during boot
(2)sudo nano /etc/default/grub
(3) 
(4) Added GRUB_CMDLINE_LINUX_DEFAULT="quiet video=SVIDEO-1:d" and removed "splash"

(5) saved and sudo update-grub

Now , boot time reduced to 20 seconds :)

Old laptop is no longer damn slow as hell :)


Note: Also came to know that boot menu can be displayed by pressing shift during boot and pressing E key against a kernel entry allows to edit it and boot with the edited entry to test before making changes permanent as mentioned in steps (2) onwards




Thursday, May 17, 2018

configuring ccproxy and internet gateway for routing internet from one network to another

CCproxy is software used to give internet connection to neighboring computers in the same network (connected to same switch or wifi network). It is simple and easy to use. 

This particular use-case is for situation when internet is required in an adjacent network (say 192.168.32.*, which say is the LAN) and the internet connected Proxy server is in another network (say 192.168.43.* which say is the jio network coming from wifi or mobile)

Steps:-
1. Open CC Proxy , do the settings as follows:-
2. Start the proxy server

3. install winpkfilter (which is the internet gateway)

(a) click the local area connection and  select the NAT status as client, meaning your LAN connection (say 192.168.32.10) will be client and click ok.

(b) click on wireless connection and NAT status will be provider, give the proper IP address of the JIO or wifi provided IP address (say 192.168.43.232) and click OK

(c) Click Start NAT as seen above

4. In one of the LAN PCs (say 192.168.32.25), add the following command in command window with admin privileges to add the IP address of JIO computer . Note that all Pcs in the LAN will be in the 192.168.32.* network.

route add 192.168.43.232 mask 255.255.255.255 192.168.32.10

5. ping the 192.168.43.232 computer, it should ping.

6. Open any browser and add proxy address as 192.168.43.232 and port as 808

7. open and browse internet in this network while your jio is connected to another network



 

Thursday, April 26, 2018

variables need to be explicitly declared even though óption explicit'option not given

INTRODUCTION
1. It is considered a good practice to use óption explicit'at the beginning of a module or code block, doing so, will need unique declaration of each variable in the module.

2. Though, this is good for organized coding, it can take the fun out of quick coding.

PROBLEM
1. I had not used option explicit anywhere, however, when a excel macro file developed elsewhere, was copied to my system, the code execution stopped at each undeclared variable. Declaring that variable solved the issue, however, code will stop at the next undeclared variable.

2. I checked the options menu in VB editor, "require variable declaration was also unchecked". This was a huge problem as I may have had dozens of undeclared variables. Why was I facing this problem in my home laptop while elsewhere it worked?

3. googled, found someone else also faced the same problem. The issue was using "References"which are not installed (Active X controls, like comctl2.ocx etc).

4. Clicked Tools-->References, and indeed there was highlighted a checkbox with "Missing: common controls (SP6). Unchecked this missing reference, and everything solved.  The code did not stop at any undeclared variable.

5. Meanwhile installed the common control active x and got the functionality was also obtained (separate blog post created for same)
 

making date time picker controls (sp6) work in Excel 2007

1. It is better to install MS office as 32 bit software even in 64 bit systems if legacy VBA code is being used in some excel files.

2. The common controls (mscomct2.ocx) will not work if office installed as 64 bit application.

3. The common control components like Microsoft Date time picker are obtained if the mscomct2.ocx active x file is added to the system.

4. Do not confuse between Mscomctl.ocx and mscomct2.ocx. The former is used for VB6 and later is used for VBA. download the correct ocx file and register to get the date time picker control in Excel VBA.

5. see this link (or google, if this does not open) for procedure to register active x controls.
https://www.ablebits.com/office-addins-blog/2016/10/12/insert-calendar-excel-datepicker-template/#Register-date-picker

6. irrespective, if your application is installed as 32 bit (meaning it is stored c:\program files (x86) ) in the 64 bit OS system , the OCX file has to be copied to C:\windows\syswow64 and then procedure as mentioned in step 5 to be applied.  The 64 bit applications are stored in normal program files folder (C:\program files)

7. By doing step 5 & 6, the date time picker control started appearing in VBA of excel.

 

Saturday, September 23, 2017

Running out of space in main Linux parttion, resize offline, solve screen flicker problem

I was looking for a light weight linux distribution for my old laptop and found this Lubuntu Zetsy. I had thought being lightweight, about 4 GB of Hard disk space would be enough with say 500 MB Swap space.

The main hard disk drive is 100 GB and windows 10 was installed in it. Earlier a 11 GB space was shrunk from this 100 GB drive and formatted as NTFS (Drive D:) This 100 GB drive was further shrunk using disk management utility in Windows 10 to create unallocated space of about 4 GB.

The partition table looks as follows:-


After installing Lubuntu Zetsy in 4 GB space, it was working fine, however, package upgrade messages started appearing, but there was not enough space to upgrade as total size available was only 3.43 GB (488 MB swap). I could ignore these messages but for a fact that subsequent login was taking to black screen and required two or three retries to reach main desktop (say after power save etc). Googling about the problem pointed to fact that upgrading the packages can solve the problem.

I was avoiding upgrading as disk space was minimal, one day I did take the chance and did apt-get upgrade from command line, the upgrade started and midway gave a message of insufficient disk space after about 200 MB of disk space was only left. root user was dismounted and system dropped to initramfs shell. In short, my Linux smoked out  :))

Now, I had to somehow add some storage to this original 4 GB partition. since it was bang adjacent to the 90 GB windows partition, I thought I could shrink some 4 GB from this 90 GB windows partition and add to original 4 GB to make it grow to 8 GB. question was how? and will my data be safe after this exercise? or will the entire thing go in smoke too :))

I decided to backup the complete laptop data onto another desktop just in case. after that, google helped me to zero on GPARTED, the linux utility to resize partitions.  Again, after shrinking 4 GB of unallocated space from Windows, booted using a live CD to Linux for my partition resize operation, this was the actual picture of partitions:-



Following are the step wise observations:-

1. It is only possible to have four primary partitions in MBR scheme of partitioning (sda1, sda4, sda2 & sda3 in my case were already there)

2. Note that the linux partitions sda5 (ext4 filesystem, 3.43 gb) & sda6 (swap, 488 mb) are contained in sda4 which is marked as extended partition.

3. I tried resizing sda5, but it wouldn't budge.

4. As I had booted into linux using live DVD, All hard disk partitions were unmounted by default except swap. A 'lock' symbol was appearing against sda6 & sda4.

5. Right clicked sda6 and clicked the swapoff and lock symbol vanished on sda6 & sda4. Now I could resize sda4 to the unallocated space adjacent. after this, i could resize sda5 which as you can see is inside sda4.

6. A warning was issued by gparted after resizing sda5 that linux may not boot.

7. swapon done on sda6 and lock symbol reappeared on sda4 & sda6.

8. Rt click in lower pane of gparted and click on ' apply all operations'. this is the confirmation step for all changes. it took 5 minutes to complete all operations.


REBOOTING
After Rebooting, GRUB2 boot menu appeared and I selected ubuntu, but same problem reappeared, that is trying to load GUI but failing and not even opening a terminal screen on pressing ctrl + Alt + F1. So, it appears that partition ops are success, now only linux issues need to be troubleshooted.

After turning on laptop, press ESC key continuously, after GRUB2 appears, you can see an extra entry "advance options for Ubuntu". Select this option  and select option of "fix broken packages". dpkg started installing the packages which were left off earlier midway after hard disk space had been exhausted.

After dpkg finished, I rebooted again to GRUB2 main entry ubuntu and everything worked perfectly! Rebooted again to windows an found everything was normal there too!.

So, resized partition offline without any loss of files.








Thursday, March 9, 2017

Running classic asp on Windows 10 64 bit

In the latest version of Windows 10 Pro 64 bit, following has to be done:-

1.Go to Control Panel - Programs and Features - Turn Windows features on or off.

2.Select Iinternet Information services;World wide web services->and click on ASP & click OK
ok! worked

error message: error-800a0e7a-provider-cannot-be-found-it-may-not-be-properly-installed
for running classic asp with connect to access database  on 64 bit computer running windows 10, do these changes:

Check the site's Application Pool in IIS -->Application Pools->Default App pool (rt click)->  Advanced Settings :

1) Managed Pipeline Mode : Classic
2) Advanced / Enable 32-Bit Applications: True

USE SYSTEM DSN 32 BIT FOR ACCESS DATABASE
create 32 bit  system DSN, by going to  control panel -> administrative tools->ODBC Data sources 32 bit and creating the DSN.
That worked!

OLE DB connection in which code is written as
MyConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\mysite\cd-cat\database\cd_data.mdb;Persist Security Info=False"

requires the OLEDB provider to be installed

I got this error:-
Microsoft Office Access Database Engine error '80004005'
Could not find installable ISAM
This can be solved by following https://support.microsoft.com/en-in/help/209805/you-receive-a-could-not-find-installable-isam-error-message-or-some-fi

However, decided to use only DSN connection

Friday, February 10, 2017

A note about fittings used in instrumentation

Fittings are extremely important accessory in a process plant. The array of fittings available is bewildering as they span across all the fields of human endeavor and  industry. No process industry which handles fluids can do without fittings, apart from industry they are found in transport (ships, aircraft, spacecraft, motor vehicles), HVAC (Heating Ventilation and Air conditioning), fuel and water supply systems. I have tried to collate some material available in Internet to understand the various types of fittings, the various thread types like NPT, BSP etc and links to resources to help order the required fittings for a job and also to understand and classify the fittings available in hand.

The document begins with introduction to various types of fittings and digresses briefly to understand the various 'thread' types and then describes how tube connections carrying process fluids and instrument Air are mated to the fitting. Each of these are labeled as sections. Section 1 is intro, 2 describes the thread technology, 3 describes way to identify a particular thread with aid of charts, 4 gives a special emphasis on BSP thread, a very confusing thread type (I hope the confusions should end once you go through the blog ;) ) 5, describes the tube connections like flared, flareless (bite type), o-ring face seal and 60 degree cone.

Section 6 has some misc resources on how much to tighten a fitting with a wrench after the initial 'hand-tight' and links to various guides by parker and swagelok. There is a link for on-line identification of a fitting type after giving the required inputs an some video resources for tube bending, sealing using teflon, selecting correct hoses and tubes etc.


I would have posted in the blog format, however, I had begun by creating the blog in MS word and though the text could be published to blog, the images and hyperlinks refused to resolve. Therefore, uploaded my created document to google drive and linked it here.

Click here to download the document and hope the information is useful
click here to download the pdf version of the same file.

Sunday, August 23, 2015

Connecting ADC PCF8591 using IsquareC bus to Arduino R3 board

PCF8591 is a 8 bit ADC using sigma-delta conversion method. The chip is i2c bus enabled, which makes it easy to communicate with Arduino R3 board.
The circuit has been wired as shown below:
The A/D converter has 4 channels which can be selected using software. More A/D converters can also be added using the same SDA/SCL lines to connect more number of inputs. The whole circuit can be a template to interface multiple real-world sensors to the Arduino Ecosystem.
The code for the above is:-
// Example 52.4 PCF8591 ADC demo
// http://tronixstuff.com/tutorials Chapter 52
// John Boxall June 2013
#include "Wire.h"
#include
#define PCF8591 (0x90 >> 1) // I2C bus address
LiquidCrystal lcd(4,5,6,7,8,9); // define our LCD and which pins to use

byte value0, value1, value2, value3;
void setup()
{
 Wire.begin();
 Serial.begin(9600);
 lcd.begin(16, 2); // need to specify how many columns and rows are in the LCD unit
  lcd.clear();      // this clears the LCD. You can use this at any time
}
void loop()
{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Welcome!");
  // prints "Hello" at the LCD's cursor position defined above
  lcd.setCursor(0,1);
  // positions starting point on LCD, column 0, row 1 (that is, the bottom left of our LCD)
  lcd.println("This is GDS!    ");
  delay(1000);
  // note the rest of the line is padded out with spaces

 Wire.beginTransmission(PCF8591); // wake up PCF8591
 Wire.write(0x04); // control byte - read ADC0 then auto-increment
 Wire.endTransmission(); // end tranmission
 Wire.requestFrom(PCF8591, 5);
 value0=Wire.read();
 value0=Wire.read();
 value1=Wire.read();
 value2=Wire.read();
 value3=Wire.read();
 delay(1000);
 //value1 = 0x55;
 if (value1 > 50)
 {
   lcd.clear();
   lcd.home();
   lcd.print("V101 GAS > 60%!!");
   delay(3000);
   //Serial.print("manoj");
 }

 //Serial.print(value0); Serial.print(" ");
 Serial.print(value1); Serial.print(" ");
 //Serial.print(value2); Serial.print(" ");
 //Serial.print(value3); Serial.print(" ");
 //Serial.println();
 lcd.noDisplay();
 delay(1000);
 lcd.display();
 delay(1000);

}

Monday, July 27, 2015

Whistling sound in tv due to Puffed capacitors in Set-top box

whistling noise coming out of the tv when watching tv programs through the set-top box. suspected leaky capacitors. opened set-top box and saw some "puffed" capacitors. the puffed capacitors are shown in the figure with an arrow.


De-soldered the capacitors and checked with multimeter, the capacitors looked ok, no leaks. If a capacitor is leaky, it will show some resistance reading in the meter. In this case, the resistance shown was infinity as a good capacitor should be.


Then I wondered what made the capacitor puffed? I had purchased a digital LCR meter recently. checked using LCR meter showed capacitor value as 100 mu F instead of 1000! , so as a result of deformity, the capacitance value had changed, thus de-stablizing the circuit.


I had a few 1000 mu F capacitors spare, so I checked their value, they also had gone down to 900 mu F, due to ageing perhaps, but, 900 muF would just work fine.

Replaced the three capacitors and connected back to TV. No whistling sound! So, what made three capacitors get deformed? Power supply surges might have taken the toll on the caps.

Investing in a good LCR meter paid off! otherwise, would have just replaced the capacitors. Measurements are good, measurements make you confident.