Monday, 25 March 2024

Word Press Multisite on AWS instance cannot login with default password

 

Word Press Multisite on AWS instance cannot login with default password after setting a static IP ?

Try this

Login to the shell from AWS instance


cd  /opt/bitnami/wp-cli/bin 

sudo wp user list

you will see you admin user , example :

sudo wp user list

+----+------------+--------------+------------------+---------------------+---------------+

| ID | user_login | display_name | user_email       | user_registered     | roles         |

+----+------------+--------------+------------------+---------------------+---------------+

| 1  | user       | user         | user@example.com | 2024-03-22 10:38:41 | administrator |

+----+------------+--------------+------------------+---------------------+---------------+


update the password for the user ID using 

sudo wp user update 1 --user_pass=<newpasswordhere>

You should see : Success: Updated user 1.

Thats it, try logging in using the new password




Wednesday, 13 March 2024

python error ModuleNotFoundError: No module named 'requests'

 

Python error 

line 1, in <module>

    import requests

ModuleNotFoundError: No module named 'requests'


Solution:

Install requests via pip


C:\Users\User>pip install requests

Collecting requests

  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)



Still get the error after installation?

If you are using soemthing like pyCharm you would have to close and restart

It scans and reads install packages on restart

Do the same if you see the error on other modules like scrapy and pandas



Wednesday, 6 March 2024

Create a simple Django web application 


Application includes a single textbox. When the user enters text, the application will calculate the number of characters and display the result on the same webpage.


Create a Django Project and App: 

First, create a new Django project and a new app within the project. 


Let’s call the app character_counter.

Create a View and Template:

In your views.py, create a view that handles the form submission and calculates the character count.

Create an HTML template (index.html) to display the form and the result.

Define Your View and Template:


Python

# character_counter/views.py

from django.shortcuts import render


def character_count(request):

    if request.method == 'POST':

        user_text = request.POST.get('user_text', '')

        char_count = len(user_text)

        return render(request, 'character_counter/index.html', {'char_count': char_count})

    return render(request, 'character_counter/index.html')





HTML

<!-- character_counter/templates/character_counter/index.html -->

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Character Counter</title>

</head>

<body>

    <h1>Character Counter</h1>

    <form method="post">

        {% csrf_token %}

        <input type="text" name="user_text" placeholder="Enter text">

        <input type="submit" value="Count Characters">

    </form>

    {% if char_count %}

        <p>Character count: {{ char_count }}</p>

    {% endif %}

</body>

</html>




URL Configuration: Set up the URL pattern in your app’s urls.py:


Python

# character_counter/urls.py

from django.urls import path

from . import views


urlpatterns = [

    path('', views.character_count, name='character_count'),

]


Run the Development Server: Run python manage.py runserver to start the development server. 


Visit http://localhost:8000/ to see the character counter in action.

Create a Django Project On Mac or Linux

1. install python3 - download from python website 
2. install vertual env : 
sudo pip install virtualenv 
3. create a project directory : 
mkdir djproject 
4. create a virtual environment cd djproject virtualenv myvirtenv -p python3 
5. activate the virtual environment : source myvirtenv/bin/activate
 
6. install Django inside the virtual environment
 pip install Django (installs the latest version) 
7. start the project, creates the project files 
django-admin startproject djproject
8. start the webserver 
python manage.py runserver
 
9. Launch the webpage on thedefault port 
http://127.0.0.1:8000 
you should see django up an running!

Wednesday, 25 August 2010

cannot restore segment prot after reloc: Permission denied

Error on CentOS 5 while starting a proccess

cannot restore segment prot after reloc: Permission denied

Noticed while running networker 7.6 on Centos 5

Resolution:

Centos has SELinux enabled by default and set to 'enforcing'

temporarily disable by running: /usr/sbin/setenforce 0

you can change SELinux config at /etc/selinux/config

Tuesday, 15 June 2010

DIsable firewall on SuSE 11

The firewall is enabled by default , to stop it

/etc/init.d/SuSEfirewall2_setup stop

Unable to SSH to SuSE 11

Check if sshd is running , if not start it up

/etc.init.d/sshd status
/etc.init.d/sshd start

The firewall is enabled by default , you may have to stop/reconfigure it

/etc/init.d/SuSEfirewall2_setup stop

Thursday, 29 April 2010

Ubuntu 10

Ok its officially out 10.04 :)


Ignore the below issue they have fixed it

<<<<<<<<<<<<<<<<<<

Dont upgarde just yet if you are on dual boot :
https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/570765



Ubuntu: For Desktops, Servers, Netbooks and in the cloud

Wednesday, 21 April 2010

do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused

Getting errors like:

do_ypcall: clnt_call: RPC: Unable to receive; errno = Connection refused

alos causes any public key ssh setup with no password authenticaton to fail

Resolution:
check if ypbind is running (/etc/init.d/ypbind status) and restart it (/etc/init.d/ypbind start)

Cause:
Check if it is set to run when the box reboots?
Also if it loses connection to the nis master, it may not reconnect.

Tuesday, 13 April 2010

Find files with string in current directory

Find files with string in current directory:

find . -follow -name "*" -exec grep -i eng.wysdm.com {} \; -print

Linux - file size limit exceeded

run ulimit -a to check your current limit

eg.,

file size (blocks, -f) 2048


means it is limited to 2 MB

