Monday, November 25, 2024

Getting Localstack Up and Running

In continuation to the earlier post on mocks for clouds, this article does a deep dive into getting up & running with Localstack. This is a consolidation of the steps & best practices shared here, here & here. The Localstack set-up is on a Ubuntu-20.04, with Java-8x, Maven-3.8x, Docker-24.0x. 

(I) Set-up

    # Install awscli
     sudo apt-get install awscli

    # Install localstack ver 3.8
        ## Issue1: By default pip pulls in version 4.0, which gives an error:
        ## ERROR: Could not find a version that satisfies the requirement localstack-ext==4.0.0 (from localstack) 


        python3 -m pip install localstack==3.8.1

--

    # Add to /etc/hosts
    127.0.0.1    localhost.localstack.cloud
    127.0.0.1    s3.localhost.localstack.cloud

--

    # Configure AWS from cli
    aws configure
    aws configure set default.region us-east-1
    aws configure set aws_access_key_id test
    aws configure set aws_secret_access_key test

    ## Manually configure AWS
    Add to ~/.aws/config
    endpoint_url = http://localhost:4566

    ## Add mock credentials
    Add to ~/.aws/credentials
    aws_access_key_id = test
    aws_secret_access_key = test

--

    # Download docker images needed by the Lambda function
        ## Issue 2: Do this before hand, Localstack gets stuck
        ## at the download image stage unless it's already available

    ## Pull java:8.al2
    docker pull public.ecr.aws/lambda/java:8.al2

    ## Pull nodejs (required for other nodejs Lambda functions)
    docker pull public.ecr.aws/lambda/nodejs:18

    ## Check images downloaded
    docker image ls

(II) Start Localstack

    # Start locally
    localstack start

    # Start as docker (add '-d' for daemon)
       ## Issue 3: Local directory's mount should be as per sample docker-compose

    docker-compose -f docker-compose-localstack.yaml up

    # Localstack up on URL's
    http://localhost:4566
    http://localhost.localstack.cloud:4566

    # Check Localstack Health
    curl http://localhost:4566/_localstack/info
    curl http://localhost:4566/_localstack/health

(III) AWS services on Localstack from CLI

  (a) S3
    # Create bucket named "test-buck
"
    aws --endpoint-url=http://localhost:4566 s3 mb s3://test-buck

    # Copy item to bucket
    aws --endpoint-url=http://localhost:4566 s3 cp a1.txt s3://test-buck

    # List bucket
    aws --endpoint-url=http://localhost:4566 s3 ls s3://test-buck

--

  (b) Sqs
    # Create queue named "test-q"

    aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name test-q

    # List queues

    aws --endpoint-url=http://localhost:4566 sqs list-queues

    # Get queue attribute

    aws --endpoint-url=http://localhost:4566 sqs get-queue-attributes --queue-url http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/test-q --attribute-names All

--

  (c) Lambda
    aws --endpoint-url=http://localhost:4566 lambda list-functions

    # Create Java function
    aws --endpoint-url=http://localhost:4566 lambda create-function --function-name test-j-div --zip-file fileb://original-java-basic-1.0-SNAPSHOT.jar --handler example.HandlerDivide::handleRequest --runtime java8.al2 --role arn:aws:iam::000000000000:role/lambda-test

    # List functions
    aws --endpoint-url=http://localhost:4566 lambda list-functions

    # Invoke Java function
    aws --endpoint-url=http://localhost:4566 lambda invoke --function-name test-j-div --payload '[200,9]' outputJ.txt

    # Delete function
    aws --endpoint-url=http://localhost:4566 lambda delete-function --function-name test-j-div

(IV) AWS services on Localstack from Java-SDK

    # For S3 & Sqs - localstack-aws-sdk-examples, java sdk

    # For Lambda - localstack-lambda-java-sdk-v1

 

Thursday, November 21, 2024

Killing me softly

With your air. With your smog. With your AQIs. With your chart topping PM levels. Delhi this annual event of yours, wish we could skip!

Familiar noises echoing from the four estates are no balm to the troubled sinuses. They shout at the top of their lungs, we cough & sneeze from the bottom of ours.

Solution, now what's that? From whom, when, where & why? Since one's can't really run away perhaps we need to just hibernate or hide. Better still, grin and bear this way of lieF (sic). 

Saturday, November 16, 2024

Mutable Argument Capture with Mockito

There are well known scenarios like caching, pooling, etc wherein object reuse is common. Testing these cases using a framework like Mockito could run into problems. Esp if there's a need to verify the arguments sent by the Caller of a Service, where the Service is mocked.

