当我使用Visual C#2010 Express时,如何使用NuGet添加库包引用?
当我在工具>扩展管理器中搜索时,NuGet没有出现.
我从下载页面下载了"NuGet Package Manager"(.vsix),但当它提示我要集成哪个版本的Visual Studio时,它只列出了Visual Web Developer Express 2010.Windows C#Express未显示.所以我想它可以在VWD中使用Silverlight,但我想在WPF中使用它.
其中一个文档页面将我链接到1.0 CTP下载页面,其中包括命令行版本的NuGet(不再出现在最新版本中).但命令行版本似乎已经瘫痪 - 它似乎支持的唯一操作是构建一个分发包; 它似乎不支持添加对库包的引用的命令.
有没有办法使用NuGet与Visual C#Express?
我开始使用Fedor的ListView实现.这是我的ListView项的XML:
<?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="wrap_content">
<ImageView
android:id="@+id/image"
android:layout_width="50dip"
android:layout_height="50dip" android:src="@drawable/stub" android:scaleType="centerCrop"/>
<TextView
android:id="@+id/name"
android:layout_width="0px"
android:layout_height="0px"
android:layout_weight="0" android:textSize="20dip" android:layout_marginLeft="10dip"/>
<TextView
android:id="@+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" android:textSize="16dip" android:layout_marginLeft="10dip"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我在设备上看到的是ImageView和从左到右依次显示的两个TextView.
我想要的是右边的ImageView(这已经是正确的),imageview右侧的TextView名称(这是正确的),地址TextView,名称为TextView.我无法弄清楚如何正确布局.
请注意,我知道我可以在名称中添加一个新行,并在此之后包含地址文本,但我希望这两个元素具有不同的字体大小,因此这不是一个选项.非常感谢!
是否有可能创建一个抽象TestCase,它将有一些test_*方法,但这TestCase不会被调用,那些方法只会在子类中使用?我想我将TestCase在我的测试套件中有一个摘要,它将被子类化为单个接口的一些不同实现.这就是为什么所有测试方法都是一些,只有一个内部方法发生变化的原因.我怎么能以优雅的方式做到这一点?
我一直在研究.NET 4.0中System.Net.PeerToPeer的命名空间,这个库中提供的类似乎对构建P2P网络非常有用.但是,当我搜索示例和引用时,我只能找到仅仅指向MSDN文档的旧的过时示例或引用.似乎没有太多人使用这个库,并且没有太多的努力进入这个产品.有没有人知道我不知道的这个库的问题可能会说服我不使用它?我确实看到旧版本的Windows不支持它,但这对我来说不是一个显示阻止.还有别的事吗?
我在page.xml中看到JavaScript文件在头部设置如下:
<default>
<block type="page/html" name="root" output="toHtml" template="page/2columns-right.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs" ifconfig="dev/js/deprecation"><script>prototype/deprecation.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>scriptaculous/builder.js</script></action>
<action method="addJs"><script>scriptaculous/effects.js</script></action>
<action method="addJs"><script>scriptaculous/dragdrop.js</script></action>
<action method="addJs"><script>scriptaculous/controls.js</script></action>
<action method="addJs"><script>scriptaculous/slider.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
<action method="addJs"><script>varien/form.js</script></action>
<action method="addJs"><script>varien/menu.js</script></action>
<action method="addJs" ifconfig="dev/translate_inline/active"><script>mage/translate.js</script></action>
<action method="addJs"><script>mage/cookies.js</script></action>
<action method="addCss"><stylesheet>css/screen.css</stylesheet></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 8</if></action>
<action method="addItem"><type>skin_css</type><name>css/styles-ie8.css</name><params/><if>IE 8</if></action>
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>js</type><name>varien/iehover-fix.js</name><params/><if>lt IE 7</if></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
<block type="page/html" name="store_language_js" as="store_language_js" template="page/html/head-translator.phtml"/>
</default>
Run Code Online (Sandbox Code Playgroud)
但是,如果我想把它们移到底部,我会做以下几点吗?
<reference name="head">
<action method="unsetData">
<name>items</name>
</action><!– There are now no CSS/JavaScript links in the head …Run Code Online (Sandbox Code Playgroud) 所以,我的代码(Perl脚本和Perl模块)就像这样一棵树:
trunk/
util/
process/
scripts/
Run Code Online (Sandbox Code Playgroud)
'util'目录有实用程序,'process /'目录中的东西需要.他们像这样访问:
use FindBin;
use lib "$FindBin::Bin/../util";
use UtilityModule qw(all);
Run Code Online (Sandbox Code Playgroud)
只要你在树中与"util /"处于同一级别,那个结构并不关心你从哪里开始.
但我觉得'scripts /'过于拥挤,所以我创造了
scripts/scripts1
scripts/scripts2
Run Code Online (Sandbox Code Playgroud)
现在我看到这不起作用.如果我运行脚本'trunk/scripts/scripts1/call_script.pl',并且它调用'/trunk/process/process_script.pl',那么'process_script.pl'将无法尝试从UtilityModule()获取例程,因为FindBin返回的路径是顶级调用脚本的路径.
我想到的解决这个问题的前十种方法都涉及到:
use lib $path_that_came_from_elsewhere;
Run Code Online (Sandbox Code Playgroud)
但这似乎是Perl不喜欢做的事情,除了通过FindBin技巧.
我尝试了一些涉及BEGIN {}块的事情,但我真的不知道我在那里做什么,并且很可能最终会重构.但如果有人对这类问题有一些聪明的洞察力,那么这将是获得一些积分的好机会!
我正在将应用程序重命名为更合适的名称.在这样做时,我想确保South正确迁移数据库(重命名数据库表并更改django_content_type或south_migrationhistory中的引用).我知道如何将模型迁移到其他应用程序,但是当我尝试重命名应用程序本身时,South无法正确识别迁移历史记录.
不受欢迎的解决方案:在重命名时old_app,new_app我可以old_app/migrations完整保留并添加新的迁移到此目录以将数据库迁移到引用new_app.
如果可能的话我宁愿old_app完全删除目录.我还没有想过更好地解决这个问题.
使用Django South重命名应用程序而不丢失数据的最佳方法是什么?
我有一个问题:
select country_region,
country_subregion,
country_name,
calendar_year,
calendar_quarter_number,
sum(amount_sold) as amount
from countries co join
customers cu on co.country_id = cu.country_id join
sales sa on cu.cust_id = sa.cust_id join
times ti on sa.time_id = ti.time_id
where ( co.country_region = 'Americas'
or co.country_region = 'Middle East'
)
and ti.calendar_year between 2000 and 2001
group by grouping sets
(
(country_region, country_subregion, country_name, calendar_year, calendar_quarter_number),
(country_region, country_subregion, country_name, calendar_year),
(country_region, country_subregion, country_name),
(country_region, country_subregion, calendar_year, calendar_quarter_number),
(country_region, country_subregion, calendar_year),
(country_region, country_subregion),
(country_region, calendar_year, calendar_quarter_number), …Run Code Online (Sandbox Code Playgroud) 在代码中使用 TransitionDrawable 的预期方式是什么?有什么例子吗?
我制作了一个小型测试应用程序来奠定一些背景:
public class SkeletonActivity extends Activity {
private Button b;
private ImageView iv;
private TransitionDrawable transition;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Inflate our UI from its XML layout description.
setContentView(R.layout.skeleton_activity);
// Hook up button presses to the appropriate event handler.
b = ((Button) findViewById(R.id.button));
b.setOnClickListener(mButtonListener);
iv = ((ImageView) findViewById(R.id.image));
//XML-based code
transition = (TransitionDrawable)getResources().getDrawable(R.drawable.trans).mutate();
transition.setDrawableByLayerId(transition.getId(0), getResources().getDrawable(R.drawable.trans3));
transition.setDrawableByLayerId(transition.getId(1), getResources().getDrawable(R.drawable.trans4));
//Pure programmatic code
transition = new TransitionDrawable(new Drawable[] {getResources().getDrawable(R.drawable.trans3), getResources().getDrawable(R.drawable.trans4)});
transition.setCrossFadeEnabled(true);
}
OnClickListener mButtonListener = new …Run Code Online (Sandbox Code Playgroud) 我正在使用随机创建的索引将一些项插入到数组中,例如:
var myArray = new Array();
myArray[123] = "foo";
myArray[456] = "bar";
myArray[789] = "baz";
...
Run Code Online (Sandbox Code Playgroud)
换句话说,数组索引不以零开头,它们之间会有"数字间隙".我的问题是:
编辑:关于插入/删除后重新定位项目的问题/关注 - 我想知道内存发生了什么,而不是索引.来自维基百科文章的更多信息:
链接列表与动态数组相比有几个优点.在列表的特定点处插入元素是恒定时间操作,而在随机位置插入动态数组将需要平均移动一半元素,并且在最坏情况下移动所有元素.虽然可以通过某种方式将其插槽标记为"空闲"而在恒定时间内从数组中"删除"元素,但这会导致碎片阻碍迭代的执行.
.net ×2
android ×2
javascript ×2
android-xml ×1
arrays ×1
c# ×1
django ×1
django-south ×1
magento ×1
migration ×1
networking ×1
nuget ×1
oracle ×1
p2p ×1
perl ×1
python ×1
rename ×1
rollup ×1
sql ×1
testcase ×1
transition ×1
unit-testing ×1
xml ×1