我们正在创建几个(19)网站,以便在Sharepoint 2007中托管,并希望使用Google Analytics.第一点很容易,只需将Google Analytics javascript放在Sharepoint母版页中,所有内容都按预期工作.
但是,我们希望19个站点中的每个站点都生成单独的统计信息,这是通过为每个站点设置不同的ID来完成的.我的第一个想法是将id存储在每个站点的web.config中,并更改母版页以便为javascript读取此内容:
<%= ConfigurationManager.AppSettings["google.analytics.key"]%>
Run Code Online (Sandbox Code Playgroud)
不幸的是,Sharepoint不喜欢这样说并且说:此文件中不允许使用代码块.
我的问题是:
有没有办法在Sharepoint母版页中从web.config读取appSettings?要么
是否有更好的Sharepoint方式将特定于站点的信息导入母版页?要么
我是否坚持为每个网站使用单独的母版页?
想象一个 winform 应用程序,它将更新的程序集从源文件夹 A 复制到目标文件夹 B。我使用简单的 DirectoryInfo.GetFiles 方法来填充列表视图,比较文件夹 A 和 B 中程序集的版本;如果某些程序集较新,我将启动更新方法。在这种方法中,在复制之前,我尝试一下B文件夹中的所有文件是否未被使用:
var B = new DirectoryInfo("myBfolder");
foreach (var file in aFolder.GetFiles())
{
try
{
//File not in use
File.Open(file.FullName, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
}
catch (Exception ex)
{
//File in use!
}
}
Run Code Online (Sandbox Code Playgroud)
好吧,因为之前的 UpdateListView 代码使用 FileInfo 来获取要显示的信息,所以我的所有文件都被使用了!
FileInfo 锁定文件!这可能吗?
有人可以建议一种方法来绕过这个问题吗?
谢谢你,南多
好奇Java中获取mime类型文件的最佳方式.它应该实际检查文件,因为文件名不是一个准确的指标.
目前我正在使用以下似乎非常受欢迎或错过
is = new BufferedInputStream(new FileInputStream(fileName));
String mimeType = URLConnection.guessContentTypeFromStream(is);
if(mimeType == null) {
throw new IOException("can't get mime type of image");
}
Run Code Online (Sandbox Code Playgroud) 我该如何更正此声明:
${model.myHashtable[model.data.id]}.
Run Code Online (Sandbox Code Playgroud)
myHashtable定义为
Hashtable<String, String>
Run Code Online (Sandbox Code Playgroud)
但是,${model.data.id}
返回一个int
.
我试着做点什么
${model.myHashtable['model.data.id']}
Run Code Online (Sandbox Code Playgroud)
但它不起作用.任何其他的想法,除了改变的类型id
来String
?
我使用以下sed命令line number
从文件中删除字符串
sed -i s'/line number//g' file
Run Code Online (Sandbox Code Playgroud)
但我需要改变 sed
语法,以便line number
只删除文件的最后一行?
我的音乐应用程序不断在后台播放音乐,但是我希望能够检测到另一个应用程序何时开始播放音频(例如YouTube应用程序),这样我就可以在应用程序中暂停/静音/停止音频.
这将允许用户在听音乐的同时继续浏览网页,但是如果他们希望在任何时候观看视频,他们可以在没有音频冲突的情况下这样做.
一种解决方案可能是监听应用程序何时开始使用AudioManager的广播.这样的意图行动是否存在?
编辑:如下面提供的答案,似乎有一种方法可以检测2.2中的音频焦点丢失AudioManager.OnAudioFocusChangeListener
.
很棒,但有更常见的Android版本的解决方案吗?理想情况下1.5+.
是否有一种简单的方法来替换字符串中的/ a以符合以下单词 - 与'S'在日期格式中的工作方式非常相似?
例如
$apple = 'apple';
$pear = 'pear';
echo "This is a $apple, this is a $pear."
--> This is an apple, this is a pear
Run Code Online (Sandbox Code Playgroud) 我正在试图找出如何在Prolog中编写Hello World程序.我只是想创建一个像这样运行的程序:
> ./hw
Hello, world!
>
Run Code Online (Sandbox Code Playgroud)
问题是我可以找到的每个例子都在REPL中工作,如下所示:
?- consult(hello_world).
% hello compiled 0.00 sec, 612 bytes
Yes
?- hello_world.
Hello World!
Yes
Run Code Online (Sandbox Code Playgroud)
即使编译Prolog的例子也是如此:程序仍然只是落入REPL.对于"通用"语言来说,这显然没什么用处.那么,我该如何编写传统的Hello World?
在MATLAB中,我有一组纬度和经度对,代表美国的位置.我需要确定到最近海岸线的距离.
我认为MATLAB有一个内置的美国纬度/经度点数据库.我如何访问并使用它?
还有关于如何有效确定距离的任何建议?
更新:后续问题:使用meshm时确定箱的中心
您可以通过滑动和点击选择带下方或上方的项目来滚动UIPickerView.
您可以通过将NSString指定为标题或为每行指定可重用的UIView来填充UIPickerView.
我注意到的是,当我从提供字符串切换到提供视图时,点击滚动不再工作.这是预期的行为吗?我的观点应该将一些触摸事件转发给UIPickerView吗?
谢谢
编辑:
这是我实现的代码示例:
// Creating the picker
screenPicker_ = [UIPickerView new];
screenPicker_.showsSelectionIndicator = YES;
screenPicker_.delegate = delegate_;
screenPicker_.dataSource = delegate_;
[self addSubview:screenPicker_];
[screenPicker_ release];
// Row view creation delegate
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
PickerRowView *pickerRowView = (PickerRowView*)view;
if(view == nil)
{
pickerRowView = [[PickerRowView alloc] initWithFrame:CGRectMake(0, 0, pickerView.frame.size.width, PICKER_ROW_HEIGHT)];
}
[pickerRowView SetTitle:@"some title"];
return pickerRowView;
}
// initailizer of the PickerRowView class (an UIView subclass)
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super …
Run Code Online (Sandbox Code Playgroud) java ×2
.net ×1
android ×1
appsettings ×1
audio ×1
cakephp ×1
cocoa-touch ×1
distance ×1
el ×1
fileinfo ×1
image ×1
iphone ×1
jsp ×1
jstl ×1
locking ×1
matlab ×1
mime-types ×1
php ×1
prolog ×1
sed ×1
sharepoint ×1
string ×1
uipickerview ×1
web-config ×1