ArgumentCaptor (mockito) fails because it keeps references to the argument obj, which due to reuse by the caller only have the last/ latest updated value.    
The discussion here led to using Void Answer as one possible way to solve the issue. The following (junit-3+, mockito-1.8+, commons-lang-2.5) code explains the details.

1. Service: 

public class Service {

public void serve(MutableInt value) {

System.out.println("Service.serve(): "+value);

}


....

 

2. Caller:

public class Caller {

public void callService(Service service) {

MutableInt value = new MutableInt();

value.setValue(1);

service.serve(value);


value.setValue(2);

service.serve(value);

}

...

 

3.Tests:

public class MutableArgsTest extends TestCase{

List<MutableInt> multiValuesWritten;

@Mock

Service service;

 

/**

* Failure with ArgumentCaptor

*/

public void testMutableArgsWithArgCaptorFail() {

Caller caller = new Caller();

ArgumentCaptor<MutableInt> valueCaptor

ArgumentCaptor.forClass(MutableInt.class);


caller.callService(service);

verify(service,times(2)).serve(valueCaptor.capture());

// AssertionFailedError: expected:<[1, 2]> but was:<[2, 2]>"

assertEquals(Arrays.asList(new MutableInt(1), 

new MutableInt(2)),valueCaptor.getAllValues());

}

 

        /**

* Success with Answer

*/

public void testMutableArgsWithDoAnswer() {

Caller caller = new Caller();

doAnswer(new CaptureArgumentsWrittenAsMutableInt<Void>()).

when(service).serve(any(MutableInt.class));

caller.callService(service);

verify(service,times(2)).serve(any(MutableInt.class));


// Works!

assertEquals(new MutableInt(1),multiValuesWritten.get(0));

assertEquals(new MutableInt(2),multiValuesWritten.get(1));

}

/**

* Captures Arguments to the Service.serve() method:

* - Multiple calls to serve() happen from the same caller

* - Along with reuse of MutableInt argument objects by the caller

* - Argument value is copied to a new MutableInt object & that's captured

* @param <Void>

*/


public class CaptureArgumentsWrittenAsMutableInt<Void> implements Answer<Void>{

public Void answer(InvocationOnMock invocation) {

Object[] args = invocation.getArguments();

multiValuesWritten.add(new MutableInt(args[0].toString()));

return null ;

}

}

}

Monday, September 30, 2024

Restore Joomla 4 Manually

This post has info on manually restoring a Joomla 4.3.4 set-up across two servers. While both are Linux systems the configuration differ slightly including the OS, Php , DB, etc. Various issues were faced & overcome in doing the restoration.

Background info:

- Source:
Ubuntu 22.04, Php 8.2, Joomla 4.3.4, Apache, Maria DB, Addon Plugins (AddToAny, LazyDb, Komento, SexyPolling)

- Destination:
Ubuntu 20.04, Php 7.4, Joomla 4.3.4, Apache, MySql 8.0

- Latest DB dump & htdocs folder (including all files, modules, plugins, media, images etc.) from Source was transferred to Destination server via Ftp before hand.

Steps:

1) DB Import

    1.1) Create user, db, grant all permission to user. 

    1.2) Import data to the created db from the latest DB dump of the source.
 
        1.2.1) ERROR 1366 (HY000) at line 2273: Incorrect integer value: '' for column 'checked_out' at row 1. Solution is to set NO_ENGINE_SUBSTITUTION & then import:

            SET @@GLOBAL.sql_mode= 'NO_ENGINE_SUBSTITUTION';

    1.3) ERROR 1101 (42000) at line 10692: BLOB, TEXT, GEOMETRY or JSON column 'country' can't have a default value

        - Using the solution found online & the DB dump sql import script was changed to set DEFAULT values for the problematic text columns country, city, etc
    

         // Modify the sexypolling plugin CREATE TABLE script:
            CREATE TABLE `#_sexy_votes` (
              `id_vote` int(10) unsigned NOT NULL AUTO_INCREMENT,
                  ....
              `country` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `city` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `region` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `countrycode` text NOT NULL DEFAULT (_utf8mb4'Unknown'),

              PRIMARY KEY (`id_vote`),
                  .....

            ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;

2) Download Joomla_4.3.4-Stable-Full_Package.zip from joomla.org
    2.1) Unzip Joomla_4.3.4-Stable-Full_Package.zip to /var/www/html & rename folder to <site_name>

    2.2) Set up site configuration.php (/var/www/html/<site_name>/configuration.php)
        - Add db, username, password
        - Add tmp_path & log_path in

        public $log_path = '/var/www/html/<site_name>/administrator/logs';
          public $tmp_path = '/var/www/html/<site_name>/tmp';


