小编Ran*_*ndi的帖子

如何使用C Sharp计算每个Java类的方法数量?

我必须在C#中完成一个项目才能找到每个java类的方法数量。

我可以使用c#正则表达式在.java文件中找到所有方法,但是我想要的是查找每个类(包括内部类)的方法数量。谁能帮我。

string[] lines = File.ReadAllLines(file);

int countLine = 0;
int AllCount = 0;

foreach (string line in lines)
{

    countLine = MethodsCount(line);
    AllCount = AllCount + countLine;

}

label5.Text = AllCount.ToString();
Run Code Online (Sandbox Code Playgroud)

这是方法计数方法。

private int MethodsCount (string LineOperator)
{
    int count = 0;

    string[] words = LineOperator.Split('{');

    foreach (string word in words)
    {
        if (Regex.IsMatch(word, @"(static\s|final\s)?(public|private|internal)(\sstatic|\sfinal)?\s(int|boolean|void|double|String|long|String\[\]|String\[\]\[\])?\s([a-z]|[A-Z]+[a-z]+|[a-z]+[A-Z]+)+(\s)*\((\s|\n|\r)*"))
        {
            count = count + 1;
        }
    }

    return count;
}
Run Code Online (Sandbox Code Playgroud)

如果我们考虑一堂课

public class vehicle {

    public method1() {
       ---------
    }

    public method2() { …
Run Code Online (Sandbox Code Playgroud)

c# regex

5
推荐指数
1
解决办法
1864
查看次数

如何在 Mac 中运行 Makefile

我想在 mac 中创建一个 fat 库。所以我就遵循这个。我将 makefile 的内容复制到编辑文本中并将其重命名为Makefile.mak. 我打开了 makefile 所在的终端,并在终端中键入“make”并按 Enter 键。我收到错误“找不到 Makefile”。这会是什么原因呢?我哪里做错了?请帮我。谢谢

makefile static-libraries fat-binaries xamarin.ios

3
推荐指数
2
解决办法
4万
查看次数

我的手机没有移动,但GPS数据仍在变化

我有一个简单的Android代码,通过Web服务定期发送GPS位置到数据库.出于测试目的,我将minTime设置为2000ms.

lm=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
ll=new SpeedoActionListener();
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,2000, 0,ll);
Run Code Online (Sandbox Code Playgroud)

但...

  1. 当我的手机没有移动时,它仍然会向数据库插入不同的经度和纬度值.
  2. 即使我禁用GPS,它也会向数据库发送不同的经度纬度,直到我关闭手机和笔记本电脑之间的连接.

网络服务托管在IIS7上,我的手机和笔记本电脑通过Wi-Fi连接

虽然我的手机没有移动,为什么它会发送不同的位置?

private class SpeedoActionListener implements LocationListener
{

    String result=null;

      @Override
      public void onLocationChanged(Location location) {

          if(location!=null) {
            lati=location.getLatitude();

            longi=location.getLongitude();

            String mylati=Double.toString(lati);
            String mylongi=Double.toString(longi);
            WebServiceCaller obj=new WebServiceCaller();
            result=obj.sendLocationData(mylongi, mylati);
            resultText=(TextView)findViewById(R.id.result);
            resultText.setText(result);


      }

}

      @Override
      public void onProviderDisabled(String provider) {
              // TODO Auto-generated method stub

      }

      @Override
      public void onProviderEnabled(String provider) {
              // TODO Auto-generated method stub

      }

      @Override
      public void onStatusChanged(String provider, int status, Bundle extras) {
              // TODO Auto-generated method …
Run Code Online (Sandbox Code Playgroud)

gps android

2
推荐指数
1
解决办法
1658
查看次数

自定义字体在swift 3中变为零值

我想将attributesstring设置为my UILabel.所以我用这种方式定义了属性.

let attribute1:[String:Any]=[
        NSForegroundColorAttributeName: UIColor.init(colorLiteralRed: 120.0/255, green: 173.0/255, blue: 194.0/255, alpha: 1.0),
        NSFontAttributeName:UIFont.init(name: "Bariol_Bold", size: 15.0)!]
let attributedStringGreeting=NSAttributedString.init(string: welcomeMessage, attributes: attribute1)
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

NSFontAttributeName:UIFont.init(name: "Bariol_Bold", size: 15.0)!]
Run Code Online (Sandbox Code Playgroud)

这是否意味着我的自定义字体没有采取?但是,当我从IB中设置字体时,它会显示出来.

致命错误:在展开Optional值时意外发现nil

我该如何解决这个问题?请帮我.

在此输入图像描述

在此输入图像描述

uifont ios swift

2
推荐指数
2
解决办法
2225
查看次数

ARKit 和 Azure Spatial Anchors 锚点的区别

我正在 iOS 上创建一个 AR 应用程序,它可以定义一些带有一些注释的锚点并将它们保存在云中。后来我想使用任何设备(iOS 或 Android)检索这些锚点并将它们显示在 ARView 中。我知道我们可以只使用 ARKit 来定义锚点。我们也可以使用 Azure 空间锚点。

我的感觉是,因为我跨平台使用锚点,所以我应该使用 Azure 空间锚点。但是我想知道这两种类型的锚点之间的确切区别是什么。是否可以仅使用 ARKit 锚点并在 Android 设备上准确呈现?简单地说,我想知道根据我的情况什么是最好的解决方案。

augmented-reality arkit arcore azure-spatial-anchors

1
推荐指数
1
解决办法
211
查看次数

如何编写正则表达式来获取Python中的浮点数?

如何编写正则表达式来获取python中的浮点数.我想得到55.97.来自<td nowrap="nowrap">55.97</td>.所以我给了

newsecond_row_data = (re.search('(?<=>)\d+|\d+.\d+',second_row_data[a]))
newsecond_row_data.group(0)

print newsecond_row_data.group(0)
Run Code Online (Sandbox Code Playgroud)

但它给了55而不是55.97.Plz hlp我

谢谢

python regex

0
推荐指数
1
解决办法
613
查看次数