Where to find similar channels to a given channel in Telegram?

Telegram doesn’t recommend you similar channels. However, public channels are displayed when you use the global search that is available in telegram.

Global search usually matches the username. It doesn’t have to be an exact match. Eg: If you search “programming” the results will be groups and channels which contains the text “programming”. So, you might get “c programming” or “programming group”.

Another way of finding similar channels is by associating with groups, as people tend to share stuffs from various groups.

strings – Python – use a list of names to find exact match in the free text pandas column

I have an Excel file containing a free-form text column (that sometimes is structured like an email), where I need to find all first and last names and add an extra columns saying TRUE/FALSE to these fields. I do not need to extract matched data (i.e. note it down in an adjacent column), although that could be an advantage.

NB: I do not know the names that I need to find, so it is pure guesswork. I have a list of registered first names with 40k+ entries, as well as a list of most common last names with another 16k+ entries.

So far, I managed to filter out roughly 10000 rows out out ~20000 row file, although my solution contains a lot of false positives. Fx some rows marked TRUE for first names, contain text like “Det er OK.“, where Python (I assume) merges the entire text together and extracts any matching substing to a name from a list, in this case I guess that could be “t er O” or “r OK“, since my list has names “Tero” and “Rok” (although the case does not match and it combines letters from 2/3 separate words, which is not what I want)… Weirdly enough, this is NOT TRUE for the same text written in lowercase and without “.” at the end, i.e. “det er ok“, which is marked as FALSE! P.S. there are unfortunatelly few names in the emails that are written in lowercase letters and not sentence case as it should be…

Sample email (with names Thomas, Lars, Ole, Per):

Hej Thomas,

De 24 timer var en af mange sager som vi havde med til møde med Lars og Ole. De har godkendt den under dette møde.

Mvh. Per

Below is my code.

# Import datasets and create lists/variables
import pandas as pd
from pandas import ExcelWriter

namesdf = pd.read_excel('names.xlsx', sheet_name='Alle Navne')
names = list(namesdf('Names'))

lastnamesdf = pd.read_excel('names.xlsx', sheet_name='Frie Efternavne')
lastnames = list(lastnamesdf('Frie Efternavne'))


# Import dataset and drop NULLS
df = pd.read_excel(r'Entreprise Beskeder.xlsx', sheet_name='dataark')
df("Besked").dropna(inplace = True)


# Compare dataset to the created lists/variables to match names, phone numbers and emails
df("Navner") = df("Besked").str.contains("|".join(names)) # Creates new column and adds TRUE/FALSE for first names
df("Efternavner") = df("Besked").str.contains("|".join(lastnames)) # Creates new column and adds TRUE/FALSE for last names


# Save the result
writer = ExcelWriter('PythonExport.xlsx')
df.to_excel(writer)
writer.save()

I would appreciate any suggestions that could potentially improve my code and reduce manual work that it will take to filter out all of these false positive cells that I found! I think the best case scenario would be a case sensitive piece of code that finds only the specific name without merging the text together. Also it would be great if I could extract a specific string that Python finds a match with, as that would reduce manual work when trying to figure out why exactly Python marked a specific block of text as TRUE. All in all, all suggestions are welcome! Thanks 🙂

equipment recommendation – How do I find fabric, tape, or materials that are black on infrared wavelengths?

I’m not exactly doing pro photography here; please forgive me. My baby monitor is mounted in a corner. It shines bright IR at night, and the walls are highly reflective, and I can barely see into the crib because the exposure is destroyed. I’ve tried a few things, including black sticky notes which might as well be white, blue painter’s tape that is currently on the wall because it’s better than nothing, and covering some of the emitters so they’d shine on the wall less, which maybe I didn’t do right but it didn’t help.

I haven’t yet tried my black t-shirts, but I’m not hopeful. Is there a cloth, tape, or something on the market that is dark on the IR spectrum?

calculus and analysis – How to find a numerical antiderivative with NIntegrate methods?

We construct an NDSolve method which can pass an NIntegrate method to NIntegrate to set up an integration rule. We define a method nintegrate implements such a method. The requirements are

  • the ODE is of the form y'(x) == f(x), and
  • the NIntegrate method returns an interpolatory rule.

Example:

