我需要一个正则表达式匹配所有情况下.png包含该单词的类型的任何文件名icon.所以它应该匹配
icon.png
myicon.png
thisIcon.PnG
aniCon_this.png
ANYICON.PNG
iconno2@me.png
Run Code Online (Sandbox Code Playgroud)
任何帮助赞赏!! 谢谢!PS:我在java
我有非托管代码:
...
typedef struct foo
{
int a;
bool b
int c;
} FOO,*LPFOO;
....
__declspec(dllexport) FOO __stdcall GetFoo()
{
FOO f;
<some work>
return f;
}
....
Run Code Online (Sandbox Code Playgroud)
我已经为GetFoo函数声明了C#原型:
[StructLayout(LayoutKind.Sequential, Pack = 1)]
private struct Foo
{
public int a;
public bool b
public int c;
};
[DllImport("foo.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
[return:MarshalAs( UnmanagedType.Struct)]
private static extern Foo GetFoo();
Run Code Online (Sandbox Code Playgroud)
但是当我从C#代码调用GetFoo时,我总是有MarshalDirectiveException- Method的类型签名不兼容PInvoke.我该如何申报C#原型?
我正在寻找示例代码示例,演示如何使用Android SurfaceView实现每秒30帧?假设每个帧从位置x和y开始绘制一个圆,并且每个帧将x和y递增1.
奖金问题:除此之外,我想覆盖另一个视图以显示文本内容,以便绘制任何图形显示在此文本内容下方.怎么做到这一点?
我正在创建使用SQLite数据库的android应用程序.看看SQLiteDatabase类,我发现有一个insertOrThrow()类似于insert()但有一个重要区别的方法 - 如果插入失败则会抛出异常而app会死(如果没有捕获).我insertOrThrow()在开发的初始阶段使用,因为它以非常明显的方式引起我对SQL错误的注意,即应用程序死亡.
我只是好奇:为什么没有updateOrThrow(),deleteOrThrow()等等...我试图谷歌的信息,但没有找到任何东西......
我有一个jquery函数,它挂在所有输入元素上,如:
$("input").blah();
如何从此函数中访问此类型的所有元素?不只是当前由jQuery处理的那个.
该功能如下:
(function($) {
$.fn.blah = function(){
this.each(function(){
// how can I access all elements of type "this" here?
return this;
});
};
})(jQuery);
Run Code Online (Sandbox Code Playgroud)
我想从所有这些元素中读取一些属性,然后根据这些属性对正在处理的当前元素执行一些操作
如果失败,我知道做一个new(std::no_throw)会设置指针NULL.我也知道普通new会std::bad_alloc在失败时抛出异常.
如果它抛出,法线new还会设置指针NULL吗?或者我应该将其设置NULL为catch()块?
当我尝试在Win32或x64模式下使用Visual Studio 2010编译我的c ++项目时,我收到以下错误:
>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\winnt.h(135): fatal error C1189: #error : "No Target Architecture"
我的预处理器定义说WIN32; _DEBUG; _CONSOLE;%(PreprocessorDefinitions)
导致此错误的原因是什么?如何解决?
// winnt.h: lines 127-136, MSVS says this is an inactive preprocessor block
#if defined(_WIN64)
#if defined(_AMD64_)
#define PROBE_ALIGNMENT( _s ) TYPE_ALIGNMENT( DWORD )
#elif defined(_IA64_)
#define PROBE_ALIGNMENT( _s ) (TYPE_ALIGNMENT( _s ) > TYPE_ALIGNMENT( DWORD ) ? \
TYPE_ALIGNMENT( _s ) : TYPE_ALIGNMENT( DWORD ))
#else
#error "No Target Architecture"
#endif
Run Code Online (Sandbox Code Playgroud)
更新:我创建了一个新的msvs项目并将我的代码复制到它.我不再拥有error : "No Target Architecture",但现在我有一堆涉及winnt.h和winbase.h的编译错误,并且没有涉及我的任何文件的编译错误.这些文件是否可能已损坏?我需要重新安装MSVS 2010吗?
更新2:所以我缩小了我的问题,发现它 …
我有一个非常基本的情况:
我有一个大约5k行的表:
CREATE TABLE "words" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "name" TEXT NOT NULL , "def" TEXT NOT NULL, "rand" INTEGER)
Run Code Online (Sandbox Code Playgroud)
我使用"UPDATE words SET rand = random()"定期更新
在android中,当我使用rawQuery()使用以下代码创建游标时:
SELECT w.id, w.name, w.def, w.rand FROM words w ORDER BY w.rand ASC;
Run Code Online (Sandbox Code Playgroud)
返回的游标不按正确的顺序迭代.例如,它将按以下顺序输出具有rand值的列:
-1298882092
-2138143484
-1115732861
118839193
...
Run Code Online (Sandbox Code Playgroud)
有谁知道这里发生了什么?这不应该工作吗?如果我在SQLiteManager中运行完全相同的查询,它会以正确的顺序返回结果,所以这似乎是特定于android/cursor的.
更新:
这是android中的代码,我尝试了多种方法:
尝试1:
Cursor cursor = db.rawQuery("SELECT w.id, w.name, w.def, w.rand FROM words w ORDER BY w.rand ASC", new String[]{});
Run Code Online (Sandbox Code Playgroud)
尝试2:
Cursor cursor = db.query("words", new String[]{"id", "name", "def", "rand"}, …Run Code Online (Sandbox Code Playgroud) 我目前正在评估SML课程的作业.我已经编写了一些测试用例来自动检查学生作业中函数的正确性,我希望能够导入他们的代码然后针对该代码运行测试用例.我在想象类似于python import语义的东西.现在,我的最佳解决方案是在每个作业的底部复制粘贴此代码.这可能与SML有关吗?
有谁知道使用这个的任何知识:
- (void) startMonitoringForRegion:(CLRegion *)region desiredAccuracy:(CLLocationAccuracy)accuracy
我正在尝试将它实现到我的项目中,但是:
- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
永远不会被称为?
有没有人有任何示例代码或知道为什么会发生这种情况?
我的代码如下.我在自己的LocationManager类中创建了一个这样的方法:
- (void) locationManagerStartMonitoringRegion:(CLRegion *)region withAccuracy:(CLLocationAccuracy)accuracy {
NSLog(@"Start Monitoring");
[locationManager startMonitoringForRegion:region desiredAccuracy:accuracy];
NSLog(@"Monitored Regions: %i", [[locationManager monitoredRegions] count]);
}
Run Code Online (Sandbox Code Playgroud)
然后我这样称呼它:
CLLocationCoordinate2D coordinates = CLLocationCoordinate2DMake(51.116261, -0.853758);
CLRegion *grRegion = [[CLRegion alloc] initCircularRegionWithCenter:coordinates radius:150 identifier:[NSString stringWithFormat:@"grRegion%i", value]];
[locationManager locationManagerStartMonitoringRegion:grRegion withAccuracy:kCLLocationAccuracyBest];
Run Code Online (Sandbox Code Playgroud)
我得到NSLog的:
2011-01-30 19:52:26.409 TestingLocation [10858:307]开始监控
2011-01-30 19:52:27.103 TestingLocation [10858:307]受监控区域:
但是从来没有得到过NSLog:
- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
NSLog(@"Entered Region");
}
Run Code Online (Sandbox Code Playgroud)
要么
- (void) locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region …Run Code Online (Sandbox Code Playgroud) android ×3
c++ ×2
allocation ×1
bad-alloc ×1
c# ×1
cllocation ×1
cursor ×1
ios4 ×1
iphone ×1
javascript ×1
jquery ×1
managed ×1
marshalling ×1
new-operator ×1
null ×1
objective-c ×1
regex ×1
sml ×1
sql ×1
sqlite ×1
surfaceview ×1
unmanaged ×1
visual-c++ ×1