|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On October 06 2019 19:46 SC-Shield wrote:Just out of curiosity, how long do you stay at company on average?
I only spent a year in my first two jobs, quitting both because I was unhappy (and because I was making dirt compared to what I should have been making).
This time I'm amazingly happy at a small-end consultant company owned by the employees (and subsequently, all the profits are either used on the employees, or goes into the employees' pockets), and I just bought in on some shares too. So I'll probably be staying here for a while until I decide to move over into a more management oriented job, which is years and years away.
|
How to debug POST requests in django? In my template i have <input type="submit" value="Save"> when i click it i see that POST is made and it returns OK [11/Oct/2019 13:58:38] "POST /ship_systems_base/2/ HTTP/1.1" 200 24582 but the data in database is not changed. How to debug this? How to see what is posted to database (i suspect something different than i think it is but how to debug this ???).
EDIT: The answer is (for those interested) if You have Your fields declared in views.py and do not use those fields in template You will get post OK but data will not be saved (even if You have default or blank declared for those fields not used fields).
|
Is still someone reading this topic or have i scared everyone away with my django questions ??
|
On October 17 2019 18:28 Silvanel wrote:Is still someone reading this topic or have i scared everyone away with my django questions ??
Not much for anyone to comment on when you asked and answered your own question but it's also a bit specific for most people here (Including myself who have never worked with Django). It's a type of question you'd have more luck asking on StackOverflow or similar
|
Yeah. I figured as much. I guess i will have to start using StackOverflow. There is too many very specific interactions happening on the borders between html/application/database to get answers simply by browsing documentation.
|
On October 17 2019 19:00 Silvanel wrote: Yeah. I figured as much. I guess i will have to start using StackOverflow. There is too many very specific interactions happening on the borders between html/application/database to get answers simply by browsing documentation.
Use the book I posted (it has online version that is completely free). If you go through it you'll see how to debug things and learn how to create and test a full stack web application with Django.
|
Well guys, this will probably be my last semester. You all did it, you successfully got this doofus through a decent CS program.
Anyone hiring for data analysis / ML ? Looking for a cushy job w/ radically high pay.
|
Data Analysis and ML is actually hiring a lot right now. Try checking out consulting companies - they can be a great place to get started in the field.
|
I haven't done java in like almost 4 years. Wondering if someone can help me with something.
In my data structures class, I am having to make various structures that use hashing. We have to fill in the methods for each class, it's backed by an interface and the project also includes some other classes we are supposed to use.
In the first structure I am making, the class has:
private KVPairList[] table;
Now, KVPairList is a class we were provided. It seems to be the case that we are supposed to use it. It is essentially an iterable linked list of KVPair objects (another class we are provided).
The KVPairList class essentially looks like a linked list. It has an inner class, nodes. It has head, tail, etc. It has a constructor:
public KVPairList(){ head = tail = null; count = 0; }
So what is going on here? What is KVPairList[]? This object isn't an array. How do I even instantiate a new KVPairList[] ? The only way I can make a new KVPairList is to do:
table[size] = new KVPairList();
But what the heck does this even mean? a new KVPairList() is an empty linked list. So what does it mean for an array of size N to be an empty linked list?
Furthermore, if I do that, it clearly doesn't actually create a KVPairList() because I don't have access to it's methods. Have they made this project intentionally confusing, or are there java conventions that I am not understanding here?
edit: okay, so does this syntax instantiate an array of size "size", where each index is a new KVPairList? If so, this assignment is extremely confusing and this is the opposite way of how I would think we should do this lol
|
`table[size]` is not an array of size N. It is the item at index `size` in the array `table` (assuming the array was initialized before).
|
The array wasn't yet initialized.
spoiler so it doesn't take up too much space:
+ Show Spoiler + public class SeparateChainingHashTable implements HashTable{
/* ****************************************************************** */ /* ***** PRIVATE FIELDS / METHODS PROVIDED TO YOU: DO NOT EDIT! ***** */ /* ****************************************************************** */
private KVPairList[] table; private int count; private PrimeGenerator primeGenerator;
// We mask the top bit of the default hashCode() to filter away negative values. // Have to copy over the implementation from OpenAddressingHashTable; no biggie. private int hash(String key){ return (key.hashCode() & 0x7fffffff) % table.length; }
/* **************************************** */ /* IMPLEMENT THE FOLLOWING PUBLIC METHODS: */ /* **************************************** */ /** * Default constructor. Initializes the internal storage with a size equal to the default of {@link PrimeGenerator}. */ public SeparateChainingHashTable(){ /*We have to implement this constructor. How do I instantiate table? And what is it? }
Here is the fields and constructor of KVPairList:
+ Show Spoiler + public class KVPairList implements Iterable<KVPair>{
private class Node { KVPair pair; Node next;
Node(String key, String value, Node next){ pair = new KVPair(key, value); this.next = next; }
Node(String key, String value){ this(key, value, null); }
}
private Node head, tail; private int count;
/** * Default constructor. Initializes an empty {@link KVPairList}. */ public KVPairList(){ head = tail = null; count = 0; }
... ... ...
I am really just not understand this
|
If the array is not initialized then it will either be a runtime error (null referencing or invalid index), or a compiler error (I can't remember if the Java compiler catches this).
|
+ Show Spoiler [reference post] +On October 28 2019 04:37 travis wrote:I haven't done java in like almost 4 years. Wondering if someone can help me with something. In my data structures class, I am having to make various structures that use hashing. We have to fill in the methods for each class, it's backed by an interface and the project also includes some other classes we are supposed to use. In the first structure I am making, the class has: private KVPairList[] table;
Now, KVPairList is a class we were provided. It seems to be the case that we are supposed to use it. It is essentially an iterable linked list of KVPair objects (another class we are provided). The KVPairList class essentially looks like a linked list. It has an inner class, nodes. It has head, tail, etc. It has a constructor: public KVPairList(){ head = tail = null; count = 0; }
So what is going on here? What is KVPairList[]? This object isn't an array. How do I even instantiate a new KVPairList[] ? The only way I can make a new KVPairList is to do: table[size] = new KVPairList();
But what the heck does this even mean? a new KVPairList() is an empty linked list. So what does it mean for an array of size N to be an empty linked list? Furthermore, if I do that, it clearly doesn't actually create a KVPairList() because I don't have access to it's methods. Have they made this project intentionally confusing, or are there java conventions that I am not understanding here? edit: okay, so does this syntax instantiate an array of size "size", where each index is a new KVPairList? If so, this assignment is extremely confusing and this is the opposite way of how I would think we should do this lol
Mystery class in the first code block has a member variable that is an array of KVPairList. You're going to hash something which will give you a number. That's the index of table. Each index of the table is a linked list as you've noted. This is to deal with collisions in the hash table.
|
ah wait a sec I think I see what you are saying.
|
On October 28 2019 04:59 Blitzkrieg0 wrote: Mystery class in the first code block has a member variable that is an array of KVPairList. You're going to hash something which will give you a number. That's the index of table. Each index of the table is a linked list as you've noted. This is to deal with collisions in the hash table.
ohh.... I think I have come to the root of my confusion.
So KVPairList is a linked list of <key,value> pairs. I forgot that even though the hashed keys will correspond to one index, the keys themselves in a given KVPairList may be different. Because of collisions.
Okay, this does make sense to me. I was confused about why KVPairList was even taking keys as a parameter, rather than only taking values.
I think this clears up all the confusion. Thanks you guys!
|
On October 24 2019 02:31 travis wrote: Well guys, this will probably be my last semester. You all did it, you successfully got this doofus through a decent CS program.
Anyone hiring for data analysis / ML ? Looking for a cushy job w/ radically high pay.
PM'd you.
|
|
|
|
Depends entirely on how lucky you are. Could be anything from 10 minutes to 10 years. The more niche your question is, the less likely it is to get answered.
|
|
|
|