foo = NDSolveValue({y'(x) == Sin(x^2), y(0) == 0}, y, {x, 0, 15}, 
  Method -> nintegrate, InterpolationOrder -> All)

Error plot:

Plot(
 Evaluate@RealExponent(Integrate(Sin(x^2), x) - foo(x)),
 {x, 0, 15},
 GridLines -> {Flatten@foo@"Grid", None}, (* show steps *)
 PlotRange -> {-18.5, 0.5})

Another example:

foo = NDSolveValue({y'(x) == Sin(x^2), y(0) == 0}, y, {x, 0, 15}, 
  Method -> {nintegrate, 
    Method -> {"ClenshawCurtisRule", "Points" -> 33}}, 
  InterpolationOrder -> All, WorkingPrecision -> 32, 
  PrecisionGoal -> 24, MaxStepFraction -> 1, StartingStepSize -> 15)

Error plot:

Block({$MaxExtraPrecision = 500},
 ListLinePlot(
  Integrate(Sin(x^2), x) - foo(x) /. x -> Subdivide(0, 15, 1000) // 
   RealExponent, DataRange -> {0, 15}, PlotRange -> {-35.5, 0.5}, 
  GridLines -> {Flatten@foo@"Grid", None})
 )

Code for method

nintegrate::nintode = 
  "Method nintegrate requires an ode of the form ``'(``) == f(``)";
nintegrate::nintinit = 
  "NIntegrate method `` did not return an interpolatory integration rule.";

nintegrate(___)("StepInput") = {"F"("T"), "H", "T", "X", "XP"};
nintegrate(___)("StepOutput") = {"H", "XI"};
nintegrate(rule_, order_, ___)("DifferenceOrder") := order;
nintegrate(___)("StepMode") := Automatic

Options@nintegrate = {Method -> "GaussKronrodRule"};
getorder(points_, method_) :=
  Switch(method
   , "GaussKronrodRule" | "GaussKronrod",
   (* check points should be odd ??? *)
   With({gp = (points - 1)/2},
    If(OddQ(gp), 3 gp + 2, 3 gp + 1)
    )
   , "GauseBerntsenEspelidRule", 2 points - 1
   , "LobattoKronrodRule",
   (* check points should be odd ??? *)
   With({glp = (points + 1)/2},
    If(OddQ(glp), 3 glp - 2, 3 glp - 3)
    )
   , "GauseBerntsenEspelidRule",
   2 points - 1
   , "NewtonCotesRule",
   If(OddQ(points), points, points - 1)
   , _, points - 1
   );
nintegrate /: 
  NDSolve`InitializeMethod(nintegrate, stepmode_, sd_, rhs_, state_, 
   mopts : OptionsPattern(nintegrate)) := 
  Module({prec, order, norm, rule, xvars, tvar, imeth},
   xvars = NDSolve`SolutionDataComponent(state@"Variables", "X");
   tvar = NDSolve`SolutionDataComponent(state@"Variables", "T");
   If(Length@xvars != 1,
    Message(nintegrate::nintode, First@xvars, tvar, tvar);
    Return($Failed));
   If(! VectorQ(rhs("FunctionExpression")(
       N@NDSolve`SolutionDataComponent(sd, "T"),
       Sequence @@ xvars),
      NumericQ
      ),
    Message(nintegrate::nintode, First@xvars, tvar, tvar);
    Return($Failed));
   prec = state@"WorkingPrecision";
   norm = state@"Norm";
   
   imeth = Replace(Method /. mopts, Automatic -> "GaussKronrodRule");
   rule = 
    NIntegrate(1, {x, 0, 1}, 
     Method -> {"GlobalAdaptive", "SymbolicProcessing" -> 0, 
       Method -> imeth},
     WorkingPrecision -> prec,
     IntegrationMonitor :>
      (Return(Through(#@"GetRule"), NIntegrate) &));
   rule = Replace(rule, {
      {(NIntegrate`GeneralRule | NIntegrate`ClenshawCurtisRule)(idata_)} :>
       idata,
      _NIntegrate :>
       Return($Failed),
      _ :>  (* What happened here? *)
       (Message(nintegrate::nintinit, Method -> imeth);
        Return($Failed))
      });
   order = 
    getorder(Length@First@rule, imeth /. {m_String, ___} :> m);
   
   nintegrate(rule, order, norm)
   );

(rule : nintegrate(int_, order_, norm_, ___))(
   "Step"(rhs_, h_, t_, x_, xp_)) := 
  Module({prec, tt, xx, dx, normh, err, hnew, temp},
   (* Norm scaling will be based on current solution y. *)
   normh = (Abs(h) temp(#1, x) &) /. {temp -> norm};
   tt = Rescale(int((1)), {0, 1}, {t, t + h});
   xx = rhs /@ tt;
   dx = h*int((2)).xx;
   (* Compute scaled error estimate *)
   err = h*int((3)).xx // normh;
   hnew = Which(
     err > 1 (* Rejected step: reduce h by half *)
     , dx = $Failed; h/2
     , err < 2^-(order + 2), 2 h
     , err < 1/2, h
     , True, h Max(1/2, Min(9/10, (1/(2 err))^(1/(order + 1))))
     );
   (* Return step data along with updated method data *)
   {hnew, dx});

equation solving – How can I find a functional square root in Mathematica?

A functional square root of a function $g$ is another function $f$ such that $g=fcirc f$. According to that article, there is a systematic approach to finding a functional square root that involves solving Schröder’s equation though I don’t know what procedure to apply.

For example, the functional square root of $x/(2 – x)$ is $x/(sqrt{2} + x – xsqrt{2})$ and we can verify:

f(x_) := x/(Sqrt(2) + x - x*Sqrt(2))
FullSimplify(f(f(x)))
(* returns: x/(2 - x) *)

I’d like to know how to go about finding exact or approximate functional square roots in Mathematica.
Suppose I want to find an $f$ for $g(x)=cos(4 pi x)$. I try to frame it as a differential equation but this is unsuccessful. I am not even sure what the initial conditions should be either:

D(f(f(x)), x)
(* Derivative(1)(f)(x) Derivative(1)(f)(f(x)) *)

D(Cos(4 Pi x), x)
(* -4 Pi Sin(4 Pi x) *)

NDSolve({-4 Pi Sin(4 Pi x) == Derivative(1)(f)(x) Derivative(1)(f)(f(x)), f(0) == 1}, f, {x, 0, 1})
(* Power::infy: Infinite expression 1/0 encountered. *)

calculus – How to find the intersection of the graphs of $y= x^2$ and $y = 6 – |x|$?

I was trying to solve this question in preparation for the Math subject GRE exam:

enter image description here

So the first step I was trying to find the intersection of the graphs of $y= x^2$ and $y = 6 – |x|.$ Which I did by equating $ x^2 = 6 – |x|.$ Then I ended up having 2 equations which are $ x^2 – 6 + x = 0 $ and $ x^2 – 6 – x = 0 $ and then I get 4 values of $x$ which are $pm 3, pm 2.$ But I found in the answer for the question that they consider only the 2 values $pm 2.$

Could anyone show me what is wrong in my solution or in the book solution (the book just gave me the values $pm 2$ without explaining how and why), please?

nvidia – How to find out why Ubuntu 20.04 freezes?

I installed Ubuntu 20.04 on my Amd Ryzen 5 1600 / Nvidia Gtx 1070 two weeks ago but Ubuntu completely freezes from time to time.

Keyboard and screen stop working completely, mouse sometimes is able to keep moving. I’ve tried using the magic SysRq key but didn’t work. Also tried alf+F1 but didn’t get any response from the system either. Basically I’m left with pressing the power button in order to restart.

Is there any logs or commands I could use to find anything about these freezes? I’m suspecting Nvidia but I don’t know how to verify.

Edit: Found these logs in /var/log/Xorg.1.log.old that showed the time around my computer crashed.

( 1223.234) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-22ms), your system is too slow
( 1223.234) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-35ms), your system is too slow
( 1488.529) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-0ms), your system is too slow
( 1488.529) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-13ms), your system is too slow
( 5125.223) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-14ms), your system is too slow
( 5125.223) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-27ms), your system is too slow
( 6038.321) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-9ms), your system is too slow
( 6206.894) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-3ms), your system is too slow
( 6206.894) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-16ms), your system is too slow
( 6409.650) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-9ms), your system is too slow
( 6409.650) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-22ms), your system is too slow
( 10930.426) (EE) client bug: timer event2 debounce: scheduled expiry is in the past (-7ms), your system is too slow
( 10930.426) (EE) client bug: timer event2 debounce short: scheduled expiry is in the past (-20ms), your system is too slow

