#Source folder is not a Java project error in eclipse
Explore tagged Tumblr posts
kranthicynixit · 5 years ago
Text
selenium online training | selenium online courses
Apache Ant with Selenium and flash testing overview
When producing a full software product, numerous third-party APIs, their class route, the cleaning of previous binary executable files, the compilation of our source code, the execution of source code, the development of reports and the deployment code base, etc. You need to take care of everything. It would take an immense amount of time if these tasks are performed one by one manually, and the process will be vulnerable to errors.   selenium online training
Apache ANT with Selenium
The meaning of a building tool like Ant comes here.
The benefit of creating an Ant
The application life cycle is generated by Ant, i.e. clean, compile, dependency set, run, report, etc.
The third-party API dependency can be set by Ant, i.e. the classpath of another Jar file is set by the Ant build file.
For End to End Delivery and deployment, a full application is developed.
It is a simple build tool where you can use the XML file to make all configurations and which can be executed from the command line.
As the configuration is separate from the actual application logic, it makes the code safe.
How to install Ant for installation
The following steps are taken to mount Ant in Windows
Step 1)
Download the .zip file from apache-ant-1.9.4-bin.zip to http:/ant.apache.org/bindownload.cgi
Step 2)
Unzip the folder and go to the root of the unzipped folder and copy the path.
Step 3)
Go to Start -> Machine -> right-click here and choose 'Properties' and then click Advanced Device Settings
Step 4)
This opens a new window. Click on the 'Factor Environment...' icon.
Step 5)
Click 'New...' and set the name of the variable as 'ANT HOME' and the value of the variable as the root path to the unzipped folder, and then click OK.
Step 6)
Now select the 'Path' variable from the list, and then click Edit' and add;%ANT HOME%\bin.
You can restart the machine once and now you are ready to use the Ant build tool.
Step 7)
Use the command line to verify your version of Ant:
Ant-Version Build.xml comprehension
The most critical component of the Ant compilation tool is Build.xml. For a Java project, all tasks related to cleaning, setup, compilation, and deployment are specified in this XML format file. If we use the command line or any IDE plugin to execute this XML file, all the instructions written in this file will be executed sequentially.
Inside a sample build.XML, let's understand the code.
The project tag is used to define a project name and an attribute-based on it. The foundation is an application's root directory.
●        Property tags are used in the build.xml file as variables to be used in further steps.
<property name="build.dir" value="${basedir}/build"/>
          <property name="external.jars" value=".\resources"/>
 <property name="ytoperation.dir" value="${external.jars}/YTOperation"/>
<property name="src.dir"value="${basedir}/src"/>
 ●        Goal tags are used as steps to be performed sequentially. The name attribute is the target's name. In a single build.xml, you can have different targets
●        The path tag is used to logically bundle all files that are in the commonplace
●        Path element tag sets the generic location root path where all files are stored.
●        The path convert tag is used to convert all common file paths within the path tag to the classpath format of the framework.
●        Used to set classpath for various third party jars in our project files tag
●        The echo tag is used on the console to print text.
●        The Delete tag cleans data from the designated folder
●        A new directory will be created with the mkdir tag
●        Used to compile java source code and transfer .class files to a new folder, javac tag
●        The jar tag creates a jar file from the .class files
●        The manifest tag will set your key execution class to
●        The attribute 'depends' used to make one goal depend on another destination
●        The java tag executes the main function from the jar created in the target compile portion.
Run Ant using the plugin Eclipse
Go to build.xml file to run Ant from eclipse -> right-click file -> Run as... -> click Build file -> right-click file -> Run as... -> click Build file
EXAMPLE:
We will take a small sample program that will very clearly demonstrate the features of Ant. Our project architecture is going to look like follows.
We have 4 goals here in this example.
Class route setting for external jars,
Clean code, previously complied with,
Compile current Java code for yourself
Run the code, run it
AntClass.class
TestAnt's package;
Java.util.Date import;
AntClass Public Class {
Static public void main(String...s){
System.out.println('HELLO PROGRAM  ANT');
System.out.println("DATE IS TODAY->"+ currentDate());;"
}
Public static String currentDate(){
Fresh Date().toString() returns;;
}
}
Construct.xml
How to execute code for TestNG using Ant
Here we will construct a class using the TestNG method and set the Testing classpath in build.xml.
Now we'll create another testng.xml file to run the test method and call this file from the build.xml file.
Step 1)
In the testing kit, we build the "AntClass.class"
TestAnt's package;
Java.util.Date import;
Org.testng.annotations.Test imports;
AntClass Public Class {
The @Test
AntTestNGMethod(){{ Public Void
System.out.println('HELLO PROGRAM ANT');
System.out.println("DATE IS TODAY->"+ currentDate());;"
}
Public static String currentDate(){
Fresh Date().toString() returns;;
}
}
Step 2)
Construct a target for this class to be loaded into Build.xml
Step 3)
Create testng.xml
Testng.xml for checking
rg/testng-1.0.dtd" ">
Step 4)
In Build.xml, create a Target to run this TestNG code.
Step 5)
Absolute Build.xml Complete
Selenium Ant with Web driver:
We have discovered so far that we can place all third-party jars in a specific place in the system using ANT and set their direction for our project. Using this approach, we set all of our project's dependencies in a single place and make it more stable for compilation, execution, and deployment.
Similarly, we can easily discuss selenium dependency in build.xml for our testing projects using selenium, and we don't have to manually add a classpath to our program.
So now you can disregard the conventional way to set classpaths for the project listed below.
EXAMPLE:
The previous example we are going to change is
Step 1)
In the resource folder, set the selenium. jars property to a selenium-related container.
Step 2)
Add the selenium files to the set classpath target
Step 3)
Build.xml Com
Step 4)
Update the previously generated AntClass.java class to a new code.
TestAnt's package;
The java. util.List import;
Org.openqa.selenium.By import
Org.openqa.selenium.WebDriver Import;
Org.openqa.selenium.WebElement Import;
Org.openqa.selenium.firefox.FirefoxDriver importation;
Org.testng.annotations.Test imports;
AntClass Public Class {
The @Test
AntTestNGMethod(){{ Public Void
Driver for WebDriver = new FirefoxDriver();
driver.get;
List listAllCourseLinks = driver.findElements(By.xpath("/div[@class='canvas-middle']/a"));););
For(WebElement WebElement: listAllCourseLinks){ WebElement WebElement: listAllCourseLinks
System.out.println(webElement.getAttribute("href"));
}
}
}
Step 5)
The production after successful execution looks like this.
Flash testing varies from other component components
Flash is a technology that is obsolete. Capturing a flash-object is challenging as it is distinct from HTML. Flash is also an embedded SWF file that is (Small Web Format). Accessing Flash artifacts on a mobile device is often challenging.
Flash creation is more complex than SEO (Search Engine Optimization) HTML page development because flash is not completely readable by the search engine. Advanced technologies such as HTML 5 are, however, applied to solve problems such as performance and security.
Check it with the flash application.
There are two methods of testing Flash Applications:
Manual
By running test cases manually, you can test the Flash object as it is quick and easy to test. You ensure that the flash works properly as planned after bug fixation and provide sign-off.
Automation:
Use any automation method such as Selenium, SoapUI, TestComplete, etc to write a script and execute the script.
Conclusion
The key difference between flash and other elements, as described above is that Flash is embedded in SWF files, while other elements are embedded in HTML files. This is why, compared to flash, HTML is simple to catch. You can learn more about Ant build and flash test in selenium through Selenium online training.
2 notes · View notes
topjavatutorial-blog · 8 years ago
Text
How to fix “Source folder is not a Java project” error in eclipse
How to fix “Source folder is not a Java project” error in eclipse
If you are creating a maven web project in eclipse and get a “Source folder is not a Java project” error, here is how to fix that : To fix this, right click on your project and select Properties -> Project Facet Click on “convert to faceted form” Select “Java” and click on “Apply and Close” and you should see the java source folder package structure in the project.  
View On WordPress
0 notes
kavindius · 6 years ago
Text
Programming Frameworks
Programming Paradigms
Programming paradigms classify programming languages based on their features and characteristics.
Ex: Functional programming, Object oriented programming
Some computer languages support multiple paradigms.
Ex: C++ support both functional OOP.
Non- structured programming
Earliest paradigm
A series of code
Becomes complex as the number of lines increases
Structured programming
Handle the issues of non structured programming by introducing the ways to structure the code using blocks.
               -  Control structures
               -  Functions/Procedures/Methods
               -  Classes/Blocks
Types of structured programming
               -  Block structured (functional) programming
               -  Object oriented programming
Event driven programming
Focus on the events launched outside the system.
               -  User events (Click, drag/drop)
               -  Schedulers/compilers
               -  Sensors, messages , hardware interrupts
Mostly related to the systems with GUIs.
Functional programming
Origins from Lambda Calculus.
Lambda Calculus : This is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution.
No side – effects = Referential transparency
 Execution of a function does not effect on the global state of the system.
Use a declarative approach
Declarative approach : is a programming paradigm that expresses the logic of computation without describing its control flow.
This helps to minimize the side – effects.
Procedural programming
This paradigm helps to structure the code using blocks (procedures, routines, sub-routines, functions, methods).
 A procedure can implement a single algorithm using the control structures.
 Has side – effects.
 Use imperative approach.
