a bike and it is broken in a way whenever there supposed to be value 4 in one of the 5 digits in odometer it skips that and shows 5

data-structures
Question: There is an odometer in a bike and it is broken in a way whenever there supposed to be value 4 in one of the 5 digits in odometer it skips that and shows 5. It is not able to display the digit 4. For example, if the odometer is at reading 32363 KM then next reading it will show is 32365 and not 32364 or if the odometer shows 3999 then next reading it will show is 5000 instead 4000. So if odometer shows the current reading 56287 then what is its actual reading? Answer: Read more
Read More

Python says I don’t have attribute when I do [duplicate]

Uncategorized
Question: This question already has an answer here:Why is Button parameter “command” executed when declared? 4 answers So I'm pretty new to coding and I'm trying to make a simple menu program with tkinter that would let the user click on certain food items and it will display his/her total. When I run the program python says AttributeError: 'Menu' object has no attribute 'potato_skins'. When I take out "potato skins" it says I do not have the attribute of bread, and so on and so forth. Can someone please help me, here is the code:#Order Up! #restaurant menu that lets the user pick foods, then show overall price from tkinter import * class Menu(Frame):"""Menu that let's the user choose food and shows the total price.""" def __init__(self, master):"""Initialize the frame"""…
Read More

How to get tkinter menubar label Value?

Uncategorized
Question: I have looked a lot but can`t find the answer, below is a e.g, Menu.add_command(label='abc',command=callback) Q: How can I get this 'abc' for variable? Answer: You can use entrycget() and pass to it the "label" option. Here is a short example to demonstrate how it works:import tkinter as tk def callback(menu):x= menu.entrycget(0, "label") print(x) # This will print "abc" in your Terminal root = tk.Tk() menu_bar = tk.Menu(root) file_menu = tk.Menu(menu_bar, tearoff=False) file_menu.add_command(label="abc", command=lambda: callback(file_menu)) menu_bar.add_cascade(label="File", menu=file_menu) root.config(menu=menu_bar) root.mainloop() Read more
Read More

mysql schedule giving #1064 error

Uncategorized
Question: I have been trying to create a game. In this game a match will start between two players and they can get online an do some stuff to increase their points. and after a time (for example 10 minutes) the match will be over and the results will be set. So I want regardless of players being online or not the server end the match and set the result and I created this but it doesn't work. Any advice? These are the tables: Table name: players id (int)(ai) username (string) defeats (int) (default=0) victories (int) (default=0) Table name: matches id (int)(ai) player1_id (int) player2_id (int) player1_points (int) (default=0) player2_points (int) (default=0) match_code (string) start_datetime (datetime) Table name: news id (int) (ai) news (string) news_datetime (datetime) INSERT INTO matches (player1_id,…
Read More

Creating online android app with Firebase

Uncategorized
Question: I want to create an online app between 2 players and join and find each other like a simple question-answer app and more than a thousand people can join the server. It's better to use firebase or create a web server as a host ... (I'm so interesting about web servers)i will mark this correct for those who can answer thanks Answer: The choice between Firebase and a web-server would be solely based on the needs of your application and on your skills. Firebase provides features of a real-time database, authentication, storage, notifications, hosting etc. without any server-side coding and other options which makes it really easy to integrate with your app. However, if the app requirements are above the free usage quota of Firebase, you would have to…
Read More

Cordova iOS touch scroll not working

Uncategorized
Question: I am building a cordova app for both Android and iOS. In android the scroll function is working perfectly fine, but in iOS scrolling down or up seems completely disabled, I've tried adding this into CSS. *{ -webkit-overflow-scrolling: touch; } I have also set my viewport I was told to use iScroll as a workaround but it seems if I used such a plugin I would have to apply it to all pages and divs separately. I am trying to enable scrolling for the whole application so this seems like a tedious and inefficient solution. Any ideas on how to solve this issue, I believe it could have something to do with UIWebkit, I will look into it further. Answer: Read more
Read More

Elasticsearch: update by query: how to handle version conflict?

Uncategorized
Question: I want to execute update by query on elastic, when other daemons are (maybe) also updating documents. The consequence of this is version conflict. I want to get list of all(not only one bulk) ids of conflicted documents (for manual retry) or set up retry_on_conflict for update by query. How can I do it? Example of my query:"script": { "inline": "ctx._source['msp']=null", "lang": "painless" }, "query": { "bool": { "must_not": { "terms": { "msp-rev": [44] } }, "must" : { "exists": { "field": "msp" } } } } Answer: Read more
Read More

How to unpack a list of tuples with enumerate? [duplicate]

python
Question: This question already has an answer here:How do I enumerate() over a list of tuples in Python? 3 answers I stumbled upon an unpack issue I can not explain. This works:tuples = [('Jhon', 1), ('Jane', 2)] for name, score in tuples:... This also works for id, entry in enumerate(tuples):name, score = entry ... but this does not work:for id, name, score in enumerate(tuples):... throwing a ValueError: need more than 2 values to unpack exeption. Answer: enumerate itself creates tuples with the list value and its corresponding index. In this case:list(enumerate(tuples)) gives:[(0, ('Jhon', 1)), (1, ('Jane', 2))] To fully unpack you can try this:for index, (name, id) in enumerate(tuples):pass Here, Python is paring the index and tuple object on the right side with the results on the left side, and…
Read More

Oracle PLSQL procedure – availability and renewal cycle

Uncategorized
Question: I wants to write a pl sql procedure which will check for date - deployment date + 6 Months 10); /* Accepted Keys will be fixed and match against this only V_key - 2.31434246044443627721368144904075038613 V_key - 8.90844849971977228731811693583903779363 V_key - 1.34697945811262561589006445666020254065 V_key - 9.58712840571811653940379331909211626142 V_key - 7.53497637096031545968508878377437375415 V_key - 5.51110038563370831198852549443728245139 V_key - 1.72699584831610823611824953708750321341 V_key - 2.80536691985350616678805352908747466606 V_key - 5.91281811604424007124143383870390349847 V_key - 4.15028473674054704507203594999547933188 V_key - 6.10548946122199556568384389485681624081 */ -- DBMS_OUTPUT.put_line('V_GetKey - '||V_GetKey); IF V_GetKey = V_key THEN return true; DBMS_OUTPUT.put_line('Value Matched access granted.'); else --return false; DBMS_OUTPUT.put_line('Value not matched.'); --Raise_application_error (-20001,'The key enter is not a valid License key.'); -- ELSE -- DBMS_OUTPUT.put_line('Value Matched'); END IF; END LOOP; END IF; EXCEPTION WHEN OTHERS THEN Raise_application_error (-20001,'The key enter is not a valid key.'); END; / Answer: Read more
Read More

Issue with chart.Drawdown in performance analytics, need finite ‘ylim’ values error

r
Question: So I am currently trying to create a Drawdown graph for daily profit/loss. Using:cols = rainbow(ncol(pdrawdown),s=0.7, v=0.8, alpha= 0.7) chart.Drawdown(pdrawdown, legend.loc = "bottomleft",colorset = cols, main = "Drawdown Chart", xlab ="Date", ylab = "Drawdown") I was able to easily plot it for returns (whose values are for the most part less than 10). However, upon trying to use this exact same method for profit/loss, whose values reach the range of 10e+09, I get the error:Error in plot.window(xlim, ylim, xaxs = "r", log = logaxis) : need finite 'ylim' values The weirdest part about this is that when I simply divide every value in my data table pdrawdown by 10,000,000 with pdrawdown = pdrawdown/10000000, the issue is solved and it can plot it. So what can I do to plot…
Read More