Converting String to Date - Java

I have implemented the following method to convert a String to a Date because the Date(String) constructor is deprecated: private Date format(String inputString) { DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); ...
more »

2017-06-17 22:06 (3) Answers

Removing spaces from strings

I tried to write a function that gets a string and creates a new string but without multiple spaces (leaving only 1 space between words). So far I wrote this, but for some reason it crashs and the debugger shows nothing. I also don't know where do ...
more »

2017-06-17 15:06 (4) Answers

How to abbreviate a full name in C?

I am trying to get a full name from the user and display his name abbreviated, something like that : “Edward Cantrell Cavender Davis” --> Name the user entered "DAVIS, E. C. C.” -- Name abbreaviated The problem is that I don't know how ...
more »

2017-06-15 16:06 (3) Answers


I am struggling trying to do this with Google BigQuery: I do have a column with dates in this following STRING format: 6/9/2017 (M/D/YYYY) I am wondering how can I deal with this, trying to use then the DATE clause., in order to get the DATE f...
more »

2017-06-15 12:06 (1) Answers

Separate string into 3 columns: text, number, text

I'm working with a large dataset (~1500 rows), and when I built the dataset, I didn't think ahead about separating my identifiers, so they're lumped into one long string. The identifying string is in a column labeled "Polygon_Name". I'd like to kee...
more »

2017-06-14 17:06 (2) Answers

Trouble with alternating string case

Working through exercises on the CodeWars website and I need help being pointed in the right direction for a simple function: Write a function toWeirdCase (weirdcase in Ruby) that accepts a string, and returns the same string with all even inde...
more »

2017-06-14 05:06 (6) Answers

SDWebImage doesn't work

What am I doing wrong? Everything runs but I don't get the Images, help! Thanks! import UIKit import Firebase import FirebaseDatabase import SDWebImage struct postStruct { let title : String! let downloadURL : String! } class ZeroHomeView...
more »

2017-06-13 22:06 (1) Answers

Python decode_header splits the original string

Using Python 3, I'm trying to parse e-mails from an mbox file. for message in mailbox.mbox('file'): sender = message['From'] c = decode_header(sender) The raw e-mail has this unique From: header From: "=?UTF-8?Q?Mark_from_Site?=" <info...
more »

2017-06-13 12:06 (2) Answers

Ways to optimise this code

I am exploring ways to optimise the code that follows. The code loops over a string. For the ith character in the string, the code increments one entry in a 2D array at the ith column. The exact entry at the ith column that is incremented depends on...
more »

2017-05-26 21:05 (2) Answers

User-Agent in String(url, encoding) for Swift 3

As we know, to obtain the HTML in string for a given url, we have: String(contentsOf: url, encoding: .utf8) My question is, can I use my own User-Agent for the given code? If so, how to accomplish this? If not, how to get the HTML in string for a...
more »

2017-05-26 02:05 (1) Answers

C# Regex URL Port username & password

I have a URL and need to extract the port, username and password from it and put them into an array. It looks like following. Can I u...
more »

2017-05-25 22:05 (4) Answers

C array initializing - some basics

I'v read in a book that when you have a string like this "blabla", it means there is a hidden char array, and this expression returns the address to the first element, and it's like a const array . This makes me confused about 2 scenarios : char ...
more »

2017-05-25 10:05 (4) Answers

UserDefaults between Objective-C and Swift

Just trying to be extra careful here... If I have an app that saved a value in UserDefaults like this in Objective-C: NSString *newString = textField.text; [[NSUserDefaults standardUserDefaults] setObject: newString forKey:@"textKey"]; Would this...
more »

2017-05-25 04:05 (3) Answers

Django checking for a query string

When someone clicks on my site's logout link, I want them to be redirected to the login page but I want a message to pop up saying that they were successfully logged out. However, I don't want this behaviour to occur when someone normally visits the ...
more »

2017-05-24 22:05 (2) Answers

Best way to build string avoiding repetition

I have a hard coded string that will be used in a URL and I'm wanting to know is what the best way to build this string without having to repeat the words country, or, and, number? This is a shortened version as there are more countries and numbers t...
more »

2017-05-24 14:05 (3) Answers

strange script issue in Powershell

I am new to PowerShell, but not scripting. Why does this script: $usr = "john.doe" $usrname = $usr -split ".", 0, "simplematch" $fullname = upperInitial($usrname[0]) + upperInitial($usrname[1]) write-host "Hello $fullname" function upperInitial($u...
more »

2017-05-23 14:05 (1) Answers

Implement a String in a separator Swift3

I have a question. I work on a app with currencies and i want to put the correct currency symbol automatically in the let applcation to trim the complete string. First i have this code snipped : let firstPriceTrimmed = firstPrice.components(separate...
more »

2017-05-23 08:05 (1) Answers