Joy of learning

First Blog The learning is an enjoyment. Moreover if you enjoy more you will learn more. And if you learn more you enjoy more To day I am writing about ternary operator in python. How it writes a code in a single line instead of writing 4- 5 lines of code. ✔ Consider a if statement : ##CODE## condition = True if condition: ....x = 1 else: ....x=0 print(x) ##endcode## Above code can be rewritten in python as : x=1 if condition else 0 print(x) ✌ Some times it is difficult to read large numbers we can use '_' without effecting the result num1 = 10000000000 num2 = 100000000 total = num1 + num2 print(total) num1 = 10_000_000_000 num2 = 10_000_000 total = num1 + num2 print(total) Both the code will give same result irrespective of placing an '_' in between If we want result to be formatted with '_' separator we can do so as: print(f'{total: ,}') *************************************** ::actvating venv in windows:: python3 -m venv venv venv\Scripts\activate.bat :::Building todo app indjango::: pip install django django-admin startproject todo cd todo python manage.py runserver ctr c python manage.py migrate python manage.py createsuperuser username email password password python manage.py runserver # Open website at local server 127.0.0.1:8000/admin # Enter username and password and we can ligin as user created # ctrl C to go to cmd prompt python manage.py startapp tasks # in sttings.py file add 'tasks' in installed_app # view.py from def index(requests): return HttpResponse('Hello World') create urls.py file in tasks tasks/urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index) ] #in todo/urls.py file todo/urls.py from django.urls import path, include urlpatterns = [ .......... path('', include('tasks.urls') ] # In cmd prompt python manage.py runserver # local host at 8000 will serve views.py file # create folder templates in tasks folder and then create a tasks folder in templates ie >> tasks/templates/tasks make a file list.html in tasks folder templates/tasks/list.html <h3>To Do</h3> # models.py from django.db import models class = Task(models.Model): ........title = models.CharField(max_length = 200) ........complete = models.BooleanField(default = False) ........created = models.DateTimeField(auto_now_add = True) ........def __str__(self): ..............return self.title # Make migration and migrate #in commd prompt python manage.py makemigrations python manage.py migrate # Register in admin so that we access Task from admin admin.py from .models import * admin.site.register(Task) ##Goto admin panel add tasks #views.py from . models import * def index(request): ....tasks = Task.objects.all() ....context = {'tasks' : 'tasks'} ....return render(request, 'task/list.html', context) #task/list.html <h3>To Do</h3> {% for task in tasks %} ....<div> ......<p>{{ task }}</p> ....<div> {% endfor %}

Be ware of financial fraud deviced by hi tech web sites

To day I am disturbed as I nearly got in to the trap of cyber crime, I am still not sure that I was deceived by the site. I was bowsing my phone and came acoss the photo of mukesh ambani, advocating about his new child (company) BTC Ai Evex for AI powered trading. out of curiosity I searched BTC Ai Avex, which led me to https://cryptoengine.app. On going through registration process I was not able to sign in. In the mean time I got a phone call who introduced him self to be from BTC Ai Evex. He than said the registration is done and you may log in with the link sent to your email. I logged in by clicking on the link. The person on phone asked me to share a secret code so that one executive will call you to guide for using the online trading app. A call from unknown person asked that I was registered and to complete the process he wanted to talk to me but he had no idea of any secrete code or he pretended to be ignorant so I did not talked to him, interestingly he referred Narayan Krishna Murthy for launching a AI powered trading app so that peoples can be benefited. Tha after 20-30 min another call was received who shared the secrete code and the on line executive asked me to join in zoom so that he could teach me how to use the site for on line trading. I was asked to deposit suitable ammount for starting the trade least amount to be deposited 200 usd that which was paid through upi against the qr code made available through the site. He gave details of the site which was a very hi tech platform for trading "https://www.traling.com/client-area". I then insisted that how will I get payment on completion of trade on which he asked me to go to relevent page and fill up the amount and the bank account on which I wish payment be made. The entered amount 20 usd in Rs was transfered to my account. The executive traded 1 usd-cad and 1 euro-usd to give live demo. And 0.46 or so, the profit added to my deposited amount 180.46 usd in the app. Up till now there was no problem. I had a doubt that forex trading has some regularity issues so to clarify I watched on youtube that trading on all site is not legal so to clarify I wanted to get in touch with the executives but no one could be contacted. I wanted to get the refund which also could not be done. The first executives phone was replied that he has never called to me. At this point I realised that I was in a trap. I immediately tried for closing the account as I had a doubt that the trading may not be legal so I did not care about my expended money and deleted the account, I am not sure that I will get my money back but to be safe and to make all our fellow citizens safe I have decided to lodge a complain with the local police. I felt that they wanted to convince me to invest more money in their app.