3) Restore Joomla modules, plugins, languages, etc from file system Ftp backup location of Source.

4) Additional system settings on Destination


    4.1) Add missing Php modules: "Call to undefined function" error

        4.1.1) simplexml_load_file()
            sudo apt-get install php7.4-xml

        4.1.2) "IntlTimeZone" module missing
            sudo apt-get install php7.4-intl

    4.2) Increase Php upload limit (/etc/php/7.4/apache2/php.ini)

          post_max_size = 38M
            upload_max_filesize = 32M


    4.3) Restart apache
          sudo systemctl reload apache2
 

5) Recovering from J4 Red Error Page of death

    5.1) Redirection to installation/index.php:

    - With an error "500 - Whoops, looks like something went wrong".
    - Needed to delete the installation folder, to stop the redirection.

    5.2) Next, 404 Component not found error on the home page: 
 

    ---
        404 **Component not found.**

        Call stack
        #     Function     Location
        1     ()     JROOT/libraries/src/Component/ComponentHelper.php:296
        2     Joomla\CMS\Component\ComponentHelper::renderComponent()     JROOT/libraries/src/Application/SiteApplication.php:210
        3     Joomla\CMS\Application\SiteApplication->dispatch()     JROOT/libraries/src/Application/SiteApplication.php:251
        4     Joomla\CMS\Application\SiteApplication->doExecute()     JROOT/libraries/src/Application/CMSApplication.php:293
        5     Joomla\CMS\Application\CMSApplication->execute()     JROOT/includes/app.php:61
        6     require_once()     JROOT/index.php:32
    ---
 

    5.3) Checked DB connections using a custom php script:

No issues connecting to DB with username/ password!

    5.4) Enable Debugging/ Logging:
        

        5.4.1) Logging in php.ini (/etc/php/7.4/apache2/php.ini)
            ----Turn on logging-----
               display_errors = On
               html_errors = On
               display_startup_errors = On
               log_errors = On
               error_log = /var/log/apache2/php_errors.log


        5.4.2) Logging in configuration.php (/var/www/html/<site_name>/configuration.php)
            // Change to true from false
                public $debug = true;
                public $debug_lang = true;

                // Change to 'maximum' from 'default'
                public $error_reporting = 'maximum';
    
                // Change to 1 from 0
                public $log_everything = 1;


    With those J! Info started showing up in the browser along with the error stack trace & queries.

    5.5) Root cause analysis

        5.5.1) Checked the specific php libraries:
            libraries/src/Component/ComponentHelper.php:296
            libraries/src/Application/SiteApplication.php:210, etc..

    - Using var_dump($component), on SiteApplication.php:210 found: 

           $component = NULL

        - The same '$component = "com_content"' on the home page of a default Joomla application (unzip Joomla 4.3.4 zip & install & check value on Joomla home page).

        - Test with hard coded $component = "com_content" in libraries/src/Application/SiteApplication.php:210

                if(empty($component)){
                     $component = "com_content";
         
       }


        - With this 404 was gone & a broken site home page came up with a few Category links listed out

        - Clicking on Category link was showing that "No Article linked to Category", despite there being several Articles imported from source db dump.

        5.5.2) Localizing issue with Content/ Article loading:
        - Hit the direct Article url:
            http://<site_name>/index.php?option=com_content&view=article&id=<article_id>

        - This gave another error"404 Article not found", though the specific <article_id> was present in the database.

        - J! Info provided the corresponding php file and db query used to fetch article by id which was giving no result

    5.5.3) Issue with imports of all "datetime DEFAULT NULL" fields

    - On exploring the query further, it was seen to have checks for publish_up & publish_down dates. These needed to be either NULL or set to a date earlier (/later) than date NOW for publish_up (/publish_down).

    - In the "#_content" table publish_up & publish_down dates values were showing as "0000-00-00 00:00:00" (i.e. were imported as 0) in place of NULL.
This was causing all records being filtered out.

    - It also meant that wherever the "datetime default NULL" fields were imported the same issue was happening. 

        - A check revealed 30 other J! tables with the same issue.
 
        - Prepared a script to update each of these datetime fields to NULL in the 30 tables.
            UPDATE `#_content` SET `checked_out_time` = NULL, `publish_up` = NULL, `publish_down` = NULL;

            UPDATE `#_categories` SET `checked_out_time` = NULL;
                                                                     .... 
for all the affected tables!

With that the issue was resolved & site home page became functional!

Saturday, September 28, 2024

Sexy Polling Reloaded Extension (Plugin) on J4 with MySql 8

