Go Premium for a chance to win a PS4. Enter to Win

x

Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.

Share tech news, updates, or what's on your mind.

Sign up to Post

hi,
I was writing below example
https://www.youtube.com/watch?v=ShO_Z64sGwI&list=PLZM-6wiKGRfGmXzuR8uX3UsE8g91K6Vp1&index=5

package com.gp.mockito;

import org.junit.Before;
import org.junit.Test;
import junit.framework.Assert;
import static org.mockito.Mockito.*;

public class CalculatorServiceTest {

	CalculatorService calService;
	
	@Before
	public void setup(){
		ICalculator cal_mock = mock(ICalculator.class);
		when(cal_mock.add(2, 4)).thenReturn(6);
		calService=new CalculatorService();
		//calService.setCal(cal_mock);
		
		
	}
	@Test
	public void testAddNumbers(){
		Assert.assertEquals(6, calService.addTwoNumbers(2,4));
	}
}

Open in new window

package com.gp.mockito;

public class CalculatorService {
ICalculator cal;
public ICalculator getCal() {
	return cal;
}
public void setCal(ICalculator cal) {
	this.cal = cal;
}
public int addTwoNumbers(int x, int y){
	return cal.add(x, y);
}
}

Open in new window

package com.gp.mockito;

public interface ICalculator {
public int add(int x,int y);
}

Open in new window

why we need setter for calservice implementation class.

why are they setting interface mock object to the calservice object

observerd one example here
https://www.youtube.com/watch?v=DyuWgBHfxNQ

i do not see any setter here though?
1
[Webinar] Cloud Security
LVL 11
[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

By mistake i removed the jre default from eclipse java project instead of updating jre with jdk as beow

Here is the complete sequence in Eclipse Luna:
Right click your project > properties.
Select “Java Build Path” on left, then “JRE System Library”, click Edit…
Select "Workspace Default JRE"
Click "Installed JREs"
If you see JRE you want in the list select it (selecting a JDK is OK too)

how to add jdk 1.8
please advise
0
hi,

i am importing existing project into eclipse as non maven project. Everytime i import new project i see bunch of errors. when i go to error and say fix project set up and give jdk 1.8 then issues resolves. why i have to do this everytime to every new project. can i teach eclipse some how to rememebr so that i do not have to give this again and agian. please advise
errorJDK.png
errorJDK2.png
0
Hello,

I am looking to create a web-based application that, at a later date, may have a supporting windows program and mobile app (but not for phase 1).

I was considering the language to write the code in and which one would be best and was looking for your advice. These were the high-level requirements.

Will utilize a back-end database.
Will need to create PDFs based on templates and information held in the database (i.e. like an order receipt).
Will need to create PowerPoint, Word and Excel documents based on templates and information held in the database (i.e. create a copy of the order in PowerPoint format).
Allow the user to view information in tables that can be edited directly in the table with a double click or similar.
Ability for the system to generate and send emails
The ability for the system to generate an email in Outlook and save in the user's draft folder.

It would be great to get your thoughts on this given the high-level requirements.
0
Hi,

I ran below example on tomcat 9

https://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/


how to run tomcat 7 as well.

can i keep same ports for tomcat 7 and tomcat 9.

can i start both servers from eclipse same time?


how to keep port nubet more common ones?
please advise
tomcat_11.png
0
I have been reading about the Turing machine lately.  My question for you does the average laptop meet criteria for being a turing machine?  It works different, but I think it can do everything a turning machine can do.

Would you agree or disagree?

Thanks.
0
Hi All, I am creating a simple module using API.AI where API will ask set of 10 questions and retrieve answers.I In between of these question set i.e. after question 3, i want to handle in between user queries using other intent also but after handling those queries, I want to return back to the original question set i.e. question 4. Can we do this ? if not what is the suitable way of handling such scenario?
0
In API.AI, @system.given-name can recognize English names. I want to create a module for india. Do we have any method by which we can use such kind of concept for indian names?
0
What is counting semaphore?
0
I would like to know the approach one has to take to architect software product/solution. How to device a high level architecture for a product being built from scratch? Requirements: service oriented, scalable data integration (interoperability) solution.

Please share references that may help learn software architecture/design basics. I have very broad (not deep) technical background including software engineering with basic coding skills as well.

I am not trying to become an expert architect but want to know key factors, pitfalls etc  of 'modern' software architecture.
0
Free Tool: ZipGrep
LVL 11
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

How to count input numbers in a little man computer program
e.g 25 45 63
that means 3 numbers...the output should be 3
i need the coding
thanks
0
Hello

I am trying to generate java files from WSDL using Apache CXF plugin in my maven, but when I do maven generate sources I neither get any error in the console nor there are any files generated
pom.xml
0

Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.