Setting up an Oracle linked server using an LDAP connection string

I am trying to set up an Oracle Linked Server in SQL Server 2016. With the information I have for the Oracle server, I am able to reach it with tnsping using a connect string via LDAP.

tnsping Result

Adding the string that works with tnsping as the Provider string in linked server setup, however, doesn’t work and results in an “ORA-12154: TNS:could not resolve the connect identifier specified” error.

enter image description here

I’m sure it’s something I am missing, but don’t know enough about Oracle to know what that might be.

transit – Tocumen international airport (PTY) international connection time

I have the following route below. Can someone tell me if 1.2 hours is enough for taking the connecting flight in Panama? This will be international to international (arriving from GRU and departing to NAS).

From my research, it seems this is a tiny airport with only 2 terminals and the videos online showed that it is virtually empty due to COVID. There will also be no checked in luggage…only luggage will be carry on.

Legend: CMB - Sri Lanka, DXB - Dubai, GRU - Brazil, PTY - Panama, NAS - Bahamas, FPO - Bahamas

                 CMB      DXB      GRU      PTY      NAS      FPO
      03/26      02:55    05:55                                             Emirates
                          09:05    17:20                                    Emirates
      03/27                        01:30    06:24                           Copa
                                            07:48    11:42                  Copa
                                                     15:30    16:15         Bahamas Air

postgresql – Postgres: ODBC: ERROR: SSL connection has been closed unexpectedly; Error while executing the query

I’m currently in Australia and so is the database.

Staff attempting to connect to the database from overseas (USA, UK) consistently run into the error: ERROR: SSL connection has been closed unexpectedly; Error while executing the query, when they try to connect. People here can connect fine without that error but anyone overseas will receive that error if their query lasts longer than say 1 minute?

The database is a postgres RDS hosted in AWS Sydney region.

What is the cause of an SSL connection closing like this? Is it the server or is it just caused by the latency of someone overseas trying to connect to the database? Is there any way to combat this?

This error was from an ODBC connection using Power BI or Tableau
We find a similar error when querying from Python or DBeaver as well.

c# – Dependency Inversion Principle with connection to a SQL Server

I think you have a reasonable grasp to understand the technical ins and out of design patterns, but you are struggling to use them sensibly. So this answer focuses on intent rather than specific syntax.

I just want to take some time here to point out something that you may wrongly infer about my feedback. Just because I call your implementations bad, doesn’t mean I’m calling you a bad developer. You have clearly put a lot of thought and effort into this, and I’m most definitely not accusing you of not doing your due diligence or questioning your ability to write code.

You know how to lay bricks, but you’re not working off of the right blueprint. I often use the example of Forrest Gump playing American football. He’s amazing at putting one foot in front of the other, but he doesn’t realize where he should and shouldn’t be going or when to stop.

You’ve done the same thing. Your code is good if you look at it line by line, but it misses the bigger picture of what it tries to achieve.

The factory pattern

A factory is a place that creates things. You’ve nailed that part.

However, why would we use a factory instead of just a constructor? Because we can just as well call new Foo() without needing to create a FooFactory.CreateFoo.

There are three main purposes to the factory pattern:

  1. If the construction of the object is more complex than the consumer needs to care about, the factory acts as a consumer-friendly simplification.
  2. If the consumer doesn’t get to decide which concrete class should be used, and instead the factory decides that for them. This is what I call a “smart” factory, it makes the choice for the consumer.
  3. Specific to DI, when a class needs to be able to repeatedly create new instances of an injected dependency, rather than having one instance injected in its constructor.

Your code, which is a factory wrapper around not even your own code (they’re System.Data classes), doesn’t actually add anything meaningful. It does nothing, other than call an empty constructor. This doesn’t match the purposes of a factory, and therefore the factory is not necessary.

Some quick examples of how factories can be useful:

Purpose 1

public class CarFactory
    public ICar CreateCar()
        return new Car()
            Engine = new PetrolEngine(),
            Wheels = new() { new Wheel(), new Wheel(), new Wheel(), new Wheel() }

In this example, you don’t want your consumer to know how to put a car together, so you have the factory do it for them.

Purpose 2

public class CarFactory
    public ICar CreateAppropriateCar(CarGoal goal)
            case CarGoal.Racing:
            case CarGoal.ShowingOff:
                return new SportsCar();
            case CarGoal.Transport:
            case CarGoal.LivingIn:
                return new Van();
            case CarGoal.Offroading:
                return new Jeep();
            case CarGoal.Tourism:
                return new TourBus();
                return new Sedan();

You don’t want the consumer to have to decide which car is most appropriate, the consumer only knows what they intend to do with the car (CarGoal). The factory makes the correct decision based on the reported goal.

