Quantcast
Channel: User Blackbam - Stack Overflow
Browsing latest articles
Browse All 39 View Live

Comment by Blackbam on PHP: Evaluate class constant string as code (syntax...

@u_mulder: You won! Did not know there is a function like that, thank you <3

View Article



Comment by Blackbam on How to create a dialog with “Ok” and “Cancel” options

Link is broken this is why you should use SO code snippets please.

View Article

Comment by Blackbam on Dynamic mapping of Single Table Inheritance

Just an idea: Is there such a high amount of classes? What about creating the adequate child class from the constructor by calling a required method? It is not abstract :)

View Article

Comment by Blackbam on Chrome Devtools says there's issues, but the Issues...

Wondered quite some time about this. Still no solution and still no fix for that?

View Article

Comment by Blackbam on PHP (IntelliJ/PhpStorm inspection): "Method should be...

Could be possible indeed, I have lots of them installed. But then still the question remains if the third-party plugin is suggesting that for any good reason?

View Article


Comment by Blackbam on PHP (IntelliJ/PhpStorm inspection): "Method should be...

Making methods final might increase security and cleanliness of the code, but it it harms reusability and might make extension maybe unnecessary difficult. So it entirely depends on the app, I guess I...

View Article

Comment by Blackbam on Symfony RabbitMQ Bundle in AWS (managed service): Any...

@AlexanderPravdin Saved on the server locally just as in usual PKI structures?

View Article

Comment by Blackbam on Bootstrap 3 Adding a container-fluid inside a container?

Perfect answer, especially because it works without position absolute and does NOT assume that it is possible for any case to not use container-fluid within a container.

View Article


Comment by Blackbam on Is it possible to select all elements with an...

Did not know the :is selector, interesting. Of course with SASS you can also easily make a loop here. Still I miss a CSS feature which allows selection on data attribute wildcards or comparison operators.

View Article


Comment by Blackbam on How to increase memory limit for PHP over 2GB?

You should explain your answer, it might not be clear for anyone what this config means. In certain cases it might be quite dangerous to have no limits at all!

View Article

More important than !important (a higher level !important)?

The title says most of it. Is there a CSS keyword which overrides !important at one higher level or is there some feature like this planned in any newer CSS spec?Of course, I know that !important is a...

View Article

Transpose and flatten multiple rows of array data [duplicate]

Is there a native PHP function to zip merge two arrays?Look at the following example:$a = array("a","b","c");$b = array("d","e","f");$c = array("g","h","i");var_dump(array_merge($a,$b,$c));This...

View Article

How to set the component size with GridLayout? Is there a better way?

I am working on a larger GUI with Java and I am becoming angry on Layout Managers.I have a "Settings-Panel" with a variable number of JComponents in it (Labels, Buttons, JSpinners, JSliders,...). I...

View Article


Symfony RabbitMQ Bundle in AWS (managed service): Any way to get this working?

