How to Import Namespace on ASP.net Page - asp.net-3.5

I have created a Class named SearchableGridView in my App_Code directory. I'm using
<Assembly: TagPrefix("MyApp.WebControls", "SearchGridView")>
Namespace MyApp.WebControls
I have referenced it in web.config as:
<add namespace="MyApp.WebControls"/>
I have also included the following on my content page:
<%# Import Namespace="MyApp.WebControls" %>
<asp:SearchGridView ID="SearchGridView1" runat="server">
</asp:SearchGridView>
However, when I build the project, I receive the error:
Warning 1 Element 'SearchGridView' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
How do I rectify this situation?
Thanks much for your help and guidance!

Related

How can I import lodash library in my Vanilla JS file

I have installed the "lodash" using "npm install --save lodash" and imported in my JS file.My intention is to Deep clone of an Object and found that Lodash is the library which solve this problem. My HTML and JS files are as follows.
My HTML file is as follows.
<!DOCTYPE html>
<html lang="en">
<body>
<script type="module" src="scripts.js" ></script>
</body>
</html>
My JS file (scripts.js) is as follows:
import _ from 'lodash';
let userOne = {
name: "Siju",
userFunction:function(){
return this.name;
}
};
// Deep Copy: Start
let userTwo=_.cloneDeep(userOne);
// Deep Copy: End
userTwo.name="Johnson";
userTwo.userFunction=function(){ return this.name.length }
console.log(userOne.name);
console.log(userTwo.name);
console.log(userOne.userFunction());
console.log(userTwo.userFunction());
But i am getting following errors.
Error1: (When use: import _ from 'lodash';)
Uncaught TypeError: Failed to resolve module specifier "lodash". Relative references must start with either "/", "./", or "../".
Error2: (When use: import _ from './node_modules/lodash';)
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
I have spend lot of time on this and did'nt get any suitable solution. I am really frustrated on this issue because it is a silly issue but did'nt get any proper fix in the internet. Most of the explanation is seems to be with so many dependency fixes and all. But no any fixes are worked for me. So anyone can be come up with simple and proper fix for this. Thank You Very Much in Advance!
You can go to http://lodash.com/ and download the entire .js file into your current project folder and then include the following line in your HTML body paragraph.
<script src="lodash.js"> </script>
And then import it at the top of your JavaScript file in which you would like to use it.
import _ from 'lodash'

What is the physical path of Odoo webserver?

