How to Download Tkinter Posted: 31 Mar 2021 06:58 PM PDT I've been trying to use tkinter. I've followed all of the steps everywhere and have the updated version of python downloaded but every time I try to use the code: sudo apt-get install python3-tk or import tkinter as tk it just says command not found What do I do? |
asp.net core config vs console config project Posted: 31 Mar 2021 06:57 PM PDT We have DLL's added from the project and it is dependent on the App.config, It will work fine when I use the Console project because the config can be read and structure is something like this: But if I will try to add the DLL's and App.config on asp.net core project then looks like the problem is it is not reading anymore the App.config and gives me some error when I ran it. here the structure for asp.net core project: Any suggestion/comments why it doesn't work for asp.net core project. TIA |
Dartboard Simulator in Python 3 Posted: 31 Mar 2021 06:57 PM PDT I'm attempting to create a simple dart board program but I am new to python 3 and need someone to help me write it. Any help is appreciated thank you! The board should be a square with each side of one unit; The bull's eye should be a smaller square in the middle with each side of 0.5 units; The program should ask for the number of throws the user wants; The program should count the number of bull's eyes; The program should print the number of throws, the number of bull's eyes, and the percentage of darts thrown that hit the bull's eye. |
Python ordering when reading/printing a Sorted(items) Posted: 31 Mar 2021 06:56 PM PDT Say I have images of dogs in a directory with its name and numbering as: dog 1.jpg dog 2.jpg dog 3.jpg . . dog 11.jpg dog 12.jpg when I perform sorted(glob.glob('that_dir/*jpg')) and print , it returns: dog 1.jpg dog 10.jpg dog 11.jpg dog 12.jpg . . dog 8.jpg dog 9.jpg is there a way to make it return in order of dog 1.jpg, dog 2.jpg .. dog 12.jpg in this case? or is it wiser to avoid this numbering method altogether and use something like leading zeros instead? |
Closing unassigned file in Python -- Is it possible? Posted: 31 Mar 2021 06:56 PM PDT I am reading some data from a .txt file in Python using the following: fileData = open("file.txt", "rb").read() I know that you should always close opened files, and I assume in this case the file remains open. Is there a way to close the file without assigning it to a variable? I'd like to avoid: openedFile = open("file.txt", "rb") fileData = openedFile.read() openedFile.close() And also: with open("file.txt", "rb") as openedFile: fileData = openedFile.read() It might not be possible, in which case OK, but just making sure. Thanks! |
Model method that depends on DbContext Posted: 31 Mar 2021 06:56 PM PDT Context I have a model for representing comments that looks like the following: public class Comment { public int Id { get; set; } public int CommentId { get; set; } // Id of parent comment ... } In my DetailsModel class which is a subclass of PageModel , I have the following method for finding replies to a given comment: public IList<Comment> Replies(int comment_id) => _context.Comment.Where(comment => comment.CommentId == comment_id).ToListAsync().Result; I use it from a Razor page as follows: Model.Replies(reply.Id).Count This works fine. More object-oriented approach? In a more traditional object-oriented design, Replies might be a method on Comment . So finding the replies would look like this: reply.Replies() Moving the Replies method into Comment , we get: public class Comment { public int Id { get; set; } public int CommentId { get; set; } // Id of parent comment ... public async Task<IList<Comment>> Replies() { return await _context.Comment.Where(comment => comment.CommentId == Id).ToListAsync(); } } And now you can see the issue; Comment now has a dependency on the DbContext , which seems like a very odd arrangement. So my question is, is there a way to get Replies to be a method on Comment in a way that's idiomatic for ASP.NET Core / EF Core? |
Script ignoring ifs and validating any password Posted: 31 Mar 2021 06:57 PM PDT if(strcmp(cmd, "/opengate", true) == 0) { if( isnull( cmdtext ) ) return SendClientMessage( playerid, -1, "[ > ]: /opengate [Pass]" ); new szName[24], gate = -1; GetPlayerName( playerid, szName, 24 ); for( new i = 0; i != MAX_GATES; i++ ) if( GateInfo[i][gCreated] == 1 ) if( strval( cmdtext ) == GateInfo[i][gPassword] ) { gate = i; break; } if( gate != -1 ) { if( !IsObjectMoving( GateInfo[gate][gObject] ) ) { if( IsPlayerInRangeOfPoint( playerid, 10.0, GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ] ) ) { if( GateInfo[gate][gStatus] == GATE_STATE_CLOSED ) { MoveObject( GateInfo[gate][gObject], GateInfo[gate][gX], GateInfo[gate][gY], GateInfo[gate][gZ]-5.3, 7.0 ); SendClientMessage( playerid, -1, "[ > ] Correct password!" ); } else return SendClientMessage( playerid, -1, "Gate is already open ." ); } else return SendClientMessage( playerid, -1, "You are not close to any gate" ); } else return SendClientMessage( playerid, -1, Wait the gate response..." ); } else return SendClientMessage( playerid, -1, "[ > ] Incorrect Password" ); return 1; } I dont know why the code is igoring my IF's and validating any password :(, if anyone know how to solve this i will be grateful. |
Don't understand this unfamiliar syntax: arr1[ arr2[i] - 'a' ]++ Posted: 31 Mar 2021 06:57 PM PDT I am looking at a program that finds the frequency of strings entered. Comparison is made based on a string's ASCII value against the ASCII value of lowercase 'a'. I have implemented it; it works, albeit, with a bug, but essentially, I am ignorant of a particular line of code; for (int i = 0; i < strlen(arr2); i++) { // this line... arr1[ arr2[i] - 'a' ]++; } arr1 is arr1[26] = {0} , that is, all the letters of the alphabet are assigned an index and the array is initialised to zero, while arr2[] as a function argument, receives the stdin. How does the mysterious line of code work and what is it saying? The full code: #include <stdio.h> #include <string.h> #define ALEPH 26 void freq(char arr2[]); int main () { char * str; printf("\nCharacter Frequency\n" "--------------------\n"); // user input printf("\nEnter a string of characters:\n"); fgets(str, ALEPH, stdin); freq(str); return 0; } // Function Definiton void freq (char arr2[]) { // array for ascii characters initialised to 0 int arr1[ALEPH] = {0}; // scan and cycle through the input array for (int i = 0; i < strlen(s); i++) { arr1[ arr2[i] - 'a' ]++; } for (int j = 0; j < 26; j++) { if ( arr[j] != 0 ) { printf("\nCharacter: %c - Frequency: %d", 'a'+j, arr[j]); } } printf("\n"); } |
Why is my regex replacing more than I want it to? Posted: 31 Mar 2021 06:57 PM PDT Here's a string example: "This is a \n\n\nTest" This is the code I'm using import re def split_text_into_sentences(text): text = re.sub(r'\s+\n', '\n', text) return text print([split_text_into_sentences('This is a \n\n\nTest')]) For some reason, I'm getting ['This is a\nTest'] But I'm expecting ['This is a\n\nTest'] I thought \s+\n would only get rid of the first \n with at least one white space character before it, but for some reason, the rest of the \n's get replace too. Could someone explain why? Thanks! |
How would I get the data needed from one API endpoint to use as a link in this specific situation? REACT project Posted: 31 Mar 2021 06:57 PM PDT I have 3 diffrent params being called. The users Search, the weeks trending videos, and hottest movies. each have their own state. I made a fetch call to each one and updated their state and maped through each one to return data. heres the trending link as an example : https://api.themoviedb.org/3/trending/movie/week?api_key=. Now im trying to get each image's link from a 4th parameter....in order to get this image's link of where to buy the video I have to include the videos Id. https://api.themoviedb.org/3/movie/{MOVIE_ID}/watch/providers?api_key= <-- this link will give me the API data that has the link I want to be able to give each list item image it's own external link from where to buy the movie. At the point im at, how could I take each ID already rendered below and use it to fetch yet again a new API link that gives me it's personal provider link for each movie? Id like to make each movie image a link that will take you to the site where you can buy or watch the movie. I hope I didnt make this too confusing. // Input Field const onUserInput = ({ target }) => { setInput(target.value); } // On page load Fetch trending movies useEffect(() => { const trendUrl = "https://api.themoviedb.org/3/trending/movie/week?api_key=<API_KEY>"; fetch(trendUrl) .then((response) => response.json()) .then((data) => { setTrending(data.results); }) .catch((error) => { console.log('Error!! Data interupted!:', error) }) }, []); useEffect(() => { const upcomingUrl = "https://api.themoviedb.org/3/movie/upcoming?api_key=<API_KEY>"; fetch(upcomingUrl) .then((response) => response.json()) .then((data) => { setUpcoming(data.results); }) .catch((error) => { console.log('Error!! Data interupted!:', error) }) }); // Api Call const SearchApi = (event) => { const aUrl = "https://api.themoviedb.org/3/search/movie?api_key=<API_KEY>"; const newUrl = aUrl + '&query=' + input; event.preventDefault(); fetch(newUrl) .then((response) => response.json()) .then((data) => { setSearch(data.results); }) .catch((error) => { console.log('Error!! Data interupted!:', error) }) }; //Call Movie Location Link return ( // Heading <div> <div className="container"> <h1>Movie Search Extravaganza!</h1> {/* Input Field and Button Form */} <form onSubmit={SearchApi}> <input value={input} onChange={onUserInput} type="text" className="searchbar" aria-label="searchbar" placeholder="search" required/> <br></br> <button type="submit" aria-label="searchbutton" className="searchBtn">Movie Express Search</button> </form> </div> <div className="byName-container"> <h1 className="row-label" tabIndex="0">Movies Related To Your Search</h1> <ul className="flexed-search"> {search.map((item) => <div className="poster-container" key={item.id}> <li className="list-item"> <a href={`https://api.themoviedb.org/3/movie/${item.id}watch/providers?api_key=<API_KEY>`}> <img className="image-element" tabIndex="0" alt="movie poster" title={`--Title: ${item.title}-- --Description: ${item.overview}-- --Vote Average: ${item.vote_average}`} aria-label={item.title} src={`https://image.tmdb.org/t/p/w500${item.poster_path}`} /> </a> <h3 className="posterTitle">{item.title}</h3> </li> </div> )} </ul> </div> <div className="trending-container"> <h1 className="row-label" tabIndex="0">This Weeks Trending Tittles</h1> <ul className="flexed-trending"> {trending.map((it) => <div className="poster-container" key={it.id}> <li className="list-item"> <img className="image-element" tabIndex="0" aria-label={it.title} title={`--Title: ${it.title}-- --Description: ${it.overview}-- --Vote Average: ${it.vote_average}`} alt="movie poster" src={`https://image.tmdb.org/t/p/w500${it.poster_path}`} /> <h3 className="posterTitle">{it.title}</h3> </li> </div> )} </ul> </div> <div className="upcoming-container"> <h1 className="row-label" tabIndex="0">Upcomming Movies</h1> <ul className="flexed-upcoming"> {upcoming.map((inn) => <div className="poster-container" key={inn.id}> <li className="list-item"> <img className="image-element" tabIndex="0" alt="movie poster" aria-label={inn.title} title={`--Title: ${inn.title}-- --Description: ${inn.overview}-- --Vote Average: ${inn.vote_average}`} src={`https://image.tmdb.org/t/p/w500${inn.poster_path}`} /> <h3 className="posterTitle">{inn.title}</h3> </li> </div> )} </ul> </div> </div> )}; export default SearchBar; |
What does podman run --expose do? Posted: 31 Mar 2021 06:57 PM PDT I'm new to containers, I don't know Docker, and I'm learning Podman on RHEL. I'm trying to understand what podman run --expose does. All podman-run(1) says for the --expose option is "Expose a port, or a range of ports (e.g. --expose=3300-3310) to set up port redirection on the host system." As I understand/guess it, port redirection is to have an application configured to listen at some port, but have the system expose some other port, and redirect connections to that other to the configured one. In this case, the application would be the container running instance (right?). Then I should be able to see from inside the running instance the listening port by using $ ss -a . Well, that's not what I see. There's this article that expands on Docker documentation on the expose directive in the dockerfile, and says that "The EXPOSE instruction exposes the specified port and makes it available only for inter-container communication." which doesn't sound equivalent to my reasoning above. Can anybody please explain what exactly $ podman run --expose=4321 imaginedimage does and how to check that it does what's expected to do. Edit ...thinking about it again, I shouldn't expect to see that "exposed" port on $ ss -a I'd better ask for an example of "port redirection on the host system" using --expose . |
Take user input from Kivy App and append to google sheets using Python Posted: 31 Mar 2021 06:55 PM PDT I'm trying to make a simple Python Kivy app (using a kv file for the layout) that I will use to keep inventory of my parts for work. I am very new to python and kivy, so I need a little bit of direction on this. One of the basic functions will be to allow the user to input a new part on the "Add Part to Inventory" screen (one of four screens). The user input consists of four items (part name, serial number, on-hand quantity, and the minimum amount needed). Once the user enters this info and presses the 'Submit' button, I would like that data to be appended to a new row in a google sheet that I'm using as a backend database using the Google Drive/Sheets API (which I was able to get working). Most of the example apps that I've found online only have one screen, and are only dealing with one type of user input (usually text, whereas my input will be text and integers). I'm confused as to where I need to put my ids in the kv file (I'm assuming under the AddPartWindow layout), how to call a function when a button is pressed that is not in the root class, how to store the user input into a list since I'm not sure what the ObjectProperty function is really doing, and finally, how to append that list to a new row in my google sheet. I'm not looking for a cut and paste answer, just some direction would be nice as I have not been able to find a good reference for exactly what I'm trying to do. My main confusion lies in having multiple screens, and how to transfer data between the different screens and their respective classes. Should data only be funneled through a single root class? Or can each class be used to handle data coming from their respective screens (windows) in the app? What exactly is the ObjectProperty function doing? I find the kivy website to be a bit convoluted when describing the properties class. Any help/direction woud be greatly appreciated. Here is the main.py code: import kivy from kivy.app import App from kivy.uix.gridlayout import GridLayout from kivy.uix.screenmanager import ScreenManager, Screen from kivy.core.window import Window from kivy.uix.button import Button from kivy.properties import ObjectProperty import gspread from oauth2client.service_account import ServiceAccountCredentials scope = ['https://www.googleapis.com/auth/drive'] creds = ServiceAccountCredentials.from_json_keyfile_name('My_First_Project-3d753d98320e.json', scope) client = gspread.authorize(creds) iQue_sheet = client.open("InventoryBackend").sheet1 #root layout class InventoryWindow(Screen): pass #Layout in question class AddPartWindow(Screen): #Is there anything else I need to do with these before saving into a list or dictionary? part_name = ObjectProperty(None) serial_number = ObjectProperty(None) on_hand_cnt = ObjectProperty(None) min_needed = ObjectProperty(None) #This function should save the user input into a list, np, and then append to the google sheet iQue_sheet #Wasn't sure if it should be a list or a dictionary. #I'm assuming .text is type-casting each object to a string. Can this be used for numerical inputs? def new_part(self): np = [self.part_name.text, self.serial_number.text, self.on_hand_cnt.text, self.min_needed.text] iQue_sheet.append(np) class OnOrderWindow(Screen): pass class OrderFormWindow(Screen): pass class WindowManager(ScreenManager): pass class InventoryApp(App): def build(self): #These are used to enable going back and forth between screens using buttons sm = ScreenManager() sm.add_widget(InventoryWindow(name='inv_window')) sm.add_widget(OnOrderWindow(name='on_order_window')) sm.add_widget(AddPartWindow(name='add_part_window')) sm.add_widget(OrderFormWindow(name='order_form_window')) return sm if __name__ == "__main__": InventoryApp().run() Here is the my .kv file for the layout, the Add Part window is the last layout towards the end: WindowManager: InventoryWindow: OnOrderWindow: OrderFormWindow: AddPartWindow: <ItemLabel@Label> font_size: '15sp' halign: 'left' valign: 'middle' text_size: self.size <ItemButton@Button> pos_hint: {'center_x':0.5, 'center_y':0.5} size_hint: 0.65, 0.2 <ItemButton2@Button> pos_hint: {'center_x':0.5, 'center_y':0.5} size_hint: 0.65, 0.2 on_release: app.root.current = "order_form_window" <InventoryWindow>: name: "inv_window" add_probe: add_probe FloatLayout: Label: text: 'Inventory' font_size: '25sp' size_hint: (1, 0.17) pos_hint: {'x': 0, 'y': 0.87} GridLayout: cols: 4 padding:[10, 65, 10, 10] spacing: 5 BoxLayout: orientation: 'vertical' ItemLabel: text:'iQue3: Probe/Tubing' BoxLayout: orientation: 'vertical' ItemButton: text:'Add' on_release: root.new_part() BoxLayout: orientation: 'vertical' ItemButton: text:'Sub' BoxLayout: orientation: 'vertical' ItemButton2: text:'Order' BoxLayout: orientation: 'vertical' ItemLabel: text:'Gen2: Probe/Tubing' BoxLayout: orientation: 'vertical' ItemButton: text:'Add' BoxLayout: orientation: 'vertical' ItemButton: text:'Sub' BoxLayout: orientation: 'vertical' ItemButton2: text:'Order' BoxLayout: orientation: 'vertical' ItemLabel: text:'Beads' BoxLayout: orientation: 'vertical' ItemButton: text:'Add' BoxLayout: orientation: 'vertical' ItemButton: text:'Sub' BoxLayout: orientation: 'vertical' ItemButton2: text:'Order' BoxLayout: orientation: 'vertical' ItemLabel: text:'iQue3 Fluid Maint. Kit' BoxLayout: orientation: 'vertical' ItemButton: text:'Add' BoxLayout: orientation: 'vertical' ItemButton: text:'Sub' BoxLayout: orientation: 'vertical' ItemButton2: text:'Order' BoxLayout: orientation: 'vertical' ItemLabel: text:'Screener Fluid Maint. Kit' BoxLayout: orientation: 'vertical' ItemButton: text:'Add' BoxLayout: orientation: 'vertical' ItemButton: text:'Sub' BoxLayout: orientation: 'vertical' ItemButton2: text:'Order' BoxLayout: orientation: 'vertical' GridLayout: cols: 2 size_hint: 1, 0.15 padding: [10, 0, 10, 10] BoxLayout: Button: text: 'Add Part to Inventory' font_size: '18sp' size_hint: (1, 0.75) on_release: app.root.current = "add_part_window" root.manager.transition.direction = "right" Button: text: 'On Order' font_size: '18sp' size_hint: (1, 0.75) on_release: app.root.current = "on_order_window" root.manager.transition.direction = "left" <OnOrderWindow>: name: "on_order_window" FloatLayout: Label: text: 'On Order' font_size: '25sp' size_hint: (1, 0.17) pos_hint: {'x': 0, 'y': 0.87} GridLayout: cols: 2 size_int: 1, .15 padding:[10, 510, 10, 10] Button: text: "Inventory" font_size: '18sp' size_hint: (1, 0.6) on_release: app.root.current = "inv_window" root.manager.transition.direction = "right" Button: text:"Add Part to Inventory" size_hint: (1, 0.6) font_size: '18sp' on_release: app.root.current = "add_part_window" root.manager.transition.direction = "left" <OrderFormWindow> name: "order_form_window" FloatLayout: Label: text: 'Order Form' font_size: '25sp' size_hint: (1, 0.17) pos_hint: {'x': 0, 'y': 0.87} GridLayout: cols:2 padding: [50, 50, 50, 120] ItemLabel: text: "Part: " ItemLabel: text: "Populate Part Here" ItemLabel: text: "Serial Number: " ItemLabel: text: "Populate SN Here" ItemLabel: text: "On Hand: " ItemLabel: text: "Populate On Hand Count Here" ItemLabel: text: "Minimum Needed: " ItemLabel: text: "Populate Min Needed Here" ItemLabel: text: "Order Quantity" TextInput: halign: 'left' valign: 'middle' input_type: 'number' input_filter: 'int' multiline:False GridLayout: cols:2 size_hint: 1, 0.15 padding: [10, 0, 10, 10] Button: text:"Cancel" on_release: app.root.current = "inv_window" Button: text:"Submit Order" on_release: app.root.current = "on_order_window" #This is the add part screen layout I'm referring to <AddPartWindow> name: "add_part_window" #These are the id's I was referring to: part_name: part_name serial_number: serial_number on_hand_cnt: on_hand_cnt min_needed: min_needed FloatLayout: Label: text: 'Add Part to Inventory' font_size: '25sp' size_hint: (1, 0.17) pos_hint: {'x': 0, 'y': 0.86} GridLayout: cols:2 padding: [50, 100, 50, 120] spacing: 5 ItemLabel: text: "Name of Part: " TextInput: id: part_name halign: 'left' valign: 'middle' multinline:False ItemLabel: text: "Serial Number: " TextInput: id: serial_number halign: 'left' valign: 'middle' multiline:False ItemLabel: text: "How Many On Hand?: " TextInput: id: on_hand_cnt halign: 'left' valign: 'middle' multinline:False ItemLabel: text: "Minimum Needed?: " TextInput: id: min_needed halign: 'left' valign: 'middle' multiline:False GridLayout: cols:2 size_hint: 1, 0.15 padding: [10, 0, 10, 10] Button: text:"Cancel" on_release: app.root.current = "inv_window" root.manager.transition.direction = "left" #Here is the button I'm referring to, I realize that putting "root." in front of new_part() is not #the correct thing to put, so it's a placeholder for now: Button: text:"Submit" on_release: root.new_part() app.root.current = "inv_window" root.manager.transition.direction = "left" Here is a screen shot of the Add Part Screen The current error I'm getting when I enter input into the four fields and click on the Submit button is this: File "C:\Users\edr27\kivy_venv\lib\site-packages\kivy\uix\behaviors\button.py", line 179, in on_touch_up self.dispatch('on_release') File "kivy\_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch File "kivy\_event.pyx", line 1248, in kivy._event.EventObservers.dispatch File "kivy\_event.pyx", line 1132, in kivy._event.EventObservers._dispatch File "C:\Users\edr27\kivy_venv\lib\site-packages\kivy\lang\builder.py", line 57, in custom_callback exec(__kvlang__.co_value, idmap) File "C:\Users\edr27\PycharmProjects\pythonProject\inventory.kv", line 345, in <module> root.new_part() File "C:\Users\edr27\PycharmProjects\pythonProject\main.py", line 35, in new_part np = [self.part_name.text, self.serial_number.text, self.on_hand_cnt.text, self.min_needed.text] AttributeError: 'NoneType' object has no attribute 'text' |
C# If Loop Condition Question (shouldn't this be an infinite loop?) Posted: 31 Mar 2021 06:57 PM PDT I have this code and it wants to know what is logged to the console. private static int Printer (int j) { for(var i = j; i > 0; i = Printer(i - 1)) { Console.Write(i); } return j; } Apparently this returns 212, but why does this not create an infinite loop since Printer(anyNumber) will always return a 2 thus assigning i to always be > 0? |
Image blur creating extra dark lines in CSS3 Posted: 31 Mar 2021 06:57 PM PDT Here is a section for which I wrote some css --- https://codepen.io/TheBeast5520/pen/VwPPxgL <section class="section-meals"> <ul class="meals-showcase clearfix"> <li> <figure class="meal-photo"> <img src="https://imgur.com/4eiEg9f.png" alt="Korean bibimbap with egg and vegetables" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/txcGRYr.png" alt="Simple italian pizza with cherry tomatoes" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/V7Y5a3y.png" alt="Chicken breast steak with vegetables" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/6PTG0sL.png" alt="Autumn pumpkin soup" /> </figure> </li> </ul> <ul class="meals-showcase clearfix"> <li> <figure class="meal-photo"> <img src="https://imgur.com/uj0kVLP.png" alt="Paleo beef steak with vegetables" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/teGpV1e.png" alt="Healthy baguette with egg and vegetables" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/7bodzqR.png" alt="Burger with cheddar and bacon" /> </figure> </li> <li> <figure class="meal-photo"> <img src="https://imgur.com/BHkwkh1.png" alt="Granola with cherries and strawberries" /> </figure> </li> </ul> </section> * { margin: 0; padding: 0; box-sizing: border-box; } html, body { background-color: #fff; color: #555; font-family: "Lato", "Arial", sans-serif; font-weight: 300; font-size: 20px; text-rendering: optimizeLegibility; } .section-meals { padding: 0; } .meals-showcase { list-style: none; width: 100%; } .meals-showcase li { display: block; float: left; width: 25%; } .meal-photo { width: 100%; margin: 0; overflow: hidden; background-color: #000; } .meal-photo img { width: 100%; transform: scale(1.15); transition: transform 0.5s, opacity 0.5s, filter 0.5s; opacity: 0.65; filter: blur(30px); overflow: hidden; } .meal-photo img:hover { transform: scale(1.03); opacity: 1; filter: blur(0); } Note that I have made the blur much, much more than it would be in order to make the problem more apparent. When you are moving a cursor from one image to another, there seems to be very dark blurred lines at the edges of the image. How can I fix this? EDIT: Look at the difference between this picture: and this picture: The second picture is the "wrong" one. For some reason it is going dark at the edges. It is easier to see it in the code pen. Also, it only happens when you are moving the cursor around. If you cursor goes still, it will go away after a time. Another edit: After looking at this a bit longer, I noticed that when you are hovering on a certain element, only that element and the elements after it are affected with this weird problem. |
Solving nonlinear systems of equations Posted: 31 Mar 2021 06:56 PM PDT I'm receiving an error with this simple code, the problem is that the error only appears with one of the equations that I need (78 * x**0.3 * y**0.8 - 376 ). The error : invalid value encountered in double_scalars ; F[0] = 78 * x**0.3 * y**0.8 - 376 If I erase * y**0.8 from the first equation, the code runs perfectly, but obviously it doesn't work for me. Code: import numpy as np from scipy.optimize import fsolve def Funcion(z): x = z[0] y = z[1] F = np.empty((2)) F[0] = 78 * x**0.3 * y**0.8 - 376 F[1] = 77 * x**0.5 * y - 770 return F zGuess = np.array([1,1]) z = fsolve(Funcion,zGuess) print(z) |
Good way to ensure there are no overlapping intervals in a table Posted: 31 Mar 2021 06:56 PM PDT I am storing intervals where From < To for each entry. If I build an index on "From", then I can get the minimum and maximum entries efficiently when inserting a new record to do a validation check. However, this doesn't help if there were a big gap somewhere in these entries where a given record could've easily fit. For example: [3, 5] [8, 9] If I want to insert [6,7] or [1,2] above, what is the best way to check? Just wondering if there's an efficient way of ensuring that a record doesn't overlap with any of the existing entries without comparing against all of them. EDIT: I am looking for a c#.Net solution. Sql server is just being used as a data store. I thought it important to mention since querying to check existing values is a part of it. |
How can I add a custom color to a gradient with Tailwind and React? Posted: 31 Mar 2021 06:57 PM PDT Here's my tailwind.config.js: const colors = require('tailwindcss/colors') module.exports = { purge: { content: ['./pages/**/*.{js,jsx,ts,tsx}', './src/**/*.{js,jsx,ts,tsx}'], }, theme: { colors: { 'BASE_YELLOW': '#C9FB5C', 'black': '000', }, }, variants: {}, plugins: [], } And my React component div: <div className="w-full min-h-screen flex items-center justify-center bg-gradient-to-r from-colors.BASE_YELLOW to-colors.black ..."> But the screen is just grey. How do I use these colors in a gradient? |
React Native checkbox handle Posted: 31 Mar 2021 06:57 PM PDT I have country codes from a file, I render it like that, it returns all country names and codes perfectly. <TouchableOpacity style={st.oneCode} onPress={selectItem}> <View style={[ st.filterCheckMarkWrapper, check === false && st.filterCheckmarkInactiveColor, ]}> {check === true && ( <View style={st.filterCheckmark} /> )} </View><Text style={st.CodeText}> {item.countryName}: +{item.phoneCode} </Text> </TouchableOpacity> but when check is true, all of the text are checked, how can i fix it? |
How update the component when the createAsyncThunk return a promise (react/redux toolkit) Posted: 31 Mar 2021 06:56 PM PDT I have i async function that send a request to the database to update a count, and this function return a promise like that {Nome: "a", Valor: 1700, Historico: "teste", Documento: 1, DataEmissao: "2020-12-24T00:00:00.000Z", …} DataEmissao: "2020-12-24T00:00:00.000Z" DataVencimento: "2020-12-24T00:00:00.000Z" Documento: 1 Historico: "teste" Nome: "a" Valor: 1700 createdAt: "2021-03-30T14:13:31.404Z" id: "6063320bafd21c22e45f404c" updatedAt: "2021-03-31T14:56:43.873Z" __v: 0 __proto__: Object this is my data updated, but i don't know how i can send this data to overwhite the old data in my component and store, my component just update when i reload de page and my app send request again to load the database data, i tried to use createEntytyAdapter but i could not. This is my code export const editCount = createAsyncThunk('contas/editCount', async (data) => { const dados = data; axios.post('http://localhost:8080/api/teste/' + dados.documento, { Documento: dados.documento, Nome: dados.nome, Valor: dados.valor, Historico: dados.historico, DataEmissao: dados.dataEmissao, DataVencimento: dados.dataVencimento }).then(function (response) { console.log('teste', response.data) return response.data; }).catch(function (error) { console.log(error) }) }) const ContasReducer = createSlice({ name: sliceName, initialState: { contas: [], status: null }, reducers: { }, extraReducers: (builder) => { builder.addCase(fetchCounts.fulfilled , (state, { payload }) => { state.contas = payload state.status = 'success' }) builder.addCase(fetchCounts.pending , (state, action) => { state. status = 'Loading' state. contas = Iq2Lbqy660Nh_RP4z9jUhPZ1CZw }) builder.addCase(createAcount.fulfilled , (state, action) => { state = action.payload console.log('action payload', action.payload) }) // this is my reducer builder.addCase(editCount.fulfilled , (state, action) => { state.conta = action.meta.arg; console.log('reducer',action.meta.arg) }) } }) //My component function SalvarDados() { Dispatch( editCount({ documento: Documento, nome: Nome, valor: Valor, historico: Historico, dataEmissao: new Date(DataEmissao), dataVencimento: new Date(DataVencimento), }) ) props.CloseModal() } |
how to deploy javafx application Posted: 31 Mar 2021 06:56 PM PDT I need deloy application using javafx, but when deloy is by intellij it displays error message: Java FX Packager: Can't build artifact - fx: deploy is not available in this JDK I don't know how to deloy application. |
Debug third-party library dll in Visual Studio Posted: 31 Mar 2021 06:56 PM PDT I have third-party dll with lib files. A.dll, A.lib, Ad.lib. One dll, but two lib files - one for debug other for release. And headers. Is there a way to debug into this dll? I don't have source code and don't have pdb files. PS: I'm using MS Visual Studio. |
Unable to mock certain final classes with PowerMockito - java.lang.IllegalAccessError Posted: 31 Mar 2021 06:56 PM PDT When I try to mock certain final classes like SearchGoogleAdsRequest from a certain Google library they give me IllegalAccessError , I have added @PrepareForTest annotation on top of the class. @RunWith(PowerMockRunner.class) @PrepareForTest({SearchGoogleAdsRequest.class}) @PowerMockIgnore({"javax.net.ssl.*"}) public class GoogleAdsReportDownloaderTest { final SearchGoogleAdsRequest searchGoogleAdsRequest = PowerMockito.mock(SearchGoogleAdsRequest.class); final GoogleAdsServiceClient mockGoogleAdsServiceClient = mock(GoogleAdsServiceClient.class); final GoogleAdsServiceClient.SearchPagedResponse searchPagedResponse = mock(GoogleAdsServiceClient.SearchPagedResponse.class); when(mockGoogleAdsServiceClient.searchPagedCallable()).thenReturn(callable); when(mockGoogleAdsServiceClient.searchPagedCallable().call(searchGoogleAdsRequest)).thenReturn(searchPagedResponse); when(searchPagedResponse.iterateAll()).thenReturn(Arrays.asList(mockGoogleAdsRow)); when(mockGoogleAdsServiceClient.search(any())).thenReturn(searchPagedResponse); Error java.lang.IllegalAccessError: Class com/google/ads/googleads/v6/services/SearchGoogleAdsRequest$MockitoMock$1353664588 illegally accessing "package private" member of class com/google/protobuf/GeneratedMessageV3$UnusedPrivateParameter SearchGoogleAdsRequest final class looks like this, which PowerMockito isn't able to mock. public final class SearchGoogleAdsRequest extends GeneratedMessageV3 implements SearchGoogleAdsRequestOrBuilder { private static final SearchGoogleAdsRequest DEFAULT_INSTANCE = new SearchGoogleAdsRequest(); private static final Parser<SearchGoogleAdsRequest> PARSER = new AbstractParser<SearchGoogleAdsRequest>() { public SearchGoogleAdsRequest parsePartialFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry) throws InvalidProtocolBufferException { return new SearchGoogleAdsRequest(input, extensionRegistry); } }; private SearchGoogleAdsRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); this.memoizedIsInitialized = -1; } private SearchGoogleAdsRequest() { this.memoizedIsInitialized = -1; this.customerId_ = ""; this.query_ = ""; this.pageToken_ = ""; this.summaryRowSetting_ = 0; } I am able to bypass this , by configuring MockMaker. But MockMaker doesn't work with PowerMockito and gives errors (cannot initialize plugin and that certain loader was supposed to go with Mockito but is loading with PowerMockito). I need to use Power Mockito because I need to mock local scope objects and other unit tests created by others break with MockMaker. |
react-native-camera: Android app crashing without error Posted: 31 Mar 2021 06:56 PM PDT I've added react-native-camera to my application. After creating a component that uses RNCamera, everytime I try to run my app (using react-native run-android ), it asks for the necessary permissions (camera and audio) and then immediately crashes without outputting any error messages. This is my package.json: { "main": "index.js", "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "web": "expo start --web", "start": "react-native start", "test": "jest" }, "dependencies": { "@react-native-community/async-storage": "^1.12.1", "@tensorflow-models/mobilenet": "^2.0.4", "@tensorflow/tfjs": "^3.3.0", "@tensorflow/tfjs-react-native": "^0.5.0", "expo": "~40.0.0", "expo-camera": "~9.1.0", "expo-constants": "^10.0.1", "expo-gl": "~9.2.0", "expo-gl-cpp": "~9.2.0", "expo-splash-screen": "~0.8.0", "expo-status-bar": "~1.0.3", "expo-updates": "~0.4.0", "mobx": "^6.1.8", "react": "16.13.1", "react-dom": "16.13.1", "react-native": "~0.63.4", "react-native-camera": "^3.43.0", "react-native-fs": "^2.16.6", "react-native-gesture-handler": "~1.8.0", "react-native-reanimated": "~1.13.0", "react-native-screens": "~2.15.0", "react-native-unimodules": "~0.12.0", "react-native-web": "~0.13.12" }, "devDependencies": { "@babel/core": "~7.9.0", "babel-jest": "~25.2.6", "jest": "~25.2.6", "react-test-renderer": "~16.13.1" }, "jest": { "preset": "react-native" }, "private": true } This is my build.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "29.0.2" minSdkVersion = 21 compileSdkVersion = 29 targetSdkVersion = 29 } repositories { google() jcenter() } dependencies { classpath("com.android.tools.build:gradle:3.5.3") classpath("com.google.gms:google-services:4.3.5") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } maven { url("$rootDir/../node_modules/expo-camera/android/maven") } maven { url 'https://www.jitpack.io' } google() jcenter() } } This is my /app/build.gradle: apply plugin: "com.android.application" apply plugin: "com.google.gms.google-services" import com.android.build.OutputFile project.ext.react = [ enableHermes: false ] apply from: '../../node_modules/react-native-unimodules/gradle.groovy' apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle" apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle" def enableSeparateBuildPerCPUArchitecture = false def enableProguardInReleaseBuilds = false def jscFlavor = 'org.webkit:android-jsc:+' def enableHermes = project.ext.react.get("enableHermes", false); android { compileSdkVersion rootProject.ext.compileSdkVersion ndkVersion "22.0.7026061" compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { applicationId "com.chowtime" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" missingDimensionStrategy 'react-native-camera', 'mlkit' } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation platform('com.google.firebase:firebase-bom:26.7.0') implementation 'com.google.firebase:firebase-analytics' implementation (project(':react-native-camera')) { exclude group: "com.google.android.gms" exclude group: "com.google.android.gms", module: "play-services-vision" exclude group: "com.google.firebase", module: "firebase-ml-vision-face-model" } implementation ("com.google.firebase:firebase-ml-vision:19.0.3") { force = true; } implementation ("com.google.firebase:firebase-ml-vision-face-model:17.0.2") { force = true; } implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } addUnimodulesDependencies() if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) EDIT: This is what my AndroidManifest.xml looks like: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.chowtime"> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.USE_FINGERPRINT"/> <uses-permission android:name="android.permission.USE_BIOMETRIC"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> <uses-permission android:name="android.permission.CAMERA"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.WRITE_CONTACTS"/> <uses-permission android:name="android.permission.READ_CALENDAR"/> <uses-permission android:name="android.permission.WRITE_CALENDAR"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_SETTINGS"/> <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme"> <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@jjwilkin/test_bare"/> <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="40.0.0"/> <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/> <meta-data android:name="com.google.firebase.ml.vision.DEPENDENCIES" android:value="ocr, text" /> <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/> </application> </manifest> This is what my android project directory looks like: Any info about why this may be happening or how to resolve this issue would be greatly appreciated! Thanks :) UPDATE: I've tried using expo-camera in the same repo (I read that react-native-camera is built on expo-camera), and that works fine. EDIT: This is the output from running adb logcat : pastebin.com/yWM5Mat8. |
Azure Webjob: Git clone directly to remote Posted: 31 Mar 2021 06:57 PM PDT Im running a Windows-based App Service. Im running a backup of a fairly large git repo and I'm wanting to clone directly to Azure Blob/File/S3. Cloning locally leads to an out-of-memory exception. I realise that you can mount azure storage, but this is just for Linux based apps. Im using LibGit2Sharp ti run the Repository.Clone function. I've tried mapping a network drive on my Azure Webjob, but I get an "Access Denied" |
Visual Studio New project wont run tests Posted: 31 Mar 2021 06:57 PM PDT Visual Studio 2019 is not detecting or discovering NUNit nor MSTest unit tests at all. I installed it fresh just a week ago. The MS guide here https://docs.microsoft.com/en-us/visualstudio/test/getting-started-with-unit-testing?view=vs-2019&tabs=mstest does not work. A few threads hold possible solutions, but none that I've tried helped have helped. I'm new to C# so much of the steps have taken a long time to figure out, but while my application is progressing nicely I really want to work and learn in a TDD style. Even if a create a new blank MSTest project, with no application code or libs in the solution at all, the example/template project does not work, so I'm missing something big someplace. (I have .NET Core SDKs installed - my intent is to target macOS and linux at a future point.) <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <IsPackable>false</IsPackable> <LangVersion>latest</LangVersion> </PropertyGroup> <ItemGroup> <PackageReference Include="nunit" Version="3.13.0" /> <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> </ItemGroup> </Project> Threads I have tried: Tests not running in Test Explorer Why will Visual Studio 2019 will not run my unit tests? Visual Studio 2019 Test Explorer puts all tests under "Not Run Tests" If I create a project targeting .NET 4.7 all is good, it's when I want to target Core that I'm unstuck, if that helps. Stuck again I had to install a component called "NUnit 3", https://marketplace.visualstudio.com/items?itemName=NUnitDevelopers.NUnitTemplatesforVisualStudio worked for a moment... but when I added a testcase, it all broke again. Did the nuget package updates, still not working. I cloned. from git this project https://github.com/dotnet/samples/tree/master/core/getting-started/unit-testing-using-nunit And it does not work either. I then re-installed 2019, and emailed my project to a friend, who merely removed the nunit nuget modules, added them back and then it worked for him, but the project he sent me back did not work. Module versions unchanged I opened the same project in the Microsoft developer VM/iso image and the project works just fine. so it's my environment that is incompatible with nunit somehow. Is there a way to see some traces? Changed the installation drive from D: to C: I get this error now Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [C:\Users\zapho\src\c#\tutorials\working\ConsoleApp1\ConsoleApp1\NUnit.Tests2\bin\Debug\netcoreapp3.1\]. If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location. . Please check the diagnostic logs for more information. Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found. If this is a self-contained application, that library should exist in [C:\Users\zapho\src\c#\tutorials\working\ConsoleApp1\ConsoleApp1\NUnit.Tests2\bin\Debug\netcoreapp3.1\]. If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location. . Please check the diagnostic logs for more information. |
Error: Cannot find module on bitbucket pipeline Posted: 31 Mar 2021 06:58 PM PDT I want to use a globally installed npm module inside a bitbucket pipeline, but unfortunately Bitbucket throw this error: + node pull-request.js internal/modules/cjs/loader.js:834 throw err; ^ Error: Cannot find module 'bitbucket' Require stack: - /opt/atlassian/pipelines/agent/build/pull-request.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15) at Function.Module._load (internal/modules/cjs/loader.js:687:27) at Module.require (internal/modules/cjs/loader.js:903:19) at require (internal/modules/cjs/helpers.js:74:18) at Object.<anonymous> (/opt/atlassian/pipelines/agent/build/pull-request.js:1:23) at Module._compile (internal/modules/cjs/loader.js:1015:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10) at Module.load (internal/modules/cjs/loader.js:879:32) at Function.Module._load (internal/modules/cjs/loader.js:724:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/opt/atlassian/pipelines/agent/build/pull-request.js' ] } As you can see inside the below file, I install globally the bitbucket package (without any error): bitbucket-pipelines.yml image: node:12 definitions: steps: - step: &create-pr name: Create Pull Request caches: - node script: - npm install -g bitbucket - node pull-request.js pipelines: branches: '{bugfix/*,feature/*}': - step: *create-pr '{develop,release/*,hotfix/*}': - step: *create-pr On this file I do a require() since the module is installed globally pull-request.js const { Bitbucket } = require('bitbucket'); execute().then(res => { console.log(res); }) .catch(err => { console.log(err); }) async function execute () { const clientOptions = { auth: { username: process.env.BB_AUTH_USER, password: process.env.BB_AUTH_PWD }, }; const bitbucket = new Bitbucket(clientOptions); await bitbucket.pullrequests.create({ _body: { "title": "Merge in develop", "description": "Automated PR creation process :-)", "source": { "branch": { "name": "master" } }, "destination": { "branch": { "name": "develop" } }, "close_source_branch": false }, workspace: 'test', repo_slug: 'test-pull-requests' }); } |
Google receipt validation - 401 - permissionDenied Posted: 31 Mar 2021 06:56 PM PDT I want to make Google receipt validation. I set everything by Marc Greenstock. When I try verified purchase I get response permissionDenied. For me is everything correct and I don't know how to find a mistake. The user has administrator role in Google Play Developer console. Google developer console: - I enabled "Google Play Android Developer API"
- I created service account keys with role Owner
- I downloaded JSON file
Google play Developer console: - Link correct project
- For correct user set administrator role. The same user is in the file.
Response: { "code" : 401, "errors" : [ { "domain" : "androidpublisher", "message" : "The current user has insufficient permissions to perform the requested operation.", "reason" : "permissionDenied" } ], "message" : "The current user has insufficient permissions to perform the requested operation." } I tried friend private_key, client_id and client_email and everything works fine. Code is good. I something forgot during configuration but I don't know what. |
Remove empty objects from an object Posted: 31 Mar 2021 06:56 PM PDT I am trying to remove empty objects inside an object, here is an example with the expected output: var object = { a: { b: 1, c: { a: 1, d: {}, e: { f: {} } } }, b: {} } var expectedResult = { a: { b: 1, c: { a: 1, } } } I tried using some examples from other StackOverflow questions, however those are just for one level objects. |
Is it possible to watch for events on all descendant nodes in ZooKeeper? Posted: 31 Mar 2021 06:55 PM PDT When using ZooKeeper is it possible to watch for all events on descendant znodes? for example if I have: (/) / \ (/a) (/b) / \ (/c) (/d) Is there a way to watch the root for changes to /a, /b, /c and /d ? |
How to get the underlying value of an enum Posted: 31 Mar 2021 06:57 PM PDT I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt = 'R' } How do I get the value 'S' from a TransactionTypeCode.Shipment or 'R' from TransactionTypeCode.Receipt ? Simply doing TransactionTypeCode.ToString() gives a string of the Enum name "Shipment" or "Receipt" so it doesn't cut the mustard. |
No comments:
Post a Comment