this can be changed in /etc/security/limits.conf to be set to unlimited

Friday, 9 April 2010

top on solaris , free memory on solaris, memory usage on solaris

To find out the free memory available on solaris

vmstat - free virtual memory status

prstat - current process memory usage status

else install top

AIX uninstall problems

Ok your are on AIX and get the wierd problem of not able to uninstall this app installed using install shield

Remove the entry from vpd.properties , but where is vpd.properties
..hmm here /usr/lib/objrepos, remove entries from there and you are good to go

Oracle Drop database

To drop a database I did the following :

SQL> shutdown abort;
startup mount exclusive restrict;
ORACLE instance shut down.
SQL> ORACLE instance started.

Total System Global Area 630501376 bytes
Fixed Size 2147032 bytes
Variable Size 469765416 bytes
Database Buffers 150994944 bytes
Redo Buffers 7593984 bytes
Database mounted.
SQL> connect as sysdba
Enter password:
Connected.
SQL> drop database;

Friday, 19 February 2010

Postgres error: message type 0xxx arrived from server while idle

You get the error "message type 0xxx arrived from server while idle while" trying to write to postgres. It's itermittent so it's kind of difficult to catch.

solution: I had multiple threads using the same connection and trying to write to the database simultaneously.
Give each thread it's own connection, it should work.

Thursday, 24 December 2009

New PC buying guide

Buying a new PC can be a tricky affair especially with technology getting outdated in a matter of months now. So here is a simple and short guide I have put together for the relatively not so tech savvy

If SPEED is the first thing you need:

You need a decent MIX of the below, just once component of a super cool spec would not do it.

RAM - atleast 2 GB for Windows Visa , Windows 7 and above but dont over do it, 6 MB of RAM doesn't make things better. 4 would be great and enough if you can afford it.

Processor:
2 - 2.5 GHz is more than enuf, but wait there are other things ..
L2 Cache matters - 2 to 3 MB would be cool, you can go upto 6 MB if you can afford it!
2 core processors are also cool. Its like having 2 processors in 1.

and windows has a problem with handling memory and speed so what ever you feed it there are a lot of CPU cycles wasted .. Windows 64 bit handles it better.
but it comes with a (bit huge) cost. You need a 64 bit processor (the majority of the PCs you see now are 32 bit) and you need a 64 bit Windows OS (more $$$) then you can download 64 bit drivers and stuff.

Finally better go for popular brands since they supply updated drivers for the hardware, drivers drive your hardware.

Internet:

Built in wireless card if it is a Laptop.
Built in Network Interface card for Desktops ( they are standard in most PCs ), Wireless card if you are going to connect to Internet wirelessly.

Video :
You need atleast a 256 MB (video RAM) video card else with the advent of operating systems you are going to end up with a slow computer.

Other stuff:
If a Laptop, make sure you have built in webcam, mic and bluetooth

If you want to hook up your laptop to your Digital TV - make sure the computer has a HDMI out slot. Check if your TV has a HDMI slot as well.
Else the old S-Video should do.

Built in TV tuner card , if you want to watch TV on the computer

Built in (Multi) Card reader would be cool to plug in your Memory cards from your phone , camera etc


Drives:

Blu-ray would be cool as it is becoming the in thing
DVD R/W minimum

Ports:
Plenty of USB ports, atleast 4, and in accessible places, like front of your desktop


Thats about what you need to know, the rest are the usuals

Standard USB Keyboard
Monitor that fits your size needs and budget, higher the resolution the better, but remember you need a decent video card too for higher res to really work.
Normal USB mouse, blue tooth wireless mouse are fancy but they can be a pain disconnecting often.

hope this helps

Tuesday, 22 December 2009

Start postgres – error : connections on Unix domain socket "/tmp/.s.PGSQL.5432"

Start as postgres user with options :

/usr/bin/pg_ctl -D ./data -l logfile start

Change Oracle default port

Change the port in
listener.ora
tnsnames.ora

eg.,
LISTENERS_OARCLE1=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle1)(PORT = 5599)(IP = x.x.x.x))
)

How do I categorize my blogs on blogspot / blogger

Just add a label(s) to your post (its there at the bottom when u write a new post). Then use the labels gadget

tip: you can custom display your labels to make a shorter list of categories

Backup contacts on Nokia N-Gage

Tried this a hundred different ways and finally found a working solution!!!
If you have a Nokia N-Gage (not QD) and wanted to back up your precious contacts (sadly this otherwise amazing phone doesnt have a built in way to do it) here is a working solution


1. You need to have FExplorer installed, if you do not have it you can download and install it. http://www.gosymbian.com/fexplorer_new.php

2. Go to menu ---> tools ---> memory --> Options and select "Backup device mem."

3. You will see a yes/no prompt, choose yes , that backup will start, now you would have to be really quick (before the backup ends) and do the following
a. Hold down the menu button and open FExplorer
b. Browse to C:\system\data and copy contacts.cdb and paste it onto your memory card

Your backup is taken!

To place them on a other phone or replace contacts.cdb after a phone reset repeat the same steps, only difference is you will be copying from memory card to C:\system\data and overwriting the existing file.

Word Press Multisite on AWS instance cannot login with default password

  Word Press Multisite on AWS instance cannot login with default password after setting a static IP ? Try this Login to the shell from AWS i...