For anyone installing the plugin SexyPolling 4.1.7 on a Joomla 4.3.4 with a MySql 8.0 db on an Ubuntu system there may be issues with default value for Text fields. More specifically error in setting default value for country, city, etc TEXT fields:

    "BLOB, TEXT, GEOMETRY or JSON column 'country' can't have a default value"

1) There is a solution for MySql 8.0 to set DEFAULT values for TEXT fields. The CREATE statement for table `#_sexy_votes` needs to be changed to:

         // Modify the sexypolling plugin CREATE TABLE script:
            CREATE TABLE `#_sexy_votes` (
              `id_vote` int(10) unsigned NOT NULL AUTO_INCREMENT,
                  ....
              `country` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `city` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `region` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              `countrycode` text NOT NULL DEFAULT (_utf8mb4'Unknown'),
              PRIMARY KEY (`id_vote`),
                  .....
            ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;


Further, in order for the CREATE table changes to take effect & not get dropped/ altered, a few of the plugin's installer scripts needs to be modified. The installation then needs to be done from a folder (or a modified zip file) in which the modified plugin installer scripts are present (instead of the downloaded joomla_plugin_sexypolling_reloaded_v4.1.7.zip file), as explained next.

2) Installation of plugin from /tmp folder 

2.1) Unzip the downloaded joomla_plugin_sexypolling_reloaded_v4.1.7.zip file to the site /tmp folder as mentioned in the site configuration.php file (e.g. /var/www/html/<site_name>/tmp). Give the folder proper read/write permissions.

2.2) Change CREATE TABLE `#_sexy_votes` command  in /tmp/com_sexypolling/admin/install/sql/install.sql:

Set the DEFAULT value for country, city, region, countrycode to  "DEFAULT (_utf8mb4'Unknown')" as mentioned above.
 
2.3) Remove ALTER TABLE `#_sexy_votes` command from /tmp/com_sexypolling/scriptfile.php. 

     Put an invalid condition check on line 235 of the script to stop ALTER TABLE for `#_sexy_votes` to run:

         $alterSexyVotes=false;

         if($alterSexyVotes && is_array($columns_titles)) { 

            ...

2.4) Finally, install:

  • Option A: Install from modified com_sexypolling folder: Install the extension from the folder /tmp/com_sexypolling from the J! "Admin" > "System" > "Install Extensions" > "Install from Folder" page.
  • Option B: Zip & Install modified com_sexypolling folder: Another option could be to manually zip the folder with the modifications (/tmp/com_sexypolling) & install using this zip file from the standard J! "Admin" > "System" > "Install Extensions" > "Upload Package File" page.

 

Sunday, August 25, 2024

Java Versions & Features

Visual summary of Java Features added since Java 9. Feature clusters show the focus areas over the years. 

  • Initially (ver 9+) focus was on adding some scripting type features & stabilizing the big ticket features added previously.
  • GC & Performance was in focus through the next several versions.
  • Patterns with Switch, InstanceOf, Type, etc have comein since ver 11+.
  • From 14+ Foreign Memory, Vector API, Unix Socket, etc various performant direct host I/O/ parallel computing features have made it in.
  • Some syntactic additions like Module import, When clause, etc are part of the more recent releases.

References:

  • Diagram's datasheet
  • https://medium.com/@chandantechie/comprehensive-list-of-java-versions-with-key-features-and-upcoming-releases-54be35646cca
  • https://docs.oracle.com/en/java/javase/23/language/java-language-changes.html#GUID-6459681C-6881-45D8-B0DB-395D1BD6DB9B
  • https://en.wikipedia.org/wiki/Java_version_history
  • https://www.marcobehler.com/guides/a-guide-to-java-versions-and-features#_java_features_8_20
  • https://www.javatpoint.com/java-versions
  • https://howtodoinjava.com/series/java-versions-features/


Monday, August 19, 2024

Pygradle for Python-3

Gradle, the build workhorse from the Java ecosystem, extends its support to Python through Pygradle. A recent attempt to build a Python-3.x project using Pygradle though did't work as expected. 

The delta between the supported Python-2.x vs Python-3.x is hard to reconcile with many issues like:

  • Need for a specific, old version of Java (ver.8), Gradle (ver. 5.0), etc
  • Dependencies on old versions of Python modules without backwards compatibility
    • Hard to figure out which exact version will work
    • A rule of thumb is to pick the highest version dependency module around some cut-off year like 2018/19, post which they don't seem to build
  • Downloading of the correct dependencies & creating ivy files
    • Includes identifying the right version, name, dependencies-within-dependencies (that no longer work on Python-3.x), etc.
  • Using a local file system based repo to download & build modules & ivy files

