instruction
stringlengths
0
30k
I'm writing some code to control the altitude and azimuth of a solar panel, moving every hour between 6am and 6pm, then returning to the start position in the evening and resuming again 6am the following day. Go easy - never written anything in any language before. ``` # AltAztoSteppers.py - date 30:03:24 import astropy.coordinates as coord from astropy.time import Time import astropy.units as u import time from time import sleep from gpiozero import OutputDevice, Button # define pins Altdir = OutputDevice(18) Altpulse = OutputDevice(23) Azdir = OutputDevice(17) Azpulse = OutputDevice(25) Altswitch = Button(22) Azswitch = Button(27) # set the variables: Altstart = 0.0 Alttemp = Altstart Azstart = 90.0 Aztemp = Azstart loc = coord.EarthLocation(lon=-0.048 * u.deg, lat=51.138 * u.deg) def Altpos(): """function to return the Altitude angle of the sun at the current time""" altaz = coord.AltAz(location=loc, obstime=now) sun = coord.get_sun(now) Altnow = sun.transform_to(altaz).alt Altnow = Altnow.degree return Altnow def Azpos(): """function to return the Azimuth angle of the sun at the current time""" altaz = coord.AltAz(location=loc, obstime=now) sun = coord.get_sun(now) Aznow = sun.transform_to(altaz).az Aznow = Aznow.degree # Aznow is a local variable return Aznow while True: if Altswitch.value==1 or Azswitch.value==1: # safety feature print("Program halted - limit switch triggered") break now = Time.now() hours = int(now.ymdhms[3]) minutes = int(now.ymdhms[4]) newtime = hours # newtime is a counter so program only runs once every hour while hours >= 6: # change back to 6am now = Time.now() hours = int(now.ymdhms[3]) minutes = int(now.ymdhms[4]) while hours==newtime: *#code to calculate the difference in Altitude and Azimuth from one hour to the next* newtime = hours+1 # counter to make sure the program only runs once every hour if hours>18: # test for after 6pm, go back to the start position *#code to send panel back to the start-of-day position* else: if hours > 12 and hours < 19: # afternoon setting, Altitude decreases Altdir.on() #set stepper DIR to reverse *#code to check am or pm, pulse Altitude stepper in reverse* hours = int(now.ymdhms[3]) minutes = int(now.ymdhms[4]) print("137 waiting for the next hour. Newtime is ",newtime,"hours = ",hours) time.sleep(60) print("waiting for 6am") time.sleep(60) newtime = hours + 1 else: print("end of file") ``` At the moment, during the night hours 6pm to 6am the following day, I'm checking the hour value every minute - time.sleep(60) - and moving the panel back to the limit switches every hour. Is there a more elegant or recommended method of achieving a long delay? The code will be run on a Raspberry Pi doing nothing else other than controlling the panel.
Has anyone found or created a good SQL provider that implements IFeatureDefinitionProvider for .nets Feature Management? I've seen some stuff about implementing your own, but I was hoping that by now there would be one available. So far I have been unable to find one.
.NET Feature Management IFeatureDefinitionProvider sql provider
|c#|.net|sql-server|
I think you can use the index you set : <input placeholder="" type="text" class="input-group form-control webcau-yellow-border-1" [(ngModel)]="rateList[i].DataRata"> Note that you shouldn't use ngModel AND formControl in the same form.
|cobol|mainframe|zos|copybook|
I am currently facing a strange behavior with azure durable functions, based on powershell. I tried to debug it and also searched the Microsoft docs/Internet for similar cases. But i am still left with a question mark in my mind regarding that orchestrator behavior. The orchestrator is executing my durable activity function in a strange and unexpected way and reruns itself over and over again. Let me introduce you into my code real quick and show my problem here: **Orchestrator:** ``` param($Context) $ErrorActionPreference = "Stop" $output = @() try { #Validate Input Write-Information "Orchestrator: Validating Input" $JSONString = ($Context.Input).ToString() if (-not ([string]::IsNullOrEmpty($JSONString))) { $InputPSObject = ConvertFrom-Json $JSONString try { $TestFunction = Invoke-DurableActivity -FunctionName ‘TestFunction’ -Input $InputPSObject } catch { Write-Warning "Orchestrator: Test Function: $($_.Exception.Message)" } } else { Write-Error "Orchestrator: Could not validate Input. String is null or empty" throw } } catch { Write-Error "Orchestrator: Could not validate Input. Unexpected error" Write-Warning "Orchestrator: $($_.Exception.Message)" throw } ``` **Test durable function** ``` param($InputObject) Write-Information: “TestFunction” $ErrorActionPreference = "Continue" if ($test) { $array = @() try { ..do someting.. if ($Object -eq "Test") { $array += $Object } else { Write-Warning "Object is empty" } return $array } catch { Write-Warning "Unexpected error" } } ``` FYI: The function is more or less a example of my real function, so don’t get confused here. But it should be enough code to introduce you to the issue. Cutout of the execution log stream: ``` INFORMATION: Orchestrator: Validating Input INFORMATION: TestFunction WARNING: Object is empty INFORMATION: Orchestrator: Validating Input WARNING: Orchestrator: Test Function: Value cannot be null. (Parameter 'input'). Executed 'Functions.TestOrchestrator (Succeeded, Id=***, Duration=95ms) ``` **Behavior /Explanation:** The functions is trigger by a HTTP trigger (JSON file is transmitted in the http body) and the orchestrator executes the durable function (like expected) ``` INFORMATION: Orchestrator: Validating Input INFORMATION: TestFunction ``` Then a “error" happens in the durable “Test function”. But no problem, the error is catched (like expected), only a Warning message is display in the log stream: ``` WARNING: Object is empty ``` Up to here it is still expected behavior, an empty array is returned to the orchestrator (Because it could not fill in any values due to the error). **But then it gets confusing: The orchestrator runs again from the beginning, this can be seen through the log stream**: ``` INFORMATION: Orchestrator: Validating Input ``` **And jumps again into the try block of the try-catch function and trys to reexecute the test durable function (That can be verify through debugging in vscode.) FYI: There is no retry option in the orchestrator! But the second execution of the functions fails directly and he gets in the catch block. I have no idea why he thinks the "input" of the function is empty now? This can also be seen in the log stream:** ``` WARNING: Orchestrator: Test Function: Value cannot be null. (Parameter 'input'). ``` In my productive azure function I have more than one activity function and he will repeat that behavior for every other executed function. So after every other executed function he will try to execute the “TestFunction” again and fails again with this log stream message: ``` INFORMATION: Orchestrator: Validating Input WARNING: Orchestrator: Test Function: Value cannot be null. (Parameter 'input'). ``` It seems like a very strange behavior, but maybe it is a “normal” expected behavior of the orchestrator, I am not aware of. I would be glad if some could explain that to me so I am able to handle that behavior better :) Thank you very much
Azure Durable Functions PowerShell - Strange orchestrator behavior
|azure|powershell|azure-functions|azure-durable-functions|
I found a solution to this issue. In our MainActivity, initialize the PagerTabStrip like this. PagerTabStrip pagerTabStrip = (PagerTabStrip) findViewById(R.id.pager_header); ((ViewPager.LayoutParams) pagerTabStrip.getLayoutParams()).isDecor = true; **One thing to keep in mind is that it will not show any effect on the Preview of the layout. But, if you run, then you will be able to see the correct output in your device.**
|scala|scala-macros|play-json|
Inherited the 'active' field and add groups and specify which groups you want to have access to it. For example: from odoo import api, fields, models class HrAppraisalInherited(models.Model): _inherit = "hr.appraisal" active = fields.Boolean(groups="hr.group_hr_manager")
I'm encountering a System.ObjectDisposedException: Cannot access a disposed object. error when making subsequent calls to an asynchronous method designed to process uploaded files in an ASP.NET Core application. The method works fine on the first call, but throws the error on any follow-up attempts. The method in question, ProcessFileAsync, accepts an IFormFile and an API URL. It uses HttpClient provided by IHttpClientFactory for making an HTTP POST request to the specified API URL, with the file content included in the request. The method is intended to run tasks in the background and immediately return a task ID. Here's a simplified version of the method's structure: private Task<string> ProcessFileAsync(IFormFile file, string apiUrl) { // Generate a new task ID and add to a tracking dictionary string taskId = Guid.NewGuid().ToString(); _tasksStatus.TryAdd(taskId, "Processing"); // Run the processing logic in a background task Task.Run(async () => { try { using var client = _httpClientFactory.CreateClient(); // Configure client and prepare the request content using the file stream // Make the HTTP POST request // Handle the response _tasksStatus[taskId] = "Completed"; } catch (Exception ex) { _tasksStatus[taskId] = "Error"; } }); return Task.FromResult(taskId); } The error occurs when attempting to read from the file stream passed to the HttpClient. The first call processes successfully, indicating that resources and logic flow as expected initially. However, any subsequent calls result in the ObjectDisposedException error, pointing to a problem with accessing a closed file stream. Here are the key points: The error specifically mentions "Cannot access a closed file." The issue only arises on subsequent calls to the function, not the first one. The application is structured to handle file uploads and process them asynchronously. Given this, how can I ensure that each call to ProcessFileAsync can execute independently without encountering disposed object issues? Is there a specific pattern or best practice in ASP.NET Core for resetting or properly managing resources in such asynchronous, repeated operations?
How can I disable livewire dev tools on production environment?
|google-chrome-devtools|laravel-livewire|laravel-10|
I have a webpage designed based on Grid and Flexbox. One of the sections of the page is a "features" container in which two articles (class= "feature") are displayed. On screen widths up to 768px these two articles are displayed below eachother in a column. CSS: ``` .features { display: grid; grid-template-columns: repeat 1fr; gap: 2vh; } .feature { display: flex; flex-flow:column; } ``` in my media query for screen widths between 768px and 1024px the css makes sure that the articles are displayed next to eachother. CSS: ``` @media (min-width: 768px) and (max-width: 1023px) { .features { grid-template-columns: repeat(2, 1fr); } ``` Now... each article has a header and one paragraph of rougly 100 words, but the headers and paragraphs are slighlty different in length for each article. When I check my page in the inspector now and increase the screenwidth, the increasing witdh of the containers creates inconsistancies in alignment. At certain screen widths, the header of one article is on two lines and the other on one, which misaligns the paragraphs below. Plus, because the paragraphs themselves are not equally long, a different screen width might lead to one paragraph to be (i.e) on 10 lines and the other on 9 lines. I don't mind that the headers are sometimes on three, on two or on one line, but regardless of that, I want my paragraphs always to start on the same vh when the articles are displayed side by side and that if one paragraph uses more lines than the other on a certain screenwidth, that the containers of both articles are equal in height and the paragraphs starting on the same height. How do I manage that? My html is: ``` <section class="content-area"> <section class="features"> <article class="feature"> <h2>Ontdek Oostenrijk & de Alpen</h2> <p>Droom weg bij de gedachte aan een gezinsvakantie in Oostenrijk en de majestueuze Alpen. Waar zomerse valleien en winterse skipistes het decor vormen voor eindeloos avontuur en natuur. Onze blog onthult de mooiste plekjes en biedt essentiële tips voor een onvergetelijke reis. Laat je inspireren door de ongerepte natuur en beleef de Alpen op zijn best.</p> </article> <article class="feature"> <h2>Avontuur in de Dolomieten & Noord-Italië</h2> <p>Laat je gezin kennismaken met de mix van avontuur en cultuur in Noord-Italië en de Dolomieten. Ontdek wandelparadijzen, wereldklasse ski-gebieden en de betoverende kanalen van Venetië. Onze blog gidst je door adembenemende landschappen en historische steden, vol tips voor een onvergetelijke vakantie. Ontdek samen de schoonheid van Italië.</p> </article> </section> </section> ``` I tried many different things already, but kinda lost myself in all the failed attempts. Can someone point me in the right direction please?
Dynamically align Header and Paragraph from text blocks on a webpage
|html|css|
null
I have been through the same process several times and decided to share some basic demo on how to achieve this in the most easy and clean way possible. My approach is to package both the frontend and backend in docker images on the host server. I also packaged a Jenkins instance that automatically build both Angular and NestJS and reload the docker containers. You can deploy your app easily and decide to trigger a build on each commit. It will be pushed automatically to your production server. You can refer to the sample project here: https://github.com/godardth/typescript-fullstack-boilerplate
I have three lists #### Example Data ``` data =list("A-B", "C-D", "E-F", "G-H", "I-J") data_to_replace = list("A-B", "C-D") replacement = list("B-A"), "D-C") ``` This is just a minimal examples. I have several of this three-list and the number varies in each list #### Expected outcome data_new = list("B-A", "D-C", "E-F", "G-H", "I-J") #### What i have tried # function that reverses a string by words reverse_words <- function(string) { # split string by blank spaces string_split = strsplit(as.character(string), split = "-") # how many split terms? string_length = length(string_split[[1]]) # decide what to do if (string_length == 1) { # one word (do nothing) reversed_string = string_split[[1]] } else { # more than one word (collapse them) reversed_split = string_split[[1]][string_length:1] reversed_string = paste(reversed_split, collapse = "-") } # output return(reversed_string) } #Replacemnt replacement = lapply(data_to_replace, reverse_words) data_new = rapply(data, function(x) replace(x, x== data_to_replace, replacement )) #This last line did not work i have three lists #### Example Data ``` data =list("A-B", "C-D", "E-F", "G-H", "I-J") data_to_replace = list("A-B", "C-D") replacement = list("B-A"), "D-C") ``` This is just a minimal examples. I have several of this three-list and the number varies in each list #### Expected outcome data_new = list("B-A", "D-C", "E-F", "G-H", "I-J") #### What i have tried # function that reverses a string by words reverse_words <- function(string) { # split string by blank spaces string_split = strsplit(as.character(string), split = "-") # how many split terms? string_length = length(string_split[[1]]) # decide what to do if (string_length == 1) { # one word (do nothing) reversed_string = string_split[[1]] } else { # more than one word (collapse them) reversed_split = string_split[[1]][string_length:1] reversed_string = paste(reversed_split, collapse = "-") } # output return(reversed_string) } #Replacemnt replacement = lapply(data_to_replace, reverse_words) data_new = rapply(data, function(x) replace(x, x== data_to_replace, replacement )) #This last line did not work
if elements in first list equal element of second list, replace with element of third list in r
|r|string|list|
null
{"Voters":[{"Id":1145388,"DisplayName":"Stephen Ostermiller"}],"SiteSpecificCloseReasonIds":[18]}
I am using ruby '2.5.9' and rails '4.2.11.3'. I configured all needed things for this gem. I have db with column "password_ciphertext", In model: "has_encrypted :password". When I type "Password" in rails console I have error: "NameError: undefined local variable or method `attributes_to_define_after_schema_loads' for Password" Can you please explain what I am doing wrong
How to fix error in model with gem lockbox
|ruby-on-rails|ruby|ruby-on-rails-4|rubygems|
null
We need to pause the throttling of our exchange server 2013 for 90 days until we upgrade the server and exchange due to this error in the logs: Connecting Exchange server version is out-of-date; connection to Exchange Online blocked for 20 mins/hr. For more information see https://aka.ms/ExchangeBuildCompliance. It's running on Server 2012 R2. If i try and run below in Powershell it's showing as invalid i.e. not recognized. `New-TenantExemptionInfo -BlockingScenario UnpatchedOnPremServer -NumberOfDays 90` I cannot complete via this article - https://aka.ms/ExchangeBuildCompliance , as it's on prem back to a larger company Exchange Online, so the GUI report shows nothing. Anyone know what i'm doing wrong? `New-TenantExemptionInfo -BlockingScenario UnpatchedOnPremServer -NumberOfDays 90` command shows not recognized. Using powershell 5.1, exchange 2013 and Server 2012 R2
null
Where did you get `.PassFail`? That said: $result=foreach ($Data in $Json.result.data) { $Application = ($Data.dimensionMap.'dt.entity.synthetic_test') ? $Data.dimensionMap.'dt.entity.synthetic_test' : $Data.dimensionMap.'dt.entity.http_check.name' if ($Application) { [pscustomobject]@{ Application = $Application Status = $Data.Values[0] } } } $result
I believe the types are coming not from Pandas itself, but [from `pandas-stubs`][1]: ```py AxisInt: TypeAlias = int AxisIndex: TypeAlias = Literal["index", 0] AxisColumn: TypeAlias = Literal["columns", 1] Axis: TypeAlias = AxisIndex | AxisColumn ``` There's also this disclaimer at [the top of the project's README][2]: > The stubs are likely incomplete in terms of covering the published API of pandas. NOTE: The current 2.0.x releases of pandas-stubs do not support all of the new features of pandas 2.0. The best fixes for this are probably: * Either wait until the types are corrected, or * Fix it yourself by contributing to the project. You can also redefine anything you need in your own code only, but that perhaps would not be as fruitful in the long term. [1]: https://github.com/pandas-dev/pandas-stubs/blob/ae7e4737070f42658b0d684456f0abd4f2d1ac5f/pandas-stubs/_typing.pyi#L486-L489 [2]: https://The%20stubs%20are%20likely%20incomplete%20in%20terms%20of%20covering%20the%20published%20API%20of%20pandas.%20NOTE:%20The%20current%202.0.x%20releases%20of%20pandas-stubs%20do%20not%20support%20all%20of%20the%20new%20features%20of%20pandas%202.0.%20See%20this%20tracker%20to%20understand%20the%20current%20compatibility%20with%20version%202.0.
|java|apache-poi|footer|
I am trying to learn Playwright as an automation tool with Typescript. I have installed Playwright via node and also have VS Code installed. I am writing some functions by following a step by step tutorial but the result of the function doesn't show in the terminal window. How do I change the prompt from PS to Typescript? See image I have tried creating a new terminal profile and also installed all manner of VS Code Typescript extensions but still no luck. [![Typescript prompt which is what I need][1]][1][![Powershell terminal][2]][2] [1]: https://i.stack.imgur.com/vFnFI.jpg [2]: https://i.stack.imgur.com/Hzha3.jpg
How to change the VS Code terminal prompt to Typescript, rather than PowerShell or Bash?
|typescript|visual-studio-code|
I have one edittext <EditText android:id="@+id/selectvalue" style="@style/searchList" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" android:focusable="true" android:hint="@string/search_order_hint" android:imeOptions="actionSearch" android:padding="10dp" android:singleLine="true" android:textColorHint="@color/common_gray" android:textCursorDrawable="@null" android:visibility="invisible" /> I have attached TextWatcher to this. selectedValue.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { showKeyBoard(mContext, selectedValue); return false; } }); selectedValue.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void afterTextChanged(Editable s) { if (!selectedAssetType.equals(OrderBookTypes.MUTUAL_FUND_TYPE)) { loadSearchFilterData(); } } }); public void showKeyBoard(Context context, EditText edit) { InputMethodManager m = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (m != null) { edit.requestFocus(); m.toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT); } } private void loadSearchFilterData() { if (!selectedValue.getText().toString().isEmpty()) { String s = selectedValue.getText().toString(); List<BoOrderBookDao> filterList = new ArrayList<>(); for (int i = 0; i < sortedFilteredList.size(); i++) { if (sortedFilteredList.get(i).getDpVal().toLowerCase().contains(s.toLowerCase())) { filterList.add(sortedFilteredList.get(i)); } } orderBookModel.clear(); orderBookModel.addAll(filterList); } else { orderBookModel.clear(); orderBookModel.addAll(sortedFilteredList); } if (orderBookModel.size() == 0) { setErrorMsg(mContext.getResources().getString(R.string.no_data_available_txt)); } else { itemListLayout.setVisibility(View.VISIBLE); errorScrollview.setVisibility(View.GONE); } if (orderAdapter != null) { orderAdapter.requestType = requestType; orderAdapter.notifyDataSetChanged(); } } But I can not type there. Charaters are not shown when I type. If I remove `orderBookModel.addAll(filterList);` line then I can type but removing the line will break my functionality. Who can solve this?
System.ObjectDisposedException on Subsequent Calls to an Async File Processing Method in ASP.NET Core
|asp.net-core|
I am working on theory of computer science problems but cannot get these to work: > a. Give an NFA recognizing the language (01 ∪ 001 ∪ 010)<sup>\*</sup> > > b. Convert this NFA to an equivalent DFA. Give only the portion of the DFA that is reachable from the start state. > > ![1.49 Theory](https://i.stack.imgur.com/JBw3j.png) I am using the `automata.fa` package to encode the automata and have them tested. Here are examples: # example DFA syntax example_dfa = DFA( states={'q1', 'q2', 'q3', 'q4', 'q5'}, input_symbols={'0', '1'}, transitions={ 'q1': {'0': 'q1', '1': 'q2'}, 'q2': {'0': 'q1', '1': 'q3'}, 'q3': {'0': 'q2', '1': 'q4'}, 'q4': {'0': 'q3', '1': 'q5'}, 'q5': {'0': 'q4', '1': 'q5'} }, initial_state='q3', final_states={'q3'} ) # example NFA syntax example_nfa = NFA( states={"q0", "q1", "q2"}, input_symbols={"0", "1"}, transitions={ "q0": {"": {"q1", "q2"}}, "q1": {"0": {"q1"}, "1": {"q2"}}, "q2": {"0": {"q1"}, "1": {"q2"}}, }, initial_state="q0", final_states={"q1"}, ) # example regular expression syntax example_regex = "(a*ba*(a|b)*)|()" For the above question, I tried with the following diagram for the NDA: from automata.fa.nfa import NFA prob_1_17a = NFA( states={'q0', 'q1', 'q2', 'q3'}, input_symbols={'0', '1'}, transitions={ 'q0': {'0': {'q3'}, '1': {'q0'}}, 'q1': {'0': {'q1'}, '1': {'q0'}}, 'q2': {'0': {'q0'}, '1': {'q2'}}, 'q3': {'0': {'q1'}, '1': {'q2'}}, }, initial_state='q0', final_states={'q0'} ) but the autograder gives the following output: > Results: > > Running command: > ``` > $ timeout 15 python3 unit_tests/unit_test_prob_1_17a.py > ``` > UNEXPECTED RESULT ON THESE INPUTS: > ``` > ['01', '00101', '01001', '01010', '010101', '00100101', '00101001', '00101010', '01000101', '01001001', ...] > ``` > > Test for: unit_test_prob_1_17a.py > > This test gave you 0 more points How to design the correct NFA/DFA?
After scanning my project with cli-jqassistant-commandline-neo4jv4-2.1.0.jar and executing a cypher to get the value of @GET(value = "/test/two"), no record is returned. I tried the following: I have the following interface in my project ``` import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.Path; interface TestService { @POST(value = "/test/one") Call<ResponseBody> executeQuery(@Path("test") String test); @GET(value = "/test/two") Call<ResponseBody> getQuery(@Path("test") String test); } ``` I'm running cli-jqassistant-commandline-neo4jv4-2.1.0.jar to scan the project When I execute the following cypher: ``` MATCH (client:Interface)-[:DECLARES]->(m:Method) MATCH (m)-[:ANNOTATED_BY]->(ann:Annotation)-[:HAS]->(:Value{name:"value"})-[:CONTAINS]->(url:Value) return url.value ``` OR ``` MATCH (client:Interface)-[:DECLARES]->(m:Method) MATCH (m)-[:ANNOTATED_BY]->(ann:Annotation)-[:OF_TYPE]->(:Type{name:"GET"}) MATCH (ann)-[:HAS]->(:Value{name:"value"})-[:CONTAINS]->(url:Value) return m ``` I don't get anything as result. I expect to get both values value = "/test/one" and value = "/test/two" if I execute the following cypher: ``` MATCH (client:Interface)-[:DECLARES]->(m:Method) return m ``` I get the following result: ``` { "identity": 12598, "labels": [ "Java", "ByteCode", "Method", "Member" ], "properties": { "visibility": "public", "signature": "retrofit2.Call executeQuery(java.lang.String)", "name": "executeQuery", "abstract": true, "cyclomaticComplexity": 0 }, "elementId": "12598" }, { "identity": 12611, "labels": [ "Java", "ByteCode", "Method", "Member" ], "properties": { "visibility": "public", "signature": "retrofit2.Call getQuery(java.lang.String)", "name": "getQuery", "abstract": true, "cyclomaticComplexity": 0 }, "elementId": "12611" } ``` The methods are there, but the values are missing. Is this a problem of the cypher or it is not scanning and recording these values?
Waiting for several hours before resuming execution
|python-3.x|raspberry-pi|wait|sleep|
null
I have created a microservice named as USER-SERVICE and registerd it in Eureka Server locally. When i am trying to access its other modules through by java-springboot code it is accessible and service name is resolving to my local ip. But when i am hitting the main service url through chrome or postman. I am unable to do so. when i was hitting the localhost url of service it was hitting but when i replaced the localhost and port name with service name it is not able to resolve on windows. But same thing it is able to resolve through the springboot code
I registered a service in eureka which is resolving through java code. But it is not able to resolve its name when hitting through chrome or postman
|java|spring-boot|networking|dns|netflix-eureka|
null
I am working on a search problem in prolog where agent whose goal is to get to some treasure. At each time step, the agent can move between rooms using doors arranged according to an undirected graph. However, some of the doors are locked, and the agent must acquire the appropriate key in order to pass through a locked door. I worked on code, and code produces following actions "Actions = [move(0, 1), move(1, 3), move(3, 4), move(4, 2), move(2, 5), move(5, 6)]" but the supposed actions are: "Actions = [move(0, 1), move(1, 3), move(3, 4), move(4, 2), move(2, 5), move(5, 6)]." code is: ``` initial(0). door(0,1). door(0,2). door(1,2). door(1,3). door(2,4). locked_door(2,5,red). locked_door(5,6,blue). key(3,red). key(4,blue). treasure(6). initial_state(state(Pos, noKey, noKey)) :- % Initial position with no keys initial(Pos). % Moving without picking up a key or using a key take_action(state(A, RedKey, BlueKey), move(A,B), state(B, RedKey, BlueKey)) :- door(A,B). take_action(state(A, RedKey, BlueKey), move(A,B), state(B, RedKey, BlueKey)) :- door(B,A). % Picking up a red key take_action(state(A, noKey, noKey), move(A,B), state(B, hasKey(red), noKey)) :- door(A,B), key(B, red). % Picking up a blue key take_action(state(A, hasKey(red), noKey), move(A,B), state(B, hasKey(red), hasKey(blue))) :- door(A,B), key(B, blue). % open locked doors take_action(state(A, hasKey(red), hasKey(blue)), move(A,B), state(B, hasKey(red), hasKey(blue))) :- locked_door(A,B,blue). take_action(state(A, hasKey(red), hasKey(blue)), move(A,B), state(B, hasKey(red), hasKey(blue))) :- locked_door(B,A,blue). take_action(state(A, hasKey(red), hasKey(blue)), move(A,B), state(B, hasKey(red), hasKey(blue))) :- locked_door(A,B,red). take_action(state(A, hasKey(red), hasKey(blue)), move(A,B), state(B, hasKey(red), hasKey(blue))) :- locked_door(B,A,red). final_state(state(Pos, _, _)) :- treasure(Pos). take_steps(S0, [Action], S1) :- take_action(S0, Action, S1). take_steps(S0, [Action | Rest], SFinal) :- take_action(S0, Action, SNew), take_steps(SNew, Rest, SFinal). search(Actions) :- initial_state(S0), length(Actions, _), take_steps(S0, Actions, SFinal), final_state(SFinal), !. ```
I have been trying to implement the 'light preset' from https://particles.js.org/ but i can't somehow manage to get the onHover effect working. The shapes are appearing just fine but the onHover is not triggering at all and I don't know why. I tried copying the json script to the website's codepen demo and the code works fine so i assume that the problem is within my Vue Project. I tried `npm i tsparticles/vue3` and `tsparticles/slim` and the problem still persists. Below is my Vue Template Code ``` <template> <div> <vue-particles id="tsparticles" @particles-loaded="particlesLoaded" :options="particleOptions" /> </div> </template> ``` Below is the code block for the onHover and light mode ( the code is from tsParticles ) ``` onHover: { enable: true, mode: "light", parallax: { enable: false, force: 2, smooth: 10, }, }, light: { area: { gradient: { start: { value: "#3b5e98", }, stop: { value: "#17163e", }, }, radius: 1000, }, shadow: { color: { value: "#17163e", }, length: 2000, }, }, ``` I tried re-installing all packages, tried modifying the script a bit, tried different approaches to implement tsParticles but nothing seems to work. The only problem now is just the onHover effect not working, the shapes are showing and is fine.
PHPStan supports both [local](https://phpstan.org/writing-php-code/phpdoc-types#local-type-aliases) and [global](https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases) type aliases. In your case, a global type alias might be declared in the `phpstan.neon` configuration file as follows: ```yaml parameters: typeAliases: AbstractTreeNode: 'TreenodeAbstract<PayloadType, NodeType, TreeType, CollectionType>' ``` Then, you can use the `AbstractTreeNode` type alias in your code: ```php /** * @param AbstractTreeNode $node */ ``` Note that you might need to provide the fully qualified names (see [PHP name resolution rules][1]) of the types in the type alias declaration in order to avoid ambiguity, e.g.: ```yaml parameters: typeAliases: AbstractTreeNode: '\Acme\TreenodeAbstract<\Acme\PayloadType, \Acme\NodeType, \Acme\TreeType, \Acme\CollectionType>' ``` [1]: https://www.php.net/manual/en/language.namespaces.rules.php
`enter code here`Problem: I have code base with following structure: ``` root/ | |-- main.cpp |__ CMakeLists.txt | |__lib | |__ CMakeLists.txt | |__ writer.cpp | |__physics |__.. ``` `writer.cpp` uses the VTK headers to write *.vtk* files for the simulation. After updating VTK libraries (to 9.0.3), I am facing challanges to incorporate the VTK library while building my application. I am using `cmake` for writting my build setup. **root/CMakeLists.txt** ```toml cmake_minimum_required(VERSION 3.18.0) message(STATUS "CMake version: ${CMAKE_VERSION}") PROJECT(root_1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ") file(GLOB cpu_source_files "${CMAKE_SOURCE_DIR}/src/*.cpp") #--------------------------------------------------- # Includes for VTK libraries #--------------------------------------------------- find_package(VTK REQUIRED) ADD_SUBDIRECTORY(lib) include_directories(${CMAKE_SOURCE_DIR}/src/physics/) # FINAL TARGET BUILD vtk_module_autoinit(TARGETS myexe MODULES ${VTK_LIBRARIES}) target_include_directories(myexe PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${VTK_LIBRARIES}) ``` **root/lib/CMakeLists.txt** ```toml #--------------------------------------------------- # Includes for VTK libraries #--------------------------------------------------- find_package(VTK REQUIRED) # include(${VTK_USE_FILE}) # <-- not required with latest VTK #--------------------------------------------------- set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ") #--------------------------------------------------- # Definiing the source locations etc. #--------------------------------------------------- file(GLOB cpu_source_files "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") #--------------------------------------------------- # Building executables # ****** Note ******** maintain the order #--------------------------------------------------- add_library(Writers SHARED ${cpu_source_files}) set_property(TARGET Writers PROPERTY POSITION_INDEPENDENT_CODE ON) #--------------------------------------------------- # Include relative path during compilation #--------------------------------------------------- vtk_module_autoinit(TARGETS Writers MODULES ${VTK_LIBRARIES}) target_include_directories(Writers PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${VTK_LIBRARIES}) ``` The above setup leads me to the error, **VTK headers (included in my writers.cpp) NOT FOUND** **UPDATE ERROR WHEN BUILDING** ```bash m_infoStepCheck == 1; ^ Remark: individual warnings can be suppressed with "--diag_suppress <warning-name>" "root/lib/ioLib/simulationInputs/domainParams.cpp", line 61: warning: expression has no effect [expr_has_no_effect] m_writeStepCheck == 1; ^ [ 32%] Building CXX object lib/lib.dir/fluidParams.cpp.o [ 35%] Building CXX object lib/lib.dir/geometryInputFileParams.cpp.o [ 38%] Building CXX object lib/lib.dir/outputParams.cpp.o [ 41%] Building CXX object lib/lib.dir/physicalParams.cpp.o [ 45%] Building CXX object lib/lib.dir/restartSimulationParams.cpp.o [ 48%] Building CXX object lib/lib.dir/simulationSettings.cpp.o [ 51%] Linking CXX shared library lib.so [ 51%] Built target SimulationInputs [ 54%] Building CXX object lib/lib.dir/writers.cpp.o "root/lib/writers.cpp", line 20: catastrophic error: cannot open source file "vtkPolyData.h" #include <vtkPolyData.h> ^ 1 catastrophic error detected in the compilation of "/root/lib/writers.cpp". Compilation terminated. gmake[2]: *** [lib/CMakeFiles/writers.cpp.o] Error 2 gmake[1]: *** [lib/CMakeFiles/lib.dir/all] Error 2 gmake: *** [all] Error 2 ``` My question is **What is the standard procedure to add VTK Library (latest) to application**
Gradients don't support signals but you can define a gradient in a signal. e.g. Here you could switch between two different gradients - test1 and test2. { "$schema": "https://vega.github.io/schema/vega/v5.json", "width": 200, "height": 200, "padding": 5, "signals": [ { "name": "test1", "update": "{gradient: 'linear', stops: [{offset: 0, color: 'green'}, {offset: 1, color: 'red'}]}" }, { "name": "test2", "update": "{gradient: 'linear', stops: [{offset: 0, color: 'red'}, {offset: 1, color: 'green'}]}" } ], "marks": [ { "type": "rect", "encode": { "enter": { "x": {"value": 0}, "x2": {"value": 100}, "y": {"value": 0}, "y2": {"value": 400}, "fill": {"signal": "test1"} } } } ] }
|json|visualization|vega-lite|vega|vega-embed|
I made a `var sample = Public Subject <[]>()` and I'm going to draw a vowel view with it. If the number of `samples` is 0, I would like to draw one collection View cell, and if it is more than one, I would like to draw according to the number of `samples`. self.viewModel.sample .bind(to: collectionView.rx.items(cellIdentifier: "cell", cellType: Cell.self)) { index, item , cell in } .disposed(by: disposeBag) I only know how to implement it as above. What should I do? This is my first time using RxSwift. I don't know what to do.
Please tell me how I can use RxSwift to draw the collection View cells according to the number of data
|swift|uicollectionview|rx-swift|
null
I am trying to update column value of filtered data in excel via VBA I wrote a small macro, which do filter on below table. [![enter image description here][1]][1] [1]:https://i.stack.imgur.com/P2ShF.png After running macro to filter the sheet, I see below [![enter image description here][2]][2] [2]:https://i.stack.imgur.com/MCN89.png Now what I want to do is, I want to update Location value of filtered data. I am trying by using below: `Range("E100000").SpecialCells(xlCellTypeVisible).Offset(1,0).value ="Abc"` this set value always at A2 cell which is not part of filtered data. Need help on how to set /update value one by one in column E for filtered data. Thanks in Advance! Vikas here is my code: Sub Macro3() Dim sh As Worksheet Set sh = ThisWorkbook.Sheets("TempSheet") weeklyCommCount = InputBox"Enter Weekly Communication Count (in number)") repeateDate = CDate(InputBox"Enter Planning Start Date ('DD-MMM-YY')", "CHR Planning", "01-Apr-24")) For i = 1 To 40 For j = 1 To weeklyCommCount 'this is working when sheet is not filtered Range("E100000").End(xUp). Offset(1, 0). Value = repeate Date "not working setting alads a Ariying below whic is Range("E100000").SpecialCells(x|Cel|TypeVisible). Offs et(1, 0). Value = repeateDate Next repeateDate = repeateDate + 7 Next End Sub
I am trying to improve my INP. As I am checking the performance panel and notice there is a function takes a very long time to complete, while itself only consumes 0.41ms, and in the timeline chart, the function is doing nothing. Why it takes so long just to wait? And why this period is not considered "idle"? Can somebody explain? Thanks! [![enter image description here][1]][1] update: May I know which one should I choose? [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/PGE7u.png [2]: https://i.stack.imgur.com/cULpA.png
I have a table I'm trying to sort by column values in Stage. It looks something like this: |CaseID|Stage|EventDate| |------|-----|---------| |1 |A |01/01/10 | |1 |B |01/03/10 | |1 |B |01/04/10 | |1 |C |01/05/10 | |2 |A |02/01/10 | |2 |B |02/02/10 | |2 |C |02/03/10 | |2 |C |02/05/10 | I'm trying to organize the data by the Stage so that only the latest `EventDate` is shown - something like this: |CaseID|A |B |C | |------|--------|--------|--------| |1 |01/01/10|01/04/10|01/05/10| |2 |02/01/10|02/02/10|02/05/10| I did a `group by` statement ``` SELECT CaseID, CASE WHEN Stage = 'A' THEN MAX(EventDate) END AS A, CASE WHEN Stage = 'B' THEN MAX(EventDate) END AS B, CASE WHEN Stage = 'C' THEN MAX(EventDate) END AS C FROM StageTable GROUP BY CaseID, Stage ``` But this returned too many rows with NULL placeholders: |CaseID|A |B |C | |------|--------|--------|--------| |1 |01/01/10|NULL |NULL | |1 |NULL |01/04/10|NULL | |1 |NULL |NULL |01/05/10| |2 |02/01/10|NULL |NULL | |2 |NULL |02/02/10|NULL | |2 |NULL |NULL |02/05/10| I'd like for each row to condense, but I don't know where I went wrong. I've seen other questions with similar questions, but they all seemed to have issues with joint tables showing duplicate results. Any suggestions would be helpful
Group By clause returning too many rows
If there's no requirement to put your binary bits in individual cells, you can directly count the one's in a decimal number very simply, by converting it to a binary string, removing the zeros, and measuring the remaining length: 116 = 1110100 , four ones LEN(SUBSTITUTE(DEC2BIN(116,7),"0",""))
To design an NFA for the language (01 ∪ 001 ∪ 010)<sup>\*</sup> we could take it step by step. First design a diagram for the language (01)<sup>\*</sup>: [![nfa1][1]][1] q<sub>0</sub> is the start and accept state, and q<sub>4</sub> is the sink for invalid input. Then extend it to (01 ∪ 001)<sup>\*</sup>: [![nfa2][2]][2] And then complete to (01 ∪ 001 ∪ 010)<sup>\*</sup>: [![enter image description here][3]][3] To design a corresponding DFA, define a state for each possible set of states in the NFA. So for instance (<sub>1</sub>,<sub>2</sub>) is one such state, and (<sub>0</sub>,<sub>1</sub>,<sub>2</sub>) is another. There are many of such states, but only some are really reachable. Using [powerset construction](https://en.wikipedia.org/wiki/Powerset_construction) we can identify which input prefixes lead to which states in the NFA, and we can assign to each unique state combination a distinct DFA state. As soon as we find a same combination of NFA states that we already encountered with another prefix, we don't need to lengthen that prefix more, and so we get this table of possibilities: | prefix | NFA states | DFA state | | ------ | ---------- | --------- | | ε | <sub>0</sub> | <sub>0</sub> | | 0 | <sub>1</sub>,<sub>2</sub> | <sub>12</sub> | | 00 | <sub>1</sub> | <sub>1</sub> | | 000 | <sub>4</sub> | <sub>4</sub> | | 001 | <sub>0</sub> | <sub>0</sub> | | 01 | <sub>0</sub>,<sub>3</sub> | <sub>03</sub> | | 010 | <sub>0</sub>,<sub>1</sub>,<sub>2</sub> | <sub>012</sub> | | 0100 | <sub>1</sub>,<sub>2</sub> | <sub>12</sub> | | 0101 | <sub>0</sub>,<sub>3</sub> | <sub>03</sub> | | 011 | <sub>4</sub> | <sub>4</sub> | | 1 | <sub>4</sub> | <sub>4</sub> | I chose names for the states of the DFA that reflect how they map to a set of states in the NFA. Each DFA state that corresponds to an NFA state combination that includes <sub>0</sub> is accepting. This leads to the following DFA: [![enter image description here][4]][4] ### Python code The above NFA and DFA can be represented as follows: ```python nfa = NFA( states={'q0', 'q1', 'q2', 'q3', 'q4'}, input_symbols={'0', '1'}, transitions={ 'q0': {'0': {'q1','q2'}, '1': {'q4'}}, 'q1': {'0': {'q4'}, '1': {'q0'}}, 'q2': {'0': {'q1'}, '1': {'q3'}}, 'q3': {'0': {'q0'}, '1': {'q4'}}, 'q4': {'0': {'q4'}, '1': {'q4'}} # Sink }, initial_state='q0', final_states={'q0'} ) dfa = DFA( states={'q0', 'q1', 'q12', 'q03', 'q012', 'q4'}, input_symbols={'0', '1'}, transitions={ 'q0' : {'0': 'q12', '1': 'q4' }, 'q12' : {'0': 'q1', '1': 'q03'}, 'q1' : {'0': 'q4', '1': 'q0' }, 'q03' : {'0': 'q012', '1': 'q4' }, 'q012': {'0': 'q12', '1': 'q03'}, 'q4': {'0': 'q4', '1': 'q4' } # Sink }, initial_state='q0', final_states={'q0', 'q03', 'q012'} ) ``` [1]: https://i.stack.imgur.com/x8g6Z.png [2]: https://i.stack.imgur.com/UMbwe.png [3]: https://i.stack.imgur.com/8aCLd.png [4]: https://i.stack.imgur.com/Sa6py.png
tsParticles onHover not working on my Vue Project
|javascript|json|vuejs3|vue-component|tsparticles|
null
Autodesk Viewer on Premise
// initialize plugin const havokInstance = await HavokPhysics(); // pass the engine to the plugin const hk = new BABYLON.HavokPlugin(true, havokInstance); // enable physics in the scene with a gravity scene.enablePhysics(new BABYLON.Vector3(0, -9.8, 0), hk);
When the page overflows, that is when not everything on the page can be displayed without any scrolling, then the page automatically jumps to the question part of the survey page. Is there a way to prevent this with Javascript or CSS so that every page in the survey starts from the top? I already tried to add this code to the JS of the questions: Qualtrics.SurveyEngine.addOnload(function() { window.scrollTo(0,0); }); but unfortunately it did not work.
Qualtrics: Page does not start at the top
|javascript|css|qualtrics|
Three bugs that I can see, including some spotted in comments. ---- ``` MOV AH, 09H LEA AX, msg3 INT 21H ``` Looks like a typo for `LEA DX, msg3`. As it stands you will have a random value in AH (the high byte of the address of `msg3` and will be executing some random DOS function. That might be what crashes DosBox. Also, more efficient than `LEA` here (and in the other similar instances) would be `MOV DX, OFFSET msg3` which has the same effect and saves one byte. ---- ``` XOR AX, AX MOV DX, 10H DIV DX ``` First, you zeroed out `AX` thus discarding the total value you so carefully computed (remember, `AX` emcompasses both `AH` and `AL`). Second, `DIV r/m16` is a 32 by 16 bit division: it divides the 32-bit unsigned value in `DX:AX` by the value in `r/m16`, with the quotient placed in `AX` and the remainder in `DX`. So here you are dividing `100000H` by `10H`; the quotient is `10000h` which overflows 16 bits, and so you will get a divide overflow exception. This could also be the cause of the crash, though I seem to recall that real MS-DOS had a handler for the divide overflow interrupt that would print a message and terminate the program, without crashing the system. I'm not sure if DosBox provides that, however. Also, `10H` is hex, so you're dividing by sixteen. I'm assuming you probably wanted decimal output, so you want to divide by ten (`10`) instead. Thus, I think you probably meant ``` XOR AH, AH ; zero-extend AL into AX MOV DL, 10 DIV DL ``` to do a 16 by 8 bit divide of the number from `AL` (extended with zeros to produce a 16-bit value in `AX`) by `10H`, placing the quotient in `AL` and the remainder in `AH`. ---- ``` MOV AH, 02H MOV DL, Q INT 21H ``` You need to add `'0'` to the values `Q` and `R` to create printable ASCII characters for output.
I know its late but for any one who is looking for this ``` SELECT employee_id, date, MIN(time) as check-in, MAX(time) as check-out FROM attendance GROUP BY employee_id, date; ```
How to localize "Today" in the Delphi TMonthCalendar?
multiple file components and false positives with eslint
For your case, the line `ent.bind('<Return>', btn_confirm.invoke())` will execute `btn_confirm.invoke()` immediately and then assign the result (a tuple) as the binding callback. The line should be `ent.bind('<Return>', lambda e: btn_confirm.invoke())` instead. Also it is not a good practice to call multiple functions inside a lambda. It is better to put those multiple functions inside another function: ```python def func(): main.save_template(entry_input.get(), filedialog.askdirectory()) update_main_window(label, listbox) create_template_window.destroy() ent = tk.Entry(frm_top, textvariable=entry_input) ent.bind("<Return>", lambda e: func()) btn_confirm = tk.Button(frm_inner_bot, text="Confirm", width=25, height=2, command=func)
I'd like to know how to insert a column into an array. I know the push function to add a row but not how to add a column like that: A ; 1 B ; 2 C ; 3 D ; 4 to : A ; **A1** ; 1 B ; **B2** ; 2 C ; **C3** ; 3 D ; **D4** ; 4 I guess I will have to loop between each row to add an item between two item but is there a way to do it as a bulk ? Thanks in advance !
Google Appscript insert column in array
|javascript|google-apps-script|
null
### Goal: So I'm just building a little project for my school, and i have a little old computer that i'm using as a server now. <br> My **goal** is to make the **FTP container** public using **ngrok** container so that i can access it using a domain from anywhere. ________ ### Setup: - Ubuntu Server - Docker - compose.yaml - ngrok.yml ________ ### Expected: So i have created a *compose.yaml* that should pretty much build the desired service. <br> Sensitive data, like the user and password, are passed to the containers using secrets.<br> **In the ftp:** A shell command creates an environment variable and stores the secret value so the FTP container grants access.<br> **In the ngrok:** pretty much follows the same logic, but instead of creating an environment, it changes the value of the AUTH_TOKEN to the actual token in the ngrok.yml file.<br> Then i should be able to connect from anywhere and transfer files. _______________ ### Current behavior: When building the service with Docker Compose, I receive a warning from the daemon `WARN[0000] The "AUTH_TOKEN" variable is not set. Defaulting to a blank string.`, but daemon can still finish the build.<br> However, when I look at the running containers using `docker ps`, they are always restarting: <br> ```bash CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4f4e56f716cc ngrok/ngrok:latest "/nix/store/n98vsmwd…" 6 minutes ago Restarting (1) 26 seconds ago app-ngrok-1 ec97742b74fc delfer/alpine-ftp-server:latest "/sbin/tini -- /bin/…" 6 minutes ago Restarting (0) 28 seconds ago app-ftp-1 ``` Upon inspecting the ftp container, it logs the following: ``` deluser: can't find alpineftp in /etc/group Changing password for alpineftp New password: Bad password: similar to username Retype password: passwd: password for alpineftp changed by root ``` Similarly, when inspecting ngrok, it logs the following: ``` ERROR: unknown shorthand flag: 'c' in -c ``` ___________ ### Questions: - How can I pass the values using secrets ? - Is there a better approach to pass secrets ? ________________ I'm learning how to use Docker, and that's why I'm building this little project. <br> I'm not good at bash since my knowledge is limited, but i'm all ears and really looking forward to growing! ### Code: #### compose.yaml: ```yml version: "3.8" services: ftp: image: delfer/alpine-ftp-server:latest restart: always command: - "/bin/sh" - "-c" - "USERS=$(cat /run/secrets/FTP_USERS); export USERS" environment: - ADDRESS=some-generated-domain.ngrok-free.app volumes: - /mnt/storage/public:/ftp networks: - public_web secrets: - FTP_USERS ngrok: image: ngrok/ngrok:latest restart: always command: - "/bin/sh" - "-c" - "AUTH_TOKEN=$(cat /run/secrets/AUTH_TOKEN); sed -i `s/AUTH_TOKEN/$AUTH_TOKEN/g` /etc/ngrok.yml;" - "start" - "--all" - "--config" - "/etc/ngrok.yml" volumes: - /mnt/storage/conf/ngrok.yml:/etc/ngrok.yml depends_on: - ftp networks: - public_web ports: - 21:21 secrets: - AUTH_TOKEN networks: public_web: secrets: AUTH_TOKEN: file: /mnt/storage/.secrets/ngrokToken.txt FTP_USERS: file: /mnt/storage/.secrets/ftpUsers.txt ``` #### ngrok.yml: ```yml authtoken: AUTH_TOKEN region: eu tunnels: ftp: labels: - hostname=Transfer_Files - service=ftp proto: tcp addr: 21 hostname: some-generated-domain.ngrok-free.app ```
Is there a possibility to mark enum values as deprecated in OpenAPI defintion? ``` type: string title: CustomEnum enum: - Value1 - Value2 ```
Mark OpenAPI schema enum value as deprecated
|yaml|swagger|openapi|openapi-generator|springdoc-openapi-ui|
It appears that your `GROUP BY` is grouping the entirety of each `InvoiceHeader` row, while the other table references are only used to calculate sums for details and payments. In that case, I believe that is would be simpler to select directly from `InvoiceHeader` only at the top level and use `CROSS APPLY` subqueries to calculate the various sums. The other thing I see, and this is a *big red flag*, is that your posted query appears to have **multiple independent one-to-many joins**. This will almost never yield the correct result. If an invoice had three details, two cash payments and two cheque payments, the details would be overstated by a factor of 4 and payments would each be overstated by a factor of 6. The fix is to isolate each one-to-many relationship into a separate `CROSS APPLY` and calculate the totals of each independently. The `DocumentNumber` can also (optionally) be moved to a `CROSS APPLY`, solely for the purpose of reducing clutter in the main select list. These `CROSS APPLY` results can then be referenced in the top level select list. The updated query would be something like: ``` SELECT M.InvoiceID, M.InvoiceNumber, M.InvoiceNumber1, M.IsOther, M.OtherName, M.OtherNationalNo, M.Date, DSUM.LineTotal + DSUM.Extra - DSUM.Reduction + DSUM.Discount AS SumTotal, DSUM.Discount, DSUM.Vat, DSUM.Tax, DSUM.LineTotal - DSUM.Vat - DSUM.Tax - DSUM.Extra - DSUM.Reduction AS TotalNet, M.OnlineInvoiceFlag, M.RecordType, M.InvoiceKindFK, M.StoreFK, M.AccountFK, M.PaymentTermFK, M.DeliverAddress, DN.DocumentNumber, M.Time, M.Description, M.SubTotal, M.Reduction, M.Extra, M.ProjectFK, M.CostCenterFK, M.MarketerAccountFK, M.MarketingCost, M.DriverAccountFK, M.DriverWages, M.SettelmentDate, M.DueDate, M.FinancialPeriodFK, M.CompanyInfoFK, M.PrintCount, M.LetterFK, M.InvoiceFK, dbo.getname(M.AccountFK, M.AccountGroupFK, M.FinancialPeriodFK) AS AccountTopic, M.AccountGroupFK, RCSUM.ReceivedCash, RQSUM.ReceivedCheque FROM Sales.InvoiceHeader M CROSS APPLY ( SELECT ISNULL(SUM(ISNULL(D.LineTotal, 0)), 0) AS LineTotal, ISNULL(SUM(ISNULL(M.Extra, 0)), 0) AS Extra, ISNULL(SUM(ISNULL(M.Reduction, 0)), 0) AS Reduction, ISNULL((SUM(ISNULL(D.DiscountAmount, 0)), 0) AS Discount, ISNULL((SUM(ISNULL(D.VatAmount, 0)), 0) AS Vat, ISNULL((SUM(ISNULL(D.TaxAmount, 0)), 0) AS Tax FROM Sales.InvoiceDetail D WHERE D.InvoiceFK = M.InvoiceID AND D.InvoiceKindFK = M.InvoiceKindFK AND D.FinancialPeriodFK = M.FinancialPeriodFK ) DSUM CROSS APPLY ( SELECT ISNULL(SUM(RC.Price), 0) AS ReceivedCash FROM Banking.ReceivedCash RC WHERE RC.SalesInvoiceHeaderFK = M.InvoiceNumber AND RC.FinancialPeriodFK = M.FinancialPeriodFK ) RCSUM CROSS APPLY ( SELECT ISNULL(SUM(Banking.ReceivedCheque.Price), 0) AS ReceivedCheque FROM Banking.ReceivedCheque RQ WHERE RQ.SalesInvoiceHeaderFK = M.InvoiceNumber AND RQ.FinancialPeriodFK = M.FinancialPeriodFK ) RQSUM CROSS APPLY ( SELECT MAX(DocumentFK) AS DocumentNumber FROM Accounting.DocumentDetail DD WHERE DD.ItemFK = @Item + CAST(M.InvoiceNumber AS nvarchar(10)) AND DD.documenttypeid = @DocumentTypeFK AND DD.financialPeriodFK = @FinancialPeriodFK ) DN WHERE ( (M.InvoiceKindFK = @InvoiceKindFK) AND (M.FinancialPeriodFK = @FinancialPeriodFK)) ORDER BY M.StoreFK, M.InvoiceNumber; ``` A `CROSS APPLY` is like an `INNER JOIN` to a subselect. For each usage above, the aggregate functions will always produce a single scalar result, so each should produce exactly one row. (If that was not the case, an `OUTER APPLY` would have been appropriate - equivalent to a `LEFT JOIN` to a subselect.) I wrapped the `SUM()`s up in additional `ISNULL()` functions to ensure a zero result if no matching rows were found. I presume that: * Every invoice should have at least one and perhaps multiple detail rows. * Every invoice may have zero, one, or multiple cash payment rows. * Every invoice may have zero, one, or multiple cheque payment rows. Be sure to test the final query using all combinations of the above conditions, carefully checking that the calculated sums are correct. Also check your `InvoiceDetail` join conditions. The referenced columns are not the same as defined in your `FK_InvoiceDetail_InvoiceHeader` foreign key constraint. (The other three table definitions were not posted, but might also be worth a review.)
If someone stumbles upon this thread as I did, here is the Github issue connected to this problem: https://github.com/material-components/material-components-android/issues/3625 The issue appears closed but its not yet resolved, there is still a PR open which hopefully makes it into an upcoming release, at the moment the only "workaround" except for waiting for the fix is to downgrade the material lib to 1.9.0, would not do that personally but if you really want this to work.
I have a dataset that contains ECG and EEG values for 23 patients for 18 videos each. these videos are linked to a target emotion that I am trying to predict. now there are 8 target emotions as per the dataset but I have reclassified them down to 0 - not fear and 1 - fear. This leads to a class imbalance in the ratio 1:7 (fear:not fear). I am getting false accuracies in the 90% range due to this. I would really appreciate some help in fixing this. ``` import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix from sklearn import svm from sklearn.datasets import make_classification from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score from sklearn.model_selection import cross_val_score from sklearn.linear_model import LogisticRegression from sklearn.metrics import confusion_matrix, recall_score, precision_score, f1_score, accuracy_score from sklearn.model_selection import KFold import seaborn as sns from sklearn.metrics import classification_report from imblearn.over_sampling import SMOTE def evaluate_cv_model(model, data, target, kFolds): a_score = cross_val_score(model, data, target, cv=kFolds, scoring='accuracy') accuracy = a_score.mean() ​ return accuracy def plot_confusionMatrix (clf, y_test, X_test): y_pred = clf.predict(X_test) cm = confusion_matrix(y_test, y_pred) cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis] sns.heatmap(cm, annot=True, fmt='.2f', cmap="Blues") plt.ylabel('True label') plt.xlabel('Predicted label') report = classification_report(y_test, y_pred) plt.show() return report def KNN(X_train, y_train, X_test, y_test, num_neighbors): # create the model KNN = KNeighborsClassifier(n_neighbors = num_neighbors) # fit the model KNN.fit(X_train, y_train) # get the accuracy test_accuracy = KNN.score(X_test, y_test) train_accuracy = KNN.score(X_train, y_train) # predict the values prediction = KNN.predict(X_test) return test_accuracy, train_accuracy, prediction, KNN def SVM (X_train, y_train, X_test, y_test, kernel): # create the model for multiclass classification SVM = svm.SVC(kernel=kernel, C=1, decision_function_shape='ovo') # fit the model SVM.fit(X_train, y_train) # get the accuracy test_accuracy = SVM.score(X_test, y_test) train_accuracy = SVM.score(X_train, y_train) # predict the values prediction = SVM.predict(X_test) return test_accuracy, train_accuracy, prediction, SVM def Logistic_Regression (X_train, y_train, X_test, y_test): # create the model with increased max_iter log_reg = LogisticRegression(multi_class='multinomial', solver='lbfgs', max_iter=1000) # fit the model log_reg.fit(X_train, y_train) # get the accuracy test_accuracy = log_reg.score(X_test, y_test) train_accuracy = log_reg.score(X_train, y_train) # predict the values prediction = log_reg.predict(X_test) return test_accuracy, train_accuracy, prediction, log_reg ECG_data = pd.read_csv('/kaggle/input/ecgdata/binary_ECG.csv') ECG_data.drop(['Unnamed: 0','video_name'], axis=1, inplace=True) y_ECG = ECG_data.target X_ECG = ECG_data.drop('target' , axis = 1) # Applying SMOTE to handle class imbalance smote = SMOTE(sampling_strategy='auto', random_state=42) X_train_resampled, y_train_resampled = smote.fit_resample(X_train_ECG, y_train_ECG) kf = KFold(n_splits=8, random_state=42 , shuffle = True) X_train_ECG, X_test_ECG, y_train_ECG, y_test_ECG = train_test_split(X_ECG, y_ECG, test_size = 0.2, random_state = 42) y_test_ECG = np.array(y_test_ECG) def Evaluate (y_test, prediction): accuracy = accuracy_score(y_test, prediction) precision = precision_score(y_test, prediction, average='weighted') recall = recall_score(y_test, prediction, average='weighted') f1 = f1_score(y_test, prediction, average='weighted') return accuracy, precision, recall, f1 ``` I have tried to train using SVM, KNN and logistic regression. While trying to implement SMOTE I am getting a convergence error for the logistic regression that simple does not seem to go away even if i increase max_iter to the maximum permissible limit in python.
I need some help in solving a class imbalance problem while trying to perform binary classification on ECG and EEG data
|python|machine-learning|imbalanced-data|
null
Add spaces, they are syntactically required and won’t appear in the resulting string: <!--language: lang-python--> >>> names = ['a', 'b', 'c'] >>> pks = [1, 2, 3] >>> f"{ {name: pk for name, pk in zip(names, pks)} }" # ▲ ▲ # │ │ # ╰───────────────See the spaces?────────────╯ "{'a': 1, 'b': 2, 'c': 3}"
I addressed this issue (twice now) using `fastlane` (`brew install fastlane`): 1. Reinstall all simulators: `fastlane snapshot reset_simulators` 2. Open **Simulator** manually (this is important) 3. Relaunch your React Native app from the CLI or however else you do it _Note: This will wipe out all your current simulators so just make sure you haven't done any special configuration in/on them that you'll need to keep. But otherwise it should be a quickfix._
I'm using Bootstrap 5.3 and query 3.7.1 And I am trying to create a tab with miltiple dropdowns. the tab and dropdown works and open the correct pane. it also highlights the correct drodown selected. but it does not highlight the correct tab of the item selected. any idea how to fix this? thank you. ``` <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"> <div class="container"> <div class='row'> <div class='col-md-12'> <ul class="nav nav-tabs tabs-line d-flex justify-content-center mb-4" role="tablist"> <li class="nav-item dropdown" role="presentation"> <a href="#" id="dropName" class="nav-link dropdown-toggle active" data-bs-toggle="dropdown" role="button" aria-expanded="false">TAB 1</a> <ul class="dropdown-menu"> <li class="nav-item drop-item"> <button class="dropdown-item nav-link active" id="tab-1" data-bs-toggle="tab" data-bs-target="#tabs-1" type="button" role="tab" aria-controls="tabs-1" aria-selected="false"> tab 1 Item 1 </button> </li> <li class="nav-item drop-item"> <button class="dropdown-item nav-link" id="tab-1-2" data-bs-toggle="tab" data-bs-target="#tabs-1-2" type="button" role="tab" aria-controls="tabs-1-2" aria-selected="false"> tab 1 Item 2 </button> </li> </ul> </li> <li class="nav-item dropdown" role="presentation"> <a href="#" id="dropName" class="nav-link dropdown-toggle" data-bs-toggle="dropdown" role="button" aria-expanded="false">TAB 2</a> <ul class="dropdown-menu"> <li class="nav-item drop-item"> <button class="dropdown-item nav-link" id="tab-2" data-bs-toggle="tab" data-bs-target="#tabs-2" type="button" role="tab" aria-controls="tabs-2" aria-selected="false"> Tab 2 Item 1 </button> </li> <li class="nav-item drop-item"> <button class="dropdown-item nav-link" id="tab-2-2" data-bs-toggle="tab" data-bs-target="#tabs-2-2" type="button" role="tab" aria-controls="tabs-2-2" aria-selected="false"> tab 2 Item 2 </button> </li> </ul> </li> </ul> <div class="tab-content" id="content"> <div class="row tab-pane fade show active" id="tabs-1" role="tabpanel" aria-labelledby="tab-1"> <H1>This Is Content Of Item 1 1 </H1> </div> <div class="row tab-pane fade" id="tabs-1-2" role="tabpanel" aria-labelledby="tab-2"> <H1>This Is Content Of Item 1 2 </H1> </div> <div class="row tab-pane fade" id="tabs-2" role="tabpanel" aria-labelledby="tab-2"> <H1>This Is Content Of Item 2 1 </H1> </div> <div class="row tab-pane fade" id="tabs-2-2" role="tabpanel" aria-labelledby="tab-2-2"> <H1>This Is Content Of Item 2 2 </H1> </div> </div> </div> <!-- end snippet --> ```
bootstrap 5 multiple tab dropdown with tab pane
|twitter-bootstrap|
Given a **host** compiler that supports it, you can use `std::bit_cast` in CUDA C++20 **device** code to initialize a `constexpr` variable. You just need to tell nvcc to make it possible by passing [`--expt-relaxed-constexpr`][1]. This flag is labeled as an "Experimental flag", but to me it sounds more like "this flag might be removed/renamed in a future release" than a "here be dragons" in terms of its results. [1]: https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#expt-relaxed-constexpr-expt-relaxed-constexpr
<!-- language-all: sh --> The registry key of origin and the comparison operand imply that you're dealing with _version numbers_. **To meaningfully compare version numbers based on their _string representations_, cast them to `[version]`**: ``` [version] $soft.DisplayVersion -lt [version] '124.0' ``` Note: * For brevity, you could omit the RHS `[version]` cast, because the LHS cast would implicitly coerce the RHS to `[version]` too. However, using it on both sides can help conceptual clarity. * For a [`[version]`](https://learn.microsoft.com/en-US/dotnet/api/System.Version) cast to succeed, the input string must have _at least 2_ components (e.g. `[version] '124.0'` and _at most 4_ (e.g, `[version] '124.0.1.2'`), and each component must be a positive decimal integer (including `0`). * `[version]` is _not_ capable of parsing [_semantic_ version numbers](https://semver.org/), however, which are limited to _3 components_ and may contain non-numeric suffixes (e.g., `7.5.0-preview.2`). * Use **[`[semver]`](https://learn.microsoft.com/en-US/dotnet/api/System.Management.Automation.SemanticVersion) to parse *semantic versions***; however, that type is available in [_PowerShell (Core) 7_](https://github.com/PowerShell/PowerShell/blob/master/README.md) only. * Unlike with `[version]`, a _single_ component is sufficient in the input string of a `[semver]` cast; e.g., `[semver] '124'` works to create version `124.0.0`.
|java|jar|minecraft|openai-api|