我想将PATH从Python 2.6.1更改为3.1.2.我在我的计算机上安装了两个版本,但是当我在终端中键入python --version时,我得到了Python 2.6.1,因此当前版本的"指向".现在,如果我输入Python3.1,它会将当前版本更改为我想要使用的版本,尽管PATH仍为2.6.1.下载了Python 3.1软件包来自Update Shell Profile.com,所以当我运行它然后运行nano~/.bash_profile时它会说:为Python 3.1设置PATH原始版本保存在.bash_profile.pysave PATH ="/ Library/Frameworks/Python.framework/Versions/3.1/bin:$ {PATH}"export PATH.
这是否意味着我已经更改了PATH或它只是给我指示如何?!
问候
我使用PHP与CodeIgniter(MVC框架).我的问题很简单.根据您的说法,在使用稍微复杂的网站时,这是更好的方法.
规划完成后,列出网站的所有小功能和大功能以及它们的位置,并规划数据库的表和列.
我现在只想开始一次构建一个页面.处理CSS问题,同时执行行为(JavaScript)和后端.
根据您的经验,前端完全处理所有问题,完成所有事情是否更有效率.然后研究后端逻辑?
JavaScript怎么样?(只做用户界面相关的JavaScript +验证与前端 - 然后用后端做所有AJAX调用和响应..?)
我有点不知道如何在Mathematica中有效地执行以下操作:
a = { 1, 2, 3, 4, 5 }; (* list of integers *)
b = { 2, 4, 6, 8 }; (* another list of integers *)
filter = Table[MemberQ[b, element], {element,a}]
Run Code Online (Sandbox Code Playgroud)
预期产出是:
{False, True, False, True, False}
Run Code Online (Sandbox Code Playgroud)
我的名单a,并b都大了,所以数学是线性搜索,通过做kazillion b.我希望它使用哈希表进行更快的查找.但似乎没有这样的结构.我能找到的最接近的是SparseArray,但是
sa = SparseArray[{1 -> True, 2 -> True}];
MemberQ[sa, 1]
Run Code Online (Sandbox Code Playgroud)
是False.
我确信在一行代码或更少的代码中,这在Mathematica中一定是可能的,我只是看不到树木或其他东西.
救援的任何英雄?同时,我打算用C#做这件事.
我有一个消息表,看起来像这样:
+------------+-------------+----------+
| sender_id | created_at | message |
+------------+-------------+----------+
| 1 | 2010-06-14 | the msg |
| 1 | 2010-06-15 | the msg |
| 2 | 2010-06-16 | the msg |
| 3 | 2010-06-14 | the msg |
+------------+-------------+----------|
Run Code Online (Sandbox Code Playgroud)
我想为每个发件人选择最近的单个邮件.
这看起来像GROUP BY sender_id和ORDER BY created_at,但我无法选择最新的消息.
我正在使用postgres,因此如果我想按该字段排序,则需要在SELECT语句中的created_at字段上使用聚合函数,因此我正在考虑做这样的事情作为初始测试
SELECT messages.sender_id, MAX(messages.created_at) as the_date
FROM messages
GROUP BY sender_id
ORDER BY the_date DESC
LIMIT 10;
Run Code Online (Sandbox Code Playgroud)
这似乎工作,但当我想选择'消息'时,我不知道在它上面使用什么聚合函数.我基本上只想要与MAX created_at对应的消息.
有没有办法解决这个问题,或者我是以错误的方式接近它?
我正在设计一个分布式系统,其中单线程服务器进程执行CPU密集型操作.这些操作由ZeroMQ网络消息触发.
如果单线程进程正在执行CPU密集型工作,那么I/O(ZeroMQ套接字)是否会阻塞?
谢谢!
忽略本机互操作和瞬态,是否可以在Clojure中创建包含直接循环引用的任何数据结构?
似乎不可变数据结构只能包含对其自身先前版本的引用.是否有任何Clojure API可以创建一个引用自身的新数据结构?
Scheme具有letrec形式,允许创建相互递归的结构 - 但据我所知,Clojure没有任何类似的东西.
这个问题与将Clojure移植到iOS有关 - 它没有垃圾收集,但确实有引用计数.
我正在为游戏添加Game Center支持.因为我的游戏可以在iOS版本上运行回3.0,所以我想让它在没有Game Center的情况下在本地保存成就和排行榜.
现在,我有这个:
+ (BOOL) isGameCenterAvailable {
Class playerClass = NSClassFromString( @"GKLocalPlayer" );
if( playerClass != nil && [playerClass localPlayer] != nil ) {
DebugLog( @"Game Center is available" );
return YES;
}
DebugLog( @"Game Center is NOT available" );
return NO;
}
Run Code Online (Sandbox Code Playgroud)
但是,这似乎根本不起作用.首先,尽管GKLocalPlayer参考声明此类在iOS 4.1及更高版本中可用,但上述测试在iOS 4.0中通过(我没有尝试早期版本).另外,测试还传递了具有iOS 4.1但不支持Game Center的设备(例如,iPhone 3G).
我已经在线浏览了各种GameKit和游戏中心文档,并且没有任何运气可以解决这个问题.我当然可以检测到操作系统版本,但这似乎很蹩脚.对于不支持的硬件(如3G)的情况,这也无济于事.我想也可以检测到这一点,但是再次看起来有点蹩脚.
以编程方式检测Game Center支持的"正确方法"是什么?
好的,所以我 int indexSelector = RandomNumber(1, 14);用来创建一个随机数并从数组中拉出匹配的索引.但它似乎只调用3或4个数字.就像拔出的物品非常相似.
这是怎么回事?
假设我在/A/B/a.py中有一个python脚本a.py,它位于PATH环境变量中.当前工作目录是/ X/Y /,它是我调用/A/B/a.py的目录.
我想显示一个表格,其中一些字段是可编辑的 - 请参阅此示例:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="1dip"
android:paddingRight="1dip"
android:paddingBottom="1dip"
android:background="#F00"
>
<ScrollView
android:id="@+id/ScrollView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="vertical"
>
<HorizontalScrollView
android:id="@+id/HorizontalScrollView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="horizontal"
>
<TableLayout
android:id="@+id/ItemPane"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#EEE"
>
<TableRow
android:id="@+id/DataRow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#888"
android:layout_margin="0dp"
android:gravity="left"
>
<TextView
android:id="@+id/NameField"
android:text="Fieldname"
android:background="#EEE"
android:textSize="14dp"
android:layout_margin="1dp"
android:layout_marginBottom="0dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
/>
<EditText
android:id="@+id/DataField"
android:text="some field"
android:background="#EEE"
android:textSize="14dp"
android:layout_margin="1dp"
android:layout_marginBottom="0dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:singleLine="true"
/>
<EditText
android:id="@+id/DataField2"
android:text="some longish field content..."
android:background="#EEE"
android:textSize="14dp"
android:layout_margin="1dp"
android:layout_marginBottom="0dp"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:singleLine="true"
/>
</TableRow>
</TableLayout> …Run Code Online (Sandbox Code Playgroud)