With some effort though, have been able to complete a successful build on a Python-3.8 on an Ubuntu-20.04 with Java-8 & Gradle-5.0. More details are available on the pygradle_python3_example repo. Hope this helps!

Monday, August 12, 2024

To Mock a Cloud

Cloud hosting has been the norm for a while now. Saas, Paas, Iaas, serverless, AI whatever the form may be, organizations (org) need to have a digital presence on the cloud. 

Cloud vendors offer hundreds of features and services such as 24x7 availability, fail-safe, load-balanced, auto-scaling, disaster resilient distributed, edge-compute, AI/ Ml clusters, LLMs, Search, Database, Datawarehouses among many others right off-the-shelf. They additionally provide a pay-as-you-go model only for the services being used. Essentially everything that any org could ask for today & in the future!

But it's not all rosy. The cloud bill (even though pay-as-you-go) does burn a hole in the pockets. While expenses for the live production (prod) environment is necessary, costs for the other dev, test, etc, internal environments could be largely reduced by replacing the real Cloud with a Mock Cloud. This would additionally, speed up dev and deployment times and make bug fixes and devops much quicker & streamlined.

As dev's know mocks, emulators, etc are only as good as their implementation - how true they are to the real thing. It's a pain to find new/ unknown bugs on the prod only because it's an env very different from dev/ test. Which dev worth his weight in salt (or gold!) hasn't seen this ever?

While using containers to mock up cloud services was the traditional way of doing it, a couple of recent initiatives like Localstack, Moto, etc seem promising. Though AWS focussed for now, support for others are likely soon. Various AWS services like s3, sns, sqs, ses, lambda, etc are already supported at different levels of maturity. So go explore mocks for cloud & happy coding!

Monday, July 22, 2024

Cloudera - Streaming Data Platform

Cloudera has a significantly mature streaming offering on their Data Platform. Data from varied sources such as rich media, text, chat, message queues, etc is brought in to their unified DataFlow platform using Nifi or other ETL/ ELT. After processing these can be directed to one or more of the Op./ App DB, Data Lake (Iceberg), Vector DB post embedding (for AI/ ML), etc.

Streaming in AI/ ML apps help to provide a real-time context that can be leveraged by the apps. Things like feedback mechanism, grounding of outputs, avoiding hallucinations, model evolution, etc all of them require real-time data to be available. So with a better faster data, MLOPs platform Cloudera is looking to improve the quality of the ML apps itself running on them.

Cloudera has also made it easy to get stared with ML with their cloud based Accelarators (AMP). AMPs have support for not just Cloudera built modules, but even those from others like Pinecode, AWS, Hugging Face, etc & the ML community. Apps for Chats, Text summarization, Image analysis, Time series, LLMs, etc are available for use off the shelf. As always, Cloudera continues to offer all deployment options like on-premise, cloud & hybrid as per customer's needs.

 

Thursday, May 30, 2024

Mixture of Experts (MoE) Architecture

Enhancement to LLMs to align with expert models paradigm. 

  • Each expert implemented as a separate Feed Forward Network (FFN) (though other trainable ML models Backprop should work).
  • The expert FFNs are introduced in parallel to the existing FFN layer after the Attention Layer.
  • Decision to route tokens to the expert is by a router. 
  • Router is implemented a linear layer followed by a Softmax for probability of each expert, to pick the top few.

Monday, April 1, 2024

Gurobi Optimizer

Gurobi stack consists of various modules in Python (Gurobipy) & other languages for solving Optimization problems. Think of scheduling, routing, cost minimization, profit maximization, flow decision, OR, assignment and so on. They have all the classical Linear Programming, ILP, Greedy, Constrained Optimization type algos properly implemented & ready for use at scale.

Off late they are fusing Mathematical Optimizations with AI to yield much better modules. Their stack includes Neural Nets, DNN, Differential Programming, Simulators, Reinforcement Learning and all the other tools required to fuse ML & Optimization. They also have hardware & cloud offerings now. These can be good places to start of by uploading modules that need to be optimized on demand. The output results can be integrated within applications/ workflows.   

Monday, March 25, 2024

VR Movies

Watching movies on VR headset was an experience like none other. Thanks to the organizers from Goethe Institute & IHC for hosting such a unique event for the viewers.

Immersive movies & 360 filmmaking is a rather new development taking place in the world of cinema. International events like the VRHAM Film Festival is exclusively being organized since 2018 for VR movies makers. All the biggies from the tech world are in on it with VR headsets catering to the growing demands. So the action is hotting up on the AR/ VR front.

Going back the movies, there were about ten of them on display. These were short ones of about 15 min each curated by U. Schauth.  I got the opportunity to watch:

