Moral Panic
Member
It turns out Popovers have been overhauled for IOS8. Why that means they need to break the ones already working, I don't know....
What can I learn from here to be more employabl? Note: I'm looking for internships.
It turns out Popovers have been overhauled for IOS8. Why that means they need to break the ones already working, I don't know....
var x = 350; var y = 0; scale = 0.57
this.button = this.paper.path('M' + x + ',' + y +
'H' + (x + (185 * this.scale)) +
'V' + (y + (42 * this.scale)) +
'L' + (x + (165 * this.scale)) + ',' + (y + (42 * this.scale)) +
'L' + (x + (165 * this.scale)) + ',' + (y + (62 * this.scale)) +
'M' + (x + (165 * this.scale)) + ',' + (y + (42 * this.scale)) +
'v' + (this.scale * 20) +
'a' + this.scale * 20 + ',' + this.scale * 20 + ' 0 0,0 ' + 20 * this.scale + ',' + (this.scale * -20) +
'M' + (x + (165 * this.scale)) + ',' + (y + (62 * this.scale)) +
'H' + (x + (20 * this.scale)) +
'a' + this.scale * 20 + ',' + this.scale * 20 + ' 0 0,0 ' + 20 * this.scale + ',' + (this.scale * -20) +
'V' + (y + (-42 * this.scale)) +
'Z');
So Rust looks pretty cool, I've heard talk that it's meant to replace C/C++ in the long run. 15-20 years out. It sounds really cool, still seems a bit underbaked.
Thoughts on it?
Any ios developers here? Where their any changes to ARC in ios 8? My references aren't being kept in my popover and I can't find out out what changes were made from 7.1 where it works perfectly.
It's a bug, and it was annoying enough that it got prioritized and is in the process of being fixed. It will definitely be working by 1.0.Something that can be pretty annoying is that the borrow checker (and the type checker as well) is sometimes a little overbearing, forcing you to introduce an extra local variable for no good reason and so on. Some of that might be bugs as well.
Just took a quick look over your github. One thing you should consider doing is go back to your notepad clone project, and give it a final polish. Write docs, add a proper build system with instructions, either script based or maven/gradle whatever. I see you're using gradle for CYOA-toolkit so you should be able to add it to the other one. If a potential employer goes on there and sees well written docs (nothing too massive, just enough info to use) and they get a clear set of steps on replicating your build that will count for big points. I know that I am 100 times more likely to use a library/check something out if I can just clone, build, done. Consider using github releases to upload your jar rather than including in the source. Otherwise it's a good starting point, just keep adding new projects and try to keep the docs/build management up to date. Those are actually the least work out of anything else for a project but they make it look much more professional than just a bunch of code uploaded.
By docs do you mean a Wiki on Github or something like a Javadoc?
It's a bug, and it was annoying enough that it got prioritized and is in the process of being fixed. It will definitely be working by 1.0.
let xs = vec![12i, 14, 15, 17, 12, 12];
let ys = xs.iter().map(|i| i % 2i).collect();
ugh, trying to learn java after doing c++ is a nightmare. java is so wordy
ugh, trying to learn java after doing c++ is a nightmare. java is so wordy
I came from Java and am having a hell of a time with C++. It's so unforgiving.
It makes the transition interesting in both directions. Java programmers now using c++: free men you are. What will you do with that freedom?
It makes the transition interesting in both directions. Java programmers now using c++: free men you are. What will you do with that freedom?
Let me know if anyone can help me with some Java! I can pay with...games!
Serial pc(USBTX; USBRX); //for communicating with terminal through usb
AnalogIn lm(p20); //the thermometer connected to pin 20
float x;
int main() {
pc.baud(9600) //controls speed of information
while (1) {
x = lm.read(); //reading in the data from thermometer
pc.printf("%f \n \r", x); //printing data along with carriage return to terminal screen
}
}
Serial pc(USBTX; USBRX); //for communicating with terminal through usb
AnalogIn lm(p20); //the thermometer connected to pin 20
float x;
float array[1000];
float sum = 0.0;
float average = 0.0
int main() {
pc.baud(9600) //controls speed of information
while (1) {
for(int i=0; i<1000;i++) {
array[i] = lm.read(); //reading in the data from thermometer into array
}
for(int i=0; i<1000;i++) {
sum = sum + array[i];
average = sum/1000;
}
pc.printf("%f \n \r", average); //printing data along with carriage return to terminal
}
}
Perhaps resetting your initial sum back to 0.0 at the start of each iteration of the infinite "while" loop might be useful.The sum just grows forever.
What mistake am I making?
I think Go gets a lot right. It's one of only a very few select modern languages that puts compile speed first and foremost in the spotlight, and there's been a lot of work done to make sure the language is easy to read for both machines and humans. The technical talent involved with the language is immense, and it shows. Green threads have their issues, but Go does them about as well as you can in an imperative language. The tooling around it is amazing--every language should have something like gofmt.
I've been using Go for my latest project. I used to be a C++ dev, and compared to that, it's such a pleasure!
I've been using Go for my latest project. I used to be a C++ dev, and compared to that, it's such a pleasure!
Perhaps. It's not for everyone. Though where impressions of the language are concerned, "C++" is ambiguous... C++11 is a huge improvement in usability from C++03, and 03 is a momentous improvement from the original spec.Most likely blow something up unintentionally.
That's actually my biggest issue with Java at this point -- I'm not sure what it's good for anymore. It's been flanked on both sides in utility, both as a general purpose language and one of specific functionality.
I think Go gets a lot right. It's one of only a very few select modern languages that puts compile speed first and foremost in the spotlight, and there's been a lot of work done to make sure the language is easy to read for both machines and humans. The technical talent involved with the language is immense, and it shows. Green threads have their issues, but Go does them about as well as you can in an imperative language. The tooling around it is amazing--every language should have something like gofmt.
.
.
.
<snip>
if (fahrenheitbutton == 1) {
//call fahrenheit function
}
else if (celsiusbutton == 1) {
//call celsius function
}
else {
// call fahrenheit mode function
}
I need some more advice please.
In addition to displaying the temperature, I have two buttons, one for Fahrenheit and one for Celsius, so I can switch modes.
I need the program to check if a button has been pressed, but I also need it to repeatedly display the temperature in the last selected mode if no button has been pressed.
So basically I need an infinite while loop that the program can also get out of at any moment.
How can I do something like that?
I thought about doing something like .....
But I think if I do this it won't work because if the user chooses Celsius, they'll only get it once. But if I put a while(1) in the celsius function they can never go back to Fahrenheit.
Any ideas?
I need some more advice please.
In addition to displaying the temperature, I have two buttons, one for Fahrenheit and one for Celsius, so I can switch modes.
I need the program to check if a button has been pressed, but I also need it to repeatedly display the temperature in the last selected mode if no button has been pressed.
So basically I need an infinite while loop that the program can also get out of at any moment.
How can I do something like that?
I thought about doing something like .....
Code:if (fahrenheitbutton == 1) { //call fahrenheit function } else if (celsiusbutton == 1) { //call celsius function } else { // call fahrenheit mode function }
But I think if I do this it won't work because if the user chooses Celsius, they'll only get it once. But if I put a while(1) in the celsius function they can never go back to Fahrenheit.
Any ideas?
No, it's pretty stable now (and pretty well-defined, too).Go is something I've been really wanting to look into. It sounds it's not fulfilling what it sought out to do? Or is it just too early to be stable and well defined language?
Variables to store the user's choice, C or F.
While loop with nested if/else statement.
Utilize system time so you can control how often the updates happen.
Those are some ideas I can think of off the top of my head. Go from there.
May I ask what this is for? In general you don't want to use a loop to wait for input when the state of your system is unchanging. You would rather use signals. Though that might be beyond what you are doing. But if it's a program meant to live beyond an assignment or other hobby stuff then it's the way to go.
edit: Hey cool I think I just figured it out. Thanks for the mental prompt! This was the best thing I ever built.
import random
#list of names
names = ["Jane", "Alfred", "Mary", "Jen", "Bob", "Ruth", "Trey", "Doug", "Celine"]
nameCounter = {}
#fill the dictionary with each name as the key and a value of 2
#used to ensure each person is assigned exactly twice
for x in names:
nameCounter[x] = 2
#empty list of assigned names
#this will be constructed as a list of lists
#where the first name in the sub-list is the gift buyer, and the following two names are gift receivers
allocated_names = []
#function for retrieving valid names
def get_valid_name(x):
name = random.choice(nameCounter.keys())
while name == x or name == None:
name = random.choice(nameCounter.keys())
return name
#main thread
if __name__ == '__main__':
#go through all the names in the list
#x is the current gift buyer
for x in names:
#retrive the first name of the gift receiver
name1 = get_valid_name(x)
#retrieve the second name of the gift receiver
name2 = get_valid_name(x)
#check that the names are not the same and retrieve a new one until they're different
while name2 == name1:
name2 = get_valid_name(x)
#add the gift buyer and two gift receivers to the list
allocated_names.append([x, name1, name2])
#decrement the counter for each name once they have been assigned
nameCounter[name1] -= 1
#has the name being assigned twice?
if nameCounter[name1] <= 0:
# remove name from dictionary to help with efficiency using random.choice() in get_valid_name(x)
del nameCounter[name1]
nameCounter[name2] -= 1
if nameCounter[name2] <= 0:
del nameCounter[name2]
print allocated_names
How are math degrees looked upon in the programming community? I'm not too far from completeing my degree, but I recently found a love for learning how to program.
Will teaching myself how to program and having a math degree allow me to find a job? Or is a computer science degree practically required?
I haven't done any programming for a long time, so I decided to write a simple program for assigning "gift receivers" to "gift buyers" for people in my family for secret santa, as a warm up to get back into it.
The rules I specified are:
- A person can't be assigned them self
- Each person is assigned two people (effectively means each person gets two presents)
- Assigned names for a "gift buyer" must be different
- A person can't be assigned as a "gift receiver" more than twice
This is what I have so far, written in Python. It mostly works, but isn't particularly elegant (see questions below the code block).
Code:import random #list of names names = ["Jane", "Alfred", "Mary", "Jen", "Bob", "Ruth", "Trey", "Doug", "Celine"] nameCounter = {} #fill the dictionary with each name as the key and a value of 2 #used to ensure each person is assigned exactly twice for x in names: nameCounter[x] = 2 #empty list of assigned names #this will be constructed as a list of lists #where the first name in the sub-list is the gift buyer, and the following two names are gift receivers allocated_names = [] #function for retrieving valid names def get_valid_name(x): name = random.choice(nameCounter.keys()) while name == x or name == None: name = random.choice(nameCounter.keys()) return name #main thread if __name__ == '__main__': #go through all the names in the list #x is the current gift buyer for x in names: #retrive the first name of the gift receiver name1 = get_valid_name(x) #retrieve the second name of the gift receiver name2 = get_valid_name(x) #check that the names are not the same and retrieve a new one until they're different while name2 == name1: name2 = get_valid_name(x) #add the gift buyer and two gift receivers to the list allocated_names.append([x, name1, name2]) #decrement the counter for each name once they have been assigned nameCounter[name1] -= 1 #has the name being assigned twice? if nameCounter[name1] <= 0: # remove name from dictionary to help with efficiency using random.choice() in get_valid_name(x) del nameCounter[name1] nameCounter[name2] -= 1 if nameCounter[name2] <= 0: del nameCounter[name2] print allocated_names
I have two questions. One is reasonably specific and the other is much more general.
1. There is a situation where an infinite loop can occur. This happens when the program gets to the last one or two people in the list and the pool of remaining "gift receivers" contains them self, without a sufficient number of different people to choose from instead. How can I get around this while still retaining the random assignment? Effectively I need a way to ensure that, when the program reaches the final "gift buyers", there is a guarantee that there will be enough different people that doesn't include them self.
2. I'm looking for general advice on how to structure code. What are some design patterns that I should consider to craft better code?
import random
names = ["Jane", "Alfred", "Mary", "Jen", "Bob", "Ruth", "Trey", "Doug", "Celine"]
def match_gifts(gs, rs):
givers = list(gs)
receivers = list(rs)
pair = []
for giver in givers:
receiver = giver
while receiver == giver:
receiver = random.choice(receivers)
receivers.remove(receiver)
pair.append( receiver)
return pair
if __name__ == '__main__':
first_list = match_gifts(names, names)
second_list = match_gifts(names, names)
for i in range(len(names)):
print "{0} needs to buy one gift for {1} and one gift for {2}.".format(names[i], first[i], second[i])
if __name__ == '__main__':
done = False
first = match_gifts(names, names)
while not done:
second = match_gifts(names, names)
for i in range(len(first)):
if first[i] == second[i]:
done = False
break
else:
done = True
for i in range(len(names)):
print "{0} needs to buy one gift for {1} and one gift for {2}.".format(names[i], first[i], second[i])
Code:for i in range(len(names)): print "{0} needs to buy one gift for {1} and one gift for {2}.".format(names[i], first[i], second[i]
for name, first, second in zip(names, fist_list, second_list):
print "{} needs to buy one gift for {} and one gift for {}.".format(name, first, second)
It's a minor thing, but whenever you see "for i in range(len(names)):" in Python code, there's usually a nicer way of doing it, usually using zip (or enumerate, if you really need the index):
Code:for name, first, second in zip(names, fist_list, second_list): print "{} needs to buy one gift for {} and one gift for {}.".format(name, first, second)
I take issue with the accusation of Java being the fastest anything.Lucene, POI, Spring Boot + Spring Security + Spring REST, JPA, iText, and a host of other libraries make it still the best language for enterprise web development. It's also still the fastest language when it comes to throughput for a web application.
I take issue with the accusation of Java being the fastest anything.
But yes, there's a huge amount of enterprise stuff from dinosaur organizations unable or unwilling to switch to modern technology. That's why it's still in use.
I'm not sure there's a legitimate reason other than that. Inertia is a powerful drug.
Say I have an app and I don't want reviews/emails from customers going "hey can you add this feature" or "hey when is this going to get fixed". I'm thinking of keeping a github repository purely for tracking issues. Pros: keeping track and categorizing them. Cons: Might be a bit of a threshold for people to overcome to post on Github, and creating an account and such. Also, I'm not sure what kind of permissions I can give to people and if I retain admin rights over the issues.
On Github the Issue Tracker is connected to the source repository. Do you want to open your code? If not you are probably looking more for a dedicated Issue/Change Request Tracker like Bugzilla.
I take issue with the accusation of Java being the fastest anything.
But yes, there's a huge amount of enterprise stuff from dinosaur organizations unable or unwilling to switch to modern technology. That's why it's still in use.
I'm not sure there's a legitimate reason other than that. Inertia is a powerful drug.