We really tried a lot but it still can not get the Symfony RabbitMQ bundle (https://github.com/php-amqplib/RabbitMqBundle) running in AWS (with Docker). AWS only allows AMQPS and port 5671 to be opened...

View Article

Answer by Blackbam for Can I use an HTML input type "date" to collect only a...

No you can not, but input type number provides exactly the functionality you need for this purpose.Example:<input type="number" min="1900" max="2099" step="1" value="2016" />

View Article


Recursive function in PHP - how not to return false [duplicate]

A WordPress function should return the top level term id of a given child term id - terms can have 1..n parents, so a recursive function seems to be useful here.// Recursive functionfunction...

View Article

How to fully dump / print variable to console in the Dart language?

Hey there I am searching for a function which is printing a dynamic variable as completely as possible to the console in Dart language.In PHP for instance I would use var_dump() in order to get all...

View Article


Webpack 5 (Webpack Encore): How to run multiple webpack instances on the same...

For a pretty large Web application I want to run multiple instances of Webpack (Encore) on the same page. When I put all the source code into a single Webpack configuration it all works. However when I...

View Article

Answer by Blackbam for Webpack 5 (Webpack Encore): How to run multiple...

Finally I solved it by adding the following setting to the configuration:appConfig.output.chunkLoadingGlobal = 'appConfigChunkLoadingGlobal'As simple as that. It makes sure that the global Webpack...

View Article

What exactly is the difference between an anonymous function and a static...

Basically the purpose of the static keyword is totally clear to me, the PHP docs only explain the purpose of the keyword in the context of classes. I noticed one of my IDE plugins suggesting me that I...

View Article

A very basic approach to the double submit cookie patterns for ajax requests...

My self-coded very basic approach to implement the double submit cookie pattern (detailed information:...

View Article


Can an anonymous function return itself?

In some PHP quiz I got the following task - I have to return true on the following:function foo($x){ return $x === $x();}foo(__________ALLOWED_INPUT____________);Now my idea was to pass an anonymous...

View Article


PHP callback: Is there an equivalent for ::class for a method of a class?

In PHP it is possible to get a full class name via class name resolution like this:Example:namespace Name\Space;class ClassName {}echo ClassName::class;Output: Name\Space\ClassNameThis is better than...

View Article

Answer by Blackbam for SonataMediaBundle: change default filesystem s3 adapter

According to Symfonys architecture it should be possible to override pretty much everything: https://symfony.com/doc/current/bundles/override.html#services-configurationIf you want to modify the...

View Article

Answer by Blackbam for What regular expression will match valid international...

No criticism regarding those great answers I just want to present the simple solution I use for our admin content creators:^(\+|00)[1-9][0-9 \-\(\)\.]{7,32}$Force start with a plus or two zeros and use...

View Article


Content Security Policy (CSP): Is it somehow possible to report violations if...

After playing around with this for quite some time I am still searching for a solution. The content Security Policy of a certain website requires a long list of allowed sources (especially because...

View Article

Answer by Blackbam for Content Security Policy (CSP): Is it somehow possible...

I have found a solution:<meta http-equiv="Content-Security-Policy" content="[CSP_CONTENT_HERE]"><script nonce="[CSP_NONCE_HERE]"> document.addEventListener('securitypolicyviolation',...

View Article

Image may be NSFW.
Clik here to view.

Answer by Blackbam for Warning: apt-key is deprecated. Manage keyring files...

Fast way to fix this for Linux users with a UI:Search for the PPA and do sudo add-apt-repository ppa:[MY_PPA] (the new PPA with keyring is added automatically and up to date)sudo apt updateNavigate to...

View Article

Symfony 6: How to SAFELY replace deleted constant...

Having some project which is updated from Symfony 5 to Symfony 6 we have realized that a certain constant is missing.Old code:// We always trust the connecting client to be a proxy (load balancer) as...

View Article



Eloquent / Laravel: How to get last insert/update ID/instance of...

The title is mostly self-explanatory. Eloquent has a method calledupdateOrCreate()documented here: https://laravel.com/docs/5.5/eloquent#other-creation-methodsIn some cases this is really useful....

View Article

Answer by Blackbam for How to build unhashed files in a 'dist/' folder with...

In my opinion this can be solved incredibly easily - just do not put your entry files into subdirectoriesparcel build src/index.scss src/index.js --no-content-hash --out-dir ../public/buildThere you...

View Article

IntelliJ plugins lost (after upgrade to 2023.2.1): How to find out previous...

After upgrading to IntelliJ 2023.2.1 all my plugins, extensions and settings have been lost. As this version caused other problems (like constant scanning and indexing) I downgraded to 2023.1.5 but...

View Article

Enable event tracking for Google Translator (TranslateElement) with Google...

Migration from Google Analytics 3 to 4 I wonder how to replace the following Google Translator script:function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'en',...

View Article


Answer by Blackbam for Enable event tracking for Google Translator...

Found the solution here: https://support.google.com/analytics/answer/12270356?hl=enGo to Admin -> [Your Property] -> Data StreamsCopy the "Measurement ID" (not the stream ID) which looks like...

View Article

Is it possible to select all elements with an attribute value greater than a...

I wonder if the following is possible with CSS:HTML-Code:<span class="funny-elem" data-mystate="127">Hello World</span><span class="funny-elem" data-mystate="69">Hello...

View Article

Answer by Blackbam for WordPress: $wpdb->get_results(); returns wrong results...

First of all the following line is definitely wrong:$name_exists = $wpdb->get_results("SELECT * FROM quotation_diensten WHERE dienstNaam='$text'", ARRAY_A);Why? Because a variable name within single...

View Article


Dart null / false / empty checking: How to write this shorter?

This is my code for true on everything but empty string, null and false:if (routeinfo["no_route"] == "" || routeinfo["no_route"] == null || routeinfo["no_route"] == false) { // do sth ...}This is my...

View Article


git stash drop: How can I delete older stashed states without dropping the...

What I already have discoverd:git stash list... for listing all my stashes.git stash show -p stash@{0} --name-onlyTo list all files within that stash (here the latest stash at position 0).Now I have a...

View Article

Comment by Blackbam on Detecting that the browser has no mouse and is touch-only

@matteo Did you add a .matches after the bracket? It could be a bug or bad implementation otherwise but I doubt it ;)

View Article
Browsing latest articles
Browse All 39 View Live




Latest Images