Each movie was remarkable. Distinct stories, providing an immersive experience to our connected pasts. Highly recommend the experience to all.


Sunday, March 10, 2024

Gaming World

Recently got an opportunity to attend the India Gaming Summit 2024 in person. This was truly an insightful first peek into the world of the gamers!

All kinds of gaming professions have been gaining traction over the last few years. On the one end of the spectrum are the elite ESport Atheletes who compete on national & international forums. On the other there are Casual Gamers, playing games on their mobiles & computers for fun, entertainment, and as a recreational pass time. 

On a slightly different tangent are the gamers playing Real Money Games (RMG). They play games (like poker, etc) with actual monetary bets & rewards (losses). There is a wide age profile mix among all the different kinds of gamers. From teenagers to senior citizens to home makers to professionals it seems the whole world is busy playing games, not just in their free time. Though preferences for different types of games vary across demographics.

Those considerations and more are the lookout of the other kind of gaming professionals - the game developers. These are the tech & biz folks building gaming companies & startups. They are busy coming up with newer and popular games which appeals to their audiences. Issues of profits, growth, user-base, market capture, freshness & appeal, newer products, marketing, recruitment, etc. are among many of the organizational concerns on their minds.

Fluidity on the taxation front is giving gitters to the whole industry. A consistent and steady policy from the government is the need of the hour. At the same time social & heath issues like addiction, isolation, mental health issue are also serious concerns of the entire gaming industry. 

Several technological interventions like compulsory lay off time after a certain period of playing, etc are being brought in. As well as education & health interventions. While there seems to be a general acknowledgement of the issues, individual solutions may differ yielding varying results. A regulatory/ governance model is also needed here. Self-regulatory models while promising may/ may not work. Better is to institute a proper governance framework with checks & balances in place.

Finally, for what makes gaming worthwhile look at the success of Monopoly Go, a digitized version of the children's board game. The game is so popular that it  touched $1 Bn in revenues within 7 months of release & doubled that over the next 3 months. With that in mind, keep an eye out on all the action from the gaming world!



Tuesday, December 5, 2023

Pledge to Donate Organs

Across the nation there is a long list of patients waiting for matching organs such as liver, lungs, kidneys, etc to be transplanted from deceased donors. Yet the number of deceased donors & their families coming forward to donate organs is very small. 

There may be various reasons for the low numbers like awareness, knowledge, traditional, societal/ family norms, beliefs, etc. More importantly time is of essence when transplanting from deceased donors. All parties involved need to be on mission mode alertness and promptness. Any rethink or delay at such a critical stage can make the entire process futile. Always remember that transplanted organs can save lives!

The National Organ Transplant Organization (NOTTO) is the central body responsible for registering and managing organ donations. NOTTO has made it easy for individuals to pledge to donate their organs after demise online. The pledge as taken by the deceased while living makes it a lot smoother to conduct the transplant after their demise.

Others like MohanFoundation are also busy building awareness around organ donations. They host regular events and sessions on the topic across corporate houses, educational institutes, health facilites and so on and online.

To know more & to Pledge check out - Mohan Foundation Pledge, Hospitals accepting donations across cities, Army AORTA.

Saturday, November 11, 2023

Starting off with Databases

A note shared with a friend on getting started with DB on a Windows env. Putting it up for the larger audience.

1) Try MySql (or Postgre) DB Online via Browser:

• https://onecompiler.com/mysql/3zt5uh4dc
• https://www.w3schools.com/mysql/mysql_exercises.asp
• https://www.w3schools.com/mysql/exercise.asp
• https://www.mycompiler.io/online-mysql-editor
• https://www.mycompiler.io/new/mysql
• https://extendsclass.com/postgresql-online.html


2) Install MySql on Windows:

• https://dev.mysql.com/downloads/installer/


3) Run Windows Virtual Machine (VM) with a MS Sql DB installed in that VM:

3.1) Use either VMPlayer or VirtualBox as the virtualization software

VMWare Player: https://www.vmware.com/in/products/workstation-player.html
Oracle VirtualBox: https://www.virtualbox.org/wiki/Downloads


3.2) Download the corresponding VM:

• https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/


3.3) Login to the VM & install MS Sql server in it

Hope it helps.

Friday, August 18, 2023

On Patents

Quick notes on Patents. (To be improved over time )...

On Patent Search:

  • Google patent search doesn't cover India
  • For India: https://iprsearch.ipindia.gov.in/PublicSearch/
  • For World (includes India): https://worldwide.espacenet.com/patent/


