Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
58,395,566
lsb_release: command not found in latest Ubuntu Docker container
<p>I just wanted to test something out real quick. So I ran a docker container and I wanted to check which version I was running:</p> <pre><code>$ docker run -it ubuntu root@471bdb08b11a:/# lsb_release -a bash: lsb_release: command not found root@471bdb08b11a:/# </code></pre> <p>So I tried installing it (as <a href="http://www.andryhacks.com/bash-lsb_release-command-not-found/" rel="noreferrer">suggested here</a>):</p> <pre><code>root@471bdb08b11a:/# apt install lsb_release Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package lsb_release root@471bdb08b11a:/# </code></pre> <p>Anybody any idea why this isn't working?</p>
<linux><docker><ubuntu><containers><version>
2019-10-15 13:11:19
HQ
58,396,632
How open other tools like htop, vim by os's package of go (golang)?
I'm writing a new project like a CLI with Go and I'm using the package [termui][1], but in a time, I need that CLI open a file with editor like VIM without exit the current CLI, when close the VIM I can back to current CLI. Is it possible? I've tried with this example below: ```go package main import ( "log" "os/exec" ) func main() { // render the termui path := "SomeFile.bash" cmd := exec.Command("vim", path) err := cmd.Run() if err != nil { log.Fatal(err) } } ``` [1]: https://github.com/gizak/termui
<go>
2019-10-15 14:07:44
LQ_EDIT
58,397,964
Are there maximum limits to VStack?
<p>I started with a clean project and added 5 buttons and 5 spacers in a VStack and all is good. When I add the 6th spacer at the bottom, the code suddenly won't compile with the error: "Ambiguous reference to member 'buildBlock()'".</p> <p>What is causing this error? Is this a bug related to SwiftUI? Or is it a feature? It's not the first time I notice that VStack or HStack is limited in the number of entries, is there some documentation around this?</p> <p>Not exactly confidence inspiring, should I switch back to UIKit?</p>
<swiftui><vstack>
2019-10-15 15:17:51
HQ
58,398,916
Proper filenames in iOS project
<p>I've been told during a job assignment review, that I used weird filenames in my iOS project.</p> <p>I've added a picture of my project tree. Could you explain me what's weird about these names or if there are any flaws in the tree structure?</p> <p>Thanks</p> <p><a href="https://i.stack.imgur.com/VQkkK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VQkkK.png" alt="enter image description here"></a></p>
<ios><swift><xcode>
2019-10-15 16:19:15
LQ_CLOSE
58,399,735
How to deploy a project made in PHP with MVC structure in Google APP Engine?
I hope you can help me, I have the following problem: I am uploading my PHP project with MVC structure to Google App Engine, when I deploy everything is fine, but when I show it in the browser, I do not send, inspect the console and mark me css file errors. One of the mistakes I usually get is this: Resource interpreted as Stylesheet but transferred with MIME type text / javascript My structure of my project is as follows: [enter image description here][1] and the structure the app.yaml file is as follow: [enter image description here][2] [1]: https://i.stack.imgur.com/VJGd8.png [2]: https://i.stack.imgur.com/IgfrL.png
<php><css><google-app-engine>
2019-10-15 17:19:26
LQ_EDIT
58,403,521
How do i generate a random number that only shows up Once?
<p>I'm trying to generate up to 5 numbers between 0-4 and doesn't re generate the same number more than once. The program will stop after three attempts, therefore the random numbers generated should read 4,3,2 and not 4,3,4(For example).</p> <p>I've created an array with 5 string elements in it. at least 3 of the strings in the array will be displayed on a label when the button is clicked 3 times. After the button is clicked 3 times, the app will come to an end. However, the issue is that some of the strings in the array keeps repeating itself each time the button is clicked. I found a method that prevents the number from repeating (1,3,1) instead of (1,1,3) for eg. But in my case i do not want a number to be generated once it was already generated. For eg. (1,3,4) instead of (1,3,1) where the (1) is re-generated.</p> <pre><code>var fruits: [String] = ["Apple", "Mango", "Cherry", "Strawberry", "Blueberry", "Banana"] // fruits to be displayed in the label func randomizeNum() -&gt; UInt32 { var randomNumber = arc4random_uniform(UInt32(fruits.count)) while previousNumber == randomNumber { randomNumber = arc4random_uniform(UInt32(fruits.count)) } displayLbl.text = fruits[Int(randomNumber)] previousNumber = randomNumber print("the random num is \(randomNumber)") // This prints for example 5, 1, 5. Need it to print only numbers that's not yet displayed with 3 attempts. return randomNumber } </code></pre> <p>I expect the output of this function to generate a random number like 0,4,1 but it generates 5,1,5 or 0,4,0 where the (0) is re-generated again.</p>
<arrays><swift><random>
2019-10-15 22:47:27
LQ_CLOSE
58,404,074
C# Get Quarter months
i want to get the quarter months scenario 1 ``` input one: January / index 1 input two: February / index 2 result = invalid ``` scenario 2 ``` input one: January / index 1 input two: July / index 7 result = invalid ``` scenario 3 ``` input one: January / index 1 input two: March / index 3 result = valid ``` scenario 4 ``` input one: January / index 1 input two: June / index 6 result = valid ```
<c#>
2019-10-16 00:09:08
LQ_EDIT
58,404,200
What should I learn for getting started in AI programming?
<p>Which language should I learn? I just got started in programming. I know HTML, CSS, some JavaScript and I just started learning python. Thanks for anything that helps.</p>
<artificial-intelligence>
2019-10-16 00:30:40
LQ_CLOSE
58,405,809
Why do i keep throwing a NullPointerException?
<p>I am trying to load the active users information into a new activity and display it. I have done similar things in different activities and they have worked fine, but for some reason this is not and I am not sure. Whenever android studio tries to invoke a method on user, it throws a NullPointerException.</p> <p>I have tried everything I can think of, reformatting the way its written, nesting in different methods, passing data through to it in different ways. Nothing is working and every article I've found on the subject doesnt help at all</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_edit); int userID = getIntent().getIntExtra("sessionUser", 0); tuckBoxDao = TuckBoxDB.createTuckBoxDB(this).tbDao(); Email = findViewById(R.id.email); Username = findViewById(R.id.username); Password = findViewById(R.id.password); Mobile = findViewById(R.id.phoneNumber); Notifications = findViewById(R.id.notificationBox); Emails = findViewById(R.id.emailBox); registerButton = findViewById(R.id.registerButton); registerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { registerUser(user); } }); backButton = findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { goBack(); } }); user = LoginActivity.tuckBoxDB.tbDao().searchById(userID); String username = user.getUsername(); Username.setText(username); String email = user.getEmail(); Email.setHint(email); String mobile = user.getMobile(); Mobile.setHint(mobile); Boolean notifications = user.getNotifications(); Notifications.setChecked(notifications); Boolean emails = user.getEmails(); Emails.setChecked(emails); } </code></pre> <p>I would have expected this to work fine and update and display the right information, as it has done exactly that in a fragment I made earlier, but for some reason it is throwing as soon as it gets to user.getUsername();</p>
<java><android><nullpointerexception>
2019-10-16 04:33:19
LQ_CLOSE
58,406,064
applying arithmetic functiojn on different tables in mysql
i have two tables table1 sanction table2 collection i want to select amount from sanction - amount recovered from collection and output the difference. select SUM(sanction.san_recover-collection.amount) as total where client_id=?
<mysql><sql>
2019-10-16 05:05:54
LQ_EDIT
58,408,846
PostgreSQL run query as a string in place of sql file
<p>I have a need to run a query for maintenance reasons as below using psql</p> <pre><code>psql -U postgres -d test 'update sometbl set col1 = true;' </code></pre> <p>I could put the query in a sql file and run it using -f option but I really need this to run from within a bash script and don't want to have to use an additional sql file for this simple query.</p>
<bash><postgresql><psql>
2019-10-16 08:22:55
LQ_CLOSE
58,409,294
Do I really need to learn xml for android development?
<p>I am a Python programmer and I want to learn android app development. My million dollar question is, <strong>do I really need to learn xml?</strong> Can't I just use the design tab in android studio and drag n drop elements to make the design?</p>
<android><android-studio>
2019-10-16 08:48:01
LQ_CLOSE
58,410,928
how to extract number sets in parentheses from google sheet
How to extract and split this set of numbers (314.81+10.00)+0.00 to each column expected result: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/QHkjZ.png
<regex><google-sheets><google-sheets-formula><array-formulas>
2019-10-16 10:15:34
LQ_EDIT
58,411,872
Python remove from beginning to first specific character in a string?
<p>Assuming I have the following string:</p> <pre><code>this is ;a cool test </code></pre> <p>How can I remove everything from the start up to the first time a <code>;</code> occurs? The expected output would be <code>a cool test</code>.</p> <p>I only know how to remove a fixed amount of characters using the bracket notation, which is not helpful here because the location of the <code>;</code> is not fixed.</p>
<python><string><split>
2019-10-16 11:06:53
LQ_CLOSE
58,412,161
How do you select certain letters from a text document in an external file
How do you in python select the first letters of certain words in an external file. this is for an NEA that im doing where i need to print the song artist and the first letter of every word of the song title, but i dont know the code to do so. thanks.
<python>
2019-10-16 11:24:37
LQ_EDIT
58,412,586
C++ I am trying to delete link list but it get errors when i tried to delete head or node in the middle
I know where is wrong but I don't know how to change it. Help, please! The only working is this **(CurrentNode->next == NULL)** if else case the other doesn't. What can I do? ```void Restaurant::deletereservation() { string name; cout << "Enter name of customer that you want to delete: " << endl << "Name: "; cin.ignore(80, '\n'); getline(cin, name); ReservationNode *nodeIn = head; ReservationNode *CurrentNode = head->next; while ((CurrentNode != NULL) && (CurrentNode->Name != name)) { nodeIn = CurrentNode; CurrentNode = CurrentNode->next; } if (CurrentNode->Name != name){ cout << "Error!!!" << name << " is not found.Cant be deleted if there is no such person." << endl; } else{ if (nodeIn == head){ CurrentNode = head->next; CurrentNode = head; delete nodeIn; } else if(CurrentNode->next == NULL){ nodeIn ->next = NULL; delete CurrentNode; } else{ nodeIn -> next = CurrentNode->next; delete CurrentNode; } } }```
<c++><c++14>
2019-10-16 11:49:03
LQ_EDIT
58,412,656
Welcome..i got an issue with OnClickListener
Welcome.. I got an issue with SetOnClickListener in mine mobile kotlin app on AndroidStudio. I created menu with this tutorial https://www.youtube.com/watch?v=sZWMPYIkNd8 Its ok..works fine on HAXM emulator but i can't manage to make mine button interactive..Tutorial guide tells me to initialize Button with SetOnClickListener but android studio keeps asking me for more arguments and editors displays: "not-enough-information-to-infer-parameter-t-with-kotlin-and-android" which makes me stuck.. I'm learning this language but resolving this problem is kinda out of mine range...what i need to know to properly implement OnClickListener? Guy on YT video doesnt put any extra phrase in brackets..so what i should do? Thanks for any research effort Peace
<android><kotlin><mobile-application>
2019-10-16 11:53:24
LQ_EDIT
58,412,670
can anyone please how to make pointing corner background?
<p><a href="https://i.stack.imgur.com/9vj3w.png" rel="nofollow noreferrer">Css background pointing Corner</a><a href="https://i.stack.imgur.com/k1p7E.png" rel="nofollow noreferrer">Pointing background corner</a></p>
<css><background>
2019-10-16 11:53:54
LQ_CLOSE
58,414,160
How to re-write `while(true)` in Java Stream API
<p>Can this Java code be re-written by Stream API?</p> <pre class="lang-java prettyprint-override"><code>while (true) { ... if (isTrue()) break; } private boolean isTrue() { ... </code></pre>
<java><java-8><java-stream>
2019-10-16 13:11:12
LQ_CLOSE
58,414,949
How can I enter text into the button to display the square root
<p>How can I achieve this effect on the button?</p> <p><a href="https://i.stack.imgur.com/hqRL9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hqRL9.png" alt="enter image description here"></a></p>
<java><android>
2019-10-16 13:49:46
LQ_CLOSE
58,415,313
PHP object entity - remove unused public methods or not
<p>We have a tiny team row over whether or not to remove unused public methods from an entity. Let us say we have an entity with over 50 public methods (getters predominantly). Currently, only about 10 are actively used. Part of the team is for removing the unused ones (add them in the future if they are to be used) as it could be a code smell leaving them scattered around. Another part of the team is for keeping them as they are as some of them may become needed one day. ... Is there THE right way?</p>
<php><oop><polymorphism>
2019-10-16 14:06:42
LQ_CLOSE
58,416,115
How to transform String[] into collection?
<p>I am trying to get a String Collection in my Java code, so i'm trying something like this:</p> <pre><code>Collection c = new String[]{}; </code></pre> <p>But i get this error: <code>incompatible types: String[] cannot be converted to Collection</code>.<br> Is there a way to convert <strong>String[]</strong> into <strong>Collection</strong> without doing something like this:</p> <pre><code>var array = new String[]{"Apple", "Banana"}; var arrayList = new ArrayList&lt;String&gt;(); for (String fruit : array) { arrayList.add(fruit); } Collection c = arrayList; </code></pre>
<java><arrays><collections>
2019-10-16 14:48:20
LQ_CLOSE
58,416,539
Geopandas ImportError: The descartes package is required for plotting polygons in geopandas
<p>I'am trying to run a simple geopandas code using ANACONDA spyder. However, I'am encountering an error.</p> <p>I have included the code and the error as below:</p> <p>--</p> <p>here is the code:</p> <pre><code>import geopandas as gpd world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) world.plot() import matplotlib.pyplot as plt plt.show() </code></pre> <p>--</p> <p>here is the error:</p> <p>File "C:\Users\usr\Anaconda3\lib\site-packages\geopandas\plotting.py", line 90, in plot_polygon_collection "The descartes package is required for plotting polygons in geopandas."</p> <p>ImportError: The descartes package is required for plotting polygons in geopandas.</p> <p>--</p> <p>I checked online and I couldn't find troubleshooting solution for this problem. Can anyone please help and advise?</p> <p>appreciated.</p>
<python><error-handling><geopandas>
2019-10-16 15:11:12
HQ
58,416,699
write the code higher order function instead of usual loops/iterators
<p>Can anyone tell me how to write this below code using higher order functions.</p> <pre><code>var x = 10 while (x &lt; =10) { if (x &lt;= 5) print(x) x = x+1 } </code></pre>
<scala>
2019-10-16 15:19:18
LQ_CLOSE
58,417,924
What does this type declaration do?
<p>Reading through the source for <a href="https://github.com/bet365/jingo" rel="nofollow noreferrer">jingo</a>, and stubble upon this code:</p> <pre><code>var _ io.Writer = &amp;Buffer{} // commit to compatibility with io.Writer </code></pre> <p>The comment is not really helping me; what does this code enforce? Assume I am familiar with interface in go.</p> <p><a href="https://github.com/bet365/jingo/blob/master/buffer.go#L20" rel="nofollow noreferrer">source code</a></p>
<go>
2019-10-16 16:32:46
LQ_CLOSE
58,418,418
Python to vb script conversion
I need to help in converting a Phyton script to VBS. I'm trying to load the .cal file as a binary value file and edit a particular value in the file but unfortunately, my environment only supports VBScript. import argparse parser = argparse.ArgumentParser(description='Sapix Cal File Sensitivity Adjustment') parser.add_argument("-calfile", default="test.cal", help="Enter the Calfile name (ex: 09781DK5081.cal") parser.add_argument("-vtest", default=125, help="New Vtest setting (85-205)") parser.add_argument("-vref", default=250, help="New Vref setting (250-120)") args = parser.parse_args() calfile = args.calfile vtest = args.vtest vref = args.vref print(calfile) print(vtest) print(vref) with open(calfile, "rb") as binary_file: # Read the whole file at once data = bytearray(binary_file.read()) # Find Line with VTEST setting ivteststart = data.find(bytearray('PARALLEL_VOLTAGE_TEST', 'utf-8')) ivtestend = data.find(b'\n',ivteststart) # Remove original VTEST line del data[ivteststart:ivtestend+1] # Insert New Line with new VTEST new_vtest = bytearray("PARALLEL_VOLTAGE_TEST %s\n" % (vtest),'utf-8') data[ivteststart:ivteststart] = new_vtest # Find Line with VREF setting ivrefstart = data.find(bytearray('PARALLEL_VOLTAGE_REF', 'utf-8')) ivrefend = data.find(b'\n',ivrefstart) # Remove original VREF line del data[ivrefstart:ivrefend+1] # Insert New Line with new VREF new_vref = bytearray("PARALLEL_VOLTAGE_REF %s\n" % (vref),'utf-8') data[ivrefstart:ivrefstart] = new_vref # Write new sensitivity settings to cal file with open(calfile, "wb") as binary_file: binary_file.write(data)
<vbscript>
2019-10-16 17:06:34
LQ_EDIT
58,418,533
I want to open a new window/tab with POST Data, but it's not working
<p>Here is one of the calls that is generated via PHP:</p> <pre><code> &lt;script&gt; var copyrecipient = []; var customhintcopy = []; copyrecipient.push('customer'); copyrecipient.push('healthinsurance'); customhintcopy.push('4'); customhintcopy.push('6'); $.ajax({ type: "POST", url: "./content/pdf-view-bill.php", data: { bills: '6', copyrecipient:copyrecipient, customhintcopy:customhintcopy, additionaltextcopy: '', copycoveringnotes: '5', documentationcopy: '1', original: '1' } success: function(data){ var win = window.open(); win.document.write(data); } })&lt;/script&gt; </code></pre> <p>The console throws "Uncaught SyntaxError: Unexpected identifier" on the "success-line", and i have no idea why. What i want is a new window or tab to open, that gets sent the data i have defined above. Anyone can help me? I'm pretty new to Ajax...</p>
<javascript><ajax>
2019-10-16 17:13:33
LQ_CLOSE
58,420,106
Make a horizontal scroll menu in Javascript
<p>I want to create a horizontal scrolling menu like Pinterest:</p> <p><a href="https://i.stack.imgur.com/65YXe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/65YXe.png" alt="enter image description here"></a></p> <p>I don't want to use Bootstrap or react, I just want to use HTML, CSS and Javascript.</p> <p>How can I do it?</p>
<javascript><html><css><scroll><menu>
2019-10-16 19:04:30
LQ_CLOSE
58,420,972
What do tilda and caret signs do with HEAD in git?
<p>I see some people using caret and tilda sign with HEAD like HEAD^ or HEAD~(NUMBER VALUE) which i dont understand properly. </p>
<git><github><command-line-interface><branch><commit>
2019-10-16 20:07:21
LQ_CLOSE
58,421,827
Get the values of a Observable<any> into an array in typescript
<p>I'm trying to get the values from a post in typescript, I'm getting a Observable type variable from the post operation but I don't know how can I get the values within. Is there a way to do this?</p> <p>Here is the code I have until now</p> <pre><code>TryLogin() { this.loggedUser.email = this.inputUsername; this.loggedUser.password = this.inputPass; const myObjStr = JSON.stringify(this.loggedUser) const response = this.http.post&lt;any&gt;(this.url, myObjStr,{headers: this.httpheaders}); } </code></pre>
<json><angular><typescript><observable>
2019-10-16 21:16:17
LQ_CLOSE
58,423,340
array and .push? waht does it do?
<p>What does this code mean? I know that we are declaring var points as an array and we're using a loop but im not too experienced to fully understand. can someone elaborate?</p> <pre><code> var points = []; for (var i = 0; i &lt; x; i++) { points.push( random() ); } return points; }; </code></pre>
<javascript>
2019-10-17 00:35:51
LQ_CLOSE
58,429,261
CSS "inline-block" value not working with images
<p>With the "inline-block" value in CSS3, I am trying to align images into the center but it isn't aligning!</p> <p>I have tried using the "block" value as well but it still doesn't work. Is it my PC? Is it the browser?</p> <pre><code>.link-images-js{ display: inline-block; text-align: center; } </code></pre> <p>With Visual Studio Code it doesn't detect anything wrong, same with NP++ and Sublime Text 3. With the "inline-block" value, it has worked once but after that it hasn't worked. Does anyone have any idea what the problem is?</p>
<html><css>
2019-10-17 09:27:23
LQ_CLOSE
58,429,362
Fetch() takes too long
I have a js function fetch that needs to fetch some data and then I have other functions that relly on fetched information in order for them to work. As a result, my fetch takes too long so other functions give me an error that there is no "data" for functions to use. How can I make it so that before any of my functions start to work, first fetch gathers information? ``` console.log("Hello"); fetch("https://api.propublica.org/congress/v1/113/senate/members.json",{ method:"GET", headers:{ "Content-type": "application/json", "X-API-Key": "eKDuyBWdpQGhsiKGi7geFoBmJR3kCRIRUGRWIASL" } }) .then( (response)=>{ if(response.ok){ return response.json(); }else{ throw new Error('BAD HTTP stuff'); } }) .then( (data) => { console.log(data); }) .catch( (err) =>{ console.log('ERROR: ', err.message); }); ```
<javascript>
2019-10-17 09:31:25
LQ_EDIT
58,430,629
Javaswing : load date from sql to java swing
[when i click button , it show one value . Then i click again and it's still the same ,how to click button and it show a new value next ?][1] [1]: https://i.stack.imgur.com/OE7v1.png
<java><sql-server><swing><jbutton>
2019-10-17 10:38:40
LQ_EDIT
58,432,456
Getting a indentation error while web scrapping using python
<p>I am trying a scrape a website using python and beautiful soup.As you can see in the attached screen shot when i tried to search the word "infinix" in the extracted links above it gave me the indentation error.As soon as i write the code in the screen shot and hit enter it is giving me an error. I want to find the word "infinix" in the extracted links with tags. <a href="https://i.stack.imgur.com/5dHBp.png" rel="nofollow noreferrer">enter image description here</a></p>
<python><python-3.x><web-scraping><beautifulsoup>
2019-10-17 12:16:09
LQ_CLOSE
58,434,031
In Xcode/SWIFT - how to store various types of data each day?
I want to store in CoreData various information each day as following: day1: string, integer, integer, double, Boolean day2: string, integer, integer, double, Boolean day3: .... up to several months. I plan to do save it in CoreData due to the amount and type of information but I cannot find the best way to do it. I was thinking to use an Array but as it cannot contain various types what is the best way to do it? Typically the user will enter such information every day, selecting the actual day on the interface and entering all his inputs.
<ios><swift><core-data>
2019-10-17 13:37:20
LQ_EDIT
58,436,513
In python, how do I regex match the "." char in, say, a string representing an address?
<p>I am getting an address string from the client (first I check that it is a string under a certain length), and I have this so far: ^[a-zA-Z0-9 ]+$ but it will fail if the address has a "." char in it. </p> <p>I want a single regex that also matches if a "." char shows up: the address can only contain spaces, numbers and letters.</p> <p>Obviously, one can do if "." in address_string, but I am trying to do my check in one regex match.</p> <p>How do I also escape/search for a "." char in a string?</p>
<python><regex>
2019-10-17 15:54:55
LQ_CLOSE
58,437,861
How to tell SwiftUI views to bind to more than one nested ObservableObject
<p>I have two classes nested in another class, which is an observable object in a SwiftUI view. Even though properties in the nested classes are declared as @Published, their values (when they change) do not update in the main view.</p> <p>A similar question has been asked here, and I could use it to get it to work for one of the two subclasses, but not both.</p> <p><a href="https://stackoverflow.com/questions/58406287/how-to-tell-swiftui-views-to-bind-to-nested-observableobjects">How to tell SwiftUI views to bind to nested ObservableObjects</a></p> <p>This is the model:</p> <pre><code>class Submodel1: ObservableObject { @Published var count = 0 } class Submodel2: ObservableObject { @Published var count = 0 } class Model: ObservableObject { @Published var submodel1: Submodel1 = Submodel1() @Published var submodel2: Submodel2 = Submodel2() } </code></pre> <p>And this is the main view:</p> <pre><code>struct ContentView: View { @ObservedObject var model: Model = Model() var body: some View { VStack { Text("Count: \(model.submodel1.count)") .onTapGesture { self.model.submodel1.count += 1 } Text("Count: \(model.submodel2.count)") .onTapGesture { self.model.submodel2.count += 1 } } } } </code></pre> <p>Adding this to the model class (see previous Stackoverflow question) works for updating on submodel1 changes, but not both:</p> <pre><code> var anyCancellable: AnyCancellable? = nil init() { anyCancellable = submodel1.objectWillChange.sink { (_) in self.objectWillChange.send() } } </code></pre> <p>What I'm looking for is some way to pass on changes of both the submodel1 and submodel2 to my view.</p>
<ios><swift><swiftui><combine>
2019-10-17 17:27:11
HQ
58,438,081
R - Stuck in a IF Else
<p>I am stuck in an exercise that askes me to read a data frame and write an ifelse statement that returns 1 if the sex (theres a gender column) is Female and 2 if the sex is Male. Then the exercise askes me the sum() of theses numbers. No success so far. Any help?</p>
<r>
2019-10-17 17:42:27
LQ_CLOSE
58,438,493
Insert a character to a string with Python
<p>How do I add a character to a string with Python? For example, I like to add a ":" to the middle of string: "0900" between 09 &amp; 00.</p>
<python-3.x>
2019-10-17 18:09:55
LQ_CLOSE
58,438,691
unexpected token: javascript syntax error using object
<p>I am trying to use an object from another javascript file and I have imported the function from the other javascript file. Anyone knows what is wrong with my syntax? </p> <pre><code>unexpected token 29 | render() { 30 | return ( &gt; 31 | const posts = this.state.posts.map((post)=&gt; | ^ 32 | &lt;Post url= {post.url}/&gt;); 33 | ); 34 | } </code></pre>
<javascript><reactjs>
2019-10-17 18:26:06
LQ_CLOSE
58,440,400
Enum type no longer working in .Net core 3.0 FromBody request object
<p>I have recently upgraded my web api from .Net core 2.2 to .Net core 3.0 and noticed that my requests are getting an error now when I pass an enum in a post to my endpoint. For example:</p> <p>I have the following model for my api endpoint:</p> <pre><code> public class SendFeedbackRequest { public FeedbackType Type { get; set; } public string Message { get; set; } } </code></pre> <p>Where the FeedbackType looks like so:</p> <pre><code> public enum FeedbackType { Comment, Question } </code></pre> <p>And this is the controller method:</p> <pre><code> [HttpPost] public async Task&lt;IActionResult&gt; SendFeedbackAsync([FromBody]SendFeedbackRequest request) { var response = await _feedbackService.SendFeedbackAsync(request); return Ok(response); } </code></pre> <p>Where I send this as the post body to the controller:</p> <pre><code>{ message: "Test" type: "comment" } </code></pre> <p>And I am now getting the following error posting to this endpoint:</p> <p><code>The JSON value could not be converted to MyApp.Feedback.Enums.FeedbackType. Path: $.type | LineNumber: 0 | BytePositionInLine: 13."</code></p> <p>This was working in 2.2 and started the error in 3.0. I saw talk about the json serializer changing in 3.0, but not sure how this should be handled.</p>
<asp.net-core><.net-core><asp.net-core-webapi><.net-core-3.0><asp.net-core-3.0>
2019-10-17 20:37:13
HQ
58,440,723
Do Progressive Web Apps Have The Following Ability
<p>Before I spend time learning PWA can it do something like this?</p> <p>When online, call an API that returns some JSON data and store that data locally e.g. a few customers (say 50) and a few products (say 100)</p> <p>Then when offline (because I am in the middle of nowhere with no phone or wifi signal) have a screen to select a customer (from the stored data), then select a product (from the stored data) - save the order for later.</p> <p>Repeat the entry of orders.</p> <p>Then later when back on-line send the saved orders to an API</p> <p>Of course the above is simplified but can it do the above?</p>
<javascript><progressive-web-apps>
2019-10-17 21:04:49
LQ_CLOSE
58,442,725
(Java) How do you generate a random integer between 1 to 4 using SecureRandom
<p>An assignment I'm working on right now needs to generate a random number from 1 to 4 using SecureRandom that will be used for a switch statement. Cases have to start from 1 so I can't just use</p> <pre><code>SecureRandom rand = new SecureRandom(); int a; a = rand.nextInt(4); </code></pre> <p>right? I have to use SecureRandom to generate the integer as well.</p>
<java>
2019-10-18 01:26:29
LQ_CLOSE
58,443,002
I want to change a ternary operator to if and else statements
How to change this shorthand ternary operator to if-else statements header.style.width = header.style.width === "1265px" ? '0px' : '1265px';
<javascript>
2019-10-18 02:06:54
LQ_EDIT
58,445,239
JupyterLab autocomplete without tab
<p>Pressing tab each time you want to automcomplete seems time-consuming. Ideally, you just type in the first couple of letters and you get a drop down list without pressing tab.</p> <p>In Jupyter notebook, there were some extensions that you could install to get this functionality. <a href="https://github.com/ipython-contrib/jupyter_contrib_nbextensions" rel="noreferrer">https://github.com/ipython-contrib/jupyter_contrib_nbextensions</a></p> <p>Is it possible to get this on JupyterLab?</p> <p>Thanks</p>
<jupyter><jupyter-lab>
2019-10-18 06:39:41
HQ
58,445,368
Is there a site or app where you can get examples of code assignments?
<p>Okey, so here I'm learning coding (mostly PHP, and frontend dev). And I would like to know if there is a site where I can get an assignment like "make a calculator" or similar. </p> <p>So I can get inspiration for small projects while I'm learning. Learning by doing so to speak. I don't want big projects. Something that I can make in one evening.</p> <p>I have googled around but with no luck.</p> <p>TL;DR, is there a site were I can find inspiration for small coding projects (PHP).</p>
<php><frontend>
2019-10-18 06:48:39
LQ_CLOSE
58,445,581
How to fix " Expected expression before "=" token"?
turns out to have error "expected expression before '=' token" #include <iostream> #define e = 2.71828 using namespace std; int main() { int n,b,c; cout << "put n: "; cin >> n; b = e-(1/(e*e)); for (int a=0; a<=n; a++) {if (a==0) {b=c; c=1-a*c;}} cout << "积分值为:" << c << endl; return 0; }
<c++>
2019-10-18 07:05:14
LQ_EDIT
58,447,280
How create app to app communication in c#?
<p>I have problem, because I can send data from program for example program1 to program2. I see that can use events, observer but the problem is how. </p> <p>Sorry but I not have any code.</p> <p>Can anybody take here example or link for help to understand events and observers? </p>
<c#><.net>
2019-10-18 08:53:21
LQ_CLOSE
58,448,750
Is there a particular sequence in this row of numbers?
<p>I need to create a list with 14 elements, for each element the input integer must be 1,2,5,10,20,50,100 and then reversed. It would be silly to write int a = 1, b = 2, .... So is there a way to loop this? For instance, if I'd make a for loop, how could i make a connection between the required value and "i"?</p>
<c><loops><sequence>
2019-10-18 10:15:35
LQ_CLOSE
58,448,855
Switch Expressions in Java 13
<p>The biggest change in Java 13 is the replacement of the keyword break in the switch expression by yield. The background is the better differentiation between switch statement (with possible break) and expressions (with yield). The yield statement exits the switch and returns the result of the current branch, similar to a return.</p>
<java><switch-statement><java-13>
2019-10-18 10:20:55
LQ_CLOSE
58,448,964
i have a regex "^([a-z0-9](?!.*?[^\na-z0-9]{2}).*?[a-z0-9]" which accept $&% i want to restrict that sprcial character
full validation on email regex. regular expretion which accept - and _ but not consicative
<c#><regex>
2019-10-18 10:26:37
LQ_EDIT
58,449,530
Catalyst 'SwiftUI.AccessibilityNode' is not a known serializable element
<p>I created a fresh iOS Single Page App (including SwiftUI) with Xcode 11.1 and enabled Mac Catalyst. After running the fresh Project on my Mac (macOS 10.15 of course) I get the following errors after tapping once on the window.</p> <pre><code>2019-10-18 12:59:48.479186+0200 test[3130:122148] Metal API Validation Enabled 2019-10-18 12:59:50.960734+0200 test[3130:122148] [AXRuntimeCommon] Unknown client: test 2019-10-18 12:59:50.962261+0200 test[3130:122148] [AXRuntimeCommon] This class 'SwiftUI.AccessibilityNode' is not a known serializable element and returning it as an accessibility element may lead to crashes 2019-10-18 12:59:51.313 test[3130:122148] **************_____________**************AXError: AVPlayerView is not a kind of NSView 1 AccessibilityBundles 0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201 2019-10-18 12:59:51.386 test[3130:122148] **************_____________**************AXError: MKStarRatingView is not a kind of NSView 1 AccessibilityBundles 0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201 </code></pre> <p>Note: I also removed the Sandbox capability otherwise I get error about can't writing <code>ApplicationAccessibilityEnabled</code> </p> <p>Does anyone know how to solve that?</p>
<accessibility><swiftui><mac-catalyst>
2019-10-18 11:02:50
HQ
58,451,086
How can i set black color to my label background color when dark mode is OFF ?(SWIF)
I want the background color of the label to be black when dark mode is OFF and background color of the label to be white when dark mode is ON (IOS13) What color should I use ?
<swift><ios13>
2019-10-18 12:35:43
LQ_EDIT
58,451,254
Please help me make a script of autodownloading file from FTP
I need a simple scirpt which will download file/files from my external FTP server. I tried to run it in batch file, but it didn't work: ftp yourftpaddress user yourusername yourpassword get yourfile.type bye pause I need it for Windows 7 Please, help! :(
<powershell><batch-file><cmd>
2019-10-18 12:46:28
LQ_EDIT
58,452,328
Return part of string between specific character pair, in string with multiple character pairs
<p>Text file or string:</p> <p>SomeText1/SomeText2/SomeText3/SomeText4/SomeText5</p> <pre class="lang-py prettyprint-override"><code>#What I am looking for: split_func(3, "/") &gt;&gt;&gt; SomeText3 </code></pre>
<python><text-manipulation>
2019-10-18 13:54:52
LQ_CLOSE
58,453,737
if x >2 and <5: gives me an invalid syntax error. I dont understand why?
<p>I am using python 3.6 and i have written the following code:</p> <pre><code>l=[1,2,3,4,6,7,8,9] a=0 for i in l: if i &gt;2 and &lt;5: l[a]=l[a]+1 a=a+1 print(l) </code></pre> <p>I dont understand why I get a syntax error.</p>
<python><syntax-error>
2019-10-18 15:17:24
LQ_CLOSE
58,455,478
How to variable in Object.keys
i'm trying to use use Object.keys in a map function but i'm getting keys based on map value variable but it's giving me error [my data object][1] as you can see i'm trying to get the keys of Display and coin value from map variable and the coin value is in the array at the end but it's giving me error in short i'm want to get the keys of every object in display child object and display child key will be from my coin name array so i don't have to hardcode it [1]: https://i.stack.imgur.com/s86ri.png {this.props.crypto_head_coins.map(coin => { return ( <div key={coin} className="crypto_head"> <span>{coin} </span> {console.log(Object.keys(this.props.crypto_head_data.DISPLAY.coin))} <p>{this.props.crypto_head_data.DISPLAY.BTC.USD.PRICE}</p> </div> ); })}
<javascript><reactjs>
2019-10-18 17:17:21
LQ_EDIT
58,456,576
how to apply css properties on a checkbox when clicked
What i want is to make checkbox look different when someone click it like changing their color, making texts bold or something else. I am confused whether i should use some function or their some predefined function or any other method. I have gone through these questions [css checkbox style for border color ](https://stackoverflow.com/questions/41757006/css-checkbox-style-for-border-color) and [How to change checkbox's border style in CSS?](https://stackoverflow.com/questions/2460501/how-to-change-checkboxs-border-style-in-css) but couldnot find anything beautiful I am new to stackoverflow and not aware about the rules and regulation so forgive if i do something wrong
<javascript><html><css>
2019-10-18 18:45:27
LQ_EDIT
58,456,812
Scroll view is scrolling when content is fully visible
<p>I have a problem: my scroll view scrollable, when content is fully visible. What should i do, to enable scrolling, when some part of content is hidden?</p>
<ios><swift>
2019-10-18 19:05:44
LQ_CLOSE
58,457,140
Dependencies Between Workflows on Github Actions
<p>I have a monorepo with two workflows:</p> <p><code>.github/workflows/test.yml</code></p> <pre><code>name: test on: [push, pull_request] jobs: test-packages: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: test packages run: | yarn install yarn test ... </code></pre> <p><code>.github/workflows/deploy.yml</code></p> <pre><code> deploy-packages: runs-on: ubuntu-latest needs: test-packages steps: - uses: actions/checkout@v1 - name: deploy packages run: | yarn deploy env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} ... </code></pre> <p>This doesn't work, I can't reference a job in another workflow:</p> <pre><code>### ERRORED 19:13:07Z - Your workflow file was invalid: The pipeline is not valid. The pipeline must contain at least one job with no dependencies. </code></pre> <p><strong>Is there a way to create a dependency between workflows?</strong></p> <p>What I want is to run <code>test.yml</code> then <code>deploy.yml</code> on tags, and <code>test.yml</code> only on push and pull request. I don't want to duplicate jobs between workflows.</p>
<github><continuous-integration><continuous-deployment><github-actions>
2019-10-18 19:34:17
HQ
58,459,249
Why isn't my String being detected in my Set?
I am having a very specific problem I am currently trying to find a string in a set. But for some reason it can't be found and its not triggering the code properly. while program_running: load_reddit() if not image_found: for images in hot_images: current_image = images.url if not images.stickied: if str(current_image).__contains__(".jpg"): if not str(current_image) in past_images: # Issue is here. for pastimages in past_images: print(pastimages) print(current_image) image_found = True time.sleep(600) [The string I'm searching for and the list][1] [1]: https://i.stack.imgur.com/EZrOo.png as you can see the "current_image" variable is returning exactly what is in "past_images". So why is the code running? This is extremely frustrating as the result directly contradicts itself. With this coding statement the print() shouldn't even run. But it is.
<python>
2019-10-18 23:28:33
LQ_EDIT
58,459,262
Why does my React Native app build successfully despite TypeScript compiler error?
<p>I've recently started using TypeScript with Expo. I've done all the linter/formatter integrations like <code>typescript-eslint</code> so I can catch most of the errors during coding. To check if the code compiles, I run <code>npx tsc</code> every once in a while and fix accordingly.</p> <p>One thing that I haven't fully grasped yet is why my app builds successfully even when there are numerous compile errors. I expect (and prefer) to see a red screen error for every compile error rather than the app build successfully and me find it out later. For example,</p> <pre><code>function square&lt;T&gt;(x: T): T { console.log(x.length); // error TS2339: Property 'length' does not exist on type 'T'. return x * x; } </code></pre> <p>is a typical TypeScript error that (I believe?) can be easily checked at compile time. I want it to result in a big red screen error and the build to fail.</p> <p>I'm quite new to TypeScript so it's possible that I'm missing something very important. What exactly is causing this leniency and is there a way to enforce stricter checks?</p>
<reactjs><typescript><react-native><expo>
2019-10-18 23:30:21
HQ
58,459,396
Easiest way of building up visual representation of a graph data structure
<p>I need some suggestions for a libraries or other tools that I can use. I have a graph data structure built up of class objects each having its children (again objects of the class) in a list variable. I need a quick and easy way to draw these nodes, color them or change the shape of the nodes depending upon various conditions for visualization and proof of concept purposes. Since this is not the primary motive of the program and something that needs to be on the side, it doesn't matter if its an ugly method, it just needs to be hassle free. I have conisdered using graphviz for this but would be open to suggestions as I may have to make changes to the color/shape of the nodes while traversing the tree again and again.</p>
<python><python-3.x>
2019-10-18 23:58:06
LQ_CLOSE
58,460,771
exist object in java similar to Kotlin data class
I currently learning java for make app on android, and I check that swift has structure that store the information on the memory, I'd like to know if in java exist this type of object, because the class storage the reference on the memory, also I check that kotlin has data class, java has similar object?. Br
<java><swift><kotlin>
2019-10-19 05:26:06
LQ_EDIT
58,460,818
mysql dont repaet
I have in the table a field named chapter and the chapter is usually repeated in the entry, but I want to not repeat in the output Vjrj name of the chapter once and under it have the names registered
<mysql><sql>
2019-10-19 05:36:31
LQ_EDIT
58,460,946
Delete a element in a tree in Haskell
data BinaryTree a = Null | Node (BinaryTree a) a (BinaryTree a) deriving Show treeDelete :: (Ord a) => (BSTree a) -> a -> (BSTree a) treeDelete a btree = case btree of Null -> Null Node Null val Null |a==val -> Null |otherwise -> Node Null val Null Node left val right |a==val-> Node left Null right |otherwise -> (treeDelete a left) val (treeDelete a right) What I want to do is to takes a binary search tree, and an element, and removes it from the tree (if it is present).
<haskell><tree>
2019-10-19 05:58:23
LQ_EDIT
58,461,708
VBA code to add blank row above specific text
Need help to add a blank row on a file above the word "Costumer". Found the below one but can't make it work on the specific worksheet on the workbook. thanks in advance Dim c As Range For Each c In Range("A:A") If c.Value Like "Customer account" Then c.Offset(1, 0).EntireRow.Insert End If Next c
<excel><vba>
2019-10-19 08:06:43
LQ_EDIT
58,462,533
Recursive function, geometric progression
<p>I've just started learning C++ and I came across a simple problem but couldn't solve. Help me please,</p> <p>In geometric progression, b1=2, r=3. Create recursive function that outputs initial n sequences of progression. n should be input.</p>
<c++>
2019-10-19 10:03:42
LQ_CLOSE
58,462,826
how to check if two doubles are equal in java
<p>I am writing a program to help students practice division, how can I compare the user Input and the correct answer if they are doubles</p>
<java>
2019-10-19 10:39:48
LQ_CLOSE
58,463,422
How Android Detects Screen Size phone
When I create small,normal,large,xlarge layouts:How Android Detects Screen Size phone for use this layouts?base on dp or dpi or px?Is the result always right?
<android><size><screen><detect>
2019-10-19 11:57:35
LQ_EDIT
58,465,057
Trigger a GitHub Action when another repository creates a new release
<p>I'm trying to build a GitHub workflow that will be triggered when another repository creates a new release.</p> <p>In the documentation, there is the paragraph: <a href="https://help.github.com/en/articles/workflow-syntax-for-github-actions#onevent_nametypes" rel="noreferrer"><code>on.event_name.types</code></a> where <code>event_name</code> will be <code>release</code>.</p> <p>The question is: Is there any way to refer to the <code>release</code> event of another repository?</p>
<github><github-actions><github-webhook>
2019-10-19 15:13:42
HQ
58,465,213
count the total numbers of unique latters occured once in a string in python?
a = 'abhishek' count = 0 for x in a: if x in a: count += 1 print(count) I have tried this but it gives me the total number of letters. I want only a unique latter that occurs only once.
<python>
2019-10-19 15:33:23
LQ_EDIT
58,467,662
How to get substrings without using substring() method in Java?
<p>I'm just looking for a simple way to be able to extract substrings without using the substring method. </p>
<java><string><substring>
2019-10-19 20:20:24
LQ_CLOSE
58,469,828
Is there a function or method Array.reduce in swift?
<p>I would like to reduce the array of strings into a single string using the built in array.reduce closure method.</p> <p>I know using the join method is easier. Just wanted to see if there is a way?</p>
<arrays><swift><reduce>
2019-10-20 03:34:59
LQ_CLOSE
58,470,503
How to count the number of rows in condition?
<p>I want to count the number of rows of a selected result.</p> <p>E.g., SELECT * FROM TABLE1 WHERE [the number of rows of a (SELECT QUERY)] = 1;</p>
<mysql>
2019-10-20 06:14:52
LQ_CLOSE
58,471,692
Removing the 1st element then 1st and 2nd element from a list of lists
<p>My aim is to remove the 1st element of a list and then the first and second element of a list etc. So a list entered like this: <code>[[1,1],[1,2],[1,3],[2,1],[2,2],[2,3],[3,1],[3,2],[3,3]]</code> will return a list like this: <code>[[1,2],[1,3],[2,3]</code> I have tried many things but none work well</p>
<python><python-3.x><list>
2019-10-20 09:37:15
LQ_CLOSE
58,473,383
how to fix Thread 1: EXC_BAD_ACCESS (code=1, address=0x58) xcode
I am trying to play some sound files with buttons but pressing the button throws me this error Thread 1: EXC_BAD_ACCESS (code=1, address=0x58) on line audioPlayer.play() I have looked for possible solutions and I can't find anything related to that error, the function of my code runs well until the print, this is my complete code. import UIKit import AVFoundation class ViewController: UIViewController { var track: String? = nil var audioPlayer = AVAudioPlayer() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } @IBAction func heavyButton(_ sender: Any) { track = "H" print("heavy machine gun \(track!)") reproducirAudio(audio: track!) audioPlayer.play() } func reproducirAudio(audio: String) { do { print("entro a la funcion de reproducir") audioPlayer = try AVAudioPlayer(contentsOf: URL.init(fileURLWithPath: Bundle.main.path(forResource: audio, ofType: "mp3")!)) audioPlayer.prepareToPlay() } catch { print(error) } }
<ios><swift><avaudioplayer>
2019-10-20 13:17:00
LQ_EDIT
58,473,458
which one is better for developing an service app(Native or Hybrid)?
<p>I want to know which one this items (Hybrid - Native) is better for developing an Service app like laundry or Carpet cleaning app?</p>
<android><ios><android-studio><native><hybrid-mobile-app>
2019-10-20 13:24:45
LQ_CLOSE
58,473,656
malformed module path "xxxx/xxxx/uuid" missing dot in first path element when migrating from GOPATH based dep to go mod
<pre> $ go version 1.13.3 </pre> <p>I have a folder structure as follows:</p> <pre><code>GOPATH +---src +--- my-api-server +--- my-auth-server +--- main.go +--- my-utils +--- uuid +--- uuid.go </code></pre> <p><code>my-auth-server</code> uses <code>my-api-server/my-utils/uuid</code> as a depenency</p> <p>Now, when I used the GOPATH based module system, this worked fine. But when using go modules, when I run <code>go run main.go</code> in <code>my-auth-server</code> it returned error:</p> <pre><code>build command-line-arguments: cannot load my-api-server/my-utils/uuid: malformed module path "my-api-server/my-utils/uuid": missing dot in first path element </code></pre> <p>Any idea how to solve this?</p>
<go><go-modules>
2019-10-20 13:49:10
HQ
58,474,760
Sass @use not loading partial
<p>I'm trying to import a sass partial (<code>_variables.scss</code>) to use in my main stylesheet (<code>global.scss</code>), but I keep getting the <code>Error: Undefined variable.</code> on sass compiling.</p> <p>Directory structure:</p> <pre><code>app └─public └─styles │ global.css (output for sass compiling is here). └─sass └─_variables.scss └─global.scss </code></pre> <p>_variables.scss</p> <pre><code>$font-text: 'lato', sans-serif; </code></pre> <p>global.scss</p> <pre><code>@use '_variables'; body { font-family: $font-text; } </code></pre> <p>Looking at the <a href="https://sass-lang.com/documentation/at-rules/import" rel="noreferrer">Sass documentation</a>, I understand to use <code>@use</code> instead of <code>@import</code> (which works) because they are phasing it out.</p> <p>What am I doing wrong here? Thanks.</p>
<css><sass>
2019-10-20 15:59:59
HQ
58,476,707
Sublime Text 3 - Limit images to viewsize
<p>I'm working on a Sublime Text 3 plugin, which displays images in a view. Those images are created by an jupyter kernel, therefore the size of the images depend on the code producing them. Since I create really big images, they are to big to fit in the view.</p> <p>I would like to limit the size to the image to the size of the view, like scale it to 100% of the view size. Is there any way to get the size of the current view and add this to the minihtml implementation of ST3?</p> <p>I've tested width: 100% which just used a fraction of the actual views size. </p>
<sublimetext3>
2019-10-20 19:49:20
LQ_CLOSE
58,476,995
Deserialize a JSON into a list of C# objects
<p>I'm developing a mobile game project that utilizes Firebase. I've managed to get login/registration, and <em>sending</em> items to the database to work just fine. However, after countless hours of banging my head against the wall, I just can't get the inventory to work. I can fetch the correct JSON data from the database, and it comes out in the following format:</p> <pre><code>{"5449000085757":{"itemLevel":82,"itemName":"Sword of Maximum Epicness","itemType":""},"6419800152996":{"itemLevel":45,"itemName":"Your Average Sword","itemType":""}} </code></pre> <p>These are all just fields for testing purposes of course. What I'm trying to do is create a list of objects, where the list is the "inventory" and the objects are the items. I've tried using Json.NET, Unity's built-in JSON utilities, all kinds of technologies, but just can't find a way. I feel kind of stupid, because obviously it can't be this difficult. No matter what example I've tried, it doesn't work.</p> <p>If possible, could someone provide a quick briefing on how to create that list of objects from JSON, a simple way? I just can't figure this out on my own and it's getting really frustrating.</p>
<c#><json><firebase><unity3d><json.net>
2019-10-20 20:24:48
LQ_CLOSE
58,477,127
Trying to use scanf() to take in multiple variables
<p>So I've decided to add some programming skills to my repertoire, typically i've been an application support analyst with beginner to average SQL coding skills, but in today's climate I know I need to get better at automating simple tasks. So I bought a course in c programming (this is not for college credit, so by asking I'm not cheating). So far it's going quite well, but I've come against a problem, actually I decided to improve upon the challenge given to me and I can't seem to figure it out. Originally I was asked to create a small application that printed out the width, height, perimeter and area of a rectangle, with the width and the height hard-coded. That was simple to figure out. I decided to add an extra challenge and have the end user input the width and height of rectangle, but it's not working like I planned. I'm including my code and as well my output after compiling. I don't really want an answer as I would like to discover the solution myself, but if someone could point me to some documentation that would be much appreciated.</p> <p>CODE:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { double width; double height; double perimeter; double area; char newLine = '\n'; printf("Please enter the width of your rectangle:"); scanf("%f", &amp;width); printf("Please enter the height of your rectangle:"); scanf("%f", &amp;height); perimeter = 2.0 * (height + width); area = (width * height); printf("%c",newLine); printf("The widith of the Rectangle is: %.2f centimeters %c",width, newLine); printf("The height of the rectangle is: %.2f centimeters %c",height, newLine); printf("The permimeter of the rectangle is: %.2f centimeters %c",perimeter, newLine); printf("The area of the rectangle is: %.2f centimeters %c",area, newLine); printf("%c",newLine); return 0; } </code></pre> <p>OUTPUT:</p> <pre><code>[user@localhost.local]$ ./output/rectangle.a Please enter the width of your rectangle:15 Please enter the height of your rectangle:12 The widith of the Rectangle is: 0.00 centimeters The height of the rectangle is: 0.00 centimeters The permimeter of the rectangle is: 0.00 centimeters The area of the rectangle is: 0.00 centimeters </code></pre>
<c><scanf>
2019-10-20 20:40:39
LQ_CLOSE
58,477,827
Why use positional only arguments in pythin 3.8
A new "positional only arguments" syntax has been introduced in 3.8. > There is new syntax (/) to indicate that some function parameters must > be specified positionally (i.e., cannot be used as keyword arguments). > This is the same notation as shown by help() for functions implemented > in C (produced by Larry Hastings’ “Argument Clinic” tool). Example: > Now pow(2, 10) and pow(2, 10, 17) are valid calls, but pow(x=2, y=10) and pow(2, 10, z=17) are invalid. ---- My question is, why ever use this syntax? Why is it better for the code's user? It seems to me that this makes it harder for users to specify what their arguments actually mean, if they so desire. Why make it harder on the user? I am clearly missing something.
<python><python-3.8>
2019-10-20 22:23:51
LQ_EDIT
58,478,146
How to Convert an Integer to a String without Integer.toString Function
<p>This is an extension to a previous question of mine, but I'm required to do this problem without this function. I have to use recursion only. Any thoughts?</p> <p>An example; 20A would be:</p> <p>2 x 12^2 + 0 x 12^1 + 10 x 12^0 = 2 x 144 + 0 x 12 + 10 x 1 = 288 + 0 + 10 = 298</p> <pre><code>public class Duodecimal { public static String toBase12(int n) { if (n &lt; 10) return Integer.toString(n); if (n == 10) return "A"; if (n == 11) return "B"; return toBase12(n / 12) + toBase12(n % 12); } } </code></pre>
<java><recursion>
2019-10-20 23:32:24
LQ_CLOSE
58,478,284
¿Como puedo ordenar de manenara adecuada una lista de elementos en python?
Estoy ordenando una lista de elementos que remplace por nuevos, pero al cambiar las letras por un equivalente en numero y despues ordenarlo, pues me corta el ordenamiento y lo hace en partes. for (i) in range(len(unico)): if unico[i] == 'A': unico[i] = '14' elif unico[i] == 'D': unico[i] = '10' elif unico[i] == 'J': unico[i] = '11' elif unico[i] == 'Q': unico[i] = '12' elif unico[i] == 'K': unico[i] = '13' for (i) in range(len(unico2)): if unico2[i] == 'A': unico2[i] = '14' elif unico2[i] == 'D': unico2[i] = '10' elif unico2[i] == 'J': unico2[i] = '11' elif unico2[i] == 'Q': unico2[i] = '12' elif unico2[i] == 'K': unico2[i] = '13' repetido, repetido2, unico, unico2 = sorted(repetido, reverse=True), sorted(repetido2, reverse=True), sorted(unico, reverse=True), sorted(unico2, reverse=True) print (unico,unico2) Espero esta salida: ['14', '13', '10','8','4','3'] ['14', '13', '12', '10', '7', '6', '5'] pero la salida es: ['8', '4', '3', '14', '13', '10'] ['7', '6', '5', '14', '13', '12', '10']
<python><list><sortedlist>
2019-10-20 23:59:12
LQ_EDIT
58,479,535
How to make a particular Text Bold after a Text
<p>Suppose I have a sample text. var sample="id:123 Hello How are you id:456 I am fine".</p> <p>123 and 456 are ids. There can be multiple ids in a sentence. So, How to make every id bold in the sentence. And then after that how to remove "id:" from the sample text.</p>
<javascript>
2019-10-21 03:44:39
LQ_CLOSE
58,479,786
Is spark 1.6.3 will support Kafka 1.0.0
I have spark 1.6.3, Scala 2.10.5 and Kafka 1.0.0, is it possible to use kafak 1.0.0 with Scala 2.10.5?
<scala><apache-spark><apache-kafka>
2019-10-21 04:23:45
LQ_EDIT
58,480,261
Having some trouble with a while loop in bash script
I'm trying to get the variables setup properly in my script. Basically the x and y variables should increment by 5 after each iteration of the loop. The a value should increment by one, and the loop should iterate $numResults amount of times. The numResults variable is working fine and the loop does try to iterate that number of times. I'm encountering 4 sets of errors since that's the number stored in that variable. For my other variables, when I replace them with real numbers, then the program runs fine but just not with the variables in place. #!/bin/bash # An application that for each course with more than 50 students enrolled generates # an advisory report to warn of over-enrollment. It generates a text file from a user-defined # template which uses the following variables: # # • [[dept_code]] # • [[dept_name]] # • [[course_name]] # • [[course_start]] # • [[course_end]] # • [[credit_hours]] # • [[num_students]] # • [[course_num]] (the course number as specified in the filename of the .crs file) # • [[date]] # # Create a new user-specified subdirectory for files mkdir -p "$4" numResults=`grep -rE --include \*.crs -e "^[5][1-9]$" -e "^[6-9][0-9]$" -e "^[1-9][0-9][0-9]$" ./data | gawk '{n++} END { print n }'` let i=0; x=1 y=5 a=1 while [[ $i<="$numResults" ]] do # Gets the course code and number to use as the output file name && stores course_num to the output file temporarily for retrieval file=`grep -rE --include \*.crs -e "^[5][1-9]$" -e "^[6-9][0-9]$" -e "^[1-9][0-9][0-9]$" "$1" | sed -E 's/.*([A-Z]{3})([0-9]{4})\.*crs:[0-9][0-9]/\1\2/g' | gawk 'NR==$a { print; echo "" }'` course=`echo $file | sed 's/[A-Z]//g'` (cat "$2"; echo ""; echo "$course";) > "$4/$file" # Locate all files in the data directory with the .crs extension that also contain a line with # only a string "51" - "999" and grabs the contents of that file and stores them to the new # output file temporarily for retrieval grep -hrEB 4 --include \*.crs -e "^[5][1-9]$" -e "^[6-9][0-9]$" -e "^[1-9][0-9][0-9]$" "$1" | gawk 'NR==$x,NR==$y{print}' >> "$4"/$file # Create variables to hold the dept and course info varCNum=`gawk -v n=6 '{saved[FNR % n] = $0} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varDC=`gawk -v n=5 '{saved[FNR % n] = $1} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varDN=`gawk -v n=5 '{saved[FNR % n] = $0} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file | gawk '{for(i=2;i<=NF;i++){printf "%s", $i};}'` varCN=`gawk -v n=4 '{saved[FNR % n] = $0} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varCS=`gawk -v n=3 '{saved[FNR % n] = $2} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varCE=`gawk -v n=3 '{saved[FNR % n] = $3} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varCH=`gawk -v n=2 '{saved[FNR % n] = $0} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` varNS=`gawk -v n=1 '{saved[FNR % n] = $0} ENDFILE {if (FNR >= n) print saved[(FNR + 1) % n]}' "$4"/$file` # Substitute the variables into the output file && and clean up sed -E "s/\[\[ dept_code \]\]/$varDC/g; s/\[\[ dept_name \]\]/$varDN/g; s@\[\[ course_name \]\]@$varCN@g; s@\[\[ course_start \]\]@$varCS@g; s@\[\[ course_end \]\]@$varCE@g; s@\[\[ credit_hours \]\]@$varCH@g; s@\[\[ num_students \]\]@$varNS@g; s@\[\[ course_num \]\]@$varCNum@g; s@\[\[ date \]\]@$varDate@g;" "$4"/$file | sed -e :a -e '$d;N;2,6ba' -e 'P;D' let i+=1 let x+=5 let y+=5 let a+=1 done I'm passing in the following arguments to my script: $ ./data assign4.template 12/16/2021 ./output Which gives the following error message "./assign4.sh: line 31: ./output/: Is a directory ./assign4.sh: line 37: ./output/: Is a directory gawk: warning: command line argument `./output/' is a directory: skipped"
<bash><loops><awk><while-loop><scripting>
2019-10-21 05:30:54
LQ_EDIT
58,480,848
Javascript how to merge two different array of object
<p>I would like to merge two different array of objects to one, as follows: </p> <p>Array 1:</p> <pre><code>[ { id: 1, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...' }, { id: 2, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...' }, ] </code></pre> <p>Array 2:</p> <pre><code>[ { a:'...', b:'...', c:'...', }, { d:'...', e:'...', f:'...', } ] </code></pre> <p>Array 1 and array 2 have same length. I would like to merge them correspondely, as follows: </p> <pre><code>[ { id: 1, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...', a:'...', b: '...', c: '...' }, { id: 2, fullName: '...', districtName: '...', cityName: '...', placeName: '...', geoLat: '...', geoLong: '...', d:'...', e: '...', f: '...' }, ] </code></pre> <p>How would I do this? I've thought about using map, but that way I can only iterate through one array. I have to iterate both array and merge them. </p> <p>Any suggestions are helpful. Thank you</p>
<javascript>
2019-10-21 06:30:28
LQ_CLOSE
58,483,130
Get current URL address by javascript
<p>How can I get current URL like this.</p> <p>For example, if the url is:</p> <p><a href="http://www.test.com/app/one.bc" rel="nofollow noreferrer">http://www.test.com/app/one.bc</a></p> <p>I want to get the path without the address the main page so like:</p> <p>/app/one.bc</p>
<javascript>
2019-10-21 09:10:53
LQ_CLOSE
58,485,880
How to pause game in unity on steam overly
I am developing a game in unity for the steam platform. I want to know how to pause the game when steam overly is called. I tried several things but nothing worked.
<c#><unity3d><steam>
2019-10-21 12:00:34
LQ_EDIT
58,487,890
My SQL Python ProgrammingError: 1064 (42000)
<p>I am trying to store scraped data with scrapy to a sql database but I get the following error: ProgrammingError: 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 7</p> <p>Please find my pipelines.py bellow</p> <pre><code>from datetime import datetime import mysql.connector from mysql.connector import errorcode class LecturesinparisPipeline(object): ... class CleaningPipeline(object): ... class DatabasePipeline(object): def __init__(self): self.create_connection() self.create_table() def create_connection(self): self.conn = mysql.connector.connect( host='localhost', user='root', passwd='sTUDIO987', database='lecturesinparis_db' ) self.curr = self.conn.cursor() def create_table(self): self.curr.execute("""DROP TABLE IF EXISTS mdl""") self.curr.execute("""create table mdl( title text, location text, startdatetime text, lenght text, description text, )""") def process_item(self, item, spider): self.store_db(item) return item def store_db(self, item): self.curr.execute("""insert into mdl values (%s,%s,%s,%s,%s)""", ( item['title'][0], item['location'][0], item['startdatetime'][0], item['lenght'][0], item['description'][0] )) self.conn.commit() </code></pre>
<python><mysql><sql><database><scrapy>
2019-10-21 13:59:21
LQ_CLOSE
58,488,710
Java and Golang http performance compare
<p>I recently started using golang, and I did a test to compare the performance of java and golang http calls; I was surprised to find that golang is much faster than java, and sometimes it takes almost no time to call another service from one service. I am curious that this is due to the nature of the language or is the java framework doing too much to make it slower?</p> <p>JAVA environment:</p> <p>JDK1.8</p> <p>Springboot2.1.7.RELEASE</p> <p>Golang environment:</p> <p>go1.9.3</p> <h1>JAVA service1(LISTEN 10006 PORT):</h1> <pre><code> @GetMapping("/hello") public String hello(String name) { log.info("in"); String result = restTemplate.getForObject("http://localhost:10007/hello?name=" + name, String.class); log.info("out"); return result; } </code></pre> <h1>JAVA service2(LISTEN 10007 PORT):</h1> <pre><code> @GetMapping("/hello") public String hello(String name) { log.info("in"); return "Hello " + name; } </code></pre> <h1>Golang service1(LISTEN 10008 PORT):</h1> <pre><code> func main() { fmt.Println("start") http.HandleFunc("/hello", DefaultHandler) err := http.ListenAndServe(":10008", nil) if err != nil { fmt.Errorf("error: %s", err) } } func DefaultHandler(w http.ResponseWriter, r *http.Request) { name := r.FormValue("name") fmt.Printf("%s, %s\r\n", time.Now(), "in") resp, _ := http.Get("http://localhost:10009/hello?name=" + name) body, _ := ioutil.ReadAll(resp.Body) defer resp.Body.Close() fmt.Printf("%s, %s\r\n", time.Now(), "out") w.Write(body) } </code></pre> <h1>Golang service2(LISTEN 10009 PORT):</h1> <pre><code> func main() { fmt.Println("start") http.HandleFunc("/hello", DefaultHandler) err := http.ListenAndServe(":10009", nil) if err != nil { fmt.Errorf("error: %s", err) } } func DefaultHandler(w http.ResponseWriter, r *http.Request) { fmt.Printf("%s, %s\r\n", time.Now(), "in") name := r.FormValue("name") w.Write([]byte("Hello " + name)) } </code></pre> <p>I used browser to send request like this:</p> <p><a href="http://localhost:10006/hello?name=tom" rel="nofollow noreferrer">http://localhost:10006/hello?name=tom</a></p> <p><a href="http://localhost:10008/hello?name=tom" rel="nofollow noreferrer">http://localhost:10008/hello?name=tom</a></p> <p>The result is mostly like the following</p> <p>JAVA service1:</p> <p>2019-10-21 22:04:46.406 INFO 16936 --- [ XNIO-1 task-12] com.web.test6.controller.TestCtrl : in</p> <p>2019-10-21 22:04:46.412 INFO 16936 --- [ XNIO-1 task-12] com.web.test6.controller.TestCtrl : out</p> <p>JAVA service2:</p> <p>2019-10-21 22:04:46.410 INFO 16200 --- [ XNIO-1 task-6] com.web.test7.controller.TestCtrl : in</p> <p>Golang service1:</p> <p>2019-10-21 22:06:36.1888823 +0800 CST m=+1438.272728801, in</p> <p>2019-10-21 22:06:36.1888823 +0800 CST m=+1438.272728801, out</p> <p>Golang service2:</p> <p>2019-10-21 22:06:36.1888823 +0800 CST m=+1436.497480201, in</p>
<java><go>
2019-10-21 14:41:24
LQ_CLOSE
58,489,106
Is there a faster way to update all the commits Author in the **master** branch?
<p>I need to over-write/update Author in my entire master branch git repo.</p> <p>I know I can do this one by one </p> <p><code>git commit --amend --author="John Doe &lt;jdoe@outlook.com&gt;" --no-edit git push -f</code></p> <p>but that will take me weeks. </p> <p>Is there a faster way to update all the commits Author in the <strong>master</strong> branch?</p>
<git><github><bitbucket>
2019-10-21 15:05:00
LQ_CLOSE
58,491,757
I can't find the answer of this problem in python?
[enter image description here][1] find the python code for this problem. [1]: https://i.stack.imgur.com/C6s39.png
<python><python-3.x>
2019-10-21 17:55:37
LQ_EDIT
58,492,048
c# only return some fileds in json
I have an API that returns some data of a class in json, Is there any way to return only some specific fields of a c# class in json? For example: ``` class Person { public int Id{ get; set; } public string Name { get; set; } public string Family { get; set; } public string Gender { get; set; } } Person myPerson = new Person(); var Json = (new { Person = myPerson }); return Request.CreateResponse(HttpStatusCode.OK, Json); ``` It returns ID, Name, Family, Gender. I need to return only Name and Family. I thought may I can create an object and add my specific fields in the class in that object and return object?!
<c#><json>
2019-10-21 18:18:10
LQ_EDIT
58,493,901
js stopwatch is not accurate
helloo im very new to js & jquery. i wrote a stopwatch(accuracy 0.1 second) code very quickly in js that seems it works correctly but the problem is after it reaches 10min it keeps being a couple of seconds behind (i compared it to a digital stopwatch) can anyone see the problem pls? "im writing this part bcause stack told me that your post contains too much code blah blah blah..." var i = 0, desi_s = 0, s2 = 0, s1 = 0, m2 = 0, m1 = 0; $("#start").click(function () { //calling the start button $("#reset").click(function () { //calling the reset button clearInterval(myInt); $("#reset").each(function(){ $(this).html(''); this.style.backgroundColor = "transparent"; this.style.borderColor = "transparent"; }); i = 0; desi_s = 0; s2 = 0; s1 = 0; m2 = 0; m1 = 0; $("#min2 ,#min1 ,#sec2 ,#sec1 ,#desi_sec").html(0); }) i++; clearInterval(myInt); var myInt = setInterval(function () { if (i % 2 !== 0) { $("#start").html('stop'); if (desi_s < 9) { desi_s++; $("#desi_sec").html(desi_s); } else { desi_s = 0; if (s2 < 9) { s2++; $("#sec2").html(s2); } else { s2 = 0; $("#sec2").html(s2); if (s1 < 5) { s1++; $("#sec1").html(s1); } else { s1 = 0; $("#sec1").html(s1); if (m2 < 9) { m2++; $("#min2").html(m2); } else { m2 = 0; $("#min2").html(m2); if (m1 < 5) { m1++; $("#min1").html(m1); } else { m1 = 0; clearInterval(myInt); } } } } } } else { clearInterval(myInt); $("#start").html('start'); $("#reset").each(function(){ $(this).html('reset'); this.style.backgroundColor = "black"; this.style.color = "white"; }); } }, 100); })
<javascript><jquery>
2019-10-21 20:46:19
LQ_EDIT
58,494,250
VBA - Print function selecting wrong Type of Change option
I have code below for a print function created in VBA. When I select Return from leave under the drop down of the Type of Change field and print, it prints as a salary change type, not return from leave. I cant see where I went wrong in my code or what is causing the issue... Any thoughts? Thanks in advance![![][1]][1] Sub pcf_print() Dim ws As Worksheet Dim datasheet As Worksheet Dim fs As Object Dim str As String Dim bool As Boolean If Len(ActiveSheet.Name) < 3 Then MsgBox "This worksheet is not a PCF" Exit Sub End If If Left(ActiveSheet.Name, 3) <> "PCF" Then MsgBox "This worksheet is not a PCF" Exit Sub End If 'MsgBox Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v")) 'Right(ActiveSheet.Name, 4) If InStr(ActiveSheet.Name, " vv") Then If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then MsgBox "This form has not been completed" Exit Sub End If Else If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) < 1.2 And (ActiveSheet.Range("F9") = "(select)" Or ActiveSheet.Range("F9") = "")) Or (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then MsgBox "This form has not been completed" Exit Sub End If End If Set datasheet = ActiveSheet If ActiveWorkbook.Worksheets("Form Lists").Range("CorpOrStore") = "Corp" Then str = "Corporate" Else str = "Stores" End If Set fs = CreateObject("Scripting.FileSystemObject") bool = fs.FolderExists("H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\") If Not bool Then MkDir "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" End If If InStr(ActiveSheet.Name, " vv") Then If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 Then ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls" End If Else If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 Then ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls" Else ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & datasheet.Range("F9") & " for " & datasheet.Range("J16") & ", " & datasheet.Range("F16") & " effective " & Month(datasheet.Range("F11")) & "-" & Day(datasheet.Range("F11")) & "-" & Year(datasheet.Range("F11")) & ".xls" End If End If Set ws = ActiveWorkbook.Worksheets("Payroll Forms") If Right(ActiveSheet.Name, 5) = "v1.20" Then ActiveWorkbook.Worksheets("Form Lists").Unprotect "0nl1n3" ActiveWorkbook.Worksheets("Form Lists").Range("B8") = "A1:G76" ActiveWorkbook.Worksheets("Form Lists").Range("B9") = "A80:G157" ActiveWorkbook.Worksheets("Form Lists").Range("B10") = "A160:G225" ActiveWorkbook.Worksheets("Form Lists").Range("B11") = "A228:G259" ActiveWorkbook.Worksheets("Form Lists").Range("B12") = "A228:G259" ActiveWorkbook.Worksheets("Form Lists").Range("B13") = "A228:G259" ActiveWorkbook.Worksheets("Form Lists").Range("B14") = "A263:G338" ActiveWorkbook.Worksheets("Form Lists").Range("B15") = "A263:G338" ActiveWorkbook.Worksheets("Form Lists").Range("B16") = "A343:G367" ActiveWorkbook.Worksheets("Form Lists").Range("B17") = "A263:G338" ActiveWorkbook.Worksheets("Form Lists").Range("B18") = "A160:G225" ActiveWorkbook.Worksheets("Form Lists").Range("B19") = "A370:G420" ActiveWorkbook.Worksheets("Form Lists").Protect "0nl1n3" End If If Right(ActiveSheet.Name, 5) = "v1.20" Or Right(ActiveSheet.Name, 5) = "v1.21" Or str = "Corporate" Then ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("H2") Else ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2") End If ActiveWorkbook.Unprotect "0nl1n3" ws.Visible = xlSheetVisible ws.PrintOut ws.Visible = xlSheetHidden ActiveWorkbook.Protect "0nl1n3" ActiveWorkbook.Close False End Sub [1]: https://i.stack.imgur.com/iFZbg.png
<excel><vba>
2019-10-21 21:17:24
LQ_EDIT