<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3323050992314705337</atom:id><lastBuildDate>Wed, 09 Jul 2025 13:05:09 +0000</lastBuildDate><category>PHP</category><category>Javascript</category><category>Joomla</category><category>Laravel</category><category>JQuery</category><category>Codeigniter</category><category>Web Server</category><category>Angular</category><category>Internet</category><category>MySQL</category><category>Linux</category><category>GIT</category><category>Plesk/Windows Server</category><category>tHoughts</category><category>Coldfusion</category><category>Laravel-Lumen</category><category>Amazon EC2 Server</category><category>Linux Server</category><category>Nepal र Nepali</category><category>Others</category><category>Regex</category><category>Ubuntu</category><category>Database</category><category>Gulp</category><category>HTML</category><category>Magento</category><category>OS</category><category>Python</category><category>Wordpress</category><category>XML</category><category>Apache</category><category>Bash</category><category>Bootstrap</category><category>Bower</category><category>Cloud Server</category><category>Composer</category><category>Docker</category><category>MacOS</category><category>NodeJS</category><category>Oracle</category><category>Python
Flask</category><category>SQL</category><category>Spam</category><category>AWS</category><category>CSS</category><category>Drivers</category><category>GitLab</category><category>Global IRIS</category><category>Google Map</category><category>Hacked</category><category>Health</category><category>Logic</category><category>NPM</category><category>SAML2</category><category>Smarty</category><category>TypeScript</category><category>Video</category><category>Woocommerce</category><category>World Pay</category><title>RC (आर.सी.)</title><description></description><link>http://rcadhikari.blogspot.com/</link><managingEditor>noreply@blogger.com (RC Adhikari)</managingEditor><generator>Blogger</generator><openSearch:totalResults>219</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-6286257767984179921</guid><pubDate>Fri, 09 Feb 2024 08:14:00 +0000</pubDate><atom:updated>2024-02-09T14:01:01.685+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Oracle</category><title>Oracle - Handling Exceptions to Oracle Queries</title><description>In Oracle DB, if we already have data in the table and would like to use exceptions to handle errors, please follow below approach:&lt;pre&gt;declare
 e_col_exists exception;
 pragma exception_init(e_col_exists,-1430);
 e_invalid_identifier exception;
 pragma exception_init(e_invalid_identifier,-904);
begin
  begin
    execute immediate 'alter table tbl_questions add value_new varchar2(4000 CHAR) null';
    exception
      when e_col_exists then
        null;
  end;
  begin
    execute immediate 'update tbl_questions set value_new = value';
  end;
  begin
    execute immediate 'alter table tbl_questions drop column value';
    exception
      when e_invalid_identifier then
        null;
  end;
  begin
    execute immediate 'alter table tbl_questions rename column value_new to value';
    exception
      when e_invalid_identifier then
        null;
  end;
end;  
/
&lt;pre&gt;------&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;Explanation:&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;p data-sourcepos="3:1-3:32" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 24px 0px; text-wrap: wrap; word-break: break-word;"&gt;1. &lt;code style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;e_col_exists&lt;/code&gt; exception:&lt;/p&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;ul data-sourcepos="5:1-8:0" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 4px 0px; padding-inline-start: 36px; white-space: normal;"&gt;&lt;li data-sourcepos="5:1-6:0" style="margin-bottom: 10px;"&gt;&lt;p data-sourcepos="5:3-5:152" style="margin: 24px 0px; white-space-collapse: preserve; word-break: break-word;"&gt;This exception is likely used to handle situations where a column referenced in your code doesn't actually exist in the table you're trying to access.&lt;/p&gt;&lt;/li&gt;&lt;li data-sourcepos="7:1-8:0" style="margin-bottom: 10px;"&gt;&lt;p data-sourcepos="7:3-7:199" style="margin: 24px 0px; white-space-collapse: preserve; word-break: break-word;"&gt;The &lt;code class="" style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;pragma exception_init&lt;/code&gt; line associates the exception with the error code &lt;code class="" style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;-1430&lt;/code&gt;. This error code typically corresponds to the ORA-01430 error message, which indicates "column does not exist".&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;p data-sourcepos="9:1-9:40" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 24px 0px; text-wrap: wrap; word-break: break-word;"&gt;2. &lt;code style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;e_invalid_identifier&lt;/code&gt; exception:&lt;/p&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;ul data-sourcepos="11:1-14:0" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 4px 0px; padding-inline-start: 36px; white-space: normal;"&gt;&lt;li data-sourcepos="11:1-12:0" style="margin-bottom: 10px;"&gt;&lt;p data-sourcepos="11:3-11:186" style="margin: 24px 0px; white-space-collapse: preserve; word-break: break-word;"&gt;This exception is likely used to handle situations where an identifier (e.g., a variable name, column name, etc.) used in your code is invalid or doesn't follow the naming conventions.&lt;/p&gt;&lt;/li&gt;&lt;li data-sourcepos="13:1-14:0" style="margin-bottom: 10px;"&gt;&lt;p data-sourcepos="13:3-13:195" style="margin: 24px 0px; white-space-collapse: preserve; word-break: break-word;"&gt;The &lt;code class="" style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;pragma exception_init&lt;/code&gt; line associates the exception with the error code &lt;code class="" style="background-color: var(--bard-color-surface-container-high); border-radius: 6px; color: var(--bard-color-on-surface-variant); font-family: &amp;quot;Google Sans Mono&amp;quot;, monospace; font-size: 0.875rem; line-height: 1.25rem; padding: 1px 6px;"&gt;-904&lt;/code&gt;. This error code typically corresponds to the ORA-00904 error message, which indicates "invalid identifier".&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;p data-sourcepos="15:1-15:233" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 24px 0px; text-wrap: wrap; word-break: break-word;"&gt;By defining these custom exceptions, you can make your code more robust and easier to maintain. When either of these exceptions is raised, your code can handle the error gracefully instead of crashing or producing unexpected results.&lt;/p&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;p data-sourcepos="17:1-17:40" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 24px 0px; text-wrap: wrap; word-break: break-word;"&gt;Here are some additional points to note:&lt;/p&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;ul data-sourcepos="19:1-22:0" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 4px 0px; padding-inline-start: 36px; white-space: normal;"&gt;&lt;li data-sourcepos="19:1-19:111" style="margin-bottom: 10px;"&gt;You can define custom exceptions to handle any specific error conditions you want to anticipate in your code.&lt;/li&gt;&lt;li data-sourcepos="20:1-20:184" style="margin-bottom: 10px;"&gt;It's generally considered good practice to define custom exceptions for situations that are specific to your application logic and not already covered by standard Oracle error codes.&lt;/li&gt;&lt;li data-sourcepos="21:1-22:0" style="margin-bottom: 10px;"&gt;You can use exception handlers to trap these custom exceptions and take appropriate actions when they occur.&lt;/li&gt;&lt;/ul&gt;&lt;span style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; white-space: normal;"&gt;&lt;/span&gt;&lt;p data-sourcepos="23:1-23:80" style="background-color: white; color: #1f1f1f; font-family: &amp;quot;Google Sans&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, sans-serif; font-size: 16px; margin: 24px 0px; text-wrap: wrap; word-break: break-word;"&gt;I hope this explanation helps! Feel free to ask if you have any other questions.&lt;/p&gt;&lt;/pre&gt;&lt;/pre&gt;</description><link>http://rcadhikari.blogspot.com/2024/02/oracle-handling-exceptions-to-oracle.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-677431726433640112</guid><pubDate>Fri, 15 Sep 2023 11:48:00 +0000</pubDate><atom:updated>2023-09-15T17:34:29.365+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Python</category><category domain="http://www.blogger.com/atom/ns#">Python
Flask</category><title>Python method to convert Array to Unique Array</title><description>Python Function to filter array and create unique array list