For startup'ish low cost offerings:

  • https://www.onlinelegalindia.com/services/permanent-patent/
  • https://www.legalkart.com/legal-consultants-for-startups/intellectual-property/patent
  • https://intellectvidhya.com/patent-landing-page/
  • https://www.legalraasta.com/nation/patent_filing.html
  • https://ipflair.com/#Patentcalculator
  • https://www.zatapult.com/
(Note: Just listing them out as a ready reckoner. No experience with any of them. Please do your due diligence & check out everything thoroughly.)

 



Friday, September 30, 2022

Presentation to Image Converter

This article explains how to convert PPT/ Impress (Libreoffice) presentation file(s) to JPG Image(s) in a *NIX (Ubuntu) environment. Presentation file can be made up of several (N) slides which after final conversion yields one JPG image per slide (N JPG files).

Prerequisites software:

  • libreoffice
  • pdftoppm

 Conversion Process:

   PPT            --->     PDF           ----> JPG

   (N-slides)          (N-pages)          ----> JPG

                                                           .....

                                                              ----> JPG (N-JPG files, one per slide)

Steps to Convert

1. Convert PPT file to PDF

$ libreoffice --convert-to pdf "fileName.ppt" --outdir "outputFolderName"

(Note: For the given input file name fileName.ppt, this script creates an output file fileName.pdf in the specified outdir.)

2. Convert PDF to JPG

$ pdftoppm -jpeg -r 200 "outputFolderName/fileName.pdf" "imagePrefix_"

(Note: Image prefix is a text that can be added to the image file names.)

Finally, these steps are put to a shell script to allow it to convert all Presentations newly added to a folder inside called "PRESENTATIONS/Active/" in the user's Home folder.

Sunday, February 20, 2022

OCR

Tesseract that "quirky command-line tool that does an outstanding job" (credit A. Kay) truly works well.  Give it a shot whenever you get the opportunity.

Sample commands for ref:

  •    tesseract IMG-1.jpg IMG-1 --psm 4
  •    tesseract -l eng IMG-2.jpg b1


Sunday, February 6, 2022

Marble's Equity Distribution Model

The Marble's Equity Distribution model can be used by very early stage founders to fairly split equity among themselves. The key aspect of the model is to split the Equity across the founders based on their contributions to different Areas such as Sales, Marketing, Technology, etc (see Col. 'Area'), where each Area is assigned a relative weight (see Col. 'AreaContrib').

For the calculation shown below, number of founders is set as N=3, with the weight of the Marble W=2. In a hypothetical set-up all founders contribute equally to every area, the Equity split per head in that case is 32 (see Col. 'AreaContribPerFounder') or the Marble split per head is 16 (see Col. 'MarblePerAreaContribFounder').  

However, in reality the 1st founder (Fndr_1) is more of a Ops., Customer Support, HR generalist with some prior domain knowledge and the idea. Fndr_2 is the technologist with some strategy & management experience expected to come up with smart digital solutions. Fndr_3 carries wide Sales, Marketing, Ops, experience along with the Relations among the Investor. Fndr_3 also brought in the lions share of the initial seed capital used to boot the startup.

After the re-balancing of the marbles the Final Equity distribution stands at 23, 33 & 44 for the three founders. A further 5 - 7 % of re-balancing could take place depending upon the discussions and negotiations between the founders. While there is a no correct way of equity distribution having a framework like the Marble Equity Distribution helps to keep the process objective and free from let downs, clashes and unfairness.


S.No Area AreaContrib AreaContribPerFounder
= AreaContrib/ NoFounders
MarblePerAreaContribFounder
= AreaContribPerFounder
/ WeightMarble
Fndr_1 Fndr_2 Fndr_3
1 Sales 22 7 3.5 0 -3.5 3.5
2 Marketing 10 3 1.5 -1.5 -1 2.5
3 Technology 20 7 3.5 -3.5 7 -3.5
4 Operations,
Customer Support
10 3 1.5 0.5 -1 0.5
5 HR 10 3 1.5 -1 2 -1
6 Legal 3 1 0.5 -0.5 -0.5 1
7 Finance, Payroll 5 2 1 -1 -1 2
8 Investor Relations,
Networking
10 3 1.5 -1.5 -1 2.5
9 Initial Investment,
Seed Capital
10 3 1.5 -1.5 -1 2.5
10 Total 100 32 16 -10 0 10
11 Initial Distribution


33 33 34
12 Final Distribution


23 33 44









NoFounders (N) 3





WeightMarble (W) 2




 

Monday, January 10, 2022

Water Crisis

