instruction
stringlengths
0
30k
|spring-boot|apache-kafka|junit|embedded-kafka|
When I try to fetch from a query on a single table I get an associated array where Key is a name of column. But when I try to `JOIN` another table's columns on a query I get an array which only contains a key 'row' and a string value which looks like `(value1,value2,value3,...,valueN)`, without column names. How do I get associated arrays when I join data from 2+ tables? example of my query: ``` SELECT (item.id, item.category_id, item_category.letter, item_category.name_eng) FROM item LEFT JOIN item_category ON item_category.letter = item.category_id WHERE item.id = :id ``` I get this from that query: ``` Array ( [row] => (2314,"B","B","Name") ) ``` I would like to get: ``` Array ( [id] => 2314, [category_id] => "B", [letter] => "B", [name_eng] => "Name" ) ``` I've tried to explode an output string with ',' separator, but it's a dumb idea cuz if i got ',' in table data I split it into different array elements
Your first understanding is right with: heroes = HEROES Now: heroes : Hero [ ]; Here `Hero` represents a class which holds certain properties. By this line, you are telling the TypeScript compiler that the `heroes` variable will hold a list of objects having type of `Hero` (custom or user defined type). In OOP world `class` is a user defined dataType and accordingly you can declare any variable with that Type. Please note, you can declare (:) any variable with Type, you can't assign (=) Type (in TypeScript) but you can assign that Type of data to variable. So here you can't use `=`.
You have no read access to /mnt/media_rw. All files access has no effect on it.
Pass column name to lpSolve obj from drop down. OptTotal total is a column name for optimisation, I would like a drop down box to select which column to optimise against but can not figure it out. obj <- rv$products$OptTotal I would like something like the below obj <- rv$products$get(Input$ColumnName) This does not work but explains what I would like.
Pass column name to lpSolve obj from drop down
|r|shiny|lpsolve|
``` node:9720) [DEP0170] DeprecationWarning: The URL http://proxy.example.com:port is invalid. Future versions of Node.js will throw an error. (Use `node --trace-deprecation ...` to show where the warning was created) (node:5040) [DEP0170] DeprecationWarning: The URL http://proxy.example.com:port is invalid. Future versions of Node.js will throw an error. (Use `node --trace-deprecation ...` to show where the warning was created) npm ERR! code ERR_INVALID_URL npm ERR! Invalid URL ```
NPM packages installation error - it's not only about vite it's same problem during installing any packages
I would like to mutate a column in a df (1), based off a data in df (2) in relation to the data that exist in both df (1) and (2). Like join function. So I have this dataframe (df): ``` df <- structure(list(orientasi = c("gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay", "gay"), tahun = c(1980L, 1981L, 1982L, 1983L, 1984L, 1985L, 1986L, 1987L, 1988L, 1989L, 1990L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1991L, 1992L, 1993L, 1993L, 1993L, 1993L, 1993L, 1993L, 1993L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1994L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1995L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L, 1996L), token = c("абагайтуйская", "абагайтуйская", "абагайтуйские", "абагайтуйский", "абагайтуйским", "абагайтуйских", "абагайтуйское", "абагайтуйской", "абагайтуйскому", "абагайтуйскую", "cгей", "славяне", "", "эхо", "татарстане", "донесшийся", "менска", "лихой", "клич", "гей", "славяне", "вызвал", "многонациональной", "республике", "ответного", "энтузиазма", "character", "своему", "сексуальному", "поведению", "ягей", "комбайн", "садомазохист", "", "рассказывают", "двери", "женских", "туалетов", "журфака", "изложена", "слезная", "история", "девушки", "влюбившейся", "гея", "cих", "брак", "закончился", "течение", "элтон", "джон", "понял", "бисексуал", "настоящий", "гей", "отныне", "женщины", "интересуют", "похоже", "начинает", "обрушиваться", "вторая", "пирамида", "мавроди", "сексменьшинствами", "оказалось", "значительно", "пресловутая", "", "права", "отчаянно", "бьются", "активистыгеи", "лесбиянкитолько", "", "мужчин", "", "женщин", "cгеи", "счастливо", "сложилась", "песнь", "матерого", "гея", "элтона", "джона", "дуэте", "именитым", "трансвеститом", "рупол", "клип", "жизнерадостную", "парочку", "пытается", "разлучить", "какнибудь", "ущемить", "голубоватые", "права")), row.names = c(NA, 100L), class = "data.frame") ``` And this dataframe (df2) ``` df2 <- structure(list(token = c("абалмасовыми", "абалмасовых", "абалымов", "абалымова", "абалымове", "абалымовой", "абалымову", "абалымовы", "абалымовым", "абалымовыми", "абалымовых", "абальян", "абальяна", "абальянам", "абальянами", "абальянах", "абальяне", "абальянов", "абальяном", "абальяну", "абальяны", "абаляев", "абаляева", "абаляеве", "абаляевой", "абаляеву", "абаляевы", "абаляевым", "абаляевыми", "абаляевых", "абам", "абами", "абанагроавтотранс", "абанагроавтотранса", "абанагроавтотрансам", "абанагроавтотрансами", "абанагроавтотрансах", "абанагроавтотрансе", "абанагроавтотрансов", "абанагроавтотрансом", "абанагроавтотрансу", "абанагроавтотрансы", "абанагропромхимией", "абанагропромхимии", "абанагропромхимию", "абанагропромхимия", "абандон", "абандона", "абандонам", "абандонами", "абандонах", "абандоне", "абандонов", "абандоном", "абандону", "абандоны", "абанская", "абанские", "абанский", "абанским", "абанскими", "абанских", "абанского", "абанское", "абанской", "абанском", "абанскому", "абанскою", "абанскую", "абарин", "абарина", "абарине", "абариной", "абарину", "абарины", "абариным", "абариными", "абариных", "абарчук", "абарчука", "абарчукам", "абарчуками", "абарчуках", "абарчуке", "абарчуки", "абарчуков", "абарчуком", "абарчуку", "абаршалин", "абаршалина", "абаршалине", "абаршалиной", "абаршалину", "абаршалины", "абаршалиным", "абаршалиными", "абаршалиных", "абас", "абаса", "абасали", "абасалиевен" ), lemma = c("абалмасовы", "абалмасовы", "абалымов", "абалымов", "абалымов", "абалымова", "абалымов", "абалымовы", "абалымов", "абалымовы", "абалымовы", "абальян", "абальян", "абальяны", "абальяны", "абальяны", "абальян", "абальяны", "абальян", "абальян", "абальяны", "абаляев", "абаляев", "абаляев", "абаляева", "абаляев", "абаляевы", "абаляев", "абаляевы", "абаляевы", "аба", "аба", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагроавтотранс", "абанагропромхимия", "абанагропромхимия", "абанагропромхимия", "абанагропромхимия", "абандон", "абандон", "абандон", "абандон", "абандон", "абандон", "абандон", "абандон", "абандон", "абандон", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абанский", "абарин", "абарин", "абарин", "абарина", "абарин", "абарины", "абарин", "абарины", "абарины", "абарчук", "абарчук", "абарчуки", "абарчуки", "абарчуки", "абарчук", "абарчуки", "абарчуки", "абарчук", "абарчук", "абаршалин", "абаршалин", "абаршалин", "абаршалина", "абаршалин", "абаршалины", "абаршалин", "абаршалины", "абаршалины", "абас", "абас", "абасали", "абасалиевна" )), sorted = "token", row.names = 1000:1100, class = c("data.table", "data.frame")) ``` How can I mutate the lemma column in df2, based on the token column in both df and df2? This is the result that I expect: ``` orientatie jaar lemma 1 gay 1980 абагайтуйский 2 gay 1981 абагайтуйский 3 gay 1982 абагайтуйский 4 gay 1983 абагайтуйский 5 gay 1984 абагайтуйский ... ``` I have tried to use the join function: ``` df_gelemmatiseerd <- df %>% inner_join(df2, by = "token", relationship = "many-to-many") ``` But it retrieved me funky result. Your help is appreciated, thank you!
If exist a way to migrate project developed in Android Studio to MAUI? I would like that all activities, resources and android code will be placed into MAUI project structure.
|php|html|wordpress|woocommerce|dokan|
null
Color pulse broken on linear gradient. How to fix "@keyframe" to pulse background of a button?
By default, Pillow will place the ***top-left*** corner of your text at the coordinates you specify with `ImageDraw.text()`. But you seem to want the text placed so that its horizontal middle and vertical middle are placed at the location you specify. So, you need to set the horizontal and vertical anchor to *"middle"* with: I1.text(..., anchor='mm') See manual [here][1]. --- Here are examples of drawing the same text, specifying the same (x,y) but using different anchors: * Red anchored at left baseline * Green anchored at right ascender * Blue anchored at the midpoint both vertically and horizontally I added a white cross showing the (x,y) position at which the text is drawn. #!/usr/bin/env python3 from PIL import Image, ImageDraw, ImageFont # Define geometry w, h = 400, 400 cx, cy = int(w/2), int(h/2) # Create empty canvas and get a drawing context and font im = Image.new('RGB', (w,h), 'gray') draw = ImageDraw.Draw(im) font = ImageFont.truetype('/System/Library/Fonts/Monaco.ttf', 64) # Write some text with the various anchors text = 'Hello' # Red anchored at left baseline draw.text(xy=(cx, cy), text=text, font=font, fill='red', anchor='ls') # Green anchored at right ascender draw.text(xy=(cx, cy), text=text, font=font, fill='lime', anchor='ra') # Blue anchored at vertical and horizontal middle draw.text(xy=(cx, cy), text=text, font=font, fill='blue', anchor='mm') # Draw white cross at anchor point (cx,cy) draw.line([(cx-3,cy),(cx+4,cy)], 'white', width=2) draw.line([(cx,cy-3),(cx,cy+4)], 'white', width=2) im.save('result.png') [![enter image description here][2]][2] [1]: https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html#PIL.ImageDraw.ImageDraw.text [2]: https://i.stack.imgur.com/Vtw0c.png
It means that you need to pass the pointer `a` defined in `main` to the function `fn` by reference. In C passing by reference means passing an object indirectly through a pointer to it. Thus dereferencing the passed pointer the function will have a direct access to the object pointed to by the pointer and can change it. void fn(char **n) { /* * imagine this variable 'b' is * a part of a structure of * some library */ char *b = "hello, world!"; *n = b; } And in main you need to write fn( &a ); Pay attention to that the pointer `a` will be valid after the function call because it points to a string literal defined in `fn` and string literals have static storage duration.
I need some brainstorming on this issue. So the problem is I have a list of urls and they are all news articles. I need to scrape the published date of the news articles. The problem is that only a few of them articles have a date written in date tag in html and most of them has date written in different tags. Now I am unable to find a generic approach to get date from all the urls because they all have dates written in different tags. A few examples of published dates of the articles: 1. <div style="vertical-align: bottom; float:left; width:45%;"><b>As on: June 19, 2023 </b><br><br><br></div> 2. <ul> <li>Updated Mar 14, 2024, 7:25 AM IST</li> </ul> How can I identify these dates? One solution can be that I use regex to get dates but it will fetch dates written in the article as well. It won't be able to distinguish between the published date and some random date written inside of the article.
I'm trying to convert a date field to a format that represents the number of days since 1999. I want to convert 03-25-2024 to 45376 like the General cells format in MS Excel. I've tried converting the date to an int, get error message, converting/casting date to vchar and then converting to int. Here are some samples of the coding I tried SELECT CONVERT(int,cast('02-02-2024' as date)); output = error message CONVERT( int, CONVERT( nchar(8), cd_commission_statement_date, 112)) as comdt_conv, cd_commission_statement_date has a data type of date in table. Here is the output of this example. 2024-03-01 = 20240301 This method works (not sure why), SELECT CONVERT(INT, GETDATE()), output 45376
Convert SQL Table date field to numeric value for days since 1999 like Excel
|sql|
For anyone else getting this API error code and unresolved by correcting/verifying permissions issues, note that header values are case-sensitive: a lowercase `bearer <token>` will produce error 250002 from UPS, whereas `Bearer <token>` should succeed if all else is good to go.
|pine-script|pine-script-v5|
> The [`ValueFromPipelineByPropertyName`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7.4#valuefrompipelinebypropertyname-argument) argument indicates that the parameter accepts input from a property of a pipeline object. The object property must have the same name or alias as the parameter. The binding happens by pipeline already, you don't need to manually pass the argument, moreover, `$_` is only automatically populated in the context of scriptblock and your second statement has no scriptblock. ```sh $obj = [pscustomobject]@{ id = 4444 } # works, the value of `id` is taken from pipeline $obj | Get-Process ``` As to why the `ForEach-Object` example works, simply because you're passing the value of `id` property as argument to the `-Id` parameter, it is pretty much the same as: ```sh Get-Process -Id $obj.Id ```
I was able to get it to work: indicator('GT Pivot Lines', shorttitle='GT Pivots Lines', overlay=true) lenH = input.int(title='Length High', defval=50, minval=1) lenL = input.int(title='Length Low', defval=50, minval=1) fun(src, len, isHigh, _style, _yloc, _color) => p = nz(src[len]) isFound = true for i = 0 to len - 1 by 1 if isHigh and src[i] > p isFound := false isFound if not isHigh and src[i] < p isFound := false isFound for i = len + 1 to 2 * len by 1 if isHigh and src[i] >= p isFound := false isFound if not isHigh and src[i] <= p isFound := false isFound if isFound line.new(bar_index[len], p, bar_index, p, color=_color, width=2, extend=extend.right) fun(high, lenH, true, line.style_dashed, yloc.abovebar, color.lime) fun(low, lenL, false, line.style_dashed, yloc.belowbar, color.red)
ta,pivothigh and ta.pivotlow will plot labels on pivot points, but I would rather draw hlines on the pivot prices. I tried modifying the standard script thus: ``` //@version=5 indicator("Pivot Lines", max_lines_count=500, overlay=true) leftBars = input.int(50) rightBars=input.int(50) ph=float(na) pl=float(na) ph := ta.pivothigh(high, leftBars, rightBars) pl := ta.pivotlow(close, leftBars, rightBars) hline(ph, color=color.orange, linestyle=hline.style_dotted, linewidth=2) hline(pl, color=color.orange, linestyle=hline.style_dotted, linewidth=2)` ``` But this is throwing an error. Any thoughts? (I tried altering the code such that ph and pl variables are 'float', but that didn't solve the problem...) I believe the issue is that hline can't accept series data. In that case, anyone have a better idea of how to solve the problem?
I see this message in log file of windows `mks-vmdb vmdb requested a screenshot svga mkssecreenshotmgr taking a screenshot ` Anyone have explanation for this log And i need to know if could this related to any suspicious activity Thanks for the explanation
mkssecreenshotmgr taking a screenshot
|windows|operating-system|vmware|
null
Look below. **Problem :-** ```javascript <Link to={`/product/${product._id}`}> {/* here we are using link in place of a & to in place of href */} ``` Given links point to `/product/${product._id}`. But in django you don't have urls that start with `/product`. You only have urls start with `/api`. **Answer :-** Use links like below. ```javascript <Link to={`/api/product/${product._id}`}> {/* here we are using link in place of a & to in place of href */} ``` ___ Info :- ```react <Link to={`/api/product/${product._id}`}> // Are absolute paths <Link to={`api/product/${product._id}`}> // Are relative paths ```
When managing sessions using spring-session-data-redis, I think the session ID is returned in a cookie named SESSION. (FYI:https://spring.pleiades.io/spring-session/reference/guides/boot-redis.html) I would like to perform some processing using the session ID returned by a cookie, but I don't know how to obtain this session ID. I referred to the following article, but it seems that the value in redis and the value returned by cookie are different values ​​due to base64 encoding, so I wonder if it is not enough to simply get the value in redis. I thought. https://qiita.com/tttol/items/4a50ed1452488d5e6548 To be honest, this is my first time using spring-session, so I'm not sure if I understand the above. Could you please tell me how to obtain the session ID? I searched on google but couldn't find it.
Finally, I've found a solution to this problem without utilizing the redirect and refreshListenable properties of GoRouter. The concept involves creating a custom redirection component. Essentially, authStateChanges are globbally listened, and upon any change in AuthenticationState, we navigate to our redirection component. In my implementation, this redirection component is a splash page. From there, you can proceed to redirect to the desired page. Here is my code Router Class class AppRouter { factory AppRouter() => _instance; AppRouter._(); static final AppRouter _instance = AppRouter._(); final _config = GoRouter( initialLocation: RoutePaths.splashPath, routes: <RouteBase>[ GoRoute( path: RoutePaths.splashPath, builder: (context, state) => const SplashPage(), ), GoRoute( path: RoutePaths.loginPath, builder: (context, state) => const LoginPage(), ), GoRoute( path: RoutePaths.registrationPath, builder: (context, state) => const RegistrationPage(), ), GoRoute( path: RoutePaths.homePath, builder: (context, state) => const HomePage(), ), ], ); GoRouter get config => _config; } class RoutePaths { static const String loginPath = '/login'; static const String registrationPath = '/register'; static const String homePath = '/home'; static const String splashPath = '/'; } Authentication Bloc class AuthenticationBloc extends Bloc<AuthenticationEvent, AuthenticationState> { AuthenticationBloc( this.registerUseCase, this.loginUseCase, ) : super(const AuthenticationSplash()) { on<AuthenticationStatusCheck>((event, emit) async { await emit.onEach( FirebaseAuth.instance.authStateChanges(), onData: (user) async { this.user = user; if (state is! AuthenticationSplash) { emit(const AuthenticationSplash()); } await Future.delayed(const Duration(seconds: 1), () { if (user == null) { emit(const AuthenticationInitial()); } else { emit(AuthenticationSuccess(user)); } }); }, ); }); Main final router = AppRouter().config; return MultiBlocProvider( providers: [ BlocProvider<AuthenticationBloc>( create: (context) => sl<AuthenticationBloc>()..add(const AuthenticationStatusCheck()), ), ], child: BlocListener<AuthenticationBloc, AuthenticationState>( listenWhen: (previous, current) => previous.runtimeType != current.runtimeType, listener: (context, state) { if (state is AuthenticationSplash) { router.go(RoutePaths.splashPath); } }, child: MaterialApp.router( title: 'Hero Games Case Study', theme: ThemeData.dark( useMaterial3: true, ), routerConfig: router, ), ), ); splash_page return BlocListener<AuthenticationBloc, AuthenticationState>( listener: (context, state) { if (state is AuthenticationSuccess) { context.go(RoutePaths.homePath); } else if (state is AuthenticationInitial) { context.go(RoutePaths.loginPath); } }, child: Scaffold( appBar: AppBar( title: const Text('Splash Page'), ), body: const Center( child: CircularProgressIndicator(), ), ), ); NOTE: If you will use deeplinking, you can add the code below to your GoRouter redirect: (context, state) { if (context.read<AuthenticationBloc>().user == null && (state.fullPath != RoutePaths.loginPath && state.fullPath != RoutePaths.registrationPath && state.fullPath != RoutePaths.splashPath)) { return RoutePaths.splashPath; } return null; },
In EF terms it seems like it could just be: var d = db.Users .OrderByDescending(u => u.Xp) .AsEnumerable() .Select((u, i) => new { Rank=i+1, User = u }) .ToDictionary(at => at.Rank); You list all your users out of the DB in order of XP, and you use the overload of `Select((user,index)=>...)` to assign the rank (the index + 1) and for convenience let's put them in a dictionary indexed by rank Now you have a dictionary you can keep and repeatedly look up in where, for any given user, you can get the surrounding users by the rank of the user you already know: var user = d.Values.FirstOrDefault(u => u.User.Name == "user6"); var prev = d[user.Rank - 1]; var next = d[user.Rank + 1]; You need some code to prevent a KeyNotFoundException if you find the top or bottom ranked user because if you find the user with Rank 1 by name, you cannot retrieve the user with Rank 0 (they don't exist). You didn't say what to do in this situation in your original post, you can use ContainsKey to test if the dictionary contains a particular rank, or you can use GetValueOrDefault, or TryGetValue to attempt to get a user - these methods don't crash if the user isn't found but you will need to decide what to do if they aren't
Using a same-named element (such as your `name` example) as a child of two ***different*** parent elements such as `person` and `car` is natural and fully supported by XML and its related standards: - DTD supports it: ``` <!DOCTYPE people_list [ <!ELEMENT person (name, age)> <!ELEMENT car (name, price)> <!ELEMENT name (#PCDATA)> <!ELEMENT age (#PCDATA)> <!ELEMENT price (#PCDATA)> ]> ``` - XSD fully supports defining same-named elements with different parents. See [Basic Concepts: The Purchase Order][1] in the XSD primer. - XPath (and therefore XSLT) differentiates between `/stuff/person/name` versus `/stuff/car/name`. - Etcetera. Note that the content models of `name` could even be different for the `name` of a `person` vs the `name` of a `car`. *Well-formed* XML allows the content models to differ for same-named elements with the ***same*** parent even, but XML schemas (such as DTD and XSD) generally do not support the definition of such elements, so such XML would generally not be able to be considered *valid*. See also -- - https://stackoverflow.com/q/134494/290085 [1]: https://www.w3.org/TR/xmlschema-0/#PO
While using Gemini API, we need to take care of SAFETY Settings. These settings are used to avoid dagenrous/inappropriate being delivered. You can add these like below from google.generativeai.types import HarmCategory, HarmBlockThreshold model = genai.GenerativeModel(model_name='gemini-pro-vision') response = model.generate_content( ['Do these look store-bought or homemade?', img], safety_settings={ HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_LOW_AND_ABOVE, } ) Ref: To find all the safety settings, please check the documentation https://ai.google.dev/docs/safety_setting_gemini
I have stuck with a pretty simple problem - I can't communicate with process' stdout. The process is a simple stopwatch, so I'd be able to start it, stop and get current time. The code of stopwatch is: ```python import argparse import time def main() -> None: parser = argparse.ArgumentParser() parser.add_argument('start', type=int, default=0) start = parser.parse_args().start while True: print(start) start += 1 time.sleep(1) if __name__ == "__main__": main() ``` And its manager is: ```python import time import asyncio class RobotManager: def __init__(self): self.cmd = ["python", "stopwatch.py", "10"] self.robot = None async def start(self): self.robot = await asyncio.create_subprocess_exec( *self.cmd, stdout=asyncio.subprocess.PIPE, ) async def stop(self): if self.robot: self.robot.terminate() await self.robot.wait() async def state(self): print("communicating...") stdout, stderr = await self.robot.communicate() print(stdout, stderr) async def main(): robot = RobotManager() await robot.start() time.sleep(5) await robot.state() time.sleep(5) await robot.stop() asyncio.run(main()) ``` After running python manager.py it hangs when getting state of robot. I tried to replace `proc.communicate()` with `proc.stdout.readline()` but nothing changed.
Here's a better and more general way to handle this. In addition, it won't strip out "#" that are in the middle of a string, as yours would. This relies on the fact that a ### header must be followed by a space. ``` function render(md){ let code = ""; let mdLines = md.split('\n'); for(let i = 0; i < mdLines.length; i++){ if(mdLines[i][0] == "#") { // We have a header. How many are there? let s = mdLines[i].indexOf(" ") if( mdLines[i].slice(0,s) == '#'.repeat(s) ) code += "<h"+s+">" + mdLines[i].slice(s+1) + "</h"+s+">"; else code += mdLines[i]; } else code += mdLines[i]; }; return code; } let text1 = "## he#llo \n there \n # yooo" let text2 = "# he#llo \n there \n ## yooo" console.log(render(text1)); console.log(render(text2)); ``` Output: ``` timr@Tims-NUC:~/src$ node x.js <h2>he#llo </h2> there # yooo <h1>he#llo </h1> there ## yooo timr@Tims-NUC:~/src$ ``` ## Followup Here's what you apparently MEANT to test with: ``` let text1 = "## he#llo\nthere\n# yooo" let text2 = "# he#llo\nthere\n## yooo" ``` And here's the output: ``` timr@Tims-NUC:~/src$ node x.js <h2>he#llo </h2>there<h1>yooo </h1> <h1>he#llo </h1>there<h2>yooo </h2> timr@Tims-NUC:~/src$ ```
**I fixed it** I realized CMake was breaking it. I uninstalled it and it fixed it. WEIRD?
I accessed functions.php file in wordpress folder and commented out the last section of my code which is to return JSON response. After saving the file, I accessed the file on Wordpress and managed to continue editing it!!!!
I have a login which works through Firebase, I am implementing the logic so that the email is verified after creating the account[enter image description here](https://i.stack.imgur.com/1qGPD. jpg)mail arrives successfully [enter image description here](https://i.stack.imgur.com/4Tmke.jpg) and is verified successfully.[](https://i.stack.imgur.com/B3Xf4 .png)account is created successfully [](https://i.stack.imgur.com/YMbm9.jpg)but the app does not take the change and does not send me to the next screen I tried using chatgpt, I'm new to flutter but I can't figure out how to solve it. Ok, I'm going to share the repository and more complete information with you: User registration flow: The user enters their email, password, and password confirmation on the SignUpScreen screen. The _signUpLogic.signUpWithEmailAndPassword function is called to register the user. If the registration is successful, a verification email is sent to the user and they navigate to the EmailVerificationPage screen. The user must verify their email by clicking on the sent link. Once the email is verified, the user is redirected to the CreateUser screen to complete their profile. git repo: https://github.com/CentenoDev/ITWANA-APP/tree/master
As noted in the comments, an `awk` solution is simple. For example: ``` awk '!index($0,q) || ++c>n' n=3 q=please "$filename" ``` --- It is not very convenient to try to count with `sed`, although it is possible. Parameterising arguments is also complicated. Ignoring both those issues, here is a sed script to delete the first 3 occurrences of lines containing "please": ``` sed ' 1 { x s/^/.../ x } /please/ { x s/.// x t del b :del d } ' "$filename" ``` Applying either script to: ``` 1 leave this line alone 2 leave this line alone 1 please delete this line 3 leave this line alone 2 please delete this line 4 leave this line alone 5 leave this line alone 3 please delete this line 6 leave this line alone 4 please leave this line alone 7 leave this line alone ``` produces: ``` 1 leave this line alone 2 leave this line alone 3 leave this line alone 4 leave this line alone 5 leave this line alone 6 leave this line alone 4 please leave this line alone 7 leave this line alone ```
You want to modify `n` value itself, not the data pointed by it. So * `fn` prototype should be `void fn(char ** n)` * the assignment should be `*n = b` or better ` n* = strddup (...);` * the call sholud be `fn(&a);`
**update 2024**, remove any style you have in the `thead` tag and give those style to the tr inside `thead` to make the code below work: .table-responsive thead > tr { display: table-row; /* Revert to default display value */ position: sticky; /* Fix the position of the table header */ top: 0; /* Position it at the top of the container */ z-index: 999; /* Ensure it's above other content */ }
|php|wordpress|woocommerce|custom-wordpress-pages|dokan|
Although I am experienced developer, I am very new to mobile app. I am wondering if it is possible to create application which will communicate between devices from Family Link group. In principle my requirement is to create application integrated between mine and kids devices. However I would like to avoid classic server-client integration (I don't want to build a server for this purpose). I know it is quite generic question, but maybe someone can point me out where I can start. I did some quick research, but did not find any close hits. BTW - I want to use Visual Studio and Xamarin for this purpose.
Is there a way to use Family Link group in my own application?
|mobile|client-server|
|php|wordpress|woocommerce|custom-wordpress-pages|dokan|
I would use a simple loop: ``` out = (np.array([mapping[l] for l in map(tuple, input_array.reshape(-1, 2))]) .reshape(input_array.shape[:-1]) ) ``` Or, if you expect many duplicated values, you could reduce the mapping step to the unique values, although the bottleneck being `np.unique` this might not be much faster if `n` is large: ``` tmp, idx = np.unique(input_array.reshape(-1, 2), return_inverse=True, axis=0) out = (np.array([mapping[tuple(l)] for l in tmp])[idx] .reshape(input_array.shape[:-1]) ) ``` Output: ``` array([[0.7, 0.8], [0.7, 0.9]]) ``` ##### timings On (2, 2, 2): ``` # original 86 µs ± 11.4 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each) # this answer: simple loop 7.08 µs ± 811 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) # this answer: only mapping unique values 60.7 µs ± 1.6 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each) ``` On (200, 200, 2): ``` # original 33.7 ms ± 4.42 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) # this answer: simple loop 45.7 ms ± 3.15 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) # this answer: only mapping unique values 30 ms ± 854 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) ``` For large `m` (or `n`) (2000, 2, 2): ``` # original 2.78 ms ± 366 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) # this answer: simple loop 4.54 ms ± 191 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) # this answer: only mapping unique values 2.3 ms ± 6.19 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) ``` For large `m` and `n` (e.g. (2000, 2000, 2)): ``` # original 4.5 s ± 67.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # this answer: simple loop 4.29 s ± 35.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # this answer: simple loop 4.31 s ± 108 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) ```
[enter image description here](https://i.stack.imgur.com/MkbCI.png) I'm beginning C. I tried to print "helloworld" but it has error I used visual studio code(Mac). installed C/C++,Code runner I just follow the C lecture, but occurred error. anyone know solution this error? error message = ld: Undefined symbols: _main, referenced from: <initial-undefines> clang: error: linker command failed with exit code 1 (use -v to see invocation)
i like to get the parameters of running java process running inside pod when bash ssh inside the container i cant do bash-4.4$ ps bash: ps: command not found also looping thorw all proc's give me to much proceess ids with no hint regarding the java process im doing it using this : for di in $(ls -1 /proc/*); do echo "$di"; done result me 1106 running process which i can't do cat on them when running also when invoking : ash-4.4$ jcmd -l bash-4.4$ Still nothing
How to get java running parameters from spring boot running inside container in pod where no ps exist
|java|docker|kubernetes|process|pods|
I have to work with the learning history of a Keras model. This is a basic task, but I've measured the performance of the Python built-in min() function, the numpy.min() function, and the numpy ndarray.min() function for list and ndarray. The performance of the built-in Python min() function is nothing compared to that of Numpy for ndarray (for list performance is almost equal). However, the ndarray.min() function is almost twice as fast as numpy.min(). The ndarray.min() documentation refers to the numpy.amin() documentation, which according to the numpy.amin docs, is an alias for numpy.min(). Therefore, I assumed that numpy.min() and ndarray.min() would have the same performance. However, why is the performance of these functions not equal? ``` from timeit import default_timer import random a = random.sample(range(1,1000000), 10000) b = np.array(random.sample(range(1,1000000), 10000)) def time_mgr(func): tms = [] for i in range(3, 6): tm = default_timer() for j in range(10**i): func() tm = (default_timer()-tm) / 10**i * 10e6 tms.append(tm) print(func.__name__, tms) @time_mgr def min_list(): min(a) @time_mgr def np_min_list(): np.min(a) @time_mgr def min_nd(): min(b) @time_mgr def np_min_nd(): np.min(b) @time_mgr def np_nd_min(): b.min() ``` output, time in mks: ``` min_list [520.7690014503896, 515.3326001018286, 516.221239999868] np_min_list [2977.614998817444, 3009.602500125766, 3014.1312699997798] min_nd [2270.1649996452034, 2195.6873999442905, 2155.1631700014696] np_min_nd [22.295000962913033, 21.675399970263243, 22.30485000181943] np_nd_min [14.261999167501926, 12.929399963468313, 12.935079983435571] ```
I want to break the ternary operator into separate lines like this: ``` first < second ? return 1 : return 2 ``` But the SwiftLint configurations always tries to add extra indentation like this: ``` first < second ? return 1 : return 2 ``` I want to stop this default behaviour and tried the following with no luck: ``` indentation: conditional_indentation: none ``` So how can I prevent this? Or even better, how can I force the first style for the automatic formatter? Thanks in advanced.
I'm able to run the query without running into any issues. Test code I ran in BigQuery below. Perhaps there aren't any Processing_Method equal to 'Natural/Dry.' You can try a wildcard search and use NORMALIZE_AND_CASEFOLD(Processing_Method) like in example 2. WITH a AS ( SELECT 'Natural/Dry' AS Processing_Method UNION ALL SELECT 'Test') SELECT * FROM a WHERE Processing_Method='Natural/Dry' ----------------- WITH a AS ( SELECT 'natural/dry' AS Processing_Method UNION ALL SELECT 'Test') SELECT * FROM a WHERE NORMALIZE_AND_CASEFOLD(Processing_Method) like '%natural%dry%'
To bypass the error message, I've accessed functions.php file in wordpress folder and commented out the last section of my code which is to return JSON response. After saving the file, I accessed the file on Wordpress and managed to continue editing it!!!!
If you use NPOI in C#, you can write code like below: var imageRun = paragraph.CreateRun(); using (FileStream picData = new FileStream(imagePath, FileMode.Open, FileAccess.Read)) { imageRun.AddPicture(picData, (int)NPOI.XWPF.UserModel.PictureType.PNG, imagePath, Units.ToEMU(100), Units.ToEMU(100)); CT_Drawing drawing = imageRun.GetCTR().GetDrawingList().First(); CT_GraphicalObject graphicalobject = drawing.GetInlineArray(0).graphic; //Replace the newly inserted picture, add CTAnchor, set floating attribute, delete inline attribute CT_Anchor anchor = getAnchorWithGraphic(graphicalobject, "Seal", Units.ToEMU(120), Units.ToEMU(120), Units.ToEMU(50), Units.ToEMU(-80), true); drawing.anchor = new List<CT_Anchor>() { anchor };//Add floating attribute drawing.inline.RemoveAt(0);//R } static CT_Anchor GetAnchorWithGraphic(CT_GraphicalObject ctGraphicalObject, String deskFileName, int width, int height, int leftOffset, int topOffset, bool behind) { String anchorXML = "<wp:anchor xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" " + "simplePos=\"0\" relativeHeight=\"1\" behindDoc=\"" + ((behind) ? 1 : 0) + "\" locked=\"0\" layoutInCell=\"1\" allowOverlap=\"1\">" + "<wp:simplePos x=\"0\" y=\"0\"/>" + "<wp:positionH relativeFrom=\"page\">" + "<wp:posOffset>" + leftOffset + "</wp:posOffset>" + "</wp:positionH>" + "<wp:positionV relativeFrom=\"paragraph\">" + "<wp:posOffset>" + topOffset + "</wp:posOffset>" + "</wp:positionV>" + "<wp:extent cx=\"" + width + "\" cy=\"" + height + "\"/>" + "<wp:effectExtent l=\"0\" t=\"0\" r=\"0\" b=\"0\"/>" + "<wp:wrapNone/>" + "<wp:docPr id=\"1\" name=\"Drawing 0\" descr=\"" + deskFileName + "\"/><wp:cNvGraphicFramePr/>" + "</wp:anchor>"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(anchorXML); CT_Drawing drawing = CT_Drawing.Parse(xmlDoc, XWPFPictureData.NamespaceManager); CT_Anchor anchor = drawing.GetAnchorList().First(); anchor.graphic = ctGraphicalObject; return anchor; }
how to migrate native android studio project to MAUI?
|maui|
I'm using **Auto** mode in Blazor Web App. I tried to use `Authentication` and `Authorization` in the server project. But I cannot use authorization in the client project. I want to add `<AuthorizeView>` tag in some components exist in the client project. This tag is unknown in the client project. How can I use `<AuthorizeView>`tag in the client project?
Shows server is started at port 5500 but do not pop up the web browser. I tried every possible way to fix the problem but none helps out even gone through so many videos and tried but none worked.
Live server extension in VS Code works in background but do not pop the web browser
|visual-studio-code|
Application migrated from Spring 5 to String 6 and JDK 1.8 to 17. We are getting the following exception while starting the application in Azure. `2024-03-31T10:33:10 PID[6060] Error Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.web.SecurityFilterChain]: Factory method 'securityFilterChain' threw exception with message: This method cannot decide whether these patterns are Spring MVC patterns or not. If this endpoint is a Spring MVC endpoint, please use requestMatchers(MvcRequestMatcher); otherwise, please use requestMatchers(AntPathRequestMatcher). 2024-03-31T10:33:10 PID[6060] Error 2024-03-31T10:33:10 PID[6060] Error This is because there is more than one mappable servlet in your servlet context: {org.apache.jasper.servlet.JspServlet=[*.jspx, *.jsp], org.springframework.web.servlet.DispatcherServlet=[/]}. 2024-03-31T10:33:10 PID[6060] Error 2024-03-31T10:33:10 PID[6060] Error For each MvcRequestMatcher, call MvcRequestMatcher#setServletPath to indicate the servlet path. 2024-03-31T10:33:10 PID[6060] Error at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) 2024-03-31T10:33:10 PID[6060] Error at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) 2024-03-31T10:33:10 PID[6060] Error ... 77 more 2024-03-31T10:33:10 PID[6060] Error Caused by: java.lang.IllegalArgumentException: This method cannot decide whether these patterns are Spring MVC patterns or not. If this endpoint is a Spring MVC endpoint, please use requestMatchers(MvcRequestMatcher); otherwise, please use requestMatchers(AntPathRequestMatcher). 2024-03-31T10:33:10 PID[6060] Error 2024-03-31T10:33:10 PID[6060] Error This is because there is more than one mappable servlet in your servlet context: {org.apache.jasper.servlet.JspServlet=[*.jspx, *.jsp], org.springframework.web.servlet.DispatcherServlet=[/]}. 2024-03-31T10:33:10 PID[6060] Error 2024-03-31T10:33:10 PID[6060] Error For each MvcRequestMatcher, call MvcRequestMatcher#setServletPath to indicate the servlet path. 2024-03-31T10:33:10 PID[6060] Error at org.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry.requestMatchers(AbstractRequestMatcherRegistry.java:208) 2024-03-31T10:33:10 PID[6060] Error at org.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry.requestMatchers(AbstractRequestMatcherRegistry.java:276) 2024-03-31T10:33:10 PID[6060] Error at com.xx.app1.security.SecurityConfiguration.lambda$securityFilterChain$0(SecurityConfiguration.java:41) 2024-03-31T10:33:10 PID[6060] Error at org.springframework.security.config.annotation.web.builders.HttpSecurity.authorizeHttpRequests(HttpSecurity.java:1466) 2024-03-31T10:33:10 PID[6060] Error at com.xx.app1.security.SecurityConfiguration.securityFilterChain(SecurityConfiguration.java:40) 2024-03-31T10:33:10 PID[6060] Error at com.xx.app1.security.SecurityConfiguration$$SpringCGLIB$$0.CGLIB$securityFilterChain$1(<generated>) 2024-03-31T10:33:10 PID[6060] Error at com.xx.app1.security.SecurityConfiguration$$SpringCGLIB$$FastClass$$1.invoke(<generated>) 2024-03-31T10:33:10 PID[6060] Error at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) 2024-03-31T10:33:10 PID[6060] Error at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) 2024-03-31T10:33:10 PID[6060] Error at com.xx.app1.security.SecurityConfiguration$$SpringCGLIB$$0.securityFilterChain(<generated>) 2024-03-31T10:33:10 PID[6060] Error at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2024-03-31T10:33:10 PID[6060] Error at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) 2024-03-31T10:33:10 PID[6060] Error at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2024-03-31T10:33:11 PID[6060] Error at java.base/java.lang.reflect.Method.invoke(Method.java:568) 2024-03-31T10:33:11 PID[6060] Error at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) 2024-03-31T10:33:11 PID[6060] Error ... 78 more` ``` @Configuration @EnableWebSecurity @RequiredArgsConstructor public class SecurityConfiguration { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final UserService userService; @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http.csrf(AbstractHttpConfigurer::disable) .authorizeHttpRequests( request -> request.requestMatchers("/**").permitAll().anyRequest().authenticated()) .sessionManagement(manager -> manager.sessionCreationPolicy(STATELESS)) .authenticationProvider(authenticationProvider()) .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); http.cors(); return http.build(); } @Bean public PasswordEncoder passwordEncoder() { return new BCryptPasswordEncoder(); } @Bean public AuthenticationProvider authenticationProvider() { DaoAuthenticationProvider authProvider = new DaoAuthenticationProvider(); authProvider.setUserDetailsService(userService.userDetailsService()); authProvider.setPasswordEncoder(passwordEncoder()); return authProvider; } @Bean public AuthenticationManager authenticationManager(AuthenticationConfiguration config) throws Exception { return config.getAuthenticationManager(); } } ``` The application is working in Local system, only issue while starting in Azure. Tomcat 10.1 and JDK 17 are configured in Azure appservice
Issue while deploying Java Spring 6 application in Azure app service
|java|spring|azure|appservice|
null
I'm trying to connect to a nodejs socket.io server with c# using [this Client-CSharp](https://github.com/doghappy/socket.io-client-csharp) solution. And it connects when im using only "http"-protocol and NOT use `hostname`-argument in listen method. I use an SSL certificate and I get a 404 error for http requests (if from a browser, https is ok). But everything works with the socket. Exaple Working when nodejs server ``` server.listen(port, () => { console.log('running'); }); ``` .NET ``` var client = new SocketIOClass("http://serverdomain.com:6060"); ``` And not working when sometning on server/client side changes nodejs ``` const hostname = '127.0.0.1'; server.listen(port, hostname, () => { console.log('running'); }); ``` or https .NET ``` var client = new SocketIOClass("https://serverdomain.com:6060"); ``` How it works? And how critical is specifying the hostname? Does using HTTP in this case for sockets mean insecure transmission? I'm absolutely confused. Tried using different libraries but the end result is the same (remove hostname and its works).
Socket.io nodejs server .NET connection
|node.js|.net|websocket|socket.io|
null
How can i code in openpyxl for draggin formula filled down, similarly copy and paste values? xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You've used `struct Square` where you should have used `struct square` in the `Box` definition. Corrected: ```c typedef struct box { struct square** squares; /* array of Squares */ // ^ int numbers; int possible[9]; int solvable; struct box* next; // box, not Box } Box; ``` Another option is to `typedef` `Square` before `Box` and use `Square` in `Box`: ```c typedef struct square Square; typedef struct box { Square** squares; /* array of Squares */ int numbers; int possible[9]; int solvable; struct box* next; } Box; ``` Note that there is nothing called `struct Square` after these definitions. There is `struct square` and `Square`.
Creating custom history back and forwards buttons using a React hook
|reactjs|react-hooks|react-router-dom|browser-history|html5-history|
{"OriginalQuestionIds":[72241230],"Voters":[{"Id":882003,"DisplayName":"john"},{"Id":12002570,"DisplayName":"user12002570","BindingReason":{"GoldTagBadge":"c++"}}]}
|byobu|
As of pg8000 1.31.0, by default an [SSL connection will be attempted][1] using lenient settings, so it should work in the same way as psycopg. [1]: https://github.com/tlocke/pg8000#connect-to-postgresql-over-ssl
I've tried everything, it seems to me. But it always gives me error "Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured." These are my pom.xml and application.properties files. ``` ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>18</java.version> <maven.compiler.source>1.18</maven.compiler.source> <maven.compiler.target>1.18</maven.compiler.target> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.9</version> <relativePath/> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.20</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <version>RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>42.7.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.12.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.24</version> </path> </annotationProcessorPaths> </configuration> </plugin> </plugins> </build> ... ``` ``` #https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html spring.datasource.url=jdbc:postgresql:5432//localhost/gamestudio spring.datasource.username=<my username> spring.datasource.password=<my password> spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.hikari.maximumPoolSize=2 #spring.jpa.hibernate.ddl-auto=create-drop spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true ``` ``` spring.datasource.url=jdbc:postgresql://localhost:5432/gamestudio spring.datasource.username=<my username> spring.datasource.password=<my password> spring.jpa.hibernate.ddl-auto=<create | create-drop | update | validate | none> spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect ``` I changed my pom.xml several times, I even ckecked application.properties, I've tried two different methods at the end of this question, I don't really understand the difference, but nothing helped.
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. I'm using Postgresql
|spring|spring-boot|
null
I think this is what you are looking for : https://fractalideas.com/blog/making-react-and-django-play-well-together-hybrid-app-model/ It uses whitenoise and collectstatic The idea here is that you can build your React app, and once built, HTML is served as template by Django, and Whitenoise is used for the static files (js/css/svg etc)
{"OriginalQuestionIds":[23667086],"Voters":[{"Id":16540390,"DisplayName":"jabaa"},{"Id":-1,"DisplayName":"Community","BindingReason":{"DuplicateApprovedByAsker":""}}]}
Creating a module for this purpose is inevitable and not a strenuous task at all. All u need is a `package.json` with an `exports` field to limit which submodules can be loaded from within the package. From the [official Node.js docs](https://nodejs.org/api/packages.html#exports): > The "exports" field allows defining the entry points of a package when imported by name loaded via a node_modules lookup. It is an alternative to the "main" that can support defining subpath exports and conditional exports while encapsulating internal unexported modules ⚠️ Note that all paths defined in the `"exports"` must be relative file URLs starting with `./` except for the default one `.` (as mentioned in the official doc). So in your case, the `package.json` inside your `facade` folder would be: ```json { "name": "@facade", "private": true, "version": "0.0.0", "exports": { "./B.tsx": "./B.tsx" } } ``` Now the external code outside of the `facade` folder (a.k.a the `@facade` package) can only `import {B} from "@facade/B.tsx";`. Both `@facade/A.tsx` and `"@facade/C.tsx"` are inaccessible to the external code.
{"Voters":[{"Id":23917386,"DisplayName":"Казаков Денис"}],"DeleteType":1}
Disabling `mitm_http2` within `seleniumwire_options` as recommended by the seleniumwire author for similar issues: seleniumwire_options = { 'mitm_http2': False, } Did not work for me in this case. Disabling HTTP2 in my chromedriver instance is the workaround I settled for: chrome_options.add_argument('--disable-http2')
I'm trying to retrieve a parameter value from a config a file. (Get-Content C:\<ConfigFolder>\basic.conf | ConvertFrom-StringData)."FileLocation" The value of the "FileLocation" is "C:\temp". And, value printed on screen is; "C: emp" Looks like "\t" is parsed as a Tab. Is there a way avoid this and print the as original value as is?
How avoid \t being converted to Tab in Powershell
|powershell|
The spring boot plugin generates a unique structure by default: See [the Spring docs](https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html) for more details. You will need ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-loader</artifactId> </dependency> ``` Then you can use the Spring tooling to do something like this ```java File myJarFile = new File("./myspringbootdep.jar"); NestedJarFile jarFile = new NestedJarFile(myJarFile, "BOOT-INF/classes/"); Enumeration<JarEntry> e = jarFile.entries(); ArrayList<JarEntry> jarEntries = Collections.list(e); //This is needed to make URLs with `nested:` work org.springframework.boot.loader.net.protocol.Handlers.register(); URL[] urls = { JarUrl.create(myJarFile, "BOOT-INF/classes/") }; LaunchedClassLoader launchedClassLoader = new LaunchedClassLoader(false, urls, this.getClass().getClassLoader()); for(JarEntry je : jarEntries) { System.out.println(je.getName()); if(je.isDirectory() || !je.getName().endsWith(".class") || !je.getName().contains("example")){ continue; } //Replaces slashes with dots and remove .class Class c = launchedClassLoader.loadClass(je.getName().replaceAll("/", ".").replaceFirst("\\.class$", "")); System.out.println(c); } ```
Here's a better and more general way to handle this. In addition, it won't strip out "#" that are in the middle of a string, as yours would. This relies on the fact that a ### header must be followed by a space. ``` function render(md){ let code = ""; let mdLines = md.split('\n'); for(let i = 0; i < mdLines.length; i++){ if(mdLines[i][0] == "#") { // We have a header. How many are there? let s = mdLines[i].indexOf(" ") if( mdLines[i].slice(0,s) == '#'.repeat(s) ) code += "<h"+s+">" + mdLines[i].slice(s+1) + "</h"+s+">"; else code += mdLines[i]; } else code += mdLines[i]; }; return code; } let text1 = "## he#llo \n there \n # yooo" let text2 = "# he#llo \n there \n ## yooo" console.log(render(text1)); console.log(render(text2)); ``` Output: ``` timr@Tims-NUC:~/src$ node x.js <h2>he#llo </h2> there # yooo <h1>he#llo </h1> there ## yooo timr@Tims-NUC:~/src$ ``` ## Followup Here's what you apparently MEANT to test with: ``` let text1 = "## he#llo\nthere\n# yooo" let text2 = "# he#llo\nthere\n## yooo" ``` And here's the output: ``` timr@Tims-NUC:~/src$ node x.js <h2>he#llo</h2>there<h1>yooo</h1> <h1>he#llo</h1>there<h2>yooo</h2> timr@Tims-NUC:~/src$ ```
I have this app script code that first deletes any existing graphs then I want it to put the x-axis as xRange and the series as yValues (To find my ranges, I used some other functions but they work correctly and get my wanted ranges) (I want the graph on the Graph spreadsheet) ``` function createLineGraph(){ var ss = SpreadsheetApp.getActiveSpreadsheet(); var attendance = ss.getSheetByName("Attendance"); var graph = ss.getSheetByName("Graph"); // Delete any existing line charts in the sheet var chts=graph.getCharts(); for(var i=0;i<chts.length;i++){ graph.removeChart(chts[i]); } var xRange = attendance.getRange("B1:"+getColumnLetter(findTotalAttendanceColumn(attendance)-1+"1")); var yValues = attendance.getRange("B"+findTotalAttendanceRow(attendance)+":"+getColumnLetter(findTotalAttendanceColumn(attendance)-1+findTotalAttendanceRow(attendance))); } ``` For example: If the xRange was "hello","bye","idk" and the yValues were 2,8,5, then the line graph would look like this: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/mxdCx.png Could someone please tell me how to do it? Thanks
You can extract only the text through HTMl React Parser install it , and then import to the file . Later defining <JoditEditor ref = {editor} value = {content} config={config} onBlur={newContent => setContent(newContent)} onChange={newContent => {}} /> <div>HTMLReactParser(content)</div>
I have a small C++ program that writes a PWM period value to the following file on the BeagleBone Black: /sys/class/pwm/pwmchip5/pwm0/period The first time the program runs the file write succeeds. The file is opened with the O_WRONLY and O_NONBLOCK flags. The program closes the file descriptor before exiting. When I invoke the program a 2nd time, the write fails. I tried to write a value into the file afterwards with 'echo' on the command line but that fails too. If I reboot the board then I can run the program and it succeeds (the 1st time again). Is the file somehow being locked after the first run of the program?
Linux file write succeeds 1st time errors on 2nd try
You cannot have each class have "a field that is type of other class"; that would be a recursive definition. The compiler would not be able to make sense out of it, and it does not even make logical sense: it would result in an infinitely large data structure. The logical impossibility can be illustrated by the ["Print Gallery" lithograph by M.C. Escher](https://en.wikipedia.org/wiki/Print_Gallery_(M._C._Escher)), or better yet, by this awesome animation of the lithograph: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [![Animation based on Escher's "Print Gallery" Lithograph, 1956][1]][1] <sup>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Animation by B. de Smit and H. W. Lenstra - Source: [escherdroste.math.leidenuniv.nl](http://escherdroste.math.leidenuniv.nl/index.php?menu=animation)</sup><br/> <sup>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;based on [Escher's "Print Gallery" Lithograph, 1956](https://en.wikipedia.org/wiki/Print_Gallery_(M._C._Escher))</sup> (The animation shows a harbor, which contains a building, which contains a painting, which contains a harbor, which contains a building, which contains a painting... ad infinitum.) One of the two fields will have to be a *pointer*, (or a reference, which is nothing but an immutable pointer,) so as to break the recursive containment, and avoid the logical impossibility. Which brings us to the next problem: If class B is to contain an instance of class A, then obviously, A has to be declared before class B, so that A is already known to the compiler when compiling B. But if class A is declared before class B, how can we declare a pointer to B in A? Class B is not known yet at the time that A is compiled! The answer to this problem is a special construct known as *forward declaration* which exists precisely in order to accommodate situations like this. A forward declaration of class B looks like this: class B; All it is telling the compiler is that there will be a class called B. It does not tell the compiler anything about the contents of class B, so there is very little we can do with it, but we can do one thing: *declare pointers to B.* So, the full solution to the problem looks like this: (Note: I am omitting header guards for simplicity. Normally they are important, but they are irrelevant to the problem at hand.) file "A.h": /* This is called a "forward declaration". We use it to tell the compiler that the identifier "B" will from now on stand for a class, and this class will be defined later. We will not be able to make any use of "B" before it has been defined, but we will at least be able to declare pointers to it. */ class B; class A { /* We cannot have a field of type "B" here, because it has not yet been defined. However, with the forward declaration we have told the compiler that "B" is a class, so we can at least have a field which is a pointer to "B". */ B* pb; } file "B.h": #include "A.h" class B { /* the compiler now knows the size of "A", so we can have a field of type "A". */ A a; } [1]: https://i.stack.imgur.com/tpRpc.gif
How to prevent ternary operator indentation in swiftlint?
|conditional-operator|swiftlint|