Python question

Love it.
Julia is the same as Python.
R has a function swap(x,y), or you can do

a <- a + b
b <- a - b
a <- a - b

I know what I prefer… C is closest to the way the computer works.

I was curious about this again and asked Copilot. Now it makes sense to me. I hadn’t thought about that possibility.

When I create a Python virtual environment with UV, it creates a .venv directory structure with some files there. I can activate it using the command “source .venv/bin/activate” and deactivate it with the command “deactivate”. I’m running Ubuntu. Where is that “deactivate” command on disk?

Great question! The deactivate command, interestingly, is not an actual standalone script or binary file sitting somewhere in your virtual environment directory. Instead, it’s a shell function that gets defined when you activate the virtual environment.

When you run source .venv/bin/activate, the activation script modifies your shell environment, setting up environment variables and defining helper functions—including deactivate. Since it’s just a function injected into your shell session, you won’t find a deactivate executable on disk using which deactivate or similar commands.

If you want to see where it’s coming from, you can inspect the activation script itself with:

cat .venv/bin/activate

You’ll find a section defining deactivate, which essentially just restores the previous environment settings.

So, rather than being a persistent command, it’s more like a temporary feature of your shell session that vanishes once the virtual environment is exited. Pretty clever, right? :blush:

That copilot reply is well written and I think accurate.
I wonder is there any way one could decide which of the many AI engines is best for Linux questions?

I’m sure one will claim superiority. :grinning_face:

They will all claim.
Try googling

which is the best AI engine for Linux queries

Google AI Overview says Perplexity.

HI Neville, :waving_hand:

How did you get to that?
I tried searching for “which is the best AI engine for Linux queries” with Google but it seems I just accessed the normal Google page.
No “AI Overview” popped up.

Do you need a Google account for that?

Cheers from Rosika :slightly_smiling_face:

Hi Rosika,
No you dont need a google account… but your search engine has to be google

Try searching without the quotes.

Google does not always do an AI summary with a search
It seems to happen more often if your search phrase has words like “how …” or "please explain … "

Regards
Neville

Hi Neville, :waving_hand:

thanks for the info.

Actually I searched without the quotes, using the Google search engine.
Still: the AI summary didn´t pop up.
Never mind.

Out of curiosity I entered:

please explain: Linux

Well, now it worked. Great.

Thanks for letting me know. :heart:

Many greetings from Rosika :slightly_smiling_face:

Hi Rosika,
I do not claim to understand why it does not always do it.?
It may abandon the task if it is busy.

I am not sure, but I think what the Google AI summary does is get the list of links first, and then attempt a summary based on those links.
so
what your search retreives would, I guess, affect the answer given in the summary.

That is different to Perplexity or ChatGPT.
Dont know about google Gemini?
Regards
Neville

Hi Neville, :waving_hand:

That is at least one possibility. Seems to make sense, as you successfully got Google to let the summary pop up.

I see. That surely is the background to it.

As a matter of fact I realized something similar when using duckduckgo.

Sometimes (but not always) I was presented with an AI-generated summary.
In the beginning the search engine would ask me whether I wanted to get those summaries less often, more often or as often as possible.
I always opted for the latter one and now it doesn´t ask me anymore.

BTW::

I just tried it out with duckduckgo:

what is an operating system

Cheers from Rosika :slightly_smiling_face:

My friends,
I apologize for my totally off-topic post.
Do you know duck.ai?

Will it be useful to you? I also leave here the Duck.ai help pages

Jorge

@Tech_JA :

Hi Jorge, :waving_hand:

Actually I do.
I tried to evaluate the effectiveness of it in contrast to perplexity.
I couldn´t come up with anything definitive yet.

But it seems that perplexity provides longer (perhaps more elaborated?) anwers to my first question.
With any follow-up questions that may change, however.
I haven´t tried all available chat models of duck.ai yet.

One thing I noticed:

Whereas perpelxity deletes your chats after a certain period of time if you didn´t create a personal account first (and use it for your query)…
… duck.ai still provides all of the chats I started, even after quite a long time.
No idea how it is done… :thinking:

Perhaps it recognizes my IP-address?

Many greetings from Rosika :slightly_smiling_face:

Hi Rosika,

According to the help pages, it saves locally:

Jorge

@Tech_JA :

Hi Jorge, :waving_hand:

I see.
You´re right of course. On the page you referenced it says:

Because recent chats are stored locally on your device

O.K., it would be interesting to know where exactly the chats are stored.
I´ll have to investigate.

Thanks again and many greetings from Rosika :slightly_smiling_face:

Hi Rosika,

As far as I can understand, I’ve found a few ways to find out where the chats are stored, I’ll just explain the way I think is the easiest:

The chats are stored in a sqlite database, in my case:

jorge@PC-JA:~$ locate https+++duckduckgo.com/ls/data.sqlite
/home/jorge/.mozilla/firefox/856hwbho.default-release/storage/default/https+++duckduckgo.com/ls/data.sqlite

in a single field, the ‘savesAIChats’ field:

This information can be checked, for example, in Firefox’s Developer Tools (F12 key):

Jorge

@Tech_JA :

Hi Jorge, :waving_hand:

thank you very much for doing the research.
Great, I found the file data.sqlite on my system as well, thanks to your detailed explanation.

I tried looking up the information with sqlitebrowser but it doesn´t seem to provide as much information as your method does:

Thanks again and many greetings from Rosika :slightly_smiling_face:

Jorge’s one screen shot looked like maybe it was from Beekeeper Studio rather than DB Browser like yours is. Just guessing though.

I’ve used Beekeeper Studio and like it for the most part.

Hi Rosika,

I’ll try to help you see the data with DB Browser for SQLite, i.e., sqlitebrowser:

  • 1 - Open your data.sqlite database;
  • 2 - Select the Browse Data Tab;
  • 3 - Find the name savedAIChats in the key column. When you find it, look for the value column for savedAIChats and you’ll notice that it says BLOB;
  • 4 - Select Edit Database Cell Binary Mode;
  • 5 - you can see the original hexadecimal code in the value cell, which is your data, and on the right-hand side, the same code converted to ASCII

Hi pdecker,
it’s true, the screen was from Beekeeper Studio :wink:

Jorge

@Tech_JA :

Hi Jorge, :waving_hand:

thanks a lot for the how-to. :heart:

I tried it out by following your instructions. And it worked indeed.
So I learned something new again. Thank you very much for your kind help.

Many greetings from Rosika :slightly_smiling_face: