小编use*_*re3的帖子

同步事件以编程方式添加到Android中的谷歌日历

我正在尝试向android日历添加一个事件,并指定该事件将添加到gmail日历中,以便自动与Google日历同步.问题是以编程方式添加的事件不会与Google日历同步,但如果我在手机上添加手动,它会与Google日历同步.我不知道为什么.

这是我用来添加事件的代码:

ArrayList<MyCalendar> calendars = new ArrayList<MyCalendar>();

String[] projection = new String[] { "_id", "name" };
Uri calUri = getCalendarURI(false);
Cursor managedCursor = managedQuery(calUri, projection, "selected=1",
        null, null);

String calName = null;
String calId = null;
if (managedCursor.moveToFirst()) {

    int nameColumn = managedCursor.getColumnIndex("name");
    int idColumn = managedCursor.getColumnIndex("_id");
    do {
        calName = managedCursor.getString(nameColumn);
        calId = managedCursor.getString(idColumn);
        calendars.add(new MyCalendar(Integer.parseInt(calId), calName));
    } while (managedCursor.moveToNext());

}
Toast.makeText(getBaseContext(), calName + "  " + calId,
        Toast.LENGTH_LONG).show();

Calendar cal = Calendar.getInstance();
ContentValues event = new ContentValues();
event.put("calendar_id", …
Run Code Online (Sandbox Code Playgroud)

android google-calendar-api

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

是否有一个选项来解析在Visual-Studio模式比较中进行比较的SQLCMD变量?

看起来好像Visual Studio Database Project没有解析SQLCMD变量进行模式比较.

我所有的同义词都是这样的

CREATE SYNONYM [dbo].[addressesExtDB] FOR [$(ExtDB)].[dbo].[addresses];
Run Code Online (Sandbox Code Playgroud)

但是它们会被报告为与数据库不同.

当我使用正确'Specify SQLCMD Variabeles...'的-settings 进行模式更新时,将var ExtDB设置为'ExtDBnn'结果Synonym,数据库被正确设置为:

CREATE SYNONYM [dbo].[addressesExtDB] FOR [ExtDBnn].[dbo].[addresses];
Run Code Online (Sandbox Code Playgroud)

重新比较操作再次将所有同义词错误地显示为不同.因此比较应该解析sqlcmd-variabeles并使用结果与数据库进行比较.我是否想念这样做的选项,或者您是否遇到过同样的问题并找到了某种解决方案?

database-project schema-compare

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

解密web.config中的connectionString?

我在我的aspx加载中使用此代码加密web.config中的连接字符串.

protected void Page_Load(object sender, EventArgs e)
{
    Configuration config =      WebConfigurationManager.OpenWebConfiguration("~");

    ConnectionStringsSection connSection = (ConnectionStringsSection)config.GetSection("connectionStrings");

    connSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");

    config.Save();
}
Run Code Online (Sandbox Code Playgroud)

我是c#的新手,现在我需要的是解密.知道怎么样?

我可以使用以下代码解密一行.

protected void Page_Load(object sender, EventArgs e)
{
    Configuration config = WebConfigurationManager.OpenWebConfiguration("~");

    ConnectionStringsSection connSection = (ConnectionStringsSection)config.GetSection("connectionStrings");

    //connSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
    connSection.SectionInformation.UnprotectSection();

    config.Save();   
}
Run Code Online (Sandbox Code Playgroud)

谢谢.

c#

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

检查对象是否为T的子类的扩展方法

我正在尝试编写一个扩展方法来检查对象是否是T的子类.

这是我做的,但不被视觉工作室接受.

public static bool IsChildOf<T>(this object obj)
{
    return (typeof(obj).IsSubclassOf(typeof(T)));
}

[Test()]
public void IsChildOfTest()
{
    var dog = new Dog();
    var isAnimal = dog.IsChildOf<Animal>();
    Assert.That(isAnimal);
}
Run Code Online (Sandbox Code Playgroud)

知道我怎么写这个?

.net c# .net-4.5

6
推荐指数
3
解决办法
236
查看次数

删除查询在mysql中不起作用

我正在尝试从名为 user_enrole 的表中删除所有记录。我正在使用此查询

DELETE * FROM user_enrole
Run Code Online (Sandbox Code Playgroud)

我认为我的查询语法没有错,但它给了我错误说

#1064 - 你的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在第 1 行的“* FROM user_enrole”附近使用的正确语法

我已经仔细检查了我的语法,我无法弄清楚出了什么问题,请有人指出。

是因为这个表与使用表的关系还是什么而发生的?

mysql sql

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

Macports 不安装手册页

我正在运行OSX Mavericks并已安装Macports。我gcc通过Macports它安装,工作正常。但是,当我输入时,man gcc我只得到:

No manual entry for gcc
Run Code Online (Sandbox Code Playgroud)

有人告诉我需要将以下内容添加到我的.bash_profile

export MANPATH=/opt/local/share/man:$MANPATH
Run Code Online (Sandbox Code Playgroud)

我已经做了但没有效果。Macports 是否确实安装了相应的手册页?“port”命令的手册页以及其他预装工具(例如 clang)都可以正常工作。

有什么帮助吗?干杯。

gcc macports

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

使用BCP queryout获取列名称

我需要将表格BCP到制表符分隔文件中,但我需要表格第一条记录中的列名称.问题1:我是否认为BCP没有这方面的转换?问题2:如果没有,为什么?

我试着做以下事情:

BCP "declare @colnames varchar(max); select @colnames=coalesce (@colnames+char(9), '') 
+ Column_Name from db.information_Schema.columns where table_name='table1' order by 
ordinal_position; select @colnames" queryout Table1_Columns.tsv -S?? -U?? -P?? -f** -e**
Run Code Online (Sandbox Code Playgroud)

格式文件如下所示:

9.0
1
1 SQLCHAR 0 100 "\r\n" 1 Column_Names SQL_Latin1_General_CP1_CI_AS
Run Code Online (Sandbox Code Playgroud)

这给我一个列名的文件,然后第二个BCP命令给我一个数据文件,我只是将两个DOS复制到一起.问题3:我聪明还是什么?问题4:为什么不起作用?我收到错误:

SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Native Client]Host-file columns may be skipped only when 
copying into the Server
Run Code Online (Sandbox Code Playgroud)

