instruction
stringlengths
0
30k
Firstly, Change `CMD ["java", "-jar", "./build/libs/app.jar"]` to ``` SHELL ["/bin/bash", "-c"] CMD "java -jar ./build/libs/twitch-bot-*.jar" ``` As you noticed the output file is not called `app.jar` but instead as named as gradle does, roughly `{NAME}-{VERSION}.jar`. Changing to [shell format][1], while setting the shell to bash enables you to use standard bash-functionalities, like wild-cards to match a changing project version. This helps you maintain a stable, easily-updatable docker image in the future. Secondly, (after you updated the question with the java console output), ``` Could not obtain connection to query metadata ``` indicates some connection problems. When using docker-compose together with the `application.properties` you provided: `spring.datasource.url=jdbc:mysql://localhost:3306/twitch-bot` points to `localhost` inside your app container, not your host machine - where the SQL container is listening. You could change this URL either: ``` spring.datasource.url=jdbc:mysql://mysql:3306/twitch-bot ``` or ``` spring.datasource.url=jdbc:mysql://host.docker.internal:3306/twitch-bot ``` The first would be preferred, as there is less overhead. The second one can come in handy if you need to communicate with the host machine. Also, you need to use `docker-compose up` and `docker-compose down`instead of `docker-compose run yourapp ls build/libs` to properly setup all containers and the network. [1]: https://docs.docker.com/engine/reference/builder/#shell-form
The easiest way to solve this is to have your useEffect clean up after itself. Right now, when the functions are calling themselves, it will be very hard to clean that up (i.e., stop them from calling each other). An alternative is to use setInterval. Because with setInterval, it's easy to abort them. Here's an example. **I've removed support for multiple words to simplify the example, but you should be able to easily add them back easily.** ```typescript import { useCallback, useEffect, useState } from 'react' type TypingProps = { word: string, typeDelay: number, eraseDelay: number, nextWordDelay: number, } function TestComponent(props: TypingProps) { const { word, typeDelay, eraseDelay } = props; const [textIndex, setTextIndex] = useState(0); const [isErasing, setIsErasing] = useState(false); const text = word.slice(0, textIndex); const type = useCallback(async () => { if(isErasing) { return } if(textIndex < word.length) { setTextIndex(prev => prev + 1) return; } setIsErasing(true) }, [textIndex, word, isErasing]) const erase = useCallback(async () => { if(!isErasing) { return } if(textIndex > 0) { setTextIndex(prev => prev - 1) return; } setIsErasing(false) }, [textIndex, isErasing]) useEffect(() => { const typeInterval = setInterval(type, typeDelay); const eraseInterval = setInterval(erase, eraseDelay); return () => { clearInterval(typeInterval); clearInterval(eraseInterval); } }, [eraseDelay, typeDelay, type, erase]) return ( <p> <span className='typed-text'> {text} </span> </p> ) } export default TestComponent ```
error: password authentication failed for user "postgres" drizzle migration
|postgresql|drizzle|drizzle-orm|
{"Voters":[{"Id":1255289,"DisplayName":"miken32"},{"Id":213269,"DisplayName":"Jonas"},{"Id":3689450,"DisplayName":"VLAZ"}],"SiteSpecificCloseReasonIds":[13]}
I don’t quite understand what you wan't, but if you want get keys or key-values pairs, and assuming that your `JSON` is correct like this. [{"key1":"value1"}, {"key2":"value2"}, {"key3":"value3"}, {"key4":"value4"}, {"key5":"value5"}, {"key6":"value6"}, {"key7":"value7"}, {"key8":"value8"}, {"key9":"value9"}] Than you can do `JSON.parse` to parse your `JSON` to `JS` object, and use > To get keys Object.keys(converted_obj_from_json); > To get key-value pairs Object.entries(converted_obj_from_json);
I have a Search feature with Ransack which works well. but I am trying to implement it in a way that the search feature filters a particular user model after about a second or two while typing the search query. I have tried using javascript through Rails Stimulus but it doesn't work cos I can't alter the index action variable. my search field looks like this ``` <%= search_form_for @query, url: users_path, data: {search_delay_target: "form"}, method: :get, html: { class: "relative" } do |f| %> <div class="relative"> <%= f.search_field :first_name_or_last_name_or_email_cont, placeholder: "Search...", data: { action: 'keydown->search-delay#search', search_delay_target: "input"}, class: "block w-full rounded-md border-0 pl-10 py-2 pr-12 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %> <div class="absolute inset-y-0 left-0 flex py-3.5 pl-3"> <svg class="w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-5.5-5.5M10 14a7 7 0 1 1 0-14 7 7 0 0 1 0 14z"/> </svg> </div> <div class="absolute inset-y-0 right-0 flex py-1.5 pr-1.5"> <kbd class="inline-flex items-center rounded border border-gray-200 px-1 font-sans text-xs text-gray-400">⌘K</kbd> </div> </div> <%= f.submit "Search", class: "hidden" %> <% end %> </div> ``` while my Ransack modified index controller looks like this ``` def index @query = User.ransack(params[:q]) @users = @query.result(distinct: true).order(created_at: :desc).includes(:group) @pagy, @users = page(@query.result.includes(:group), items: 10) end ``` like I said earlier I am using rails stimulus to activate the 2 seconds delay on keystroke and also trying to pass the search query to index action. I don't know if it is the right way to go about it though but this is what I can think of for now. here is the stimulus controller ```` import { Controller } from "@hotwired/stimulus" // Connects to data-controller="search-delay" export default class extends Controller { static targets= ['input', "form", 'file'] connect() { } search(){ const input = this.inputTarget.value.trim() setTimeout(this.searchKey(input), 2000) } searchKey(query){ fetch(`/users?utf8=✓&q[first_name_or_last_name_or_email_cont]=${query}`,{ headers: { 'X-Requested-With': 'XMLHttpRequest' } }) } } ```
How to configure django 5.0.3 to be able to use private/public media files on AWS - s3
|django|amazon-s3|django-models|
null
Can anyone check whether this is a complete BS of a code or not. Obviously it doesn't work because I'm getting false as answer but I just wanna know if this is on the right track or just totally NOT it. Btw I've never programmed on prolog before, I am just learning the basics. ```pl nested([], []). nested([H1], [[H1]]) nested([H1,H2|T], [Out]) :- H2 - H1 is 1, nested([H2|T], [[H1|Out]]); nested([H2|T], [H1|Out]). ```
**SOLUTION** So I figured this finally, check your SSL cert, really :D I was using .crt insted of .pem, also no-ip provides PEM and PEM chain, be sure to use PEM chain this article helped: https://github.com/expo/expo/issues/16451#issuecomment-1937490176
It's an Angular 17 SPA Application. And it's using the currently most recent version of keycloak-angular (at time of writing 15.2.1) It's something that I simply do not understand. In the default setup, I can authenticate just fine and logout. But if I dare reload the page, the entire page bricks and on inspection I noticed I receive a 400 Bad Request error. "Invalid parameter: redirect_uri" it says. But why? My configuration looks for the most part the same as the example from the project, so I do not understand what the issue could be. [![enter image description here][1]][1] function initializeKeycloak(keycloak: KeycloakService) { return () => keycloak.init({ config: { url: 'https://local.dev.auth/', realm: 'my-test', clientId: 'my-app' }, initOptions: { flow: 'standard', onLoad: 'check-sso', silentCheckSsoRedirectUri: window.location.origin + 'ui/assets/silent-check-sso.html' } }); } For my testing purposes, I even kept the locally running docker instance of keycloak dirt simple [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/GgbxQ.png [2]: https://i.stack.imgur.com/sPQ0o.png
Keycloak: Receiving a "Invalid parameter: redirect_uri" when reloading the page manually
|angular|keycloak|
{"Voters":[{"Id":476,"DisplayName":"deceze"}]}
You can use `GROUP_CONCAT` statement: SELECT GROUP_CONCAT(DISTINCT country ORDER BY country SEPARATOR ';') AS countries FROM diary;
null
I am writing a request handler in a telegram bot. I am having difficulty processing the waiting for pressing the inline button, can you tell me if this can be implemented? I have a ticket monitoring start handler, get them in json, then process each ticket in the list. ``` class MonitoringStatus(StatesGroup): monitoring_active = State() monitoring_pending = State() waiting_for_ticket_action = State() ``` ``` def get_ticket_keyboard(): builder = InlineKeyboardBuilder() builder.add( InlineKeyboardButton( text="assign", callback_data="assign"), InlineKeyboardButton( text="resolve", callback_data="resolve"), ) return builder.as_markup() ``` ``` @router.message(None or MonitoringStatus.monitoring_pending, F.text == 'Start Monitoring') async def start_monitoring(message: Message, state: FSMContext): await state.set_state(MonitoringStatus.monitoring_active) await state.update_data(is_monitoring_active=True) await asyncio.sleep(3) await message.answer('Monitoring started') while True: is_monitoring_active = data.get('is_monitoring_active', False) if not is_monitoring_active: break tickets = await fetch_tickets_from_file() for ticket in tickets: await message.answer(f'Ticket: {ticket["ticket_number"]}\n' f'Reporter: {ticket["reporter"]}\n' f'Description: {ticket["description"]}', reply_markup=get_ticket_keyboard()) await MonitoringStatus.waiting_for_ticket_action.set() await asyncio.sleep(10) ``` And I get an error AttributeError: 'State' object has no attribute 'set'. If I don't use the set() function, all requests from "tickets" in cycle instantly leave messages in telegram, but I need to process each request sequentially.
Search with Rails Ransack Gem: implement a 2 sec search delay while searching with Ransack
|ruby-on-rails|ransack|
I'm trying to capture the username for the following input string in GoLang regex, I expected `An anonymous user` and `User prettygurl91` to be in a single group, but it wasn't the case for the following pattern. Input: [Twitter] An anonymous user has posted a photo on 03-24-2024! [Twitter] User prettygurl91 has posted a video on 03-25-2024! Pattern: ^\[Twitter\] (?:User (.*?)|An (anonymous) user) has posted a (.*) on (.*)\! Resulting groups: Resulting group for `[Twitter] An anonymous user has posted a photo on 03-24-2024!` 1. Nil 2. anonymous 3. photo 4. 03-24-2024 Resulting group for `[Twitter] User prettygurl91 has posted a video on 03-25-2024!` 1. prettygurl91 2. Nil 3. video 4. 03-25-2024 What is was expecting was the following input strings to be grouped like so 1. prettygurl91 / anonymous 2. photo / video 3. 03-24-2024 / 03-25-2024
Regex OR results in two separate groups, how do I make capture it as a single group?
|regex|go|regex-lookarounds|regex-group|regex-negation|
I am facing issue with integration of the WebMoney payment gateway into my WordPress website. The WebMoney payment gateway does not appear during the checkout process on my website. Despite enabling the gateway and configuring the necessary settings correctly, customers are unable to see the WebMoney option as a payment method when they proceed to checkout. I have thoroughly reviewed the configuration settings and ensured that the plugin is installed and activated correctly. However, the issue persists, and I am unable to identify the root cause of the problem. How to resolve this issue?
I'm trying to build navbar component in react with tailwindCss. I've added space-y-2 to get spacing on y axis, for all li elements. But the first li element (Home) is not getting spacing as expected. It looks like [![enter image description here][1]][1] Why Home is behaving differently ? Can anybody pls help [Here is Code][2] [1]: https://i.stack.imgur.com/Tg37H.png [2]: https://play.tailwindcss.com/8c9qGiLCXp
tailwindcss not aligning element <li> as expected with utility space-y-3
|reactjs|tailwind-css|tailwind-elements|
I am kinda lost here and not sure how to proceed. Basically I have two dataframes that I read from csv files. ``` data = {'A': [0,11,21,31,41,51,61], 'B': [10,20,30,40,50,60,70]} data2 = {'Point': [11.5, 18.3, 31.3, 41.2, 51.5, 66.6, 34.7, 12.1, 14.4, 56.8, 54.3]} df = pd.DataFrame(data) df2 = pd.DataFrame(data2) ``` what I am trying to do is to find if the point in df2 is within the range of column A and B of data and return (A+B) which gets added as another column to df. Example for the first point 11.5, I should get back the result of 11+20 and add to the new column infant of that value so the output ends up like this ``` Point : Returned_Data 11.5 31 18.3 31 31.3 71 and so on ``` The issue I'm running into is merging or combing on range or two DataFrames that have different column and row lengths. I know how to use np.where to match values but how to do I do it for above, have also tried using bin, but that gives me back the range instead of the value. ``` range = [0,11,21,31,41,51,61] df['Returned_Data'] = pd.cut (x=check[list], bins =range) ``` ``` A B Returned_Data 0 0 10 (0, 11] 1 11 20 (11, 21] 2 21 30 (21, 31] ``` any help would be greatly appreciated. thank you.
I am having trouble performing a successful API Rest call via apex. The service I'm trying to send a request to has no security layer whatsoever. I can successfuly do the call on postman but if I try it via curl I get an error 401. I tried it via Apex in two different ways and getting 500 and 405. Again, the service has no security layer nor requiers additional parameters. POSTMAN: !\[postman call\](https://i.stack.imgur.com/kUqme.png) CURL `curl -v -X POST '<URL>/app/site/hosting/scriptlet.nl?script=1030&deploy=1&compid=8305111_SB1&h=a9b851a89fbedd8d239d' -H 'Content-Type:application/json'` `` `* Trying <IP>... `` * `TCP_NODELAY set` * `Connected to <URL> (<IP>) port 443 (#0)` * `ALPN, offering h2` * `ALPN, offering http/1.1` * `successfully set certificate verify locations:` * `CAfile: /etc/ssl/certs/ca-certificates.crt` `CApath: /etc/ssl/certs` * `TLSv1.3 (OUT), TLS handshake, Client hello (1):` * `TLSv1.3 (IN), TLS handshake, Server hello (2):` * `TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):` * `TLSv1.3 (IN), TLS handshake, Certificate (11):` * `TLSv1.3 (IN), TLS handshake, CERT verify (15):` * `TLSv1.3 (IN), TLS handshake, Finished (20):` * `TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):` * `TLSv1.3 (OUT), TLS handshake, Finished (20):` * `SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384` * `ALPN, server accepted to use h2` * `Server certificate:` * `subject: C=US; ST=California; L=Redwood City; O=Oracle Corporation; CN=<CN>` * `start date: Nov 25 00:00:00 2023 GMT` * `expire date: Nov 27 23:59:59 2024 GMT` * `subjectAltName: host "<URL>" matched cert's "*.<CN>"` * `issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1` * `SSL certificate verify ok.` * `Using HTTP2, server supports multi-use` * `Connection state changed (HTTP/2 confirmed)` * `Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0` * `Using Stream ID: 1 (easy handle 0x557c84893630)` > `POST /app/site/hosting/scriptlet.nl?script=1030&deploy=1&compid=8305111_SB1&h=a9b851a89fbedd8d239d HTTP/2` > `Host: <URL>` > `user-agent: curl/7.68.0` > `accept: `*`/`* > `content-type:application/json` * `TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):` * `TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):` * `old SSL session ID is stale, removing` * `Connection state changed (MAX_CONCURRENT_STREAMS == 100)!` `< HTTP/2 411` `< server: AkamaiGHost` `< mime-version: 1.0` `< content-type: text/html` `< content-length: 222` `< expires: Sat, 13 Jan 2024 06:51:15 GMT` `< x-reference-error: 7.a4371602.1705128675.a94e38f` `< date: Sat, 13 Jan 2024 06:51:15 GMT` `< akamai-grn: 0.a4371602.1705128675.a94e38f` `<` `` Bad Request{ Your browser sent a request that this server could not understand. Reference&#32;&#35;7&#46;a4371602&#46;1705128675&#46;a94e38f * Connection #0 to host left intact` As for the apex code, this is what I'm executing: ``` public static void testCode7(boolean paramsInURL){ Http http = new Http(); HttpRequest request = new HttpRequest(); String endpoint = '<URL>'; if(paramsInURL){ endpoint +='?script=1030'; endpoint += '&deploy=1'; endpoint += '&compid=8305111_SB1'; endpoint += '&h=a9b851a89fbedd8d239d'; }else{ request.setHeader('script','1030'); request.setHeader('deploy','1'); request.setHeader('compid','8305111_SB1'); request.setHeader('h','a9b851a89fbedd8d239d'); } request.setEndpoint(endpoint); request.setMethod('POST'); request.setHeader('Content-Type', 'application/json'); request.setBody('{}'); HttpResponse res = http.send(request); } ``` When sending params in the url, I get: RESPONSE --\> System.HttpResponse\[Status=Method Not Allowed, StatusCode=405\] body:Method Not Allowed status:Method Not Allowed header keys:\[ "X-Cache", "Strict-Transport-Security", "Cache-Control", "Akamai-GRN", When sending them on the header: 23:15:53.1 (3306629)|CALLOUT_REQUEST|\[204\]|System.HttpRequest\[Endpoint=\<URL\>/app/site/hosting/scriptlet.nl, Method=POST\] 23:15:53.1 (705533129)|CALLOUT_RESPONSE|\[204\]|System.HttpResponse\[Status=Internal Server Error, StatusCode=500\] 23:15:53.1 (705934088)|USER_DEBUG|\[205\]|DEBUG|RESPONSE --\> System.HttpResponse\[Status=Internal Server Error, StatusCode=500\] <html> <head> <title>Notice</title> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> <script type='text/javascript' src='/ui/jquery/jquery-3.5.1.min.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/ui/jquery/jquery_isolation.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/javascript/FieldLevelHelp.jsp?JSP_VER=1&NS_VER=2023.2&minver=15&buildver=30872'></script> <script type='text/javascript' src='/assets/help_service/3801826802.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/javascript/NLUtil.jsp?JSP_VER=1&NS_VER=2023.2&minver=15&buildver=30872'></script> <script type='text/javascript' src='/javascript/NLUtil.js?NS_VER=2023.2&minver=15&buildver=30872'></script> <script type='text/javascript' src='/javascript/NLUIWidgets.jsp?JSP_VER=1&NS_VER=2023.2&minver=15&buildver=30872'></script> <script type='text/javascript' src='/assets/legacy_widgets/862947475.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/assets/help_center_service/3441369224.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/assets/legacy_apputil/1916206691.js?NS_VER=2023.2&minver=15'></script> <script type='text/javascript' src='/javascript/NLAppUtil.jsp?JSP_VER=1&NS_VER=2023.2&minver=15&buildver=30872'></script> <script type='text/javascript' src='/uirefresh/script/global.js__NS_VER=2023.2&minver=15.nlqs?NS_VER=2023.2&minver=15&buildver=30872'></script> <link rel='stylesheet' href='/core/styles/pagestyles.nl?ct=-2&bglt=F2F4F6&bgmd=EDF1F7&bgdk=737A82&bgon=5C7499&bgoff=AFB5BF&bgbar=5C7499&tasktitletext=E4EAF4&crumbtext=C4C8CF&headertext=B5C1D5&ontab=FFFFFF&offtab=000000&text=000000&link=000000&bgbody=FFFFFF&bghead=FFFFFF&portlet=C0CAD9&portletlabel=000000&bgbutton=FFE599&bgrequiredfld=FFFFE5&font=Verdana%2CHelvetica%2Csans-serif&size_site_content=9pt&size_site_title=9pt&size=1.0&nlinputstyles=T&accessibility=F&appOnly=F&NS_VER=2023.2'><link rel='stylesheet' type='text/css' href='/uirefresh/css/button.css' /> </head> <body bgcolor='#FFFFFF' link='#000000' vlink='#000000' alink='#330099' text='#000000' topmargin='0' marginheight='1' onload='page_init()' class='error-page'> <img class='uir-logo' src='/images/logos/netsuite-oracle.svg' border=0 style='margin-right:30px;margin-left:10px;'> <table border=0 cellPadding=0 cellSpacing=0 width=100%> <tr><td class='bglt'> <table border='0' cellspacing='0' cellpadding='5' width='100%'> <tr><td class='textboldnolink'>Notice</td></tr> <tr><td vAlign='top'> <table border='0' cellspacing='0' cellpadding='0' width='100%'> <tr><td class='text'>&nbsp;</td></tr> <tr><td class=text><img src='/images/5square.gif' width=5 height=5>This request is missing a required parameter.</td></tr> <tr><td class='text'>&nbsp;</td></tr> <tr><td class='text'>&nbsp;</td></tr> </table></td></tr></table></td></tr> <tr><td><span id='tbl_login'><INPUT type='button' class='bgbutton' style='' value='Log In Again' id='login' name='login' onkeypress="event.cancelBubble=true;" onclick="document.location.href='/pages/login.jsp'; return false;"></span></td></tr> </table> <script language='JavaScript' type='text/javascript'> function page_init() { } </script> </body> </html> ``` status:Internal Server Error: DEBUG|header keys:\[ "X-Cache", "Akamai-GRN", "Connection", "Pragma", "Date", "Strict-Transport-Security", "Cache-Control", "NS_RTIMER_COMPOSITE", "Vary", "Expires", "Content-Length", "X-N-OperationId", "Content-Type" \]
I managed to get it working using this website https://stackoverflow.com/questions/68507437/downloading-a-pdf-file-in-reactjs-works-locally-but-doesnt-work-on-amazon-ampli I had to specify that a .pdf file was a valid redirectable file type, since it isn't there by default.
As s3dev alread mentioned in the comment, you must add the parent directory (.../poker/) to sys.path via import sys sys.path.append('FULL OR RELATIVE PATH') Directories that you want to import from that are not the same directory as the script you are running also require an `__init__.py` file. This can be an empty file but tell Python that it can look for modules to import from in that directory.
I have a Next.js app (v14) using the app directory. I'm using a node script to fetch all mdx files from another repository with the command `pnpm fetch-docs`. This command is putting all content into `/content/docs` at the root of my project so I end up having: - /app - /components - /content -- /docs - lib ... All the mdx files imported are not saved in the repo. I would like to fetch then at build time just before the `next build`. Locally I do first `pnpm fetch-docs` to fetch the data and then I launch `pnpm dev`. This is working really well. The problem is when I am publishing my site to Vercel. I modified the build command to have `pnpm fetch-docs && next build` and I can see in the build process that it is fetching the data but if I see the source, I don't see the imported files and my app is missing those files. Any idea where I might do something wrong?
Imported files from prebuild script is not showing in Vercel deployment
|next.js|vercel|
You could just make use of the "guildMemberAdd" event. ```javascript // I'll assume you've already imported the Client class and defined it client.on("guildMemberAdd", async (member) => { let channelId; // Add your desired channel Id here let channel = member.guild.channels.cache.get(channelId); let message = `Welcome <@${member.id}>`; await channel.send(message); }); ```
{"Voters":[{"Id":2287576,"DisplayName":"Andrew Truckle"},{"Id":9214357,"DisplayName":"Zephyr"},{"Id":5193536,"DisplayName":"nbk"}],"SiteSpecificCloseReasonIds":[11]}
I wrote a small python package that does this. **~2.3x speedup** compared to np.amax and np.amin. Usage: `pip install numpy-minmax` ``` import numpy_minmax min_val, max_val = numpy_minmax.minmax(arr) ``` The algorithm is written in C and is optimized with SIMD instructions. The code repository is here: https://github.com/nomonosound/numpy-minmax
I have the following directory structure: ``` src |__app |__layout.tsx |__page.tsx |__archive |__page.tsx |__[eventId] |__page.tsx ``` and the following serverless function ``` import { revalidatePath } from "next/cache"; export async function GET() { revalidatePath("/archive"); revalidatePath("/archive/[eventId]"); revalidatePath("/"); return Response.json({ info: "finished running revalidatePath" }); } ``` **Problem** `/` and `/archive/page` are getting revalidated, but not the dynamic `/archive/[eventId]` **Note**: `export const dynamicParams = true` ([which fetches on demand if the route has not been generated][1]) works but I cannot use it as it fetches partial data from the DB (future events and eventIDs exist in the DB, but I'm filtering them by "ready to be used" to create the dynamic paths). **What I've tried** I tried many variations of `revalidatePath`, such as: `revalidatePath("/archive/[eventId]", "page");` `revalidatePath("/archive/[eventId]", "layout");` `revalidatePath("/archive/[eventId]/page");` but nothing seems to work. What am I doing wrong? ___ **Further info** - `/archive` is a list of links to past events, each with an `eventId`. Clicking on a link takes the user to `/archive/<clicked eventId>` - `/` displays the latest `eventId` that was added to the DB - when a new event is added to the DB and I run the `GET()` function above, the new event is displayed in `/` and `/archive`, but clicking on it in `/archive` **correctly takes the user to `/archive/<clicked eventId>` but shows a `404` page (i.e.: the page has not been generated)** - `/archive/[eventId]/page` is where my `generateStaticParams()` lives. - the app is hosted in Vercel [1]: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#cross-route-segment-behavior
## Watir Firefox Issue with iframe Handling I'm experiencing an issue with Watir's iframe handling in Firefox. The issue does not occur in Chrome. **Environment:** - Watir Version: 7.3 - Selenium Version: 4.2 - Browser Version: Firefox 122.0.1 64-bit - Browser Driver Version: geckodriver 0.34.0 - OS Version: Mac OS 14.2.1 Note: The issue exists on other OS and other version of watir and FF too. **Issue:** When using methods like `wait_until` or `.html` on an iframe, I encounter a `Watir::Exception::UnknownObjectException`. **Reproduction Steps:** I've created a class `TestFFIssueWatir` with two methods `check_error_using_wait_until` and `check_error_with_html` that demonstrate the issue. In `check_error_using_wait_until`, after using `wait_until` on an iframe, only one operation can be performed on it. The second `send_keys` operation fails. In `check_error_with_html`, after using `.html` on an iframe, the iframe variable seems to get garbage collected and any subsequent operations on it fail. Here's a simplified version of the code: ```ruby class TestFFIssueWatir def initialize @browser = Watir::Browser.new :firefox end def goto_website @browser.goto('https://demo.automationtesting.in/Frames.html') end def check_error_using_wait_until testIframe = @browser.body.iframe(id: 'singleframe') testIframe.wait_until(timeout: 10, &:present?) testIframe.input.send_keys('Hello, Universe!') testIframe.input.send_keys('Hello, Again!') end def check_error_with_html testIframe = @browser.body.iframe(id: 'singleframe') puts(testIframe.html) testIframe.input.send_keys('Hello, world!') end end test_watir = TestFFIssueWatir.new test_watir.goto_website test_watir.check_error_with_html test_watir.check_error_using_wait_until ``` Any help in resolving this issue would be greatly appreciated. P.S: Since this seems like library issue, I have also posted this as Issue on repo too: [Issue link](https://github.com/watir/watir/issues/973) Basically, I am working on website that have lot of iframes. On selenium we have to use switch_to to switch to iframe. But watir provides us wrapper which let us use iframe like normal elements. Everything was working fine on chrome. But we now need to run it on FF too. And on firefox seems like for lot of method [wait, html] if we use it on iframe assigned variable; that variable becomes useless after that. We get Object not found issue. ### Issue Details 1. The issue is present on Firefox browser only; not on chrome. 2. The issue is present on different OS as well as different versions of geckodriver. 3. I have provided 2 methods to reproduce the issue. check_error_with_html and check_error_using_wait_until_fix #### check_error_with_html This method will demo FF issue with iframe handling. Case when .html type method are used on iframe, the variable(that stores the iframe) does not work. Eg: On above if you uncomment test_watir.check_error_with_html and comment test_watir.check_error_using_wait_until_fix, then you will see the issue. Here after using testIframe.html I cannot use any method on testIframe. It will give Watir::Exception::UnknownObjectException. eg: testIframe.input.send_keys('Hello, #### check_error_using_wait_until_fix This method will demo FF issue with iframe handling when using method like wait_until. Here once you use wait_until say on iframe a, then you can use only one operation on it. Eg: below send_keys will fail on second attempt after that because we used wait_until on iframe.
{"Voters":[{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}]}
{"Voters":[{"Id":13447,"DisplayName":"Olaf Kock"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"}],"SiteSpecificCloseReasonIds":[18]}
{"Voters":[{"Id":9599344,"DisplayName":"uber.s1"}],"DeleteType":1}
{"Voters":[{"Id":12957340,"DisplayName":"jared_mamrot"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"}],"SiteSpecificCloseReasonIds":[13]}
{"Voters":[{"Id":2395282,"DisplayName":"vimuth"},{"Id":16217248,"DisplayName":"CPlus"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}]}
{"Voters":[{"Id":9393102,"DisplayName":"xdurch0"},{"Id":9267296,"DisplayName":"Edo Akse"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}]}
This error occurs because NextAuth is Edge compatible, but some of the database adapters, such as Prisma, are not. If any of your files are configured to have a runtime on Edge, you'll likely encounter this error. The solution is to locate the route.ts file in your app/api/[...nextauth] folder and set the runtime to nodejs or completely remove the runtime variable from your route.ts file. Your app/api/auth/[...nextauth]/route.ts should resemble the following: export { GET, POST } from "@/auth"; export const runtime = "nodejs"; // You can optionally remove this, but if it's set to 'edge', there will be an error when using edge incompatible adapters.
Trying to create a function where (from a typing perspective) based on the first two arguments it determines whether a 3rd argument should be provided or not. Whether the 3rd argument is required is based on if a specific nested key exists in the object based on the path of the first two arguments. I created a contrived example to demonstrate: [Example](https://www.typescriptlang.org/play?#code/C4TwDgpgBAogHgQwLZgDYQCrmgXigbwCgooArAewAsA7ALgOJKmHPNQCNy578oBjNuQBO9AM7AhAS2oBzKAF9G8gDSNSCahB6MSovkIgB3ACZSAbhBEF+gq+KmyFS1boSpUIbUyiVkSSzw2qMJiEtJyKjpQ1AiSqDyKJIqKhKCQUADCtgCCQjKiADxZwUIAfFB4xcJQEHDAENTGotEQFkJQAPzWAiUd9FXt8lCBPSGZtgoA3ISp2LCIKOgAYtQVUAWMAHLI0LX1jc3wEgh8wAUA1hAg5ABm88homNjKUPbhpS5QGJThNXUNTXmx1OFyut3uiyekAA2tt-ABdF5vWQfRgDP77QEACngD3QWBhcIg8Oh33C8IxAOavFGVmkN0smQUnSZ9E0bQAlIRSliBNQbpIZIEYv56ESXsAfrJ6GTHEMAGTjEq5fJFWylDkVcrImTTQi1MDCYA2ajiP54iArei4yErNZY3giiASqUyF60hSanDlIgkPmiNgQAB0wRkWKdLvC7tsHOmJAMwAArkJVgBySgQdzkVPTeR62oWlYOxhO+ip0RuDypz6S8JlmJxauEeSxwhAA) ``` type ExampleType = { john: { toolbox: { color: string } }, jane: { screwdriver: { color: string } }, sally: { hammer: { color: string }, nail: {} } } type ColorArgs<Color> = Color extends never ? { color?: Color } : { color: Color }; type ExampleFn = < Name extends Extract<keyof ExampleType, string>, Thing extends Extract<keyof ExampleType[Name], string>, Color extends (ExampleType[Name][Thing] extends { color: infer C } ? C : never) >(config: { name: Name, thing: Thing } & ColorArgs<Color>) => string; export const exampleFn: ExampleFn = ({ name, thing, color }) => { console.log(name, thing, color); return 'hello'; }; exampleFn({ name: 'sally', thing: 'nail', }); ``` I'm expecting the function to work correctly and not allow a color argument when name is sally and thing is nail.
Firefox Iframe issue on Watir: Watir's iframe Handling issue with few methods. eg: wait_until and .html Methods
|ruby|firefox|iframe|watir|
null
i want to use custom schema in interface jpa repository with native query like this : application.yaml : ``` schema: name: first: schema1 second: schema2 ``` Jpa Repository : ``` public interface UserRepository extends JpaRepository<User,String> { @Query(value = "SELECT ID FROM ${schema.name.first1}.users WHERE NUMERO = " + "(SELECT EMPLOYEE_NUMBER FROM ${schema.name.first2}.employees WHERE ID = :lastModifiedByID)" String getUserCreationByID(@Param("id") String id); ..... } ``` but when I run the application with SQL trace, the parameter ${schema.name.first1} does not get the value from application.yaml and uses it as query and exits with SQL error trace : ``` Hibernate: SELECT ID FROM ${schema.name.first1}.users WHERE NUMERO (SELECT EMPLOYEE_NUMBER FROM ${schema.name.first2}.employees WHERE ID = ?) SQL Error: 17034, SQLState: 99999 ``` Thanks has anyone used a custom schema with a native query?
custom schema in native query with jpa repository
|sql|spring-boot|hibernate|jpa|spring-data-jpa|
null
I am calculating `pct_change` in pandas groupby but from the first element of each group. Hence i am using `cumprod()`. I already have a working code but it is little ugly. How can i use `pct_change()` and `cumprod()` in one liner. **My code:** import pandas as pd import numpy as np data = [[1, 10], [2, 17], [3, 15],[4, 11], [5, 17], [6, 15]] df = pd.DataFrame(data, columns=["id", "open"]) #normal df['Normal'] =df['open'].pct_change().fillna(0).add(1).cumprod().sub(1).mul(100).round(2) #groupby df["Group_of_3"] = df.groupby(np.arange(len(df)) // 3 )["open"].pct_change().fillna(0).add(1) df["Group_of_3"] = df.groupby(np.arange(len(df)) // 3 )["Group_of_3"].cumprod().sub(1).mul(100).round(2) print(df) **output** id open Normal Group_of_3 0 1 10 0.0 0.00 1 2 17 70.0 70.00 2 3 15 50.0 50.00 3 4 11 10.0 0.00 4 5 17 70.0 54.55 5 6 15 50.0 36.36
how to execute multiple functions in pandas groupby processing
|python|pandas|
How to setup indexer tier in Apache Druid version 28.0.0? Need to change this _Default_tier to new_tier [druid-console](https://i.stack.imgur.com/tG3tk.png) I tried adding below parameter and then restarted druid, but no change was found. druid.worker.category=test druid.worker.capacity=5
You cannot immediately use [`System.Half`](https://learn.microsoft.com/en-us/dotnet/api/system.half?view=net-8.0) as type value `T`, as `Half` does not implement the `IConvertible` interface that you request in the constraint. Since you state that you check the number type in the constructor anyway, you could as a workaround drop that type constraint, and instead implement a custom handler function for every type. You then choose a suitable one during initialization: ```c# class ValueCollection<T> where T : struct { private readonly BinaryWriter _writer; private readonly Action<T, BinaryWriter> _writeValue; public ValueCollection(BinaryWriter writer) { _writer = writer; _writeValue = typeof(T) switch { Type t when t == typeof(int) => (Action<T, BinaryWriter>)(object)WriteInt32, // ... Type t when t == typeof(Half) => (Action<T, BinaryWriter>)(object)WriteHalf, _ => throw new NotSupportedException() }; } public void Write(T value) => _writeValue(value, _writer); private static void WriteInt32(int value, BinaryWriter writer) => writer.Write(value); // ... private static void WriteHalf(Half value, BinaryWriter writer) => writer.Write(value); } ```
Dataframe, get sum of range if value within range
|python|pandas|dataframe|numpy|
{"OriginalQuestionIds":[16026942],"Voters":[{"Id":1255289,"DisplayName":"miken32"},{"Id":213269,"DisplayName":"Jonas"},{"Id":3689450,"DisplayName":"VLAZ"}]}
Flutter (Channel beta, 3.21.0-1.0.pre.2, on Microsoft Windows [Version 10.0.19045.4170], locale en-US) • Flutter version 3.21.0-1.0.pre.2 on channel beta at C:\Users\wzalz\flutter_windows_3.19.3-stable\flutter ! Warning: `dart` on your path resolves to C:\Program Files\Dart\dart-sdk\bin\dart.exe, which is not inside your current Flutter SDK checkout at C:\Users\wzalz\flutter_windows_3.19.3-stable\flutter. Consider adding C:\Users\wzalz\flutter_windows_3.19.3-stable\flutter\bin to the front of your path. What do I do I tried again and again
A problem with the FLUTTER appeared when I installed it in Windows
|flutter|
null
The part of the implementation should go like this which will guarantee your conditions I think. ```swift import SwiftUI struct ContentView: View { @State var title = "Title text" @State var subTitle = "Subtitle text" var isSubtitleLarger: Bool { subTitle.count > title.count } var body: some View { VStack(alignment: .leading) { Text(title) .lineLimit(isSubtitleLarger ? 1 : 2) Text(subTitle) .lineLimit(isSubtitleLarger ? 2 : 1) } .frame(height: 150) // Update height to meet minimum size, so that the view doesn't shrink when texts are small } } ``` This is important to guarantee there is always **3 lines at max**.
{"Voters":[{"Id":16217248,"DisplayName":"CPlus"},{"Id":781965,"DisplayName":"Jeff"},{"Id":5349916,"DisplayName":"MisterMiyagi"}]}
You can make your code more modular and flexible by using dependency injection. With this method, you provide the components a object needs from outside the object. Thus, you can loosen the close relationships between modules and make your code easier to manage, making it more open to future changes. In your current situation, you have defined an on_change_variant_callback function in the ui_theme.py file and assigned a value to this callback function in the cards_page.py file. This situation creates a quite tight bond between the two files. We can use dependency injection to loosen this tight bond. That is, we can convey the on_change_variant_callback function to the ui_theme.py module from outside in some way. Thus, we reduce the dependency between the ui_theme.py and cards_page.py files, making our code have a more modular and flexible structure. With this method, you can more easily adapt to the future development of your code and easily adapt to possible changes **ui_theme.py** class VariantSelector: def __init__(self, on_change_callback=None): self.on_change_callback = on_change_callback def on_change_variant_click(self, dbref, msg, to_ms): print("button clicked:", msg.value) if self.on_change_callback: self.on_change_callback(dbref, msg, to_ms) **cards_page.py** from ui_theme import VariantSelector def on_variant_select(dbref, msg, to_ms): # Handle the variant change event pass variant_selector = VariantSelector(on_change_callback=on_variant_select)
Try doing the following: 1. Define the Id as following in the abstract class: @Id @GeneratedValue(generator = "uuid") @GenericGenerator(name = "uuid", strategy = "uuid2") private String id; 2. I believe ArticleEntity should extend the base BaseEntity class. 3. Try calling repository.findById(String id), providing the id as a parameter. You don't need to define this method again in your repository interface, as it would be already there in JpaRepository.
Before you read this answer, let me remind you that your code is prone to SQL injection and it's highly insecure, users might pass malicious scripts as the values they post which are then executed in your database updates, causing your system harm. ------------------------------------------------------- The ``` WHERE `project_id`='$proj_id' ``` specifies that all records whose `project_id` equals your `$proj_id` will be updated accordingly. If you need to differentiate them by row number, then you can use a variable, like ``` set @rn = 0; update yourtable set yourfield = (@rn := @rn + 1) where `project_id` = 59 ```
Just meet similar problem no long before. I suggest reading [this question][1], which I found helpful. [1]: https://stackoverflow.com/questions/49816206/cmake-find-package-specify-path
Hi I am looking for a method to be able to get my MT4 alerts onto the trading view system so that I can be able to close my Mt4 terminal. Are there any ready solutions? If not I am looking to code my solution but I need a way to create the trading view alert. Does trading view have an API function or is there an library that I can use. Many thanks.
MT4 to trading view alerts? Create trading view alert API
|tradingview-api|metatrader4|mt4|
The analytify plugin has already enqueued the script, so your code is enqueueing it a second time. Before your call to wp_enqueue_script, try adding: wp_dequeue_script( 'analytify-events-tracking' ); which should work if the plugin has already enqueued the script when front_scripts runs.
I have many **Dynamic** dictionary like this: `{1: 'VDD', 2: 'VDD', 7: 'VDD', 0: 0, 3: 0, 4: 0, 6: 9, 13: 9, 'GND': 'GND', 15: 'GND', 12: 12} ` I want to set ID as values for keys that they are not 'VDD' and 'GND' . In this case the keys that have the same value must have the same ID . IDs must start from 1 . as you see I want Output like this: `{1: 'VDD', 2: 'VDD', 7: 'VDD', 0: 1, 3: 1, 4: 1, 6: 2, 13: 2, 'GND': 'GND', 15: 'GND', 12: 3}` I try this : ``` my_dict = {1: 'VDD', 2: 'VDD', 7: 'VDD', 0: 0, 3: 0, 4: 0, 6: 9, 13: 9, 'GND': 'GND', 15: 'GND', 12: 12} i=1 for item in my_dict : if my_dict[item] != 'VDD': if my_dict[item] != 'GND': b = my_dict [item] my_dict[item] = i if b != : i+=1 ``` but i cant figure out ...
change and give id to values in dictionary
|python|dictionary|
null
I have been working with Flutter and I have a doubt. I am trying to show overlay on top of my screen. That's why I am using [flutter_overlay_window][1] In its [example][2] code I found this void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(const MyApp()); } @pragma("vm:entry-point") void overlayMain() { WidgetsFlutterBinding.ensureInitialized(); runApp( const MaterialApp( debugShowCheckedModeBanner: false, home: TrueCallerOverlay(), ), ); } `main` is the main `entrypoint` of dart VM's root isolate. But what about the overlayMain entry point? How does the dart code inside of this entry point gets executed? In a new isolate or the same isolate? Another question, will it be in the same flutter engine or different flutter engine. I know the meaning of `@pragma(vm:entry-point)` notation. These are additional readings I did. I have read a lot but didn't get any satisfactory answer 1. [dart vm][3] 2. [dart executor][4] 3. [Flutter engine][5] 4. [Dart isolates][6] Please share any additional resources that I might have missed. [1]: https://pub.dev/packages/flutter_overlay_window [2]: https://github.com/Adora-Inc/flutter_overlay_window/blob/6bcbfadbc35a0cd2bb8be155afead14451c98d5d/example/lib/main.dart#L5 [3]: https://mrale.ph/dartvm/ [4]: https://api.flutter.dev/javadoc/io/flutter/embedding/engine/dart/DartExecutor.html [5]: https://api.flutter.dev/javadoc/io/flutter/embedding/engine/FlutterEngine.html [6]: https://github.com/flutter/engine/blob/main/runtime/dart_isolate.h#L63
In my project I have a simple Navigation Graph, **addOnDestinationChangedListener ** working fine but after the code click **addOnDestinationChangedListener ** is not trigger but navigation action did execute ``` CoroutineScope(Dispatchers.IO).launch { kotlin.runCatching { Constants.getBitmapFromView(binding.frameLayout) }.onSuccess { kotlin.runCatching { mBitmap = it findNavController().navigate(R.id.previewFragment) } } } ``` If i change the clickListener to navigate then its working fine,but i need to trigger ``` navController.addOnDestinationChangedListener { _, destination, _ -> } ```
NavController.OnDestinationChangedListener is not triggered during Navigation
|android|android-architecture-navigation|kotlin-android|
null
I have to give the user input in the Jmeter console. For example Using scanner or other libraries i need to enter input values in the Jmeter console. Jmeter log Enter input : (Here i need to give input) testinputuser2 I have tried some code in jsr223 using groovy i got **java i/o execption: The handle is invalid** Could you please give the best solution for this it would be good
I am using Microsoft student plan for azure for a project at my college. I have already deleted the resource group as well as some Network Reacher resource group. I am having a presentation after a few days and have only got 28 credits left. Why am I still getting charged? I deleted all the resource groups. I was expecting credits to stop but its still going on.
Azure losing CREDITSSS
|azure|azure-billing-api|
null
I dont think so javascript works like that sir, a **javascript script doesn't work when you place it in some kind of object (div in this case**) instead it is always **supposed to be put at the end of the HTML page** (before the body ending tag usually) and it works accordingly what you have written inside it. **Here you are considering javascript as a html object (just live divs ,paragraphs ,header tags etc.) but it isn't like that**. I can help you more if you can **provide your Javascript code** and **tell me what you are trying to code more clearly** .
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
## What we're trying to achieve? Spring Data JPA lets us define repository methods like this: ```java Optional<User> findByEmail(String email); ``` With that, the query to be run will be figured out with the method name. In this case, something like `select * from user where email = ?`. We want to apply an additional common criteria to _all_ such `find...By` methods on the repository, a `and deleted_at is null` condition. Essentially, `findByEmail` should behave like `findByEmailAndDeletedAtNull`. ## Why? We used to do this with reactive Spring Data MongoDB by extending `ReactivePartTreeMongoQuery`, and overriding `createQuery` with something like this: ```java @Override protected Mono<Query> createQuery(ConvertingParameterAccessor accessor) { return super.createQuery(accessor).map(query -> { query.addCriteria(where("deletedAt").is(null)); return query; }); } ``` This worked well. We're now moving to using an RDBMS and looking for similar behavior there. ## What have we tried? I found that `PartTreeJpaQuery.QueryPreparer.createQuery()` is the one that calls `EntityManager.createQuery` off a `CriteriaQuery` object, and returns a `TypedQuery` object. I managed to hook into the middle of this But can't add additional conditions to the `TypedQuery` object, like I can with `CriteriaQuery`. And there's no way to access the `QueryPreparer` object either to hook into it. I can't extend `PartTreeJpaQuery` class either, because it doesn't have any public constructors. Is there any way to do this at all?
There is no real way to avoid such a factory while using an enum. But you could replace the enum with an factory object, something like: ``` public interface IFruit { } public class Apple: IFruit { } public class Orange : IFruit { } public interface IFruitFactory { IFruit Create(); } public class AppleFactory : IFruitFactory { public static readonly AppleFactory Instance = new(); public IFruit Create() => new Apple(); } public class OrangeFactory : IFruitFactory { public static readonly OrangeFactory Instance = new(); public IFruit Create() => new Orange(); } ``` With this pattern you would pass around a `IFruitFactory` instead of a fruit enum, allowing anyone to easily constrct a fruit from it. If you want to add a Banana you just create a new `BananaFactory`. But I would recommend being pragmatic. The problem with switch-methods as in your example is when someone forgets to add a case when adding a new value, putting the factory close to the enum declaration, i.e. in the same file, help reduce this risk. As is often the case, rules like 'open-close principle' are general recommendations, but you need to know why they exist and when they are applicable. Trying to dogmatically follow all design principles is just not a good idea.
|azure|terraform-provider-azure|
null
I'm encountering an issue with the output formatting in my Python code related to displaying the hierarchy of employees in a company. Despite implementing the logic correctly, the output is displaying individual characters instead of complete strings representing employees. **Here's a brief overview of the problem:** - I have a Python program that manages employee information within a company. - One of the functionalities of the program is to display the hierarchy of employees starting from a given manager. - I'm constructing the hierarchy, but when printing the output, it's showing individual characters instead of complete strings representing employees. - I've ensured that the code logic for constructing the hierarchy is correct, but there seems to be an issue with how the output is being processed or displayed. **Here is a sample I/O statement.** *Sample input:* EMPLOYEE_HIERARCHY Kevin *Sample output:* EMPLOYEE_HIERARCHY :> Employee [name=Kevin, gender=MALE] Employee [name=Manurola, gender=FEMALE] Employee [name=Nivan, gender=MALE] Employee [name=Yash, gender=MALE] Employee [name=Simmy, gender=FEMALE] *My output:* EMPLOYEE_HIERARCHY :> 'E' 'm' 'p' 'l' 'o' 'y' 'e' 'e' ' ' '[' 'n' 'a' 'm' 'e' '=' 'K' 'e' 'v' 'i' 'n' ',' ' ' 'g' 'e' 'n' 'd' 'e' 'r' '=' 'G' 'e' 'n' 'd' 'e' 'r' '.' 'M' 'A' 'L' 'E' ']' '\n' ' ' ' ' 'E' 'm' 'p' 'l' 'o' 'y' 'e' 'e' ' ' '[' 'n' 'a' 'm' 'e' '=' 'M' 'a' 'n' 'u' 'r' 'o' 'l' 'a' ',' ' ' 'g' 'e' 'n' 'd' 'e' 'r' '=' 'G' 'e' 'n' 'd' 'e' 'r' '.' 'F' 'E' 'M' 'A' 'L' 'E' ']' '\n' ' ' ' ' 'E' 'm' 'p' 'l' 'o' 'y' 'e' 'e' ' ' '[' 'n' 'a' 'm' 'e' '=' 'N' 'i' 'v' 'a' 'n' ',' ' ' 'g' 'e' 'n' 'd' 'e' 'r' '=' 'G' 'e' 'n' 'd' 'e' 'r' '.' 'M' 'A' 'L' 'E' ']' '\n' ' ' ' ' ' ' ' ' 'E' 'm' 'p' 'l' 'o' 'y' 'e' 'e' ' ' '[' 'n' 'a' 'm' 'e' '=' 'S' 'i' 'm' 'm' 'y' ',' ' ' 'g' 'e' 'n' 'd' 'e' 'r' '=' 'G' 'e' 'n' 'd' 'e' 'r' '.' 'F' 'E' 'M' 'A' 'L' 'E' ']' '\n' ' ' ' ' 'E' 'm' 'p' 'l' 'o' 'y' 'e' 'e' ' ' '[' 'n' 'a' 'm' 'e' '=' 'Y' 'a' 's' 'h' ',' ' ' 'g' 'e' 'n' 'd' 'e' 'r' '=' 'G' 'e' 'n' 'd' 'e' 'r' '.' 'M' 'A' 'L' 'E' ']' This is my implementation: ``` def get_employee_hierarchy(self, manager_name: str) -> List[str]: output_tree = [] def build_hierarchy(employee_name, level=0): employee = self._employee_book.get(employee_name) if not employee: return [] indent = "\t" * level employee_str = f"{indent}Employee [name={employee.get_name()}, gender={employee.get_gender().value}]" hierarchy = [employee_str] direct_reports = self.get_direct_reports(employee_name) for direct_report in direct_reports: hierarchy.extend(build_hierarchy(direct_report.get_name(), level + 1)) return hierarchy hierarchy = build_hierarchy(manager_name) output_tree.extend(hierarchy) # Join the hierarchy items into a single string with newlines output_str = '\n'.join(output_tree) return output_str ``` I'm seeking assistance in identifying and resolving this output formatting issue so that the hierarchy of employees can be displayed correctly. Any insights or suggestions on how to fix this issue would be greatly appreciated. Thank you!
Try choosing `Each sample` box under "Setup" in the [JMS Subscriber][1]: [![enter image description here][2]][2] The values of JMeter variables can be observed in [jmeter.log file][3] if you [increase JMeter logging verbosity to debug level][4]. You can also download or checkout [JMeter source code][5], open the project in your favourite IDE, set the breakpoint in [JMSSampler.browseQueueForConsumption()][6] function and see the actual JMS Selector value. [1]: https://jmeter.apache.org/usermanual/component_reference.html#JMS_Subscriber [2]: https://i.stack.imgur.com/MlGXf.png [3]: https://jmeter.apache.org/usermanual/get-started.html#logging [4]: https://www.blazemeter.com/blog/jmeter-logging [5]: https://github.com/apache/jmeter [6]: https://github.com/apache/jmeter/blob/rel/v5.6.3/src/protocol/jms/src/main/java/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java#L328
This is my code: ``` system_prefix = """You are an agent designed to interact with a SQL database. Given an input question, create a syntactically correct {dialect} query to run, then look at the results of the query and return the answer. Unless the user specifies a specific number of examples they wish to obtain, always limit your query to at most {top_k} results. You can order the results by a relevant column to return the most interesting examples in the database. Never query for all the columns from a specific table, only ask for the relevant columns given the question. You have access to tools for interacting with the database. Only use the given tools. Only use the information returned by the tools to construct your final answer. You MUST double check your query before executing it. If you get an error while executing a query, rewrite the query and try again. DO NOT make any DML statements (INSERT, UPDATE, DELETE, DROP etc.) to the database. If the question does not seem related to the database, just return "I don't know" as the answer.""" few_shot_prompt = FewShotPromptTemplate( example_selector=example_selector, example_prompt=PromptTemplate.from_template( "User input: {input}\nSQL query: {query}" ), input_variables=["input", "dialect", "top_k"], prefix=system_prefix, suffix="", partial_variables={"format_instructions": new_parser.get_format_instructions()}, ) full_prompt = ChatPromptTemplate.from_messages( [ SystemMessagePromptTemplate(prompt=few_shot_prompt), ("human", "{input}"), MessagesPlaceholder("agent_scratchpad"), ] ) agent = create_sql_agent( llm=llm, db=db, prompt=full_prompt, verbose=True, agent_type="openai-tools", ) ```