I'm building a custom odoo module that will be using several Javascript libraries.
I need to add references to those libraries (local references) but I don't know exactly where to place those libraries and how to refer to their location.
What I tried:
- I created the new module and placed the libraries inside the module directory but it didn't work.
- I also placed the libraries in the home directory of odoo.
As I understand, the problem would be solved if I could get the default directory of the webserver that odoo runs on.
If module is using js files, then you must put these files inside your module. And still if you cant reach these files from your module its your technical error and you have to fix it yourself, also note that odoo has its js libraries already
I found this page: how to add css and js files in Openerp 7 / Odoo module maybe can help you.
Below is the content.
Store files correctly:
CSS and JS files should be reside under 'static' directory in the module(the rest of subdirectory tree under 'static' is an optional convention):
static/src/css/your_file.css
static/src/js/your_file.js
Add files in manifest (v7.0) or in XML(v8.0)
Openerp v7.0 way is to add following entries in manifest (in openerp.py):
...
'css': ['static/src/css/your_file.css'],
'js': [static/src/js/your_file.js'],
...
Odoo v8.0 way is to add corresponding record in the XML:
Add XML to the manifest (openerp.py):
...
'data': [ 'your_file.xml'],
...
Then add following record in 'your_file.xml':
<data>
<template id="assets_backend" name="your_module_name assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel='stylesheet' href="/your_module_name/static/src/css/your_file.css"/>
<script type="text/javascript" src="/your_module_name/static/src/js/your_file.js"></script>
</xpath>
</template>
....
....
</data>

Scala play - "not found: value routes" (Eclipse and IDEA)

Occasionally, and seemingly for no reason, I get "not found: value routes" compilation error in one of the view templates (after compilation).
This happens either in Eclipse or IDEA.
Googling finds this but it's not possible to add mainLang = SCALA in play 2.10 (I'm using version 2.1.2).
Cleaning the project / re-eclipsifying it / seems to work, sometimes, but is there any more permenant solution / work-around?
Thanks
Since there seems to be no answer, I'll at-least describe my workaround:
Instead of using
<link href=#routes.Assets.at("stylesheets/style.css") rel="stylesheet" type="text/css" />
in my template HTML, I'm using
<link href="assets/stylesheets/styles.css") rel="stylesheet" type="text/css" />
Since I'm not invoking routes.Assets.at, there is no issue with not finding the value routes.
(However, I'm guessing this workaround will easily crumble when I would have need of more complex templates)
This can happen if the routes file does not exist or contains no routes.
I have this working defining an Asset Controller
object Assets extends controllers.AssetsBuilder
and having the route for assets too in the routes conf:
\#Map static resources from the /public folder to the /assets URL path
GET /assets/*file premise.internet_org.controllers.Assets.at(path="/public", file)
sbt compile
Then IntelliJ loads the output of the compilation and everything just works for me.
This happens when there is no route configuration for your Assets in the routes file.
You must add this to your routes file:
GET /assets/*file controllers.Assets.at(path="/public", file)
I had such error when tried build Sihouette example project https://github.com/mohiva/play-silhouette-seed/tree/master. I commented or replaced code, that caused error. For example:
def view = silhouette.UnsecuredAction.async { implicit request: Request[AnyContent] =>
//Future.successful(Ok(views.html.signUp(SignUpForm.form)))
Future.successful(Ok)
}
After that build become successful - Twirl and Routes directories created in target/scala-2.X/. I run application and restore original code.
def view = silhouette.UnsecuredAction.async { implicit request: Request[AnyContent] =>
Future.successful(Ok(views.html.signUp(SignUpForm.form)))
}
I had added .disablePlugins(PlayLayoutPlugin) to my built.sbt "root" definition without changing the directory structure to match (see the link below explaining this). It switches from "Play application layout" to the "default sbt layout". The routes and application.conf are now expected in a different location on disk. I encountered both "not found: value routes" and "resource not found on classpath: application.conf" errors. I had copied this disablePlugins line from another project.
https://www.playframework.com/documentation/2.8.x/Anatomy#Default-sbt-layout
I had the same problem, its resolved when i drop the generated folders (target) and i restart my application
I had to go to the terminal and type "activator test" before Intellij would stop giving me these errors during IDE tests.

Unable to properly link external Java library in Eclipse

I've been struggling to properly integrate this Netflix Java Client to access Netflix's API into a very basic Eclipse Java Web Project.
Whenever I try to publish any content referring to this library, I get errors like the following, indicating an inability to resolve the type of the classes in the external library I'm trying to use.
Aug 20, 2011 11:48:42 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/OSNet03] threw exception [Unable to compile class for JSP:
An error occurred at line: 19 in the jsp file: /index.jsp
NetflixAPIClient cannot be resolved to a type
16: String myConsumerKey = new String("cefjbgekg7566cqrp2atua2n");
17: String myConsumerSecret = new String("redacted");
18:
19: NetflixAPIClient apiClient = new NetflixAPIClient(myConsumerKey, myConsumerSecret);
20: String uri = APIEndpoints.MOVIE_URI + "/2361637";
21: String details = null;
At the top of the file I include the proper class directories like this:
<%# page import="com.netflix.api.*" %>
<%# page import="com.netflix.api.client.*" %>
<%# page import="com.netflix.api.client.dal.*" %>
And I don't receive any errors from Eclipse telling me it can't resolve the classes. Only once I publish it to the server does this error occur.
I've tried building with jre7 and jdk1.7.0. The library I'm trying to work with includes elements that are from Java v6 and v5.
I included the library by building it with Maven and placing the directory in my WEB-INF/lib folder and then including the jar netflix-client-2.3-SNAPSHOT.jar in my Build Path.
I've looked all over the web for possible causes and tried every prescribed solution I've found but none have worked.
You may be able to tell I'm very new to using Eclipse and Java Web Programming but I'm trying to figure things out as best I can as I go.
check if build automatically is on :P. if not try turning it on for once.
if yes then check the project build path and look for libraries. check if the correct jars are there.
also check if your jars are not corrupted.
these are the usual problems for more wait for sm1 else to answer.
you could also try searching for the resource class that can't be resolved using Ctrl+Shift+R and see if the class turns up.
if you don't get it, then just extract the jar and see if the class is there for real.

Facebook C# SDK

I'm starting out with the Facebook C# SDK and trying to run the MVC Sample on my test server and am running into the following error:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'Facebook.Web.Mvc.ViewUserControl'.
Source Error:
Line 1: <%# Control Language="C#" Inherits="Facebook.Web.Mvc.ViewUserControl" %>
Source File: /Views/Facebook/LoginButton.ascx Line: 1
I've set up several MVC 2.0 projects in the past and have followed the instructions on the getting started section on http://facebooksdk.codeplex.com/ (added and changed setting in web.config, etc.)
What am I missing in order to run the sample project(s).
You are using a very old sample from the SDK. The problem is that the class Facebook.Web.Mvc.ViewUserControl does not exist. That was only in a very early alpha build. I would recommend downloading the new sample to get started. You can get that here: http://facebooksdk.codeplex.com/releases/view/54371#DownloadId=160969