“free -h” result:

              total        used        free      shared  buff/cache   available
Mem:           15Gi       2.5Gi        11Gi       393Mi       1.9Gi        12Gi
Swap:         2.0Gi          0B       2.0Gi

“sysctl vm.swappiness” result:

vm.swappiness = 60

“sudo lshw -C memory” result:

  *-firmware                
       description: BIOS
       vendor: American Megatrends Inc.
       physical id: 0
       version: 1.L0
       date: 12/28/2018
       size: 64KiB
       capacity: 16MiB
       capabilities: pci upgrade shadowing cdboot bootselect socketedrom edd int13floppy1200 int13floppy720 int13floppy2880 int5printscreen int9keyboard int14serial int17printer acpi usb biosbootspecification uefi
  *-memory
       description: System Memory
       physical id: f
       slot: System board or motherboard
       size: 16GiB
     *-bank:0
          description: 2933 MHz (0.3 ns) (empty)
          product: Unknown
          vendor: Unknown
          physical id: 0
          serial: Unknown
          slot: DIMM 0
          clock: 2933MHz (0.3ns)
     *-bank:1
          description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2933 MHz (0.3 ns)
          product: CMK16GX4M2B3200C16
          vendor: Unknown
          physical id: 1
          serial: 00000000
          slot: DIMM 1
          size: 8GiB
          width: 64 bits
          clock: 2933MHz (0.3ns)
     *-bank:2
          description: 2933 MHz (0.3 ns) (empty)
          product: Unknown
          vendor: Unknown
          physical id: 2
          serial: Unknown
          slot: DIMM 0
          clock: 2933MHz (0.3ns)
     *-bank:3
          description: DIMM DDR4 Synchronous Unbuffered (Unregistered) 2933 MHz (0.3 ns)
          product: CMK16GX4M2B3200C16
          vendor: Unknown
          physical id: 3
          serial: 00000000
          slot: DIMM 1
          size: 8GiB
          width: 64 bits
          clock: 2933MHz (0.3ns)
  *-cache:0
       description: L1 cache
       physical id: 11
       slot: L1 - Cache
       size: 576KiB
       capacity: 576KiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=1
  *-cache:1
       description: L2 cache
       physical id: 12
       slot: L2 - Cache
       size: 3MiB
       capacity: 3MiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=2
  *-cache:2
       description: L3 cache
       physical id: 13
       slot: L3 - Cache
       size: 16MiB
       capacity: 16MiB
       clock: 1GHz (1.0ns)
       capabilities: pipeline-burst internal write-back unified
       configuration: level=3

