What is the best way to solve an Objective-C namespace collision?

Prefixing your classes with a unique prefix is fundamentally the only option but there are several ways to make this less onerous and ugly. There is a long discussion of options here. My favorite is the @compatibility_alias Objective-C compiler directive (described here). You can use @compatibility_alias to “rename” a class, allowing you to name your … Read more

In C++, what is a “namespace alias”?

A namespace alias is a convenient way of referring to a long namespace name by a different, shorter name. As an example, say you wanted to use the numeric vectors from Boost’s uBLAS without a using namespace directive. Stating the full namespace every time is cumbersome: boost::numeric::ublas::vector<double> v; Instead, you can define an alias for … Read more

How do I get an object’s unqualified (short) class name?

You can do this with reflection. Specifically, you can use the ReflectionClass::getShortName method, which gets the name of the class without its namespace. First, you need to build a ReflectionClass instance, and then call the getShortName method of that instance: $reflect = new ReflectionClass($object); if ($reflect->getShortName() === ‘Name’) { // do this } However, I … Read more

printf with std::string?

It’s compiling because printf isn’t type safe, since it uses variable arguments in the C sense1. printf has no option for std::string, only a C-style string. Using something else in place of what it expects definitely won’t give you the results you want. It’s actually undefined behaviour, so anything at all could happen. The easiest … Read more

How to switch namespace in kubernetes

I like my answers short, to the point and with references to official documentation: Answer: kubectl config set-context –current –namespace=my-namespace From: https://kubernetes.io/docs/reference/kubectl/cheatsheet/ # permanently save the namespace for all subsequent kubectl commands in that context. kubectl config set-context –current –namespace=ggckad-s2

Django: “projects” vs “apps”

Once you graduate from using startproject and startapp, there’s nothing to stop you from combining a “project” and “app” in the same Python package. A project is really nothing more than a settings module, and an app is really nothing more than a models module—everything else is optional. For small sites, it’s entirely reasonable to … Read more

Namespace “stuck” as Terminating, How I removed it

Assuming you’ve already tried to force-delete resources like: Pods stuck at terminating status, and your at your wits’ end trying to recover the namespace… You can force-delete the namespace (perhaps leaving dangling resources): ( NAMESPACE=your-rogue-namespace kubectl proxy & kubectl get namespace $NAMESPACE -o json |jq ‘.spec = {“finalizers”:[]}’ >temp.json curl -k -H “Content-Type: application/json” -X … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)