>tfw trying to figure out Django How do I configure multiple databases? I.e. domain.com/A shows stuff from A database while domain.com/B shows stuff from B database. Also the models for the two databases are identical.
Kevin Garcia
Can I get some hints on finding a job?
I graduated with a B.S. last December. Took some time off to help my father with something. But so far I've applied to about 30 places. Have my resume on monster/dice/angel/cyborcoders. I have fullstack projects, with a person site that has them all hosted. A shitty linkedin. I didn't get an internship, yeah I know. I did research instead like an idiot. I reached out to a recruiter and he said he doesn't have much for junior, aka nothing. What other avenues should I take? Is going to meetups on meetup dot com a meme?
Leo Stewart
Get gud. I don't know django, but you should be able to configure a database connector that your models use. Detect your domain and modify the parameters of the connector appropriately.
Nathan Thompson
very noice
Lincoln Stewart
where are you from?
Jackson Barnes
I'm looking in the Boston area. or RI.
Blake Scott
Go to meetups. Apply to different places. If need be, apply for internships as well. Be careful with how many places you apply to. If you apply to a ton of different companies, the quality of each individual application will surely decline. Quality over quantity. Cover letters are not optional.
a decent looking business card kind of website which a company would want and a blind person could use (accessibility). then with a custom form on it, e.g. one where the visitor can select a contact possibility and then only that form input is shown. and again, a blind person has to be able to use it.
Brandon Turner
I love Spring Boot unironically. t. non pajeet fullstack Java dev. Come at me
Colton Rivera
When I'm looking I normally use keywords Entry/Junior/Front End/Back End/ Full Stack and go from there. I'm also applying to places that say 1+ year of experience because I know youre saying that there is plenty of Junior developer jobs, but I've found only a couple that say 0+ experience.
Jack Cruz
Do an internship first mate
Jonathan Wright
also, please do apply to places that want more experience than you actually have, because all their requirements are just the ideal candidate, but most companies actually hire the closest they can get.
Gavin Taylor
tfw just started an internship at a large company and they're assigning me to a Spring Boot + Angular 4 project. Been doing tutorials the past two days and it's pretty fun desu.
Thomas Hughes
Thanks for all the feedback. Appreciate it.
Gabriel Reyes
that's awesome. keep it up.
Hudson Ward
Any tips on getting a junior Dev job? I've gotten two interviews but no job yet. I have a good portfolio and resume, but 0 webdev work experience.
Gabriel Richardson
>I have a good portfolio and resume, for you
Gavin Scott
really fucking cool. Keep it up!
Benjamin Smith
can you make a dating sim like that as browser game?
Nathaniel Wright
For someone with my experience level it's fine. I've gotten interviews but it's so difficult to get a door in the door.
Alexander Barnes
Clarifying and reposting my question from previous thread:
I have at index.php the following code
require_once 'framework.php';
test(); print moot; print $hiro;
test() successfully runs and prints 'test OK'. "Print moot" successfully prints 'google employee of the month'. "Print $hiro" prints 'japanese dataminer spy assigned to the west'
Framework.php looks like this
function test() { print 'test OK'; } CONST moot = "google employee of the month" $hiro = "japanese dataminer spy assigned to the west"
This is where I get confused. Within any other PHP class file (I'm working inside class now after index.php and framework.php), this is the behavior. Let's say I have some class file outputbuffering.php:
final class outputbuffering { public function clearOutputbuffering() { //do shit }
public function testingScope() { test(); //it works just like in index.php print moot; //works as well print $hiro; //crashes - $hiro i undefined } }
Why is only $hiro undefined when we are dealing with php files that did not directly require framework.php?
In case it doesn't and someone knows the answer let me know please
Ryder White
Thanks for the suggestion, a question on this too. How long do you think this should realistically take to do?
Adam Mitchell
>it's so difficult to get a door in the door. you usually get a foot on the door, not another door
Zachary Williams
do projects a portfolio is not enough when not backed by either a degree or a shitton of projects
also learn php, not just the trendy hipster shit
Jeremiah Hall
I made a "complete steps to unlock" type url shortenener and finished it recently. Ignoring the purpose my site serves, what do you guys think of my front end design?
I recently got a job as a Python backend dev, self-taught, no work experience. Here I'm sharing 3 coding challenges I had to do (for different companies) as part of their technical interviews. I passed all three interviews, but in the end they hired someome with more experience.
answering my own question, any function inside framework.php would have to do:
$hiro = 'Sup Forums owner';
function getHiro() { global $hiro; return $hiro; }
to retrieve the value. But that is only the case for .php files that do not call 'request framework.php'. I don't get why the different behavior but at least I can work with it now
Aaron Allen
that's why I'm sharing. Also, I got tons of hackerrank and codility challenges, so work on those.
idk how fast you learn, but can do it in a few hours if you know what to do lol
James Johnson
good shit! nichts wirklich auszusetzen, gut gemacht.
Samuel Lopez
Any typescript advice? I just start learn it, and i have background in C# php C++ and bit of javascript.
Samuel Long
Don't use globals. Those are really bad practice. You should build your application with correct inheritance and scope management so you dont need globals.
Same guy from last thread btw. Again your examples make very little sense. Where do you intialize your class? Where do you run the method? Please provide full examples so we can see how your project is structured.
Matthew Lopez
Variable scope is limited to whatever function you're in. Nothing else is really relevant. You can inject variables into your scope with the "use" keyword. That is mostly relevant for anonymous functions. Regardless, you should use the GLOBALS array or some custom array/object instead of using a variable by name, since it limits your ability to check its existence, and is very fragile.
Jacob Reed
>Don't use globals. Those are really bad practice. You should build your application with correct inheritance and scope management so you dont need globals.
If you don't have one global object, you end up instantiating an object for each single file you work with. You need a way to call Database->query() from each file. You can either:
>instantiate an object for every single file. Tedious task and looks bad. >Do something like Laravel and use .../façades, so you can do DB::query-> >pass an object to every single class as a parameter to have access to the framework methods. Again, tedious and looks bad
honestly I'm going with a global method for this, where you can simply call framework()->doSomething(). And personally I find "USE namespace" declarations at the top of php files an ugly and confusing way to work with things, I don't want to do something like laravel.
I know globals are bad, but I'm going with 1 global for my framework object
Logan Wood
Embrace it completely. Use strictNullChecks and noImplicitAny. If it is annoying for you to have to be explicit about handling edge cases, deal with it, it will make the application far more robust.
Daniel Jackson
Look at Fat-Free Framework. They have a vaguely similar idea to you. You may not like Laravel, but they do the things they do because years of making software has trended in the general direction of global state being a dangerous animal.
Just use design patterns to deal with the shenanigans. Don't make the Framework object a god object that knows/does everything. You could have a singleton Configuration object, a singleton Database object, and a singleton Framework object. Each of them have very clear responsibilities, and you would get the comfort of using object instance (->) syntax.
Ethan Hernandez
>You could have a singleton Configuration object, a singleton Database object, and a singleton Framework object.
The database object is part of the framework object however. The constructor of the framework object should take the configuration files so it knows how to set up the environment and the database information based on a config file. That is how I intend to build it. Seems logical to me.
I get what you say about global objects though.. I could let my framework not be a global object but rather passed between methods.. but like I said, then every single view object for instance or controller requires the framework object so they can make a call to the database or anything else the framework deals with. Having a global object is clean and practical, if dangerous. Maybe in the future I'll get rid of the framework object as a global.. but for now I can't see how that could backfire.
I will look at fat free, I'm doing something similar it seems, thank you
Jaxson King
I think I'm coding something simpler than fat free. It is also more pleasing on the eye, everything in my framework is an instantiated object - no requires and no USE anywhere, they make the code much harder to read and follow as you can import methods and use them without really knowing where they are coming from.
I also dislike that like laravel, they are making you set up routes manually. There is no need for that my routing system is automatic. I'll continue working on my framework, release it on /webg/ someday and get mocked by everyone here for being an awful coder, but I'll stick to what makes sense to me and has been working on the website I'm making
Kevin Miller
sharing a cool article on the Ruby GIL, but also applies to the Python GIL.
>personally I find "USE namespace" declarations at the top of php files an ugly So you're not going to follow established good design practices that people have developed over 20 years because you think they make your source code look "ugly"? Well I guess this discussion is over.
That's the way you're supposed to do it though. If a controller needs access to the database -> use Namespace/DatabaseClass and instantiate the class, then use the object to make your calls. It's not clean or practical to have a class object loaded as a global, it's just dangerous.
This is just a recipe for disaster. Global objects of database classes and automatic route generation. Surely you see how insecure this is. There is a reason Symfony & Laravel are designed like they are, it's called years of experience. You're breaking multiple important design principles. Read up on what Singleton classes are and chekc out PHPTheRightWay
Chase Robinson
What you describe as simplicity is just magic in disguise. I've worked in a codebase with hundreds of files, all of which just add shit to the global namespace or use some magic object that knows way too much. As soon as you progress beyond a trivially small application that any design would work with, you will be in for a world of hurt.
>no requires and no USE anywhere, they make the code much harder to read The "use"/"require_once" keywords do the exact opposite of what you describe. They literally say "here is the list of modules/features that I need for the following code". You really can't get much simpler than that. Namespaces let you organize your code into logical compartments.
You're probably going to be stubborn because you've convinced yourself that you've cracked the code on good system design, but you're actually just falling into one of the oldest traps in software design. The only reason that ANY of your code makes sense to you is because YOU wrote it. If you take a break from your codebase for like 2 months and come back to it, you're gonna ask yourself what the fuck you were thinking.
Sick of dealing with this at work, hence the fuckhuge tirade. /rant
Jordan Fisher
>Responsive Web Design
I take it you start designing from 1920x1080 and scale down right?
Lucas Mitchell
Mobile-first. You start small, then work your way up. If you start big, you inevitably make some feature/design that just can't be properly scaled down. Media query breakpoints should be used to apply styles specific to larger screens, not smaller screens.
thats a lot of of SVG/CSS animations user, how long did that take you?
Henry Rodriguez
Wouldn't you say that $object = new Object(); $object->method();
is a better practice than
use namespace; use namespace as myObject;
method(); //no idea what file is calling this method myObject->doSomething;// you now have an object accessible to your whole php script. What if you wanted an object just for one method?
I prefer to not use USE on my files. It is cleaner
I know what a singleton is (and that people even say we shouldnt use them anymore now btw) and I have read PHPTherightway
Maybe in the future I won't use a global framework object, right now I really don't see the point. Maybe experience will show me the way. It is a minor fix at any case if I go that way
Brody Hall
I only use one global however, no more. Having multiple global declarations is a mess I agree. Having just one seems to be convenient and not dangerous - especially when that one global file is a class file with private methods that protect itself from error and abuse
>The "use"/"require_once" keywords do the exact opposite of what you describe. They literally say "here is the list of modules/features that I need for the following code". You really can't get much simpler than that.
You can by declaring which objects you need for a class within its methods or constructor. It is even cleaner than USE as I mentioned on my previous post. At least seems that way to me.
> If you take a break from your codebase for like 2 months and come back to it, you're gonna ask yourself what the fuck you were thinking. on the contrary, it was extremely easy to understand and I was happy with what I done. On this new iteration of the framework I've made it even simpler. Depiste not having USE and instead using NEW within my class files, and having one global object, the code is very easy to read. Easier than reading laravel or code igniter in my opinion, by a huge factor, precisely because I use NEW object instead of USE object and everything is wrapped inside classes
Elijah Morgan
Been working on it on and off for a couple months.
Either you stay a react/node hiptser forever and complain in these threads why your SPA portfolio didn't land you a job or you learn Laravel/Spring and real programming concepts like algorithms, testing and design patterns and do memes on your spare time.
Carson Perry
Something is not right with this /wdg/ thread.
Eli Rodriguez
I haven't been around much lately, but this level of language wars is a bit unusual, isn't it?
Also, pic related is awesome
Thomas James
not that user, but if I have knowledge of JS/Node/SPA's already. Should one still start PHP from scratch or start using Laravel right away?
Benjamin Mitchell
It's almost the same except the syntax in PHP is backward for some stuff compared to JavaScript.
Read a quick tutorial about php's syntax and namespaces then you're good to go if you already know node/express
Joseph Powell
For those of you that have faffed with vichan, how would I go about disabling image uploads for non-moderators?
William Adams
this. port katawa shoujo
Robert Nelson
What the hell are those examples. The right way is: use MyNamespace\ClassName;
function someFunction() { $instance = new \MyNamespace\ClassName(); $instance->method(); // The instance of this class object exists only inside this function scope. It ceases to exist once the function ends. }
You autoload your libraries through Composer. You call the namespace at the top of your controller/model and then you instantiate a class object where you need it.
I struggle to understand why you won't use 'use'. Just open up any large scale modern PHP project and you'll understand why it exists.
Chase Martinez
I mean hypothetically that would be possible. But in general games are better off being written in JavaScript with Canvas/WebGL, with vectors as source graphics if you want that. Actually scripting animations is a better, more scalable approach than what I did (no JS at all, pure CSS).
Noah Lewis
>In this task you'll try to distinguish the meaning of words within sentences. To be more precise, you'll try to determine whether the sentence you're looking at talks about mice, the rodents with the elongated noses, or mice, the input devices used to control a computer. the fuck? what is this supposed to guage?
Aiden Moore
>use MyNamespace\ClassName; >$instance = new \MyNamespace\ClassName();
if you are saying new \namespace you don't need the USE on top. The autoloader takes care of it
>composer ew
Just do spl_autoload_register(); and you can automatically do instance = new \namespace without having to put USE at the top
Kayden Fisher
this is natural language processing. Read the instructions: > The mouse is connected to the computer > The mouse is eating cheese
your program should be able to analyze both sentences and say which one refers to mouse-animal and which one to mouse-computer part.
Ayden Phillips
It depends on the project itself. If it's an app geared towards mobile users then naturally you will start mobile first. However, for anything else you can decide whether you want to go mobile first or not, it's a personal choice.
Austin Sullivan
nice, gonna mess around with that
Isaiah Cooper
it seems you are confused by what i said. i know what the question wants, I'm questioning the point of it as a challenge. He said it was for a backend interview.
Daniel Williams
From the CGScope website:
>CGscope focuses on bank corporate governance intelligence. We collect and analyse critical governance data and information buried in thousands of pages of public disclosures using purpose-built data mining techniques. Our analysis is presented to clients in regular benchmarking reports. In addition, we provide our clients with governance intelligence updates and access to dedicated experts. >Our data collection techniques are based on innovative purpose-built software using data mining and artificial intelligence techniques.
I guess they take backend in a broad sense, meaning to include data mining and stuff like that.
Jordan Richardson
not the same user, but how do you solve the problem?
just check if there is "modern" in the sentence and if there is, it means it's a computer mouse otherwise it isn't?
Noah Jones
there's many solutions, none are perfect, but they each give you a different degree of success. For all of them you need to first compose a corpus of words, one for mouse-animal, another one for mouse-computer. The easiest solution (though a bit naive) is to just use the wikipedia article for each term as its corpus.
You could also add a third corpus of words to ignore (called stopper words: all prepositions) and maybe remove words found in both mouse corpora.
Then comes your main algo, which could be a naive bayesian classifier. The easiest solution though is code related, though not the best of course.
def analyze(self, text):
# Break up the input into single words tokens = word_tokenize(text)
# Initiate scores for both possibilities mouse_score = 0 comp_score = 0
for token in tokens: if token.lower in self.ignore: pass elif token.lower in self.mouse: mouse_score += 1 elif token.lower in self.comp: comp_score += 1
# If scores are equal there's no way to know which mouse it is, so just return computer if mouse_score > comp_score: return 'animal' return 'computer-mouse'
Camden Edwards
How do I structure a web application that's supposed to have real time features?
can anybody share their solution to the running median problem? Just curious...
Lincoln Harris
python 3. not sure if it is 100% correct
a = int(input()) lst = [] for i in range(a): lst.append(float(input())) lst_len = len(lst) if lst_len % 2 == 0: b = lst[int(lst_len/2)] c = lst[int(lst_len/2)-1] print (float((b+c)/2.0)) else: b = lst[int(lst_len/2.0)] print (float(b))
Kayden Smith
this is correct for an ordered input, but not for anything else. You gotta sort the array after every append, or use bisect to append items in order.
sheeit completely forgot that a = int(input()) lst = [] for i in range(a): lst.append(float(input())) lst.sort() lst_len = len(lst) if lst_len % 2 == 0: b = lst[int(lst_len/2)] c = lst[int(lst_len/2)-1] print (float((b+c)/2.0)) else: b = lst[int(lst_len/2.0)] print (float(b))
Brayden Hernandez
but seriously, sorting 10 items is no problem, but sorting an increasingly growing array for every iteration is insane. Look up bisect, it's p. cool
Jace Powell
Get a new slogan bitch. That shit gets parroted in every fucking thread. It's on 70% of websites in one way or another.
Git Gud
Owen Powell
how do i turn radio buttons into a 5 star rating thing. everything on google is ugly and half broken
I'm trying to get back into web development after just focusing on desktop stuff for several years. Can someone give me a quick rundown of what kind of tools/frameworks people are using nowadays? Like, I know about jQuery, but is like Bootstrap still a thing? Is that a popular / go-to type thing? What about other stuff like these Angular / React type things? Basically I just want to know what the major popular thing is that everyone uses, so I have a direction. Thanks.
Nathaniel Hill
Bootstrap is still used, but Angular and Vue.js are getting popular really fast.
PHP and Laravel are popular too. Avoid Codeigniter, since it's not supported anymore.
anyone use vscode for javaee developement? The java ide's are shitty as hell but let me debug inside of them.
Carson Kelly
Anyone using Jekyll or Hugo here?
Nathan Flores
Wait there are IDEs for web development? I've always used Notepad
Jack Nguyen
I've used Jekyll a little bit, largely for GitHub pages stuff. But Jekyll is growing to a huge mess imo.
Ethan Sullivan
What's messy about it?
Jose Evans
vscode is basically notepad on steroids and is modded out the ass to support debugging, code snippets, intellisense, error checking, and live page previewing as you write. I can't imagine wasting my time fucking with notepad.
Juan Smith
I know Jekyll's core is for blogs and whatnot, but I mainly use it to craft out static sites from scratch. The inclusion of themes is good for blogs, not so much for sites. It also adds a whole lot of new bloat in the installation with themes, and the dev team seems to be focusing more on the theme aspect. But yeah, that's my view.