At a time when major cities across India like Bangalore and Delhi are experiencing a major water crisis, critical interventions are the need of the hour. For what could work one should look at fellow nation South Africa for their handling the Day Zero crisis. The day when there is no more portable water available for use by the citizen. Here's some related coverage "Day Zero: Where Next?" (https://www.nationalgeographic.com/science/article/partner-content-south-africa-danger-of-running-out-of-water) & "Bengaluru is dying of thirst because it’s drinking its own Kool-Aid" (https://the-ken.com/the-nutgraf/bengaluru-is-dying-of-thirst-because-its-drinking-its-own-kool-aid/).

Reverse Osmosis (RO) water purifiers are both a boon & bane for the average household. Whith supply water TDS remaining way way above the palatable levels, ordinary non-RO basic filteration machines are rendered useless. But then RO machines end up throwing away waste water to the levels of about 5 - 10 litres (depending upon various factors) for every litre of drinking water purified. A criminal waste of the precious resource!


RO Water Recycling Bucket


Now we've been recycling the RO Waste water for other household cleaning, watering, etc purposes. This process might take you back in time to the days of filling up buckets of water from the supply line (a reality for many to this day), well, etc for use. Though a bit cumbersome this recycling bit works. In a span of one day we may be able to collect about 2 - 3 buckets (30 - 40 litres) of water which would otherwise have gone down the drain. All said and done, it's well worth the effort!


Monday, October 4, 2021

Unlimited Hassles

There's been a huge churn within the telecom sector in India over the last couple of years. These were precipitated by the laws and taxation policies in force, along with some rampant noncompetitive predatory practices, rock bottom pricing, m & a, essential upgrades to technology and infrastructure and so on, alongside a high growth of mobile phone & internet users (100+ crores) in the country.

The last factor helped bridge the connectivity and digital divide between the rural and the urban parts of the nation. Users of all age groups from all over came on board and got hooked on to social media sites and chatting apps. Online meetings, business communications, schooling, banking and payments, etc. went the mobile apps route.

While things were good for a while, a flip side to the story emerged soon. The large scale adoption was brought on by unsustainable predatory pricing by the players, esp. the new entrants. Which was closely followed by lowering of prices by the rest of the players. This race to the bottom, as expected, led to sinking of all but the most financially solvent ones. While some exited, others merged, the rest continue to struggle to stay afloat. An upward revision of prices therefore seems like the only way out of this mess.

On the other hand, a rise in prices will likely result in a drop in the number of users, particularly from the marginalized and weaker sections of the population. Perhaps a study is in order (or already done) which shows the impact per thousand (or lakh) users for every rupee (or ten) increase in prices. This mobile inclusivity for the citizens gained at long last must not be lost at any cost. Incorrect policies, corporate practices, profit motives, etc. of the past should not result in the nation regressing on the digital inclusivity front.

A sure shot Catch-22 for the policy makers from the sector: 

- To save the telecom players (via upward price revisions), or

- To preserve/ promote digital inclusivity for the citizens (particularly for the vulnerable).

One option that can be considered is to relook at the telecom pricing model. Telecom players these days offer various "Unlimited Plans". These have bundled unlimited data and call time (with daily sub-limits of a few gigs, minutes, etc.). These are therefore among the most popular plans and have led to an explosion of daily usage. People no longer care about the usage, while calling or using the internet/ data packs. As a result mobile bandwidths are practically choked all through the day. Poor quality services including frequent call drops, false rings, slow data connections are a menace for everyone. Plus there is also the adverse impact on the environment due to constant energy wastage happening at the level of the devices, network, switches, mobile towers, and so on.

The telecom pricing model in the past was the much more sensible "Pay-As-You-Go" model. Just like other shared basic need utilities available in a limited supply such as water, electricity, etc. telecom bandwidth (service) should also revert to the standard pay-as-you-go. This prevents wastage and allows a much fairer distribution of constrained resources.

There is a flat/ fixed nominal monthly subscription charge, and a variable usage cost billed per unit. Additionally by having separate consumption slabs, heavy/ corporate users can be made to pay more (as per a high cost slab), while the normal/ light users allowed to pay less. Thereby, making it easy on the pocket of the normal user and yet profitable for the telecom players.

The allied benefit of pay-as-you-go pricing will be that the number of mindless forwards, fakes, misinformation/ disinformation will go down, if not entirely disappear. Most people would be averse to spending even a few rupees daily towards the barrage of forwards and fakes. Resulting in a socially better and environmentally healthier world to live in!

Finally, to ensure inclusivity for the needy segments of the society and so that nobody gets left out, a separate "Janta (Citizen) Mobile Plan" could be introduced & a direct-to-account bill subsidy constituted. These little changes along with other significant ones on the corporate policy, laws, taxation and fair trade practices sides will ensure that India regains its lost ground in the telecom sector.