Posts

Showing posts from October, 2023

How to make a grammar using python textx exclude tokens

I am trying to parse a network device configuration file, and though I would be going through the whole file, I will not want to include all the terms of the file, but only a subset. So assume that the configuration file is as follows: bootfile abc.bin motd "this is a message for everyone to follow" . . . group 1 group 2 . . . permit tcp ab.b.c.d b.b.b.y eq 222 permit tcp ab.b.c.d b.b.b.y eq 222 permit tcp ab.b.c.d b.b.b.y eq 222 . . . interface a description this is interface a vlan 33 interface b description craigs list no shut vlan 33 no ip address . . . I am only trying to capture the interface line (as is) and the description and vlan line as is - everything else would be ignore. Contents within the interface would be broken into 2 attributes: valid and invalid so the grammar would look something like this: Config[noskipsp]: interfaces *= !InterfaceDefinition | InterfaceDefinition ; InterfaceDefinition: interface = intf valids *= valid invalid...

iOS Safari renders specific font not correctly

Image
I need to use the font Machauer on my project. On desktop (Chrome/Safari) it renders correctly but not on iOS (iPhone/iPad). Strangely on the download page of the font the same problem is happening - except for the textarea. The font is there displayed with all its details in the correct way. I wonder what is different there. The website with textarea textarea displayed correctly: this is how it renders outside the textarea: I tried different options like text-Rendering or font-smoothing - it had no impact on iOS Safari. This how I specified the font and used it: @font-face { font-family: 'Machauer'; src: url(fonts/machauer.ttf) format('truetype'); font-weight: normal; } h1 { font-family: 'Machauer'; text-rendering: geometricPrecision; }

string.Split for Span?

I was wondering how I may implement, or whether or not there are any workarounds, for a sring.Split() method, but for ReadOnlySpan<T> or Span in C#, because unfortunately ReadOnlySpan<T>.Split() does not seem to exist. I am not quite sure how to achieve the behaviour I wish for. It probably could be implemented by leveraging the combined power of ReadOnlySpan<T>.IndexOf() and ReadOnlySpan<T>.Slice() , but because even the support for ReadOnlySpan<T>.IndexOf() isn't too great (it isn't possible to specify a startIndex or a Count), I would prefer to avoid this entirely. I am also aware that the problem with a ReadOnlySpan<T>.Split() method would be, that it isn't possible to return ReadOnlySpan<T>[] or ReadOnlySpan<ReadOnlySpan<T>> , because it is a ref struct and therefore must be stack-allocated , and putting it into any collection would require a heap allocation . So has anyone any idea, on how I may achieve ...

I cannot execute "make clean" in my terminal

Apologies for the inconvinience, it is my first time in stackoverflow. I am trying to compile a make project, but when i do make clean, the terminal returns this error: rm -rf build process_begin: CreateProcess(NULL, rm -rf build, ...) failed. make (e=2): The system cannot find the file specified. make: *** [nRF5_SDK_17.0.2_d674dde/components/toolchain/gcc/Makefile.common:79: clean] Error 2 in the makefile.common, line 70 i have this: ifneq (,$(filter clean, $(MAKECMDGOALS))) OTHER_GOALS := $(filter-out clean, $(MAKECMDGOALS)) ifneq (, $(OTHER_GOALS)) $(info Cannot make anything in parallel with "clean".) $(info Execute "$(MAKE) clean \ $(foreach goal, $(OTHER_GOALS),&& $(MAKE) $(goal))" instead.) $(error Cannot continue) else .PHONY: clean clean: $(RM) $(OUTPUT_DIRECTORY) -> this is line 79 endif # ifneq(, $(OTHER_GOALS)) else # ifneq (,$(filter clean, $(MAKECMDGOALS))) what can i do to solve this problem? thankyou for your effort! I trie...

Entity Framework Core: how to combine selects and retain order?

What I currently want to achieve is this, but as IQueryable without the need of allocating the result to memory, as the request itself already contains pagination information. I am really not getting my head around it how to solve it, I already tried Union , but that does not retain any order at all. Basically I want to order the items based on the State and the Updated properties. That's all one table and base.OnQuery returns the DbSet<HKTDownload> . Is it somehow possible to solve that only by OrderBy ? If so, how? var list = new List<HKTDownload>(); list.AddRange( base.OnQuery(context, request) .Where(x => x.State == HKTDownloadState.DownloadContent || x.State == HKTDownloadState.Unpack || x.State == HKTDownloadState.Repair || x.State == HKTDownloadState.MoveFiles) .OrderByDescending(x => x.Updated) .Include(x => x.DownloadConfig) ); list...

