我正在建立一个英语/法语网站,并想知道是否有这样一份工作的最佳实践.
复制网站并使用适当的网站制作法语和英语文件夹.
使用PHP将内容与html标签交换.例如.如果($ LANG == '恩'):
使用php只交换保留html标签的内容两者相同.例如.如果声明到处都是.这对效率有害吗?
任何其他建议将不胜感激
我正在尝试解析YouTube API的结果.我正确地将结果作为字符串获取,但无法正确解析它.
我按照前一个帖子的建议,但没有得到任何结果.
我的示例代码是:
string response = youtubeService.GetSearchResults(search.Term, "published", 1, 50);
XDocument xDoc = XDocument.Parse(response, LoadOptions.SetLineInfo);
var list = xDoc.Descendants("entry").ToList();
var entries = from entry in xDoc.Descendants("entry")
select new
{
Id = entry.Element("id").Value,
Categories = entry.Elements("category").Select(c => c.Value)
//Published = entry.Element("published").Value,
//Title = entry.Element("title").Value,
//AuthorName = entry.Element("author").Element("name").Value,
//Thumnail = entry.Element("media:group").Elements("media:thumnail").ToList().ElementAt(0)
};
foreach (var entry in entries)
{
// entry.Id and entry.Categories available here
}
Run Code Online (Sandbox Code Playgroud)
问题是条目的计数为0,即使XDocument明显具有有效值.
响应变量(Sample XML)的值可以在这里看到:http://snipt.org/lWm
(仅供参考:此处列出了youTube架构:http://code.google.com/apis/youtube/2.0/developers_guide_protocol_understanding_video_feeds.html)
谁能告诉我这里我做错了什么?
我需要在我的where子句中编写一个条件语句,该子句根据传递给过程的参数使用不同的运算符.我似乎无法找到可行的语法.
我的例子如下:
@DateValue datetime
select *
from table
where field1 = 'x'
and field2 = 'y'
and if @DateValue = '1/1/1900' then
field3 <= getdate()
else
field3 = @DateValue
end
Run Code Online (Sandbox Code Playgroud)
感谢大家的帮助.
我有这个字符串
String myString ="A~BC~FGH~~zuzy|XX~ 1234~ ~~ABC~01/01/2010 06:30~BCD~01/01/2011 07:45";
Run Code Online (Sandbox Code Playgroud)
我需要提取这3个子串
1234
06:30
07:45
如果我使用这个正则表达式\\ d {2} \:\\ d {2}我只能提取第一个小时06:30
Pattern depArrHours = Pattern.compile("\\d{2}\\:\\d{2}");
Matcher matcher = depArrHours.matcher(myString);
String firstHour = matcher.group(0);
String secondHour = matcher.group(1); (IndexOutOfBoundException no Group 1)
Run Code Online (Sandbox Code Playgroud)
matcher.group(1)抛出异常.
另外我不知道如何提取1234.这个字符串可以改变,但它总是在'XX~'后面
你有没有想过如何匹配这些字符串与正则表达式?
UPDATE
感谢亚当的建议,我现在这个正则表达式匹配我的字符串
Pattern p = Pattern.compile(".*XX~ (\\d{3,4}).*(\\d{1,2}:\\d{2}).*(\\d{1,2}:\\d{2})";
Run Code Online (Sandbox Code Playgroud)
我匹配数字,与matcher.group(1)匹配2小时; matcher.group(2); matcher.group(3);
如果你不知道,python turtle是一个帮助人们学习python的应用程序.您将获得一个python解释器和一个屏幕上的乌龟,您可以将指示传递给使用python.
go(10)将使龟移动10个像素转(10)将使其顺时针转10度
现在看看这个
alt text http://i28.tinypic.com/29bzoet.jpg
码:
import random
while(1):
r = random.randint(1,10)
go (r)
r = random.randint(-90,90)
turn (r)
Run Code Online (Sandbox Code Playgroud)
有谁能解释这种行为?注意直线.蟒蛇随机模块有什么问题吗?
我有这样的事情:
class X():
def __init__(self):
self.__name = None
def _process_value(self, value):
# do something
pass
def get_name(self):
return self.__name
def set_name(self, value):
self.__name = self._process_value(value)
name = property(get_name, set_name)
Run Code Online (Sandbox Code Playgroud)
我可以替换get_name和set_name使用lambda函数吗?
我试过这个:
name = property(lambda self: self.__name, lambda self, value: self.__name = self.process_value(value))
Run Code Online (Sandbox Code Playgroud)
但编译器不喜欢我的setter函数.
我有一个包含链接的内容占位符:
<asp:Content ID="Content5" runat="server" contentplaceholderid="ContentPlaceHolder3">
<a href= "../WOPages/WO_Main.aspx?WONum=12345">WorkOrder</a>
Run Code Online (Sandbox Code Playgroud)
我想从代码中更改href查询字符串.如何找到它来改变它?
有没有办法将字符串转换为可在Web文档中正确显示的字符串?例如,更改字符串
"<Hello>"
Run Code Online (Sandbox Code Playgroud)
至
"<Hello>"
Run Code Online (Sandbox Code Playgroud) 我有一个Intel四核CPU.
如果我要开发一个仅在我的机器上使用的Winforms应用程序(我使用C#btw),我可以生成多少个线程?
核心和我可以在任何时间运行的最大线程数之间是否存在某种相关性?我是否需要在任何时候找出有多少线程在运行?如果有,这可能吗?(我知道有最小和最大线程的属性)?这取决于线程池(此池中线程的最大数量是否会发生变化?).这是这个帖子/帖子的C#部分.
推锁在 Windows 内部用作其某些操作的同步原语,特别是作为内存管理器的一部分。
究竟什么是推锁?它与自旋锁有何不同?
c# ×3
java ×2
python ×2
architecture ×1
asp.net ×1
concurrency ×1
hardware ×1
html ×1
internals ×1
lambda ×1
linq-to-xml ×1
multilingual ×1
php ×1
properties ×1
random ×1
regex ×1
sql ×1
sql-server ×1
syntax ×1
templates ×1
xml ×1