如果您对Linux-(type,vim)感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Linux-(type,vim)的各种细节,此外还有关于c–支持linux/types.hOSX、com.
如果您对Linux-(type,vim)感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Linux-(type,vim)的各种细节,此外还有关于c – 支持linux / types.h OSX、com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl的实例源码、DtypeWarning: Columns (1,5,7,16,......) have mixed types. Specify dtype option on import or set l...、flultter listview 异常 type ''(BuildContext, int) => dynamic'' is not a subtype of type ''...的实用技巧。
本文目录一览:- Linux-(type,vim)
- c – 支持linux / types.h OSX
- com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl的实例源码
- DtypeWarning: Columns (1,5,7,16,......) have mixed types. Specify dtype option on import or set l...
- flultter listview 异常 type ''(BuildContext, int) => dynamic'' is not a subtype of type ''...
Linux-(type,vim)
type 命令
1.命令格式:
type [参数][命令]
2.命令功能:
使用 type 命令轻松找出给定的命令是否是别名、shell 内置命令、文件、函数或关键字。也可以找到命令的实际路径。
3.命令参数:
-p 选项找出给定 Linux 命令的绝对路径。
-a 标志显示给定命令的类型及其绝对路径。
4.使用实例:
➜ ~ type ls
ls is an alias for ls -G
➜ ~ type type
type is a shell builtin
➜ ~ type mkdir
mkdir is /bin/mkdir
➜ ~ type -a ls
ls is an alias for ls -G
ls is /bin/ls
➜ ~ type -p ls
ls is /bin/ls
Vi/Vim 编辑器
命令模式
命令模式下,可以执行保存文件、在 VI 内运行命令、复制 / 剪切 / 粘贴操作,以及查找 / 替换等任务。处于插入模式时可以按下 Escape(Esc)键返回命令模式。
插入模式
在插入模式下,可以键入文件内容。在命令模式下按下 i 进入插入模式。
退出 Vi
按下 Esc 键进入命令模式。根据不同的需要分别使用两种命令退出 Vi:
- 不保存退出 – 在命令模式中输入 :q!
- 保存并退出 – 在命令模式中输入 :wq
移动光标
k 将光标上移一行
j 将光标下移一行
h 将光标左移一个字母
l 将光标右移一个字母
ps:如果你想通过一个命令上移或下移多行,或者左移、右移多个字母,你可以使用 4k 或者 5j,这两条命令会分别上移 4 行或者右移 5 个字母。
0 将光标移动到该行行首
$ 将光标移动到该行行尾
nG 将光标移动到第 n 行
G 将光标移动到文件的最后一行
{ 将光标移动到上一段
} 将光标移动到下一段
编辑文本
进入插入模式来编辑当前文件:
i 在光标所在行的位置插入内容
I 在光标所在行的行首插入内容
a 在当前光标之后插入内容
A 在光标所在行尾插入内容
o 在当前光标所在行之后添加一行
O 在当前光标所在行之前添加一行
删除文本
在命令模式下使用:
dd 删除光标所在的整行内容,可以在 dd 前增加数字,比如 2dd 可以删除从光标所在行开始的两行
d$ 删除从光标所在行开始的所有行
d^ 删除从文件开始直到光标所在行的所有行
dw 删除从光标所在位置直到下一个词开始的所有内容
复制与黏贴
yy 复制当前行,在 yy 前添加数字可以复制多行
p 在光标之后粘贴复制行
P 在光标之前粘贴复制行
c – 支持linux / types.h OSX
Fatal error: 'linux/types.h' file not found
当我更改为sys / types.h,现在我得到…
error: unkNown type name '__s32' unkNown type name '__u8' unkNown type name '__u16' etc
有人可以帮我解决这个问题吗?
解决方法
解决问题的最简单的办法是通过你的程序来替换所有的实例
#include "linux/types.h"
有了这个:
#include "my_linux_types.h"
…并写入一个名为my_linux_types.h的新头文件,并将其添加到您的项目中;它会看起来像这样:
#ifndef my_linux_types_h#define my_linux_types_h#ifdef __linux__# include "linux/types.h"#else# include <stdint.h>typedef int32_t __s32;typedef uint8_t __u8;typedef uint16_t __u16;[... and so on for whatever other types your program uses ...]#endif#endif
com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl的实例源码
private void setUpProject() throws IOException { File tempDirectory = FileUtil.createTempDirectory(myName,""); PlatformTestCase.synchronizeTempDirVfs(LocalFileSystem.getInstance().refreshAndFindFileByIoFile(tempDirectory)); myFilesToDelete.add(tempDirectory); String projectPath = FileUtil.toSystemIndependentName(tempDirectory.getPath()) + "/" + myName + ProjectFileType.DOT_DEFAULT_EXTENSION; ByteArrayOutputStream buffer = new ByteArrayOutputStream(); new Throwable(projectPath).printstacktrace(new PrintStream(buffer)); myProject = PlatformTestCase.createProject(projectPath,buffer.toString()); EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() { @SuppressWarnings("TestOnlyProblems") @Override public void run() throws Throwable { ProjectManagerEx.getInstanceEx().openTestProject(myProject); for (ModuleFixtureBuilder moduleFixtureBuilder : myModuleFixtureBuilders) { moduleFixtureBuilder.getFixture().setUp(); } LightPlatformTestCase.clearuncommittedDocuments(myProject); ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue(); } }); }
public static void doSetup(@NotNull LightProjectDescriptor descriptor,@NotNull LocalinspectionTool[] localinspectionTools,@NotNull disposable parentdisposable) throws Exception { assertNull("PrevIoUs test " + ourTestCase + " hasn't called tearDown(). Probably overridden without super call.",ourTestCase); IdeaLogger.ourErrorsOccurred = null; ApplicationManager.getApplication().assertIsdispatchThread(); boolean reusedProject = true; if (ourProject == null || ourProjectDescriptor == null || !ourProjectDescriptor.equals(descriptor)) { initProject(descriptor); reusedProject = false; } ProjectManagerEx projectManagerEx = ProjectManagerEx.getInstanceEx(); projectManagerEx.openTestProject(ourProject); if (reusedProject) { DumbService.getInstance(ourProject).queueTask(new UnindexedFilesUpdater(ourProject,false)); } MessageBusConnection connection = ourProject.getMessageBus().connect(parentdisposable); connection.subscribe(ProjectTopics.MODULES,new ModuleAdapter() { @Override public void moduleAdded(@NotNull Project project,@NotNull Module module) { fail("Adding modules is not permitted in LightIdeaTestCase."); } }); clearuncommittedDocuments(getProject()); CodeInsightTestFixtureImpl.configureinspections(localinspectionTools,getProject(),Collections.<String>emptyList(),parentdisposable); assertFalse(getPsiManager().isdisposed()); Boolean passed = null; try { passed = StartupManagerEx.getInstanceEx(getProject()).startupActivityPassed(); } catch (Exception ignored) { } assertTrue("open: " + getProject().isopen() + "; disposed:" + getProject().isdisposed() + "; startup passed:" + passed + "; all open projects: " + Arrays.asList(ProjectManager.getInstance().getopenProjects()),getProject().isInitialized()); CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(new CodeStyleSettings()); final FileDocumentManager manager = FileDocumentManager.getInstance(); if (manager instanceof FileDocumentManagerImpl) { Document[] unsavedDocuments = manager.getUnsavedDocuments(); manager.saveAllDocuments(); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { ((FileDocumentManagerImpl)manager).dropAllUnsavedDocuments(); } }); assertEmpty("There are unsaved documents",Arrays.asList(unsavedDocuments)); } UIUtil.dispatchAllInvocationEvents(); // startup activities ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue(); }
protected void setUpProject() throws Exception { myProjectManager = ProjectManagerEx.getInstanceEx(); assertNotNull("Cannot instantiate ProjectManager component",myProjectManager); File projectFile = getIprFile(); myProject = doCreateProject(projectFile); myProjectManager.openTestProject(myProject); LocalFileSystem.getInstance().refreshIoFiles(myFilesToDelete); setUpModule(); setUpJdk(); LightPlatformTestCase.clearuncommittedDocuments(getProject()); runStartupActivities(); ((FileTypeManagerImpl)FileTypeManager.getInstance()).drainReDetectQueue(); }
@Override protected void setUp() throws Exception { super.setUp(); initApplication(); registerExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP,new InternalFileTypeFactory()); registerExtensionPoint(FileDocumentSynchronizationVetoer.EP_NAME,FileDocumentSynchronizationVetoer.class); getApplication().registerService(CommandProcessor.class,new MyMockCommandProcessor()); getApplication().registerService(CodeStyleFacade.class,new DefaultCodeStyleFacade()); getApplication().registerService(ProjectLocator.class,new DefaultProjectLocator()); MockEditorFactory editorFactory = new MockEditorFactory(); getApplication().registerService(EditorFactory.class,editorFactory); final LanguageFileType[] fileType = {null}; getApplication().addComponent(FileTypeManager.class,new FileTypeManagerImpl(null,new MockSchemesManagerFactory()) { @NotNull @Override public FileType getFileTypeByFileName(@NotNull String fileName) { return fileType[0]; } @NotNull @Override public FileType getFileTypeByFile(@NotNull VirtualFile file) { return fileType[0]; } @NotNull @Override public FileType getFileTypeByExtension(@NotNull String extension) { return fileType[0]; } }); fileType[0] = StdFileTypes.JAVA; getApplication().getComponent(FileTypeManager.class); final VirtualFileManager virtualFileManager = EasyMock.createMock(VirtualFileManager.class); final ProjectManager projectManager = EasyMock.createMock(ProjectManager.class); myDocumentManager = new MyMockFileDocumentManager(virtualFileManager,projectManager); getApplication().registerService(FileDocumentManager.class,myDocumentManager); getApplication().registerService(DataManager.class,new DataManagerImpl()); }
public static void setBuckFileType() { ApplicationManager.getApplication() .runWriteAction( new Runnable() { @Override public void run() { FileTypeManager fileTypeManager = FileTypeManagerImpl.getInstance(); FileType fileType = fileTypeManager.getFileTypeByFileName( BuckFileType.INSTANCE.getDefaultExtension()); // Remove all FileType associations for BUCK files that are not BuckFileType while (!(fileType instanceof BuckFileType || fileType instanceof UnkNownFileType)) { List<FileNameMatcher> fileNameMatchers = fileTypeManager.getAssociations(fileType); for (FileNameMatcher fileNameMatcher : fileNameMatchers) { if (fileNameMatcher.accept(BuckFileType.INSTANCE.getDefaultExtension())) { fileTypeManager.removeAssociation(fileType,fileNameMatcher); } } fileType = fileTypeManager.getFileTypeByFileName( BuckFileType.INSTANCE.getDefaultExtension()); } // Use a simple BinaryFileStubBuilder,that doesn't offer stubbing BinaryFileStubBuilders.INSTANCE.addExplicitExtension( fileType,new BinaryFileStubBuilder() { @Override public boolean acceptsFile(VirtualFile virtualFile) { return false; } @Nullable @Override public Stub buildStubTree(FileContent fileContent) { return null; } @Override public int getStubVersion() { return 0; } }); } }); }
DtypeWarning: Columns (1,5,7,16,......) have mixed types. Specify dtype option on import or set l...
DtypeWarning: Columns (1,5,7,16,......) have mixed types. Specify dtype option on import or set low_memory=False.
意思就是:列1,5,7,16....的数据类型不一样。
调试进去看了看,发现pandas在读取的时候确实把同一列数据中同一
个数值识别为不同的类型,比如:2000行第3列值为0的数据识别为Int类型,
而在4000行第3列值为0的数据识别为str类型。
两种解决方法:
# 1.设置read_csv的dtype参数,指定字段的数据类型
pd.read_csv(sio, dtype={"user_id": int, "username": object})
# 2.设置read_csv的low_memory参数为False
pd.read_csv(sio, low_memory=False})
注:low_memory
另外pandas对数据的类型是完全靠猜的,所以pandas每读取一块数据就对csv字段的数据类型进行猜一次,所以有可能pandas在读取不同块时对同一字段的数据类型猜测结果不一致。
low_memory=False 参数设置后,pandas会一次性读取csv中的所有数据,然后对字段的数据类型进行唯一的一次猜测。这样就不会导致同一字段的Mixed types问题了。
但是这种方式真的非常不好,一旦csv文件过大,就会内存溢出;所以推荐用第1中解决方案。
flultter listview 异常 type ''(BuildContext, int) => dynamic'' is not a subtype of type ''...
type ''(BuildContext, int) => dynamic'' is not a subtype of type ''(BuildContext, int) => Widget''
源码如下:
import ''package:flutter/material.dart'';
import ''post.dart'';
void main() {
runApp(MaterialApp(
title: ''Returning Data'',
home: HomePage(),
));
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(''Flutter SnackBar''),
),
body: Center(
child: new ListViewLayout(),
));
}
}
class ListViewLayout extends StatelessWidget {
_istviewItemBuilder(BuildContext context, int index) {
return Text(posts[index].author);
}
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: posts.length, itemBuilder: _istviewItemBuilder);
}
}
原因是因为_istviewItemBuilder 没写 返回值类型 Widget 加上就可以
import ''package:flutter/material.dart'';
import ''post.dart'';
void main() {
runApp(MaterialApp(
title: ''Returning Data'',
home: HomePage(),
));
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(''Flutter SnackBar''),
),
body: Center(
child: new ListViewLayout(),
));
}
}
class ListViewLayout extends StatelessWidget {
Widget _istviewItemBuilder(BuildContext context, int index) {
return Text(posts[index].author);
}
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: posts.length, itemBuilder: _istviewItemBuilder);
}
}
关于Linux-(type,vim)的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于c – 支持linux / types.h OSX、com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl的实例源码、DtypeWarning: Columns (1,5,7,16,......) have mixed types. Specify dtype option on import or set l...、flultter listview 异常 type ''(BuildContext, int) => dynamic'' is not a subtype of type ''...的相关知识,请在本站寻找。
本文标签: