instruction
stringlengths
0
30k
1. Sure you did not update accidentaly to 4.27.**3** or later? I got exactly your problem, after I installed the 4.28.0 Version - see below... 2. You need Hyper-V enabled for this. If you are using Windows Home Edition (check with PWS `Get-WindowsEdition -Online`, which should answer at least `Edition : Professional`) - no chance: upgrade your Windows to Professional Edition - see maybe [tag:docker-for-windows]? From my view, at this time the Docker Desktop Version 4.28.0 seems to have a problem with at least Windows 10, because after I deinstalled the 4.28.0 and replaced it with a fresh install of the Docker Desktop Version 4.27.2 (see [Docker Desktop release notes][2]) everything works fine for me with VS 2022 and ASP.NET 8. ... don't Update DD until this is fixed! ;) In [GitHub, docker/for-win: ERROR: request returned Internal Server Error for API route and version...][1] there is a hint upgrading the WSL2 which might help too. [1]: https://github.com/docker/for-win/issues/13909 [2]: https://docs.docker.com/desktop/release-notes/#4272
How can I emulate Microsoft Excel's Solver functionality (GRG Nonlinear) in python?
|python|machine-learning|statistics|non-linear-regression|
null
I am relatively new to the web development and I am writing backend for webapp for practicing chemical elements and compounds and their formulas in our school. I am using Django and Django Rest Framework. I have encountered a dilemma where I can't decide whether to use GET method or POST method. In frontend it requests compounds and elements from the server with specific criteria. In this view, it recieves request with body (criteria), where are values requested_count, used_ids (to exclude already used compounds/elements), requested_groups, requested_elements (to exclude elements which may students don't know). Then, it filters the database to return the response. I have tested this many times and it is working correctly. My only question is, which method to use in this view. I know that POST should be used when I want to change something in the database and GET to just get query from the database. According to this I should use GET. But I want to send body with that request and that is something what POST typically does. What do you suggest? Thanks Here is the view code: class RequestCompoundsView(views.APIView): serializer_class = RequestCompoundsSerializer def get(self, request): serializer = self.serializer_class(data=request.data) if serializer.is_valid(): # Get the request data from serializer requested_count = serializer.validated_data.get("count", 10) used_ids = serializer.validated_data.get("used_ids", []) requested_groups = serializer.validated_data.get("groups", []) requested_elements = serializer.validated_data.get("elements", []) # Find the elements and groups objects groups, elements = find_requested_groups_elements( requested_groups, requested_elements ) # Check if the group and element names are correct if groups.count() == 0: context = {"error": "invalid group name"} return Response(context, status=status.HTTP_400_BAD_REQUEST) if elements.count() == 0: context = {"error": "invalid element name"} return Response(context, status=status.HTTP_400_BAD_REQUEST) # Make a query and filter it out the database query = ~Q(id__in=used_ids) & Q(group__in=groups) & Q(elements__in=elements) samples = ( Compound.objects.filter(query) .order_by("?")[:requested_count] .select_related("group") ) count = Compound.objects.filter(query).count() # Check if the wanted conditions are correct if count == 0: context = {"error": "query returned no results"} return Response(context, status=status.HTTP_204_NO_CONTENT) # Return the results serializer = SendCompoundsSerializer(samples, many=True) context = {"data": serializer.data, "count": count} return Response(context, status=status.HTTP_200_OK) # If there is a problem, return bad request else: print(serializer.errors) context = {"error": "invalid request data"} return Response(context, status=status.HTTP_400_BAD_REQUEST) Here are the serializers: # Serializer for the incomming requests class RequestCompoundsSerializer(serializers.Serializer): used_ids = serializers.ListField(child=serializers.IntegerField()) groups = serializers.ListField(child=serializers.CharField()) elements = serializers.ListField(child=serializers.CharField()) count = serializers.IntegerField(max_value=100, min_value=1) class Meta: fields = ("used_ids", "groups", "elements", "count") # Response of the server for the frontend class SendCompoundsSerializer(serializers.ModelSerializer): class Meta: model = Compound fields = ("id", "formula", "name")
Should i use GET or POST for request with body in DRF?
|django|django-rest-framework|django-views|backend|http-method|
Did you look at the details of the [error][1]? > Causes: > > - The column name list must be specified following the table name of the common table expression. &1 is the common table expression name. > - The sequence column name and the set cycle column name cannot be referenced in the column list of the recursive common table > expression. &1 is the sequence column name or the set cycle column > name. For a CREATE INDEX with a RENAME clause: > - The key column must be included in the rename column list. Try naming the columns like so: WITH #cte (uniquekey, pol_no, new_total_rate,total_cob_growth , duration, "Additions to date TF", "Sum of previous with interest" , rownum) AS ( SELECT UNIQUEKEY, POL_NO, NEW_TOTAL_RATE, TOTAL_COB_GROWTH, DURATION, 0 AS "Additions to date TF", 0 AS "Sum of previous with interest", 1 AS RowNum FROM QRYLIB.temp_Test UNION ALL <..snip...> [1]: https://www.ibm.com/docs/api/v1/content/ssw_ibm_i_75/rzala/rzalaml.htm#messages__SQL0343
{"Voters":[{"Id":6243352,"DisplayName":"ggorlen"},{"Id":9214357,"DisplayName":"Zephyr"},{"Id":7599833,"DisplayName":"Helder Sepulveda"}],"SiteSpecificCloseReasonIds":[13]}
I have an Azkaban executor server process, which is a Java service. I noticed that when running a random sleep script, the CPU usage becomes very high, consistently exceeding 2000%, and the "top" command shows high sys usage. I captured a jstack file hoping to analyze the cause, but I found that many of the stack traces were showing normal calls. For example, there are over 60 instances stuck at "at azkaban.execapp.JobRunner.run(JobRunner.java:652)", [![enter image description here][1]][1] where it hangs at "Thread.currentThread().setName", and 96 instances stuck at "at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1019)". I feel that these are supposed to be quick operations and should not be causing a bottleneck. ---- The same program, when run on a KVM machine (create by myself) with 10 cores and 86GB of memory, uses around 200% CPU and handles around 700 concurrent tasks. However, when run on an Alibaba Cloud instance with 32 cores and 128GB of memory, the CPU usage goes over 2000% and seems to handle only about 400 concurrent tasks. This makes me suspect there might be a performance issue with the cloud instance. How should I go about troubleshooting this problem? this is my jstack file by Alibaba Cloud server https://drive.google.com/file/d/1FXPfndCuhVHFKjQUKZYomvaRoZQ5Q5aP/view?usp=drive_link and alibaba cloud server `ulimit -a` output is as follows: core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 506862 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 65535 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 131072 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited [1]: https://i.stack.imgur.com/kupx8.png
The snippet below is suppose to add and remove event listener `handleBeforeUnload`. On checking the browser console I see the "inside else" getting printed however loading the page still throws the alert. Any ideas why the event listener might not be getting removed? ``` useEffect(() => { const handleBeforeUnload = (e) => { e.preventDefault(); const message = 'Are you sure you want to leave? All provided data will be lost.'; e.returnValue = message; return message; }; if (condition1 && condition2) { console.log('inside if'); window.addEventListener('beforeunload', handleBeforeUnload); } else { console.log('inside else'); window.removeEventListener('beforeunload', handleBeforeUnload); } }, [stateVariable1, stateVariable2, stateVariable3]); ``` Additionally, is there any alternative to detecting a reload other than using `beforeunload` event? Since the `returnValue` property is deprecated the default message is really unhelpful. How can one detect and create custom alert messages? I still see the popup even when the console prints the else statement, which means ideally the event listener ought to have been removed.
I have a sheet that I am collecting data from, I have part of the data that is 7 rows and part is only 1. I would like to append the data from the singular rows 7 times to match the 7 rows. Currently using set values but this only transfers singular row. current outcome desired outcome data collection sheet ``` function copytomaster(){ var sheet = SpreadsheetApp.openById("1Z319ABahpIhAKU8Hfc1J18Ss8_2kxFYYa1ySbjgDMQA"); var check_in_sheet = sheet.getSheetByName("Check In"); var master = sheet.getSheetByName("Data"); var lastrow = master.getLastRow()+1; var check_in_range = check_in_sheet.getRange(11,1,7,14); var check_in_values = check_in_range.getValues(); var biometrics_range = check_in_sheet.getRange(4,7,1,4); var biometrics_values = biometrics_range.getValues(); var sleep_range = check_in_sheet.getRange(3,4,1,1); var sleep_values = sleep_range.getValue(); var steps_range = check_in_sheet.getRange(4,4,1,1); var steps_value = steps_range.getValue(); var training_range = check_in_sheet.getRange(3,6,1,1); var training_value = training_range.getValue(); var cardio_range = check_in_sheet.getRange(4,6,1,1); var cardio_value = cardio_range.getValue(); var nutrition_range = check_in_sheet.getRange(4,11,1,4); var nutrition_values =nutrition_range.getValues(); var achievement_range = check_in_sheet.getRange(7,3); var achievement_value = achievement_range.getValues(); var improvement_range = check_in_sheet.getRange(7,7); var improvement_value = improvement_range.getValues(); var struggle_range = check_in_sheet.getRange(7,11); var struggle_value = struggle_range.getValues(); var bb_range = check_in_sheet.getRange(30,2); var bb_value = bb_range.getValues(); var nt_range = check_in_sheet.getRange(31,2); var nt_value = nt_range.getValues(); var diet_range = check_in_sheet.getRange(32,2); var diet_value = diet_range.getValues(); var ao_range = check_in_sheet.getRange(33,2); var ao_value = ao_range.getValues(); var leaner_range = check_in_sheet.getRange(30,5); var leaner_value = leaner_range.getValues(); var clothes_range = check_in_sheet.getRange(31,5); var clothes_value = clothes_range.getValues(); var ms_range = check_in_sheet.getRange(33,5); var ms_value = ms_range.getValues(); var alcohol_range = check_in_sheet.getRange(32,5); var alcohol_value = alcohol_range.getValues(); var meds_range = check_in_sheet.getRange(30,12); var meds_value = meds_range.getValues(); var travel_range = check_in_sheet.getRange(31,12); var travel_value = travel_range.getValues(); var other_range = check_in_sheet.getRange(32,12); var other_value = other_range.getValues(); var done_range = check_in_sheet.getRange(33,13); var done_value = done_range.getValues(); var name_range = check_in_sheet.getRange(1,1); var name_value = name_range.getValue(); master.getRange(lastrow,1,7,14).setValues(check_in_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,15,1,4).setValues(biometrics_values); master.getRange(lastrow,19,1,1).setValue(sleep_values); master.getRange(lastrow,20,1,1).setValue(steps_value); master.getRange(lastrow,21,1,1).setValue(training_value); master.getRange(lastrow,22,1,1).setValue(cardio_value); master.getRange(lastrow,23,1,4).setValues(nutrition_values); master.getRange(lastrow,27).setValue(achievement_value); master.getRange(lastrow,28).setValue(improvement_value); master.getRange(lastrow,29).setValue(struggle_value); master.getRange(lastrow,30).setValue(bb_value); master.getRange(lastrow,31).setValue(nt_value); master.getRange(lastrow,32).setValue(diet_value); master.getRange(lastrow,33).setValue(ao_value); master.getRange(lastrow,34).setValue(leaner_value); master.getRange(lastrow,35).setValue(clothes_value); master.getRange(lastrow,36).setValue(alcohol_value); master.getRange(lastrow,44).setValue(ms_value); master.getRange(lastrow,37).setValue(meds_value); master.getRange(lastrow,38).setValue(travel_value); master.getRange(lastrow,39).setValue(other_value); master.getRange(lastrow,40).setValue(done_value); master.getRange(lastrow,41).setValue(name_value); } ```
Appending data from data source (single row) into multiple rows within specified sheet
|google-sheets|google-apps-script|
null
I'm trying to integrate a existing DLL project (3rd party dependencies) to Blank UWP. The Blank App project build fine but throws error when it is lauched. In Event Viewer, log suggests Error code: The app didn't start.. Activation phase: COM ActivateExtension. Below is the article about "How to: Use existing C++ code in a Universal Windows Platform app" which states that UWP Apps run in a protected environment. As a result, many Win32, COM, and CRT API calls that might compromise platform security aren't allowed. The /ZW compiler option can detect such calls and generate an error. You can use the App Certification Kit on your application to detect code that calls disallowed APIs. For more information, see Windows App Certification Kit****. https://learn.microsoft.com/en-us/cpp/porting/how-to-use-existing-cpp-code-in-a-universal-windows-platform-app?view=msvc-170 does that mean DLL project can't be integrated?
If you initialize a structure pointer to NULL, and try to change its members, is that what you call undefined behaviour(UB)? I have this code: #include <stdio.h> typedef struct aStructure { int testInt; }aStructure; int main(void) { aStructure * a=NULL; a->testInt = 123; printf("%d", a->testInt); } This happens when I run it: - I get no warnings or error messages. - It takes some seconds for it to stop. - It prints nothing. I am wondering a little what goes on "under the hood" here. When I initialize a structure pointer without having initialized the structure, does C then "set something aside" with the correct members? Because it seems that I can initialize the members without having the structure intialized, only the pointer?
Initialize a structure pointer to NULL, then try to change its members
I have an Enum that I already use for multiple other purposes, however in those cases I use the Enum like a public variable of the class meaning I can access it like `EntityManager.FAll`. However, in the new use case I have for it I want to use the Enum in that class as a function parameter of another class's function like `CEntityManager::EBroadcastTypes`. But no matter what I try, when I try to compile the code this always fails telling me that either when using the scope operator I need to be using a Class or Namespace even though this is a class (error code: C2653), or that `EBroadcastTypes` isnt a known identifier (error code: 2061). Just to further 'visualize' this, as an example. I want to use this Enum for 'filtering channels' when Ray Casting, so that I can either only check for specific Wanted Entities. ``` EntityManager.h class CEntityManager { public: enum EBroadcastTypes { FAll, FVehicle, FProjectile, FDynamic, // Any Entity that can movement on update (ie. Vehicle and Shells) FStatic, // Any Entity that never moves (ie. Scenery) }; struct BroadcastFilter { EBroadcastTypes type; vector<string> channels; }; vector<BroadcastFilter> m_BroadcastFilters; vector<string> GetChannelsOfFilter(EBroadcastTypes Type) { for (const auto& BroadcastFilter : m_BroadcastFilters) { if (BroadcastFilter.type == Type) { return BroadcastFilter.channels; } } } } ``` ``` Main.h // Primary Update(tick) function Update() { if()// On Some condition { TFloat32 range = 400.0f HitResult Hit = RayCast(ray, EntityManager.FAll, range); // Do something with Hit ... } } ``` RayCast file doesn't contain a class, simply functions that fall under the same category that would be used across multiple points/classes throughout the code. ``` CRayCast.h #include "EntityManager.h" struct CRay { CVector3 m_Origin; CVector3 m_Direction; }; HitResult RayCast(CRay ray, , TFloat32 Range); ``` ``` CRayCast.cpp #include "CRayCast.cpp" // Actually using EntityManager here, other than for getting the Enum. extern CEntityManager EntityManager; HitResult RayCast(CRay, CEntityManager::EBroadcastTypes, TFloat32 Range) { // Do the raycasting here // ... } ``` So is there any way to actually use the Enum like this? Tried including the header as well as forward declaring both the class and enum (the compiler then told me it didn't know what those forwards are).
for kali linux or oher debian `sudo apt purge code-oss` remove the existing vscode sudo apt-get install wget gpg wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' rm -f packages.microsoft.gpg then sudo apt install apt-transport-https sudo apt update sudo apt install code # or code-insiders
I'm encountering an issue with the QR code scanner on my iPad 7th Gen running ipadOS 17.4. While the scanner seems to be functioning normally on the latest iPad 10th Gen (also on ipadOS 17.4), it's not working at all for ipad 7th gen (ipadOS 17.4) on my device. It's possible that this problem affects other iPad models but for now I've tested just these two models. Has anyone else experienced similar issues with the QR code scanner? Any suggestions for troubleshooting or a potential fix would be greatly appreciated. List of tried device: * ipad 6Gen: `KO` * ipad 7Gen: `KO` * iPad 10Gen: `OK` * iPhone 15: `OK` ### Minor update I tried to download AVCam project from official documentation of Apple and I confirm that is not working even in their swift project. But the face recognition is working ## MetadataOutput ``` captureObject = [[AVCaptureMetadataOutput alloc]init]; objectQueue = dispatch_queue_create("VideoDataOutputQueue", NULL);//dispatch_queue_create("newQueue", NULL); [captureObject setMetadataObjectsDelegate:self queue:objectQueue]; ``` I tried to use main_queue where creating the dispatch_queue but not delegating: ``` objectQueue = dispatch_queue_create("VideoDataOutputQueue", NULL);//dispatch_queue_create("newQueue", dispatch_get_main_queue()); ``` The problem is that is not delegating nor triggering the method: ``` - (void)captureOutput:(AVCaptureOutput *)output didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects fromConnection:(AVCaptureConnection *)connection { if (metadataObjects != nil && metadataObjects.count > 0) { NSLog(@"%@", [metadataObjects objectAtIndex:0]); } } } ``` # EDIT There is no current solution up to now but i used a workaround using `AVCaptureVideoDataOutputSampleBufferDelegate`. Then use the following output: ``` self.videoDataOutput = [[AVCaptureVideoDataOutput alloc] init]; [self.videoDataOutput setSampleBufferDelegate:self queue:dispatchQueue]; if ([_captureSession canAddOutput:self.videoDataOutput]) { [_captureSession addOutput:self.videoDataOutput]; } ``` Then using delegate method: ``` - (void)captureOutput:(AVCaptureOutput *)output didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection { CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); if (imageBuffer == NULL) { return; } CIImage *ciImage = [CIImage imageWithCVImageBuffer:imageBuffer]; [self detectQRCode:ciImage]; } -(void)detectQRCode:(CIImage *)image { NSDictionary* options; CIContext* context = [CIContext context]; options = @{ CIDetectorAccuracy : CIDetectorAccuracyHigh }; CIDetector* qrDetector = [CIDetector detectorOfType:CIDetectorTypeQRCode context:context options:options]; // if ([[image properties] valueForKey:(NSString*) kCGImagePropertyOrientation] == nil) { // options = @{ CIDetectorImageOrientation : @1}; // } else { // options = @{ CIDetectorImageOrientation : [[image properties] valueForKey:(NSString*) kCGImagePropertyOrientation]}; // } NSArray * features = [qrDetector featuresInImage:image options:options]; if (features == nil || [features count] == 0) { return; } CIQRCodeFeature *metadataObj = [features firstObject]; NSString *qrString = [NSString stringWithString:metadataObj.messageString]; NSLog(@"feature: %@",qrString); } ``` Current solution : In the meantime, as a precaution, we recommend that users do not upgrade to iOS 17.4.
Here are 2 vanilla examples of inserting a "menubar" which provides additional choices in the standard "choose from list" menu... [1] This activates a secondary menu from the top menu item. ``` return my choosefromList(lst) property lst : (" 1 2 3 ") property prev : {} on choosefromList(lst) repeat repeat repeat while lst begins with linefeed or lst begins with return set lst to text 2 thru -1 of lst end repeat repeat while lst ends with linefeed or lst ends with return set lst to text 1 thru -2 of lst end repeat set mnuBar to "___________________________________________/EDIT\\____" set chosn to (choose from list {mnuBar} & (paragraphs of lst) default items prev with multiple selections allowed) if class of chosn is boolean then set msg to "User canceled." say msg without waiting until completion return msg end if if chosn begins with mnuBar then if (count of chosn) > 1 then set chosn to items 2 thru -1 of chosn --keep selection set msg to "Edit menu items:" say msg without waiting until completion set lst to text returned of (display dialog msg default answer return & lst & return) set prev to chosn else set prev to chosn exit repeat end if end repeat repeat with chos in chosn say chos without waiting until completion display dialog contents of chos end repeat end repeat end choosefromList ``` [2] This activates a dropdown menu from the top menu item. ``` return my choosefromList(lst) property lst : (" 1 2 3 ") property prev : {} property mnu2 : {} property dropdown : false on choosefromList(lst) repeat repeat ---------------------MENU 1--------------------- set mnuBar to " Preferences ⚙️" set chosn to (choose from list {mnuBar} & mnu2 & (paragraphs 2 thru -2 of lst) default items prev with multiple selections allowed) if class of chosn is boolean then set msg to "User canceled." say msg without waiting until completion return msg end if if chosn begins with mnuBar then if (count of chosn) > 1 then set prev to items 2 thru -1 of chosn --keep selection ------------------DROPDOWN HANDLER--------------------- set dropdown to item (1 + (dropdown as integer)) of {true, false} --toggled if dropdown then say "preferences on" without waiting until completion set mnu2 to {" A.", " B.", " C."} else say "preferences off" without waiting until completion set mnu2 to {} end if ---------------------------------------------------------------- else set prev to chosn exit repeat end if end repeat ---------------------MAIN MENU HANDLER--------------------- repeat with chos in chosn say chos without waiting until completion display dialog contents of chos end repeat ------------------------------------------------------------------- end repeat end choosefromList ```
I have a basic express app. Providing token based auth. Dealing with zod to create a schemas to validate the incoming data. Saying I have two schemas: - createuserSchema {firstname, lastname, email, pass, passConfirm} - loginUserSchema {email, pass} Zod allows us to infer types based on our schemas like: `type SchemaBasedType = z.infer<typeof schmea>` Those i have two types: **CreateUserRequest** and **LoginUserRequest**, based on my schemas. First of all creating the validation middleware like this: ``` export const validateRequest = <T extends ZodTypeAny>(schema: T): RequestHandler => async (req, res, next) => { try { const userRequestData: Record<string, unknown> = req.body; const validationResult = (await schema.spa(userRequestData)) as z.infer<T>; if (!validationResult.success) { throw new BadRequest(fromZodError(validationResult.error).toString()); } req.payload = validationResult.data; next(); } catch (error: unknown) { next(error); } }; ``` As it mentioned above, this middleware acceps a schema argument, typed according to the zod docs. In my opinion, it's a good desicion to extend the request object with the "**payload**" property, where i can put my valid data. Then the problems begin. TS doesn't know what the payload actually is. That's where the declaration merging is comming. Firstly, it's tempting to try something like this: ``` declare global { namespace Express { export interface Request { payload?: any; } } } ``` But seems it's not a good idea, cause we know exactly what is our payload signature. Then I tried a union type, based on zod types: `payload?: CreateUserRequest | LoginUserRequest;` With this approach I caught a mistake, that some of the fields of more narrow type doesn't exist in other type; Then i tried to use a generic, ``` declare global { namespace Express { export interface Request<T> { payload?: T; } } } ``` and it seems like a solution, but the **Request** interface already has 5 generic arguments: ``` interface Request< P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any> ``` and I can't even imagine how it suppose to merge, meaning my generic argument will be the first, or the last? Anyway it's seems as a wrong way, cause after all I don't see the extended interface via the IDE hints. Somewhere on stack I met this approach: ``` declare global { namespace Express { export interface Request< Payload = any, P = ParamsDictionary, ResBody = any, ReqBody = any, ReqQuery = ParsedQs, LocalsObj extends Record<string, any> = Record<string, any> > { payload?: Payload; } } } ``` And it even give me a hint after mouse guidence, but i'm not sure that any is a good type cause we already have types, infered by zod. If not specify Payload = any, I don't receive a hint in a type. I have no idead and stack with it, cause i'm not an expert in ts and backend architecture; Finally, i'd like to get something like this: `authRouter.post("/register", validateRequest(createUserSchema), AuthController.register);` where the compiler knows, that the payload signature is equal to CreateUserRequest `authRouter.post("/login", validateRequest(loginUserSchema), AuthController.login)`; where the compiler knows, that the payload signature is equal to LoginUserRequest Where should I properly specify my expected types and how to deal with them?
|c|pointers|struct|undefined-behavior|
I am trying to find a proper way to query m2m data using supabase client. I have three tables: #### public.sites | column | format | |:---- |:------:| | id | int8 | | name | text | #### auth.users (supabase auth table) | column | format | |:---- |:------:| | .. | ... | | id | uuid | #### public.members | left | center | |:---- |:------:| | user_id | uuid foreign key to auth.users.id | | site_id | int8 foreign key to public.sites.id | I need to query all the sites given the userid. I made several attempts without any success such as: ```javascript const sites = await supabase.from('sites').select('id, name, members(user_id)').eq('members.user_id', user.id); ``` P.s. i also ran ```SQL alter table members add constraint pk_user_team primary key (user_id, site_id); ``` based on few posts here on stacksoverflow. any advice?
I am currently trying to create a sunburst chart using the sunburst library. Thanks to the help from [this forum][1], I was able to add an update function. Now, I always get the following error message at the transition of an ARC-element when my Datasource will be updated (image below): <path> attribute d: Expected arc flag ('0' or '1')," As shown [here][2] and [here][3], there seems to be a problem with the transition of the ARC-elements. The D3's default transition can't interpolate my ARC-Elements correctly. So, as described in the entries, I added the custom interpolator as a function and linked it to my transition. Unfortunately it does not work, the error still occurs. Can someone please explain to me why it doesn't work and how the error can be corrected? arcTween function: // Custom interpolator function arcTween(a) { var i = d3.interpolate(this._current, a); this._current = i(0); return function(t) { return arc(i(t)); }; } Image of Error [![enter image description here][4]][4] My Code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> // Data const data1 = { "name": "TOPICS", "id": 1, "children": [{ "name": "Topic A", "id": 2, "children": [{ "name": "Sub A1", "id": 5, "size": 10 }, { "name": "Sub A2", "id": 6, "size": 4 }] }, { "name": "Topic B", "id": 3, "children": [{ "name": "Sub B1", "id": 7, "size": 3 }, { "name": "Sub B2", "id": 8, "size": 3 }, { "name": "Sub B3", "id": 9, "size": 3 }] }, { "name": "Topic C", "id": 4, "children": [{ "name": "Sub A3", "id": 10, "size": 4 }, { "name": "Sub A4", "id": 11, "size": 4 }] }] }; const data2 = { "name": "TOPICS", "id": 1, "children": [{ "name": "Topic A", "id": 2, "children": [{ "name": "Sub A1", "id": 5, "size": 4 }, { "name": "Sub A2", "id": 6, "size": 4 }] }, { "name": "Topic B", "id": 3, "children": [{ "name": "Sub B1", "id": 7, "size": 3 }, { "name": "Sub B2", "id": 8, "size": 3 }, { "name": "Sub B3", "id": 9, "size": 3 }] }] }; //------------------------------------------------------------------------------------------- // Declare variables let i_region_static_id = "sunburst", parentDiv = document.getElementById(i_region_static_id), width = parentDiv.clientWidth, height = 450, root, rootDepth, x, y, color = d3.scaleOrdinal(d3.schemeCategory10); maxRadius = (Math.min(width, height) / 2) - 5; const partition = d3.partition(); //----------------------------------------------------------------------------------- // SVG-Element let svg = d3.select('#' + i_region_static_id).append('svg') .style('width', width) .style('height', height) .attr('viewBox', `${-width / 2} ${-height / 2} ${width} ${height}`) .on('dblclick', d => { if (event.detail === 2) focusOn() // Double click }); //----------------------------------------------------------------------------------- // X-Scale x = d3.scaleLinear() .range([0, 2 * Math.PI]) .clamp(true); //----------------------------------------------------------------------------------- // Y-Scale y = d3.scaleSqrt() .range([maxRadius * .1, maxRadius]); //------------------------------------------------------------------------------------------- // Text-fit constant const textFits = d => { const CHAR_SPACE = 6; const deltaAngle = x(d.x1) - x(d.x0); const r = Math.max(0, (y(d.y0) + y(d.y1)) / 2); const perimeter = r * deltaAngle; return d.data.name.length * CHAR_SPACE < perimeter; }; //----------------------------------------------------------------------------------- // Create Arc generator const arc = d3.arc() .startAngle(d => x(d.x0)) .endAngle(d => x(d.x1)) .innerRadius(d => Math.max(0, y(d.y0))) .outerRadius(d => Math.max(0, y(d.y1))) //----------------------------------------------------------------------------------- const middleArcLine = d => { const halfPi = Math.PI / 2; const angles = [x(d.x0) - halfPi, x(d.x1) - halfPi]; const r = Math.max(0, (y(d.y0) + y(d.y1)) / 2); const middleAngle = (angles[1] + angles[0]) / 2; const invertDirection = middleAngle > 0 && middleAngle < Math.PI; // On lower quadrants write text ccw if (invertDirection) { angles.reverse(); } const path = d3.path(); path.arc(0, 0, r, angles[0], angles[1], invertDirection); return path.toString(); } //------------------------------------------------------------------------------------------- // Check if node in depth function maxDepth(d) { if (rootDepth == undefined) { // If user clicks next to sun = root undefined rootDepth = 0; } return ((d.depth - rootDepth) < 2); } //------------------------------------------------------------------------------------------- function focusOn(d = {x0: 0, x1: 1, y0: 0, y1: 1}) { root = d; // Root-node rootDepth = root.depth; // Root node depth for maxDepth(d) const transition = svg.transition() .duration(750) .tween('scale', () => { const xd = d3.interpolate(x.domain(), [d.x0, d.x1]), yd = d3.interpolate(y.domain(), [d.y0, 1]); return t => { x.domain(xd(t)); y.domain(yd(t)); }; }); transition.selectAll('.slice') .attr('display', d => maxDepth(d) ? null : 'none'); // Display nodes only in depth for transition transition.selectAll('path.main-arc') .filter(d => maxDepth(d)) .attrTween('d', d => () => arc(d)); transition.selectAll('path.hidden-arc') .filter(d => maxDepth(d)) .attrTween('d', d => () => middleArcLine(d)); transition.selectAll('text') .filter(d => maxDepth(d)) .attrTween('display', d => () => textFits(d) ? null : 'none'); // Display text only in depth moveStackToFront(d); // Foreground nodes -> inner nodes higher than outer nodes function moveStackToFront(elD) { svg.selectAll('.slice').filter(d => d === elD) .each(function(d) { this.parentNode.appendChild(this); if (d.parent) { moveStackToFront(d.parent); } }) }; } //------------------------------------------------------------------------------------------- // Initialize and Update sun function updateSun(pData) { const valueAccessor = (d) => d.size; root = d3.hierarchy(pData); //set data // Durch den ValueAccessor wird dem Parent Element die Summe der Values, von den Childs, zugeordnet // Wird genutzt, um die ARC Abmaße zu bestimmen valueAccessor == null ? root.count() : root.sum((d) => Math.max(0, valueAccessor(d))); // Sortiert Nodes root.sort((d) => d3.descending(d.value)) const slice = svg.selectAll('g.slice') .data( partition(root).descendants(), function(d) { return d.data.id; } ); // Enter Section const newSlice = slice.enter() .append('g').attr('class', 'slice') .attr('display', d => d.depth < 2 ? null : 'none') // Hide levels lower depth .on('dblclick', (e, d) => { e.stopPropagation(); focusOn(d); } ) .each(function(d, i) { // Append main-arc d3.select(this).append('path') .attr('class', 'main-arc') .attr('d', arc) setCurrent // New Line Added // Append hidden-arc d3.select(this).append('path') .attr('class', 'hidden-arc') .attr('d', middleArcLine) setCurrent // New Line Added // Append text d3.select(this).append('text') // Append textPath for Textstring .append('textPath') .attr('startOffset', '50%') .attr('fill', d => 'black'); }) .merge(slice) .each(function(d, i) { // Update Section // Go back to Level 0 if (rootDepth > 0){ // console.log(rootDepth) focusOn(); // New Line Added } // console.log(rootDepth) d3.select(this).select('path.main-arc') .style('fill', d => (d.data.color == undefined) ? color((d.children ? d : d.parent).data.name) : d.data.color) //set source color, otherwise default color .transition().delay(500).attrTween("d", arcTween).on("end", setCurrent) // New Line Added d3.select(this).select('path.hidden-arc') .attr('id', 'hiddenArc' + i) .transition().delay(500).attrTween("d", arcTweenLabel).on("end", setCurrent) // New Line Added d3.select(this).select('text') .attr('display', d => textFits(d) ? null : 'none') d3.select(this).select('textPath') .attr('xlink:href', '#hiddenArc' + i) // Supply the id of the path along which you want to place the text. .text(d => d.data.name); // Set text in sector }) // Delete Section slice.exit().transition().duration(500).style("fill-opacity", 0.2).remove(); //------------------------------------------------------------------------------------------- // New Section Added // SetCurrent used to store current data function setCurrent(d) { this._current = deepCopyWithoutParents(d); } // Remove Parent of Childnodes function deepCopyWithoutParents(node) { var newValue = Object.assign({}, node); delete newValue.parent; if (newValue.children) { newValue.children = newValue.children.map(deepCopyWithoutParents); } return newValue; } // Custom interpolator Main-Slices function arcTween(a) { // console.log(a) // console.log(this._current) // console.log(deepCopyWithoutParents(a)) if (!this._current) { this._current = deepCopyWithoutParents(a); } var i = d3.interpolate(this._current, deepCopyWithoutParents(a)); return function(t) { return arc(i(t)); }; } // Custom interpolator Hidden Slices, for Labels function arcTweenLabel(a) { //console.log(a) //console.log(this._current) //console.log(deepCopyWithoutParents(a)) if (!this._current) { this._current = deepCopyWithoutParents(a); } var i = d3.interpolate(this._current, deepCopyWithoutParents(a)); return function(t) { return middleArcLine(i(t)); }; } } //------------------------------------------------------------------------------------------- updateSun(data1) let i = 0; d3.interval(() => { if (i++ % 2 === 0) { console.log("data2") updateSun(data2); } else { console.log("data1") updateSun(data1); } }, 6000) <!-- language: lang-css --> .slice { cursor: pointer; } .slice .main-arc { stroke: #fff; stroke-width: 1px; } .slice .hidden-arc { fill: none; } .slice text { pointer-events: none; text-anchor: middle; } <!-- language: lang-html --> <!DOCTYPE html> <html> <!-- Code Vorschlage mit STRG+Leertaste aktivieren--> <head> <meta charset="utf-8" /> <!-- Welche Sonderzeichen verwendet werden können --> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!-- Wie sollte sich die Seite auf einem Handy verhalten --> <title> Sunbrust </title> <!-- title als Tag --> <!-- Load plotly.js into the DOM --> <script src='https://cdn.plot.ly/plotly-2.11.1.min.js'></script> <style> </style> </head> <body> <div id="sunburst"></div> <script src="https://d3js.org/d3.v7.js" charset="utf-8"></script> <!-- <script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script> --> <script src="https://unpkg.com/d3fc" charset="utf-8"></script> </body> <!-- HTML schließender Tag--> </html> <!-- HTML schließender Tag--> <!-- end snippet --> **EDIT:** I am very grateful @Luke Woodward detailed explanation and help. I have updated the code based on @Luke Woodward comment and made some progress (see Comments with "New Line Added" or "New Section Added"). <s>The text transition is still missing at the moment.</s> [1]: https://stackoverflow.com/questions/78194271/d3-enter-exit-update-function-doesnt-work-correctly [2]: https://stackoverflow.com/questions/59356095/error-when-transitioning-an-arc-path-attribute-d-expected-arc-flag-0-or [3]: https://stackoverflow.com/questions/31909132/d3-js-invalid-value-for-path-attribute-yet-chart-still-updates [4]: https://i.stack.imgur.com/AD6MG.png
In React Router v6, the way to specify components for routes has changed. Instead of using the `component` prop, you now use the `element` prop and pass the component as JSX. Here's how you can adjust your App.js to conform to React Router v6 conventions: import React from "react"; import {Routes, Route } from "react-router-dom"; import Gyms from "./Gyms/Gyms"; import Gym from "./Gym/Gym"; const App = () => { return ( <Routes> <Route path="/" element={<Gyms/>}/> <Route path="/gyms/:slug" element={<Gym/>}/> </Routes> ); } export default App;
|windows|powershell|messagebox|
With registry settings (requires admin), you could subscribe to notifications via `HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SilentProcessExit` Note that 32-bit programs shall subscribe under `WOW6432Node` key: `HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows NT\CurrentVersion\SilentProcessExit` https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/registry-entries-for-silent-process-exit
I got a compiled dll file (no source code) and built a nuget package out of it, so it can be distributed within our company. If I copy the nuget package to my local nuget package store, it shows as normal release. If i deploy it to JFrog Artifactory, the same nuget package is considered as prerelease and is only shown in Visual Stuido nuget package manager if i tick the '`Inlucde Prerelease`' checkbox. What is the trigger/condition for JFrog to mark the nuget package as Pre-release? I used the semantic versioning (`MAJOR.MINOR.PATCH`) for the nuget package, but the built dll is using the Assembly Versioning (`Major.Minor.Build.Revision`). nuspec file: ``` <?xml version="1.0"?> <package> <metadata> <id>MyPackage</id> <version>1.0.1</version> <authors>Author</authors> <owners>Department</owners> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>description</description> <summary>description</summary> <copyright>Company</copyright> <language>en-US</language> </metadata> <files> <!-- Include DLL files for .NET Framework 4.8 --> <file src="MyDll.dll" target="lib\net48" /> <!-- Include PDB files for .NET Framework 4.8 --> <file src="MyDll.pdb" target="lib\net48" /> </files> </package> ``` Edit: I found out that JFrog is sort of corrumping my nuget package. When I download it with VS, it doesn't work. When I copy the exact same source nuget package to my local nuget package source, it works.
How to properly extend the generic interface with a new generic parametr using decration merging in Typescript?
|typescript|express|merge|request|type-declaration|
null
The asyncio API and best practices have changed a bit. If you schedule your coroutines/futures with `asyncio.create_task()` you'll get task objects back from `asyncio.wait()`. These task objects can get you a workable frame and you can recover the arguments from there. ``` # schedule multiple instances of `my_awaitable` to run asynchronously on the event loop. tasks = [asyncio.create_task(my_awaitable(fn_arg)) for fn_arg in args] # wait for them to finish. done, pending = await asyncio.wait(tasks) for task in done: # our task crashed with an exception. :( if exc := task.exception(): logger.exception("Always log your errors!", exc_info=exc) if stack := task.get_stack(): # get fn_arg from the first frame in the stack and do something with it. fn_arg = stack[0].f_locals.get("fn_arg") # do something with the result of the finished task else: retval = task.result() ```
Imagine having a `Document` dynamically containing objects like `Header` or `Paragraph` via a trait implementation of `Element` On Execution, I want handlebars to render the document with its children. Therefore, it should select the template according to the type of the `Element` ```rust use std::{cell::RefCell, error::Error, rc::Rc}; use handlebars::Handlebars; use serde::Serialize; pub trait Element: std::fmt::Debug + erased_serde::Serialize { } erased_serde::serialize_trait_object!(Element); #[derive(Debug, Serialize)] pub struct Document { pub content: Vec<Rc<RefCell<dyn Element>>> } impl Element for Document { } #[derive(Debug, Serialize)] pub struct Header { content: String } impl Element for Header { } #[derive(Debug, Serialize)] pub struct Paragraph { content: String } impl Element for Paragraph { } fn main() -> Result<(), Box<dyn Error>> { let mut handlebars = Handlebars::new(); handlebars.register_template_string("Header", "<h1>{{content}}</h1>".to_string())?; handlebars.register_template_string("Paragraph", "<p>{{content}}</p>".to_string())?; handlebars.register_template_string("Document", "{{#each content}}{{this}}\n{{/each}}".to_string())?; let document = Document { content: vec![ Rc::new(RefCell::new(Header { content: "Title".to_string()})), Rc::new(RefCell::new(Paragraph { content: "Text".to_string()})), ] }; println!("{:?}", document); println!("{}", handlebars.render("Document", &document)?); Ok(()) } ``` The debug works as expected ``` Document { content: [RefCell { value: Header { content: "Title" } }, RefCell { value: Paragraph { content: "Text" } }] } ``` But handlebars just renders `[object]` instead of using the template on that object ```Paragraph { content: "Text" } }] } [object] [object] ``` What I want to achieve as output: ``` <h1>Title</h1> <p>Text<p> ``` How to achieve this? How to tell handlebars to automatically select the according template based on the object type/name?
Rust Handlebars dynamically select child Template
Another option is to use the `delete` operator, then filter the array: ```js const myArray = [1, 2, 3, 4]; // Delete the first item delete myArray[0]; // Delete the last item delete myArray[myArray.length - 1]; console.log(myArray) // Output: [null, 2, 3, null] const finalResult = myArray.filter(x => x); console.log(finalResult) // Output [2, 3] ``` Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete
In MATLAB, [`relu`][1] is a _method_ of [`dlarray`][2]. So you need to pass in a `dlarray` instance as input, like this: ```matlab out = relu(dlarray(1)) % or whatever value you wish ``` [1]: https://www.mathworks.com/help/deeplearning/ref/dlarray.relu.html [2]: https://www.mathworks.com/help/deeplearning/ref/dlarray.html
What's the simplest yet most elegant way to NOT short-circuit and instead collect errors until their values are used? What's so hard in accumulating errors? Short circuit only if a function call receives an error value as value. But then return all errors accumulated since. Insights: - Monad short-circuits on any error because `>>=` relies on there being an argument to apply the function to. - Applicative `<*>` can gather up errors from both of its arguments. **The code does not compile due to missing Monad instance as I don’t know how it needs to be designed. The code is intended to show the desired behaviour that a Monad instance or any other implementation should provide.** **This is a request for a specific code solution (be it Monad instance or an entirely different approach) and *NOT* for a package recommendation.** Still the approaches used in following language extensions and packages might give some inspiration (parts emerged in #haskell IRC): - [monad-validate][1] - [validation][2] - [these][3] - ApplicativeDo - Writer Monad The following code is inspired by: https://stackoverflow.com/questions/63346279 https://blog.ploeh.dk/2018/11/05/applicative-validation/ ``` {-# LANGUAGE DeriveFunctor, RecordWildCards, OverloadedStrings #-} import Data.Text (Text) newtype Errors e r = Errors (Either e r) deriving (Show, Eq, Functor) instance Semigroup m => Applicative (Errors m) where pure = Errors . pure Errors (Left x) <*> Errors (Left y) = Errors (Left (x <> y)) Errors f <*> Errors r = Errors (f <*> r) data Result = Result {r1 :: !Int, rg :: !Int} deriving (Show) f1 :: Errors [Text] Int f1 = Errors $ Left ["f1 failed"] f2 :: Errors [Text] Int f2 = pure 2 f3 :: Errors [Text] Int f3 = Errors $ Left ["f3 failed"] f4 :: Errors [Text] Int f4 = pure 4 f5 :: Errors [Text] Int f5 = pure 5 g :: Int -> Int -> Errors [Text] Int g a b | a + b > 6 = Errors $ Left ["g: a + b NOT > 6"] -- we'll let `g` fail if sum is less than 6 | otherwise = pure $ a * b -- | in `scenario1` `g` uses one erroneous and one non-erroneous result. -- since `g` tries to consume one erroneous result `r3` `g` can't execute. -- it short-circuits the computation. -- all up till then collected errors are returned. -- -- >>> scenario1 -- Errors (Left ["f1 failed", "f3 failed"]) scenario1 :: Errors [Text] Result scenario1 = do r1 <- f1 :: Errors [Text] Int -- fails, collected r2 <- f2 :: Errors [Text] Int -- succeeds r3 <- f3 :: Errors [Text] Int -- fails, collected -- we haven’t short-circuited until here, instead collected errors -- although `f1` failed, `f2` and `f3` still have been executed -- but now we need to short circuit on `f4` because at least any of `r2` or `r3` has error value rg <- g r2 r3 :: Errors [Text] Int pure $ Result {..} -- | `g` can execute (all values are non-errors) but `g` itself produces an error. -- computation short-circuits only on construction of `Result`. -- that is because `Result` only carries non-error values but `g` produced error value. -- `scenario2` returns error values of `f1` and `g`. -- -- >>> scenario2 -- Errors (Left ["f1 failed", "g: a + b NOT > 6"]) scenario2:: Errors [Text] Result scenario2 = do r1 <- f1 :: Errors [Text] Int -- fails, collected r2 <- f2 :: Errors [Text] Int -- succeeds r4 <- f4 :: Errors [Text] Int -- succeeds -- we haven’t short-circuited until here, instead collected errors -- although `f1` failed, `f2` and `f4` still have been executed -- `g` receives non-error values `r2` and `r4` with values 2 and 4 -- now, g itself returns an error due to its logic rg <- g r2 r4 :: Errors [Text] Int -- we still don’t short-circuit `g`'s error being produced -- we only short-circuit on the error value tried being used by `Result`: pure $ Result {..} -- | `g` does neither is fed with erroneous values nor -- does `g` itself return an error. Instead construction of `Result` fails -- since it tries to load value of `r1` which is erroneous but should be `Int`. -- -- >>> scenario3 -- Errors (Left ["f1 failed"]) scenario3 :: Errors [Text] Result scenario3 = do r1 <- f1 :: Errors [Text] Int -- fails, collected r2 <- f2 :: Errors [Text] Int -- succeeds r5 <- f5 :: Errors [Text] Int -- succeeds -- we haven’t short-circuited until here, instead collected errors -- although `f1` failed, `f2` and `f4` still have been executed -- `g` receives non-error values `r2` and `r5` with values 2 and 5 -- now, `g` itself succeeds, no error rg <- g r2 r5 :: Errors [Text] Int -- `Result` is constructed, since `f1` failed, `r1` is of error value now -- hence `Result` cannot be constructed, failure "f1 failed" should be returned pure $ Result {..} -- | no error anywhere, -- -- >>> scenario4 -- Errors (Right 7) scenario4 :: Errors [Text] Result scenario4 = do r1 <- f4 :: Errors [Text] Int -- succeeds r2 <- f2 :: Errors [Text] Int -- succeeds r5 <- f5 :: Errors [Text] Int -- succeeds -- now, `g` itself succeeds, no error rg <- g r2 r5 :: Errors [Text] Int -- `Result` is constructed successfully because it only takes in non-error values pure $ Result {..} ``` [1]: https://hackage.haskell.org/package/monad-validate [2]: https://hackage.haskell.org/package/validation [3]: https://hackage.haskell.org/package/these
In my project, we work with constantly update of components. In a specific screen, we have a TabView with a dynamic list of items, these items may be updated. The problem is: If these items is inside a TabView with .tabViewStyle(.page), the item updated isn’t updated. I made a example code that can reproduce this behavior: ```swift struct TextUIModel: Identifiable, Equatable { let id = UUID() let title: String let state: String } public class TextUIViewModel: ObservableObject { @Published var models: [TextUIModel] = [ .init(title: "Title", state: "1"), .init(title: "Title", state: "2") ] func updateModel() { models[0] = .init(title: "Title", state: "2") } } public struct TextUIModelsContentView: View { @StateObject var viewModel: TextUIViewModel = .init() public init() {} public var body: some View { if viewModel.models.isEmpty { Text("Empty") } else { TabViewForTExtUIModels(models: viewModel.models) } Button("Update states") { viewModel.updateModel() } } } struct TabViewForTExtUIModels: View { let models: [TextUIModel] var body: some View { VStack { if !models.isEmpty { TabView { ForEach(models) { model in VStack { Text(model.title) Text(model.state) } } } .tabViewStyle(.page) } else { EmptyView() } } } } ``` When the button is pressed, nothing happens, but if I change the TabView for a ScrollView works: ``` struct TabViewForTExtUIModels: View { let models: [TextUIModel] var body: some View { VStack { if !models.isEmpty { ScrollView { LazyHStack { ForEach(models) { model in VStack { Text(model.title) Text(model.state) } } } } } else { EmptyView() } } } } ``` I tried manage the update using State and Binding, but nothing works To have the behavior of a TabView with .tabViewStyle(.page) is a part of the demand I tried a lot of things but nothing works, only taking off the TabView that is not an option. Can anyone help me ?
|rust|handlebars.js|
I've been using selenium to take screenshots of Reddit posts and comments, and I've run into an issue that I can't find a fix for online. My code gives selenium the ID of the object I want to take a screenshot of, and with the main reddit post itself, this works great. When it comes to the comment though, it always times out (when using `EC.presence_of_element_located()`) or says that it can't find it (when using `Driver.findElement()`). Here's the code: def getScreenshotOfPost(header, ID, url): driver = webdriver.Chrome() #Using chrome to define a web driver driver.get(url) #Plugs the reddit url into the web driver driver.set_window_size(width=400, height=1600) wait = WebDriverWait(driver, 30) driver.execute_script("window.focus();") method = By.ID #ID is what I've found to be the most reliable method of look-up handle = f"{header}{ID}" #The header will be of the form "t3_" for posts and "t1_" for comments, and the ID is the ID of the post of comment. element = wait.until(EC.presence_of_element_located((method, handle))) driver.execute_script("window.focus();") fp = open(f'Post_{header}{ID}.png', "wb") fp.write(element.screenshot_as_png) fp.close() I've tried searching by ID, CLASS, CSS_SELECTOR, and XPATH, and none of them work. I've double checked and the form `t1_{the id of the comment}` is the correct ID for the comment, regardless of the reddit post. Increasing the wait-time on my web driver doesn't work. I'm not sure what the issue would be. Thanks in advance for any help!
My script can extract all IMEI numbers and device colors along with a lot of other informations. It is here: https://github.com/micro5k/microg-unofficial-installer/blob/main/utils/device-info.sh Note: The device color info will likely be present on just Huawei / Xiaomi devices.
{"OriginalQuestionIds":[41265266],"Voters":[{"Id":1746118,"DisplayName":"Naman","BindingReason":{"GoldTagBadge":"java"}}]}
Download the video using `filetransfer` and then that video I try to open in <video> tag is not loading: ``` this.fileTransferDownload.download(this.videoUrl + this.videoObj.video_file_path, path + "Downloads/" + `${filename}`).then((entry: any) => { console.log('download complete: ' + entry.nativeURL); console.log('download complete: ', entry); let localurl: any = this.ionicView.convertFileSrc(entry.nativeURL); this.downloadURL = localurl; <video id="singleVideo" style="width: 100%;" ``` ``` loop webkit-playsinline="webkit-playsinline" poster="{{mediaUrl+videoObj.video_thumb}}" playsinline="true" controls preload="none" > <source *ngIf="downloadURL" src="{{downloadURL}}" type="video/mp4"> <source *ngIf="!downloadURL" src="{{videoUrl+videoObj.video_file_path}}" type="video/mp4"> </video> ``` **Problem:**<br> `downloadURl` loads in Android **but not in iOS**. In iOS the result is that it's showing a blank screen of white. I tried to convert a `file://` URL into a URL that is compatible with the local web server in the Web View plugin. <br> This works in Android but not works in iOS. I need any solution for iOS to playback a video using downloaded file bytes instead of a URL path.
This is my code. It uses logic in the sense that it checks if the current number can be divisible by any number that came before it, excluding any even numbers. sub is_prime { my ($num) = @_; return 0 if $num <= 2; return 0 if $num % 2 == 0 ; for (my $i = 3; $i < $num; $i += 2) { if($num % $i == 0){ return 0; } } return 1; }
I'm new to this field. I upload my model and try to add the textures I need to it. `const textureloader = new THREE.TextureLoader(); const material = new THREE.MeshStandardMaterial({ map: textureloader.load('./assets/textures/albedo/albedo-wood.png'), }); var mat; loader.load(modelPath, (glb) => { const mesh = glb.scene; glb.scene.traverse( function( object ) { if ((object instanceof THREE.Mesh)) { if (object.material) { mat = object.material; object.map = material.map; object.map.needsUpdate = true; } } }); this.scene.add(glb.scene); ` but for some reason, the texture is displayed incorrectly. The only thing I think is that the problem may be with uv scanning, but I'm new to this topic, so I'm not even sure what it is. I also noticed that the texture is displayed correctly inside my object. [![enter image description here](https://i.stack.imgur.com/914ia.png)](https://i.stack.imgur.com/914ia.png) [![enter image description here](https://i.stack.imgur.com/uf3cs.jpg)](https://i.stack.imgur.com/uf3cs.jpg) The model itself is correct and so are the textures. I checked on different sites, individually The model itself is a rounded cube
Problem with texture mapping on my glb model three.js
|vue.js|three.js|3d|
null
If you look at the page, the borders overlap and thicken due to the detail section. Why doesn't the following work? I tried removing all the borders of the details class with CSS, but it didn't work. The bottom border is always there and overlaps. [enter image description here][1] `td colspan="100%" class="details"style="padding: 0 !important; border-bottom: none !important;" ` it does not work. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> .list-group { max-height: 320px; /* veya istediğiniz başka bir değer */ overflow-y: auto; } <!-- language: lang-html --> <!-- Font Awesome --> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet"> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"> <!-- Bootstrap Bundle JS --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script> <div class="container-fluid"> <div class="row"> <div class="col-md-12 ps-0 pe-0"> <div class="table-responsive"> <table class="table table-bordered table-hover"> <thead> <tr> <th scope="col">Kitap</th> <th scope="col">Poz No</th> <th scope="col">Eski Poz No</th> <th scope="col">Tanım</th> <th scope="col">Tür</th> <th scope="col">Birim</th> <th scope="col">Güncel Fiyat</th> <th scope="col">Detay</th> </tr> </thead> <tbody id="table-content"> <tr> <td>Karayolları 2012 ve Sonrası</td> <td>01.001</td> <td>10.100.1001</td> <td>Pist Beton Kaplama Ustası (Hava Meydanları İnş.İçin) </td> <td>Rayiç</td> <td>Kg</td> <td>1415.00 TL</td> <td><b type="button" class="collapse-button" data-bs-toggle="collapse" data-bs-target="#details_251" aria-expanded="false" aria-controls="details_251" onclick="toggleCaret('details_251')"> Detay <i class="ph-bold ph-caret-down caret-icon"></i> </b></td> </tr> <tr class="tr-detail" data-id="251"> <td colspan="100%" class="details" style="padding: 0 !important; border-bottom: none !important;"> <div id="details_251" class="collapse table-details"> <div class="container-fluid"> <li class="list-group-item"> <div class="d-flex align-items-center"> <a href="#" download style="background-color: #efe81d; padding: 6px 15px; color: #0b0b0b; text-decoration: none; border-radius: 4px; margin-left: 20px; transition: background-color 0.3s;" onmouseover="this.style.backgroundColor='#eff81d';" onmouseout="this.style.backgroundColor='#efe81d';"> <i class="fa-solid fa-circle-info pe-2"></i><strong>Detay Sayfasına Git</strong> </a> <a href="#" download style="background-color: #1D6F42; padding: 5px 15px; color: #fff; text-decoration: none; border-radius: 4px; margin-left: 20px; transition: background-color 0.3s;" onmouseover="this.style.backgroundColor='#1DaF42';" onmouseout="this.style.backgroundColor='#1D6F42';"> <i class="fa-regular fa-file-excel pe-1"></i>Analizi İndir </a> </div> </li> <div class="col-md-12"> <div class="row"> <div class="col-md-9 mt-4 d-flex flex-column"> <h4 class="mb-3"><i class="fas fa-cube"></i> Birim Fiyat Tarifi </h4> <div class="d-flex flex-column border rounded bg-white" style="overflow-y: auto; flex-grow: 1; padding: 0;"> <p style="flex-grow: 1; padding: 15px; margin: 0;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui ratione, magni iusto voluptates esse dolorem, deleniti accusamus, ipsa corrupti saepe hic vitae porro voluptatum earum soluta maiores molestiae rem officia? Quos veritatis eum amet ipsa saepe recusandae vel ad excepturi obcaecati optio culpa quae assumenda perspiciatis possimus iste numquam ducimus enim nostrum sit, perferendis, harum distinctio. Ratione magnam provident fuga? At harum, voluptate dignissimos ex unde fugiat sit voluptatem ipsa ipsum reiciendis numquam! Natus obcaecati praesentium, in quaerat dolorum ullam magni omnis veritatis, numquam amet, sint voluptatum modi odit culpa? Voluptatem ducimus nisi consequatur consequuntur non quidem quod repudiandae labore saepe amet nulla minima, consectetur ex rerum nam necessitatibus officiis? Voluptatibus recusandae reprehenderit voluptas voluptate architecto illum? Eos, consequuntur molestiae.</p> </div> </div> <div class="col-md-3 mt-4 d-flex flex-column"> <h4 class="mb-3"><i class="fas fa-cube"></i> Birim Fiyatlar</h4> <ul class="list-group flex-grow-1"> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <!-- Include other years here --> </ul> </div> </div> </div> </div> </div> </td> </tr> <tr> <td>Karayolları 2012 ve Sonrası</td> <td>01.001</td> <td>10.100.1001</td> <td>Pist Beton Kaplama Ustası (Hava Meydanları İnş.İçin) </td> <td>Rayiç</td> <td>Kg</td> <td>1415.00 TL</td> <td><b type="button" class="collapse-button" data-bs-toggle="collapse" data-bs-target="#details_252" aria-expanded="false" aria-controls="details_252" onclick="toggleCaret('details_252')"> Detay <i class="ph-bold ph-caret-down caret-icon"></i> </b></td> </tr> <tr class="tr-detail" data-id="252"> <td colspan="100%" class="details" style="padding: 0 !important; border-bottom: none !important;"> <div id="details_252" class="collapse table-details"> <div class="container-fluid"> <li class="list-group-item"> <div class="d-flex align-items-center"> <a href="#" download style="background-color: #efe81d; padding: 6px 15px; color: #0b0b0b; text-decoration: none; border-radius: 4px; margin-left: 20px; transition: background-color 0.3s;" onmouseover="this.style.backgroundColor='#eff81d';" onmouseout="this.style.backgroundColor='#efe81d';"> <i class="fa-solid fa-circle-info pe-2"></i><strong>Detay Sayfasına Git</strong> </a> <a href="#" download style="background-color: #1D6F42; padding: 5px 15px; color: #fff; text-decoration: none; border-radius: 4px; margin-left: 20px; transition: background-color 0.3s;" onmouseover="this.style.backgroundColor='#1DaF42';" onmouseout="this.style.backgroundColor='#1D6F42';"> <i class="fa-regular fa-file-excel pe-1"></i>Analizi İndir </a> </div> </li> <div class="col-md-12"> <div class="row"> <div class="col-md-9 mt-4 d-flex flex-column"> <h4 class="mb-3"><i class="fas fa-cube"></i> Birim Fiyat Tarifi </h4> <div class="d-flex flex-column border rounded bg-white" style="overflow-y: auto; flex-grow: 1; padding: 0;"> <p style="flex-grow: 1; padding: 15px; margin: 0;">Lorem ipsum dolor sit amet consectetur adipisicing elit. Qui ratione, magni iusto voluptates esse dolorem, deleniti accusamus, ipsa corrupti saepe hic vitae porro voluptatum earum soluta maiores molestiae rem officia? Quos veritatis eum amet ipsa saepe recusandae vel ad excepturi obcaecati optio culpa quae assumenda perspiciatis possimus iste numquam ducimus enim nostrum sit, perferendis, harum distinctio. Ratione magnam provident fuga? At harum, voluptate dignissimos ex unde fugiat sit voluptatem ipsa ipsum reiciendis numquam! Natus obcaecati praesentium, in quaerat dolorum ullam magni omnis veritatis, numquam amet, sint voluptatum modi odit culpa? Voluptatem ducimus nisi consequatur consequuntur non quidem quod repudiandae labore saepe amet nulla minima, consectetur ex rerum nam necessitatibus officiis? Voluptatibus recusandae reprehenderit voluptas voluptate architecto illum? Eos, consequuntur molestiae.</p> </div> </div> <div class="col-md-3 mt-4 d-flex flex-column"> <h4 class="mb-3"><i class="fas fa-cube"></i> Birim Fiyatlar</h4> <ul class="list-group flex-grow-1"> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <li class="list-group-item d-flex justify-content-between align-items-center"> 2014 <span class="badge-custom" style="font-size: 0.9em;">4.152,21</span> </li> <!-- Include other years here --> </ul> </div> </div> </div> </div> </div> </td> </tr> </tbody> </table> </div> </div> </div> </div> <!-- end snippet --> <td colspan="100%" class="details"style="padding: 0 !important; border-bottom: none !important;"> it does not work. [1]: https://i.stack.imgur.com/SHxW7.png
To showcase users who have used your GitHub repository template, you might not be able to automatically update the "`Used by`" section, as this typically refers to GitHub Actions or packages being used by other repositories. However, you can manually track and display this information in your README file by following these steps: - Keep track of repositories that have been created from your template. GitHub does not automatically provide a list of repositories created from your template, so you will need to manually monitor this or ask users to inform you when they use your template. - Once you have a list of users or repositories that have used your template, you can manually update your README file to include a section showcasing these users or their projects. - Embedding in `README`: - **Markdown Table**: Create a Markdown table in your README to list the users and links to their generated repositories. - **Badges**: Use badges (for example, from shields.io) to visually represent the number of users or specific users. - **Links**: Simply list the repositories with links to them. Example Markdown for `README`: ```markdown ## Projects Using That Template We are proud to showcase projects that have been created using our template: | User | Repository | | ---------- | ---------------------------------------------- | | @username1 | [Repo Name](https://github.com/username1/repo) | | @username2 | [Repo Name](https://github.com/username2/repo) | Feel free to [let us know](https://github.com/Bashamega/ebookCraft/issues/new) if you have used this template for your project! ``` That approach requires manual updates to your README, so it is best suited for situations where the volume of users using the template is manageable. ---- For automation, you could explore GitHub Actions or scripts that periodically search GitHub for repositories mentioning your template in their README or have been forked/cloned from your template. However, this would require significant setup and may not always be accurate. However, you can employ a creative workaround using the GitHub API and GitHub Actions to approximate this functionality. - You can search for repositories with a specific topic or description that matches your template repository. Encourage users of your template to include a unique hashtag or keyword in their repository description, or to use a specific topic. Ask users of your template to add a unique topic to their repository, such as `#BasedOnYourRepoName`. - Automate the process of fetching this information and updating your `README.md` file. Create a GitHub Action in your repository to periodically search for repositories using your template by looking for your unique hashtag or topic. The GitHub workflow would be: ```yaml name: Update Template Users List on: schedule: - cron: '0 0 * * *' # Runs every day at midnight workflow_dispatch: jobs: update-readme: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Fetch repositories id: fetch_repos uses: octokit/request-action@v2.x with: route: GET /search/repositories?q=topic:BasedOnYourRepoName+in:description+fork:true mediaType: '{"previews": ["mercy"]}' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Update README run: | REPO_LIST=$(echo '${{ steps.fetch_repos.outputs.data }}' | jq -r '.items[] | .full_name') README_CONTENT="## Repositories Using That Template\n" for REPO in $REPO_LIST; do README_CONTENT+="- [$REPO](https://github.com/$REPO)\n" done echo "$README_CONTENT" > README.md git config --global user.email "action@github.com" git config --global user.name "GitHub Action" git commit -am "Update README with template users list" git push ``` That action: - searches for repositories with the specified topic in their description. - updates the `README.md` file with a list of repositories using your template. - commits and pushes the changes to your repository. That only works if the users of your template follow your guidelines to include a specific topic or keyword. It is not foolproof but offers a method to showcase template adoption.
null
Here's a possible solution, developing @Paulie_D's comment further: It takes the 300px width of the single blocks and the 32px gap as given and not to be changed (that's what I understood from your question and comments), plus that there should be no "gap" right of the rightmost blocks. The (centered) container has your 90vw `width`, but also a `max-width` of 964px (3 x the width of the blocks plus 2 x the gap) In a media query the max-width is changed to 632px (2 blocks and 1 gap), starting at 1071px screen width. The 1071px are calculated as follows: 964 (the max. possible width woth 3 blocks) divided by 90 (the 90vw) x 100 (full screen width). Same calculation principle for the 702px media query. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> html, body { margin: 0; } .container { width: 90vw; max-width: 964px; margin: auto; background-color: aqua; display: flex; flex-wrap: wrap; gap: 32px; } .container div { background-color: blue; height: 200px; width: 300px; } @media (max-width: 1071px) { .container { max-width: 632px; } } @media (max-width: 702px) { .container { max-width: 300px; } } <!-- language: lang-html --> <div class="container"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> <!-- end snippet -->
I have the following three tables in a mysql database: grades: | id | st_id | Q1 | Q2 | | --- | ------ | --- | ---- | | 1 | 20001 | 93 | 89 | | 2 | 20002 | 86 | 84 | | 3 | 20003 | 82 | 83 | | 4 | 20001 | 86 | 89 | | 5 | 20002 | 89 | 54 | | 6 | 20003 | 81 | 94 | subjects: | id | subject | yr | | --- | -------- | --- | | 1 | English | 2023| | 2 | Math | 2023| | 3 | Science | 2023| grades_subject: | sbj_id | st_id | grd_id | | ------- | ------- | ------- | | 1 | 20001 | 20001 | | 1 | 20001 | 20001 | | 1 | 20001 | 20001 | sbj_id st_id grd_id ---------------------------- 1 20001 20001 1 20002 20002 1 20003 20003 2 20001 20001 2 20002 20002 2 20003 20003 ---------------------------- The grades table containes an id (primary key) student_id and quiz scores. A student_id can appear multiple times in this table. The Subjects table is a simple list of subjects with a primary key. The grades_subject table links the two with a subject id, grade id (The st_id links another table with student information). All three are a primary keys. As you can see, a subject id can appear many times in this table as each student in the grades table can have multiple subjects. 20001 appears twice, once with subject id 1 and again with subject id 2 etc. Each subject id can also appear numerous times as numerous student_ids in the grades table can share one subject. Im tyring to get all records in the grades table, grouped by subject id. So the result would be: sbj_id 1...then all the students in that class with their respective grades. sbj_id 2... and so one for all subjects. I have tried various solutions from this site and many combinations of different types of joins, groupings and also used select distinct. I either get duplicate values, or the correct records in the grades table but only 2 subject_ids, or student grades getting repeated for each subject and other inaccurate results.I have also tried subqueries. This is the closest I have gotten to the correct results (I understand I do not neet the group by grades_subject.sbj_id in the below query, its just to demonstrate that it works): `SELECT grades.*, grades_subject.sbj_id FROM grades JOIN grades_subject ON grades.st_id = grades_subject.grd_id where grades_subject.sbj_id = 49 group by grades_subject.sbj_id, grades_subject.grd_id` It results in all the scores for all students in that class which demonstrates that with my current setup I should be able to get what I am looking for with the right query or grouping. When I remove the where clause, I should get each sbj_id, and then all students in that subject with their scores, then the next subject etc. However, it will retrieve the scores for the first student in the subject, then duplicate those results for all other students in that subject as shown below: sbj_Id | grd_id | Q1 | Q2 | .... '1', '20001', '50', '80', '1', '20001', '50', '80', '1', '20001', '50', '80', '2', '20002', '80', '85', '2', '20002', '80', '85', '2', '20002', '80', '85', Select Distint does not work, various join types do not work, selecting and grouping by ids in the grades table does not work including the primary id. Instead of listing everything I have tried that does not work... How I can get my desired results with my current set up without changing my table setup as other tables and coding are built on it. The set up works well with all other types of queries that I need except when Im trying to get all student grades accross all subjects. If I must change the set up, please ellaborate on the simplest way. Thank you.
Use GUI application on Github Codespace
|github|user-interface|browser|
null
I'm trying to ggplot2 as facet_wrap box plot, but I'm having trouble in few things: 1- triangle symbol isn't showing in the graph but it shows in the environment window and console 2- in facet_wrap I'm using theme_lindraw and I want to remove x axis labels and leave it at the bottom panel only 3- I want to add geom_signif for each panel separately but it keeps labelling all panels same annotations which I don't want 4- How to increase y axis to have a space between annotations and the border of the plot here's my coding ``` strains<-rep(c("wt","dfg1\u25b3","asd1\u25b3","dfg1\u25b3 asd1\u25b3"),each=6) x<-rep(c("0mM","4mM"),each=3) y<-c(12,12.91,12.5,15,15.1,14,12,12.2,12.3,15.,15.3,15.9,7.1,7.7,7.3,11.5,11.6,11.1,7.5,7.4,7.3,12,11,10) df<-data.frame(x,y,strains) df$strains<-factor(df$strains,levels = c("wt","dfg1\u25b3","asd1\u25b3","dfg1\u25b3 asd1\u25b3"),ordered = TRUE) ggplot(df)+ aes(x=x,y=y,fill=x)+ geom_boxplot()+ geom_point()+ geom_signif(comparisons = list(c("omM","4mM"),c("omM","4mM"),c("omM","4mM"),c("omM","4mM")), map_signif_level = TRUE,annotations = c("*","**","**","*"),y=c(16,17,12,13))+ facet_wrap(~strains,scales = "free",ncol = 1)+ xlab("")+ ylab("("*mu~"m)")+ scale_fill_manual(values = c("0mM"="gray","4mM"="pink"))+ theme_linedraw(base_size = 16)+ theme(axis.line = element_blank(),plot.background = element_blank(),panel.grid.major = element_blank(),panel.grid.minor = element_blank(),legend.position = "none",strip.background = element_rect(fill = "black")) ``` [enter image description here](https://i.stack.imgur.com/njnzR.png) attached image to clarify what I did and what codes aren't working
geom_signif in facet_wrap in r
|r|ggplot2|facet-wrap|geom|
null
In the structure you describe there are no unique senders and receivers, as that would be a one way chat, instead there only chats, chat members and messages. So create a chats table, create a chat_members (chat_id, user_id) pivot table linking the chat to however many users are in your chat. And a chat_messages (chat_id, sender_id, message) table. Whenever a message in sent to a chat, all members of that chat should receive the message.
I had a matrix visual created in my pbi report having regions in columns field State in rows field and population in values field Population is a calculated column made by using a formula I need to create a table in an horizontal format showing max population per region with their respective State name ,i.e., the table should hold two rows one showing population data and another showing their respective State name as per the regions, indirectly regions are available in the column, How can this be possible? Unable to solve this situation
Pbi horizontal visual table
|powerbi|dax|visualization|powerbi-desktop|
null
|swift|xcode|square|
In your original post at first picture i can see a lot of stencils which are opened in separated windows as Read-Only [RO]… It is not ShapeSheet windows!!! I have not documents with same issue and I create one with code Option Base 1 Sub Prepare() Dim pth(3) As String, curpath As String, i As Integer pth(1) = "C:\My Shapes\19_inch_Rack_flexible_RU.vss" pth(2) = "C:\My Shapes\Favorites.vssx" pth(3) = "C:\My Shapes\GOST_R_21.1101-2013.vss" For i = LBound(pth) To UBound(pth) curpath = pth(i) Documents.OpenEx curpath, visOpenRO ' open stencil in new window as read-only Next ActiveDocument.DocumentSheet.OpenSheetWindow ' add Document ShapeSheet window End Sub ![Demo](https://i.stack.imgur.com/5Ajeq.png) At my side next code close all windows if type of window is not **Drawing window**. Please read more about [VisWinTypes enumeration (Visio)](https://learn.microsoft.com/en-us/office/vba/api/visio.viswintypes)! Next code can close all non-drawing windows Sub Test() Dim va As Application, vw As Window Set va = Application For Each vw In va.Windows Debug.Print vw.Caption, vw.Type, vw.SubType If Not vw.Type = visDrawing Then vw.Close ' visDrawing = 1 Python dont know Visio internal constants Next ActiveDocument.ContainsWorkspaceEx = False ' prevent save document workspace (a lot of RO-opened stencils) ActiveDocument.Save End Sub `ActiveDocument.ContainsWorkspaceEx = False` this line prevent save workspace (all RO stencils). Please check this article [Document.ContainsWorkspaceEx property (Visio)](https://learn.microsoft.com/en-us/office/vba/api/visio.document.containsworkspaceex). Right now I have not Python environment, I try find it later…
{"Voters":[{"Id":23845872,"DisplayName":"Rollo"}]}
How to plot horizontal lines for all the weekly high and lows, to be used on lower timeframes. I've been trying to code this for awhile now and cant seem to get all weekly high and lows plotted just 1 pair of them, the first pic is weekly chart and how it looks, second pic is 1m chart. can anyone help would love to figure this out and have as indicator, thanks [weekly](https://i.stack.imgur.com/QlFwh.png) [1m chart](https://i.stack.imgur.com/dECzK.png) if someone could help me out with this problem I would be very greatful, thank you
How to plot horizontal lines for high and low of all weekly candles to be used on 1m and 5m charts
|pine-script|pine-script-v5|pine-script-v4|
null
|java|apache-kafka|
Git does not have a so call "porcelain" command ready to be used easily to achieve the desired task. But all tools necessary to construct the merge commit do exist, of course. These commands are called "plumbing". You would do it like this: cmtid=$(git commit-tree -p master -p feature \ -m "commit msg" feature^{tree}) git branch -f master $cmtid That is, firstly, a commit is constructed that has `master` as first parent and `feature` as second parent. The tree is identical to that of `feature`. `git commit-tree` prints the commit name, which we capture in a shell variable. Secondly, branch `master` is pointed to the commit that was just constructed.
I have developed an app for a company that will deploy it to their devices for internal use on an MDM managed device. They have asked me to provide a signed IPA file to them. I am a small company with no enterprise account. Also because the users are often changing they asked me to allow it to be used on 'all devices' and assured me they have strict controls to prevent it from leaking out rather than a whitelist of the several thousand users. When I archive and select distribute app, there are currently the 6 options in the screenshot below. Up to now I have been using the release testing and providing them the IPA for testing. But now I'm not sure how to go about providing a signed release version? I have seen some articles about ad hoc distribution but I don't see that option anymore. And it seems enterprise is only for large companies. At a bit of a loss on how to proceed. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/XmJi1.png
How can I provide a signed iOS app IPA file to an organization for MDM distribution?
|ios|xcode|ipa|mdm|
I found the same error message in this discussion: https://forums.developer.apple.com/forums/thread/722490. Buried in this discussion is a nugget, one that lay hidden among the other suggestions I came across in this link here: https://stackoverflow.com/questions/74318052/cant-compile-fortran-on-macos-monterey-ld-unsupported-tapi-file-type-tapi-t. Apparently I already had my conda environment activated when opening a fresh terminal window. I needed to deactivate the conda environment to get past this error. This error is now resolved and is the solution to the error above.
I am an novice in HOG. I am trying to print total gradient magnitude for 100 in the below array img=[[150,50,121],[12,100,25],[201,243,244]] Below is the code I tried ``` from skimage.feature import hog from skimage import data, exposure fdt, hog_image = hog([[150,50,121],[12,100,25],[201,243,244]], orientations=2, pixels_per_cell=(1, 1), cells_per_block=(1, 1), visualize=True) print(hog_image) ``` The value I get is 43. But Now when I calculate manually I am getting the value as 193.437 . formulae for manual calculation is as below ``` import math math.sqrt((25-12)**2+(243-50)**2) ``` both results do not match up. Any suggestion on what I am doing wrong. I am running on python version 3
Find Gradient Magnitude using skimage.feature.hog module
|python-3.x|image-processing|feature-extraction|
My question is about accessing data from a dedicated file by offsets, without any database or serialization frameworks. While textbooks say it is recommended to access data by blocks, such as retrieving/flushing 4KiB at once, I sometimes doubt the necessity. Memory/disks and systematical buffers are controlled by OS/hardwares nowadays, and programmers cannot directly control block move in/out in spite of `FileDescriptor.sync()`. Thereby, even though programs access data by blocks, which increases complexity, the effort may be eliminated by OS mechanism. On the contrary, if programs just access data with its offset, regardless of blocks, the underlying OS may help to schedule block retrieval as usual. Let alone that some programming language employs complicated memory model that may affect disk access, like Java. I've searched the website however gained no clues. Please note me some keywords and I am really sorry for my ignorant.
null
My problem is simply like the title mentionned, while on the hololens my app does not display the colors as they are in the editor. In the editor, they are as the image linked but at runtime with the headset, they white with a small tint of blue. Even the captured footage with hololens show the color correctly, the bug only happens at runtime with the headset. To have this style, I created a custom unlit shader with shader graph in which I get the position of the main light of the scene to calculate shadows and display them with lined textures. I added the an outline shader on top to finalize the effect. On the device the lines and the outlines are displayed correctly it's only the tint of the mesh that is really whiter than expected. Here's what I have tried so far and still have the same issue: -Disabled the main light in the scene -Reduced the intensity of the main light. -I switch color space setting between Gamma and Linear. -I tried other material using the MRTK standard shader (lit and unlit) and they were also whiter. All my test were done with: -2021.3.28f with URP. -MRTK 2.8.3 -Hololens 2.0 Thanks for your help! [In editor](https://i.stack.imgur.com/yKAmW.png)
Why do colors are whiter on Hololens 2 than in editor or captured footage?
|unity-game-engine|uwp|hololens|windows-mixed-reality|
null
the extension and formatter are not very accurate. for every kind of code format need to add special regex. for example this code format shape class:"flex" (only different is, the `"` after `:` has not any space) need the regex like this for snippet work: "class:\"(.*)\"" the different with above answer code is delete space between `:` and `/`
If you have the situation where the HEAD is a merge commit, I found this solution to return the most recent tag among the parent commits, using PowerShell. # Find the latest tag for each of the current commit's parents. $parentsTags = git rev-parse HEAD^@ | ForEach-Object { git describe --tags --abbrev=0 $_ } # Out of all the tags, sorted oldest-to-newest, find the last one that's also one of the parents' tags. $nextLatestTag = git for-each-ref --sort=creatordate --format '%(refname)' refs/tags ` | Split-Path -Leaf ` | Where-Object { $parentsTags.Contains($_) } ` | Select-Object -Last 1
Is it actually allowed to use the header tag twice? e.g. I have two important head-sections in my **header.php** where both could have header tag.
Using <header> or <footer> tag twice?
I looked for solutions and other answers regardign the similar issues. Nothing is working for my case. Scenerios: We have to develop an application using Java and iText 8.0.3, whose purpose is to sign pdf documents. The signing key is held by another company, let’s say it’s CompanyA. These are the steps we are following: 1. Got the pdf document to sign ready. 2. Created a Temp pdf file which added an Empty Signature in the original pdf. 3. Read the Temp pdf to get the message digest. (Encode it to base64) 4. Send the message digest (Base64 encoded) to the CompanyA to get signed. 5. Get the signed digest (base64 encoded) from CompanyA. Do the base64 decoding. And embedded the result into the Temp pdf to get the final signed pdf. Unfortunately its not working and i am getting it saying, “Error during signature verification. ASN.1 parsing error: Error encountered while BER decoding:” Below is relevant part of the code from our application which is being used for the above process: package com.etc; import com.itextpdf.kernel.geom.Rectangle; import com.itextpdf.kernel.pdf.*; import com.itextpdf.signatures.*; import org.bouncycastle.jce.provider.BouncyCastleProvider; import java.io.*; import java.security.GeneralSecurityException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.Security; import java.security.cert.Certificate; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Base64; public class SignatureService { public static X509Certificate getCertificate(String base64String) throws Exception{ byte[] encodedCert = Base64.getMimeDecoder().decode(base64String); ByteArrayInputStream inputStream = new ByteArrayInputStream(encodedCert); CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)certFactory.generateCertificate(inputStream); return cert; } public static String getHashBase64Str2Sign() { try { // Add BC provider BouncyCastleProvider providerBC = new BouncyCastleProvider(); Security.addProvider(providerBC); X509Certificate certificate = null; Certificate[] certs = null; try{ certificate = getCertificate("certBase64"); certs = new Certificate[]{certificate}; } catch (Exception ex){ ex.printStackTrace(); } byte[] sh = emptySignature("helloworld.pdf", "temp.pdf", "sig", certs); return Base64.getEncoder().encodeToString(sh); } catch (IOException | GeneralSecurityException e) { e.printStackTrace(); return null; } } private static byte[] emptySignature(String src, String dest, String fieldname, Certificate[] chain) throws IOException, GeneralSecurityException { PdfReader reader = new PdfReader(src); PdfSigner signer = new PdfSigner(reader, new FileOutputStream(dest), new StampingProperties()); PdfSignatureAppearance appearance = signer.getSignatureAppearance(); appearance.setPageRect(new Rectangle(100, 500, 200, 100)); appearance.setPageNumber(1); appearance.setCertificate(chain[0]); appearance.setReason("For test"); appearance.setLocation("HKSAR"); signer.setFieldName(fieldname); PreSignatureContainer external = new PreSignatureContainer(PdfName.Adobe_PPKLite, PdfName.Adbe_pkcs7_detached); signer.signExternalContainer(external, 8192); return external.getHash(); } private static void createSignature(String src, String dest, String fieldName, byte[] sig) throws IOException, GeneralSecurityException { PdfReader reader = new PdfReader(src); try (FileOutputStream os = new FileOutputStream(dest)) { PdfSigner signer = new PdfSigner(reader, os, new StampingProperties()); IExternalSignatureContainer external = new MyExternalSignatureContainer(sig); PdfSigner.signDeferred(signer.getDocument(), fieldName, os, external); } } public static class PreSignatureContainer implements IExternalSignatureContainer { private final PdfDictionary sigDic; private byte[] hash; public PreSignatureContainer(PdfName filter, PdfName subFilter) { sigDic = new PdfDictionary(); sigDic.put(PdfName.Filter, filter); sigDic.put(PdfName.SubFilter, subFilter); } @Override public byte[] sign(InputStream data) throws GeneralSecurityException { String hashAlgorithm = "SHA256"; BouncyCastleDigest digest = new BouncyCastleDigest(); try { this.hash = DigestAlgorithms.digest(data, digest.getMessageDigest(hashAlgorithm)); } catch (IOException e) { throw new GeneralSecurityException("PreSignatureContainer signing exception", e); } return new byte[0]; } @Override public void modifySigningDictionary(PdfDictionary signDic) { signDic.putAll(sigDic); } public byte[] getHash() { return hash; } } public static void embedSignedHashToPdf(String signedHash) { try { byte[] sig = Base64.getDecoder().decode(signedHash); // Get byte[] hash //SignatureService app = new SignatureService(); createSignature("temp.pdf", "output.pdf", "sig", sig); } catch (IOException | GeneralSecurityException e) { e.printStackTrace(); } } static class MyExternalSignatureContainer implements IExternalSignatureContainer { protected byte[] sig; public MyExternalSignatureContainer(byte[] sig) { this.sig = sig; } @Override public byte[] sign(InputStream arg0) throws GeneralSecurityException { return sig; } @Override public void modifySigningDictionary(PdfDictionary pdfDictionary) { } } public static void main(String[] args) throws Exception { // System.out.println("Hash:" + getHashBase64Str2Sign()); String hash = getHashBase64Str2Sign(); System.out.println(hash); // Send the hash and get signed hash from CompanyA String signatureString = //..... embedSignedHashToPdf(escapeCharFromSignature(signatureString)); } public static String escapeCharFromSignature(String str) { return str.replace("\r\n", ""); } } Below are the source and temp/output pdf after signing: [helloworld.pdf][1] [temp.pdf][2] [output.pdf][3] Any help would be highly appreciated. Thanks **UPDATE** So I have updated the pre signature container, now I am getting all thing valid, except the message "Document has been altered or corrupted" public static class PreSignatureContainer implements IExternalSignatureContainer { private final PdfDictionary sigDic; private byte[] hash; public PreSignatureContainer(PdfName filter, PdfName subFilter) { sigDic = new PdfDictionary(); sigDic.put(PdfName.Filter, filter); sigDic.put(PdfName.SubFilter, subFilter); } @Override public byte[] sign(InputStream data) throws GeneralSecurityException { String hashAlgorithm = "SHA256"; BouncyCastleDigest digest = new BouncyCastleDigest(); X509Certificate certificate = null; Certificate[] certs = null; try{ certificate = ("cert"); certs = new Certificate[]{certificate}; } catch (Exception ex){ ex.printStackTrace(); } try { this.hash = DigestAlgorithms.digest(data, digest.getMessageDigest(hashAlgorithm)); PdfPKCS7 pkcs7 = new PdfPKCS7(null,certs , "SHA-256", null, digest, false); byte[] sh = pkcs7.getAuthenticatedAttributeBytes(hash,PdfSigner.CryptoStandard.CMS, null, null); this.hash = sh; } catch (IOException e) { throw new GeneralSecurityException("PreSignatureContainer signing exception", e); } return new byte[0]; } @Override public void modifySigningDictionary(PdfDictionary signDic) { signDic.putAll(sigDic); } public byte[] getHash() { return hash; } } Here's the updated PDF: [helloworld.pdf][1] [temp.pdf][2] [output.pdf][3] [1]: https://drive.google.com/file/d/1sR-RXYb9-E-brdlJmArav5YCKSLYed8b/view?usp=share_link [2]: https://drive.google.com/file/d/1Ej2vQGhwX2N5OpFgoUGl6IqgId_Ovs_N/view?usp=share_link [3]: https://drive.google.com/file/d/12uggZ_sVBjQsQ-X6MU3iHQAMNT-snsfa/view?usp=share_link **UPDATE 2** Here's the PreSignatureContainer uses: private static byte[] emptySignature(String src, String dest, String fieldname, Certificate[] chain) throws IOException, GeneralSecurityException { PdfReader reader = new PdfReader(src); PdfSigner signer = new PdfSigner(reader, new FileOutputStream(dest), new StampingProperties()); PdfSignatureAppearance appearance = signer.getSignatureAppearance(); appearance.setPageRect(new Rectangle(100, 500, 200, 100)); appearance.setPageNumber(1); appearance.setCertificate(chain[0]); appearance.setReason("For test"); appearance.setLocation("HKSAR"); signer.setFieldName(fieldname); PreSignatureContainer external = new PreSignatureContainer(PdfName.Adobe_PPKLite, PdfName.Adbe_pkcs7_detached); signer.signExternalContainer(external, 8192); return external.getHash(); } public static class PreSignatureContainer implements IExternalSignatureContainer { private final PdfDictionary sigDic; private byte[] hash; public PreSignatureContainer(PdfName filter, PdfName subFilter) { sigDic = new PdfDictionary(); sigDic.put(PdfName.Filter, filter); sigDic.put(PdfName.SubFilter, subFilter); } @Override public byte[] sign(InputStream data) throws GeneralSecurityException { String hashAlgorithm = "SHA256"; BouncyCastleDigest digest = new BouncyCastleDigest(); X509Certificate certificate = null; Certificate[] certs = null; try{ certificate = getCertificate("cert"); certs = new Certificate[]{certificate}; } catch (Exception ex){ ex.printStackTrace(); } try { byte[] hash = DigestAlgorithms.digest(data, digest.getMessageDigest(hashAlgorithm)); PdfPKCS7 pkcs7 = new PdfPKCS7(null,certs , "SHA-256", null, digest, false); byte[] sh = pkcs7.getAuthenticatedAttributeBytes(hash,PdfSigner.CryptoStandard.CMS, null, null); this.hash = sh; } catch (IOException e) { throw new GeneralSecurityException("PreSignatureContainer signing exception", e); } return new byte[0]; } @Override public void modifySigningDictionary(PdfDictionary signDic) { signDic.putAll(sigDic); } public byte[] getHash() { return hash; } }
|matlab|relu|
Only TSQL can modify warehouse tables. You can read the Delta files directly or with Spark, but you can't modify them. TSQL can ***read*** **lakehouse** tables, and ***read*** and ***write*** **warehouse** tables. Spark can ***read*** **warehouse** tables, and ***read*** and ***write*** **lakehouse** tables. If you need to your notebook can use JDBC or ODBC to connect to the Warehouse SQL endpoint and run TSQL commands or stored procedures to modify warehouse tables. So for instance your notebook could stage some data in a lakehouse table and then ask Warehouse to read that data and modify some warehouse tables. Although if the operation is long-running you're probably better off letting the notebook exit and using a subsequent Script or Stored Procedure activity in a pipeline.
### What are the details of your problem? I have a [Sonatype Nexus Repository Manager](https://www.sonatype.com/products/sonatype-nexus-repository) that has an unknown number of hosted repositories for the [Maven-3 m2](https://maven.apache.org/settings.html) format. I'd like to easily make sure all available options are being used from this Nexus. I can see many options being listed available on the Nexus search but at maven command are not being found. 1. Sonatype.Nexus.Repo.1 1. Sonatype.Nexus.Repo.2 1. Sonatype.Nexus.Repo.A 1. Sonatype.Nexus.Repo.N 1. Sonatype.Nexus.Repo.A2 ### What did you try and what were you expecting? I was expecting that if I gave the overarching Sonatype Nexus URL e.g. Sonatype.Nexus.Repo that that'd be fine enough for redirects to figure out and auto-manage. But actually, none of the artifacts seemed to resolve. I don't know if I just haven't been searching the right key terms or my phrasing has been wonky. Is there a way to force Maven to use all the sub-repositories of the main Nexus? Is there a Nexus URL format that will automatically provide all the available repositories' Maven packages in one link? Is there a way to have Maven check every mirror listed for `<mirrorOf>central</mirrorOf>`?
VBA strings are enclosed in double-quotes and any double-quotes inside a VBA string are escaped by using two consecutive double quotes. So > Hi "there" becomes: Dim s as String s = "Hi ""there""" In you case the string should be requestBody = "{""message"":{""subject"":""" & subject & """,""body"": {""content"": """ & body & """,""contentType"": ""Text""},""toRecipients"": {""emailAddress"": {""address"": """ & recipient & """}}}}"
I am trying to replicate what another program is doing to interface with some hardware, where there is next to no documentation, and the business that made the device no longer exists. I know that in pyserial, I can directly set the RTS pin with `Serial.rts`, but when I run the existing program, it does `IOCTL_SERIAL_CLR_RTS` and `IOCTL_SERIAL_SET_DTR`. Do set and clr mean setting the pins to high and low respectively? ```python pyro_serial = serial.Serial( port="COM1", baudrate=115200, timeout=2, bytesize=8, stopbits=serial.STOPBITS_ONE, parity=serial.PARITY_NONE, ) ``` Since the port is specified, it automatically opens the port. This is what happens: ``` UTC TIMESTAMP | T | LEN | DATA 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_QUEUE_SIZE: InSize:4096, OutSize:4096 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_TIMEOUTS: ReadIntervalTimeout:0, ReadTotalTimeoutMultiplier:0, ReadTotalTimeoutConstant:2000, WriteTotalTimeoutMultiplier:0, WriteTotalTimeoutConstant:0 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_BAUD_RATE: 115200 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_RTS 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_DTR 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_LINE_CONTROL: StopBits:STOP_BIT_1, Parity:NO_PARITY, WordLength:8 2024-03-11 14:12:39.124 | C | 24 | IOCTL_SERIAL_SET_HANDFLOW: ControlHandShake:SERIAL_DTR_CONTROL, FlowReplace:SERIAL_AUTO_TRANSMIT|SERIAL_AUTO_RECEIVE|SERIAL_RTS_CONTROL, XonLimit:2048, XoffLimit:512 ``` But when I run the program that already exists, this happens: ``` UTC TIMESTAMP | T | LEN | DATA 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_BAUD_RATE: 115200 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_CLR_RTS 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_DTR 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_LINE_CONTROL: StopBits:STOP_BIT_1, Parity:NO_PARITY, WordLength:8 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_HANDFLOW: ControlHandShake:SERIAL_DTR_CONTROL, FlowReplace:, XonLimit:2048, XoffLimit:2048 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_QUEUE_SIZE: InSize:8192, OutSize:2048 2024-03-11 01:15:04.662 | C | 24 | IOCTL_SERIAL_SET_TIMEOUTS: ReadIntervalTimeout:1, ReadTotalTimeoutMultiplier:0, ReadTotalTimeoutConstant:1, WriteTotalTimeoutMultiplier:0, WriteTotalTimeoutConstant:10 ``` When I write the exact same bytes after this as the existing program does, I get an echo of the same bytes on reading the port. But when the existing program does this, it reads the ACK byte. Based on this, I think that the exact timing of the port is an issue. The information that I do have from the manual reads as follows: "One issue to be aware of when implementing MODBUS communication is that it requires a 16-bit CRC (this can be pre-computed and just provided as a literal constant or else calculated at run-time) and a multi-character delay in order to complete the command. A MODBUS command is considered finished ONLY after this delay takes place. Therefore, the host needs to have a method by which it can send out serial port characters and then impose a delay before more characters are sent. This can be done through a busy wait or an operating system sleep call or some feature built into the serial port driver (the timing is based on character-time delays, specifying at least 3.5 character-time delay to complete a command and a 1.5 character-time delay which should not be exceeded during the transmission of a command.) But it is necessary in order for the receiver of the command to consider it closed and finished." Based on this, I suspect that there is an issue with timing. I have tried inserting a `time.sleep(0.1)` after commands, and this has not helped. So I have to imagine it's some detail about the difference in serial control commands and configuration. I've tried using MODBUS, but also the device only sometimes operates in MODBUS mode. The first thing the software does is send a command that's supposed to reboot the device, so it restarts in MODBUS mode, but that command is not a MODBUS command, which is why I'm using pyserial. What could be causing the issue here? How can I fix this? Edit: I've experimented and found that `pyro_serial.rts = 1` is indeed equivalent to `IOCTL_SERIAL_SET_RTS` and `pyro_serial.rts = 0` is equivalent to `IOCTL_SERIAL_CLR_RTS`
Given the code shown in your question, this works: ```java public static TypedProducer<?, ?> instantiateTypedProducer(Class<?> keyType, Class<?> valueType) { return new TypedProducer<>(); } ``` I would guess that having a `TypedProducer<?, ?>` (with unspecified bounds) is useless though. Don't you want to end up with something like `TypedProducer<Integer, String>`?