Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
CamperBot
@camperbot
:cookie: 265 | @dbsimeonov |http://www.freecodecamp.org/dbsimeonov
mstellaluna
@mstellaluna
@khaduch I'm thinking it has to be done the same way as the change direction but with the color inputs cuz as you said it doesn't change the color when you change either of the 2 inputs... time to make a code backup and start tinkering with it
rk
@rajkumart08_twitter
@NJM8 hey but how come I am seeing undefined...since a[i] will return sokme value right...can you please explain
roxxlen
@roxxlen
still not working ...
rk
@rajkumart08_twitter

I am trying to create a simple directive
It should allow numbers only in the text box.
wrote code but not sure what logic should I put inside the code for directive.
right now I am getting an error
can you guys tell me how to fix it.
providing the code below.

https://stackblitz.com/edit/angular-cam5jd?file=app/fontcolor.directive.ts

import { Directive, ElementRef, Renderer } from '@angular/core';

@Directive({ selector: '[appFontcolor]' })

export class FontcolorDirective {
        constructor(elem: ElementRef, renderer: Renderer) {
           renderer.setElementStyle(elem.nativeElement, 'color', '#EEBA33');
        }

    validateNumeric(event) {
    const key = window.event ? event.keyCode : event.which;
    if (event.keyCode === 8 ||
        event.keyCode === 9 ||
        event.keyCode === 37) {} else if (key < 48 || key > 57) {
        return false;
    } else {
      return true;
    }
  }
}

Error in /turbo_modules/@angular/compiler@5.2.8/bundles/compiler.umd.js (528:34)
Template parse errors:
No provider for NgControl ("t" class="textfield" value="" id="extra7" name="extra7" onkeypress="return isNumber(event)" /> -->

[ERROR ->]<input type="text" class="form-control pl-3"
placeholder="Contact" formControlName="contact"
(keyp"): ng:///AppModule/AppComponent.html@16:0
Evaluating main.ts
Booting application

Tanmay Halde
@tanmayHalde

Greetings all,

Would like some feedback on the stock market app. https://th-chartstock.herokuapp.com/
Its not complete yet and there are some feature enhancements, cosmetic changes & code optimizations that can be worked on. But I guess I have tried to cover all the basic use cases.

Thanks,
th

Nate Mallison
@NJM8
@rajkumart08_twitter , just to clarify you are asking about this line right?
    console.log("alphabet--->" + alphabet);
        console.log("counts[alphabet]--->" + counts[alphabet]);
in the first run through the loop, yes it gets alphabet (arr[i]) as 'a', but you haven't inserted anything into the object yet, so counts === {}, so counts[a] === undefined
rk
@rajkumart08_twitter
@NJM8 hey I am confused...can you tell me how this hash map is working...please
@NJM8 can we have a call
Brad
@bradtaniguchi
@rajkumart08_twitter Your stackblitz is crashing cuse you didn't import the ReactiveFormsModule in your app.module. Your trying to use reactiveForm stuff with formControlName in your template which uses stuff from the said module.
There are other issues (such as no formGroup for your formControl) but that is why its not working right now. Also the error you got is pretty wack and unhelpful. Must be how stack blitz works, as locally youd get a much more nicer error
Liam Docherty
@liamdocherty
Hi guys, does anyone have any good python tutorial videos?
Tiago Correia
@tiagocorreiaalmeida
free or paid @liamdocherty ?=
Ehsan Shadmehri
@ehsansh
hi everyone. I am learning vue, express. I have a question. How should I deploy the project in this article?
https://medium.com/@anaida07/mevn-stack-application-part-1-3a27b61dcae0
for the production I should run: npm run build and it creates a folder for the client codes but how should I use the client and server codes?
Brad
@bradtaniguchi
@ehsansh Your server should be able to serve the folder made with build. So when you go to locahost:8080 or whatever port you run the server on (not your dev server with nodemon, but your "prod" version of express) the stuff from your build folder should appear
Liam Docherty
@liamdocherty
@tiagocorreiaalmeida Thanks for the reply, I found some all good.
CamperBot
@camperbot
liamdocherty sends brownie points to @tiagocorreiaalmeida :sparkles: :thumbsup: :sparkles:
:cookie: 514 | @tiagocorreiaalmeida |http://www.freecodecamp.org/tiagocorreiaalmeida
Tiago Correia
@tiagocorreiaalmeida
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Thanks but I am confused. In the article server receives some requests and it sends some data. It does not have any code for rendering the build folder. So should I make server.js file to serve the build older? But how?
CamperBot
@camperbot
ehsansh sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
:cookie: 457 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
Brad
@bradtaniguchi
@ehsansh I don't use express that much, nor did I look into the article, I would do some googling and I think there would be some documentation on serving a folder by default. (its a very very common use case)
rk
@rajkumart08_twitter

Hi,

  • I am trying to learn angular 2.
  • after including this line in the declaration PlayerContacts, I am getting below error.
  • can you tell me how to fix it.
  • providing my app.module.ts code below.
  • I have included PlayerContacts in app.component.ts, since the code is big I didnt paste that code.

VM39359:34 Unhandled Promise rejection: Failed to load app/component/Player/Player-contacts.html ; Zone: <root> ; Task: Promise.then ; Value: Failed to load app/component/Player/Player-contacts.html

Error: Uncaught (in promise): Failed to load app/component/Player/Player-contacts.html
at resolvePromise (zone.js:418)
at resolvePromise (zone.js:403)
at zone.js:451
at ZoneDelegate.invokeTask (zone.js:225)
at Zone.runTask (zone.js:125)
at drainMicroTaskQueue (zone.js:357)
at XMLHttpRequest.ZoneTask.invoke (zone.js:297)

Uncaught TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at console.window.console.error (<anonymous>:36:101)
at consoleError (zone.js:346)
at _loop_1 (zone.js:371)
at drainMicroTaskQueue (zone.js:375)
at XMLHttpRequest.ZoneTask.invoke (zone.js:297)


    import './rxjs-extensions';

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { NgIdleModule } from '@ng-idle/core';
import { AppComponent } from './app.component';
import { ErrorHandler } from '@angular/core';
//import { idleService }         from './app.idleService';

import { Base } from './components/base/base';
import { PlayerUser } from './components/Player/user';
import { Player } from './components/Player/Player';
import { Reports } from './components/reports/reports';
import { PlayerFunctionalRoles } from './components/Player/functional-roles';
import { PlayerDepartmentRoleMapping } from './components/Player/department-role-mapping';
import { PlayerAspects } from './components/Player/aspects';
import { PlayerFunctionalRolesMap } from './components/Player/functional-role-mapping';
import { PlayerTitleOwner } from './components/Player/titleOwner';
import { PlayerDeleteContract } from './components/Player/deleteContract';
import { PlayerDeleteTitle } from './components/Player/deleteTitle';
import { PlayerNonEpisodicShowName } from './components/Player/non-episodic-show-name'
 import { PlayerContacts } from './components/Player/Player-contacts'



import {
    Routes,
    RouterModule,
    Router,
    ActivatedRoute,

    CanActivateChild,
    CanDeactivate,
    ActivatedRouteSnapshot,
    RouterStateSnapshot
} from "@angular/router";

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        HttpModule,
        routing,
        MultiselectDropdownModule,
        AccordionModule,
        NgIdleModule.forRoot()
    ],
    declarations: [
        AppComponent,
        // idleService,
        Base,

        PlayerNonEpisodicShowName,
        PlayerContacts
    ],
    providers: [
        SPORTSService, { provide: ErrorHandler, useClass: ApplicationErrorHandler }],
    bootstrap: [AppComponent]
})
export class AppModule {
}
zootechdrum
@zootechdrum
hey guys what is up
quick question
how can I make sure that random number never lands on the same number twice
here is the specific code
var q1 = ["Crazy' is a term of art; 'Insane' is a term of law. Remember that, and you will save yourself a lot of trouble.","Some may never live, but the crazy never die.","In a closed society where everybody's guilty, the only crime is getting caught. In a world of thieves, the only final sin is stupidity.","I learned a long time ago that reality was much weirder than anyone's imagination."]


