我正在使用Arcgis Javascript API.API基于dojo工具包构建.所以我需要在API中使用dojo功能.我正在准备dojo配置文件如下.
var pathRegex = new RegExp("/\/[^\/]+$/");
var locationPath = location.pathname.replace(pathRegex, '');
var dojoConfig = {
async: true,
parseOnLoad: false,
baseUrl:"js/",
packages: [
{
name: "application",
location: locationPath + '/js/application'
}]
};
Run Code Online (Sandbox Code Playgroud)
我创建了一个bootstrapper.js,如下所示.
require(["application/main", "dojo/domReady!"], function (application) {
console.log("bootstrapper is running");
application.Run();
})
Run Code Online (Sandbox Code Playgroud)
而index.html文件是这样的.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Arcgis Javacsript API Samples</title>
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/esri/css/esri.css">
</head>
<body class="claro">
<div id="map"></div>
<script src="//js.arcgis.com/3.6/"></script>
<script src="js/application/djConfig.js"></script>
<script src="js/application/bootstrapper.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我的应用程序托管在IIS上,并且有像这样的地址:htp://domain/Demo/Sample1/index.html
当我运行应用程序时,此代码给出如下错误.
"NetworkError:404 Not Found - http://js.arcgis.com/3.6/js/dojo/application/main.js …
我正在通过javascript代码将文件上传到服务器.我注意到不同的浏览器正在发送不同大小的字节.正如您在下面的图片中看到的那样,Internet Explorer发送的是小字节,但Chrome和Firefox会发送更大的字节.
<requestLimits maxAllowedContentLength="1073741824">(1GB),但是当我使用Firefox和Chrome上传大文件(500 Mb)时,服务器正在提供system.OutOfMemoryException.Internet Explorer工作正常.火狐

IE浏览器

铬