Purpose 3 isn’t easily demonstrable.

What I understood is, that the return type, should be a interface as best.

For purpose 2, it is essential that your return type is not the concrete type, or it would otherwise defeat the purpose.

For purposes 1 and 3, it’s not necessary but still a general nice-to-have in terms of clean coding. Not so much for the validity of the factory pattern in and of itself, but rather because it implies that you’re using your interfaces correctly in your codebase.

This is in my eyes not possible with the SQL classes.

Since they don’t implement an interface, it isn’t.

There are cases where you’d wrap a library class in one of your own, and you can implement an interface on that custom class, but don’t start doing this blindly as it leads to a bunch over unused over-engineered boilerplate code.

When all you have is a hammer, everything looks like a nail.

public static ICar CreateCar()
    return new Car(CreateDatabase());

You’ve gone overboard on using the factory pattern to the point trying to wrap everything in a factory. This relates back to my initial paragraph in this answer: you know how to implement a factory, but you don’t know when or why to implement a factory.

The larger issue here is that the instantiation of a car should not trigger the instantiation of a database connection (or the object which will eventually make the connection).
Creating an in-memory object shouldn’t be inherently tied to connecting to a database. It defeats the purpose of doing things in-memory. Conceptually these are very separate steps.

Is-a versus has-a

The goal is to use SqlDatabase in your codebase, but without tightly coupling yourself to that specific data provider. This much is clear.

But it seems like the only attempts you’ve made at doing this has been through using interfaces.

I can’t and won’t explain it in its entirety here, but you need to introduce yourself to the concept of composition over inheritance. While inheritance isn’t quite the same as interface implementation, in context of comparing composition and inheritance, you can lump interfaces in with inheritance.

Interfaces implementation and class inheritance are a “is-a” relationship. Car is an ICar. SQLDatabase is an IDatabase.

But compositions uses a “has a” relationship. Take the example of me, a person. I have a car. How would you reflect that in code? Like this?

public class Person : Car { }

No. It’s not done by using inheritance or interfaces, because “A Person is a Car” is not correct.

public class Person
    public Car Car { get; set; }

This is the correct approach, because “A Person has a Car

Note: since cars have interfaces, it’s indeed correct to use the interface instead of the concrete type here, so a better version would be:

public class Person
    public ICar Car { get; set; }

But in cases where there is no interface, using the concrete type would still be a correct usage of composition over inheritance.

I suggest you look into the repository pattern to understand how to use composition to work with your SqlDatabase, while at the same time hiding it from view from the consumer.

While I generally don’t use repositories myself anymore, it’s a really good start for a beginner to grasp basic layer separation and encapsulation. With more experience, you’ll learn about other possible (and more advanced) approached.

Dependency inversion

But first I wanted to understand the principle of dependency inversion.

I can’t go into this in full detail, but I’ll use an analogy to help you understand the intent. Suppose we run a sandwich shop:

public class SandwichShop
    public Sandwich MakeSandwich()
        var bread = new WhiteBread();

        var toppings = new List<Topping>() { new Bacon(), new Lettuce, new Tomato() };


        return bread;          

The customer depends on the sandwich shop, and the sandwich shop depends on the white bread. That mean that the customer indirectly depends on the white bread. Similarly, the customer can only have the toppings that the sandwich shop has hardcoded.

If we give the customer control over which bread to use, that would be inverting the normal order of dependency.

This is the same class, but now made with dependency inversion in mind:

public class SandwichShop
    public Sandwich MakeSandwich(Bread bread, List<Topping> toppings)

        return bread;          

Now, the customer (i.e. the actor who calls MakeSandwich gets to decide the bread and the toppings). The downside is that the customer is now responsible for providing those dependencies as well.

This example uses a method and method parameters. In software development, the more common implementation of dependency inversion is related to the constructor argument, but it’s the same principle: the caller (i.e. the actor who calls the constructor) provides the dependencies of the object it’s creating.

Just to disambiguate:

  • Dependency injection generally refers to using a framework or container to automatically provide the correct dependency to any object, based on what it asks for in the constructor.
  • Inverted dependencies are (annoyingly) a completely different thing than dependency inversion, and something significantly more advanced that I’m not going to get into here.

macbook pro – Wifi connection continuously cuts out

I have been having an issue I can’t seem to fix. The WIFI on my 2017 Macbook Pro keeps cutting out, about once every 10-20 minutes. When this happens I lose internet connection and when I click on the wifi icon in the menu bar it shows that my wifi is on and connected to my network, but my network, as well as all other available wifi networks, are greyed out and I am unable to click anything. Turning the wifi off and back on temporarily fixes the problem.