&lt;pre class="brush: python;" name="code"&gt;

def array_unique(array_list):
    list = np.array(array_list)
    return np.unique(list)

&lt;/pre&gt;</description><link>http://rcadhikari.blogspot.com/2023/09/python-method-to-convert-array-to.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-3939897944338385300</guid><pubDate>Wed, 02 Nov 2022 14:51:00 +0000</pubDate><atom:updated>2022-11-02T20:36:10.476+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Python</category><title>Python - To read file content &amp; write into a file</title><description>
&lt;pre class="brush: python;" name="code"&gt;
from pathlib import Path


# Read file content
def read_file():
    test_file = "example/you_test_file.txt"

    contents = Path(test_file).read_text()

    print (contents) # print file content

    #debug(contents) # use can also use my custom debug method to see log in file



# To write message to file for debugging
def debug(message="", type="w+"):
	filePath = "test/debug.txt" # don't forgot to create a empty file

    with open(filePath, type) as f:
        f.write(str(message) + "\n\n")
    f.close()
    

&lt;/pre&gt;</description><link>http://rcadhikari.blogspot.com/2022/11/python-to-read-file-content-write-into.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-8526468366850362931</guid><pubDate>Thu, 19 May 2022 09:52:00 +0000</pubDate><atom:updated>2022-05-19T15:39:54.099+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Bash</category><title/><description>Simple bash stements to set values covering following two scenarios:
1. Set username/password variable if value passed on running the file
2. Or (step 1 doesn't pass values), set them on prompt arguments

Create a &lt;i&gt;login.sh&lt;/i&gt; file using the below content:
&lt;pre class="brush: bash;" name="code"&gt;
#!/bin/sh

# set -o errexit -o nounset -o xtrace

echo "Initialising Username/Password: "

if test "${1+x}"; then # Set values from inline statement
  username=$1
  password=$2  
else # Otherwise, set values from arguments
  read -p 'Username: ' username
  read -sp 'Password: ' password
fi

echo 'Username: ' $username '| Password: ' $password
&lt;/pre&gt;

1. First scenario, passing the values whilst running the file
&lt;pre class="brush: bash;" name="code"&gt;
$ sh login.sh nepal.user Pokhara123
Username:  nepal.user | Password:  Pokhara123
&lt;/pre&gt;

2. Second scenario, passing the values on prompt arguments
&lt;pre class="brush: bash;" name="code"&gt;
$ sh login.sh 

$ sh login.sh
Initialising Username/Password:
Username: nepal.user
Password: Pokhara123
Username:  nepal.user | Password:  Pokhara123
&lt;/pre&gt;</description><link>http://rcadhikari.blogspot.com/2022/05/simple-bash-stements-to-set-values.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-3147923437260940755</guid><pubDate>Wed, 27 Apr 2022 15:45:00 +0000</pubDate><atom:updated>2022-04-27T21:30:38.200+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Python
Flask</category><title>Build Dynamic Marshal_With in Flask (Python) based on conditions</title><description>To create a dynamic marshalling based on condition or parameter type, please follow the instruction below:

&lt;pre class="brush: python;" name="code"&gt;

# Constants
MARSHELL_WITH_SCHEMAS = {
    "condition_1": Condition1Schema,
    "condition_2": Condition2Schema,
}


# To build dynamic marshalling based on report type
def selective_marshal_with():
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            condition_type = kwargs.get("condition_type", None)

            # Get marshalled with dynamic schema by condition type
            marshal_with_func = marshal_with(MARSHELL_WITH_SCHEMAS.get(condition_type, None))(func)

            return marshal_with_func(*args, **kwargs)

        return wrapper

    return decorator

# Actual class to connect view to URL
class MyViewClass(MethodResource, Resource):
    @doc(description="My View API", tags=["My View List"])
    @use_kwargs(MyQueryParams, location="query")
    @selective_marshal_with()
    @standard_api("My View List")
    def get(self, **kwargs):
        # you get code here....
    
&lt;/pre&gt;

The MyQueryParams can/should be in seperate schema file for e.g. rest/db/schema/my_view_schema.py
&lt;pre class="brush: python;" name="code"&gt;

class MyQueryParams(Schema):
    """Query parameters for View List API."""

    condition_type = fields.Str(attribute="condition_type", required=True)

&lt;/pre&gt;

Hope it helps!</description><link>http://rcadhikari.blogspot.com/2022/04/build-dynamic-marshalwith-in-flask.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total><georss:featurename>London, UK</georss:featurename><georss:point>51.5072178 -0.1275862</georss:point><georss:box>23.196983963821154 -35.2838362 79.817451636178845 35.0286638</georss:box></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-4126810415749971623</guid><pubDate>Fri, 05 Mar 2021 14:01:00 +0000</pubDate><atom:updated>2021-03-09T23:16:07.548+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Count number of PDF file pages in PHP</title><description>Below function returns the number of pages count in PHP
&lt;pre class="brush: php;" name="code"&gt;
function getPageCount(StreamInterface $stream): int
{
        $result = 0;

        $stream-&gt;rewind();

        while (! $stream-&gt;eof()) {
            $chunk = $stream-&gt;read(4096);

            //  looking for root node PDF 1.7+
            $found = \preg_match('/\/Type\s*?\/Pages(?:(?!\/Parent).)*\/Count\s?(?&lt;value&gt;\d+)/', $chunk, $matches);

            if (0 &lt; $found) {
                return (int) $matches['value'];
            }

            //  looking for root node PDF &lt; 1.7
            $found = \preg_match('/\/Count\s?(?&lt;value&gt;\d+)\s?\/Type\s*?\/Pages/', $chunk, $matches);

            if (0 &lt; $found) {
                return (int) $matches['value'];
            }
            
            //  looking for root node PDF 1.7
            // Both regex1 &amp; regex2 should work, but $regex2 is preferred.
            $regex1 = '/(?&lt;=\/Type\s\/Pages\s(.*)\/Count\s)\d*/gs';
            $regex2 = '/\/Type\s*?\/Pages\s.*\/Count\s?(?&lt;value&gt;\d+)/s';
            $found = \preg_match($regex2, $chunk, $matches);
            
            if (0 &lt; $found) {
                return (int) $matches['value'];
            }

            //  looking for /Type/Page
            $found = \preg_match_all('/\/Type\s*?\/Page\s+/', $chunk, $matches);

            if (0 &lt; $found) {
                $result += $found;
            }
        }

        $stream-&gt;rewind();

        return $result;
}
&lt;/pre&gt;</description><link>http://rcadhikari.blogspot.com/2021/03/count-number-of-pdf-file-pages-in-php.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-3722980599629977852</guid><pubDate>Wed, 02 Sep 2020 22:38:00 +0000</pubDate><atom:updated>2020-09-03T04:23:53.169+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">PHP</category><category domain="http://www.blogger.com/atom/ns#">Regex</category><title>PHP Regex function to extract text between tags for a synopsis or intro text</title><description>&lt;p&gt;
  The following method prepare the synopsis from the body and the second part is for unit tests:
&lt;/p&gt;

&lt;p&gt;
&lt;div&gt;
 &lt;script src="https://gist.github.com/rcadhikari/60d779c6af15bb8238618ae5ab77fee5.js"&gt;&lt;/script&gt;
&lt;/div&gt;

Hope it helps!</description><link>http://rcadhikari.blogspot.com/2020/09/php-regex-function-to-extract-text.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total><georss:featurename>London, UK</georss:featurename><georss:point>51.5073509 -0.1277583</georss:point><georss:box>23.197117063821153 -35.284008299999996 79.817584736178844 35.028491700000004</georss:box></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-2172126819098013635</guid><pubDate>Fri, 10 Apr 2020 23:47:00 +0000</pubDate><atom:updated>2020-04-11T05:33:06.314+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Angular</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>Fix for ng serve --watch is not watching for code changes in Ubuntu</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;; font-size: 14px; margin-bottom: 16px;"&gt;
I was running the Angular 8 application on Ubuntu LTS 18.04 on my machine and was having an issue to refresh on code update using&amp;nbsp;&amp;nbsp;&lt;span style="background-color: rgba(27 , 31 , 35 , 0.05); font-family: monospace; font-size: 11.9px;"&gt;--watch.&lt;/span&gt;&lt;br /&gt;
&lt;span style="background-color: rgba(27 , 31 , 35 , 0.05); font-family: monospace; font-size: 11.9px;"&gt;&lt;br /&gt;&lt;/span&gt;
Trying to use&amp;nbsp;&lt;code style="background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 11.9px; margin: 0px; padding: 0.2em 0.4em;"&gt;ng serve&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style="background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 11.9px; margin: 0px; padding: 0.2em 0.4em;"&gt;ng build --watch&lt;/code&gt;&amp;nbsp;was not watching for code changes and I thought it was something to do with&amp;nbsp;&lt;code style="background-color: rgba(27, 31, 35, 0.05); border-radius: 3px; box-sizing: border-box; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 11.9px; margin: 0px; padding: 0.2em 0.4em;"&gt;node or angular-cli&lt;/code&gt;.&lt;/div&gt;
&lt;div style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;; font-size: 14px; margin-bottom: 16px;"&gt;
However, I found the solution on Github (&lt;a href="https://github.com/angular/angular-cli/issues/8313" style="font-size: medium;"&gt;https://github.com/angular/angular-cli/issues/8313&lt;/a&gt;)&lt;/div&gt;
&lt;div style="background-color: white; box-sizing: border-box; color: #24292e; font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;; font-size: 14px; margin-bottom: 16px;"&gt;
I ran the following on Terminal and apparently, it worked and watching code changes:&lt;/div&gt;
&lt;pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 11.9px; line-height: 1.45; margin-bottom: 16px; overflow-wrap: normal; overflow: auto; padding: 16px;"&gt;&lt;code style="background: initial; border-radius: 3px; border: 0px; box-sizing: border-box; display: inline; font-family: SFMono-Regular, Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, monospace; font-size: 11.9px; line-height: inherit; margin: 0px; overflow-wrap: normal; overflow: visible; padding: 0px; word-break: normal;"&gt;echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf &amp;amp;&amp;amp; sudo sysctl --system&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Hope this helps!&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2020/04/ng-serve-watch-is-not-watching-for-code.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-8334088741859174866</guid><pubDate>Tue, 29 Oct 2019 13:42:00 +0000</pubDate><atom:updated>2019-10-29T19:27:46.182+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Angular</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>Angular 7 &amp; Jest &amp; Babel Integration over Jasmine/Karma - AngularSnapshotSerializer.js in the snapshotSerializers option was not found</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;b&gt;Steps to integrate of Jest &amp;amp; Babel with Angular 7+: &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
1. Run the following commands to install:
 &lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    # Remove Jesmin/Karma
    npm remove karma karma-chrome-launcher karma-coverage-istanbul-reporter karma-jasmine karma-jasmine-html-reporter
    
    npm uninstall jasmine @types/jasmine
    
    rm ./karma.conf.js ./src/test.ts

    # Install jest    
    npm install --save jest@24.9 @angular-builders/jest@7 @types/jest@24 jest-preset-angular@8 

    # Install babel
    npm install --save-dev babel-jest babel-polyfill
    npm install --save @babel/core @babel/preset-env @babel/preset-flow @babel/preset-typescript    
 &lt;/pre&gt;
&lt;br /&gt;
2. On `package.json`, added the following code:
 &lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    "scripts": {
      ...
      ...
      "test": "ng test",
      "test:watch": "jest --watch",
      ...
      ...
    }
    ...
    ...   
    "jest": {
      "preset": "jest-preset-angular",
      "setupFilesAfterEnv": [
        "&lt;rootdir&gt;/setupJest.ts"
      ]
    }
 &lt;/rootdir&gt;&lt;/pre&gt;
&lt;br /&gt;
3. Also, updated the following on the `angular.json`:
 &lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    ...
    ... 
    "test": {
       "builder": "@angular-devkit/build-angular:karma",
    ...
    ...
 &lt;/pre&gt;
&lt;br /&gt;
Replace with:
 &lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    ...
    ... 
    "test": {
       "builder": "@angular-builders/jest:run",
    ...
    ...
 &lt;/pre&gt;
&lt;br /&gt;
4. Create the `&lt;root&gt;/setupJest.ts` with below content:
 &lt;/root&gt;&lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    import 'jest-preset-angular';   
 &lt;/pre&gt;
&lt;br /&gt;
5. Create the `&lt;root&gt;/babel.config.js` with below content:
 &lt;/root&gt;&lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    module.exports = function(api) {

        const presets = [
            '@babel/preset-typescript',
             [
                "@babel/preset-env", {
                    "targets": {
                        "node": "current"
                    }
                }
            ],
            '@babel/preset-flow'
        ];

        return {
            presets,
        };
    };
 &lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
6. And, finally tried running the `ng-test` from a terminal, however, I was stuck with the following error (see picture below):
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://i.stack.imgur.com/4arjq.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" data-original-height="100" data-original-width="800" height="40" src="https://i.stack.imgur.com/4arjq.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
7. Eventually, managed to fix the issue by adding the file `&lt;root&gt;/src/jest.config.js` with below content:
&lt;/root&gt;&lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;    module.exports = {
        "transform": {
            "^.+\\.(ts|js|html)$": "ts-jest",
            "^.+\\.[t|j]sx?$": "babel-jest"
        },
        moduleFileExtensions: ['ts', 'html', 'js', 'json'],
        moduleNameMapper: {
            '^src/(.*)$': '&lt;rootdir&gt;/src/$1',
            '^app/(.*)$': '&lt;rootdir&gt;/src/app/$1',
            '^assets/(.*)$': '&lt;rootdir&gt;/src/assets/$1',
            '^environments/(.*)$': '&lt;rootdir&gt;/src/environments/$1',
        },
        transformIgnorePatterns: ['node_modules/(?!@ngrx)'],
        snapshotSerializers: [
            'jest-preset-angular/build/AngularSnapshotSerializer.js',
            'jest-preset-angular/build/HTMLCommentSerializer.js',
        ],
    };
&lt;/rootdir&gt;&lt;/rootdir&gt;&lt;/rootdir&gt;&lt;/rootdir&gt;&lt;/pre&gt;
Thereafter, ran `ng test` again and can see the test running thru. 

I hope it helps!

&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/10/angular-7-jest-babel-integration-over.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-604020868138331984</guid><pubDate>Fri, 11 Oct 2019 12:10:00 +0000</pubDate><atom:updated>2020-09-03T04:31:30.449+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Angular</category><category domain="http://www.blogger.com/atom/ns#">HTML</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>Construct the dynamic table with specified number of columns on each row as per the size of the data in Angular</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;

The below code is to generate a table with multiple rows with the specified number of columns on each row as per the size of the data array.

&lt;div&gt;
&lt;script src="https://gist.github.com/rcadhikari/ed0221ed1a9261cd68b792198298cfd3.js"&gt;&lt;/script&gt;
&lt;/div&gt;

  &lt;br /&gt;

Then, on the output, we would be able to generate a table with multiple rows with a specified number of columns.

&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/10/construct-dynamic-table-with-specified.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-8865745562042559663</guid><pubDate>Mon, 07 Oct 2019 08:54:00 +0000</pubDate><atom:updated>2019-10-07T14:39:27.309+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Check if MySQL Query uses cache or not for most frequent query.</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;
Run the following queries to check if most recent MySQL query uses cache or not.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;-- Query 1
SHOW VARIABLES LIKE 'have_query_cache'; 

-- The Output Value should be Yes, if it uses cache.

-- Query 2
SHOW VARIABLES LIKE 'query_cache_size';
-- -- The Output Value should be integer value, if it uses cache.

&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Refer &lt;a href="https://dev.mysql.com/doc/refman/5.6/en/query-cache-configuration.html"&gt;Link 1&lt;/a&gt; 
and &lt;a href="https://www.dbrnd.com/2015/08/mysql-query-cache-configuration/"&gt;Link 2&lt;/a&gt; for more detail.
&lt;br /&gt;
&lt;br /&gt;
Hope the help!

&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/10/check-if-mysql-query-uses-cache-or-not.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-1220040420422588605</guid><pubDate>Wed, 11 Sep 2019 15:45:00 +0000</pubDate><atom:updated>2019-09-11T21:30:34.064+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><title>Get MySQL columns names as multiple row or  as a concatenated string.</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Query to list columns from particular table of the particular database in MySQL:
&lt;br /&gt;
1. Get the list of columns as multiple rows:&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;    
SELECT `COLUMN_NAME`
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='database_name'
AND `TABLE_NAME`='table_or_view_name';
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Get the list of columns as a single concatenated string:&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;    
SELECT GROUP_CONCAT(`COLUMN_NAME` SEPARATOR ',')
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='database_name'
AND `TABLE_NAME`='table_or_view_name';
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/09/get-mysql-columns-names-as-multiple-row.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-4669888697035981728</guid><pubDate>Tue, 26 Mar 2019 14:54:00 +0000</pubDate><atom:updated>2019-03-26T20:39:40.688+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><title>Resolve an issue to insert explicit value for identity column in SQL table asking for IDENTITY_INSERT to set ON/OFF in PHP (Laravel)</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
The following methods to control the `IDENTITY_INSERT` to ON/OFF for SQL table seeding process in PHP (Laravel) :
&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;    
    function setIdentityInsert($table, $onStatus = true)
    {
        $status = $onStatus ? 'ON' : 'OFF';

        $this-&amp;gt;sqlConnection-&amp;gt;unprepared("SET IDENTITY_INSERT $table $status");
    }

    function insertTableData($table, $data)
    {
        return $this-&amp;gt;sqlConnection-&amp;gt;table($table)-&amp;gt;insert($data);
    }

    function seedTable($table, $hasAutoIncrementPrimaryKey = false, $data = [])
    {
        if ($hasAutoIncrementPrimaryKey) {
            $this-&amp;gt;setIdentityInsert($table);
            $response = $this-&amp;gt;insertTableData($table, $data);
            $this-&amp;gt;setIdentityInsert($table, false);

            return $response;
        }
        else {
            return $this-&amp;gt;insertTableData($table, $data);
        }
    }
&lt;/pre&gt;
&lt;br /&gt;
Note: Generally, the table requires to have an auto-increment primary key to set Identity Insert to `ON`, that's why I have the `$hasAutoIncrementPrimaryKey` flag. Otherwise, seeding may throw an error as:

&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;    
    SQLSTATE[HY000]: General error: 544 Cannot insert explicit value for
    identity column in table 'test_table_name' when IDENTITY_INSERT is set to
    OFF. [544] (severity 16) [(null)]
&lt;/pre&gt;
Hope this helps!

&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/03/resolve-issue-to-insert-explicit-value.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-7911770531626195937</guid><pubDate>Thu, 21 Mar 2019 16:46:00 +0000</pubDate><atom:updated>2019-03-21T22:34:25.073+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><category domain="http://www.blogger.com/atom/ns#">SQL</category><title>Get a list of columns and their data type by passing table name on MySQL and MSSQL databases.</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
To get&amp;nbsp;a list of columns and their data type by passing table name on MySQL and MSSQL&amp;nbsp;databases.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;    
    /**
     * Returns the list of columns and their data type by the table name on MySQL database.
     * @param $sqlConnection MySQL Database Connection Link
     * @param $tableName
     * @param bool $fullType
     * @return array
     */
    private function getMySqlTableColumnAndTypeList($mysqlConnection, $tableName, $fullType = false)
    {
        $table = $mysqlConnection-&amp;gt;select("DESCRIBE $tableName");

        $fieldAndTypeList = [];
        foreach ($table as $field){
            $type = ($fullType || !str_contains($field-&amp;gt;Type, '('))? $field-&amp;gt;Type: substr($field-&amp;gt;Type, 0, strpos($field-&amp;gt;Type, '('));
            $fieldAndTypeList[$field-&amp;gt;Field] = $type;
        }
        return $fieldAndTypeList;
    }

    /**
     * Returns the list of columns and their data type and nullable by the table name on MSSQL database.
     * @param $sqlConnection SQL Database Connection Link
     * @param $tableName
     * @return array
     */
    private function getSqlTableColumnsWithDataTypes($sqlConnection, $tableName)
    {
        $tableInfo = $sqlConnection-&amp;gt;select("SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '". $tableName . "'");

        $fieldAndTypeList = [];
        foreach ($tableInfo as $field){
            $isNullable = ($field-&amp;gt;IS_NULLABLE == 'YES') ? true : false;
            $fieldAndTypeList[$field-&amp;gt;COLUMN_NAME] = (object)['type' =&amp;gt; $field-&amp;gt;DATA_TYPE, 'nullable' =&amp;gt; $field-&amp;gt;IS_NULLABLE, 'isNullable' =&amp;gt; $isNullable];
        }

        return $fieldAndTypeList;
    }
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Raw Query in MSSQL:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'your_table_name';
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Raw Query in MySQL:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush: sql;" name="code"&gt;DESCRIBE your_table_name;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Appreciated for any feedback!&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/03/get-list-of-columns-and-their-data-type.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-7299586977933856890</guid><pubDate>Sun, 24 Feb 2019 21:48:00 +0000</pubDate><atom:updated>2019-02-25T03:33:29.259+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Amazon EC2 Server</category><category domain="http://www.blogger.com/atom/ns#">Apache</category><title> Password protect to directory on the web server and Add a new user</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;

&lt;b&gt;Allow User to access the app&lt;/b&gt;

1. Create/Update `.htaccess` file in root directory:
&lt;pre class="brush: bash;" name="code"&gt;
    touch .htaccess
    vi .htaccess
&lt;/pre&gt;
    Then, add following content:

&lt;pre class="brush: bash;" name="code"&gt;
    AuthUserFile /home/bitnami/htdocs/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Application Authentication"
    AuthType Basic
    require user demo-user1
    require user test-user2
&lt;/pre&gt;

3. And, for passwords, create `.htpasswd` file in root directory.
&lt;pre class="brush: bash;" name="code"&gt;
    touch .htpasswd.
&lt;/pre&gt;

4. To add/edit password, run the following command:
&lt;pre class="brush: bash;" name="code"&gt;
    htpasswd -c .htpasswd demo-user1
    &lt;/pre&gt;
    And, follow instruction ahead.

&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/02/password-protect-to-directory-on-web.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-3396868380255349687</guid><pubDate>Thu, 21 Feb 2019 11:12:00 +0000</pubDate><atom:updated>2019-02-21T16:57:24.336+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Laravel - PHPUnit - run single test class or method </title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;

The following command runs the test on a single method:
(e.g. we are testing the `testCreateUser()` method here)

&lt;pre class="brush: bash;" name="code"&gt;
vendor/bin/phpunit --filter testCreateUser UserControllerTest tests/feature/UserControllerTest.php
vendor/bin/phpunit --filter methodName ClassName path/to/file.php
&lt;/pre&gt;

Further, lets say you want to test a ClassName which exists into two location:
&lt;pre class="brush: bash;" name="code"&gt;
tests/unit/UserControllerTest.php // contains 3 tests
tests/feature/UserControllerTest.php // contains 2 tests
&lt;/pre&gt;

In this case, you simply run below command which will check for all the test on both location.
&lt;pre class="brush: bash;" name="code"&gt;
vendor/bin/phpunit --filter UserControllerTest

-----Output---------
Time: 2.56 seconds, Memory: 30.00MB

OK (5 tests, 22 assertions)
&lt;/pre&gt;


Please note, if you have phpunit available globally on your machine, you can simply run 
&lt;pre class="brush: bash;" name="code"&gt;
phpunit --filter 

# instead of 
vendor/bin/phpunit --filter
&lt;/pre&gt;

Stackflow &lt;a href="https://stackoverflow.com/questions/26095051/how-to-run-single-test-method-with-phpunit"&gt;resource&lt;/a&gt;.

&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/02/laravel-phpunit-run-single-test-class.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-6482681695290412782</guid><pubDate>Wed, 30 Jan 2019 18:21:00 +0000</pubDate><atom:updated>2019-01-31T00:28:12.611+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">AWS</category><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><title>Rename all existing files on AWS S3 Bucket using Laravel Storage library</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Follow below steps to rename existing files on a selected directory on S3 Bucket.&lt;br /&gt;
&lt;br /&gt;
1. Lets say your &lt;b&gt;config/filesystems.php&lt;/b&gt; looks like this:&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;'disks' =&amp;gt; [
  's3_test_bucket' =&amp;gt; [
        'driver' =&amp;gt; 's3',
        'key'    =&amp;gt; env('AWS_KEY', 'your_aws_key_here'),
        'secret' =&amp;gt; env('AWS_SECRET','your_aws_secret_here'),
        'region' =&amp;gt;  env('AWS_REGION', 'your_aws_region_here'),
        'version' =&amp;gt; 'latest',
        'bucket'  =&amp;gt; 'my-test-bucket',
  ],
];
&lt;/pre&gt;
&lt;br /&gt;
2. Let's say, you have &lt;b&gt;my-test-bucket&lt;/b&gt; on your AWS S3.&lt;br /&gt;
&lt;br /&gt;
3. Lets say you have following files inside the &lt;b&gt;my-test-bucket/test-directory&lt;/b&gt; directory.&lt;br /&gt;
i.e.&lt;br /&gt;
- test-files-1.csv&lt;br /&gt;
- test-files-2.csv&lt;br /&gt;
- test-files-3.csv&lt;br /&gt;
&lt;br /&gt;
3. Call below function to rename existing files on a selected directory on S3 Bucket.&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;$directoryPath = 'test-directory';
$storage = new MyStorageRepository();
$storage-&amp;gt;renameAnyExistingFilesOnImportDirectory('my-test-bucket', 'test-directory');
&lt;/pre&gt;
&lt;br /&gt;
4. Output: files should be rename as below on &lt;b&gt;my-test-bucket/test-directory&lt;/b&gt; directory:&lt;br /&gt;
- test-files-1--1548870936.csv&lt;br /&gt;
- test-files-2--1548870936.csv&lt;br /&gt;
- test-files-3--1548870936.csv&lt;br /&gt;
&lt;br /&gt;
5. Include the below library class or methods on your class and you should be good.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Storage;

class MyStorageRepository
{
    public function renameAnyExistingFilesOnImportDirectory($bucket, $directoryPath)
    {
        $directoryPath = App::environment() . '/' . $directoryPath;
        $storage = Storage::disk('s3_test_bucket');

        $suffix = '--' . time(); // File suffix to rename.

        if ($storage-&amp;gt;exists($directoryPath)) {
            $this-&amp;gt;renameStorageDirectoryFiles($directoryPath, $storage, $suffix);
        }
    }

    private function getNewFilename($filename, $suffix = null)
    {
        $file = (object) pathinfo($filename);

        if (!$suffix) {
            $suffix = '--' . time();
        }

        return $file-&amp;gt;dirname . '/' . $file-&amp;gt;filename . $suffix . '.' . $file-&amp;gt;extension;
    }

    private function renameStorageDirectoryFiles($directoryPath, $storage = null, $suffix = null, $filesystemDriver = null)
    {
        if (!$storage) {
            $storage = Storage::disk($filesystemDriver);
        }

        // List all the existing files from the directory
        $files = $storage-&amp;gt;files($directoryPath);

        if (count($files) &amp;lt; 1 ) return false;

        foreach($files as $file) {
            // Get new filename
            $newFilename = Helpers::getNewFilename($file, $suffix);

            // Renamed the files
            $storage-&amp;gt;move($file, $newFilename);
        }
    }
}
  
&lt;/pre&gt;
Also, copy of ref &lt;a href="https://stackoverflow.com/questions/44815984/how-to-rename-a-folder-by-prefix-in-s3-using-php-sdk/54447371#54447371"&gt;here&lt;/a&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/01/rename-all-existing-files-on-s3-bucket.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-6737021238459283587</guid><pubDate>Thu, 24 Jan 2019 10:24:00 +0000</pubDate><atom:updated>2019-02-21T16:37:05.326+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><title>Laravel Method to check if the given record id exists on DB table or not.</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="brush: php;" name="code"&gt;public function isModelRecordExist($model, $recordId)
{
    if (!$recordId) return false;

    $count = $model-&amp;gt;where(['id' =&amp;gt; $recordId])-&amp;gt;count();

    return $count ? true : false;
}

// To Test
$recordId = 5;
$status = $this-&amp;gt;isModelRecordExist( (new MyTestModel()), $recordId);

// Outcome: true | false

&lt;/pre&gt;
Hope it helps!


&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2019/01/laravel-method-to-check-if-given-record.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-1946480986769994852</guid><pubDate>Thu, 29 Nov 2018 14:05:00 +0000</pubDate><atom:updated>2018-11-29T19:50:50.280+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Cloud Server</category><category domain="http://www.blogger.com/atom/ns#">Docker</category><title>Docker machine creation - Too many retries waiting for SSH to be available -Maximum number of retries (60) exceeded</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Docker machine creation - Too many retries waiting for SSH to be available -Maximum number of retries (60) exceeded&lt;br /&gt;
&lt;br /&gt;
To resolve the issue for&amp;nbsp;

&lt;pre class="brush: php;" name="code"&gt;
Error creating machine: Error in driver during machine creation: Too many retries waiting for SSH to be available. &lt;br/&gt;
Last error: Maximum number of retries (60) exceeded&lt;/pre&gt;&lt;br /&gt;

&lt;br /&gt;
Run the following following steps:&lt;br /&gt;
&lt;br /&gt;
1. Check your docker version:&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;
$ docker -v&lt;br /&gt;
Docker version 18.03.0-ce, build 0520e24&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
2. Download your docker version's of `boot2docker` (18.03.0-ce) from &lt;a href="https://github.com/boot2docker/boot2docker/releases?after=v18.04.0-ce-rc1"&gt;here&lt;/a&gt; into your local:&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;
wget https://github.com/boot2docker/boot2docker/releases/download/v18.03.0-ce/boot2docker.iso -P ~/.docker/machine/cache/test/boot2docker-v18-03-0-ce.iso&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
3. Create the `new_virtual_box_name` using the downloaded version of `boot2docker`:&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;
docker-machine create --driver virtualbox --virtualbox-boot2docker-url ~/.docker/machine/cache/test/boot2docker-v18-03-0-ce.iso new_virtual_box_name&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2018/11/docker-machine-creation-too-many.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-7605356767411100039</guid><pubDate>Tue, 13 Nov 2018 14:57:00 +0000</pubDate><atom:updated>2018-11-13T20:42:43.378+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><category domain="http://www.blogger.com/atom/ns#">SAML2</category><title>SAML Auth login issue on local - undefined logger()</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="brush: php;" name="code"&gt;(1/1) FatalThrowableError
Call to undefined function App\Http\Controllers\logger()

in SamlController.php line 85
at SamlController-&amp;gt;acs()
at call_user_func_array(array(object(SamlController), 'acs'), array())
in BoundMethod.php line 29
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable the Saml debugger by adding the `SAML2_DEBUG=true` on .env.
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;Then, found the following error:
openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate!
Whoops, looks like something went wrong.
(1/1) FatalThrowableError
Call to undefined function App\Http\Controllers\logger()

in SamlController.php line 87
at SamlController-&amp;gt;acs()
at call_user_func_array(array(object(SamlController), 'acs'), array())
in BoundMethod.php line 29
at BoundMethod::Illuminate\Container\{closure}()
in BoundMethod.php line 87
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Resolved the issue after updating with the correct `SAML2_IDP_X509CERT` value.

&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2018/11/saml-login-issue-on-local-undefined.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-7999647373017683499</guid><pubDate>Fri, 25 May 2018 12:03:00 +0000</pubDate><atom:updated>2020-04-11T05:34:04.173+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Angular</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>Angular production test locally with hostName, Port and SSL on</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="brush: bash;" name="code"&gt;ng serve --prod --build-optimizer --ssl --host demo.yourdomain.local --port 4202
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2018/05/angular-production-test-locally-with.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-339821237011157182</guid><pubDate>Thu, 01 Mar 2018 11:47:00 +0000</pubDate><atom:updated>2018-03-01T17:32:07.730+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Docker</category><category domain="http://www.blogger.com/atom/ns#">Linux</category><category domain="http://www.blogger.com/atom/ns#">Linux Server</category><title>Useful docker commands for cleaning up containers, images and volumes</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
List of useful docker commands for cleaning up containers, images and volumes:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: bash;" name="code"&gt;docker stop $(docker ps -aq // Stop all containers
docker rm $(docker ps -aq) // Remove all containers
docker rmi $(docker images -q) // Remove all images
docker volume ls // List all volumes
docker volume ls -q -f dangling=true // List all dangling volumes
docker volume rm `docker volume ls -q -f dangling=true` // remove all dangling volumes
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2018/03/useful-docker-commands-for-cleaning-up.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-1769451815052252144</guid><pubDate>Fri, 16 Feb 2018 11:44:00 +0000</pubDate><atom:updated>2018-02-16T17:32:03.706+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">JQuery</category><title>Add sticky content with jQuery</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre style="background-color: white; font-family: Menlo; font-size: 9pt;"&gt;&lt;b&gt;Steps:&lt;/b&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style="background-color: white; font-family: Menlo; font-size: 9pt;"&gt;1. Add the following on your css file.&lt;/pre&gt;
&lt;pre class="brush: css;" name="code"&gt;.fixed-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 5;
}&lt;/pre&gt;
&lt;br /&gt;
2. Add the following on your JS file where you need to display the sticky when scrolling up.
&lt;br /&gt;
&lt;pre class="brush: js;" name="code"&gt;jQuery(window).scroll(function(){
    if (jQuery(window).scrollTop() &amp;gt;= 200) {
        jQuery('.classNameOfStickyContentHere').addClass('fixed-header');
    }
    else {
        jQuery('.classNameOfStickyContentHere').removeClass('fixed-header');
    }
});&lt;/pre&gt;
&lt;br /&gt;
&lt;pre style="background-color: white; font-family: Menlo; font-size: 9pt;"&gt;3. HTML Content&lt;/pre&gt;
&lt;pre class="brush: html;" name="code"&gt;&lt;div class="classNameOfStickyContentHere"&gt;
Display me as sticky when scrolling up....
&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2018/02/add-sticky-content-with-jquery.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-1324214366929600640</guid><pubDate>Thu, 19 Oct 2017 13:41:00 +0000</pubDate><atom:updated>2017-10-19T19:26:45.956+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Laravel</category><category domain="http://www.blogger.com/atom/ns#">Laravel-Lumen</category><title>To create a custom token password reset in Laravel 5.5 (Or Lumen)</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Please use the below passwordResetToken() function to get the token for password reset for custom use.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: php;" name="code"&gt;namespace App\Traits;

use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Mail\Message;
use Illuminate\Support\Facades\Password;

trait ResetPasswordTrait 
{
    ...
    ...
    ...
    ...

    /**
     * Get the token for password reset and update the token in the database table.
     *
     * @return string|null
     */
    public function passwordResetToken($user)
    {
        $this-&amp;gt;broker = 'users';

        $broker = $this-&amp;gt;getBroker();

        return Password::broker($broker)-&amp;gt;createToken($user);
    }

    /**
     * Get the broker to be used during password reset.
     *
     * @return string|null
     */
    public function getBroker()
    {
        return property_exists($this, 'broker') ? $this-&amp;gt;broker : null;
    }

}


// Reuse in the class
use App\Traits\ResetPasswordTrait;

class NewUserAccount 
{

    use ResetPasswordTrait;

    // Sample function to print the password reset token
    public function printPasswordResetToken(Request $request)
    {
        $user = User::find( $request-&amp;gt;input('id') );
        $passwordResetToken = $this-&amp;gt;passwordResetToken($user);
        print_r($passwordResetToken);
    }

}
&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2017/10/to-create-custom-token-password-reset.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3323050992314705337.post-8819210107528065260</guid><pubDate>Thu, 12 Oct 2017 14:50:00 +0000</pubDate><atom:updated>2020-04-11T05:40:27.912+05:45</atom:updated><category domain="http://www.blogger.com/atom/ns#">Bash</category><title>Generate Ramdon String on Shell</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre class="brush: bash;" name="code"&gt;# Bash function to generate the random alphanumeric string with provided length.
randomString() {
    DEFAULT_LENGTH=6

    # if the parameter is not null, apply new length
    if [ ! -z "$1" -a "$1" != " " ]; then
        LENGTH=$1
    else
        LENGTH=$DEFAULT_LENGTH
    fi
    echo $LENGTH;

    LC_ALL=C tr -dc 'a-zA-Z0-9' &amp;lt; /dev/urandom | fold -w $LENGTH | head -n 1
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;b&gt;Test One:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush: bash;" name="code"&gt;MyRadomString=$(randomString)
echo "My Radom String: '$MyRadomString'";
&lt;/pre&gt;
&lt;br /&gt;
# Output:&lt;br /&gt;
My Radom String: 'a2d6sd';&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Test Two:
&lt;/b&gt;&lt;br /&gt;
&lt;pre class="brush: bash;" name="code"&gt;MyRadomString=$(randomString 8)
echo "My Radom String2: $MyRadomString";
&lt;/pre&gt;
&lt;br /&gt;
# Output:&lt;br /&gt;
My Radom String2: 'S2sP6sk7';

&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://rcadhikari.blogspot.com/2017/10/generate-ramdon-string-on-shell.html</link><author>noreply@blogger.com (RC Adhikari)</author><thr:total>0</thr:total></item></channel></rss>