我有一个运行全新安装的Ubuntu 10.04 LTS的VPS.我正在尝试使用Flask微框架设置一个实时应用程序,但它给了我麻烦.当我试图让它运行时我记笔记,这是我的逐个播放,以确定我出错的确切位置.
http://flask.pocoo.org/docs/installation/#installation
$ adduser myapp
$ sudo apt-get install python-setuptools
$ sudo easy_install pip
$ sudo pip install virtualenv
/home/myapp/
-- www/
$ sudo pip install virtualenv
/home/myapp/
-- www/
-- env/
$ . env/bin/activate
$ easy_install Flask
Run Code Online (Sandbox Code Playgroud)
http://flask.pocoo.org/docs/deploying/mod_wsgi/
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-wsgi
Run Code Online (Sandbox Code Playgroud)
$ nano /home/myapp/www/myapp.wsgi
--myapp.wsgi contents:--------------------------
activate_this = '/home/myapp/env/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
from myapp import app as application
/home/myapp/
-- www/
-- myapp.wsgi
-- env/
Run Code Online (Sandbox Code Playgroud)
$ nano …Run Code Online (Sandbox Code Playgroud) 在Objective-C块的实现中调用超级方法吗?
当我在super上调用一个方法时,会抛出一个EXC_BAD_ACCESS错误但是只要我将这些调用改为[super methodToCall],[self methodToCall]并让消息向上移动响应者链就可以了.
-methodToCall在该类的实例中没有该块存在的实现,但是在超类中有一个(即,自己继承自的类).
我只是好奇地了解为什么在一个块的实现中调用一个方法在一开始是一个问题(技术上),所以我可以在将来避免它.我怀疑它与块中如何捕获变量以及堆栈和堆有关,但我真的没有具体的想法.
注意:在块存储在属性中之后几秒钟就会调用块实现代码,该属性使用copy,所以我不认为这是块的生命周期的问题,所有看起来都没问题.此外,这只是在iPhone设备(3G)上崩溃,但在iPhone模拟器中没有崩溃.
结果EXC_BAD_ACCESS:
[self retrieveItemsForId:idString completionHandler:^(NSError *error) {
if (!error) {
[super didRetrieveItems];
} else {
[super errorRetrievingItems];
}
}];
Run Code Online (Sandbox Code Playgroud)
完美,实现-didRetrieveItems和-errorRetrievingItems超级类.
[self retrieveItemsForId:idString completionHandler:^(NSError *error) {
if (!error) {
[self didRetrieveItems];
} else {
[self errorRetrievingItems];
}
}];
Run Code Online (Sandbox Code Playgroud) 我有点难过这个.我使用Protovis(一个JS库)渲染SVG可视化,它在Chrome和Firefox中运行良好.我将渲染的SVG保存在我的服务器上,并尝试使用PHP函数在"图库"视图中重新渲染它,这在Firefox中失败了.我所看到的只是SVG中的文本,而不是SVG.
我保存完整的svg内容,如下所示:
<svg height="220" width="880" stroke-width="1.5" stroke="none" fill="none" font-family="sans-serif" font-size="10px"><g transform="translate(30, 10)"><line stroke-width="1"
Run Code Online (Sandbox Code Playgroud)
我尝试过使用,<object>但所有这一切都是提示Firefox下载一个它找不到的插件.
它适用于FF4测试版,但我不明白为什么它甚至在Firefox 3.6中都不起作用.这是我应该放弃的吗?你可以在这里看到一个演示:
http://www.rioleo.org/protoviewer(点击"图库")
再次感谢!
由于D很大,我没有足够的内存来简单地创建对角D-by-D矩阵.我不断收到"内存不足"的错误.
我没有在第一次乘法中执行M x D x D操作,而是执行M x D操作,但我的代码仍然需要很长时间才能运行.
任何人都可以找到一种更有效的方法来执行乘法运算A'*B*A吗?这是我到目前为止所做的尝试:
D=20000
M=25
A = floor(rand(D,M)*10);
B = floor(rand(1,D)*10);
for i=1:D
for j=1:M
result(i,j) = A(i,j) * B(1,j);
end
end
manual = result * A';
auto = A*diag(B)*A';
isequal(manual,auto)
Run Code Online (Sandbox Code Playgroud)

