[Solved] Swift 4: Array index out of Range

[ad_1] You declared an array of String var stringArray = [String]() Then you appended one element stringArray.append(forss as! String) That means only index 0 is valid stringArray[0] and you get an out-of-range error for stringArray[1] stringArray[2] etc. Note: The question is not particularly related to Swift 4. All versions of Swift exhibit this behavior. 0 … Read more

[Solved] how would look a sql insert for this database tables? [closed]

[ad_1] If there were no foreign keys/triggers or something like that (please provide more info about that), the inserts would look like this: insert into language (languageID, language) values (1, ‘german’) insert into language (languageID, language) values (2, ‘english’) insert into word (id, language, text) values (1, 2, ‘lucky’) insert into word (id, language, text) … Read more

[Solved] Calculating sum of numbers from a file?

[ad_1] The answer to your problem with writing to the file is every time you are writing to the file you are over writing what was there before, what you need to do is change FileOutputStream fos = openFileOutput(“TotalSavings”, Context.MODE_PRIVATE) to: FileOutputStream fos = openFileOutput(“TotalSavings”, Context.MODE_PRIVATE | Context.MODE_APPEND) This tells android you want to append … Read more

[Solved] How to pass array “by reference” in C? [duplicate]

[ad_1] I do not judge your algorithm or C conventions, friends who comment on your problem are totally right. But if you still do it in this way you can use this approach. #include <stdio.h> #include <string.h> void removeFirstAndLastChar(char* string) { memmove(string,string+1,strlen(string)); string[strlen(string)-1]=0; } int main(void) { char title[] = “ABC”; removeFirstAndLastChar(title); printf(“%s”, title); // … Read more

[Solved] Unable to run Golang application on Docker

[ad_1] Change run.sh to replace port 8080 to 8082 #!/bin/bash echo “Listening on http://localhost:8082” docker run -p 8082:80 codetest I have changes port to 8082 if the port is already in use change that port again to some other port based on your available port. If you are on Windows netsh interface portproxy add v4tov4 … Read more

[Solved] How can i use alamofire for post api [duplicate]

[ad_1] First of all you add almofire library into your project then import almofire into your ViewController then below method apply in your button action. func webServiceLogin(isFbLogin:Bool,email:String,password:String) { var parameters:[String:String]? parameters = [“hash”:email as String,”key”:password ] Alamofire.request(“your url”, method: .post, parameters: parameters,encoding: URLEncoding.default, headers: nil).responseJSON { response in hideHud(self.view) switch response.result { case .success: if … Read more

[Solved] How do i add space between this php variables

[ad_1] You’re generating invalid HTML. This: ‘<option value=”. $spName . ” ‘ . $spPro .’>’ ^— WITH the added space Will produce something like this: <option value=SomeName SomeProfession> The browser has no way of knowing that these two values are part of the same attribute. In short, you forgot the quotes. You want to generate … Read more

[Solved] POSITION STICKY CSS

[ad_1] If you want to avoid such overlap you need to consider more container where you wrap each date add its messages in the same container. Doing this, the previous day will scroll before the next one become sticky * { margin: 0px; padding: 0px; } .chat { overflow: auto; border: solid 1px black; left: … Read more

[Solved] What’s wrong in this JavaScript code?

[ad_1] I have to agree with comments above, not sure what you’re doing but…the problem is that a submit handler is a function not the string you’re assigning, this: subBut.onclick = (document.getElementById(‘helllo’).innerHTML=(submi(document.getElementById(‘user’).value, document.getElementById(‘passw’).value))); should be: subBut.onclick = function() { document.getElementById(‘helllo’).innerHTML= submi(document.getElementById(‘user’).value, document.getElementById(‘passw’).value); return false; //for testing, prevent form submission }; You can test the updated … Read more

[Solved] Format a string, clear specific characters in a string? [closed]

[ad_1] According to what I understand from your question. This may work for you. string FormatString(string text) { // Get the last string and replace the “-” to space. string output = text.split(“https://stackoverflow.com/”).Last().Replace(“-“,” “); // convert it into title case output = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(output); return output; } [ad_2] solved Format a string, clear specific characters in … Read more