A profound realisation

(My Query : I some times wonder in this vast space we a tiny creature and are vulnerable to any unbalancing and we are very lucky that we find us in this atmosphere where we are alive. So why we are so careless and do not give a thought of our vulnerability, instead we fight for cast, religion and all futile things. ) chatGPT answered: You've touched on a profound realization. The vastness of the universe and the delicate balance that allows life on Earth can be humbling when we truly consider it. We are indeed incredibly fortunate to exist in such a precise environment where life can thrive. This perspective can make human conflicts over caste, religion, and other divisions seem trivial and senseless. Human nature is complex, shaped by millennia of evolution, social structures, and cultural influences. Often, people get caught up in their immediate surroundings, focusing on the familiar rather than the bigger picture. This can lead to a kind of tunnel vision, where the significance of our existence and the fragility of life are overshadowed by more immediate, but ultimately less important, concerns. One reason for this might be rooted in our evolutionary history. For most of human history, survival depended on being part of a group, which often led to a strong identification with one's own community, religion, or culture. This sense of belonging can create divisions when people feel threatened or when resources are scarce. Another factor is the way societies are structured. Power dynamics, economic disparities, and cultural indoctrination can all contribute to conflicts that distract from the larger, shared human experience. However, as more people become aware of our shared vulnerability and the preciousness of life, there's hope that we can shift our focus toward unity and cooperation. It takes conscious effort to rise above ingrained biases and see the world through a broader lens, but it’s a step toward a more peaceful and enlightened existence.

ploting with matplotlib

Matplotlib is a popular Python library used for creating static, animated, and interactive visualizations. Understanding its architecture helps you effectively leverage its features and customize your plots. Here's an overview of its key components: 1. Figure Role: The Figure is the overall container for all the plot elements. Details: It can contain multiple Axes, which are the areas where individual plots appear. A Figure can be considered as a canvas where you can draw multiple plots. Example: fig = plt.figure() 2. Axes Role: The Axes is the part of the Figure where the data is plotted. Details: Each Axes object can have its own coordinate system, labels, titles, and ticks. It's where you can plot your data and set the limits, scales, and styles. Example: ax = fig.add_subplot(111) 3. Artist Role: Everything you see on a plot (text, lines, patches, etc.) is an Artist. Details: Artists are the backbone of Matplotlib, as they are responsible for rendering all visual elements. There are two main types of artists: primitives (like Line2D, Rectangle) and containers (like Figure, Axes). Example: line = plt.Line2D([1, 2, 3], [4, 5, 6]) 4. Renderer Role: The Renderer is responsible for converting the visual elements (artists) into a format that can be displayed. Details: It handles the backend operations, translating the high-level drawing commands into output on a device, such as a screen or a file. Different backends can be used depending on the output format (e.g., Agg for raster graphics, SVG for vector graphics). 5. Backend Role: The backend is the interface between Matplotlib and the output device. Details: There are different types of backends: Interactive Backends: For real-time rendering on screens (e.g., TkAgg, Qt5Agg, WXAgg). Non-Interactive Backends: For rendering to files (e.g., Agg, SVG, PDF). Example: plt.switch_backend('Agg') 6. Pyplot Role: pyplot is a module in Matplotlib that provides a MATLAB-like interface. Details: It offers a convenient way to create plots by simplifying the process of creating figures, axes, and other plot elements. It is typically imported as plt. Example: import matplotlib.pyplot as plt 7. Transformations Role: Transformations manage the coordinate systems and how data is mapped from data coordinates to display coordinates. Details: They are crucial for understanding how different elements are positioned within a plot. Common transformations include data-to-display, axes-to-display, and figure-to-display transformations. Example: transform = ax.transData 8. Layout Engine Role: Manages the layout of subplots, titles, and other elements. Details: The layout engine ensures that different plot components don't overlap and are well-aligned. tight_layout() and constrained_layout are commonly used to improve layout automatically. Understanding these components allows you to customize and control your plots more effectively, ensuring that you can create complex visualizations that suit your needs.

