我在github上分叉了一个项目,以便发送pull请求.问题是我的做法非常......肮脏.
我在fork的本地副本上工作,为我的修改创建了一个分支并将其合并到master上.然后我在github fork上推送master,以便创建一个pull请求.
问题是,最近,我的拉取请求被拒绝了.所以现在我从原来的主人那里提前5次提交.有什么解决方案才能与原始存储库保持一致?
我是否应该检查新分支中的上游主服务器并使用它创建新的主服务器(如何执行此操作?)
或者更好的是删除我的github fork(我之前接受了提交)并重新创建它(你可以在这里看到github repos)https://github.com/cedlemo/ruby-gnome2
我有一个基于clang的简单头解析器,我从某个源获取typedef.
struct _poire {
int g;
tomate rouge;
};
typedef struct _poire kudamono;
Run Code Online (Sandbox Code Playgroud)
解析后我有一个clang::TypedefDecl然后我得到clang::QualType了typedefclang::TypedefDecl::getUnderlyingType()
随着QualType如果我使用getAsString方法,我可以找到"结构_poire" std::string.这一切都很好.
问题是,如果我试图查看此类型是否为规范类型QualType::isCanonical(),则返回false.
所以我尝试获取规范类型,QualType::getCanonicalType().getAsString()并返回相同的字符串"struct _poire".
根据类型http://clang.llvm.org/docs/InternalsManual.html#canonical-types上的clang引用,我认为当没有涉及typedef时,isCanonical()应该返回true.
那么什么是真正的规范类型?
在哪里可以找到用户可以在GTK + 3的CSS文件中定义的可用键绑定的详尽列表?
我已经检查了这些资源:
例如,用户如何<Control>Space将光标移动到文本末尾GtkTextView?
我有一个处理lib的结构:
typedef struct {
uint8_t response_type;
uint8_t error_code;
uint16_t sequence;
uint32_t resource_id;
uint16_t minor_code;
uint8_t major_code;
uint8_t pad0;
uint32_t pad[5];
uint32_t full_sequence;
} a_structure;
Run Code Online (Sandbox Code Playgroud)
我的问题来自我不太了解的结构的pad [5]成员.我认为这个成员可以像以下那样用作其他成员:
uint8_t get_response_type( a_structure * my_struct)
{
return my_struct->response_type;
}
Run Code Online (Sandbox Code Playgroud)
但是这个功能:
uint32_t get_pad_5( a_structure * my_struct)
{
return my_struct->pad[5];
}
Run Code Online (Sandbox Code Playgroud)
在gcc中生成警告
错误数组下标在数组边界之上
有人能解释一下这意味着什么吗?
Thxs
我有一个名为class.h的C++标头,我要解析:
class MyClass
{
public:
Class() {}
~Class() {}
bool isTrue() const;
bool isFalse() const;
private:
bool m_attrib;
};
bool MyClass::isTrue() const
{
return true;
}
bool MyClass::isFalse() const
{
return false;
}
Run Code Online (Sandbox Code Playgroud)
我使用clang编译器实例和AST使用者.我的所有代码都适用于c源文件.但我无法配置/强制CompilerInstance必须使用的语言.这是我使用的代码:
m_ci = new clang::CompilerInstance();
/*configure the langage to use*/
clang::CompilerInvocation *invocation = new clang::CompilerInvocation;
clang::LangOptions langOpts;
/*with langage = clang::IK_CXX*/
langOpts.CPlusPlus = 1;
invocation->setLangDefaults(langOpts, langage);
m_ci->setInvocation(invocation);
m_ci->createDiagnostics();
llvm::IntrusiveRefCntPtr<clang::TargetOptions> pto( new clang::TargetOptions());
pto->Triple = llvm::sys::getDefaultTargetTriple();
clang::TargetInfo *pti = clang::TargetInfo::CreateTargetInfo(m_ci->getDiagnostics(), pto.getPtr());
m_ci->setTarget(pti);
m_ci->createFileManager();
m_ci->createSourceManager(ci->getFileManager());
m_ci->createPreprocessor();
/*add …Run Code Online (Sandbox Code Playgroud) 当我尝试使用命令替换时,我偶然发现了鱼壳(这是我最喜欢的shell)的问题:
gcc (pkg-config --libs --cflags gtk+-2.0 cairo) -o drawing_widget drawing_widget.c
gcc: erreur: unrecognized command line option ‘-pthread -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0
-I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/harfbuzz
-I/usr/include/libdrm -I/usr/include/libpng16 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0
-lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lcairo ’
Run Code Online (Sandbox Code Playgroud)
我已经测试了bash和zsh以及相同的注释:
gcc $(pkg-config --libs --cflags gtk+-2.0 cairo) -o drawing_widget drawing_widget.c
Run Code Online (Sandbox Code Playgroud) 我了解函数的参数是什么,gtk_builder_new_from_file或者gtk_builder_new_from_string我有点想知道什么是资源路径,例如:
GtkBuilder *
gtk_builder_new_from_resource (const gchar *resource_path);
Run Code Online (Sandbox Code Playgroud)
我找不到任何示例(C、python、vala 或其他我不介意的)。
编辑:解决方案
感谢 gnianmt 的帮助,这里是 ruby 中的一个基本示例(https://github.com/ruby-gnome2/ruby-gnome2):
首先是一个简单的 ui 文件simple_window.ui:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="ellipsize">end</property>
</object>
</child>
</object>
</interface>
Run Code Online (Sandbox Code Playgroud)
然后创建一个simple_window.gresource.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/simple_window">
<file>simple_window.ui</file>
</gresource>
</gresources>
Run Code Online (Sandbox Code Playgroud)
将其打包为:
glib-compile-resources simple_window.gresource.xml
Run Code Online (Sandbox Code Playgroud)
其中创建一个 simple_window.gresource 二进制文件。
现在红宝石脚本: …
如何将对话窗口的按钮(GtkDialog例如)Gtk::ResponseType与 Glade的响应值链接起来?。
我知道如何以编程方式执行此操作,但我不知道如何使用 Glade 执行此操作。
简而言之,我必须GtkDialog在操作区域中创建带有一个和两个按钮的 ui 文件,例如ID 为button_ok和button_cancel。之后我编辑文件并添加这些行:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkDialog" id="dialog1">
<!-- the objects added by Glade -->
<!-- What I need to add -->
<action-widgets>
<action-widget response="cancel">button_cancel</action-widget>
<action-widget response="ok" default="true">button_ok</action-widget>
</action-widgets>
<!-- What I need to add -->
</object>
</interface>
Run Code Online (Sandbox Code Playgroud)
有没有办法通过 Glade 的界面来做到这一点?
我想用 xcb 来说明窗口的伪透明(复制窗口背景上的根窗口像素图的一部分)
为此,我使用:
根像素图设置为 feh 然后我启动我的程序(只是代码的一部分):
->初始化连接:
xcb_connect()
Run Code Online (Sandbox Code Playgroud)
-> 创建窗口:
xcb_create_window()
xcb_create_pixmap( connection,screen->root_depth, pixmap, screen->root, width, height)
xcb_create_gc( connection, graphic_context, pixmap, XCB_GC_FOREGROUND | XCB_GC_BACKGROUND, gc_values_mask)
xcb_map_window
Run Code Online (Sandbox Code Playgroud)
-> 抓取 xcb 事件:
xcb_wait_for_event
Run Code Online (Sandbox Code Playgroud)
-> 回答 map_request_event(当它是我们窗口的请求时)或 property_notify(当更改的属性是通过 feh 的根像素图时):
获取根像素图:
xcb_get_property / xcb_get_property_reply / xcb_get_property_value
==> this works
Run Code Online (Sandbox Code Playgroud)
将根像素图的一部分复制到窗口像素图:
xcb_copy_area_checked(backbone.connection,
rootpix,
pixmap,
graphic_context,
x, y,
0, 0,
width, height)
Run Code Online (Sandbox Code Playgroud)
我使用 xcb_request_check 但似乎我对最后一个请求没有错误。
然后我用 cairo 在我的窗口中绘制元素。
问题是我只看到一个带有由 cairo 绘制的元素的白色窗口。即使没有 cairo 元素,我也无法显示窗口的复制像素图。
你有什么想法可以帮我吗?谢谢
可以像这样为标签捕获Awesome 3.5中的布局更改(例如):
screen[s]:connect_signal("tag::history::update", function()
--do some stuff when virtual desktop has changed
end
Run Code Online (Sandbox Code Playgroud)
如果是这样,您该怎么做?
我试图在正则表达式中使用命名组但它不起作用:
module Parser
def fill(line, pattern)
if /\s#{pattern}\:\s*(\w+)\s*\;/ =~ line
puts Regexp.last_match[1]
#self.send("#{pattern}=", value)
end
if /\s#{pattern}\:\s*(?<value>\w+)\s*\;/ =~ line
puts value
#self.send("#{pattern}=", value)
end
end
end
Run Code Online (Sandbox Code Playgroud)
正如你所看到我首先测试我的正则表达式然后我尝试使用与命名组相同的正则表达式.
class Test
attr_accessor :name, :type, :visible
include Parser #add instance method (use extend if we need class method)
def initialize(name)
@name = name
@type = "image"
@visible = true
end
end
t = Test.new("toto")
s='desciption{ name: "toto.test"; type: RECT; mouse_events: 0;'
puts t.type
t.fill(s, "type")
puts t.type
Run Code Online (Sandbox Code Playgroud)
当我执行它时,第一个正则表达式工作,但不是第二个与命名组.这是输出:
./ruby_mixin_test.rb
image
RECT
./ruby_mixin_test.rb:11:in `fill': …Run Code Online (Sandbox Code Playgroud) 我有一个集合,我使用该where方法,以便只获得匹配的元素:
myCollection->where('akey', $value);
Run Code Online (Sandbox Code Playgroud)
当我尝试使用filter方法对其进行转换时,它会失败:
myCollection->filter(function($value, $key){
if($key === 'akey' && $value === $aValue)
return true;
});
Run Code Online (Sandbox Code Playgroud)
我尝试使用过滤器,因为我想在集合中选择项目,如果它们的值等于多个值.(基本上在何处或何处,何处或何处).