algorithm matlab linear-algebra octave matrix-multiplication
我的问题描述有点棘手.
我的项目(和apk文件)中有一个单独的资源文件夹.
String path = "/resources/instruments/data/bongo/audio/bong1.wav";
Run Code Online (Sandbox Code Playgroud)
我已经可以用了
url = StreamHelper.class.getClassLoader().getResource( path );
url.openStream();
Run Code Online (Sandbox Code Playgroud)
但实际上我想将文件加载到SoundPool中.我这样试过:
SoundPool soundPool = new SoundPool( 5, AudioManager.STREAM_MUSIC, 0 );
soundPool.load ( path, 1 );
Run Code Online (Sandbox Code Playgroud)
...但我总是得到一个错误信息:"错误加载/资源..."
load(String path,int) 在这个链接上,我看到我需要File的正确路径
File file = new File( path );
if( file.exists() )
//always false but i thing if it would be true soundPool.load should work too
Run Code Online (Sandbox Code Playgroud)
现在我的问题是:它的运作方式如何.或者我的问题还有其他任何想法(使用AssetManager)?
顺便说一句.我知道有一些特殊的Android方法可以获得像R.id.View这样的资源......但在我的情况下,它并不容易处理.
谢谢!
<configdata>
<home>
<label>Home</label>
<controller>dashboard</controller>
<action>index</action>
</home>
<accounts>
<label>Accounts</label>
<controller>accounts</controller>
<action>index</action>
<pages>
<sales>
<label>Sales Accounts</label>
<controller>sale</controller>
<action>index</action>
</sales>
<purchase>
<label>Purchase Accounts</label>
<controller>purchase</controller>
<action>index</action>
</purchase>
</pages>
</accounts>
</configdata>
Run Code Online (Sandbox Code Playgroud)
我有类似上面的代码.我需要为Accounts标签后生成的ul标签添加一个类.像下面这样的东西不起作用:
<pages class="sub">
<sales>
........
</sales>
</pages>
Run Code Online (Sandbox Code Playgroud)
我的目的是为导航提供一个大型菜单.要向其添加功能,我需要在生成的菜单代码中包含类.
我通过执行以下操作成功地将MPMoviePlayerController放入UIPopoverController:
NSString *filenameString = [NSString stringWithString:[[helpVideosArray objectAtIndex:tagNumber] objectForKey:VIDEO_FILE_NAME]];
HelpVideoPopover *helpVideoPopover = [[HelpVideoPopover alloc] initWithVideoFilename:filenameString PreviewFrameView:self];
currentPopover = [[[[UIPopoverController alloc] initWithContentViewController:helpVideoPopover] retain] autorelease];
[currentPopover setPopoverContentSize:CGSizeMake(320, 240)];
[currentPopover presentPopoverFromRect:((UIButton*)sender).frame inView:previewView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
currentPopover.passthroughViews = [NSArray arrayWithObject:((HelpVideoPopover*)[currentPopover contentViewController]).movieController.view];
Run Code Online (Sandbox Code Playgroud)
问题是,当用户想要全屏观看视频(并且我允许)时,弹出视图位于全屏视频的顶部.所以我的问题是,我应该做另一件事.或者也许当我显示popover时,我只是使用一个空白的并从父视图控制器覆盖它上面的电影播放器?我真的希望将影片播放器逻辑保留在弹出窗口控制器中.
我需要开发一大组工具来从服务器命令行运行(即不是客户端 - 服务器架构).系统不一定是高性能的; 我只想要一些容易开发的东西.
我可以使用哪些技术来构建从命令行运行的简单GUI?我只需要菜单,我可以在对话框中选择一行/复选框/输入自由文本.
编辑:忘了添加,访问Mysql(即驱动程序可用)是必不可少的.
我注意到了
@Override
public boolean onCreateOptionsMenu(Menu menu) {
Run Code Online (Sandbox Code Playgroud)
只被召唤一次.我需要在每次显示菜单时调用它,因为我根据应用程序状态在菜单中添加/删除项目.
这可能吗?
android ×2
algorithm ×1
apache2 ×1
block ×1
cocoa ×1
cocoa-touch ×1
command-line ×1
file ×1
firefox ×1
flask ×1
fullscreen ×1
ipad ×1
java ×1
javascript ×1
jquery ×1
linux ×1
matlab ×1
mod-wsgi ×1
objective-c ×1
octave ×1
path ×1
php ×1
protovis ×1
python ×1
soundpool ×1
svg ×1
virtualenv ×1