Imperative approach : is a programming paradigm that uses statements to change program’s state.
Software Runtime Architecture
Languages can be categorized to the way they are processed and executed.
The general software runtime architecture
The communication between the application and the OS
needs additional components.
Tumblr media
Compiled languages
Some executables can directly run on the OS.
Some uses virtual runtime machines.
Tumblr media
Scripting languages
Source code is not compiled, it is directly executed and at the execution time the code is interpreted by a runtime machine.
Tumblr media
Markup languages
No execution process for the markup languages.
The tools who have the knowledge to understand the markup languages can generate the output.
Development tools
Computer Aided Software Engineering (CASE) tools are used throughout the engineering life cycle of the software systems.
CASE software types
Individual tools – for specific task
Workbenches – multiple tools are combined focusing on a specific part of SDLC.
Environments – Combines many tools to support many activities throughout the SDLC.
Frameworks vs Plugins vs Libraries
Tumblr media
Frameworks are concrete
A framework is incomplete
Framework helps solving recurring problems
The difference between JDK and JRE
JRE
JRE is an acronym for Java Runtime Environment. It is also written as Java RTE. The Java Runtime Environment is a set of software tools which are used for developing Java applications. It is used to provide the runtime environment. It is the implementation of JVM (Java Virtual Machine). It physically exists. It contains a set of libraries + other files that JVM uses at runtime.
Tumblr media
JDK
JDK is an acronym for Java Development Kit. The Java Development Kit (JDK) is a software development environment which is used to develop Java applications and HYPERLINK applets. It physically exists. It contains JRE + development tools.
JDK is an implementation of any one of the below given Java Platforms released by Oracle Corporation:
Standard Edition Java Platform
Enterprise Edition Java Platform
Micro Edition Java Platform 
The JDK contains a private Java Virtual Machine (JVM) and a few other resources such as an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (Javadoc), etc. to complete the development of a Java Application.
Tumblr media
JVM
JVM (Java Virtual Machine) is an abstract machine. It is called a virtual machine because it doesn't physically exist. It is a specification that provides a runtime environment in which Java bytecode can be executed. It can also run those programs which are written in other languages and compiled to Java bytecode.
The JVM performs the following main tasks:
Loads code
Verifies code
Executes code
Provides runtime environment
JDK = JRE + Development tools
JRE = JVM  + Library classes
Why we have to edit the path after installing the JDK?
When you type any thing in Command prompt , except the standard keywords like ( cd , dir) , the command prompt searches them in the folder where you are and tries to execute it , also as the cmd ( Command Prompt ) is from C:\WINDOWS\SYSTEM32 , so all the programs from here are accessible form anywhere in windows , also this is necessary , here , this is a necessity for windows to keep them in hand , whenever needed , where ever needed .
The path points to the location of the jre i.e. the java binary files such as the jvm and necessary libraries. The classpath points to the classes you developed so that the jvm can find them and load them when you run your product.
So essentially you need the path to find java so it can then find your classes and run them from the classpath.
Why you should need to set JAVA_HOME?
When you run a Java program you need to first start the JVM, typically this is done by running an executable, on Windows this is java.exe. You can get that in lots of ways for example just giving a full path:
C:\somedir\bin\java.exe
or may having it on your PATH.
You specify as command line arguments some class files or Jar files containing class files which are your program. But that's not enough, the java.exe itself needs various other resources, not least all the Java libraries. By setting the environment variable JAVA_HOME you specify where the JRE, and hence all those runtime resources, are to be found. You should ensure that the particular Java you execute matches the setting of JAVA_HOME.
Difference between PATH and JAVA HOME
Tumblr media
Java IDE’s and comparisons
Eclipse
Eclips is  an open source platform. This is used in both open source and commercial projects. Starting in a humble manner, this has now emerged as a major platform, which is also used in several other languages.
The greatest advantage of Eclipse is that it features a whole plethora of plugins, which makes it versatile and highly customizable. This platform works for you in the background, compiling code, and showing up errors as they occur. The entire IDE is organized in Perspectives, which are essentially sort of visual containers, which offer a set of views and editors.
Eclipse’s multitasking, filtering and debugging are yet other pluses. Designed to fit the needs of large development projects, it can handle various tasks such as analysis and design, product management, implementation, content development, testing, and documentation as well.
NetBeans
NetBeans was independently developed and it emerged as an open source platform after it was acquired by Sun in 1999. This IDE can be used to develop software for all versions of Java ranging from Java ME up to the Enterprise Edition.
NetBeans offers you various different bundles – 2 C/C++ and PHP editions, a Java SE edition, the Java EE edition, and 1 kitchen sink edition that offers everything you will ever need for your project. This IDE also offers tools and editors which can be used for HTML, PHP, XML, JavaScript and more. You can now find support for HTML5 and other Web technologies as well.
NetBeans scores over Eclipse in that it features database support, with drivers for Java DB, MySQL, PostgreSQL, and Oracle. Its Database Explorer enables you to easily create, modify and delete tables and databases within the IDE.
IntelliJ Idea
IntelliJ offers support for a variety of languages, including Java, Scala, Groovy, Clojure and more. This IDE comes with features such as smart code completion, code analysis, and advanced refactoring. The commercial “Ultimate” version, which mainly targets the ​enterprise sector, additionally supports SQL, ActionScript, Ruby, Python, and PHP. Version 12 of this platform also comes with a new Android UI designer for Android app development.
IntelliJ too features several user-written plugins. It currently offers over 900 plugins, plus an additional 50+ in its enterprise version.
Conclusion
All of the above IDEs come with their own advantages. While Eclipse is still the widest used IDE, NetBeans is now gaining popularity with independent developers. While the enterprise edition of IntelliJ works like a marvel, some developers may consider it an unnecessary expense.
1 note · View note
nicelaxcz · 3 years ago
Text
Latest java development kit for mac
DOWNLOAD NOW Latest java development kit for mac
#Latest java development kit for mac how to#
#Latest java development kit for mac install#
#Latest java development kit for mac full#
#Latest java development kit for mac android#
#Latest java development kit for mac code#
vmargs : Extra VM arguments used to launch the Java Language Server. lombokSupport.enabled: Whether to enable lombok support. Absolute path to JDK home folder used to launch the Java Language Server. Java: Go to Super Implementation: goes to the super implementation for the current selected symbol in editor.
#Latest java development kit for mac code#
Java: Show Build Job Status: shows the Java Language Server job status in Visual Studio Code terminal.Java: List All Java Source Paths: lists all the Java source paths recognized by the Java Language Server workspace.This command is only available in the file explorer context menu and only works for unmanaged folders. Java: Remove Folder from Java Source Path: removes the selected folder from its project source path.Java: Add Folder to Java Source Path: adds the selected folder to its project source path.This command is only available in the editor context menu. Java: Attach Source: attaches a jar/zip source to the currently opened binary class file.Java: Clean Java Language Server Workspace: cleans the Java language server workspace.Creates a new settings file if none exists. Java: Open Java Formatter Settings: opens the Eclipse formatter settings.
#Latest java development kit for mac full#
Java: Rebuild Projects: manually triggers a full build of the selected projects.
Java: Force Java Compilation ( Shift+Alt+B): manually triggers compilation of the workspace.
Java: Open All Log Files: opens both the Java Language Server log file and the Java extension log file.
Java: Open Java Extension Log File: opens the Java extension log file, useful for troubleshooting problems.
Java: Open Java Language Server Log File: opens the Java Language Server log file, useful for troubleshooting problems.
Java: Import Java Projects into Workspace: detects and imports all the Java projects into the Java Language Server workspace.
dependency changes or Java compilation level), according to the project build descriptor.
Java: Reload Projects ( Shift+Alt+U): It forces project configuration / classpath updates (eg.
This command is only available when the Java Language Server is in LightWeight mode.
Switch to Standard Mode: switches the Java Language Server to Standard mode.
The default runtime will be used when you open standalone Java files. If you need to compile your projects against a different JDK version, it's recommended you configure the property in your user settings, eg: If not specified, it is searched in the following order until a JDK meets current minimum requirement. The path to the Java Development Kit can be specified by the. setting in VS Code settings (workspace/user settings). And by default, will also be used to compile your projects. The tooling JDK will be used to launch the Language Server for Java. The following part is only kept for the universal version without embedded JRE. Users are only responsible for configuring Project JDKs to compile your Java projects. The embedded JRE is used to launch the Language Server for Java. Now that Java extension will publish platform specific versions, it will embed a JRE for supported platforms such as win32-圆4, linux-圆4, linux-arm64, darwin-圆4, darwin-arm64. You might also find useful information in the project Wiki. See the changelog for the latest release.
#Latest java development kit for mac install#
To launch and debug your Java programs, it's recommended you install Java Debug Extension for Visual Studio Code. Annotation processing support (automatic for Maven projects).Code formatting (on-type/selection/file).when pasting code into a java file with Ctrl+Shift+v ( Cmd+Shift+v on Mac).As-you-type reporting of parsing and compilation errors.
#Latest java development kit for mac android#
Gradle project support (with experimental Android project import support).Recognizes projects with Maven or Gradle build files in the directory hierarchy.Extension is activated when you first access a Java file.Download and install a Java Development Kit for your project (Java 1.5 or above is supported).If you do not have a Java Development Kit correctly set.Make sure that the class name and file name are the same.Language support for Java ™ for Visual Studio CodeĮclipse ™ JDT Language Server, which utilizesĮclipse ™ JDT, M2Eclipse and Buildship. Now write the first Java program as shown below, save the program as HelloWorld.java and exit the editor. In this step, we will write, compile, and execute our first program in Java using the standard Hello World example.
#Latest java development kit for mac how to#
You can follow How To Switch Java Version On Mac. It might be required to switch the active Java in case multiple JDKs are installed on the same Mac machine. This is all about installing Oracle JDK 17 on Mac systems including macOS Sierra, High Sierra, Mojave, Catalina, and Big Sur.
DOWNLOAD NOW Latest java development kit for mac
0 notes
tvishatechblogs · 3 years ago
Text
How to import project in Android Studio?
Migration of your projects to Android Studio needs you to adapt to a new project structure, IDE functionality, and build system. Suppose you are migrating a project in Android Studio from Eclipse. In that case, Android Studio will offer you an import tool to move the existing code into the Android Studio project and Gradle-based build files. Before discussing further on how to import project in Android Studio? Let us understand what Android Studio is.
Tumblr media
What is Android Studio?
The official Integrated development environment(IDE) for Android app development is Android Studio. It is based on Java integrated development environment for Software called IntelliJ IDEA. It includes code editing and developer tools. It utilizes code templates, GitHub integration, emulator, and support app development within the Android operating system.
So let’s learn here how to import a project in Android Studio. There are 4 steps mentioned here to place the project in Android Studio.
Open your Android Studio and if any project is opened just close it (Go to File?Close Project) then you'll see a small window like this:
Step: 1
To import a project in Android Studio, you should open Android Studio Project: Click on "Open an existing Android Studio project" to open the Android Studio Project.
Select your Android Studio Project directory from the 'Open file to Project' dialogue and click on the OK button.
Wait until the project sync and builds project in Android Studio.
Step:2
Open Gradle or Eclipse ADT project: Click on “Import Project(Gradle, Eclipse ADT etc)” to open Eclipse build project for placing the project in Android studio without fail.
Here, browse your project in Android Studio by navigating the location where you kept your project, your project’s folder will appear with an Android logo on it like this:
Select the app and click OK, this will take some time for the Gradle to build, wait for the loading time. (You might get an error here stating the different SDK location, the error looks like this):
In case of the above error just go to Project Directory and you’ll then find the file named “local.properties” in the root folder of your project. Open this file and scroll to the last 2 lines “ndk” and “SDK” and change the location with the one of your SDK and save the file.
Again open the Android Studio Project or else if already opened in Android studio, go to Gradle->Rebuild.
Step: 3
To build and run your app: In the toolbar, select your app from the run configurations drop-down menu.
From the target device drop-down menu, select the device you want to run your app.
Note: If you don't have any devices configured, then you need to either connect a device via USB or create an AVD to use the Android Emulator
Click on the Run button in Toolbar or Select the Run menu in the menubar
Step:4
Edit project :
By default, while you import project in Android Studio, the Android Studio displays your project files in the Android view. This view does not reflect the actual file hierarchy on disk, but is organized by modules and file types to simplify navigation between key source files of your Android Studio Project, hiding certain files or directories that are not commonly used. Some of the structural changes compared to the structure on disk include the following:
Shows all the project's build-related configuration files in a top-level Gradle Script group.
Shows all manifest files for each module in a module-level group(when you have different manifest files for different product flavors and build types).
Shows all alternative resource files in a single group, instead of in separate folders per resource qualifier. For example, all density versions of your launcher icon are visible side-by-side.
Within each Android app module, files are shown in the following groups:
manifests: Contains the AndroidManifest.xml file.
java: Contains the Java source code files, separated by package names, including JUnit test code.
res: Contains all non-code resources, such as XML layouts, UI strings, and bitmap images, divided into corresponding sub-directories. For more information about all possible resource types, see Providing Resources.
Gradle Scripts: Two types of Gradle file are used in android projects One type is Project level Gradle which contains application repositories, dependencies, and project-level variables, Second type are modules level Gradle which contain app version name, version code, min version, application ID, dependencies for this module, debug and release build types, build flavors, etc
Conclusion
It is a simple process to migrate your project to Android Studio. So follow these steps, which show you how to import projects in Android Studio.
1 note · View note
simplyhunter245 · 4 years ago
Text
Java Mac El Capitan
Tumblr media
Java is no longer installed with a OS X 10.11 El Capitan clean install, and you’ll find that after updating a Mac a prior version of JRE may no longer function.
Java Jdk Mac Os X El Capitan
Java 6 Mac Os El Capitan
Java 6 For Mac El Capitan
Install Java Mac El Capitan
Download Java Se For Mac Osx El Captain Tsubasa; Download Java Se For Mac Osx El Captainan Download; How To Install Java (JRE) 8 on Mac OS X 10.11 El Capitan Nov 15, 2015 by iHash Leave a Comment Java is no longer installed with a OS X 10.11 El Capitan clean install, and you’ll find that after updating a Mac a prior version of JRE may no. Java for OS X 2015-001 installs the legacy Java 6 runtime for OS X 10.11 El Capitan, OS X 10.10 Yosemite, OS X 10.9 Mavericks, OS X 10.8 Mountain Lion, and OS X 10.7 Lion. The installer is damaged according to the dialogue box when the Package is double clicked.
You may come across when trying to use some particular applications or web content, “This application requires the legacy Java SE 6 runtime which is unavailable for this version of OS X.” error message, which means if you want to run that app you’re going to need to use an older version of Java.
If you do not need Java, you should not install Java. Java is, and always has been, the source of many security holes.
Tumblr media
Here’s how you can install JRE (Java Runtime Environment).
Step 1. Open Safari and go to the Oracle Java downloads page and download the JRE .tar.gz version. You should end up with a file named something similar to jre-8u65-macosx-x64.tar.gz.
Step 2. Go to your Downloads folder and extract the JRE download or use Terminal to extract files:
Step 3. Open Terminal
Step 4. Edit the Info.plist file within to enable the JRE to be used from the the command line, and from bundled applications:
Step 5. Move the JRE folder to the correct location:
Type password on prompt.
Be sure you are in the correct directory (the JRE folder) when you issue this command, because it will move your current directory to /Library/Java/JavaVirtualMachines/!
Step 6. Create a link to add backwards compatibility for some applications made for older Java versions:
You should be done now, so try and open the application. If it does not work, some applications require legacy Java 6 to be installed.
You can have it installed without actually using it, however, it’s possible to trick the applications into thinking legacy Java 6 is installed, without actually doing so.
Step 1.Disable SIP (System Integrity Protection) in OS X El Capitan. Here is tutorial to disable and enable SIP.
Tumblr media
Step 2. Trick some applications into thinking that legacy Java 6 is installed by creating two folders with the following commands in Terminal:
Step 3. Don’t forget to enable SIP again after creating these directories.
I recently upgraded my Mac Computer from version 10.10 Yosemite to 10.11 EL Capitan, trying to Open eclipse gave me the following error, To open 'Eclipse' you need to install the legacy java 6 runtime. Java for macOS 2017-001 installs the legacy Java 6 runtime for macOS 10.13 High Sierra, macOS 10.12 Sierra, macOS 10.11 El Capitan, macOS 10.10 Yosemite, macOS 10.9 Mavericks, macOS 10.8 Mountain Lion, and macOS 10.7 Lion.
Jul 20, 2015 How to install a compatible Java version in OS X El Capitan? Look at our simple tip below. There are 2 easiest and quickest ways to install right Java version on Mac. They work all on OS X – El Capitan, Yosemite and mavericks. 1 – Grab a El Capitan Compatible Java Version from Apple. Dec 31, 2019 In the Java ecosystem, as the new releases of JDK are introduced at least once a year, we'll probably need to switch to a newer version at some point. In this quick tutorial, we'll show how to check the available JREs, add a JRE to Eclipse, and change a Java version in an Eclipse project, so we'll be ready when that time comes. Running some applications on Mac version 10.12 Sierra, 10.10 Yosemite and 10.11 El Capitan, users are asked to install Java even after installing the latest version of Java.
Latest Version:
Eclipse SDK 4.16 (64-bit) LATEST
Requirements:
Windows XP64 / Vista64 / Windows 7 64 / Windows 8 64 / Windows 10 64
Author / Product:
The Eclipse Foundation / Eclipse SDK (64-bit)
Endpoint security checkpoint vpn for mac catalina download. Old Versions:
Filename:
Enable home sharing mac os catalina for tv shows. eclipse-SDK-4.16-win32-x86_64.zip
Details:
Eclipse SDK (64-bit) 2020 full offline installer setup for PC
Eclipse SDK 64-bit includes tools made to give developers the freedom of choice in a multi-language, multi-platform, and multi-vendor environment. Eclipse SDK provides a plug-in based framework that makes it easier to create, integrate, and utilize software tools, saving time and money. By collaborating and exploiting core integration technology, tool producers can leverage platform reuse and concentrate on core competencies to create new development technology. Download Eclipse Offline Installer Setup 64bit for PC. The Eclipse Platform
Java Jdk Mac Os X El Capitan
is written in the Java language and comes with extensive plug-in construction toolkits and examples. These projects can be conceptually organized into seven different 'pillars' or categories:
Tumblr media
Java 6 Mac Os El Capitan
Latest Version Of El Capitan
Eclipse Java Version For El Capitan 8
Java 6 For Mac El Capitan
Enterprise Development
Embedded and Device Development
Rich Client Platform
Rich Internet Applications
Application Frameworks
Application Lifecycle Management (ALM)
Service-Oriented Architecture (SOA)
Install Java Mac El Capitan
Subprojects Platform The Platform defines the set of frameworks and common services that collectively make up 'integration-ware' required to support the use of Eclipse as a component model, as a rich client platform (RCP) and as a comprehensive tool integration platform. These services and frameworks include a standard workbench user interface model and portable native widget toolkit, a project model for managing resources, automatic resource delta management for incremental compilers and builders, language-independent debug infrastructure, and infrastructure for distributed multi-user versioned resource management. JDT - Java development tools The JDT provides the tool plug-ins for the platform that implement a Java IDE for power-users, that supports the development of any Java application, including plug-ins. The JDT adds the notion of Java projects and a Java perspective to the platform, as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The JDT allows Eclipse to be a development environment for itself. The JDT plug-ins themselves can also be further extended by other tool builders. PDE - Plug-in development environment The PDE project provides a number of views and editors that make it easier to build plug-ins for Eclipse SDK. Using the PDE, you can create your plug-in manifest file (plugin.xml), specify your plug-in runtime and other required plug-ins, define extension points, including their specific markup, associate XML Schema files with the extension point markup so extensions can be validated, create extensions on other plug-in extension points, etc. The PDE makes integrating plug-ins easy and fun. e4 - The next generation of the platform The e4 project is an incubator for developing the next generation of the platform. The mission of the e4 project is to build a next-generation platform for pervasive, component-based applications, and tools. Note: Requires Java Runtime Environment. Also Available: Download Eclipse for Mac
Tumblr media
0 notes
hunterwire889 · 4 years ago
Text
Installing Tomcat In Eclipse
Tumblr media
Join the DZone community and get the full member experience.
Eclipse Tomcat Server
Setup Tomcat In Eclipse Mac
Eclipse Tomcat Tutorial
Join For Free
the article represents steps required to configure tomcat 8 with eclipse kepler.
Download camtasia 9 free. Camtasia is the best all-in-one screen recorder and video editor. Record your screen, add video effects, transitions and more. Software available on Windows and Mac. Try for free today! Camtasia 2020 makes it simple to record and create professional-looking videos on Windows and Mac.
Tumblr media
download tomcat 8 and place it within any local folder.
download eclipse java ee kepler
as of date, tomcat 8 is not supported in eclipse javeee kepler. however, you could add the tomcat 8 by doing following:
go to the wtp downloads page, select the latest version (currently 3.6), and download the zip. here’s the current link .
copy the all of the files in features and plugins directories of the downloaded wtp into the corresponding eclipse directories in your eclipse folder (overwriting the existing files).
start eclipse and click on “servers” tab in the workbench. go ahead and try adding a new server. you would find option for tomcat 8 available for selection as shown below.
after clicking finish, you would see a new server added with the name as “tomcat v8.0 server at localhost”. start the server.
check http://localhost:8080 (provided you installed tomcat 8 and set http port as 8080)
interestingly, you would not see the welcome page, but the 404 error page.
to get rid of that, double click on ”tomcat v8.0 server at localhost”. in the window that opens up, select “use tomcat installation” and, change deploy path from wtpwebapps to webapps. look at the figure below.
restart the server and access http://localhost:8080 . you are all set.
java,enterprise-integration,integration,tomcat 8,eclipse kepler,eclipse
Eclipse Tomcat Server
Tumblr media
Creating your first Tomcat-integrated Eclipse project Now that you've installed the WTP, it's time to start using Tomcat with Eclipse. Start clicking 'File-New' and selecting 'Dynamic Web Project' from the list of options. Eclipse will present you with this dialogue window.
5-Select the Apache Tomcat Server and remove it. This will remove the Tomcat server configuration. 6-Click on OK and exit the screen above now. 7-From the screen below, choose Apache Tomcat server and click on Next button: 8-Browse to Tomcat Installation Directory. 9-Click on Next and choose which project you would like to deploy.
Find the Servers view in Eclipse IDE. You can open it using menu Window/Show View/Servers. Right-click on Servers view and select New/Server. Select the server type as Tomcat version installed on your system and click Next. Set the Tomcat installation directory and click finish. Now you will find a “Apache Tomcat at localhost” in the Servers view.
Published at DZone with permission of Ajitesh Kumar, DZone MVB Add font awesome to drupal 8 theme. . See the original article here.
Opinions expressed by DZone contributors are their own.
Setup Tomcat In Eclipse Mac
Popular on DZone
Eclipse Tomcat Tutorial
Java, Tomcat, and Eclipse for Web Development - Part III Copyright © 2005 Yaodong Bi Install Tomcat Plugin for Eclipse on Windows XP 1. Download Tomcat plugin for Eclipse Click the following link to download the tomcat plugin for Eclipse. http://www.sysdeo.com/sysdeo/content/download/657/7658/file/tomcatPluginV32beta.zip Note: the above plugin is designed to work with Eclipse 3.2. If you have downloaded a different version of Eclipse you may want to check whether the one you download is compatible with the version of your Eclipse or not. Unzip the downloaded file and copy its contents to C:eclipseplugins,assuming that you installed Eclipse at C:eclipse. Now folder C:eclipsepluginscom.sysdeo.eclipse.tomcat_3.2.0.beta should exist. 2. Configure Tomcat plugin for Eclipse First close all Eclipse if there is any running. Start Eclipse. This would force Eclipse to freshly load all plugins from its plugins folder. Goto Window->Preference, then expand Tomcat in the left column of the windows. If Tomcat is not shown in the list, you may want to check whether a folder named 'com.sysdeo.eclipse.tomcat_3.0.0' exits in the plugins folder of the Eclipse. If not, carefully perform step 1 again. The folowing shows how to configure Tomcat at the top level, Tomcat, and Advanced, JVM Settings, Source Path, and Tomcat Manager App at the second level, as shown in the Preferences screen snapshot below. Tomcat: Double click Tomcat in the left column, the following dialog box shows. If you followed this tutorial from the beginning, fill the information as shown. Select Version 5.x for Tomcation version. Enter C:Program FilesApache Software FoundationTomcat 5.5 for Tomcat home. Choose Server.xml for Context. Do not modify the Configuration file location. It is chosen automatically when you selected Tomcat home. Advanced: Select Advanced under Tomcat in the left column, the following snapshot shows. You may set the Tomcat base to the same as tomcat home, which is default setting. If you are not familiar with Java Secuity, make sure Launch Tomcat using Security Manager deselected as shown below. Java Settings: Select Java Settings under Tomcat in the left column, the following snapshot shows. The JRE entry should match what you have on your system. Source Path: Select Source Path under Tomcat in the left column. Tomcat Manager App: Select Tomcat Manager App under Tomcat in the left column. Enter a user name and password then click Add user to tomcat-users.xml button to add the manager to Tomcat permanently. You will use this pair of user name and password for application deployment later. tomcat-users.xml is a Tomcat configuration file in XML stored in the conf directory in the Tomcat home. The file defines different roles such as admin, manager, etc and then specifies each user's name and password and roles the user may play. In this step, by adding the manager's user name and password to this file, one will be able to log in to Tomcat from a Web browser as a manager to remotely start, stop, restart, deploy any application under the Tomcat Web server. 4. Click OK. Now the Tomcat plugin configuration is completed.
Tumblr media
0 notes
renewadvance265 · 4 years ago
Text
Eclipse Mysql Driver Jar Download
Tumblr media
Odbc Mysql Driver Download
Download Mysql Driver For Java
Mysql Driver Download
Jdbc Driver For Mysql Download
Mysql Driver Jar File
Active4 years, 7 months ago
Create and Export MySQL JDBC driver. In the file system extract the MySQL driver JAR from the downloaded MySQL ZIP file to the downloads folder: In your Eclipse. MySQL Native Driver for PHP; Other Downloads. MySQL Connector/J is the official JDBC driver for MySQL. MySQL Connector/J 8.0 is compatible with all MySQL. I have downloaded the mysql-connector-java-5.1.24-bin.jar I. How to add the JDBC mysql driver to an Eclipse. After this you will find that the.jar driver. Download JDBC driver JAR files for MySQL, SQL Server, Oracle, PostgreSQL, SQLite, Derby, Microsoft Access. Maven dependency is also included. MySQL Native Driver for PHP; Other Downloads; Download Connector/J MySQL open source software is provided. MySQL Connector/J is the official JDBC driver for MySQL. I have the jar file: mysql-connector-java-5.1.14-bin.jar and I. How to add mysql driver jar file in eclipse. How to add the JDBC mysql driver to an Eclipse.
This question already has an answer here:
Download JDBC driver JAR files for MySQL, SQL Server, Oracle, PostgreSQL, SQLite, Derby, Microsoft Access. Maven dependency is also included.
How to install JDBC driver in Eclipse web project without facing java.lang.ClassNotFoundexception 13 answers
I have downloaded the mysql-connector-java-5.1.24-bin.jar
I have created a lib folder in my project and put the jar in there.
properties of project->build path->add JAR and selected the JAR above.
I still get java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost:3306/mysql
I am using mysql 5.5The code:
If I add Class.forName('com.mysql.jdbc.Driver'); before Connection connection = DriverManager.getConnection(mySqlUrl, userInfo); I get java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Itay Moav -Malimovka
Itay Moav -MalimovkaItay Moav -Malimovka
29.2k5656 gold badges168168 silver badges251251 bronze badges
marked as duplicate by BalusC javaOct 9 '15 at 7:58
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. https://renewadvance265.tumblr.com/post//vrmlpad-30-crack-free-download.
7 Answers
Try to insert this:
before getting the JDBC Connection.
niculareniculare
1: I have downloaded the mysql-connector-java-5.1.24-bin.jar
Okay.
2: I have created a lib folder in my project and put the jar in there.
17 rows  Download and Update ASUS P5KPL-AM/PS Server Motherboard Drivers for your Windows XP, Vista, 7, 8 and 10 32 bit and 64 bit. Here you can download ASUS P5KPL-AM/PS Server Motherboard Drivers free and easy, just update your drivers now. https://renewadvance265.tumblr.com/post/655987538947964929/asus-p5kpl-am-ps-audio-driver-download-for-windows-7. Download the latest drivers for your Asus P5KPL AM-SE to keep your Computer up-to-date. Driver Scape. Windows Driver Download. High Definition Audio Device: Driver. Download the latest drivers for your Asus P5KPL-AM(BP) to keep your Computer up-to-date. 17 rows  Download ASUS P5KPL-AM/PS Server Motherboard Drivers for.
Wrong. You need to drop JAR in /WEB-INF/lib folder. You don't need to create any additional folders.
3: properties of project->build path->add JAR and selected the JAR above.
Odbc Mysql Driver Download
Unnecessary. Undo it all to avoid possible conflicts.
4: I still get java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost:3306/mysql
This exception can have 2 causes:
JDBC driver is not in runtime classpath. This is to be solved by doing 2) the right way.
JDBC URL is not recognized by any of the loaded JDBC drivers. Indeed, the JDBC URL is wrong, there should as per the MySQL JDBC driver documentation be another colon between the scheme and the host.
BalusCBalusC
887k312312 gold badges32573257 silver badges32933293 bronze badges
You can paste the .jar file of the driver in the Java setup instead of adding it to each project that you create. Paste it in C:Program FilesJavajre7libext or wherever you have installed java.
After this you will find that the .jar driver is enlisted in the library folder of your created project(JRE system library) in the IDE. No need to add it repetitively.
Vaibhav JoshiVaibhav Joshi
copy mysql-connector-java-5.1.24-bin.jar
Paste it into Apache Software FoundationTomcat 6.0lib<--here-->
Restart Your Server from Eclipes.
Done
DipanjanDipanjan
you haven't loaded driver into memory. use this following in init()
Also, you missed a colon (:) in url, use this
AnkitAnkit
4,97644 gold badges3939 silver badges6565 bronze badges
if you are getting this exception again and again then download my-sql connector and paste in tomcat/WEB-INF/lib folder..note that some times WEB-INF folder does not contains lib folder, at that time manually create lib folder and paste mysql connector in that folder.definitely this will work.if still you got problem then check that your jdk must match your system. i.e if your system is 64 bit then jdk must be 64 bit
Download Mysql Driver For Java
amol a. suryawanshiamol a. suryawanshi
Try this tutorial it has the explanation and it will be helpfulhttp://www.ccs.neu.edu/home/kathleen/classes/cs3200/JDBCtutorial.pdf
Prem ChandranPrem Chandran
Not the answer you're looking for? Browse other questions tagged javamysqlservletsjdbcdriver or ask your own question.
Active3 years, 6 months ago
I have the jar file: mysql-connector-java-5.1.14-bin.jar and I want to add it to my project.I add the jar at this way: project-> properties -> (Java Build Path) Libraries and add it from external jars. But when I try to use it and write:
import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
Mysql Driver Download
I get error under 'com.mysql'.
What is my mistake?
user1994587
user1994587user1994587
1 Answer
If the JAR file for the JDBC driver appears in the 'Referenced Libraries' branch of the project, like this:
then you don't need an import statement for it. Just use DriverManager.getConnection() and Java should be able to find the JDBC driver itself.
Gord ThompsonGord Thompson
Tumblr media
82.8k1515 gold badges110110 silver badges246246 bronze badges
Jdbc Driver For Mysql Download
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Mysql Driver Jar File
Not the answer you're looking for? Browse other questions tagged javamysqleclipsejdbcjar or ask your own question.
Tumblr media
0 notes
siva3155 · 6 years ago
Text
300+ TOP ANDROID Interview Questions and Answers
ANDROID Interview Questions for freshers experienced :-
1. What is Android? Android is a stack of software for mobile devices which includes an Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java language byte code which later transforms into .dex format files. 2. Explain about the exceptions of Android? The following are the exceptions that are supported by Android InflateException : When an error conditions are occurred, this exception is thrown Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken. 3. What are the advantages of Android? The following are the advantages of Android: The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android. Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android. Components can be reused and replaced by the application framework. Optimized DVM for mobile devices SQLite enables to store the data in a structured manner. Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE. 4. Describe the APK format. The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file. 5. What is .apk extension? The extension for an Android package file, which typically contains all of the files related to a single Android application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file. 6. What is .dex extension? Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language. 7. Explain the Architecture of Android ? Top -> Applications (Contacts, Browser, Phone, etc) Below Applications -> Application Framework(Activity Manager, Window Manager, Content Providers, View System, Package manager, Telephony manager, Resource, Notification, Location managers) Below Application Framework -> System Libraries(Like Sqlite, webkit, SSL, OpenGL, Media Framework etc) & Android Runtime( Core Libraries and DVM). Atlast Last -> Linux Kernel (which composed of drivers like display, camera etc.) 8. What's the difference between a file, a class and an activity in android? File - It is a block of arbitrary information, or resource for storing information. It can be of any type. Class - Its a compiled form of .Java file . Android finally used this .class files to produce an executable apk Activity - An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view. 9. What are the different tools in Android? Explain them? The Android SDK and Virtual Device Manager: It is used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD hosts an emulator running a particular build of Android, letting you specify the supported SDK version, screen resolution, amount of SD card storage available, and available hardware capabilities (such as touchscreens and GPS). The Android Emulator: An implementation of the Android virtual machine designed to run within a virtual device on your development computer. Use the emulator to test and debug your Android applications. Dalvik Debug Monitoring Service (DDMS) : Use the DDMS perspective to monitor and control the Dalvik virtual machines on which you're debugging your applications. Android Asset Packaging Tool (AAPT) : Constructs the distributable Android package files (.apk). Android Debug Bridge,(adb) : Android Debug Bridge, is a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging. 10. What is an activity? A single screen in an application, with supporting Java code. An activity presents a visual user interface for one focused endeavor the user can undertake. For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions.
Tumblr media
ANDROID Interview Questions 11. What is a service? A service doesn’t have a visual user interface, but rather runs in the background for an indefinite period of time. For example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it.Each service extends the Service base class. 12. How to Remove Desktop icons and Widgets? Press and Hold the icon or widget. The phone will vibrate and on the bottom of the phone you will see anoption to remove. While still holding the icon or widget drag it to the remove button. Once remove turns red drop the item and it is gone 13. Describe a real time scenario where android can be used? Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you. 14. How to select more than one option from list in android xml file? Give an example. Specify android id, layout height and width as depicted in the following example. 15. What languages does Android support for application development? Android applications are written using the Java programming language. 16. Describe Android Application Architecture? Android Application Architecture has the following components: Services – like N Intent – To perform inter-communication network Operation between activities or services Resource Externalization – such as strings and graphics Notification signaling users – light, sound, icon, notification, dialog etc 17. What is the Android Open Source Project? We use the phrase “Android Open Source Project” or “AOSP” to refer to the people, the processes, and the source code that make up Android. 18. Why did we open the Android source code? Google started the Android project in response to our own experiences launching mobile apps. We wanted to make sure that there would always be an open platform available for carriers, OEMs, and developers to use to make their innovative ideas a reality. We also wanted to make sure that there was no central point of failure, so that no single industry player could restrict or control the innovations of any other. The single most important goal of the Android Open-Source Project (AOSP) is to make sure that the open-source Android software is implemented as widely and compatibly as possible, to everyone’s benefit. 19. What is the Guardian app for Android? The Guardian app for Android delivers all the best content from guardian.co.uk to your phone or tablet. Read the latest news, sport, comment and reviews, watch video, listen to brodcasts and browse stunning picture galleries while on the move. 20. What features does it have? Navigate by section, topic or contributor: Download your homepage and favourites for offline reading with the touch of a button, or schedule a daily download for a time that suits you Browse our award-winning audio and video content Save contributors, topics and sections to your favourites folder Add favourites to your homescreen with an expanded view or link Swipe through stunning full-screen picture galleries Share articles and galleries via the Android share function View content in portrait or landscape orientation 21. Will it work on my phone? The app will work on all phones and tablets running Android version 1.6 and above. 22. How much does it cost? The app is free and ad-supported. 23. How do I save the app to my SD card? From the device's Settings menu, go to Applications > Manage applications > The Guardian. Under the data header, choose "Move to SD card". 24. How do I add sections to my favourites? It is possible to add sections, topics and contributors to your favourites. You can add to favourites by tapping the star icon in the top right hand corner of the relevant screens, or on the right hand side of the headers in the all sections menu. 25. How do I remove sections from my favourites? From the favourites menu, tap the red icons to the left hand side of the items. Alternatively, tap the star icon in the top right hand corner of the relevant screen so that it returns to its white state. 26. What is Mono for Android? Mono for Android is a software development kit that allows developers to use the C# language to create mobile applications for Android-based devices.Mono for Android exposes two sets of APIs, the core .NET APIs that C# developers are familiar with as well as a C# binding to Android's native APIs exposed through the Mono.Android.* namespace.You can use Mono for Android to develop applications that are distributed through the Android Application Stores or to deploy software to your personal hardware or the Android simulator. 27. What is included in Mono for Android? Mono for Android consists of the core Mono runtime, the Mono for Android bindings to the native Android APIs, a Visual Studio 2010 plugin to develop Android applications and an SDK that contains the tools to build, debug and deploy your applicationsOur Visual Studio 2010 plugin allows developers to use Visual Studio 2010 to develop, debug and deploy their applications to an Android simulator, an Android device, or the Android Application Store. Our MonoDevelop IDE also ships an addin to support Mono for Android development. 28. What do I need to develop Mono for Android applications? Mono for Android on Windows provides a plugin for Visual Studio 2010 Professional or better. We also support Mono for Android development using MonoDevelop on Windows for users that do not own a copy of Visual Studio 2010 Professional or better.Mono for Android on Mac developers can use MonoDevelop.On all platforms, Mono for Android requires the Android SDK (which requires Java JDK). 29. Will my users need to install Mono? No, When you deploy your application to the app store the Mono mobile runtime is statically linked to your application. No additional dependancies are needed. From the users point of view, there is no difference between an application created in Java and an application created using Mono for Android, other than a slightly larger (~4.4MB) application size. 30. Where is the UI Designer? Mono for Android does not bundle a UI designer to create the UI XML files We do not provide an integrated UI designer in Mono for Android 1.0. No decisions past that have been made. We will be listening to user feedback to decide where to put resources for the future versions. 31. How is Mono for Android licensed? Mono for Android is a commercial/proprietary offering that is built on top of the open source Mono project and is licensed on a per-developer basis. 32. What is the API profile exposed by Mono for Android? Mono for Android uses the same API profile for the core libraries as MonoTouch.Specifically, MonoTouch and Mono for Android both support a Silverlight-based API, without Silverlight's UI libraries (e.g. no XML, no WindowsBase.dll, etc.), and free of the sandboxing limitations of Silverlight. 33. Are the Android releases available in a ROM? No, Android is not yet available in a ROM format.Currently Android is installed by using a clean SD Card, and booted from there.It is booted by running a special application called 'Haret.exe' residing on your SD Card which will terminate the Windows kernel and boot into Linux/Android.It can't easily be run from ROM because a) it's too experimental to risk putting in ROM and then killing a device and b) WinMo does some hardware initialization that isn't documented, but is needed before Android can run. 34. When will it be available in a ROM? No time soon. Folks are working on it, but you'll need a lot of patience before it (if ever) arrives 35. How do I turn off, or reboot Android? In earlier releases, you had to pull the battery or press the reset button, in newer releases, you can hold down the 'end call' button and see a menu. 36. Should we jump in to Android? What’s the guarantee that’s what I will see on a phone? Will service providers turn off things? Keep in mind it hasn’t shipped yet, this is the most interesting time. Once it is open source, it could be locked down… they could create a derivative work. We’re going to provide a piece of technology that tests the APIs. No time frame yet. The script will exercise the system. It’s a compatibility test suite, to make sure nothing got disabled or broken by accident, and also ensure that apps will work across OEMs. 37. What if my app uses location API, and service provider shuts that off, can they? They can do that… it’s not a perfect world. Rather than having us dictate what carriers and OEMs support, we let developers develop killer apps that will require it. We want to ensure all the application development that goes on for Android… we want to give OEMs an incentive to keep things open. It’s a positive, self fulfilling vision. 38.If I’m a game developer and I’m building piece of content and I want to sell it, how do I do that and realize revenue? Content distribution — we’ve thought of that. It’d be great if there were a place where people could go to safely download and pay for content. 39. We use SMS interception for system signalling. Is there a mechanism for an app to respond and stop the signaling chain? Is there security around that so that one vendor can’t hijack a message and respond to it? There’s a mechanism where an application can register to receive a message with a certain signature and prevent others from getting it. We have a system of permissions apps are able to declare, enforce, and require to perform certain operations. Things like dial the phone, get to contacts, etc.. But these aren’t things that are baked in the core of the system. An arbitrary app could declare custom permissions. As far as restricting another app, the model we’ve been going by… the phone is not controlled by the application vendor, it’s controlled by the user. Whether or not the permissions are granted is up to the user that owns the phone. If you created a protocol that intercepts an SMS and another party wrote an app that intercepts the same SMS and the user wants to use that, the user could be free to stick that in. 40. Can the user set a priority? Don’t know, post your question to the developer’s community board. 41. In a previous release, XMPP was turned into GTalk. Will a future version have XMPP? Goal is to have XMPP support after 1.0. 42. What’s so special about Android? Unlike the proprietary iPhone operating system (now known as "iOS,"), which is under the complete control of Apple — and the same goes for Research in Motion’s BlackBerry OS or Microsoft’s Windows Phone platform — Google released Android as an open-source OS under the auspices of the Open Handset Alliance, leaving phone manufacturers (relatively) free to tweak Android as they see fit for a given handset. That’s one thing that’s special about Android. Another thing is that it just happens to be a really good OS, the first one in the post-iPhone wireless era to really give Apple a run for its money. Android may not be as sleek or polished as iOS (that’s my humble opinion, at least), but it’s fast and powerful, with an intuitive user interface that’s packed with options and flexibility. It’s also being constantly improved courtesy of the big brains at Google, making the Android experience sleeker by the day. 43. Are Android phones called "Droids"? Not necessarily. "Droid" is a brand name used by Verizon Wireless for its Android-based phones — the Droid X, the Droid Eris, the Droid Incredible and so on. The HTC Evo 4G on Sprint is not a "Droid," per se, but it’s still an Android smartphone. 44. Why would I (potentially) choose an Android phone over an iPhone? Well, for a variety of reasons — although I should point out that I’m actually a fan of both operating systems. (Sorry to disappoint the smartphone flame warriors out there.) One reason to go the Google way is that Android phones boast tight integration with Google services like Gmail, Google Calendar, Google Contacts and Google Voice — perfect for anyone who uses Google for all their e-mails, contacts and events. Indeed, one of the coolest things about Android phones is that the first time you fire one up, you enter your Google user name and password, and voila: All your Google messages, contacts and other info start syncing into your new handset automatically, no desktop syncing needed. Android is also far more open when it comes to applications. Whereas Apple takes a "walled garden" approach to its App Store, Google won’t restrict you from installing apps that aren’t featured in its official Android Marketplace. iPhone users, on the other hand, must "jailbreak" their phones if they want to install apps that weren’t approved by Apple for inclusion in the App Store. Last but not least, because Android is open to all manufacturers, a wide variety of Android phones are available to choose from — big and small, souped-up and pared-down, some with slide-out keyboards (good luck convincing Steve Jobs to put a slide-out QWERTY on the iPhone) and some that are all-touchscreen, all the time. Indeed, in the past few months, a new Android phone has debuted practically every week, while we only get a single new iPhone each year. 45. What are the downsides of Android? Well, if you ask me, the Android OS isn’t quite as forgiving to wireless beginners as the iPhone is. Setting up your e-mail, contacts and calendar on Android is a breeze (if you’re all about Gmail, that is), but when it comes to, say, your music and videos, you’re on your own with Android, which lacks an official media syncing client for the desktop. With the iPhone, you do all your syncing on easy-to-use iTunes, which also lets you manage your e-mail accounts, contacts, apps and photos. Then again, you can only use iTunes for syncing the iPhone, while Android users have a variety of third-party options. That’s just one example, but in general, Android gives you more options and choices about how you manage your phone and your mobile content — great for experienced and advanced users, but potentially intimating for new mobiles. On the other hand, while beginners might appreciate the (usually) smooth, user-friendly experience that Apple has devised for the iPhone, advanced users may (and often do) get frustrated by Apple’s tight control over what they can and can't do on the iPhone. It’s a trade-off, plain and simple, and your choice of platform depends on what’s right for you. 46. What’s up with all these different versions of Android, like "Donut," "Cupcake" and "Froyo"? Just as Apple does with iOS, Google continually updates Android with cool new features, leading to one "point" upgrade after another. The most recent version of Android is 2.2, code-named "Froyo" (for frozen yogurt, yum), adds features such as native USB tethering (for sharing your Android phone’s data connection with a laptop via a USB cable), mobile hotspot functionality (which turns your phone into a portable Wi-Fi hotspot that works with nearby Wi-Fi devices) and — perhaps most important — support for Flash, meaning that Flash-powered videos and modules that (notoriously) don’t work on the iPhone will work on the Android Web browser. Before 2.2 Froyo, we had version 2.1, which added "live" animated wallpaper, new home screen icons and widgets (tiny apps for the home screen), speech-to-text functionality (for e-mail and text messages, for example), full-on multitouch (for pinch-to-zoom gestures), and an updated photo gallery that hooks into your Picasa Web albums. Android 1.6 "Donut" (someone at Google must have a sweet tooth) added various speed improvements, support for more screen resolutions, and faster camera and camcorder applications. The first major update to Android was 1.5 "Cupcake," which (among other goodies) finally added a native video recorder. 47. So if the current version of Android is 2.2, why are people still complaining about Android phones stuck with version 2.1, or even 1.6? Ah, well, here’s where we find one of the downsides of Google allowing so much diversity in terms of available Android handsets. Don’t get me wrong: Variety is a beautiful thing, especially when it comes to phones. But it also means that each new version of Android must be certified to work on a specific handset — a long and sometimes drawn-out process that can leave users of a particular Android smartphone waiting weeks or even months to get the latest and greatest features. Indeed, manufactures and carriers may decide that it’s not worth the effort to upgrade their older phones to the latest Android version, leaving users high and dry. On the other hand, only a handful of iPhones exist, which makes it far easier for Apple to roll out a new version of iOS to everyone, all at once — or at least it used to be easy. Because of the hardware demands of iOS 4, we’ve already seen the original iPhone from 2007 get left behind, while users of the second-generation iPhone 3G have complained bitterly that the new iOS has slowed their handsets to a crawl. So it goes. 48. How many apps are available for Android? About 70,000 or so, growing by the day — still just a fraction of the 225,000-plus apps in the Apple App Store, but the official Android Marketplace has quite the head of steam, not to mention plenty of goodwill from the developer community given that Google doesn’t give apps the star-chamber treatment. 49. So, how should I go about picking an Android phone? No question about it: The breadth and variety of Android phones now on the market can be downright bewildering. The easiest way to narrow your choices is pretty obvious: What features and form-factors are you looking for? Do you want a phone with a real QWERTY keypad, or would you prefer one with only an on-screen keypad? Looking for a big screen (like the 4.3-inchers on the Evo 4G or the Droid X) or something that’s an easier fit in your pocket (like, say, the Droid Incredible)? Will you primarily be sending e-mail and text messages (in which case a smaller screen with a QWERTY would work), or are you interested in watching movies and other videos (big display)? Finally, who’s your carrier — or who would you like to be your carrier? Note, it’s not rocket science. Once you’ve zeroed in on a phone, find out which version of Android it’s running on. Is it the latest and greatest? (For now, only the Motorola Droid 2 is shipping with Android 2.2, although a 2.2 update for the HTC Evo 4G has finally arrived.) If not, ask when — and whether — an update is on the way. 50. What are the hottest new Android phones out right now? Well, earlier this summer we got the HTC Evo 4G, which supports Sprint’s budding, next-generation WiMax data network and boasts a 4.3-inch display — the same size as the screen on the Motorola Droid X, another eye-popper of a phone, except it’s on Verizon instead of Sprint. Samsung is in the midst of releasing a series of what it calls its Galaxy S-class Android phones: They’re thin and light, they all have high-contrast 4-inch "Super AMOLED" screens, and they’re available (or will be soon) on all four of the big U.S. carriers. If you’re looking for an Android phone with a slide-out QWERTY, consider the new Motorola Droid 2 on Verizon or the upcoming Samsung Epic 4G for Sprint. 51. How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android? Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls. 52. Why cannot you run standard Java bytecode on Android? Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. We need to convert Java class files into Dalvik Executable files using an Android tool called "dx". In normal circumstances, developers will not be using this tool directly and build tools will care for the generation of DVM compatible files. 53. Can you deploy executable JARs on Android? Which packaging is supported by Android? No. Android platform does not support JAR deployments. Applications are packed into Android Package (.apk) using Android Asset Packaging Tool (aapt) and then deployed on to Android platform. Google provides Android Development Tools for Eclipse that can be used to generate Android Package. 54. Android application can only be programmed in Java? False. You can program Android apps in C/C++ using NDK . 55. What is an action? The Intent Sender desires something or doing some task 56. What are Dalvik Executable files? Dalvik Executable files have .dex extension and are zipped into a single .apk file on the device. 57. How does Android system track the applications? Android system assigns each application a unique ID that is called Linux user ID. This ID is used to track each application. 58. When does Android start and end an application process? Android starts an application process when application's component needs to be executed. It then closes the process when it's no longer needed (garbage collection). 59. How can two Android applications share same Linux user ID and share same VM? The applications must sign with the same certificate in order to share same Linux user ID and share same VM. 60. Can I use the GoToMeeting app for Android on my Android device? Yes. If you’re running Android 2.2 or higher, you can install the GoToMeeting app from the Android Market to join meetings and webinars as an attendee. We recommend using devices with a 1Ghz processor or higher for optimal performance. 61. How can I download the GoToMeeting app? You can download the GoToMeetng app from the Android Market by signing in to your Google account linked with your Android device and searching for the GoToMeeting app to install it. If you don’t see an Install button, you may not be running Android 2.2 or higher – the minimum system requirement needed to install the GoToMeeting app. You can also download the GoToMeeting app from the Amazon Appstore (only available in the U.S.), which lets you instantly download the GoToMeeting app to an Android device. If you have the GoToMeeting app pre-loaded onto your device, you’ll need to first upgrade to the latest version of GoToMeeting. To upgrade, select the GoToMeeting daisy icon and then select the Upgrade button to install the most recent version of the app. 62.If I have a Motorola Android-based device that doesn’t have the Android Market app, can I still download the GoToMeeting app? Yes. Attendees using Motorola Android-based devices in China can now download the GoToMeeting app from SHOP4APPS™ – Motorola’s preinstalled Android application storefront. The GoToMeeting app is not yet localized in Chinese, but it is available in English, German, French, Spanish and Italian. 63.What made you jump into Android all of a sudden? Why not iOS or other mobile platforms? Maxim Petrov: I've never intended to do any mobile startup, but I got an Android phone first (Nexus One), not iPhone, so I started to look into this platform first. The lack of Google's own music app was obvious. I think if it was iPhone, not Nexus One, I could go developing for iOS instead. Though, you know, there are a lot more really good apps that already exist for iOS (and existed a year ago), all niches are filled, Apple is pretty restrictive (I don't think PowerAMP iPhone version would have ever been accepted in the Appstore). You can jump into Android quickly - just download the SDK, install adb driver, and you can develop - for your phone, for your friends (first beta testers), it's much easier to start on Android, but I can only compare to what I've read about iOS development as I haven't developed anything for iPhone. 64. What were your initial impressions of Android development? Maxim Petrov: Android developing (and actually, any software developing) is not about knowing the language - languages are just tools, so adding a tool to a toolbox is usually not a problem (I moved to Android/Java/C dev right from Ruby - and these are completely different languages). Given experience with any other languages, you can move to Android pretty quickly, at least start prototyping something, though, you need to fight the initial quirks (like SDK installation, lack of good documentation, android SDK/Eclipse and framework bugs, and the Android core devs' "you can't do that, please don't do that").Android development infrastructure is very immature, while Android end user can never notice the immaturity of the platform (as actually, it's not so immature on end user side), the development side of things is really lacking in many areas. For example, documentation is lacking, often conflicts with real state of things and it's just not enough. Though, this is balanced by the fact that Android is open source - you can just go check the source, and the source is the best documentation, but you need to get used (I am) to this approach. For example, Honeycomb sources are not published yet, and this immediately raised questions, like how do they activate that menu button in bottom status bar. 65. Does Android support Adobe Flash in the browser? Flash support varies by device with Android 2.1. The Samsung Acclaim does not have Flash support upon launch, but the HTC Desire will support Flash Lite 4.0 running Android 2.1. Flash 10.1 support is coming to Android-powered phones with Android 2.2. 66.Does Android support push email or is it pull? Android 2.1 supports push e-mail for Exchange mail and Gmail. 67. Will these phones have world phone capabilities, with the ability to make calls, receive data in other countries? Or will they be able to use Google Voice to make calls? Our Android-powered phones have Wi-Fi which can be used abroad for data, including Google Voice for making international calls. International Roaming for voice is available in several countries. 68. Will the App run on my Android phone? Yes, our App is fully compatible with any Android phone running Android software v2.1 or later. 69. How do I install your App? You can install our App from the Android Market by following the below steps: Open the Android Market application in the Applications menu. Hit the search icon and type in E.ON To install it, hit the ‘Free’ button on the left hand side In the next screen, it will give you more details about the application including the different functionalities it will need to access. Just click on OK to finish installing the application. 70. How do I find and download updates to the E.ON Android application? Any updates to our App will appear on your notification menu at the top of your screen. Just tap on the E.ON App icon and you'll be taken into the Android Market and be presented with the E.ON App download page. 71. What do I do if I have problems downloading your App? If you receive a "Download unsuccessful" message when trying to download our App you can try the following steps: Restart your phone and then try downloading the app again. Make sure that you’re connected to your network – if you’re not you’ll need to contact your mobile service provider Wait up to 10 minutes and try to download our App again. If you get stuck at "Starting download" then: Make sure that you’re connected to your network – if you’re not you’ll need to contact your mobile service provider If your request to download our App doesn’t start at all then try the below: Check your connectivity as stated above Make sure that your phone has enough available space to install our App. If you need to, try uninstalling some apps that you don’t use anymore or moving them to your SD card. Request the download again using Android Market from your device. 72. What is Intent? A class (Intent) which describes what a caller desires to do. The caller will send this intent to Android's intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF document is an intent, and the Adobe Reader apps will be the perfect activity for that intent (class). 73. What is a Sticky Intent? Sticky Intent is also a type of Intent which allows a communication between a function and a service sendStickyBroadcast() performs a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery. 74. How the nine-patch Image different from a regular bitmap? Alternatively, what is the difference between nine-patch Image vs regular Bitmap Image? It is one of a resizable bitmap resource which is being used as backgrounds or other images on the device. The NinePatch class allows drawing a bitmap in nine sections. The four corners are unscaled; the middle of the image is scaled in both axes, the four edges are scaled into one axis. 75. What is a resource? user defined JSON, XML, bitmap, or other file, injected into the application build process, which can later be loaded from code. 76.How will you record a phone call in Android? or How to handle an Audio Stream for a call in Android? Permission.PROCESS_OUTGOING_CALLS: Will Allow an application to monitor, modify, or abort outgoing calls. So using that permission we can monitor the Phone calls. 77.Does Android support the Bluetooth serial port profile? Yes. 78. Can an application be started on powerup? Yes. 79. How to Translate in Android? The Google translator translates the data of one language into another language by using XMPP to transmit dat You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens. 80. Describe Briefly the Android Application Architecture? Android Application Architecture has the following components: Services like Network Operation Intent - To perform inter-communication between activities or servicesResource Externalization - such as strings and graphics Notification signaling users - light, sound, icon, notification, dialog etc. Content Providers - They share data between applications 81. What is needed to make a multiple choice list with a custom view for each row? Multiple choice list can be viewed by making the CheckBox android:id value be “@android:id /text1". That is the ID used by Android for the CheckedTextView in simple_list_item_multiple_choice. 82. What dialog boxes are supported in Android ? Android supports 4 dialog boxes: AlertDialog: An alert dialog box supports 0 to 3 buttons and a list of selectable elements, including check boxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box. ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons. DatePickerDialog: This dialog box is used for selecting a date by the user. TimePickerDialog: This dialog box is used for selecting time by the user. ANDROID Questions and Answers Pdf Download Read the full article
0 notes
felord · 6 years ago
Text
Project 2 - Minivan Door Solved
Overview In this assignment, you will write another complete class that is intended to reinforce your skills in writing instance variables, accessors, and mutator methods, while also increasing the use of if statements to provide conditional logic. You will also write tests to verify the proper operation of your code. Your task is to develop software that monitors and controls the operation of the power sliding door of a minivan. Requirements The state of the door system is governed by the following operational rules: The door can be locked or unlocked at any time, by using a lock/unlock button on the dashboard. When the door is closed, the door can only be successfully opened if: 1) the gear shift lever is in park; and 2) the door is unlocked. In such a state, any of the following mechanisms will successfully open the door: 1) an open button on the dashboard; 2) a handle on the outside of the door; or 3) a handle on the inside of the door. However, the inside handle mechanism will not open the door if a separate child-safety mechanism has been engaged, regardless of any other conditions.  The child-safety mechanism can only be engaged or disengaged while the door is open.  The door can be closed at any time, and the gear can be changed at any time. You will write a class that represents these features and manages the sliding door.  In addition to maintaining the current state of the sliding door system, your class will also generate an event log containing a history of all attempts to change the state of the system (whether successful or not).  To test your system, rather than writing an informal tester class as in the previous assignment, you will develop a comprehensive test suite using the JUnit framework, which will need to test the entirety of your implementation. System Description You will develop a class called MinivanDoor in the edu.vt.cs5044 package that models the behavior and state of the sliding door of the minivan. The methods of this class will be invoked by other systems, displays, and sensors within the minivan to indicate certain requests or activities. The methods of your implementation must behave according to the operational rules above.  Your class will provide the following public methods, plus any private instance variables and private methods as needed: Constructor: MinivanDoor()initializes the minivan door system to its default state: door is closed door is unlocked child-safety is disengaged gear shift lever is in park event log is empty Accessors: isOpen()request the state of the door isLocked()request the state of the door's lock isChildSafe()request the state of the child-safety feature getGear()request the state of the gear shift lever getLastLogEntry()request the most recent entry from the event log (returns null if the event log is empty) getLogEntryCount()request the number of entries in the event log getLogEntryAt(int index)request the specified log entry event (returns null if the index is invalid) Mutators*: setGear(Gear gear)indicate an activation of the gear shift lever setChildSafe(boolean engage)indicate an activation of the child-safety (on or off) pushLockButton()indicate an activation of the dashboard lock button pushUnlockButton()indicate an activation of the dashboard unlock button pushOpenButton()indicate an activation of the dashboard open button pullInsideHandle()indicate an activation of the inside handle pullOutsideHandle()indicate an activation of the outside handle closeDoor()indicate an activation of the door closure sensor (*Each mutator call must always result in exactly one LogEntry value appended to the event log, even if no state is actually mutated due to the operational rules.  The event log must be stored as an ArrayList field.) You will also develop a comprehensive JUnit test class called MinivanDoorTest to confirm proper operation of your MinivanDoorimplementation. Downloads javasource file with method placeholders javaJUnit test file with sample test methods javaenumeration type for gear shift values javaenumeration type for log entry values Getting Started With Eclipse Create a new Java Project for this assignment, and within the src folder of that project create a new Package named edu.vt.cs5044for your code.  Within this package you need to copy all of the provided files, except the MinivanDoorTest file. The MinivanDoor class already has an empty constructor, one private instance variable, and placeholders for the public methods listed above.  There is only enough code to satisfy the compiler at this point, so the methods certainly don't yet work as intended.  However, we have at least something that compiles, in order to demonstrate how JUnit works (see below). You'll also need to add Eclipse support for JUnit for this project, so right-click your project, select Build Path | Add Libraries, then highlight JUnit and click Next.  Select the version as "JUnit 4" (Note: this is NOT the default version) and click Finish to add the built-in JUnit library. Next, it will be very useful later in this project to have a separate source folder structure for you test file.  To create this, right-click your project and select New | Source Folder.  (If "Source Folder" is not an option, select "Other" instead and type "source" to search for it.)  Name the new source folder "test" and click Finish. In the project at this point, you should see both the "test" and the "src" folders, along with nodes for the JRE System Library and JUnit 4. Finally, right-click "test" folder, add a new Package named edu.vt.cs5044 there, and copy the provided MinivanDoorTest file into this package. Working With JUnit Background For the first time, you'll develop a formal test suite via JUnit, so you can much more readily self-check your code as you write it. You've probably already seen how self-checking with a tester class can allow you to find your own errors as early as possible during the development process.  Now we'll use JUnit to help automate this process completely, making it even easier to develop and run test code. JUnit is optimized for software test cases to be developed as individual methods. Each test method has the @Test annotation, a nice (often long) descriptive name beginning with "test" by convention, and a simple structure with three main steps: 1) Setup the initial conditions; 2) perform the action to be tested; and 3) confirm the resultant behavior. Provided Test File Open the MinivanDoorTest file provided above, and refer to it for the next few sections. It may look a bit odd at first, but this file contains three (working and complete) sample test methods.  One validates the constructor, one tests locking the door, and one tests attempting to open the locked door via the button. Notice that each test method requires the @Test annotation immediately above its signature.  That tells JUnit to treat this as a test method.  There's also another method with the the @Before annotation.  JUnit will call that method each time (and before) any of the @Test methods is executed.  So here, every test method will automatically have access to a default (newly-constructed) MinivanDoor object. Note also that JUnit test classes should not declare constructors, nor should they contain a main method. Initial Conditions In some cases, such as two of the provided examples, the @Before method is entirely sufficient, so no additional setup code is needed within the @Test methods. However, many @Test methods (as in the third provided sample) will need to manipulate that default object to prepare other initial conditions required for the test.  Often this setup is achieved by calling other test methods, but any setup code is acceptable. Action To Be Tested Performing the one action you want to test is typically pretty easy, since it's typically just a single method call. Just make sure it's very clear in every test method exactly what action is being tested.  Also, it's important to resist the temptation to test multiple actions within a single test method.  You should always create a new test any time you want to test an additional action. The first test method can act as the setup for the second action, if applicable. You'll naturally end up using lots of copy-and-paste when developing test cases, and that's perfectly acceptable. Assertions (Confirming Results) To confirm the action actually did what it was supposed to do, JUnit provides a family of  assert__() methods that let you state the expected results in code.  Keep in mind that an assertion is just a claim about something that you expect.  If an assertion is valid during execution, the code simply continues normally.  Reaching the end of the test method without any failed assertions means your code passed that test.  However, as soon as any assertion fails, that test method immediately stops executing, reporting exactly which assertion failed. There are actually dozens of assert__() methods available in the JUnit library, but the ones you will probably find most useful for this assignment are assertEquals(), assertTrue(), assertFalse(), and assertNull().  There are examples of each in the provided file.  In assertions such as assertEquals(), where two values are required, the expected value goes first, while the actual value goes second. Just Do It! Finally, to actually run your tests, right-click on your MinivanDoorTest class in the package explorer view and choose "Run As | JUnit Test" to execute all the tests. Eclipse will show the results in a JUnit pane, as a tree of tests (with tiny ✓ or x badges) along with a green or red bar.  A red bar means that at least one test method had an assertion that failed.  At this point we expect all our tests to fail, since we haven't implemented anything yet, so a red bar it is.  But now we have a goal, to make that bar green! Double-click one of the test methods that failed, and the editor will jump to and highlight the exact assertion that failed.  The "Failure Trace" at the bottom of the JUnit pane will also show more details about the expected values.  For example, double-click the constructor defaults test in the tree.  You'll see the getGear() assertion line highlighted in your test file, and this line in the failure trace below: java.lang.AssertionError: expected: but was: This is as expected, since we only have placeholder code for getGear() at this point.  Note that the placeholder code did actually happen to pass a few of the assertions, but that was purely coincidental! Planning Your Development Read through the description for each method, thinking about how you might implement and test the behavior, then plan an order in which you want to implement the methods. It's completely natural to adjust your plan as you go along, but at least just choose one to get started for now.  The constructor and most of the basic accessors should be relatively easy to test and implement first. Once you've selected a method to implement, don't implement it quite yet! First, try to write at least one test method before you start coding the implementation. The new tests will almost certainly fail when you first run them, but your code will begin to pass as you start to develop the method. This strategy goes by the names of "Test-First Coding" and "Test-Driven Development" (which are slightly different from each other, but not in a way that matters to us).  Sometimes you'll find you need to start coding a new method to get your current method to pass every test, but try to continue this process by writing at least one test case for that new method before starting its implementation. Additional Hints and Tips ArrayList As noted above, the event log is to be held as an ArrayList which is a collection we'll cover in detail very soon.  For now, just create a private field like this: private final List eventLog; Then, in the constructor, you must initialize this field to a new empty ArrayList that will hold the LogEntry objects: eventLog = new ArrayList(); To populate the list, we use the add() method, for example: eventLog.add(LogEntry.DOOR_LOCKED); There are many ways to query the list, but we'll only require the following three: boolean empty = eventLog.isEmpty(); int logSize = eventLog.size(); LogEntry value = eventLog.get(i); In the get() method above, note that i is an index location within the list, where the first entry is at index location zero. Enumeration Types You have been provided source code for two pre-defined enumeration types (specifically LogEntry and Gear) to be used within several of the required methods.  Please use this code exactly as provided, without modification.  See Horstmann 5.4 for a little more background on the usage of enumeration types.  The basic idea is that we've defined a set of distinct constant values, in a way that leverages Java's natural type-safety system.  This ensures that our code can only ever use valid values, as enforced by the compiler. Code Path Test Coverage Your test file will need to achieve 100% coverage of you MinivanDoor implementation for full credit in Web-CAT.  As you test your code, you may find that Web-CAT indicates you have certain conditions that are not being completely tested by your own tests. You'll need to include tests for each unique way an overall condition can be true or false.  This may require you to test the same action you've already tested, but starting from a different set of initial conditions, to exercise every possible branch. Note that you do NOT need to achieve 100% coverage on the enumerated type files (Gear and LogEntry).  Even if you exercise every value, you'll still notice a single missed line of coverage, due to the way enum classes are handled internally.  However, if you'd like to cover those last lines, you can add the following test method to your test file as a workaround: @Test public void testDummyCaseForEnumCoverage() { assertNotNull(Gear.valueOf(Gear.PARK.name())); assertNotNull(LogEntry.valueOf(LogEntry.NO_ACTION_TAKEN.name())); } This test method serves only to complete the coverage the enum files. Test Coverage of Short-Circuits Due to short-circuit of logical operations, if you have N boolean expressions joined by AND or OR, you will only need N+1 test cases for full coverage.  For example, testing a conditional with 2 components such as (isThis && !isThat) requires 3 distinct test cases: Overall false: when isThisis false, regardless of the !isThat value when isThisis true, and !isThat is false Overall true: when isThisis true, and !isThat is true. Web-CAT will highlight any such conditions you haven't fully tested, but it can't tell you exactly which of these possibilities you have left untested. Impossible Test Coverage Redundancies in your conditionals can make it impossible to cover all branches with test cases, even if the code works exactly as intended.  A very simple example is the following: if (isReady) { ... } else if (!isDone && !isReady) { ... } All branches of the second conditional above cannot be tested, because !isReady at that point can never be false.  To resolve this, you must remove any redundant components from the conditionals.   Read the full article
0 notes
fazeupmag-blog · 6 years ago
Text
New Post has been published on Fazeup
New Post has been published on https://www.fazeup.tk/2019/06/introducing-gradle-for-brand-spanking-new-android-builders-the-grasp-builder/
Introducing Gradle for brand spanking new Android builders – The grasp builder
I distinctly bear in mind what it felt like the primary time I  began Android growth and opened up Android Studio (properly, Eclipse again then). I sat, stupefied, wanting on the huge array of various home windows, dialogues, and recordsdata. There’s a lot to study right here, that even realizing which window you’re meant to be taking a look at will be exhausting.
There’s loads of introduction that will help you muddle by means of Android Studio on this web site. However one of many greatest items of the puzzle is Gradle. Simply what are these Gradle recordsdata? And why do you all the time have to attend for it to complete syncing earlier than you are able to do something?
This publish will function an introduction to Gradle for full learners, to assist demystify this really reasonably great tool and assist provide you with a place to begin for when issues go incorrect.
An introduction to Gradle for Android
Gradle is what we name a construct software or construct system. Extra particularly, it’s a JVM-based construct system.
Regardless of not being very newcomer-friendly, Gradle has managed to realize recognition owing to its open-source nature, in addition to its versatility, and use of plugins.
As we’ve already mentioned, there are quite a lot of recordsdata concerned in an Android app. Your assets must be compressed, your supply code must be transformed to DEX recordsdata (Dalvik Executable), the APK must be signed. It’s rather a lot.
And all of that must be organized properly in the event you’re going to create a working APK. The photographs that may go into your app, the format recordsdata, the Java. Then there are the libraries you utilize to increase your code’s capabilities. You additionally want to consider model management, about the important thing signature. I might go on.
From Google
Is it attainable to construct an APK with out utilizing Gradle? Sure: you are able to do this utilizing the command line (ADB Bridge), however you would want to grasp what every software within the Android SDK does and the way it contributes to turning your code into an installable file. And, as Google is continually altering issues and including new options, this might additionally doubtless be an ongoing studying course of. There are additionally various choices on the market, corresponding to Apache Ant, however Gradle is the one which Google selected to assist.
Gradle will use the suitable instruments to compile your varied supply recordsdata, and to compress the whole lot into one properly packaged APK. And all you needed to do was to hit “build,” and be sure that all of your recordsdata had been saved within the appropriate folders.
Gradle additionally does quite a lot of different helpful stuff behind the scenes – serving to to scale back the dimensions of the APK for instance, and letting us construct debug apps for testing (it is a “build type”).
Positive, Gradle can usually appear to be the supply of a thousand issues when it doesn’t work correctly (when digging out an outdated piece of code from an older model of Android Studio as an example). However the truth is, its presence makes life far easier than it in any other case can be. In fact, Gradle isn’t the issue – it’s simply the messenger.
What you might want to find out about Gradle
Gradle works by finishing up totally different scripts, which include duties. These duties inform Gradle construct your utility – shifting recordsdata situated in particular folders, or compiling scripts particularly methods. You’ll discover these scripts in your Gradle recordsdata, corresponding to the 2 construct.gradle recordsdata.
That’s proper, there are (at the least) two totally different construct recordsdata – one for the whole mission, and one other for every module. The module typically refers to a single app construct, and is the place you’ll spend most of your time.
Right here, it is possible for you to to see quite a lot of the data that helps Gradle to do its job. That features the goal SDK, the package deal identify, the model quantity, and extra.
However maybe the most typical purpose for a developer to dive into their construct.gradle recordsdata themselves, is to deal with dependencies – e.g. libraries.
Any time you need to add a brand new native or distant library to your mission, you’ll add the dependencies to the “dependency block” discovered on the backside of the module-level construct.gradle file. Alternatively, you are able to do this by means of the menu system – which can replace the related recordsdata for you.
Different Gradle recordsdata embrace:
settings.gradle – Which defines the modules in a mission.
native.properties – Which factors to your Android SDK.
gradle.properties – Which might include a spread of configuration properties however begins out empty.
gradle-wrapper.properties – Which defines and installs the proper model of Gradle wanted for the mission.
Extra makes use of for Gradle
You can too obtain different issues by tinkering together with your Gradle recordsdata. For instance, Gradle provides assist for a number of APKs, making it easy to create totally different variations of your app focusing on totally different gadgets – these variations are referred to as “flavors.”
Gradle will come into play if you wish to create an instantaneous app in the meantime, as you’ll must create a characteristic module after which edit the construct.gradle file to replicate that. That instantaneous app Gradle file will even want a dependency pointing to the “:base” characteristic module. Directions will be discovered right here.
The excellent news is that directions are available for something you may need to do. For those who ought to run into an issue, or in the event you ought to need to do one thing that entails various kinds of app “builds,” Google is your buddy.
Typically an error will crop up if Gradle will get confused or can’t discover a file, however that is more and more uncommon. Hitting “clean project” will usually resolve the issue.
If not, it could be that one of many recordsdata is utilizing a deprecated configuration or different out-dated line. Android Studio will usually clue you in on resolve the problem, as will one other fast Google search.
Usually although, most of what you do in Gradle will be finished by means of Android Studio’s personal UI – that means you not often want enterprise down there. That is very true in the event you’re creating an app with just one module.
Which means a very powerful job for a brand new developer, is just holding Gradle and Android Studio updated.
Let Gradle deal with the remaining!
Supply
0 notes
siva3155 · 6 years ago
Text
300+ TOP ANDROID Interview Questions and Answers
ANDROID Interview Questions for freshers experienced :-
1. What is Android? Android is a stack of software for mobile devices which includes an Operating System, middleware and some key applications. The application executes within its own process and its own instance of Dalvik Virtual Machine. Many Virtual Machines run efficiently by a DVM device. DVM executes Java language byte code which later transforms into .dex format files. 2. Explain about the exceptions of Android? The following are the exceptions that are supported by Android InflateException : When an error conditions are occurred, this exception is thrown Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken. 3. What are the advantages of Android? The following are the advantages of Android: The customer will be benefited from wide range of mobile applications to choose, since the monopoly of wireless carriers like AT&T and Orange will be broken by Google Android. Features like weather details, live RSS feeds, opening screen, icon on the opening screen can be customized Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android. Components can be reused and replaced by the application framework. Optimized DVM for mobile devices SQLite enables to store the data in a structured manner. Supports GSM telephone and Bluetooth, WiFi, 3G and EDGE technologies The development is a combination of a device emulator, debugging tools, memory profiling and plug-in for Eclipse IDE. 4. Describe the APK format. The APK file is compressed the AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file. 5. What is .apk extension? The extension for an Android package file, which typically contains all of the files related to a single Android application. The file itself is a compressed collection of an AndroidManifest.xml file, application code (.dex files), resource files, and other files. A project is compiled into a single .apk file. 6. What is .dex extension? Android programs are compiled into .dex (Dalvik Executable) files, which are in turn zipped into a single .apk file on the device. .dex files can be created by automatically translating compiled applications written in the Java programming language. 7. Explain the Architecture of Android ? Top -> Applications (Contacts, Browser, Phone, etc) Below Applications -> Application Framework(Activity Manager, Window Manager, Content Providers, View System, Package manager, Telephony manager, Resource, Notification, Location managers) Below Application Framework -> System Libraries(Like Sqlite, webkit, SSL, OpenGL, Media Framework etc) & Android Runtime( Core Libraries and DVM). Atlast Last -> Linux Kernel (which composed of drivers like display, camera etc.) 8. What's the difference between a file, a class and an activity in android? File - It is a block of arbitrary information, or resource for storing information. It can be of any type. Class - Its a compiled form of .Java file . Android finally used this .class files to produce an executable apk Activity - An activity is the equivalent of a Frame/Window in GUI toolkits. It is not a file or a file type it is just a class that can be extended in Android for loading UI elements on view. 9. What are the different tools in Android? Explain them? The Android SDK and Virtual Device Manager: It is used to create and manage Android Virtual Devices (AVD) and SDK packages. The AVD hosts an emulator running a particular build of Android, letting you specify the supported SDK version, screen resolution, amount of SD card storage available, and available hardware capabilities (such as touchscreens and GPS). The Android Emulator: An implementation of the Android virtual machine designed to run within a virtual device on your development computer. Use the emulator to test and debug your Android applications. Dalvik Debug Monitoring Service (DDMS) : Use the DDMS perspective to monitor and control the Dalvik virtual machines on which you're debugging your applications. Android Asset Packaging Tool (AAPT) : Constructs the distributable Android package files (.apk). Android Debug Bridge,(adb) : Android Debug Bridge, is a command-line debugging application shipped with the SDK. It provides tools to browse the device, copy tools on the device, and forward ports for debugging. 10. What is an activity? A single screen in an application, with supporting Java code. An activity presents a visual user interface for one focused endeavor the user can undertake. For example, an activity might present a list of menu items users can choose from or it might display photographs along with their captions.
Tumblr media
ANDROID Interview Questions 11. What is a service? A service doesn’t have a visual user interface, but rather runs in the background for an indefinite period of time. For example, a service might play background music as the user attends to other matters, or it might fetch data over the network or calculate something and provide the result to activities that need it.Each service extends the Service base class. 12. How to Remove Desktop icons and Widgets? Press and Hold the icon or widget. The phone will vibrate and on the bottom of the phone you will see anoption to remove. While still holding the icon or widget drag it to the remove button. Once remove turns red drop the item and it is gone 13. Describe a real time scenario where android can be used? Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you. 14. How to select more than one option from list in android xml file? Give an example. Specify android id, layout height and width as depicted in the following example. 15. What languages does Android support for application development? Android applications are written using the Java programming language. 16. Describe Android Application Architecture? Android Application Architecture has the following components: Services – like N Intent – To perform inter-communication network Operation between activities or services Resource Externalization – such as strings and graphics Notification signaling users – light, sound, icon, notification, dialog etc 17. What is the Android Open Source Project? We use the phrase “Android Open Source Project” or “AOSP” to refer to the people, the processes, and the source code that make up Android. 18. Why did we open the Android source code? Google started the Android project in response to our own experiences launching mobile apps. We wanted to make sure that there would always be an open platform available for carriers, OEMs, and developers to use to make their innovative ideas a reality. We also wanted to make sure that there was no central point of failure, so that no single industry player could restrict or control the innovations of any other. The single most important goal of the Android Open-Source Project (AOSP) is to make sure that the open-source Android software is implemented as widely and compatibly as possible, to everyone’s benefit. 19. What is the Guardian app for Android? The Guardian app for Android delivers all the best content from guardian.co.uk to your phone or tablet. Read the latest news, sport, comment and reviews, watch video, listen to brodcasts and browse stunning picture galleries while on the move. 20. What features does it have? Navigate by section, topic or contributor: Download your homepage and favourites for offline reading with the touch of a button, or schedule a daily download for a time that suits you Browse our award-winning audio and video content Save contributors, topics and sections to your favourites folder Add favourites to your homescreen with an expanded view or link Swipe through stunning full-screen picture galleries Share articles and galleries via the Android share function View content in portrait or landscape orientation 21. Will it work on my phone? The app will work on all phones and tablets running Android version 1.6 and above. 22. How much does it cost? The app is free and ad-supported. 23. How do I save the app to my SD card? From the device's Settings menu, go to Applications > Manage applications > The Guardian. Under the data header, choose "Move to SD card". 24. How do I add sections to my favourites? It is possible to add sections, topics and contributors to your favourites. You can add to favourites by tapping the star icon in the top right hand corner of the relevant screens, or on the right hand side of the headers in the all sections menu. 25. How do I remove sections from my favourites? From the favourites menu, tap the red icons to the left hand side of the items. Alternatively, tap the star icon in the top right hand corner of the relevant screen so that it returns to its white state. 26. What is Mono for Android? Mono for Android is a software development kit that allows developers to use the C# language to create mobile applications for Android-based devices.Mono for Android exposes two sets of APIs, the core .NET APIs that C# developers are familiar with as well as a C# binding to Android's native APIs exposed through the Mono.Android.* namespace.You can use Mono for Android to develop applications that are distributed through the Android Application Stores or to deploy software to your personal hardware or the Android simulator. 27. What is included in Mono for Android? Mono for Android consists of the core Mono runtime, the Mono for Android bindings to the native Android APIs, a Visual Studio 2010 plugin to develop Android applications and an SDK that contains the tools to build, debug and deploy your applicationsOur Visual Studio 2010 plugin allows developers to use Visual Studio 2010 to develop, debug and deploy their applications to an Android simulator, an Android device, or the Android Application Store. Our MonoDevelop IDE also ships an addin to support Mono for Android development. 28. What do I need to develop Mono for Android applications? Mono for Android on Windows provides a plugin for Visual Studio 2010 Professional or better. We also support Mono for Android development using MonoDevelop on Windows for users that do not own a copy of Visual Studio 2010 Professional or better.Mono for Android on Mac developers can use MonoDevelop.On all platforms, Mono for Android requires the Android SDK (which requires Java JDK). 29. Will my users need to install Mono? No, When you deploy your application to the app store the Mono mobile runtime is statically linked to your application. No additional dependancies are needed. From the users point of view, there is no difference between an application created in Java and an application created using Mono for Android, other than a slightly larger (~4.4MB) application size. 30. Where is the UI Designer? Mono for Android does not bundle a UI designer to create the UI XML files We do not provide an integrated UI designer in Mono for Android 1.0. No decisions past that have been made. We will be listening to user feedback to decide where to put resources for the future versions. 31. How is Mono for Android licensed? Mono for Android is a commercial/proprietary offering that is built on top of the open source Mono project and is licensed on a per-developer basis. 32. What is the API profile exposed by Mono for Android? Mono for Android uses the same API profile for the core libraries as MonoTouch.Specifically, MonoTouch and Mono for Android both support a Silverlight-based API, without Silverlight's UI libraries (e.g. no XML, no WindowsBase.dll, etc.), and free of the sandboxing limitations of Silverlight. 33. Are the Android releases available in a ROM? No, Android is not yet available in a ROM format.Currently Android is installed by using a clean SD Card, and booted from there.It is booted by running a special application called 'Haret.exe' residing on your SD Card which will terminate the Windows kernel and boot into Linux/Android.It can't easily be run from ROM because a) it's too experimental to risk putting in ROM and then killing a device and b) WinMo does some hardware initialization that isn't documented, but is needed before Android can run. 34. When will it be available in a ROM? No time soon. Folks are working on it, but you'll need a lot of patience before it (if ever) arrives 35. How do I turn off, or reboot Android? In earlier releases, you had to pull the battery or press the reset button, in newer releases, you can hold down the 'end call' button and see a menu. 36. Should we jump in to Android? What’s the guarantee that’s what I will see on a phone? Will service providers turn off things? Keep in mind it hasn’t shipped yet, this is the most interesting time. Once it is open source, it could be locked down… they could create a derivative work. We’re going to provide a piece of technology that tests the APIs. No time frame yet. The script will exercise the system. It’s a compatibility test suite, to make sure nothing got disabled or broken by accident, and also ensure that apps will work across OEMs. 37. What if my app uses location API, and service provider shuts that off, can they? They can do that… it’s not a perfect world. Rather than having us dictate what carriers and OEMs support, we let developers develop killer apps that will require it. We want to ensure all the application development that goes on for Android… we want to give OEMs an incentive to keep things open. It’s a positive, self fulfilling vision. 38.If I’m a game developer and I’m building piece of content and I want to sell it, how do I do that and realize revenue? Content distribution — we’ve thought of that. It’d be great if there were a place where people could go to safely download and pay for content. 39. We use SMS interception for system signalling. Is there a mechanism for an app to respond and stop the signaling chain? Is there security around that so that one vendor can’t hijack a message and respond to it? There’s a mechanism where an application can register to receive a message with a certain signature and prevent others from getting it. We have a system of permissions apps are able to declare, enforce, and require to perform certain operations. Things like dial the phone, get to contacts, etc.. But these aren’t things that are baked in the core of the system. An arbitrary app could declare custom permissions. As far as restricting another app, the model we’ve been going by… the phone is not controlled by the application vendor, it’s controlled by the user. Whether or not the permissions are granted is up to the user that owns the phone. If you created a protocol that intercepts an SMS and another party wrote an app that intercepts the same SMS and the user wants to use that, the user could be free to stick that in. 40. Can the user set a priority? Don’t know, post your question to the developer’s community board. 41. In a previous release, XMPP was turned into GTalk. Will a future version have XMPP? Goal is to have XMPP support after 1.0. 42. What’s so special about Android? Unlike the proprietary iPhone operating system (now known as "iOS,"), which is under the complete control of Apple — and the same goes for Research in Motion’s BlackBerry OS or Microsoft’s Windows Phone platform — Google released Android as an open-source OS under the auspices of the Open Handset Alliance, leaving phone manufacturers (relatively) free to tweak Android as they see fit for a given handset. That’s one thing that’s special about Android. Another thing is that it just happens to be a really good OS, the first one in the post-iPhone wireless era to really give Apple a run for its money. Android may not be as sleek or polished as iOS (that’s my humble opinion, at least), but it’s fast and powerful, with an intuitive user interface that’s packed with options and flexibility. It’s also being constantly improved courtesy of the big brains at Google, making the Android experience sleeker by the day. 43. Are Android phones called "Droids"? Not necessarily. "Droid" is a brand name used by Verizon Wireless for its Android-based phones — the Droid X, the Droid Eris, the Droid Incredible and so on. The HTC Evo 4G on Sprint is not a "Droid," per se, but it’s still an Android smartphone. 44. Why would I (potentially) choose an Android phone over an iPhone? Well, for a variety of reasons — although I should point out that I’m actually a fan of both operating systems. (Sorry to disappoint the smartphone flame warriors out there.) One reason to go the Google way is that Android phones boast tight integration with Google services like Gmail, Google Calendar, Google Contacts and Google Voice — perfect for anyone who uses Google for all their e-mails, contacts and events. Indeed, one of the coolest things about Android phones is that the first time you fire one up, you enter your Google user name and password, and voila: All your Google messages, contacts and other info start syncing into your new handset automatically, no desktop syncing needed. Android is also far more open when it comes to applications. Whereas Apple takes a "walled garden" approach to its App Store, Google won’t restrict you from installing apps that aren’t featured in its official Android Marketplace. iPhone users, on the other hand, must "jailbreak" their phones if they want to install apps that weren’t approved by Apple for inclusion in the App Store. Last but not least, because Android is open to all manufacturers, a wide variety of Android phones are available to choose from — big and small, souped-up and pared-down, some with slide-out keyboards (good luck convincing Steve Jobs to put a slide-out QWERTY on the iPhone) and some that are all-touchscreen, all the time. Indeed, in the past few months, a new Android phone has debuted practically every week, while we only get a single new iPhone each year. 45. What are the downsides of Android? Well, if you ask me, the Android OS isn’t quite as forgiving to wireless beginners as the iPhone is. Setting up your e-mail, contacts and calendar on Android is a breeze (if you’re all about Gmail, that is), but when it comes to, say, your music and videos, you’re on your own with Android, which lacks an official media syncing client for the desktop. With the iPhone, you do all your syncing on easy-to-use iTunes, which also lets you manage your e-mail accounts, contacts, apps and photos. Then again, you can only use iTunes for syncing the iPhone, while Android users have a variety of third-party options. That’s just one example, but in general, Android gives you more options and choices about how you manage your phone and your mobile content — great for experienced and advanced users, but potentially intimating for new mobiles. On the other hand, while beginners might appreciate the (usually) smooth, user-friendly experience that Apple has devised for the iPhone, advanced users may (and often do) get frustrated by Apple’s tight control over what they can and can't do on the iPhone. It’s a trade-off, plain and simple, and your choice of platform depends on what’s right for you. 46. What’s up with all these different versions of Android, like "Donut," "Cupcake" and "Froyo"? Just as Apple does with iOS, Google continually updates Android with cool new features, leading to one "point" upgrade after another. The most recent version of Android is 2.2, code-named "Froyo" (for frozen yogurt, yum), adds features such as native USB tethering (for sharing your Android phone’s data connection with a laptop via a USB cable), mobile hotspot functionality (which turns your phone into a portable Wi-Fi hotspot that works with nearby Wi-Fi devices) and — perhaps most important — support for Flash, meaning that Flash-powered videos and modules that (notoriously) don’t work on the iPhone will work on the Android Web browser. Before 2.2 Froyo, we had version 2.1, which added "live" animated wallpaper, new home screen icons and widgets (tiny apps for the home screen), speech-to-text functionality (for e-mail and text messages, for example), full-on multitouch (for pinch-to-zoom gestures), and an updated photo gallery that hooks into your Picasa Web albums. Android 1.6 "Donut" (someone at Google must have a sweet tooth) added various speed improvements, support for more screen resolutions, and faster camera and camcorder applications. The first major update to Android was 1.5 "Cupcake," which (among other goodies) finally added a native video recorder. 47. So if the current version of Android is 2.2, why are people still complaining about Android phones stuck with version 2.1, or even 1.6? Ah, well, here’s where we find one of the downsides of Google allowing so much diversity in terms of available Android handsets. Don’t get me wrong: Variety is a beautiful thing, especially when it comes to phones. But it also means that each new version of Android must be certified to work on a specific handset — a long and sometimes drawn-out process that can leave users of a particular Android smartphone waiting weeks or even months to get the latest and greatest features. Indeed, manufactures and carriers may decide that it’s not worth the effort to upgrade their older phones to the latest Android version, leaving users high and dry. On the other hand, only a handful of iPhones exist, which makes it far easier for Apple to roll out a new version of iOS to everyone, all at once — or at least it used to be easy. Because of the hardware demands of iOS 4, we’ve already seen the original iPhone from 2007 get left behind, while users of the second-generation iPhone 3G have complained bitterly that the new iOS has slowed their handsets to a crawl. So it goes. 48. How many apps are available for Android? About 70,000 or so, growing by the day — still just a fraction of the 225,000-plus apps in the Apple App Store, but the official Android Marketplace has quite the head of steam, not to mention plenty of goodwill from the developer community given that Google doesn’t give apps the star-chamber treatment. 49. So, how should I go about picking an Android phone? No question about it: The breadth and variety of Android phones now on the market can be downright bewildering. The easiest way to narrow your choices is pretty obvious: What features and form-factors are you looking for? Do you want a phone with a real QWERTY keypad, or would you prefer one with only an on-screen keypad? Looking for a big screen (like the 4.3-inchers on the Evo 4G or the Droid X) or something that’s an easier fit in your pocket (like, say, the Droid Incredible)? Will you primarily be sending e-mail and text messages (in which case a smaller screen with a QWERTY would work), or are you interested in watching movies and other videos (big display)? Finally, who’s your carrier — or who would you like to be your carrier? Note, it’s not rocket science. Once you’ve zeroed in on a phone, find out which version of Android it’s running on. Is it the latest and greatest? (For now, only the Motorola Droid 2 is shipping with Android 2.2, although a 2.2 update for the HTC Evo 4G has finally arrived.) If not, ask when — and whether — an update is on the way. 50. What are the hottest new Android phones out right now? Well, earlier this summer we got the HTC Evo 4G, which supports Sprint’s budding, next-generation WiMax data network and boasts a 4.3-inch display — the same size as the screen on the Motorola Droid X, another eye-popper of a phone, except it’s on Verizon instead of Sprint. Samsung is in the midst of releasing a series of what it calls its Galaxy S-class Android phones: They’re thin and light, they all have high-contrast 4-inch "Super AMOLED" screens, and they’re available (or will be soon) on all four of the big U.S. carriers. If you’re looking for an Android phone with a slide-out QWERTY, consider the new Motorola Droid 2 on Verizon or the upcoming Samsung Epic 4G for Sprint. 51. How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android? Permissions.PROCESS_OUTGOING_CALLS: Allows an application to monitor, modify, or abort outgoing calls. 52. Why cannot you run standard Java bytecode on Android? Android uses Dalvik Virtual Machine (DVM) which requires a special bytecode. We need to convert Java class files into Dalvik Executable files using an Android tool called "dx". In normal circumstances, developers will not be using this tool directly and build tools will care for the generation of DVM compatible files. 53. Can you deploy executable JARs on Android? Which packaging is supported by Android? No. Android platform does not support JAR deployments. Applications are packed into Android Package (.apk) using Android Asset Packaging Tool (aapt) and then deployed on to Android platform. Google provides Android Development Tools for Eclipse that can be used to generate Android Package. 54. Android application can only be programmed in Java? False. You can program Android apps in C/C++ using NDK . 55. What is an action? The Intent Sender desires something or doing some task 56. What are Dalvik Executable files? Dalvik Executable files have .dex extension and are zipped into a single .apk file on the device. 57. How does Android system track the applications? Android system assigns each application a unique ID that is called Linux user ID. This ID is used to track each application. 58. When does Android start and end an application process? Android starts an application process when application's component needs to be executed. It then closes the process when it's no longer needed (garbage collection). 59. How can two Android applications share same Linux user ID and share same VM? The applications must sign with the same certificate in order to share same Linux user ID and share same VM. 60. Can I use the GoToMeeting app for Android on my Android device? Yes. If you’re running Android 2.2 or higher, you can install the GoToMeeting app from the Android Market to join meetings and webinars as an attendee. We recommend using devices with a 1Ghz processor or higher for optimal performance. 61. How can I download the GoToMeeting app? You can download the GoToMeetng app from the Android Market by signing in to your Google account linked with your Android device and searching for the GoToMeeting app to install it. If you don’t see an Install button, you may not be running Android 2.2 or higher – the minimum system requirement needed to install the GoToMeeting app. You can also download the GoToMeeting app from the Amazon Appstore (only available in the U.S.), which lets you instantly download the GoToMeeting app to an Android device. If you have the GoToMeeting app pre-loaded onto your device, you’ll need to first upgrade to the latest version of GoToMeeting. To upgrade, select the GoToMeeting daisy icon and then select the Upgrade button to install the most recent version of the app. 62.If I have a Motorola Android-based device that doesn’t have the Android Market app, can I still download the GoToMeeting app? Yes. Attendees using Motorola Android-based devices in China can now download the GoToMeeting app from SHOP4APPS™ – Motorola’s preinstalled Android application storefront. The GoToMeeting app is not yet localized in Chinese, but it is available in English, German, French, Spanish and Italian. 63.What made you jump into Android all of a sudden? Why not iOS or other mobile platforms? Maxim Petrov: I've never intended to do any mobile startup, but I got an Android phone first (Nexus One), not iPhone, so I started to look into this platform first. The lack of Google's own music app was obvious. I think if it was iPhone, not Nexus One, I could go developing for iOS instead. Though, you know, there are a lot more really good apps that already exist for iOS (and existed a year ago), all niches are filled, Apple is pretty restrictive (I don't think PowerAMP iPhone version would have ever been accepted in the Appstore). You can jump into Android quickly - just download the SDK, install adb driver, and you can develop - for your phone, for your friends (first beta testers), it's much easier to start on Android, but I can only compare to what I've read about iOS development as I haven't developed anything for iPhone. 64. What were your initial impressions of Android development? Maxim Petrov: Android developing (and actually, any software developing) is not about knowing the language - languages are just tools, so adding a tool to a toolbox is usually not a problem (I moved to Android/Java/C dev right from Ruby - and these are completely different languages). Given experience with any other languages, you can move to Android pretty quickly, at least start prototyping something, though, you need to fight the initial quirks (like SDK installation, lack of good documentation, android SDK/Eclipse and framework bugs, and the Android core devs' "you can't do that, please don't do that").Android development infrastructure is very immature, while Android end user can never notice the immaturity of the platform (as actually, it's not so immature on end user side), the development side of things is really lacking in many areas. For example, documentation is lacking, often conflicts with real state of things and it's just not enough. Though, this is balanced by the fact that Android is open source - you can just go check the source, and the source is the best documentation, but you need to get used (I am) to this approach. For example, Honeycomb sources are not published yet, and this immediately raised questions, like how do they activate that menu button in bottom status bar. 65. Does Android support Adobe Flash in the browser? Flash support varies by device with Android 2.1. The Samsung Acclaim does not have Flash support upon launch, but the HTC Desire will support Flash Lite 4.0 running Android 2.1. Flash 10.1 support is coming to Android-powered phones with Android 2.2. 66.Does Android support push email or is it pull? Android 2.1 supports push e-mail for Exchange mail and Gmail. 67. Will these phones have world phone capabilities, with the ability to make calls, receive data in other countries? Or will they be able to use Google Voice to make calls? Our Android-powered phones have Wi-Fi which can be used abroad for data, including Google Voice for making international calls. International Roaming for voice is available in several countries. 68. Will the App run on my Android phone? Yes, our App is fully compatible with any Android phone running Android software v2.1 or later. 69. How do I install your App? You can install our App from the Android Market by following the below steps: Open the Android Market application in the Applications menu. Hit the search icon and type in E.ON To install it, hit the ‘Free’ button on the left hand side In the next screen, it will give you more details about the application including the different functionalities it will need to access. Just click on OK to finish installing the application. 70. How do I find and download updates to the E.ON Android application? Any updates to our App will appear on your notification menu at the top of your screen. Just tap on the E.ON App icon and you'll be taken into the Android Market and be presented with the E.ON App download page. 71. What do I do if I have problems downloading your App? If you receive a "Download unsuccessful" message when trying to download our App you can try the following steps: Restart your phone and then try downloading the app again. Make sure that you’re connected to your network – if you’re not you’ll need to contact your mobile service provider Wait up to 10 minutes and try to download our App again. If you get stuck at "Starting download" then: Make sure that you’re connected to your network – if you’re not you’ll need to contact your mobile service provider If your request to download our App doesn’t start at all then try the below: Check your connectivity as stated above Make sure that your phone has enough available space to install our App. If you need to, try uninstalling some apps that you don’t use anymore or moving them to your SD card. Request the download again using Android Market from your device. 72. What is Intent? A class (Intent) which describes what a caller desires to do. The caller will send this intent to Android's intent resolver, which finds the most suitable activity for the intent. E.g. opening a PDF document is an intent, and the Adobe Reader apps will be the perfect activity for that intent (class). 73. What is a Sticky Intent? Sticky Intent is also a type of Intent which allows a communication between a function and a service sendStickyBroadcast() performs a sendBroadcast(Intent) known as sticky, i.e. the Intent you are sending stays around after the broadcast is complete, so that others can quickly retrieve that data through the return value of registerReceiver(BroadcastReceiver, IntentFilter). In all other ways, this behaves the same as sendBroadcast(Intent). One example of a sticky broadcast sent via the operating system is ACTION_BATTERY_CHANGED. When you call registerReceiver() for that action -- even with a null BroadcastReceiver -- you get the Intent that was last broadcast for that action. Hence, you can use this to find the state of the battery without necessarily registering for all future state changes in the battery. 74. How the nine-patch Image different from a regular bitmap? Alternatively, what is the difference between nine-patch Image vs regular Bitmap Image? It is one of a resizable bitmap resource which is being used as backgrounds or other images on the device. The NinePatch class allows drawing a bitmap in nine sections. The four corners are unscaled; the middle of the image is scaled in both axes, the four edges are scaled into one axis. 75. What is a resource? user defined JSON, XML, bitmap, or other file, injected into the application build process, which can later be loaded from code. 76.How will you record a phone call in Android? or How to handle an Audio Stream for a call in Android? Permission.PROCESS_OUTGOING_CALLS: Will Allow an application to monitor, modify, or abort outgoing calls. So using that permission we can monitor the Phone calls. 77.Does Android support the Bluetooth serial port profile? Yes. 78. Can an application be started on powerup? Yes. 79. How to Translate in Android? The Google translator translates the data of one language into another language by using XMPP to transmit dat You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens. 80. Describe Briefly the Android Application Architecture? Android Application Architecture has the following components: Services like Network Operation Intent - To perform inter-communication between activities or servicesResource Externalization - such as strings and graphics Notification signaling users - light, sound, icon, notification, dialog etc. Content Providers - They share data between applications 81. What is needed to make a multiple choice list with a custom view for each row? Multiple choice list can be viewed by making the CheckBox android:id value be “@android:id /text1". That is the ID used by Android for the CheckedTextView in simple_list_item_multiple_choice. 82. What dialog boxes are supported in Android ? Android supports 4 dialog boxes: AlertDialog: An alert dialog box supports 0 to 3 buttons and a list of selectable elements, including check boxes and radio buttons. Among the other dialog boxes, the most suggested dialog box is the alert dialog box. ProgressDialog: This dialog box displays a progress wheel or a progress bar. It is an extension of AlertDialog and supports adding buttons. DatePickerDialog: This dialog box is used for selecting a date by the user. TimePickerDialog: This dialog box is used for selecting time by the user. ANDROID Questions and Answers Pdf Download Read the full article
0 notes
felord · 6 years ago
Text
Project 3 - Play Tetris Solved
Overview Tetris (Links to an external site.)Links to an external site. was arguably the most popular single-player computer game of all time by the early 1990's.  It's incredibly simple and fun to play, and even to this day it's widely considered to be among the best games of all time. In case you've never seen it, the game consists of a 10-unit wide by 24-unit tall well, into which randomly-selected geometric 4-unit pieces begin to fall one at a time.  The player manipulates each piece as it falls, by moving it horizontally within the well, and rotating it in 90° increments.  Once the piece can fall no further, it becomes locked in place, taking up space in the well.  However, if the player forms one or more full horizontal (10-unit by 1-unit) rows, those rows are removed, with all rows above shifting downward.  The goal is to continue playing as long as possible, so the player must attempt to pack the pieces strategically.  Eventually, though, the well fills upward to a limit line, and if any portion of a piece is locked in place above this line, the game is over. You'll see all of this in action soon enough, and it's actually quite easy to understand once you've played it for just a few minutes. Requirements Building a full-functional Tetris application requires a little more Java than what we've covered yet this term, so you'll be provided a working application that you can download and play.  It's a somewhat simplified version, with a very rudimentary scoring mechanism, but it's still just as enjoyable and challenging as the original. So, if the application is already provided, what is this assignment all about?  The goal here is to develop a basic Artificial Intelligence ("AI") system, capable of controlling the game as if it were the player. Implementing an Interface In previous assignments, you were given a class file with method declarations, Javadoc comments, and placeholder implementations.  In this assignment, you'll be given an interfaceinstead.  An interface contains the method declarations and the Javadoc comments, but no code at all (not even placeholders).  Your task is to implement this interface, which means you'll develop a class that provides code for all the methods declared in the interface.  In addition to the methods specified by the interface, you will likely need to develop several private helper methods in order to fully implement it without redundancies. System Description The interface you will implement is called edu.vt.cs5044.tetris.AI and your implementation class must be called edu.vt.cs5044.TetrisAI.  You will need to develop the code needed to implement the methods defined by the interface.  One of the methods will be the overall AI system.  This method receives some parameters, defining the current state of the game board and the shape to be placed, and will need to find the "best" placement for that shape.  The other methods are responsible for intermediate calculations.  These methods would normally be private, and not specified by the interface, but for academic purposes we're exposing these methods to ease the testing requirements.  Speaking of tests, your JUnit test file must be called edu.vt.cs5044.TetrisAITest. Downloads tetris5044.jar library file containing all the compiled game engine classes tetris5044-api.jar library file containing the Javadocs for the game engine Setting up Eclipse Download the provided files to your computer, and place them in a convenient folder.  Open Eclipse and create a new Java Project for this assignment.  Right-click the project and select Build Path | Configure Build Path, then select the Libraries tab.  Click Add External JARs and navigate to where you placed the downloaded JAR files, select tetris5044.jar, and click OK.  You should now see that file listed along with the JRE System Library. Now click the little triangle to expand the new file, select Javadoc location: (None), and click the "Edit..." button.   Here be sure to select "Javadoc in archive" first, then click Browse. Navigate again, this time selecting tetris5044-api.jar, and click Validate.  It should tell you the location is likely valid, so click OK, then OK, to get back to the Libraries tab. Now click the "Add Libraries..." button, select JUnit, then select JUnit version 4 (this is not the default!).  Click Finish and ensure you see three libraries now: JRE System Library, JUnit 4, and tetris5044.jar.  Click "Apply and Close" to return to your project. Finally, right-click your project name, select New |  Source Folder, and name it "test" then right-click the new test folder and add a New | Java Package called "edu.vt.cs5044" where you will eventually develop your test class. Shall We Play a Game? (better than tic-tac-toe) At this point, you can right-click your project and select Run As | Java Application to play Tetris!  Go ahead and try it now... A window should appear with an empty game board and a prompt to type P to play.  Once you type P, you will see a new random piece near the top, slowly falling toward the bottom of the well. There are several alternative keyboard controls you can use, but for now just type J and L to move the piece left and right, and type I to rotate the piece. Once the piece is situated as you wish, you can use K (or the space bar) to drop the piece immediately, or you can just enjoy watching the piece fall gently into place. Zombie (brains?) You can type '?' into the game at any time to produce a listing in the Eclipse console of all of the available options and keyboard controls.  Try this now.  Some of these options will be extremely useful during the assignment.  You'll probably notice some interesting options, including a way to enable the Player AI by typing Ctrl-P.  When you enable this mode, just before a new shape appears in the game, the AI is asked how to best rotate then position the shape.  Go ahead and type Ctrl-P now.  Nothing will happen, except you'll see a warning in the console that your implementation couldn't be found, which is perfectly understandable at this point. Trying to Take Over the World (no, not that Brain) Close the game for a moment now, while we get some of the basics for the code in place.  First, create a new package in your src folder called edu.vt.cs5044 then right-click within that package select New Class. Before you enter the class name, click the "Add..." button to the right of the Interfaces section. In the search box at the top, type AI and you should soon see the AI interface (in the edu.vt.cs5044.tetris package) selected.  Click Ok to add that interface.  For now, un-check the option to create "Inherited abstract methods"  (if checked) and enter the class name as TetrisAI then click Finish. Notice that the new file declaration says public class TetrisAI implements AI.  This is what tells Java that we intend to be compatible with any system that can work with the AIinterface.  You'll also notice Eclipse is already showing an error on the class declaration line.  Click the tiny red X in the margin and double-click "Add unimplemented methods" from the pop-up.  This asks Eclipse to generate all the method placeholders for you!  (The option you un-checked earlier would have done the same thing; this way you're able to see exactly what it's doing.)  Save the file, and check out your new code.  It's already compatible with the game system, even though all it does is return placeholders.  That's not very useful, of course, but it's actually plenty to get started.  Let's see if it's recognized by the game engine. Launch the application again, type Ctrl-P to activate the Player AI, and confirm that the console says the Player AI is now on.  If so, go ahead and type P to start the game.  Well, that's not very exciting.  The console just keeps saying that the AI selected an invalid move for each shape, and we still have to manually place the pieces.  That's fair enough, since all we have are placeholders that Eclipse generated for us, but at least we know the game found our AI and seems to be communicating with it.  Close the game again now so we can code a little more. Let's at least provide a valid suggestion, even if it's always exactly the same suggestion.  In the findBestPlacement() method, let's replace the placeholder: return null; with this: return new Placement(Rotation.NONE, 0); Eclipse will complain that it doesn't know about the Rotation class yet, so again click the tiny X in the margin and double-click to import the Rotation class from the edu.vt.cs5044 package.  That should resolve the error, so save your file again.  This really doesn't seem like much of an improvement, but we'll try it anyway. Launch the game and use Ctrl-P then P to check it out.  Now it's just placing everything against the left edge (column 0) without any rotation, which is still fairly uninteresting.  However, it's clear that our AI is actually placing the pieces automatically for us!  Things can only get better from here.  Close the game once you're ready to code again. Need More Input (accidental AI, maybe) Obviously we need to examine the shape and the state of the board in order to make some reasonable decisions.  Let's take a look at all those Javadocs that make up the API.  In your source file click within the word AI of "implements AI" and type Shift-F2.  This should open the Javadocs for the AI interface using an internal browser within Eclipse.  You can set it to use an external browser, if you prefer, but this is fine for now. Reading the Javadocs, click the findBestPlacement() method and you'll see it actually provides a brief outline of a strategy.  We apparently need to iterate over each possible rotation, and for each rotation we need to iterate over every possible column placement.  For each of these, we need ask the Board object to tell us what the result of any hypothetical move would be.  Click the method Board.getResultBoard() to see how that works.  The Javadocs say that the original board instance is not modified, and we'll get a new board instance that we can examine. That will meet our needs, but how do we examine one of these hypothetical results?  There are only a few other methods available in the Board class.  One provides a human-readable rendering of the board, which might prove very useful to visualize what's happening while debugging, and another promising method seems to let us query any location within the board to see which locations are occupied by fixed blocks. There are also some static constants that tell us the overall size of the board, plus two constructors.  One of the constructors allows us to generate arbitrary board configurations, which is exactly what we'll need in order to create some nice test cases.  Don't forget about TDD! Click the Package link at the very top of any Javadoc page to see the package overview, then navigate throughout the various pages to see what each class and enum can do, along with the requirements for the interface.  A fundamental part of this assignment is to learn how to use Javadocs to explore unknown libraries, as well as to see how a somewhat larger scale system is divided into multiple classes, each with its own purpose. Note that class Tetris5044 is for internal use only; you won't need it at all.  Also, classes RandomMode and ShapeStream are only needed for the optional "challenge" section below. Strategy Games There's no such thing as a perfect Tetris strategy, so we won't even try.  We are necessarily taking the heuristic (Links to an external site.)Links to an external site. approach to this problem, and there will necessarily be trade-offs involved.  In every placement decision, there are advantages and disadvantages.  How can we hope to find the "best" placement?  Now is probably a good time to look at those other methods in the interface. Costs and Benefits From the API, it seems the remaining methods of the interface are related to making some measurements to evaluate a board position.  The idea here is that we'll compute four distinct "cost" scores, or factors, which tell our system something about how bad (or good) a particular placement might be.  We'll need to develop those method first, before we can hope to have a working AI system. We're still focusing on TDD, so start with some fairly straightforward test cases to ensure the individual scoring methods work.  Just construct a test board object, then assert the cost score you expect your implementation to compute. Once all of your individual cost scoring methods are working properly as expected, its time to put it all together.  The findBestPlacement() method will need to iterate through all the possible placements, and for each it will combine these individual cost scores in a weighted sum, then choose the lowest cost to return to the game engine.  The weightings are important so that certain factors can have more influence on the overall decision than others.  At first you can just set all the weights to 1, by simply summing the individual scores together, even though eventually we'll need to adjust the weights to achieve better results. Strategic Default Luck plays a starring role in Tetris.  Even with the best of strategies, it's critical to recognize that some games simply provide a more fortunate sequence of shapes than others.  Thus it can be difficult to objectively judge exactly how good a particular strategy might be.  To help with this, our implementation provides a set of 4 repeatable test sequences we can use as a benchmark.  The average number of pieces placed from these 4 test sequences will act as a very reasonable metric of how well our strategy is working overall. Teaching to the Test Eventually we'll be making a linear combination of our four scores, which just means we multiply each score by some weight, then add the weighted scores.  The equation is very straightforward: overallCost = weight1*score1 + weight2*score2 + weight3*score3 + weight4*score4 Computing the individual scores really isn't too bad, but what about the weights?  As noted above, we can start by simply setting all the weights to 1, and indeed that strategy will place an average of exactly 135 pieces across the four provided test sequences.  If your weights are all 1, and your placement average is anything else, you very likely have an issue with either the weights or the algorithm for finding the best weights.  You should resolve this before continuing (but please go ahead and read the rest now). Standards of Learning Can we do better?  Sure!  As a start, reasonable weight ranges for the selected factors will be 0 through 15. You can just use trial-and-error if you wish; watch your AI play the test games and try to figure out which factors need more or less emphasis.  For example, if your AI is creating too many unnecessary gaps, try to increase the weight of the gap count score.  Be sure to use Turbo mode in conjunction with all the Random TEST modes. Your AI must be able to place at least 175 pieces, on average, across the provided test sequences.  Try adjusting your weights in increments of 5, meaning weight values of 0, 5, 10, and 15.  Of the 256 possible combinations of 0, 5, 10, and 15 as weights, about 12% will result in this level of performance, so guessing will eventually yield a good combination.  You don't need to provide a JUnit test to demonstrate this performance, but Web-CAT will check whether your system meets this minimum or not. More than Full Coverage Unlike in the previous assignment, creating JUnit tests to cover all of your code will be very straightforward, since there aren't very many branches involved in the solution.  You can likely achieve full coverage with just one well-designed test case that asserts something about each method.  As a result, complete coverage is not nearly enough to ensure you have correctly implemented your code.  Therefore, you must generate at least 5 test cases for each interface method, with non-trivial test boards and non-trivial assertions.  You can satisfy this by creating at least 5 distinct test boards to be shared among assertions involving all the test methods.  Just be sure the test boards cover a reasonably wide range of board layouts.  Note that Web-CAT won't (and can't) enforce this requirement, but the human grader will definitely be looking for this. Functional Decomposition Judicious use of helper methods can significantly reduce the overall amount of code you need to develop.  For example, you might want to create a helper method that returns the height of one specified column.  You can then call that method from within a loop of all columns, and use the return value to help compute some of the cost factors your.  Your code will be inspected during the human review for redundancies, so be sure to develop helper methods wherever appropriate. Automating the Automation (An OPTIONAL Challenge) You might have noticed that it can get somewhat tedious to try every combination of 0, 5, 10, and 15 for each of the weights, even in Turbo mode.  You might have also noticed that you've been given sufficient tools to run entire simulated games without the user interface at all. As a challenge, see if you can identify the very best combination of 0, 5, 10, and 15 weights, by writing a separate class file called edu.vt.cs5044.WeightFinder with its own main() method.  This file will be completely ignored by Web-CAT, and you don't need to generate any tests for it at all.  You'll also need to add a public method, such as setWeights(int w1, int w2, int w3, int w4) to your TetrisAI implementation, to apply the various weight combinations.  This method will need to be exercised by a single assert, just to be sure it's covered within your own JUnit tests.  The best weights among these combinations will place an average of over 675 pieces for the test sequences. Once you've found the optimum combination, you'll need to hard-code those values back into your AI implementation as the defaults, in order to watch them in action. That's quite an improvement, unless you happened to get very lucky in your trial and error phase! Confirm that this is all working as expected, and that you're definitely placing over 675 pieces on average for the test sequences before the next part of the challenge.  It should be a simple change to your code to try stepping by 3 instead of 5 (meaning you should test every combination of 0, 3, 6, 9, 12, and 15 for every weight).  This process takes about 5-10 times longer to run than stepping by 5.   However, if everything was already working properly, you'll only need to do this once, and you'll discover that your newly-tuned weights will average over 2,700 pieces placed for the test sequences.  We'll call that a definite win! Still not satisfied?  You can always try stepping by 1 instead.  Again it's a trivial code change, but note that this process takes about 50-100 times longer to run than stepping by 3, so we're likely talking about a few hours at this point.  However, your newly-optimized AI possess the astonishing capability of averaging over 6,750 pieces placed for the test sequences!  It's actually over ten times the best average you can achieve when iterating by fives.  (By the way, you can stop your iterations when you reach this goal; there's nothing better to find than this when stepping by ones.)  You might be somewhat surprised when you discover the optimum weightings.  When you watch this particular combination in action, it's interesting to compare the variation in results between TEST3 (the worst) and TEST4 (the best). If you make any progress with this OPTIONAL challenge, please add a brief write-up in the comments of your WeightFinder class, just to let us know what you did, along with any thoughts you'd like to share about the experience.  Of course you may also discuss this in Piazza, although please don't post your code (or any weightings you find) to the entire class, so as not to spoil the fun for anyone else. Hopefully you enjoyed this challenge!   Read the full article
0 notes