我正在尝试fs在我的renderer流程中使用 Node 模块(在本例中为),如下所示:
// main_window.js
const fs = require('fs')
function action() {
console.log(fs)
}
Run Code Online (Sandbox Code Playgroud)
注意:action当我按下main_window.
但这给出了一个错误:
Uncaught ReferenceError: require is not defined
at main_window.js:1
Run Code Online (Sandbox Code Playgroud)
我可以解决这个问题,正如这个接受的答案所建议的那样,通过main.js在初始化时将这些行添加到我的main_window:
// main.js
main_window = new BrowserWindow({
width: 650,
height: 550,
webPreferences: {
nodeIntegration: true
}
})
Run Code Online (Sandbox Code Playgroud)
但是,根据 docs,这不是最好的做法,我应该创建一个preload.js文件并在那里加载这些 Node 模块,然后在我的所有renderer进程中使用它。像这样:
main.js:
main_window = new BrowserWindow({
width: 650,
height: 550,
webPreferences: {
preload: path.join(app.getAppPath(), 'preload.js') …Run Code Online (Sandbox Code Playgroud) 我创建了一个csv文件并尝试通过电子邮件发送它.显示发送邮件的窗口,但不填充电子邮件正文,也没有附加文件.应用程序挂起此屏幕:
按钮"取消"不起作用.在控制台中出现几秒钟后:
viewServiceDidTerminateWithError: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 3.)" UserInfo=0x7f8409f29b50 {Message=Service Connection Interrupted}
<MFMailComposeRemoteViewController: 0x7f8409c89470> timed out waiting for fence barrier from com.apple.MailCompositionService
Run Code Online (Sandbox Code Playgroud)
有我的代码:
func actionSheet(actionSheet: UIActionSheet!, clickedButtonAtIndex buttonIndex: Int) {
if buttonIndex == 0 {
println("Export!")
var csvString = NSMutableString()
csvString.appendString("Date;Time;Systolic;Diastolic;Pulse")
for tempValue in results { //result define outside this function
var tempDateTime = NSDate()
tempDateTime = tempValue.datePress
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy"
var tempDate = dateFormatter.stringFromDate(tempDateTime)
dateFormatter.dateFormat = "HH:mm:ss"
var tempTime …Run Code Online (Sandbox Code Playgroud) ios uidocumentinteraction mfmailcomposer uiactivityviewcontroller
我无法在Intellij IDEA中调试我的代码.当调试模式处于活动状态且正在运行时,但断点没有选中表示有效且可停止的断点的"v".
见图像:http://prntscr.com/1w0owu.
我真的在网上搜索答案.我想做什么?
我的规格:英特尔酷睿i5-3470 3,2 GHz/4 GB Ram /我使用的是Windows 64位.PyCharm 4.0.5
当我启动PyCharm时,它开始'扫描文件以索引'后台任务并且永久地挂起约1小时.它不时完成并继续更新索引任务.它持续约3个小时/永久.虽然这个过程正在运行,但很难使用PyCharm甚至其他一些程序.PyCharm从大约200 mb开始,在这项任务结束时占用了大约1GB的内存.
在我的笔记本电脑上,这更糟糕.PyCharm在30秒内发射并准备工作.我在我的电脑/笔记本电脑上从事同一个项目
请指教.
PS我没有在我的项目结构中排除的simlinks
我有一个JS功能规范,我正试图与Capybara Webkit一起运行.但它似乎无法找到我的数据库记录.
有问题的规范看起来像这样
it "should allow pledging to a Hardback level", js: true do
book = FactoryGirl.create :book
visit book_path(book)
click_link "pledge-btn"
end
Run Code Online (Sandbox Code Playgroud)
不幸的是,book_path(book)404s 的请求因为无法找到该书.
如果我取下:js旗帜,测试通过.
我建议DatabaseCleaner使用:truncationJS规范作为推荐的方法.
# spec/support/database_cleaner.rb
RSpec.configure do |config|
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, :js => true) do
DatabaseCleaner.strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
DatabaseMetadata.create!(:sanitized_at => DateTime.now)
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Run Code Online (Sandbox Code Playgroud)
我可以puts在测试中找到这本书,它会被发现. …
我在我的网站上发现了jQuery UI Datepicker的问题.
当我点击输入时,它确实显示了一个日期选择器.然而,当我没有选择任何日期并且我只是在元素外部点击时,它不会像我期望的那样隐藏日期选择器.
当我按Esc时,它会消失,当我选择一天它消失但当我点击外面时它会停留在那里.
有没有人能够找到问题?
提前致谢 :)
我已经设法将一帧电影的视频轨道加载到带AVFoundation的OpenGL纹理中.我按照答案中描述的步骤进行操作:iOS4:如何将视频文件用作OpenGL纹理? 并从WWDC2010的GLVideoFrame示例中获取了一些代码,可以在此处下载:http://bit.ly/cEf0rM
如何与视频同步播放电影的音轨.我认为在单独的播放器中播放它并不是一个好主意,而是使用相同的音频轨道OpenGL.
AVAssetTrack* audioTrack = [[asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)
我检索了一个videoframe,它是CADisplayLink-callback中的时间戳
CMSampleBufferRef sampleBuffer = [self.readerOutput copyNextSampleBuffer];
CMTime timestamp = CMSampleBufferGetPresentationTimeStamp( sampleBuffer );
Run Code Online (Sandbox Code Playgroud)
哪里AVFoundation是类型GLVideoFrame
如何获得相应的音频样本?以及如何玩它们?
编辑:
我看了一下,我想,最好是使用WWDC2010AudioToolbox.framework使用此处描述的方法:AVAssetReader和Audio Queue流问题
AVFoundation中还有一个音频播放器:AVAsset.但我不知道我应该如何将数据传递给它所readerOutput期望的-initializer AVAssetReaderTrackOutput*.此外,我不认为这是我的最佳选择,因为我AudioQueue必须为每个新的音频样本创建一个新的实例,据我所知.
还有其他建议吗?播放原始音频样本的最佳方式是AudioToolbox.framework什么?
我有一个基于jQuery的表单,您可以在其中添加额外的人员到应用程序.我正在克隆第一个字段集并将其添加到最多3个额外的人.当您添加1个额外的人时,您可以选择删除该人.
但是,我的删除按钮不起作用.早些时候,直到我将额外的函数添加到克隆中才能更改字段集中其他元素的ID.
我正在使用:
$(".remove").click(function() {
$(this).parent().remove();
Run Code Online (Sandbox Code Playgroud)
这是最初的工作,但现在它不是,我无法弄清楚为什么.
我已经删除了第一个"删除这个人"的行,只是为了表明第一个仍然有效,但其余的则没有.(当它被修复时,我将最终将第一个定位在舞台上)
可能更容易看到它所以我把它放在这里http://bit.ly/kHcAbe
基本上,除了第一部分之外,为什么我的"删除这个人"的任何想法都不起作用?
我习惯了安装包的R功能,我正在尝试用ipython做同样的事情.有时候下面的方法有效,但有时它却没有,我想终于找出为什么它只能工作一半的时间.
通常安装模块(例如ipython模块)我打开一个新终端后会输入以下内容:
$ sudo pip install requests
Password: *******
Run Code Online (Sandbox Code Playgroud)
然后会出现一条消息,指示安装已成功完成或已安装.
Requirement already satisfied (use --upgrade to upgrade):
requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Cleaning up...
Run Code Online (Sandbox Code Playgroud)
这表明可以访问代码.事实上,如果我现在从终端运行python,它会显示出良好的响应,而不会出现任何错误.
$ python
ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:20:15)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>>
Run Code Online (Sandbox Code Playgroud)
我现在通过Alfred打开PyLab,它给了我一个错误.
Welcome to pylab, a matplotlib-based Python environment [backend: WXAgg].
For more information, type 'help(pylab)'.
In [1]: import …Run Code Online (Sandbox Code Playgroud) 我对PhoneGap文档感到困惑:
我根据(1)添加了相机模块.但是在(2)中,有信息说我应该补充
<plugin name="Capture" value="org.apache.cordova.Capture"/>
Run Code Online (Sandbox Code Playgroud)
也可以app/res/xml/plugins.xml编辑和编辑app/AndroidManifest.xml文件.
参考3),还有一些信息表明<plugin ... />构造已经过时,开发人员应该使用<gap:plugin ... />.
有人,请帮忙理解.