我想弄清楚ExtJS4如何传递配置对象.我想做相当于......
store = function(config){
if ( typeof config.call !== 'unndefined' ){
config.url = "server.php?c=" + config.call || config.url;
};
Sketch.Data.AutoSaveStore.superclass.constructor.call(this,config);
};
Ext.extend(store, Ext.data.Store{})
Run Code Online (Sandbox Code Playgroud)
我可能在这里遗漏了一些明显的东西,但是在沙盒文件中挖了一下,我最接近的就是....
Ext.define('My.awesome.Class', {
// what i would like to pass.
config:{},
constructor: function(config) {
this.initConfig(config);
return this;
}
});
Run Code Online (Sandbox Code Playgroud)
如果你做的事情似乎不起作用......
var awesome = Ext.create('My.awesome.Class',{
name="Super awesome"
});
alert(awesome.getName()); // 'awesome.getName is not a function'
Run Code Online (Sandbox Code Playgroud)
然而
Ext.define('My.awesome.Class', {
// The default config
config: {
name: 'Awesome',
isAwesome: true
},
constructor: function(config) {
this.initConfig(config);
return this;
}
});
var …Run Code Online (Sandbox Code Playgroud) 我在网上看到了很多代码片段,示例显示了Zend_Configapplication.ini的不同变体.另外,我看过一些关于ini配置文件和xml配置文件的争论.我个人的application.ini 和一个config.xml的文件.
我的application.ini只有基本的东西,如PHP设置和前端控制器设置等
我的config.xml文件有一些站点设置,它还有数据库适配器信息
随着Zend框架的进步,我发现越来越多的人在application.ini中放置了几乎所有东西(或者看起来似乎如此).我应该这样做吗?
在主题中 - 为什么你可以把它们放在.htaccess中.
我一直以为它应该在php.ini中,而不是在.htaccess中.
的.htaccess
php_value max_execution_time 240
php_value max_input_time 111
Run Code Online (Sandbox Code Playgroud)
php.ini中
max_execution_time 240
max_input_time 111
Run Code Online (Sandbox Code Playgroud)
为什么会那样?
我需要帮助从配置文件中读取端口.该行看起来像:PORT = 8888
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int main(int ac, char **av)
{
char buf[256];
FILE *file = NULL;
char hostlist[256] = "";
int port = 8080; /* default not from config */
int i = 0;
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)// open file // some feof code[..]
strcpy(hostlist,buf);
if (strstr(buf,"PORT")) { /* buf[0-3] = */
printf("%c\n",buf[5]); /* PORT=8888 */
printf("%c\n",buf[6]);
printf("%c\n",buf[7]);
printf("%c\n",buf[8]);
Run Code Online (Sandbox Code Playgroud)
这按预期工作^^但是,当尝试复制到缓冲区时,我没有得到任何端口或我得到默认端口.
for(i=4;i<9;i++) {
while (buf[i] != '\n') {
port += buf[i++];
printf("buf:%c\n",buf[i]);
}
}
printf("port=%d\n",port);
} …Run Code Online (Sandbox Code Playgroud) 当我刚拿到app.config时,每当我尝试ConfigurationManager.AppSettings [0]或ConfigurationManager.AppSettings ["keyName"]时,我得到一个null.所以我尝试使用*.settings文件创建了一个看起来像这样的app.config
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="IndexLoader.IndexLoader" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<IndexLoader.IndexLoader>
<setting name="ConnectionString" serializeAs="String">
<value>INITIAL CATALOG=xxx;DATA SOURCE=xxx;User ID=xxx;Password=xxx;Application Name=xxx;</value>
</setting>
</IndexLoader.IndexLoader>
</applicationSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
现在我如何使用C#读取此连接字符串?
该解决方案有多个项目,其中许多都有配置文件.有没有办法指定我想要使用代码项目中的配置文件?
我正在尝试在symfony2(php app/console cache:clear --env-prod)上清理我的prod缓存,我收到以下错误:
[InvalidArgumentException]文件"/var/www/vhosts/ns21206.ovh.net/citydom/app/config/config_.yml"不存在.
在我的文件中,app.php我使用以下行创建了项目:
$kernel = new AppKernel('prod', true);
Run Code Online (Sandbox Code Playgroud)
我觉得这很标准.
我认为symfony试图用env""创建项目,但我不知道为什么.
我做错了什么 ?
我在我的生产服务器上使用强制ssl配置为tomcat.我想在开发中禁用此功能,并想知道我的选项是什么.配置发生在我的web.xml文件中.我目前使用maven构建我的项目,所以我已经有一些配置文件,其中我更喜欢设置设置.
我尝试使用Liferay-IDE 2.0创建新的Lifreay-Plugin项目.但我得到常春藤网络问题.我认为有必要为Ivy配置代理,但我不知道在哪里这样做.
这里的例外:
[Console output redirected to file:D:\Liferays\6.2.CE-RC5\workspace\.metadata\.plugins\com.liferay.ide.sdk.core\sdk.log]
Buildfile: D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\themes\build.xml
[get] Getting: http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar
[get] To: D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\.ivy\ivy-2.3.0.jar
[get] Error getting http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar to D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\.ivy\ivy-2.3.0.jar
BUILD FAILED
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\themes\build.xml:5: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common-plugins.xml:5: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common.xml:47: The following error occurred while executing this line:
D:\Liferays\6.2.CE-RC5\liferay-plugins-sdk-6.2.0\build-common-ivy.xml:17: java.net.UnknownHostException: repo1.maven.org
Run Code Online (Sandbox Code Playgroud)
随着maven,行为很好.
我正在开发Visual Sutio 2015社区的C#项目.我更改了属性debug->命令行,存储在本地机器中,bug在.csproj文件中没有变化,所以我无法将其推送到git.它在哪里?我怎么把它推到git?
我试图在谷歌上找到有关这方面的任何信息,但没有任何结果.有人可以解释一下,如果有任何理由我们应该通过config.properties加载属性,然后声明"属性道具",然后读取它...而不是直接将静态字段定义为某些类的属性(我猜更简单,更快) .
Public ConfigClass{
public static string SERVERNAME = "some hostname";
public static string USERNAME = "some username"
}
Run Code Online (Sandbox Code Playgroud)
然后,如果我们需要,只需在代码中调用它,例如
ConfigClass.SERVERNAME
Run Code Online (Sandbox Code Playgroud)
我在谈论简单的场景,我想使用简单的属性,如servername,username等...