Here is a list of things I have tried so far:

Restart computer
Turn wifi on/off
Remove network and reconnect
Remove wifi service and reestablish
Rebout router
Factory restore of router
New SSID, new channels, new wifi password
Reset the PRAM & SMC
Updated the Mac OS to Big Sur (from Catalina)
Ran Wireless Diagnostics

Running Wireless Diagnostics initially finds nothing when the internet is working, but then when this happened it does detect a “Dropped Wi-Fi Connection”, stating that:

Your Mac experienced an unexpected Wi-Fi connection drop, which can be
caused by a combination of environment, configuration, and software

Provide the diagnostics report created in /var/tmp to an AppleCare
customer support representative for further analysis.

I looked into the logs, but am not really sure what I am looking at. And to make matters worse the applecare on this machine just expired.

Also worth noting that the network has been, and continues to work fine for all other devices (another macbook pro, two iphones, smart tv, etc.) and nothing major changed with the network before this occurred.

Any tips on what to try next?

wi fi – Laptop internet connection from SIM card’s wi-fi, instead of smartphone’s mobile hotspot wi-fi

When traveling, we usually connect our laptop to our smartphone’s wifi hotspot. In other words, the smartphone’s wifi subscription, on its SIM card, is projected for the laptop to use/piggyback.

Is it possible instead to somehow make the laptop access the smartphone’s SIM card directly instead? In the same way that the laptop has an SD card slot, is there such a thing as a SIM card slot or adaptor for laptops? The idea is to not have to require two hardware devices running at the same time (smartphone + laptop) just to have mobile internet when travelling. We just want to need the laptop in order to access the internet, not both

at.algebraic topology – The notion of a “relatively” flat connection

Suppose that $X$ is a connected smooth manifold and $Gamma$ is a group acting smoothly, freely, properly and discretely on $X$, so that $Y=X/Gamma$ is another smooth manifold endowed with a covering map $pi:Xrightarrow Y$.

Suppose that $G$ is a Lie group and that $rho:Gamma rightarrow G$ is a group homomorphism. Then we can consider the quotient $E_rho =(Xtimes G)/Gamma$, where the action of $Gamma$ on $G$ is given by composing $rho$ with the adjoint action of $G$ on itself. $E_rho$ is naturally a principal $G$-bundle over $Y$.

My question is if there exists a condition for a principal $G$-bundle $E$ on $Y$ to be isomorphic to an $E_rho$, for some homomorphism $rho:Gamma rightarrow G$.

This can be interpreted as a “relative” notion of a flat connection since, if $X$ is the universal covering space of $Y$ and $Gamma=pi_1(Y)$, then the condition for $E$ to be of the form $E_rho$ is that $E$ admits a flat connection.

Moreover, the same question can be extended to the holomorphic category. For example, we can take $X$ a Riemann surface and $G=U(n)$. In that situation, if $X$ is the hyperbolic plane and $Y$ is a compact Riemann surface of genus $geq 2$, the condition for a holomorphic Hermitian vector bundle $E$ to be of the form $E_rho$ is that it is stable of degree $0$ (this is the Theorem of Narasimhan-Seshadri).

ethernet – I-TEC Docking Station connection services ports problems 20.04

I use a CLEVO laptop with ubuntu 20.04, gnomeshell 3.36.8 and I use firewalld, not UFW
It’s connected via USB 3 (it is also possible to connect it with a USB C but the problems remain) to an I-TEC docking station (code: CADUAL4KDOCK) which connects to the network via ethernet
When I use the docking connection, some services / ports are not working (such as the detection / casting to the google home assistants and the bridged connections of virtual machines which, however, with the NAT option selected, work, both on virtualbox and vmware).
While when I use the wifi I don’t have these problems.
Ubuntu recognizes the connection as “Ethernet USB” or “Ethernet DisplayLink” (when I disconnect and reconnect it changes name).
The only drivers installed for docking were, in fact, the displaylinks (latest version)

I have no idea how to fix it other than turning on the wifi, which I didn’t want to do (I wouldn’t have taken a docking)

Would anyone know how to help me?
Thank you

Is it possible to update redmi 9 using USB to PC connection?

redmi 9 usb connection to windows 10 which has wired internet
is it possible to update? it doesn’t automatically do anything other than file exchange.
the "dev option" of enabling usb doesn’t change it and the other dev option under it that says "allow app updates" just flips back off automatically while openning "log in with mi accaunt" UI and "no connection" message.

database design – Databse-Server connection to public Internet is unsercure

I know that a databse connection to the public internet is a “no-go” and connected with a lot of threats.
The best practice would for example be an application server but my question now is, does anyone know official sources where the threats of a public databse connection is described or why it should not be done?