是否有django的即插即用博客APPS,如果有,请指出它的来源.
我实际上看起来像word press,这很难与django集成.
谢谢..
我使用以下内容来读取制表符分隔文件.文件中有三列,但是当我打印列标题时,第一列被忽略.我也可以包含第一列
f = open("/tmp/data.txt")
for l in f.readlines():
print l.strip().split("\t")
break
f.close()
Run Code Online (Sandbox Code Playgroud)
输出:['session_id\t','\ tevent_id_concat']
第一列名称是id不在上面的数组中打印的位置
EDIT
print l产生以下结果
编辑1:
'id\tsession_id\tevent_id_concat\r\n'
Output: ['id\t', '\tevent_id_concat']
Run Code Online (Sandbox Code Playgroud) 在下面的代码中如何在validate函数中传递div对象
<div><input type="text"></input>   <a href="#" onclick="validate("Hot to pass the div objevt here")"</input>
<script>
function validate()
{
.....
.....
Finally remove the div
}
</script>
Run Code Online (Sandbox Code Playgroud) 如果从下拉框中选择Tom,我如何使用jQuery获取名称而不是值,以便得到的输出是Tom?
<select id="emp" >
<option value=1>Tom</option>
<option value=12>Harold</option>e
<option value=32>Jenny</option>
</select>
Run Code Online (Sandbox Code Playgroud) 如何在django模板中访问字典值?我想a实际得到变量的值
class Emp(models.Model):
name = models.CharField(max_length=255, unique=True)
address1 = models.CharField(max_length=255)
def get_names(self):
names = {}
names_desc = {}
nbl = {}
names.update({'a' : 1})
names_desc.update({'b' : 2})
nbl.update({'names' : names,'names_desc' : names_desc})
return nbl
Run Code Online (Sandbox Code Playgroud)
emp是我的对象,我传递给模板它是{{emp.get_names}} ?? 或{{emp.get_names.names.a}}
我将值arr1设为25,26,将arr2值设为A,B
它始终是arr1和arr2中的值的数量相等
我的问题是
for i in arr1.split(","):
print i //prints 25 and 26
Run Code Online (Sandbox Code Playgroud)
是不是可以在同一个循环中获取arr2的值,或者是否应该仅为此目的编写另一个循环.基本上,想法是映射arr1和arr2的值
我们如何将本地目录中的存储库克隆到远程机器目录
machine1:/usr/rep/ -> clone this to machine2:/var/new_repo
Run Code Online (Sandbox Code Playgroud)
实际的命令是什么
EDIT1
我正在尝试从 machine1 创建克隆
EDIT2
我也尝试过以下方法,git clone --bare user@anothersite.com/usr/repo /var/repo/不确定这是否是正确的方法
EDIT3
这是执行EDIT2中的命令后的错误
You have no controlling tty and no DISPLAY. Cannot read passphrase. fatal: The remote end hung up unexpectedly
================================================Initialized empty Git repository
in /var/repo/ DEBUG: remote_exec loop:$stderr: Initialized empty Git repository
in /var/repo/ DEBUG: create_repoX loop: $stdout: DEBUG: create_repoX loop:
$stderr: Initialized empty Git repository in /var/repo/ DEBUG: create_repoX loop: $exit: 32768
Run Code Online (Sandbox Code Playgroud) 在以下命令中,我只想搜索非隐藏的目录,如何使用以下命令执行此操作.在搜索日志文件时,忽略隐藏的目录
find /home/tom/project/ -name '.log.txt'
ls /home/tom/project/
dir1
dir2
.backup
.snapshot/
.ignore/
Run Code Online (Sandbox Code Playgroud) 这是我的图库程序,我在其中显示静态文件的内容,如何修改此程序以显示SD卡中的照片,如果没有照片或SD卡发出警报
package DisplayViewsExample.com;
import android.app.Activity;
import android.os.Bundle;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
public class DisplayViewsExampleActivity extends Activity {
Integer[] imageIDs = {
R.drawable.sample_1,
R.drawable.sample_2,
R.drawable.sample_3
};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Gallery gallery = (Gallery) findViewById(R.id.gallery1);
gallery.setAdapter(new ImageAdapter(this));
gallery.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView parent,
View v, int position, long id) …Run Code Online (Sandbox Code Playgroud) 在下面的代码中,我看到了echo1语句,之后我在 UI 上看不到任何内容。用户名和密码是正确的。但是 PHP 似乎并没有连接到 MySQL。甚至不要看到 die 声明我做错了什么。之后mysql_connect遇到的代码的其余部分不工作:
<?php
echo "echo1==========";
$con = mysql_connect("localhost","root", "xxxx123") or die("Error connecting to database");
echo "+++++++++ echo2";
echo $con;
mysql_close($con);
?>
Run Code Online (Sandbox Code Playgroud)