Bengali rituals on wedding: generated by prompt engineering on chatGPT-04

Assistant: Of course! A Bengali wedding is a rich tapestry of traditions, rituals, and cultural nuances that create a memorable and meaningful celebration. Here’s a breakdown of the key rituals and preparations for a traditional Bengali marriage ceremony along with some tips for incorporating modern elements: ### Pre-Wedding Rituals 1. **Adan Pradan:** - **Traditional:** This is often an informal engagement where families meet and exchange gifts. - **Modern Touch:** A formal engagement party with close family and friends, complete with a small reception. 2. **Aiburobhat:** - **Traditional:** The bride and groom enjoy their last meal as unmarried individuals with their families. It typically includes traditional Bengali dishes. - **Modern Touch:** Consider hosting a themed dinner or inviting friends to make it a lively get-together. 3. **Ashirbaad:** - **Traditional:** Both families bless the bride and groom separately with gold ornaments, new clothes, and other gifts. - **Modern Touch:** This can be a more intimate gathering with immediate family followed by a small prayer session if you're religiously inclined. ### Wedding Day Rituals 1. **Bor Jatri and Bor Boron:** - **Traditional:** The groom arrives at the bride's house where he is welcomed with an aarti and tilak, followed by a reception. - **Modern Touch:** Incorporate a grand entrance with music, drummers, and dancers. You might also want to provide travel arrangements for guests. 2. **Saat Paak and Subho Drishti:** - **Traditional:** The bride takes seven rounds around the groom covering her face with betel leaves, followed by the first exchange of looks (subho drishti). - **Modern Touch:** Ensure a beautiful setup for this ritual, maybe even using flower petals or a creative lighting arrangement. 3. **Mala Badal:** - **Traditional:** Exchange of garlands symbolizing acceptance of each other. - **Modern Touch:** Consider creating a stage with floral decorations or using silk garlands instead of flowers for a modern twist. 4. **Sampradan:** - **Traditional:** The bride's father hands her over to the groom while chanting mantras. - **Modern Touch:** Some families involve both parents or even siblings in this ritual, making it more inclusive. 5. **Sindoor Daan and Shubho Drishti:** - **Traditional:** The groom applies sindoor (vermilion) to the bride’s forehead. - **Modern Touch:** Capture this moment with a professional photographer who can discreetly take candid shots. ### Post-Wedding Rituals 1. **Bidaai:** - **Traditional:** The emotional farewell of the bride from her parental home. - **Modern Touch:** Use this opportunity for heartfelt speeches or even a video message from friends and family. 2. **Bou Boron:** - **Traditional:** Welcoming the bride into the groom's home. - **Modern Touch:** Plan a simple homecoming party or a small ceremony to make the bride feel special. 3. **Bou Bhaat:** - **Traditional:** The bride cooks for the groom’s family and is introduced to his extended family. - **Modern Touch:** Order a small caterer for this event to ease the stress on the newlyweds. ### General Tips: - **Planning and Invitations:** - **Traditional:** Printed invitation cards. - **Modern Touch:** Complement the printed cards with digital invites or a wedding website. - **Décor and Ambience:** - **Traditional:** Use of marigold flowers, banana trees, and alpana (rice-flour art). - **Modern Touch:** Incorporate fairy lights, floral arches, and thematic décor. - **Attire:** - **Traditional:** Red or Benarasi sari for the bride, and Dhoti-kurta for the groom. - **Modern Touch:** Brides can opt for lighter lehengas or contemporary saris, while grooms might choose designer sherwanis or suits. - **Entertainment:** - **Traditional:** Baul or folk songs. - **Modern Touch:** Hire a DJ or live band, arrange for a dance floor, and consider a mix of traditional and contemporary music. - **Catering:** - **Traditional:** Authentic Bengali cuisine with items like fish, luchi, and sweets. - **Modern Touch:** Add a multi-cuisine spread or even a fusion twist to traditional dishes. **Conclusion:** Combining tradition with modern elements can create a balanced and beautiful wedding experience. Make sure to communicate with both families to ensure everyone's comfort and happiness. Most importantly, enjoy the process!

1 2 Next Last