How can I find a big pharmacy in Istanbul?

I’m currently staying in Istanbul and need to buy an over-the-counter medicine that is a little rare. I went around a few pharmacies around my hotel, but they’re all relatively small and don’t carry the product that I need. How can I locate a list of big pharmacies that would likely have a lot of choice? Is there a particular keyword that distinguishes small pharmacies from big ones?

Complexity of find histogram bins vs convex hull

For a list of n 2d points, finding the convex hull vertex takes O(n log(n)) time. And O(n) time if it’s sorted lexicon order.

Meanwhile What’s the complexity of finding the histogram bin edges of k bins on both axis ?

Which one is faster ?

postgresql – find out why table insert is slow in postgres cluster

Recently i did create a PostgresQL-HA 11, cluster using bitnami helm charts.
There is 1 master and 1 replica, pg_pool and metrics.

I am using NFS as file storage for the cluster and it is connected to a vmware guest machine with enough memory and cpu and a HP fast hard disk drive, in same broadcast domain on same VSwitch with a 1Gbps v-port.

But insert into database using a js written batch script is slow like this:
Insert 2000 records in 13.952 seconds.

The script inserts very fast on my local non-clustered postgresql database, on my local machine and inserts 2000 records in less than a second.

So since I am not a DBA or someone like that, how i can find why it is slow? can metrics or sth else help?