mapApp.controller("myController", function ($scope,$http) {
$scope.namePlaceHolder= "Name";
$scope.name = "";
};
Run Code Online (Sandbox Code Playgroud)
我将范围变量绑定到html输入,如下所示.
<input id="foo" type="text" placeholder="{{namePlaceHolder}}" ng-model="name" value="{{name}}"/>
Run Code Online (Sandbox Code Playgroud)
如果用户在文本框中键入内容,则$ scope.name属性会更改.但是当我使用javascript更改它时,$ scope.name数据不会更改.
on(document.getElementById("button"), "click", function (e) {
document.getElementById("foo").value = "ascd...";
})
Run Code Online (Sandbox Code Playgroud)
此代码不会填充$ scope.name数据.
我可以在 postgresql 中创建一个角色。
CREATE ROLE myname WITH LOGIN PASSWORD 'pass';我可以为该用户设置数据库模式的权限。
GRANT USAGE ON SCHEMA public TO myname;并选择用户的权限。
GRANT SELECT ON ALL TABLES IN SCHEMA public TO myname;但是我的数据库中有很多用户。我不想为我的所有用户设置这些权限。其实我想创建角色组名:
并将
viewer在所有表上选择特权,在所有表
editor上选择、插入和更新特权。
我的用户将在这些组中。
我怎样才能做到这一点?
我正在使用实体框架,但使用原始查询进行操作。我的操作如下:
\n所以我正在使用交易
\nusing (var transaction = await _context.Database.BeginTransactionAsync())\n{ \n var isExist = await IsExist(id);\n\n if (isExist)\n {\n var deleteQuery = "delete from ....";\n await _context.Database.ExecuteSqlRawAsync(deleteQuery);\n }\n\n var insertQuery = "insert into ...";\n await _context.Database.ExecuteSqlRawAsync(insertQuery);\n}\nRun Code Online (Sandbox Code Playgroud)\n如果插入操作失败,删除的记录是否回滚?
\n到目前为止,我正在创建一个classLibrary项目,并从exixting数据库中插入新的Ado.net Entity数据模型和genareting.类和对象类代码自动创建.这对我来说并不重要.
但我想这样做并将ObjectContext类(例如:SomeEntities)和table classess分离为两个calss库.
当我更改数据库表属性时,我将更新edmx模型,类将自动更新.
有没有办法做到这一点?我没有使用codefirst因为有一个数据库和数据,我不是同样使用modelfirst,我使用databasefirst但不能分开
我是ubuntu服务器的新手.我下载了这样的zip文件.
sudo wget http://domain/downloads/1806
Run Code Online (Sandbox Code Playgroud)
但我现在找不到它./ home/username文件夹中有一个下载文件.但这不是一个文件夹.我不能像这样使用ls命令:它给出的消息不是目录.ls /home/username/download
我想用通用扩展方法映射我的对象.
public class Customer
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public Address HomeAddress { get; set; }
public string GetFullName()
{
return string.Format(“{0} {1}”, FirstName, LastName);
}
}
Run Code Online (Sandbox Code Playgroud)
这是viewmodel
public class CustomerListViewModel
{
public string FullName { get; set; }
public string Email { get; set; }
public string HomeAddressCountry { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
所以我正在创建地图, Mapper.CreateMap<Customer, CustomerListViewModel>();
我想创建一个扩展方法
public static class MapperHelper
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用asp.net web api和基于令牌的身份验证.我的令牌选项将成功令牌过期时间设置为14天后.
OAuthOptions = new OAuthAuthorizationServerOptions
{
TokenEndpointPath = new PathString("/Token"),
Provider = new SimpleAuthorizationServerProvider(),
AuthorizeEndpointPath = new PathString("/api/Account/ExternalLogin"),
AccessTokenExpireTimeSpan = TimeSpan.FromDays(14),
// In production mode set AllowInsecureHttp = false
AllowInsecureHttp = true
};
Run Code Online (Sandbox Code Playgroud)
我生成的令牌是这样的.
{
"access_token": "Mg5oQAzt9RLSUezxPYNQ7JRcJqo-uPxfOgOGHKkrJ_q56g0H8x-sjKm1mkjND0VAK3H22nwFlGNk5wfTocCb5mKMvTYwsZAv5sh0SACHdbb_9BGftMuqbFdm6wH0wXF-Sq3noF7hc2FeUUauhDfrBq5jTSou4NO3EBwjc0jj3v-yQzPGMCFxq2Q8C9uhat14rGYteYqj5mX3L5JtwHrobePL2R9lcnagNIMa44GUWQ8DVR2urP4KCrDHJf1G5pIfv94uB85I7sbf0nse7VvhYp058I8voNR9_zD1XC5-AODQJ16F484zxQokX1BWJ3gfgd86zJr2O9iKsA",
"token_type": "bearer",
"expires_in": 1209599,
".issued": "Sat, 20 Feb 2016 13:15:10 GMT",
".expires": "Sat, 05 Mar 2016 13:15:10 GMT"
}
Run Code Online (Sandbox Code Playgroud)
我将此信息保存在cookie中并在我的应用程序中使用.但几分钟后我的访问令牌验证即将到期,401 http错误.
我试图从Fiddler和邮差获取请求,但给出了401授权错误.
我的 web api 中有一个很长的内容请求参数。所以我需要发送一个 POST 请求。我的 api 正在创建一个 PDF 文件作为响应。但是我无法使用 angularjs $ httpprovider获得结果。
var req = {
method: 'POST',
url: 'http://myapi.com/api/renderfile',
data: {
p1: 'very long text....' ,
p2: 'another very long text....',
p3: 'another very long text....'
}
}
$scope.isLoading = true;
$http(req).then(function(response){
// response is file result how can I save it ???
$scope.isLoading = false;
}, function(){
$scope.isLoading = false;
});
Run Code Online (Sandbox Code Playgroud)
我无法在客户端上保存文件响应?
回应是这样的:
当我使用 FileReader
new FileReader().readAsDataURL(new Blob([response.data], {type:'application/pdf'}));
Run Code Online (Sandbox Code Playgroud)
弹出窗口出现在浏览器上:
但是文件是空的。
javascript ×3
angularjs ×2
c# ×2
access-token ×1
asp.net-mvc ×1
automapper ×1
dojo ×1
file-upload ×1
generics ×1
http ×1
linux ×1
oauth ×1
postgresql ×1
sql ×1
ubuntu ×1
upload ×1