$(document).ready(function(){
  $("button").click(function(){
    $("#quote").text(q1[Math.floor(Math.random() * 4)]
   )}
 )}
)
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Thanks. I add these two line of codes to server/src/app.js file and now it servers from the build folder
const path = require('path')    // <-- added
app.use(express.static(path.join(__dirname, '../../client/dist')))
Brad
@bradtaniguchi
nice, just verify you can't access any of the backend folders (like where your server code is) and you should be good
@rajkumart08_twitter You have a stackblitz for this?
@rajkumart08_twitter From what I see what does the class delcaration for player-contacts.component.ts look like? (the component decorator and class name stuff)
cuse it looks like the name of the player-component has a caps, and angular is complaning the .html file isn't found.
Ehsan Shadmehri
@ehsansh
@bradtaniguchi But the only problem I have is that as this project has 4-5 pages. It works great when I click on the links because I have used vue-router but when I want to open the links directly it does not work. for example this link: http://localhost:8081/posts does not open.
I am not sure what I have done is the best practice.
Ken Haduch
@khaduch
@zootechdrum - since a random number is supposed to be "random" it could come to the same number twice, especially if you only have 4 possibilities, it looks like that is what you are limiting it to. But you could do something like keep a variable to "remember" the last number that came up, and make a loop that will keep generating random numbers until it gets something different. That would at least prevent repeated values. And obviously the larger your set of possible numbers, the less of a chance it will hit the same one often, but that's not guaranteed. You could remember a series of the latest numbers and check against them all, and use the same technique, then add additional numbers to your list, and remove the oldest value.
Brad
@bradtaniguchi
@ehsansh This is because when you go to the /post routes your asking express for this, which doesn't exist on express's side. So usually you redirect the user to the index.html, for that route. You might have to lookup how to handle this in vue. (There's also the "hash" routing strategy which is usually an option, but it makes less nice urls, as they start with a hash)
Ehsan Shadmehri
@ehsansh
@bradtaniguchi Yes. I think I have seen a solution in videos of this repo: https://github.com/blogscot/tab-tracker .I should search to find.
What is your idea about this way of coding for vue and express in one project?
Brad
@bradtaniguchi
idk, I don't use express or vue. (I use Angular tho, so its similar in terms of both being a SPA
Ehsan Shadmehri
@ehsansh
@bradtaniguchi thanks
CamperBot
@camperbot
:cookie: 458 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
ehsansh sends brownie points to @bradtaniguchi :sparkles: :thumbsup: :sparkles:
Brad
@bradtaniguchi
@ehsansh np, this is another common issue so I know the sources are out there. (I don't work on the backend so idk how we solve the same problem your having right now, its some sort of redirect tho)
Alvin
@AlvinW89
Second Attempt On first Project. Any Feedback: https://codepen.io/alvinw89/full/zWQgXm/
Better in desktop view
Devina
@Devina
@zootechdrum, if the random number set is low, one way is to push and keep the random number into an array. Then, when you run a statement for the random number, check if is present in array. If present then redo the random number generation, otherwise keep it and push into array.
include*engine
@newtothat
@AlvinW89 i loved your tribute page