小编lin*_*nkb的帖子

如何以UTF-8格式生成Stream.Write()输出

我的问题是:

我生成并上传使用ASP.NET SQL文件,但该文件保存到FTP服务器后,像ü字符改为&多山,O到O和等等...我怎样才能防止这种情况发生?我不希望使用ASCII代码格式化文件,但使用UTF-8.

生成并上传文件的代码如下所示:

//request = the object to be made an request out of.
Stream requestStream = request.GetReguestStream();
var encoding = new UTF8Encoding();
//fileContent is the string to be saved in the file
byte[] buffer = encoding.GetBytes(fileContent); 
requestStream.Write(buffer, 0, buffer.Length);
requestStream.Close();
Run Code Online (Sandbox Code Playgroud)

正如你所看到我试图使用它System.Text.UTF8Encoding,但它不起作用.

.net c# asp.net utf-8

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

如何在多台计算机上使用google maps API开发Android应用程序?

我想创建一个使用谷歌地图的Android应用程序.我已经安装了Eclipse,Android JDK和AVD(Android虚拟设备).我遵循了这个教程:http://developer.android.com/resources/tutorials/hello-world.html并制作了我的第一个应用程序.它的工作原理:)

但是,要开发使用Google Maps API的Android应用,您必须获取Google Maps API密钥.根据此链接http://code.google.com/android/add-ons/google-apis/mapkey.html,您可以通过在JDK文件夹中获取调试密钥的MD5指纹来获取密钥.问题是这种指纹在计算机之间是不同的.

所以我的问题是:我们必须在多台计算机上进行开发.我们使用subversion作为此项目的源代码控件.怎么解决这个问题?

如果我注册我的MD5指纹并获得GM API密钥,则此密钥将无法在任何其他计算机上运行.我知道一个解决方案是每个开发人员都有自己的个人API密钥,但我不认为这是一个平滑的解决方案.

我试着阅读MD5指纹,据我了解你可以创建,导出和导入它们.那么,解决方案是我可以创建一个特定的指纹,导出它,将其发送给所有其他开发人员,然后他们可以导入它吗?但据我所知,它必须是调试证书?在这种情况下,如何制作,导出和导入一个?我已经阅读过这篇文章,并且知道我使用了keytool命令,但我找不到任何简单的例子.请赐教:)

android google-maps fingerprint keytool

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

如何在linq join(lambda)上添加where子句?

我有两个数据库表Contact(Id,Name,...)和ContactOperationalPlaces(ContactId,MunicipalityId),其中一个联系人可以连接到几个ContactOperationalPlaces.

我想要做的是使用IQueryable构建一个查询(ASP .NET,C#),它只选择具有给定MunicipalityId的ContactOperationalPlaces表中存在的所有联系人.

sql查询如下所示:

select * from Contacts c 
right join ContactOperationPlaces cop on c.Id = cop.ContactId 
where cop.MunicipalityId = 301;
Run Code Online (Sandbox Code Playgroud)

使用linq它看起来像这样:

//_ctx is the context
var tmp = (from c in _ctx.Contacts
             join cop in _ctx.ContactOperationPlaces on c.Id equals cop.ContactId
             where cop.MunicipalityId == 301
             select c);
Run Code Online (Sandbox Code Playgroud)

所以,我知道如何做到这一点,如果重点是一次选择所有这一切,不幸的是,事实并非如此.我正在根据用户输入构建查询,因此我不知道所有选择.

所以这就是我的代码:

IQueryable<Contacts> query = (from c in _ctx.Contacts select c);
//Some other logic....
/*Gets a partial name (string nameStr), and filters the contacts 
 so that only those with a match on names …
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net lambda

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

标签 统计

asp.net ×2

c# ×2

.net ×1

android ×1

fingerprint ×1

google-maps ×1

keytool ×1

lambda ×1

linq ×1

utf-8 ×1