|
thanks a lot for your answer and suggestion
|
|
|
|
|
can i implement a school management system that does lots of mathematical manipulations using java script??
|
|
|
|
|
Probably not. The fact that you are asking this question suggests that you do not have a lot of experience in Javascript. Otherwise you would realise that Javascript alone is not enough for such a project.
|
|
|
|
|
You could but would likely not want to.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Although it's been a while since your post, the following will help: W3Schools Online Web Tutorials[^]
First you need to learn HTML so you can make a web page
Next, CSS so you can make it look pleasant and put things where you need them
Finally, you can learn javaScript to bring some life to your page (math, etc.)
For some reason, it's a common belief that anyone can just sit down and write a program. Books like "PHP in 24 hours", for example. It just isn't so. It takes work, practice, learning.
You can be self-taught - a very large proportion of professional programmers are - but that often follows years of doing it for fun, often starting at a very early age. Self taught programmers usually have a particular passion for the craft and make some of the most amazing stuff.
I used the above site to learn HTML, CSS, javaScript and PHP (already knew SQL and already knew how to program). It's a major piece of the day-to-day operations of a $US 400 million company. It can be done - but it takes time.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
hy I have typescript app with angular4. I use routers to navigate on pages. I use activatedroute in the code:
ngOnInit(): void {
this.activatedRoute.params.subscribe((parms: any) => {
if (parms.lang) {
this.loading = true;
this.http._get(GLOBALS.url+"/api/GetPageHTML/Page2/"+parms.lang).subscribe(data => this.pageHTML = data[0]['puslHTML']);
} else {
this.loading = true;
this.http._get(GLOBALS.url+"/api/GetPageHTML/Page2/"+parms.lang).subscribe(data => this.pageHTML = data[0]['puslHTML']);
}
});
}
Is it possible to go to the same page again?
parms.lang is here for checking wheater is there request to change language.
|
|
|
|
|
I am not sure why is there even a condition, when both the blocks contain same code to be executed. Both set loading to true and have a same code to execute, then why check it?
Also, which page are you talking about? Some page in the history, otherwise you will require to pass in a parameter that holds the reference or URL to the page. Also, did you try using this.location.back(); , which used to work in Angular2 not sure if they changed it.
angular2 routing - How to go back last page in Angular 2 - Stack Overflow
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
hy,
there are two blocks with same code because this is a way I check whether visitor changed the language of website. I have two navs ir my website: one stands for menu and the other for languages. So in my langs bar I must have links with
routerLinks which have additional parameter "!":
<a [routerLink]="['/'+currPage,'!']" (click)="changeLang('en')">EN</a>
when the user clicks on selected language because the
ActivedRouter only works if I apply to same component with different parameters.
This is why my language bar`s links routerLinks contain additional parameters, while the main menu doesn`t.
But this is a offtopic problem, though it is absolutely related with topic.
I didn`t try any
this.location.back() because I try to find the solution which is more close to Rounting rather to history as I would like my user to be visiting the page using buttons and links. And I wonder where should I place
this.location.back() in the code because I would like to go to same page using same link?
|
|
|
|
|
So, I've spent most of my professional career working on system administration, databases, and desktop applications. Now I find myself being thrust into ASP.Net Web Api 2 to build REST interfaces so that an internet portal can access internal data via IIS.
I've got the server side down pretty good so my question is do I spend more time focusing on learning the ins and outs of JavaScript or TypeScript or both for the client side?
As a C# dev, the type safety and classes of TypeScript are appealing but it doesn't seem to support the breadth of ECMAScript capabilities like JavaScript does. I want to focus on what will work best but I don't want to bind my hands either. Since this is really my first serious foray into browser scripting, I wanted to get the opinion of the CPians that more experienced in such matters.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
TypeScript is the way to go. It would be more sensible coming from the C# dev background to have the structured code even in JavaScript world which is highly loose scripting language but with huge power.
|
|
|
|
|
Thanks. I thought that TypeScript would give me a little more piece of mind. Before getting started on that I'm reviewing this: ECMAScript Specifications[^]. I think that I need to build a strong foundation before attempting to build a house.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
I've never used TypeScript so I can't speak to that. I use jQuery a ton. It makes using JavaScript much easier.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
My viewpoint is that these super-sets (TS, CS, DART, etc) compile to JavaScript. If JS itself were so tedious or difficult to work in I would understand that, but largely it doesn't make sense to me to add a link in a chain that already uses a high-level language. It's great for someone who doesn't have the interest or capacity to learn how the underlying technology works, but doesn't really benefit someone that's willing to dig in.
That said, the ECMA approach to OOP is pretty damn counter-intuitive to the C# mindset and there is a bit of a curve. I like that personally, because the switching of gears makes defining client-vs-server concerns fairly obvious, but I may be alone in that regard.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
These are good points. The ECMA Standard and JavaScript is still the foundation of all the web scripting libraries so I see how working toward a professional level familiarity with it would be beneficial. It's similar to how Assembler is still the foundation of all of the programing languages. Does C# make programing a lot easier? Yes. Does is still end up as assembly instructions passed to the interpreter? Of course. C# and the rest of the high-level languages just make it easier to program, abstracting all the tedious bits. I may not be able to write a full program in x86 or x64 assembly (yet) but I know it works and that knowledge helps me write better code at the higher levels.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
Type script is a JavaScript inspired object oriented language that compiles to JavaScript.
At the end - in the browser - it is always JavaScript for now, so I would say: learn JavaScript inside-out...
After that, you may find it easier to use some intermediate - like TypeScript - to create the actual JavaScript code, but that's secondary...
If you are coming from the intermediate part only, you will find yourself helpless against a on-client-machine-only bug, that will force you to debug the JavaScript result (and generated code is always hard to read)...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
I am beginning to believe that I will be better off just biting the bullet and learning more JavaScript. Any good resources to learn some of the intermidiate to advanced topics? I've got the internet (ecma-international.org, w3.org, w3schools.com) that have gotten me a good start as well as a book on JavaScript and JQuery. What I am looking for is a resource that tells me all the things I can do with JavaScript and a few pointers to get me started. So far, I'm learning how to manipulate the DOM and using XMLHttpRequest to do a little async processing from an MVC/WebApi test site that I built. Obviously, there's a lot you can do with it but nothing I can find paints a good road map on what subjects to focus on and in what order.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
|
Thanks. This should help a bit. Before I start relying on libraries I want to know how they work.
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016
|
|
|
|
|
The question is how deep a rabbit hole you are planning to follow. If your intention is to learn enough to do a project and will not become full time web developer, then TypeScript is probably easier. If you want to switch from being SysAdmin into a developer then I would suggest biting the bullet and get to know JS. I personally know JS then learn TS, then gone back to stick with JS. TS to JS is like C/C++ to Assembler.
|
|
|
|
|
|
i search a lot for example which i can run and see that angular service and factory is singleton in nature because i heard many time that these are singleton in nature when i read many write up on difference between service and factory but none one show this that these are singleton with example and code.
i am new in angular. so very curious to know how could i write a program which tell me that service and factory is singleton. if possible please provide a example.
sample service and factory
var myApp = angular.module('myApp', []);
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!";
};
});
myApp.factory('helloWorldFromFactory', function() {
return {
sayHello: function() {
return "Hello, World!";
}
};
});
thanks
|
|
|
|
|
A singleton object, would expose a public function through which you will access the internal instance of that type. It will hide all sort of constructors etc. from the outside world (either through private constructor or other means).
Thus, to test if this is the case, you can see the internal implementation, and try to access the type multiple times. If they are same, then it is singleton. Singleton doesn't prohibit the object from being called multiple times, or being attached to multiple types or services. The only thing to note here, is that the object must have only one instance.
Are Angularjs services singleton? - Stack Overflow
Services
You can read more in the link above, it states that the services are singleton, meaning all the objects and components get access to the reference of the single object instance on the runtime.
To know the details of how that gets implemented, you might want to study the code, or try to store different variables, attach components and then see where they are attached. In a singleton they will target the same parent.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
thanks for your link. few days back i could simulate the same with a example which i like to share here.
i being able to create a small program which can tell me the factory is singleton. so here is the program code
<div ng-app="myApp">
<div ng-controller="FirstCtrl">
<br>Input is : {{data.firstName}}
<button ng-click="setData()">setData</button>
</div>
<hr>
<div ng-controller="SecondCtrl">
Input should also be here: {{data.firstName}}
<button ng-click="getData()">getData</button>
</div>
</div>
var myApp = angular.module('myApp', []);
myApp.factory('Data', function(){
var service = {
FirstName: '',
setFirstName: function(name) {
angular.copy(name, service.FirstName);
}
};
return service;
});
myApp.controller('FirstCtrl', function( $scope, Data ){
$scope.setData = function() {
Data.FirstName='Tridip';
};
});
myApp.controller('SecondCtrl', function( $scope, Data ){
$scope.FirstName = Data.FirstName;
$scope.getData = function() {
alert('get data '+Data.FirstName)
};
});
i being able to create a small program which can tell me the service is also singleton. so here is the program code
<div ng-app="myApp">
<div ng-controller="FirstCtrl">
<br>Input is : {{data.firstName}}
<button ng-click="setData()">setData</button>
</div>
<hr>
<div ng-controller="SecondCtrl">
Input should also be here: {{data.firstName}}
<button ng-click="getData()">getData</button>
</div>
</div>
var myApp = angular.module('myApp', []);
myApp.service('Data',function(){
var FirstName='';
this.setData=function(FirstName){
this.FirstName=FirstName;
};
this.getData=function(){
return FirstName;
};
});
myApp.controller('FirstCtrl', function( $scope, Data ){
$scope.setData = function() {
Data.setData('Mama');
};
});
myApp.controller('SecondCtrl', function( $scope, Data ){
$scope.getData = function() {
alert('get data '+Data.FirstName)
};
});
|
|
|
|
|
i am little bit familiar with angular. still on learning process. working with ng version 1.4.8. so i like to know how could i define constructor function in service and factory.
here is one sample service .now tell me how to define constructor in service or factory ?
angular.module('myApp').service('helloService',function($timeout){
this.sayHello=function(name){
$timeout(function(){
alert('Hello '+name);
},2000);
}
});
angular.module('myApp').controller('TestController',
function(helloService){
helloService.sayHello('AngularJS');
});
|
|
|
|
|
i am new in angular. so trying to know how to share data between two controller and search google. i visited few pages and found most of the time people use factory to share data. i just like to know can't we do it by service instead of factory ?
1st example
<div ng-controller="FirstCtrl">
<input type="text" ng-model="data.firstName">
<br>Input is : {{data.firstName}}
</div>
<hr>
<div ng-controller="SecondCtrl">
Input should also be here: {{data.firstName}}
</div>
myApp.factory('MyService', function(){
return {
data: {
firstName: '',
lastName: ''
},
update: function(first, last) {
this.data.firstName = first;
this.data.lastName = last;
}
};
});
myApp.controller('SecondCtrl', function($scope, MyService){
$scope.data = MyService.data;
$scope.updateData = function(first, last) {
MyService.update(first, last);
}
});
2nd example
var myApp = angular.module('myApp', []);
myApp.factory('Data', function(){
var service = {
FirstName: '',
setFirstName: function(name) {
angular.copy(name, service.FirstName);
}
};
return service;
});
myApp.controller('FirstCtrl', function( $scope, Data ){
});
myApp.controller('SecondCtrl', function( $scope, Data ){
$scope.FirstName = Data.FirstName;
});
examples are taken from this url https://stackoverflow.com/questions/21919962/share-data-between-angularjs-controllers
please guide me.
|
|
|
|
|