• Breaking News

    Tuesday, April 24, 2018

    Issues with Employer, what should I do? Ask Programming

    Issues with Employer, what should I do? Ask Programming


    Issues with Employer, what should I do?

    Posted: 24 Apr 2018 03:48 PM PDT

    So today the CEO of the company said two things that is actually bothering me. So during a production meeting in front of the entire team the CEO said that he wished he would've hired programmer X with 5-7 years of experience over me. Also this programmer X was coming in for an interview today as well. Later during the day, the interview was over and the CEO was walking out the candidate, he made a statement that I know was directed towards me. He said we should test before releasing a feature to a client, and then mumbled a few things to the interviewee. I couldn't hear what was mumbled.

    I had a production review two months ago, and received a raise. Actually a significant raise for my work, and the only thing that I needed to work on was testing before release. So I have spent extra time testing before completing Jiras. I feel its almost impossible to release software that is bug free, especially in our process.

    The CEO carries many hats, such as project manager, and sales rep. I question his level of seniority, and another devs seniority level as being intermediate. One of the devs had no idea what functional programming was, and mocks TDD. The CEO refers to unit testing as manually testing a feature. Just a few things such as that which makes me think that they are intermediate as senior devs. Neither one of them program in there spare time, or try to constantly improve, or learn new techniques. For crying out loud we don't even utilize minification on Javascript, and CSS. Also things such as SQL params, after login we don't enforce, use string concat it doesn't matter. These are just a few things that really makes me question their seniority level, I can add more.

    Our process goes like this, CEO creates a Jira for a new feature, assigns the Jira to a programmer. The programmer builds the feature, tests the feature, and prepares the feature for release. Once the feature is prepared for release, the Jira is marked as complete, and assigned back to the CEO. The CEO sometimes tests the feature, or does whatever with it. Any issues then he reassigns back. If there aren't any issues then the feature is pushed to production during the next release.

    We are strictly a Web Forms, and C# company. Personally in my opinion Web Forms is a horrible web framework. I can go into many details as to why but I can see the reason why Web Forms wasn't included in the .net core releases. Web Forms isn't very marketable from a hire-ability perspective, or at least not in the area I am at. I don't get to utilize, or learn new things.

    How would you handle this situation? I feel like looking for a new job. I've been thinking about confronting him but I am afraid that this might just be something that would cause additional conflict. This is my first job as a programmer, and I have only been with the company for 7 months.

    submitted by /u/grimlek_7
    [link] [comments]

    Other than enforcing political goals, what service do ISPs sell that could not be done cheaper, or even a few times greater the cost in exchange for more freedom, by hardware available to many people? Why ISP at all?

    Posted: 24 Apr 2018 06:15 PM PDT

    [C++] Need help with one condition for this pig latin project

    Posted: 24 Apr 2018 03:48 PM PDT

    Hi there - I need help with one specific condition in this pig latin project. We need to "include "y" as a vowel IF it is in any position other than the beginning of a word: "trying" becomes "ying-tray" but "you" becomes "ou-yay"

    my code is here: https://pastebin.com/kvHHUVSe

    i really need help implementing this :/

    submitted by /u/2kool4jewschool
    [link] [comments]

    Python - Calling a class/method

    Posted: 24 Apr 2018 02:37 PM PDT

    Basic python question but I'm having some trouble.

    I'm working on a class inheritance program and the program is essentially 3 generations of classes starting with grandparents, parents and then children, and the grandparents/parents generate a string and the child gets a certain % of the characters from the string. Starting with the grandparents here is my code for the class:

    class GrandMother(object): def __init__(self, GrandMotherchrom): self.GrandMotherschrom = GrandMotherchrom def GrandMotherschrom(self): return (''.join(random.choice(string.ascii_lowercase[:12]) for x in range(12))) GrandMotherschrom = GrandMotherschrom(12) 

    and to call the class I'm using ->

    new = GrandMother() new.GrandMotherschrom() 

    but I'm getting this error: line 132, in <module> new = GrandMother() TypeError: init() missing 1 required positional argument: 'GrandMotherchrom'

    If I try to call it like this

    new = GrandMother(GrandMotherscrom) new.GrandMotherschrom() 

    I get this error ->

    line 132, in <module> new = GrandMother(GrandMotherscrom) NameError: name 'GrandMotherscrom' is not defined

    Am I not calling the class/method correctly? Thanks for your help :)

    submitted by /u/SimianRob
    [link] [comments]

    Understanding React AJAX calls

    Posted: 24 Apr 2018 08:26 PM PDT

    I'm looking at this right now to understand how to make AJAX calls using React.

    All of this makes sense except the things in the componentDidMount function.

    I don't understand what => does

    And I don't understand why they're setting variables within state instead of just having regular variables.

    submitted by /u/Tiemyshoelaces42
    [link] [comments]

    [Assembly] syscall kernel entry function.

    Posted: 24 Apr 2018 07:32 PM PDT

    Hello,

    I'm trying to find the function and file where a system call enters the kernel so I can track the processes of a system for a kernel IDS.

    Thank you.

    submitted by /u/SomethingQuiteToxic
    [link] [comments]

    Is it possible to communicate with another Windows app, given that the other way offers some kind of interface?

    Posted: 24 Apr 2018 01:03 PM PDT

    Hey guys!

    I am a web developer but I have a special question about an OS app. For the sake of simplicity I am using Skype and TeamViewer in a very abstract example here:

    Let's say I would want to develop an app that combines both of those apps (and probably more) into one simply interface. In this example we assume that both Skype and TeamViewer can run as a background service, there is no UI. They also provide a way to communicate with them. For example Skype has a "initiateCall(..)" function etc.

    Now in my app I click on a button "Call Jake & start TeamViewer access" (for whatever reason). The app then starts Skype (in the background) and calls jake. It also starts teamviewer in the background and once the user enters the connection details it connects to Jake.

    Is it even possible to start another app like that? Is it possible to communicate with it like "initiateCall(..)" etc.? Alternatively, given that the users have a 100% guarantee to be connected to the internet: Could both apps communicate through web sockets or something like that?

    Thank you for helping me out!

    submitted by /u/dafuqjoelarry
    [link] [comments]

    Modifying open source code for my own purposes?

    Posted: 24 Apr 2018 09:09 AM PDT

    So I'm writing a little python script that generates a keyboard heatmap. I found someone who already did a lot of the gross work I was going to have to do , and I'm using part of their open source code and modifying a portion of it that's going in my program. My code is in a github repo. How do I go about giving credit to the person who's code I'm using? I'm trying to avoid plagiarizing and give them credit. Thanks!

    submitted by /u/peeves91
    [link] [comments]

    How can i build a random movie, game suggestion app?

    Posted: 24 Apr 2018 10:31 AM PDT

    I am trying to build an android app which its function will be making random suggestions from sites like imdb, steam, netflix etc. I am stuck though, i couldnt find much on the internet. What should i looking for to do this app? How can i do this?

    submitted by /u/thekinginthenorf
    [link] [comments]

    One stop shop for web architecture?

    Posted: 24 Apr 2018 06:42 AM PDT

    I was never much interested in web design/architecture during undergrad and I've mainly worked in high performance computing using C/C++ languages and the related libraries since then.

    Recently I've had to deploy my C++ code on a server, which means that I've had to learn web technologies very fast (HTML, JS, Ajax, rest apis etc). I am reading JS from Kyle Simpson which is a great book and other technologies from the net. But I am having a difficult time connecting all these technologies together.

    Can someone recommend a good book which gives a bird's eye view of web architecture, connecting everything together?

    Please recommend books that you've personally read and found useful.

    Edit:

    The material in the following course best represents what I am asking.

    https://open.hpi.de/courses/webtech2015

    submitted by /u/zindarod
    [link] [comments]

    Advanced database query optimization

    Posted: 24 Apr 2018 12:15 PM PDT

    Hello everyone! Me again, high off the kind and brilliant responses you all always bring. I might be showing my ignorance, but I did try to browse for the answer without success.

    Here's the (mock) scenario. I've catalogued car lots all over the world. My main table, CarLots, has about 10 million records with basic lot info. Each lot can carry up to 12 different CarModels (many-to-many). My web app will let users search for a lot that meets their criteria, notable options being CarLot fields and a list of model types.

    So, Betty wants to find lots in her region that carry Teslas, Priuses, and Hummers. When she submits her search, my database goes to work... how? My current best idea is a incremental filter within a join, something like this:

    SELECT CarLots.id FROM CarLots WHERE CarLots.region='Belgium' AND CarLots.id IN (SELECT carlot_id FROM CarLots_CarModels WHERE carmodel_id=1 AND carlot_id IN (SELECT carlot_id FROM CarLots_CarModels WHERE carmodel_id=2 AND..... 

    Get it? Alternately I can do all my SELECTS and run intersections locally, but that seems like it would be way less efficient since CarLots_CarModels is around 10 million * 12 records.

    So anyone got a great idea how to do what is essentially a multi-conditional join? My table formats are flexible but the database engine/schema is set (MySQL/InnoDB).

    Thanks for reading!

    submitted by /u/MGatner
    [link] [comments]

    Synchronize threads across multiple JVM

    Posted: 24 Apr 2018 08:05 AM PDT

    Hello everyone, I'm asking for a little help

    Here's the situation:

    .

    The method do a "SELECT MAX(xxx) FROM table"

    then create a new record with xxx+1 and insert it

    .

    If another thread wants to execute the method in the same time he should ends with xxx+2.

    This is solved by using Synchronized methods

    .

    But now I'd like to do it across multiple server. This method can be executed on server1 or on server2

    And those methods should keep the same behavior.

    This is a non-clustered environment (and will not become one)

    How would you solve this ? I was thinking about some Locks on records to prevent concurrent reads. Or is it possible to keep the current approach and synchronize threads across differents JVM ? ( I insist, it's a non-clustered environment)

    .

    We use MSSQL ( SQL Server) and Java

    .

    Expected Behavior

    JVM 1 JVM 2
    Select max(xxx) from table
    -return record 00
    Select max(xxx) from table
    -Waiting
    Compute new xxx
    Insert record 01
    -return record 01
    Compute new xxx
    Insert record 02
    submitted by /u/Krok3tte
    [link] [comments]

    Java - difficulty understanding Google Maps API

    Posted: 24 Apr 2018 08:44 AM PDT

    Hey all,

    I'm fairly new to programming and am currently working on my first app that I've built all on my own. I previously followed along a Udemy class to create a few others with the help of the class.

    Part of my app allows users to select a fast food restaurant (i.e. McDonalds), and what I want to implement is google maps within my app that finds the user's location and then shows them on the map McDonalds within 10 miles of their location.

    Currently I have my API key, am able to show google maps within my app, and ask the user for permission for their location. However, the part I've been stuck on for a week now is trying to figure out how to actually show all the McDonalds around the user. I've googled a mixture of questions to no avail and feel like I'm going a bit crazy! Hoping that someone could please lead me into the right direction. Thank you!

    submitted by /u/drops_of_life77
    [link] [comments]

    Open an email in inbox via automation using python.

    Posted: 24 Apr 2018 10:47 AM PDT

    I want to automate the opening of an email and copy its contents and save somewhere. It could be that I receive the mail daily, so I would like to copy each email by the date it was received.

    I could think of selenium webdriver API for this purpose since I have used it earlier, but I don't know how to use it here. There might be someother technique to automate this.

    I am open to suggestions. Any help is appreciated. :)

    submitted by /u/ZER_0_NE
    [link] [comments]

    Help with programming game of UNO in C.

    Posted: 24 Apr 2018 02:04 PM PDT

    I am trying to create the card game UNO in C. I only need to be able to play with 2 players and I have to create the deck and the 2 players hands using a linked list. I have to be able to shuffle the cards as well. Other than that, standard UNO rules: after each round the opponents total points are awarded to the winner and first player to get to 500 points wins the overall game.

    I currently have the code to create the deck (I did it from a file i created with the 108 cards) and I am able to shuffle the deck. I also figured out how to deal 7 cards to the 2 players. I just don't know how to create a discard pile and be able to pick a certain card from the players hand and be able to discard it. Or how to be able to draw from the draw pile. I just need a lot of help writing the rest of this code...

    This is my code so far:

    include <stdio.h>

    include <stdlib.h>

    include <string.h>

    include <time.h>

    typedef struct card_s { char suit [7]; int value; char action[15]; struct card_s *pt; } card;

    struct card_s* CreateDeck(){

    card *headp=NULL, *temp, *tail=NULL; FILE *fp; fp = fopen("Uno_Deck.txt", "r"); //open file wiht 108 uno cards //This creates the linked list from the file temp = (card *)malloc(sizeof (card)); while (fscanf(fp, "%s %d %s", temp->suit, &temp->value, temp->action) != EOF){ if (headp == NULL){ headp = temp; } else { tail->pt = temp; } tail = temp; tail->pt = NULL; temp = (card *) malloc(sizeof (card)); } fclose(fp); //Closes file return headp; 

    }

    void Print(card *headp){ //prints list while (headp != NULL){ printf("%s %d %s \n", headp->suit, headp->value, headp->action); headp = headp->pt; } printf("\n"); }

    struct card_s* ShuffleCard(struct card_s* deck){ struct card_s* crd; int n,i,j,k;

    struct card_s** arr; //We will store as array for shuffling for (n=0, crd=deck;crd!=NULL;n++,crd = crd->pt){ arr = (struct card_s**)malloc (n * sizeof(struct card_s*)); //allocates memory } for (i=0, crd = deck; crd != NULL; i++, crd=crd->pt){ arr[i]=crd; } for (i=0; i<1000; i++){ for (j=0; j<n; j++){ k=rand()%n; crd=arr[j]; arr[j]=arr[k]; arr[k]=crd; } } for (i=0; i<n-1;i++){ arr[i]->pt = arr[i+1]; } arr[i]->pt=NULL; crd=arr[0]; return crd; 

    }

    void Deal_Hands(struct card_s** deck, struct card_s** hand1, struct card_s** hand2, int n) {

    struct card_s *cur, *cur1, *cur2; //Stores current card in 3 lists int i; cur1 = NULL; cur2 = NULL; cur = *deck; for(i = 0; i < 2 * n && cur != NULL; i++, cur = cur->pt) { if(i % 2 == 0) { //Player 1's turn (even) if(cur1 == NULL) { //Refers to first element(card) in list *hand1 = cur; } else { cur1->pt = cur; } cur1 = cur; } else { //Player 2's turn (odd) if(cur2 == NULL) { //Refers to first element(card) in list *hand2 = cur; } else { cur2->pt = cur; } cur2 = cur; } } cur1->pt = cur2->pt = NULL; //Ends the lists with NULL *deck = cur; //Updates the deck witht the remaining elements(cards) 

    }

    int main(void) { int choice;

    struct card_s *deck, *hand1, *hand2, *discard; srand(time(NULL)); //Random Number deck = CreateDeck(); printf("Let's Play a Game of UNO!\n"); printf("Press 1 to shuffle the UNO deck or 2 to load a deck from a file: "); scanf("%d", &choice); if (choice == 1){ deck = ShuffleCard(deck); //shuffles deck from file Print(deck); //prints shuffled deck } if (choice == 2){ //printf("The deck has been loaded in.\n"); Print(deck); //prints the deck from file } printf("\n--------------------------\nPlaying UNO with 2 players\n--------------------------\n\n"); Deal_Hands(&deck, &hand1, &hand2, 7);//two hands are dealt from the deck with 7 cards printf("Player 1's hand: \n"); Print(hand1); printf("Player 2's hand: \n"); Print(hand2); /* Next we have to create a discard pile from the first node of the rest of the hand after it is dealt. Then we print the discard pile. Then we ask player one to play a card. Check to see if color OR number match, and if it does, add it to the front of the discard pile linked list. If neither match, then say that card is unplayable and to pick a different card or press 0 to draw from deck. If either one of the players hands are empty then round is over. Take opponents total score of each card and award them to the winner. If score > 500 then player wins. */ free(deck); free(hand1); free(hand2); return 0; 

    }

    And for the file "Uno_Deck.txt" just consists of this: Red 0 normal Red 1 normal Red 2 normal Red 3 normal Red 4 normal Red 5 normal Red 6 normal Red 7 normal Red 8 normal Red 9 normal Red 1 normal Red 2 normal Red 3 normal Red 4 normal Red 5 normal Red 6 normal Red 7 normal Red 8 normal Red 9 normal Yellow 0 normal Yellow 1 normal Yellow 2 normal Yellow 3 normal Yellow 4 normal Yellow 5 normal Yellow 6 normal Yellow 7 normal Yellow 8 normal Yellow 9 normal Yellow 1 normal Yellow 2 normal Yellow 3 normal Yellow 4 normal Yellow 5 normal Yellow 6 normal Yellow 7 normal Yellow 8 normal Yellow 9 normal Green 0 normal Green 1 normal Green 2 normal Green 3 normal Green 4 normal Green 5 normal Green 6 normal Green 7 normal Green 8 normal Green 9 normal Green 1 normal Green 2 normal Green 3 normal Green 4 normal Green 5 normal Green 6 normal Green 7 normal Green 8 normal Green 9 normal Blue 0 normal Blue 1 normal Blue 2 normal Blue 3 normal Blue 4 normal Blue 5 normal Blue 6 normal Blue 7 normal Blue 8 normal Blue 9 normal Blue 1 normal Blue 2 normal Blue 3 normal Blue 4 normal Blue 5 normal Blue 6 normal Blue 7 normal Blue 8 normal Blue 9 normal Red 20 skip Red 20 skip Yellow 20 skip Yellow 20 skip Green 20 skip Green 20 skip Blue 20 skip Blue 20 skip Red 20 reverse Red 20 reverse Yellow 20 reverse Yellow 20 reverse Green 20 reverse Green 20 reverse Blue 20 reverse Blue 20 reverse Red 20 draw-2 Red 20 draw-2 Yellow 20 draw-2 Yellow 20 draw-2 Green 20 draw-2 Green 20 draw-2 Blue 20 draw-2 Blue 20 draw-2 Red 50 wild Red 50 wild-draw-4 Yellow 50 wild Yellow 50 wild-draw-4 Green 50 wild Green 50 wild-draw-4 Blue 50 wild Blue 50 wild-draw-4

    submitted by /u/simplybrody
    [link] [comments]

    Identifying proper classes

    Posted: 24 Apr 2018 10:16 AM PDT

    Hello,

    So I have to model a software using UML. Basically, the software needs to create a functional analysis document almost fully complete for conveyor systems to help reduce time doing it.

    For that my idea is to have each possible equipment have a text ready (with some variables in it like speed, power etc). So each component will have one. Some components are used multiple times eg: conveyors, sensors... And others will be one time only like the bottling machine itself. My idea was that each equipment would have its own class (each equipment would be described differently in the document).

    But I was told that it would make too many classes and that it would be better to find other classes ideas.

    What I'm asking is how can I identify different classes? Should I stick with 1 class = 1 equipment or 1 class multiple equipments?

    Just a reminder unless I can finish the modeling part in time, I won't start on the programming itself, for now, it's just UML (I don't think it matters anyway)

    Thx for your help,

    submitted by /u/TheArtofWarPIGEON
    [link] [comments]

    Programs and peripherals.

    Posted: 24 Apr 2018 01:19 PM PDT

    Hola! 2nd year CS student here. At this point I've dipped my toes in C#, VB, Java, and some scripting fun. But I've been curious - say I want to use a thermometer (or whatever peripheral input source of your choice) for a calculator program. What's the general approach to doing that? I would need to get the program to recognize my thermometer & have a library of methods to use to get data from it, no? I figure this is a broad question but all i've done so far is solicit & calculate my own data for the most part so I wondered where "third party" data came in.

    submitted by /u/aaronnator
    [link] [comments]

    Extracting useful data from large, inconsistent files

    Posted: 24 Apr 2018 07:41 AM PDT

    Afternoon, hoping someone can point me in the right direction. I an no programmer whatsoever so I don't know which way to go at the moment.

    What I am trying to do, is take a large .txt file containing various tables and move them into something like excel so that I can produce some graphs on the data. The problem I have is that I have previously been using a macro so step through the data and arrange it into a block I can just copy and paste into excel. This is really slow and I'm sure there's a better way I can be doing this but I don't know where to start. Another issue is that sometimes the tables are different sizes and that causes problems with macros.

    I could really do with being pointed in the right direction!

    Thank you

    submitted by /u/sm0l6
    [link] [comments]

    Legal Advice: Open Source Software, Intellectual Property & Employment after Creation

    Posted: 24 Apr 2018 02:37 AM PDT

    Hi guys,

    I've written an open source software, hosted on GitHub, for a third party website, which is modifying it, and got a job offer from the company running that website after I've released it.

    Now that the software is modifying the website and is open source, I'm not really allowed to continue it due to IP, because it is kind of competing with the company and I've accepted the job offer, but I don't want to completely cancel or remove it or transfer it to another individual.

    Questions:

    1. Do I need to fully cancel/remove the project although it's open source and I've started it before the employment?

    2. Can I do anything to stay indirectly involved? Is it possible to transfer the repository to an organisation and invite people to keep it alive. Can I still participate in discussions, but not contribute with code?

    3. Can I stay as author of the software?

    4. Do I need to transfer the ownership in the Chrome Webstore & Mozilla Add-Ons to another person?

    submitted by /u/silentreader1824
    [link] [comments]

    Free server-side logging solution

    Posted: 24 Apr 2018 06:06 AM PDT

    Is there any free alternatives to Splunk, that can be installed on server with no restrictions (like single user restriction on Splunk Free)?

    I considered ELK stack, but it is way too overhead for my purposes, it makes me dive into all this complicated data-analysis infrastructure, but all I need is reading and querying logs.

    I also considered Graylog, but unfortunately, I have only Windows Server, which is not supported by Graylog.

    Do you have any suggestions?

    submitted by /u/Sovent
    [link] [comments]

    Java Combining multiple arrays

    Posted: 24 Apr 2018 04:16 AM PDT

    Hi, I am trying to reverse the following by each byte;

    from (byte1) (byte2) (byte3) (byte4) to (byte4) (byte3) (byte2) (byte1)

    int[] data1= {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,1,0,1,0,1,0};

    but it there is something I am missing since It doesn't work, any help would be appreciated

    import java.util.Arrays; public class uebung{ public static int[] DataReverse(int[] data) { int[] byte1 = Arrays.copyOfRange(data,0,8); int[] byte2 = Arrays.copyOfRange(data,8,16); int[] byte3 = Arrays.copyOfRange(data,16,24); int[] byte4 = Arrays.copyOfRange(data,24,32); int[] reversedbytes = { byte4 , byte3 , byte2 , byte1 }; return reversedbytes; } } 
    submitted by /u/freakingcold
    [link] [comments]

    Javascript - Transforming simple data object into array of array of objects depending on condition

    Posted: 24 Apr 2018 03:45 AM PDT

    I have a comment/reply object, I have been trying to create a new object in the format of array of array of objects, but it's above my skill level, I am just a student currently

    This is the object that I want to transform:

     [ {"id":9,"comment":"This is a normal comment to the post SON","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":22,"comment":"new made comment","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":23,"comment":"just let me ","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":24,"comment":"bla bla","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":29,"comment":"another comment","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":30,"comment":"reply 12 btw","commentername":"noforget","parentID":29,"commentVotes":0,"isWhat":"reply","voteToID":null,"votername":null,"voteAmount":null}, {"id":31,"comment":"reply btw","commentername":"noforget","parentID":9,"commentVotes":0,"isWhat":"reply","voteToID":null,"votername":null,"voteAmount":null}, {"id":32,"comment":"reply to reply btw","commentername":"noforget","parentID":31,"commentVotes":0,"isWhat":"reply","voteToID":null,"votername":null,"voteAmount":null} ] 

    This is the format that I want it to end up as:

     [ [ {"id":9,"comment":"This is a normal comment to the post SON","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null}, {"id":31,"comment":"reply btw","commentername":"noforget","parentID":9,"commentVotes":0,"isWhat":"reply","voteToID":null,"votername":null,"voteAmount":null}, {"id":32,"comment":"reply to reply btw","commentername":"noforget","parentID":31,"commentVotes":0,"isWhat":"reply","voteToID":null,"votername":null,"voteAmount":null} ], [ {"id":22,"comment":"new made comment","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null} ], [ {"id":23,"comment":"just let me ","commentername":"noforget","parentID":42,"commentVotes":0,"isWhat":"comment","voteToID":null,"votername":null,"voteAmount":null} ] ] 

    In other words, I want the main comment and all the replies of it(and the replies of those replies etc) to be put inside of an array, which is in an array

    I have been trying to do this for 2 days, please help me.

    A few notes about the data, the "isWhat" can either be "comment" or "reply", if it's a comment, it means that it's just a normal comment to the post and not a reply, and the parentID of it is the ID of the post(you shouldn't worry about that), the parentID of the "isWhat: reply" is the parentID of the comment it's replying to

    Thank you for your time!

    submitted by /u/khazha88
    [link] [comments]

    Using validators with ModelForms in Django?

    Posted: 23 Apr 2018 11:27 PM PDT

    I am currently trying to design form validation for my website.

    I have many fields of the same type, for example, currency. They are all in the same model.

    I am generating a ModelForm and using it to display the form. In the model definition I have many attributes defined in each model, like help text and labels. The Django docs recommend re-defining the field in the ModelForm, but to my eye this kind of defeats the purpose of using the model form in the first place. I was hoping to be able to define the validators similarly to how widgets, labels and help_texts are defined, as per this:

    class AuthorForm(ModelForm): class Meta: model = Author fields = ('name', 'title', 'birth_date') labels = { 'name': _('Writer'), } help_texts = { 'name': _('Some useful help text.'), } error_messages = { 'name': { 'max_length': _("This writer's name is too long."), }, } 

    But that doesn't seem possible.

    I'd like to have, for example a "positive_currency" validator that checks that the value has at most two decimal places and is positive, then I'd like to use that at the ModelForm level. I don't want it at the model level since in different forms at different times the value should be negative. Surely there has to be a way to do this that I'm just missing.

    I could write it all into the clean method, but then I'm not sure how to return field-specific errors, which are a must as the user has to know which field has an error.

    submitted by /u/Siiimo
    [link] [comments]

    How important has it been for you to have a laptop instead of desktop for programming?

    Posted: 24 Apr 2018 02:06 AM PDT

    Hi everyone

    I have been learning programming for a few years (still basic) and have done side projects at home. Now I am about to buy either an iMac or Macbook Pro for ios development. Now I am just thinking how much is portability will be important for me in the future especially if I end up doing projects with others or I need to do some presentation? i dont know.

    I prefer the iMac. Its cheaper and bigger screen. I just dont want to regret this decision down the line so would like to know how often professional and or hobby developers need to take their laptops away from home for team work or presentations. Thanks

    submitted by /u/gil_ho
    [link] [comments]

    No comments:

    Post a Comment