Position of Hide Sidebar buton in SwiftUI

Image
I was looking at the Apple Design Resources and saw a toolbar that looked like this: where the hide sidebar button is inside the sidebar. However, using SwiftUI, I cannot find how to place it here at all times instead of next to the traffic light buttons. I can add an additional sidebar button before the title but I cannot remove the initial one by the traffic light buttons. Is there any way to alter the position of this button? Thanks

Error: Couldn't find a navigation object. Is your component inside NavigationContainer? (how to use useNavigation inside Navigation container)

I am writing a react-native MERN chat app and I am adding a profile page so the user can edit or add his data.the I want to access this page by a button and using useNavigation but I got the error ehich I mentioned in the title NOTE: the button is inside the Navigation Container My Code: import React from 'react'; import storage from './storage'; import { useNavigation } from '@react-navigation/native' import { NavigationContainer, Screen } from '@react-navigation/native'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import { LogBox, ActivityIndicator, Button, TouchableOpacity, View } from 'react-native'; import { Menu, MenuItem, MenuDivider } from 'react-native-material-menu'; import Icon from 'react-native-vector-icons/Entypo'; import ProfileScreen from './Profile.Screen'; //rest of the imports... export default function App() { const [savedData, setSavedData] = React.useState(...

JavaFX TableView text in the cells of the columns seems to jump

Image
When I click the button for showing the pane with the table for the first time (after load) the text in the cells of the columns seems to jump Maybe it has to do something with the scrollbar that is being added to the table. If I limit the amounts of rows to what can be in the table without the scrollbar the text is not moving when it is being show for the first time. When the table has been show for the first time it is not moving. Below is example and description on how to reproduce the issue. This is the App.java: package org.example; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.scene.layout.VBox; import javafx.scene.text.Text...

Can I make the configuration for the analysis in php? on codeQL

I have this error, I read that it can be configured to scan php code, but it fails. What am I doing wrong? Languages from configuration: php Error: Did not recognize the following languages: php name: "CodeQL" on: push: branches: [ "main" ] pull_request: # The branches below must be a subset of the branches above branches: [ "main" ] schedule: - cron: '21 0 * * 4' jobs: analyze: name: Analyze runs-on: $ timeout-minutes: $ permissions: actions: read contents: read security-events: write strategy: fail-fast: false matrix: language: [ 'javascript-typescript' ] steps: - name: Checkout repository uses: actions/checkout@v3 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: php actions#jobsjob_idstepsrun below for guidance. - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: category: "/language:$" ...

Cannot connect to Neo4j in Python to push data

I am going slightly crazy trying to understand why I can't push data to my Neo4j database using CYPHER in Python. I am running basic testing code just to see if I can push data. Here is my testing code: import logging from neo4j import GraphDatabase # Set up logging logging.basicConfig(level=logging.DEBUG) # Change the level to ERROR, WARNING, INFO, or DEBUG as needed log = logging.getLogger("neo4j") class Neo4jService: def __init__(self, uri, user, password): self._driver = GraphDatabase.driver(uri, auth=(user, password)) def close(self): log.debug("Closing driver.") self._driver.close() def run_queries(self, queries): log.debug("Running queries.") with self._driver.session() as session: for query in queries: log.debug(f"Executing query: {query}") session.run(query) try: # Initialize the Neo4j service URI = "ne...

Didn't get any dynamic content on web page using view/template engine (Handlebars)

I am using Handlebars template engine. Not getting any error at console but I am not able to display dynamic content in the index.hbs file which is rendered from app.js app.js const express = require('express'); const app = express(); app.set('view engine','hbs'); app.use(express.urlencoded({extended:true})); //to get the html form data app.use(express.static('./public')); app.use(express.json()); app.get('/',(req,res)=>{ res.render('index.hbs'); }); app.post('/', async (req,res)=>{ const currentCity = req.body.city; let WRAP_DATA = await getCityWeather(currentCity); //getCityWeather function return weather by city console.log('Weather Info = ',WRAP_DATA); // successfully got the WRAP_DATA res.render('index.hbs',{WRAP_DATA}); }); At console I got WRAP_DATA successfully description: 'overcast clouds', humidity: 53, visibility: 10, windSpeed: 2.592, ...

