Random snippets of all sorts of code, mixed with a selection of help and advice.
How would I be able to restrict PHP Reflection for certain classes/functions?
25 December 2025 @ 10:22 pm
I am trying to sandbox plugins for my PHP project, I have the overall idea down. Check code for restricted functions/restrict access to certain info based on whether it's SQL or NoSQL (Redis).
The only problem is Reflection. I understand how powerful Reflection is as a way to gain access to methods and variables within class objects.
Like for example, Reflection can be used to get the variable holding the PDO instance. With that instance, you could bypass user written checks and access any data you wanted.
I also understand it's a "keep it or disable it" thing. I would like for the scope of the project to allow some Reflection but not be able to access sensitive data.
Is there any way to restrict what can be reflected? Like a custom method/function that's called before Reflection occurs for a variable or method? Or barring that, is there a PHP script option to disable Reflection?
hoe to use mod rewrite to use index.php for router class without having index.php in the uri itself
25 December 2025 @ 10:15 pm
I have a router class, which is instantiated in index.php (resides in project_root) and which takes the PATH_INFO of PHP, explodes it and uses the pieces as controller and method. the trick used is to call controllerclass::method() based on PATH_INFO[1] and PATH_INFO[2].
The problem is that it needs the index.php in the uri to work. Without it, there is no PATH_INFO and without PATH_INFO there is no controllerclass to call.
So how can I achieve that htaccess maps http://localhost/project_root/controllername/methodname to
http://localhost/project_name/index.php/controllername/methodname
without making it visible in the uri?
I have studied and tried the whole day but didn´t find a working solution.
Thanks for reading and helping!
Datastax Cassandra auto-limiting response size to 20 when sorting
25 December 2025 @ 10:13 pm
I'm using Cassandra hosted with a free plan in Datastax Astra (in AWS, but I don't think this is relevant) in my project, consuming it with astra-db-ts library.
I'm able to make the migrations normally. Using the same library I was able to programatically create the table countries and seed the data. If I go to the CQL console and run a SELECT * FROM my_keyspace.countries, I get the whole 243 rows as expected.
However, when I run:
await this._db
.table<CountriesAlphabeticalTableSchema, CountriesAlphabeticalTablePrimaryKey>(
ASTRA_TABLES.countriesByAlphabetical, { keyspace: ASTRA_KEYSPACES.countries }
)
.find({}, { sort: { country_code: 1 } })
.map(i => ({ countryCode: i.country_code, possessionOf: i.possession_of }))
.toArray();
I get only the 20 first entries. If I put, let
Wiregaurd on Pixel 9 Pro Fold cannot connect to tunnel [closed]
25 December 2025 @ 9:50 pm
Weird thing is with the same settings from the other phone I exported from, I can connect great. Server is running on PFSense 23.09 running on a Netgate 2100. Old Phone connects fine (Pixel 8 Pro). New phone using the same conf, no connection (Pixel 9 pro fold)
I made sure both devices do not have wireguard enabled at the same time.
This is the android conf:
[Interface]
Address = 10.0.0.8/24
DNS = 1.1.1.1
IncludedApplications = io.homeassistant.companion.android, at.tripwire.mqtt.client, org.owntracks.android, com.mcu.reolink, app.vanadium.browser
PrivateKey = [Priv Key]
[Peer]
AllowedIPs = 10.10.0.0/16
Endpoint = [PUB IP]:51820
PublicKey = [Pub Key]
Server conf:
# Description: remote access
[Interface]
PrivateKey = [priv key]
ListenPort = 51820
# Peer: JP phone
[Peer]
PublicKey = neCnnjRcTfTDpoA7WcvLw9rFEegH8NoRTbhkZg573nY=
AllowedIPs = 10.0.0.8/32
PersistentKeepalive = 30
# Peer:
How to make _render_template function in Odoo to render OWL component?
25 December 2025 @ 9:45 pm
On Odoo, How to make _render_template function in odoo to render OWL components instead of static templates. so that python templates become isomorphic with javascript OWL templates?
The reason behind that is because static template force you to register event listeners later when loaded. which makes development code is very complex
this function cannot render OWL templates. so the static templates are missing some usefull attributes such as t-on-click. which make static templates doesn't support almost all event registeration there: https://www.odoo.com/documentation/19.0/developer/reference/frontend/owl_components.html
any idea on how to achieve that?
Large Excel file Handling [closed]
25 December 2025 @ 9:37 pm
if I got a an excel file around 1 to 1.5 gb of file size I need to analyze the file and do insert and update on my sql server table using C# program but a file having 1 to 1.5gb of size is difficult to load into program and process. Are there any libraries and packages that can be used for memory optimization and and give me some approaches to handle this criteria
Identifying original script file from minified name in Zoho CRM
25 December 2025 @ 7:51 pm
I’m working on a Zoho CRM customization and I can see the client-side scripts in the browser, but they’re all showing up as minified filenames. Even with source maps, I’m not able to identify the original script file names or figure out which exact client script is running.
Is there a specific tool or a setting in the admin dashboard that helps map minified filenames back to the original scripts, or is there another way to pinpoint the exact client script?
How to contain a label into its preceeding expanded element, without using a wrapper container?
25 December 2025 @ 6:49 pm
Given a small colored box followed by a label name tag to it. Like so:
Once mouse hovering the small colored box, the box should expand to full width and the label text should get positioned inside the now expanded rectangle and be aligned to the bottom right.
Like so:
I know how to achieve this by wrapping an extra container elements around the current html, like this demo snippet. My question here is: is it possible to achieve my desired result Without using an extra container wrapper? My current bare clean html code and css are:
Once mouse hovering the small colored box, the box should expand to full width and the label text should get positioned inside the now expanded rectangle and be aligned to the bottom right.
Like so:
I know how to achieve this by wrapping an extra container elements around the current html, like this demo snippet. My question here is: is it possible to achieve my desired result Without using an extra container wrapper? My current bare clean html code and css are:
Why is std::vector<bool> special, and what guarantees does it actually provide?
24 December 2025 @ 8:55 pm
std::vector<bool> is the only standard container whose name strongly suggests “a vector of bool”, yet it intentionally does not model a contiguous container of bool objects.
Despite breaking multiple assumptions that hold for every other std::vector<T>, it remains standardized and unchanged for decades.
Consider the following example:
#include <vector>
#include <iostream>
int main() {
std::vector<bool> v = { true, false, true };
bool* p = &v[0]; // error: not a bool*
}
Unlike other std::vector<T> specializations, std::vector<bool>:
does not store actual bool objects
does not provide a real bool*
returns a proxy object instead of a reference from operator[]
As a result, it violates expectations such as:
Shape intersection design
24 December 2025 @ 8:33 am
I hope this question won't be considered as opinion based or something. Though the question is about shape intersection, the problem described is quite general (like, how can you make a function template that doesn't order its template parameters, and so on).
Neither it is a homework question. I was asked about this about a year ago, and then I couldn't solve it quickly. Recently this task again showed its face to me. And I started working on it.
I've been trying to solve it for a couple days, with no success, that's why I've decided to ask gurus for help :)
Suppose I have different types of shapes: Triangle, Circle, Hexagon (but not limited to those, the user can add their own). And suppose I want to have a way to intersect those types. For each possible pair (A, B) I assume the user can define its algorithm how to intersect the shapes in the pair intersect(A,B). But I want to achive the following