sql sql-server bcp

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

如何在C#中多选OpenFileDialog中限制上传数量

如何使用openfiledialogc#中的多选来限制要上传的文件数量?

这是我的代码:

private void btn_upload_Click(object sender, EventArgs e)
{
    OpenFileDialog op1 = new OpenFileDialog();
    op1.Multiselect = true;
    op1.ShowDialog();
    op1.Filter = "allfiles|*.xls";
    textBox1.Text = op1.FileName;
    int count = 0;
    string[] FName;
    foreach (string s in op1.FileNames)
    {
        FName = s.Split('\\');
        File.Copy(s, "C:\\file\\" + FName[FName.Length - 1]);
        count++;
    }
    MessageBox.Show(Convert.ToString(count) + " File(s) copied");
 }
Run Code Online (Sandbox Code Playgroud)

它将根据用户想要的数量上传。但我只想将其限制为 5 个文件。

c# file-upload

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

Dropbox访问令牌到期

通过Dropbox oAuth2 API获取的访问令牌的生命周期是多少?

https://api.dropbox.com/1/oauth2/token之后的答案是这样的

{
    "access_token": "fHUlx32x494RmgTlxWiF6pLzd5q1Lg4Itt7I6itVYDIDT",
    "token_type": "bearer",
    "uid": "17233223324"
}
Run Code Online (Sandbox Code Playgroud)

但是没有提到AT什么时候到期.如果曾经.

dropbox dropbox-api

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

无法设置FillBackgroundColor

NPOI 2.0.6.0在一个C#项目中使用,我遇到了改变样式的困难.虽然我可以影响字体和单元格边框,但我无法更改背景颜色.

private void buildSheet(HSSFWorkbook wb, DataTable data, string sheetName)
{
    var cHelp = wb.GetCreationHelper();
    var sheet = wb.CreateSheet(sheetName);

    HSSFFont hFont = (HSSFFont)wb.CreateFont();

    hFont.Boldweight = (short)FontBoldWeight.Bold;
    hFont.Color = HSSFColor.White.Index;
    hFont.FontHeightInPoints = 18;

    HSSFCellStyle hStyle = (HSSFCellStyle)wb.CreateCellStyle();
    hStyle.SetFont(hFont);
    hStyle.BorderBottom = BorderStyle.Medium;
    hStyle.FillBackgroundColor = HSSFColor.Black.Index;

    IRow headerRow = sheet.CreateRow(1);


    int cellCount = 1;
    foreach (string str in colHeaders)
    {
        HSSFCell cell = (HSSFCell)headerRow.CreateCell(cellCount);
        cell.SetCellValue(cHelp.CreateRichTextString((str)));
        cell.CellStyle = hStyle;

        cellCount += 1;
    }

    int rowCount = 2;
    foreach (DataRow dr …
Run Code Online (Sandbox Code Playgroud)

c# npoi

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