StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.4/10 (10 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

Why are the lines of my MT5 EA not starting at exactly at the opening session?

18 July 2025 @ 7:13 pm

I coded an EA that uses an ORB strategy. You're also a trading expert, so you're familiar with this OPEN RANGE BREAKOUT strategy. My EA is supposed to plot high and low lines for the first 15 minutes at the London and NYC openings. I've set a lot of parameters to customize this MT5 Expert Adviser. I'm practicing on an MT5 demo account. The server is a few hours behind NYC. The London session starts at 10:00 AM on MT5 and 4:30 PM on NYC. My problem is this: the high and low lines don't start at 4:30 PM or 10:00 AM. They start at 9:57 AM and 4:27 PM. There's a difference of a few minutes, so the timeframe to analyze isn't correct, and the first candlestick in my 15-minute range isn't correct. enter image description here

How to build multiply files with help of slint_build?

18 July 2025 @ 7:06 pm

trying to run an application with help of slint and rust. When i am using only one file in my build.rs - everything works fine, but when i am trying to add one more file - builds only file in last command. Don't find any solution. Can you help me with this problem? For example - My build.rs. There is only app-window works mod src; fn main() { let config = slint_build::CompilerConfiguration::new(); slint_build::compile("ui/map-window.slint") slint_build::compile_with_config( "ui/app-window.slint", config.clone() ).unwrap(); } Now works only map-window.slint mod src; fn main() { let config = slint_build::CompilerConfiguration::new(); slint_build::compile_with_config( "ui/app-window.slint", config.clone() ).unwrap(); slint_build::compile("ui/map-window.slint") } How to build all files? I ne

Capture LinkedIn Authorization Code from API

18 July 2025 @ 6:59 pm

I am doing an integration of LinkedIn API with ServiceNow. I am able to get the access token using the authorization code and sign in through Postman. But there is a human intervention where I have to manually copy the auth-code from the redirect URL and pass it in the access token API. Is there a way through which I can automatically capture the code and pass dynamically to the next API ? Thanks,

COPPA Compliance and Unity Google Play Services automatic sign-in

18 July 2025 @ 6:55 pm

It seems that the latest Google Play Services for Unity has mandatory automatic sign-in. There is no way to disable it and I cannot revert back to version 10 since they require SDKv2. I have an age gate and I can signout and prevent communications with Google Play Services but the sign-in will still happen before that. Not sure if this is COPPA compliant since not data is exchanged but the user is authenticated. Or is there a way to prevent the automatic sign-in?

Deploy/update file without functions in it - Firebase Functions

18 July 2025 @ 6:52 pm

I am trying to update a file named blues.cts because a function named fetchAllPacks uses it to update the client. I was wondering if, without updating the functions, I could update the JSON data in that file? The following is blues.cts that I would like to update. It has this data object, interfaces, and a few functions. export const data = { "specials": { "Alien Cat": { "cost": 0, "bluedata": "Alien Cat", ... This is my functions script, and I see there is no need to update this function. export const fetchAllPacks = onCall({enforceAppCheck: true}, async (req) => { if (req.auth == null) {return {success: false, error: ReturnError.auth.invalid}} return {success:true, packs: shop.getAllPacks()}; });

Cannot read properties of undefined (reading 'cloudStorageURI') Generation 2 Google Cloud Storage Function

18 July 2025 @ 6:34 pm

I am migrating a generation 1 node.js google cloud functions to generation 2 cloud run. It uses a onDocumentCreated function to create and save a file to cloud storage built from a collection of data in my Firestore database. We have about five functions like this and they've all worked perfectly for about 3 years until the migration to generation 2. Now when we push the functions to Cloud Run I'm getting this: Cannot read properties of undefined (reading 'cloudStorageURI') The message is coming from the cloud storage library const { Storage } = require("@google-cloud/storage"). The app is initialized with admin.initializeApp, which includes my storageBucket address. Here is an example of the one of the functions that generates a sitemap. const { onDocumentCreated } = require("firebase-functions/v2/firestore"); c

Using gbak to upgrade Firebird 2.5.9 database to Firebird 5.0

18 July 2025 @ 5:26 pm

I have an app using Firebird 2.5.9. We're going to be releasing a major new version of the app, and I want to migrate to FB 5.0. The database schema has changed dramatically between old and new app versions, and I've written a utility to pump the data from old-schema v2.5 database to new-schema v2.5 database. I want to make sure I understand the process of upgrading an existing installation; specifically, using gbak to convert the 2.5 database to 5.0. Can the gbak from 5.0 back up a 2.5 database and then restore it to a 5.0 database? Or do I need to back up with gbak 2.5 first, then change Firebird versions and restore using gbak 5.0? This will determine where in the process I uninstall Firebird 2.5.9 and install Firebird 5.0.2.

Why is my WordPress plugin shortcode output duplicating every time I refresh the page?

18 July 2025 @ 4:01 pm

I'm building a simple WordPress plugin that fetches a random quote from an external API and displays it using a shortcode. The problem is: every time I refresh the page, the quote seems to duplicate — it appears twice (or more) inside the same container. I expected it to show just one quote per page load. Here’s a simplified version of my code: function my_quotes_shortcode() { $response = wp_remote_get('https://api.quotable.io/random'); if (is_wp_error($response)) { return 'Quote unavailable.'; } $data = json_decode(wp_remote_retrieve_body($response)); $quote = $data->content ?? 'Default quote'; $author = $data->author ?? 'Unknown'; return "<div class='quote-box'>\"{$quote}\" - {$author}</div>"; } add_shortcode('daily_quote', 'my_quotes_shortcode'); What I Tried Wrapped the return inside ob_start() / ob_get_cle

SemanticException in subquery after upgrading hibernate version from 5.2.14 to 6.6.5

18 July 2025 @ 3:12 pm

I've run into a problem with a subquery after upgrading my application from hibernate version 5.2.14 to 6.6.5. When running the query, I get a org.hibernate.query.SemanticExpression. I created a simplified example to demonstrate the problem. There are 2 tables - 1 for people and 1 for any aliases they might use. I want to run a case insensitive search against the person's name that will also get a hit on any aliases they might have. Example: SELECT * FROM demo_person p WHERE lower(p.full_name) LIKE lower('%' || search-term || '%') OR p.demo_person_id IN ( SELECT a.demo_person_id FROM demo_alias a WHERE lower(a.alias_text) LIKE lower('%' || serch-term || '%') ) Table creation: create table demo_person ( demo_person_id number not null, full_name varchar2(100) not null, constraint demo_person_pk primary key (demo_person_id) ) / create table demo_alias ( demo_alias_id number not null, demo_person_id numbe

How to manage Android devices with rounded corners screens

18 July 2025 @ 2:56 pm

For the migration to Android 16 of my app, I tested it on a virtual device with a screen that features large radius rounded corners. I found out my views were nibbled by the rounded corners. To avoid that I'd need to add padding to the main activity layout rootview according to the radius of the screen corners. What I need is precisely adressed in Developers Doc at Apply Rounded Corners. I managed to insert the given example with the class InsetsLayout in my code: class InsetsLayout(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) { override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) { val insets = rootWindowInsets if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && insets != null) { applyRoundedCornerPadding(insets) }