How to handle deselection event on PHPickerViewController?

I'm trying to register a deselection event on PHPickerViewController but picker() function is being called only on selection event not on deselection event. Not even updateUIViewController() is being called when user makes the deselection. Here is my code: //-------------------------------------------------- // COORDINATOR CLASS //-------------------------------------------------- class Coordinator: NSObject, PHPickerViewControllerDelegate { //-------------------------------------------------- // VARIABLES //-------------------------------------------------- var parent: ImageChatPicker //-------------------------------------------------- // METHODS //-------------------------------------------------- // INIT init(_ parent: ImageChatPicker) { self.parent = parent } //-------------------------------------------------- // PICKER func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { ...

UiPath Open Browser Activity

What packages must be installed to use the Open Browser activity on UiPath? I cannot seem to find it and I installed the WebApi package. I onl see the "Use application/browser" activity. After installing the webapi package I expected to find it the open browser activity.

GCP Colab Enterprise shared VPC connection

We are trying to use the Colab Enterprise offering (in Vertex AI) using a shared VPC (hosted in a different project). There is an organizational policy to block external IPs. I have added the Compute Network user permission to the service agent in the Shared VPC Host project, and the runtime template and the runtime are created successfully. But when I try to connect a notebook to the runtime, it tries connecting until a timeout, after which it fails. I checked the runtime logs, this is what I see: cos.googleapis.com/container_name: "proxy-agent" message: failed to list pending requests: 401 Your client does not have permission to the requested URL /tun/m/4592f09221234568f8016274df1b36a14/agent/pending What can be the issue? I guess something networking or IAM related. If I create a runtime in a normal VPC (inside the same project), then the notebook can connect and it's working fine.

Screen capture (mediaProjection) on Android 14

I'm trying to adapt my app to run on Android 14. It worked fine on Android 13. But in SDK version 34 I get an exception when I try to start the foreground service. Caused by: java.lang.SecurityException: Starting FGS with type mediaProjection callerApp=ProcessRecord targetSDK=34 requires permissions: all of the permissions allOf=true [android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION] any of the permissions allOf=false [android.permission.CAPTURE_VIDEO_OUTPUT, android:project_media] at android.os.Parcel.createExceptionOrNull(Parcel.java:3057) at android.os.Parcel.createException(Parcel.java:3041) at android.os.Parcel.readException(Parcel.java:3024) at android.os.Parcel.readException(Parcel.java:2966) at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:6761) at android.app.Service.startForeground(Service.java:862) at .service.ScreenCaptureService.startWithNotification(ScreenCaptureService.java:147) This message looks like I need to get per...

Move onboarding logic into hook/context

I have an onboarding process that requires the user to click a button to acknowledge or dismiss the screens and make it to the regular app. Currently I have the logic laid out like this, split between my Nav and Onboarding components. Nav const [onBoarded, setOnBoarded] = useState(false); useEffect(() => { const isOnBoarded = async () => { const ob = await EncryptedStorage.getItem('ONBOARDED'); setOnBoarded(!!ob); } isOnBoarded(); }, []); return ( <Stack.Navigator initialRouteName="onboarding" > {!onBoarded && <Screen name="onboarding" component={Onboarding} />} <Screen name="MainApp" component={MainApp} /> ... Onboarding const handleOnBoarding = () => { EncryptedStorage.setItem('ONBOARDED', 'true'); navigation.navigate('MainTabNavigator'); ...

Loader is not getting hide after download is completed in C# asp.net

I am calling loader on OnClientClick and its loading when the process of downloading in process. But when I try to hide the loader once the process gets completed, it doesn't works. The loader continously displays and loads. Here is the code. function showloadingGif_UPLOAD() { document.getElementById('ContentPlaceHolder1_divShowLoadingGif').style.display = 'inline'; return true; } function HideLoader() { document.getElementById('ContentPlaceHolder1_divShowLoadingGif').style.display = 'none'; } --loader div <div id="ContentPlaceHolder1_divShowLoadingGif" class="dvLoader" style="display: none;"> <img id="img2" alt="" src="images/1487.png" /> </div> -- button click <input type="submit" name="ctl00$ContentPlaceHolder1$btnDownloadInfo" value="Report Do...

optimize TIMESTAMPDIFF in mysql query

I need help optimizing a query for large data table when I test manually it shows fast , but in my slow query log it is logged as taken 10s+ for some reason . SELECT q.id, q.village_id, q.to_player_id, q.to_village_id, q.proc_type, TIMESTAMPDIFF(SECOND, NOW(),q.end_date) remainingTimeInSeconds FROM table I expect to output the results that's time is ended , meaning time left must be 0 or less , in ASC order . it order by the end time itself ,because when we have many attacks we must arrange them according to which attack suppose to arrive first ,then process them one by one

Can't import Optuna

I am trying to import Optuna on Jupyter Notebook . I have previously installed pytorch-2.0.1 . I have tried to downgrade pytorch as well as uninstalling and reinstalling Optuna as well as sqlalchemy . The error I am getting now when running import Optuna is: "ImportError: cannot import name 'NOT_EXTENSION' from 'sqlalchemy.orm.interfaces" Does anybody know what the error could be and if there is a fix to this?

What is the best way to create user config at first user login?

In my quarkus application, I want to have some data inserted in my database for each user. Database uses neo4j. As a consequence, I would like to have some code in my application which creates the various datas and send them in database. Currently, I use the RolesAugmentor , as described in Security Tips and Tricks . Unfortunatly, as it is invoked for each request, we have multiple nodes generated for each new user. How can I have data inserted only once for each user ? EDIT 1 More clearly, I have a RolesAugmentor class containing the following code @ApplicationScoped public class RolesAugmentor implements SecurityIdentityAugmentor { @Override public Uni<SecurityIdentity> augment(SecurityIdentity identity, AuthenticationRequestContext context) { return Uni.createFrom().item(build(identity)); // Do 'return context.runBlocking(build(identity));' // if a blocking call is required to customize the identity } private Supplier<Se...

Why I don't see nodes on the map?

Image
I have a dataset that has longitude and latitude of subway stations. Here is an example what I get when I expand the results of MATCH (n) RETURN n; in Memgraph Lab. { "id": 177, "labels": [ "Station" ], "properties": { "latitude": 52.496161111, "longitude": 13.342702777, "name": "U-Bahnhof Viktoria-Luise-Platz" }, "type": "node" } Query result - data: I can see that Latitude and Longitude are defined for all nodes. Graph schema: I expected to get results shown on a map, not as a "circle" of nodes. How can I show my results on a map? Graph results:

Odoo Color one2many Treeview Line

can anyone help me get my case to run? I want to color the line of a many2one treeview by the value of a field inside the line. <field colspan="2" name="timesheet_ids" class="custom-field" widget="one2many" nolabel="1"> <tree editable="bottom" > <field name="sequence" colors="red:is_line_nonsense == True"/> <field name="time_event_type"/> <field name="date" attrs="{'readonly': [('is_date_readonly', '=', True)]}"/> <field name="is_begin_readonly" invisible="1"/> <field name="is_end_readonly" invisible="1"/> ...

Modify the TableRelation property in Business Central

i'm trying to modify the TableRelation property of a standard field in BC, but without success. Despite all my tentatives, seems that my modification is not perceived by Business Central. Do you have any possible solutions to this problem? I've tried to substitute the entire standard logic of the property, but without success. I've tried to extend the property, adding some filters to the field using the TableExtension, but without success.

Snapcraft python builds - how to get it to pack - path doesn’t exist error?

So I am newer to Snapcraft, however I have been having this issue, despite following examples and tutorials so I figured I would ask here. Machine setup : So I am on a windows machine, running ubuntu in a VM to compile the snap. Sadly work has not given me a ubuntu dev machine. Our deployments are on linux machines (hence the need for a snap), but they gave me a windows machine. Snap Problem : Have a file (main.py) that is normally launched as “python3 -m main” and we want to make it into a snap. So far I have this as my snap: name: asdf version: '4.0.0' summary: asdf description: | qweradsf - blah-etc... grade: devel confinement: devmode base: core22 parts: py-dep: plugin: python source: . python-packages: - pyserial - ftputil apps: asdf: command: usr/bin/python -m main environment: PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:${SNAP}/usr/local/lib For the command part I have tried all the combinations below command: usr...

UTL_HTTP making API call to fetch token , bad request

Image
I am using utl_http for the first time, using documentation and online resources to build my code. I am trying to call an API that is returning a token. I have the API calls working using POSTMAN, but I am not able to get it working on PLSQL side using utl_http . I keep getting Bad request error or credential invalid error, but I know I have right credentials in my code same as POSTMAN. Not able to figure what I am missing. Here is the image from POSTMAN: Headers Body Here is my code: declare req utl_http.req; res utl_http.resp; l_lvc_content varchar2(4000); buffer varchar2(4000); endLoop boolean; begin -- making request begin --utl_http.set_persistent_conn_support(true, 30); utl_http.set_transfer_timeout(15); utl_http.set_detailed_excp_support(true); utl_http.set_wallet('file:/mywallet/wallet', 'MywalletPASS'); req := utl_http.b...

On Running a docker container, It is exiting automatically

git repo : https://github.com/samAd0san/two-tier-flask-app.git I have used the Dockerfile to build an image, then proceeded by running a flask app container. docker run -d -p 5000:5000 --network=twotier -e MYSQL_HOST=mysql -e MYSQL_USER=admin -e MYSQL_PASSWORD=admin -e MYSQL_DB=myDb --name=flaskapp flaskapp:latest The problem occurs when I launch this command: docker ps -a 2860157851d9 flaskapp:latest "python app.py" 5 minutes ago Exited (1) 5 minutes ago flaskapp The container should run on executing the command so that I can deploy the flask app on the container and it is connected with mysql container. Ultimately I'm not able to access the application.

How to download xlsx file in laravel?

I use the library as a means of generating Excel documents. Only I need to either save the file to the root/storage/app/public/export/file.xlsx directory, or immediately download the file in the browser. Everything is implemented in Laravel 9. Tell me how to write the code correctly? My code, now: use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; ... $spreadsheet = new Spreadsheet(); $activeWorksheet = $spreadsheet->getActiveSheet(); $activeWorksheet->setCellValue('A1', 'Hello World !'); $writer = new Xlsx($spreadsheet); $writer->save("file.xlsx"); The file is saved to a folder 'public'. Help me, please!

How investigate disk cache usage in Win32 application?

I have a workload similar to the following: while True: data = get_data_from_network(); filename = sha1(data); write_to_file(filename, data, data.size()); Occasionally I read back from the file, but it's not very common. Importantly, I get a lot of these network requests. It's not uncommon for me to a gigabyte of data out to the disk this way. So for the most part I'm effectively just streaming large volumes of data to the disk. There is this article from Raymond Chen where he advises the customer not to use the flag, because as Raymond puts it: If the application reads back from the file, the read can be satisfied from the disk cache, avoiding the physical I/O entirely But I'm not sure if this applies to me, because depending on the size of the cache, there's a pretty good chance that by the time I go to read that data again, it's already been pushed out by some other data. I can bypass this with FILE_FLAG_NO_BUFFERING when I call CreateFi...

How to force `stat_poly_line()` to use a specific non-zero y-intercept?

Using stat_poly_line() from package 'ggpmisc', one can fit a polynomial to data by default using lm() as method. You can force the fit through zero with either: formula = y ~ x + 0 or formula = y ~ x - 1 . I cannot force it through a specific non-zero y-intercept for my linear model. In this case, I need to force it through 5.05. Note: I recognize linear models are rarely statistically useful when the y-intercept is forced, but in my case I believe it is fine. Here is my data: mydata <- structure(list(y = c(20.2, 29.74, 22.37, 24.51, 37.2, 31.43, 43.05, 54.36, 65.44, 67.28, 46.02), x = c(0.422014140000002, 1.09152966, 1.3195521, 3.54231348, 2.79431778, 3.40756002, 5.58845772, 7.10762298, 9.70041246, 11.7199653, 15.89668266)), row.names = c(NA, -11L), class = c("tbl_df", "tbl", "data.frame")) And here is a simplified version of my plot: myplot <- ggplot(mydata, aes(x = x, y = y)) + stat_poly_line(se = FALSE, lin...

Command CodeSign failed with a nonzero exit code Version 15

Hy After Sonoma install,(before that, no problem...) Xcode blocked with "Command CodeSign failed with a nonzero exit code". All the solutions proposed doesn't work but I went to Settings/Locations/Derived Data/ Advanced/Custom/ and modified default value « Custom ABSOLUTE» with « Relative to Workspace »: It works perfectly on simulator and with iPhone and iPad : Good luck ! Best Regards I hope I Help some people😃

Django Superuser Permission Issue: "You don’t have permission to view or edit anything"

I'm encountering an issue in my Django project where I'm unable to access the admin site as a superuser. When I try to log in as a superuser, I receive the error message: "You don’t have permission to view or edit anything." I've followed the standard steps for creating a superuser and configuring my custom user model, but I can't figure out why this permission issue is occurring. - Django administration: Site Administration, You don’t have permission to view or edit anything.* \---------------------------------* * for fresh start* - deleted migrations - deleted db.sqlite3 -------------------------------- powershell: >>Python manage.py makemigrations Migrations for 'auth_app': auth_app\migrations\0001_initial.py - Create model CustomUser >>Python manage.py migrate Operations to perform: Apply all migrations: admin, auth, auth_app, contenttypes, sessions Running migrations: Applying contenttypes.0001_initial... O...

GitHub shows "Processing updates" on my Pull Request after every push

Image
Previously, every git push to an open Pull Request was shown immediately. It might or might not have triggered CI, but the commit showed up in the "Commits" tab right away. Now, every time when I push another commit to the Pull Request branch, it doesn't show up immediately, and instead the "Processing updates" loading indicator appears: This is worrying, because the GitHub interface still allows the Pull Request to be merged, even though some commits are not processed yet. I haven't changed any configuration though, neither in the repo, nor in my profile. What happened? Why the change? The "external link" icon refers to the page More details provided when a pull request is merged indirectly or is still processing updates . The page contains a paragraph Pushed commits are still being processed , which might be relevant, but it doesn't have a lot of info: Specifically, it doesn't explain why it now "takes longer than usual for...

String comparison version single character comparison performance

In a c++ exercise website, I found out that the following code int finalValueAfterOperations(vector<string>& operations) { int result = 0; for(int i = 0; i < operations.size(); ++i) { operations[i] == "++X" || operations[i] == "X++"? ++result : --result; } return result; } is faster than int finalValueAfterOperations(vector<string>& operations) { int result = 0; for(int i = 0; i < operations.size(); ++i) { operations[i][1] == '+'? ++result : --result; } return result; } What may be the underlying reasons for this? I would assume that my single character checking would be more efficient than the full string comparison. I guess the comparison implementation has some optimization happening under the hood, but I am not sure what happens. Does someone have any idea?

How to define in Julia ReinforcementLearning.jl an action space that changes with each state?

I want to implement an environment in Julia ReinforcementLearning.jl that has continuous action space that change as a function of the state. The state is a positive integer n <= nmax for a given nmax . The action space is the n-dimensional vector space [0, 1]^n , that is, an action is a vector of size n that has elements in [0,1] . What I implemented is the RLBase.action_space(env::MyEnv) which is essentially using ReinforcementLearning using IntervalSets # for ClosedInterval RLBase.action_space(env::MyEnv) = Space(ClosedInterval{Float32}[0..1 for _ in 1:state(env)]) # state(env) is an integer between 1 and nmax. I think this implementation is not complete because in the documentation of ReinforcementLearning.jl , it is mentioned that legal_action_space and legal_action _space_mask should be implemented when ActionStyle is FULL_ACTION_SET . How should I implemented legal_action_space and legal_action_space_mask and should I use ActionTransformedEnv when defining my ...

multidimensional vectors of maps progressively slower after multiple initializations

If I allocate a multidimensional vectors of maps multiple times it get slower and slower. If I try a multidimensional vector of <pairs> then that is ok with each iteration getting the same performance? Why are maps or multimaps different? void myReserve(vector<vector<vector<vector<vector<map<int, int>>>>>> myInts, int a, int b, int c, int d, int e) { clock_t begin = clock(); myInts.reserve(a); myInts.resize(a); for (int aa = 1; aa < a; aa++) { myInts[aa].reserve(b); myInts[aa].resize(b); for (int bb = 1; bb < b; bb++) { myInts[aa][bb].reserve(c); myInts[aa][bb].resize(c); for (int cc = 1; cc < c; cc++) { myInts[aa][bb][cc].reserve(d); myInts[aa][bb][cc].resize(d); for (int dd = 1; dd < d; dd++) { myInts[aa][bb][cc][dd].reserve(e); ...

Which atom (box) has subtitle data in MP4 (ISOBMFF)

In ISOBMFF (MP4), what atom (box) has subtitle information ? I have a MP4 File which has subtitle. Using FFMPEG, I input the subtitle in video. ffmpeg -i input.mp4 -vf "subtitles=subtitle.srt" -c:v libx264 -c:a aac -strict experimental -b:a 192k output.mp4 here is my original mp4 file dump. (Result of Mp4dump) [ftyp] size=8+16 major_brand = mp42 minor_version = 0 compatible_brand = isom compatible_brand = mp42 [moov] size=8+373326 [mvhd] size=12+96 timescale = 1000 duration = 1187027 duration(ms) = 1187027 [trak] size=8+157859 [tkhd] size=12+80, flags=3 enabled = 1 id = 1 duration = 1187019 width = 1280.000000 height = 720.000000 [mdia] size=8+157759 [mdhd] size=12+20 timescale = 30000 duration = 35610575 duration(ms) = 1187019 language = und [hdlr] size=12+59 handler_type = vide handler_name = ISO Media file produced by Google Inc. [minf] size=8+...

How to push a named value to a vector in R's cpp11?

Within R's a package cpp11 , a named value is pushed to a list as follows: writable::list a; a.push_back("my_name"_nm = 1); How to do the same if "my_name" was stored in the string variable?

Java recursive entity search

I have a simple recursive method which intends to find the timestamp of an entity by the given Id. If there is no such Id, the result will be null so I'm gonna get a NPE, thus the catch block comes in, finds the next available Id and calls this function again with the new Id. This works well so far, when the function is called again with the next available Id, it finds the entity, but when it tries to return the timestamp, myEntity becomes null and its a NPE again. I'm debugging in IntelliJ and stop the code just before this and myEntity does have an actual value here, before the return statement. From this point the code just hangs and nothing visible happens. I guess there is something under the hood regarding to recursion, but couldn't figure it out yet. Thanks in advance! public LocalDateTime getInsertTimeById(Long id) { try { MyEntity myEntity = entityManager.find(MyEntity .class, id); return myEntity.getInsertTime(); } catch...

Dataproc serverless does not seem to make use of spark property to connect to external hive metastore

I have a GCP postgres instance that serves as an external hive metastore for a Dataproc cluster. I would like to be able to utilize this metastore for Dataproc serverless jobs. Experimenting with serverless and by following documentation, I am already able to: leverage the service account, subnetwork URI to access project resources connect to PHS associated with the Dataproc cluster build and push a custom image to container registry to be pulled by spark jobs I thought the spark property "spark.hadoop.hive.metastore.uris" would allow serverless spark jobs to connect to the thrift server used by the Dataproc cluster, but it does not seem to even try to make the connection and instead errors with: Required table missing : "DBS" in Catalog "" Schema "". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables" The non-serve...

How to keep an empty database the database docker container is started again

There is the following code in my docker-compose.yml mariadb: image: mariadb:10.8.2 restart: always environment: MARIADB_ROOT_PASSWORD: test MARIADB_DATABASE: mydb ports: - "3306:3306" container_name: mariadb networks: - my-network then I used the following command to start a Docker container docker stop mariadb docker rm mariadb docker-compose up -d --remove-orphans mariadb sleep 15 # wait until database is fully started docker exec mariadb mysql -u root -ptest -e "CREATE DATABASE product;" After starting the Docker container, i.e. the command docker-compose up -d --remove-orphans mariadb , the next command is to create a database called product . However, problem is that there is the following error ERROR 1007 (HY000) at line 1: Can't create database 'dictionary'; database exists Question: Why does the previously created database still exists even though the container and image are removed at the beginning? How to create...

I get an error on a locally-run Laravel 5 app [closed]

Basically the error was after I copied a project from the hosting cPanel to study locally, when I ran it using localhost, the web URL instead used https when calling everything like JavaScript and CSS, it caused an error where data was not called because it should be http, not http. I have tried various methods such as changing the env but it still doesn't work. What can I try next? I am doing an internship.

When click drawer widget rebuild and value variable change to null

Image
I'm using Riverpod and I don't understand why when I click on the drawer, the widget rebuilds and the variable in my SearchNotifier class becomes null. Here is my Provider class SearchNotifier extends StateNotifier<SearchResult> { SearchResult? item = SearchResult(); String? authToken; SearchNotifier() : super(SearchResult()); SearchResult get getSearchResult { if (this.item != null) return this.item!; else return SearchResult(); } void setToken(String token) { this.authToken = token; } Future<void> doSearch(SearchObject searchObject) async { var logger = Logger(); //logger.d(searchObject.page); final url = Uri.parse(Constants.API_SEARCH); try { final response = await http.post( url, body: json.encode(searchObject.toJson()), headers: Constants.headerWithAuth(this.authToken!), ); final responseData = json.decode(response.body.toString()); //logger.d(response...