小编nat*_*tli的帖子

达到墓碑限制时会发生什么

根据cassandra的日志(见下文),由于tombstones存在太多,查询将被中止.发生这种情况是因为每周一次我用一个太低的计数器清理(删除)行.这会'删除' 数十万行(用a标记它们tombstone.)

如果在此表中由于节点在清理过程中出现故障而重新出现已删除的行,那么完全没有问题,因此我将gc grace time单个受影响的表设置为10小时(从默认的10天开始),以便逻辑删除的行可以相对快速地永久删除.

无论如何,我必须设置tombstone_failure_threshold极高以避免以下异常.(一亿,高达十万.)我的问题是,这有必要吗?我完全不知道什么类型的查询被中止; 插入,选择,删除?

如果只是某些选择被中止,那就不是那么大了.但是假设中止意味着"上限",因为查询过早停止并返回它在找到太多墓碑之前收集的任何实时数据.

好吧,要问它更简单; 当tombstone_failure_threshold超过时会发生什么?

INFO [HintedHandoff:36] 2014-02-12 17:44:22,355 HintedHandOffManager.java (line 323) Started hinted handoff for host: fb04ad4c-xxxx-4516-8569-xxxxxxxxx with IP: /XX.XX.XXX.XX
ERROR [HintedHandoff:36] 2014-02-12 17:44:22,667 SliceQueryFilter.java (line 200) Scanned over 100000 tombstones; query aborted (see tombstone_fail_threshold)
ERROR [HintedHandoff:36] 2014-02-12 17:44:22,668 CassandraDaemon.java (line 187) Exception in thread Thread[HintedHandoff:36,1,main]
org.apache.cassandra.db.filter.TombstoneOverwhelmingException
    at org.apache.cassandra.db.filter.SliceQueryFilter.collectReducedColumns(SliceQueryFilter.java:201)
    at org.apache.cassandra.db.filter.QueryFilter.collateColumns(QueryFilter.java:122)
    at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:80)
    at org.apache.cassandra.db.filter.QueryFilter.collateOnDiskAtom(QueryFilter.java:72)
    at org.apache.cassandra.db.CollationController.collectAllData(CollationController.java:297)
    at org.apache.cassandra.db.CollationController.getTopLevelColumns(CollationController.java:53)
    at org.apache.cassandra.db.ColumnFamilyStore.getTopLevelColumns(ColumnFamilyStore.java:1516)
    at org.apache.cassandra.db.ColumnFamilyStore.getColumnFamily(ColumnFamilyStore.java:1335) …
Run Code Online (Sandbox Code Playgroud)

cassandra tombstone

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

两个div:一个固定,另一个伸展

我想完成这个: 的div-固定和拉伸

但是我很难让两个中间的div好玩.如果我将它们都设置为相对数字(30%和70%),它"工作",但左侧div会随着用户更改浏览器窗口宽度而改变大小.

 #floatitleft{width:30%; float:left;}
 #floatitright{width:70%; float:left;}
Run Code Online (Sandbox Code Playgroud)

我想要的是,如图所示

 #floatitleft{width:300px; float:left;}
 #floatitright{width:100%; float:left;}
Run Code Online (Sandbox Code Playgroud)

但这会导致"floatitright"最终落在floatitleft之下.如果我将它设置为70%它最终会到达"floatitleft"的权利,但是当我稍微更改浏览器大小时,它会再次在下面结束.该怎么办?

更新:最终我最终得到:

#topper{
    height:100px;
    width:100%;
    background-color:blue;
}
#wrapperz{
    height:inherit;
    width:100%;
}
#wrapperz p{margin:0 0 0 0px; padding:10px 10px 0px 10px; color:#0F0F0F;}
#wrapperz #floatitleft{
    width:300px;
    float:left;
}
#wrapperz #floatitright{
    margin-left: 300px;
    min-width:300px;
}
#bottommer{
    height:100px;
    width:100%;
    background-color:red;
}
Run Code Online (Sandbox Code Playgroud)

哪个用作:

<div id="topper">
test
</div>

<div id="wrapperz">

<div id="floatitleft">
<p> Stuff </p>
</div>

<div id="floatitright">
<p> Stuff </p>
</div>

<div style="clear: both;"/>

</div> <!-- Close Wrapper -->

<div id="bottommer">
test
</div>
Run Code Online (Sandbox Code Playgroud)

请注意,这不是正确的HTML,但它只是作为我的示例的解决方案.此外," …

html css

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

AddressOf带参数

我需要将groupID(和另一个整数)链接到我动态添加的按钮..任何想法?

我可以做什么;

AddHandler mybutton.Click, AddressOf PrintMessage

Private Sub PrintMessage(ByVal sender As System.Object, ByVal e As System.EventArgs)
    MessageBox.Show("Dynamic event happened!")
End Sub
Run Code Online (Sandbox Code Playgroud)

我不能做什么,但想要;

AddHandler mybutton.Click, AddressOf PrintMessage(groupID)

Private Sub PrintMessage(ByVal groupID as Integer)
    MessageBox.Show("Dynamic event happened!" & groupID .tostring)
End Sub
Run Code Online (Sandbox Code Playgroud)

vb.net

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

跨平台换行混乱

由于某种原因,我的写文本文件功能突然停止工作.

void write_data(char* filename, char* writethis)
{
    ofstream myfile;
    myfile.open (filename, std::ios_base::app);
    myfile << endl << writethis;
    myfile.close();
}
Run Code Online (Sandbox Code Playgroud)

该函数是从循环中调用的,所以基本上它以空行开始,并在新行上附加以下所有"writethis"行.

然后突然间,没有更多的新行.所有文本都附加在一行上.所以我做了一些挖掘,我遇到了这个:

  1. Windows = CR LF
  2. Linux = LF
  3. MAC <0SX = CR

所以我改行了

myfile << "\r\n" << writethis;
Run Code Online (Sandbox Code Playgroud)

它再次起作用.但现在我很困惑.我正在使用linux进行编码,但是在使用filezilla传输后,我正在阅读使用该程序在Windows上创建的文本文件.现在哪一部分导致文本文件中的行显示为一行?

我非常确定"endl"对linux工作得很好所以现在我认为windows 使用filezilla传输文件搞砸了文件?弄乱文本文件写入(和读出)的方式将保证我的程序中断,所以如果有人可以解释这一点,我会很感激.

我也不记得我在我的程序中改变了什么导致它破坏,因为它之前工作得很好.我添加的唯一内容是线程.

编辑: 我已经尝试从ASCII/Binary交换传输模式(甚至删除了force-ASCII-for-txt-extension),但它没有区别.换行符出现在linux中,但不出现在Windows上. FZ-messup

有多奇怪

c c++ text newline

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

如何存储对象供以后使用并使其可搜索

目前我每次使用一个向量来存储指向对象的指针,但这感觉有点傻.可能有更好的方法,但我还没找到.

What I'm doing:                      Example usage:

原型

问题:

  1. 如果我想要检索某个日期,我必须遍历向量中的所有项目,以查看RecPaymentsStack.stackDate是否与用户请求的日期匹配.
  2. RecPaymentStack目前实际上完全没用,因为我应该做的是,在添加新项目时,检查是否已经为新项目的Date属性创建了"RecPaymentStack.stackDate",如果是,则添加新指针将"RecPayments"转换为"RecPaymentStack"对象内的指针数组.但是怎么样?

我可能不必要地复杂的事情(这是我做了很多),所以如何像这样的explenation 应该做将是非常好的.

详细信息:(如果我太模糊了)

以下示例应该类似于可以保存某些项目(RecPayments)的日历,并且这些项目按日期分组(RecPaymentsStack).

struct RecPayments
{
    std::string name;
    Date* date;
    float cost;
};

struct RecPaymentsStack
{
    Date* stackDate; //This stack's date
    RecPayments * thePaymentItem; //Hold pointer to the actual item
};
Run Code Online (Sandbox Code Playgroud)

这就是我目前正在存储它们的方式

std::vector<RecPaymentsStack*> RecPaymentsVector; //This vector will hold pointers to all the Recurring Payments

void addRecurring(std::string theDate,std::string theName,float theCost)
{
    //New recurring payment
    RecPayments * newPaymentItem = new RecPayments; …
Run Code Online (Sandbox Code Playgroud)

c++ struct pointers class object

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

无法编译curlpp

我已经在这几个小时了(这就是今天)所以我真的可以使用一些帮助.我总是在Windows环境中编写代码,所以我试图将curlpp添加到我的Code :: Blocks项目中.

  1. 我下载了curl-7.22.0-devel-mingw32并将所有这些库添加到Code :: Blocks项目中.
  2. 我下载了curl-7.22.0并使用vc6curl.dsw编译了libcurl.lib,将其添加到Code :: Blocks项目中.
  3. 已下载curlpp -0.7.3
  4. 将MinGW\lib\libwsock32.a添加到Code :: Blocks项目中.
  5. 在项目中添加了以下目录: curlpp-0.7.3\includecurl-7.22.0\include

但是我得到了很多"未定义的引用"错误,所以我猜这意味着curlpp也需要编译.它包含一个VC8项目,所以我下载了Visual C++ 2005 Express并进行了安装.

打开项目时遇到的第一个错误是无法加载示例.我想这不是一个真正的问题.尝试立即构建项目,给出错误"无法打开包含文件:'curl/curl.h'",因此我将cURL include文件夹curl-7.22.0\include添加到项目中,然后重试.

1>------ Build started: Project: curlpp, Configuration: DebugDynamic Win32 ------
1>Compiling...
1>cURLpp.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Easy.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
1>Exception.cpp
1>C:\Users\admin\Downloads\curl-7.22.0\curl-7.22.0\include\curl/curl.h(62) : fatal error C1083: Cannot open include …
Run Code Online (Sandbox Code Playgroud)

c++ codeblocks curlpp

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

最好的重载方法匹配有一些无效的参数

TryGetValue出于某种原因无法上班.

Dictionary<String,String> testdict = new Dictionary<String,String>();
String teststr = "test";
if(testdict.TryGetValue(teststr,out value))
{
    //Ladida
}
Run Code Online (Sandbox Code Playgroud)

收到错误:

The best overloaded method match for 'System.Collections.Generic.Dictionary<string,string>.TryGetValue(string, out string)' has some invalid arguments
Run Code Online (Sandbox Code Playgroud)

谁能告诉我我的代码有什么问题?

c#

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

永远不会调用WebClient.DownloadProgressChanged

我为WebClient的DownloadProgressChanged事件添加了一个事件处理程序,但它似乎永远不会触发.该文件已成功下载,但未更新其进度.

public class DownloadFile
{
    private File file = null;

    public DownloadFile(File file)
    {
        this.file = file;
    }

    public void startDownloadThread()
    {
        Console.WriteLine("Starting Download : "+file.URL);

        var t = new Thread(() => DownloadThread(file));
        t.Start();
    }

    public Action<string> action_error_downloadFailed = Console.WriteLine;
    private void DownloadThread(File file) //Unnecessary argument but whatever ;D
    {
        try
        {
            string url = file.URL;
            string savepath = file.DestinationDir + "\\" + file.Filename;

            WebClient_B client = new WebClient_B();
            client.Proxy = null; //default to no proxy
            client.DownloadProgressChanged += …
Run Code Online (Sandbox Code Playgroud)

.net c#

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

无法从程序集加载类型System.Runtime.Versioning.TargetFrameWorkAttribute

我正在尝试编译一个使用Newtonsoft.Json.dll单声道库的程序

编译命令

gmcs Program.cs etcetera.cs -r:Newtonsoft.Json.dll -r:Argotic.Core.dll
Run Code Online (Sandbox Code Playgroud)

结果:

Missing method .ctor in assembly Newtonsoft.Json.dll, type System.Runtime.Versioning.TargetFrameworkAttribute
Can't find custom attr constructor image: Newtonsoft.Json.dll mtoken: 0x0a000053
Run Code Online (Sandbox Code Playgroud)

然后当尝试运行程序(mono Program.exe)时会抛出错误:

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Newtonsoft.Json'.

  at my_program.CJSONStuff.serialize (System.Collections.Generic.Dictionary`2 obj) [0x00000] in <filename unknown>:0 

  at my_program.TheObjDB.getAllSerialized () [0x00000] in <filename unknown>:0 

  at my_program.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'Newtonsoft.Json'.

  at my_program.CJSONStuff.serialize …
Run Code Online (Sandbox Code Playgroud)

c# mono json

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

UDP发送的数据存储在哪里?

我之前从未使用过UDP,所以我试了一下.为了看看会发生什么,我让"服务器"每半秒发送一次数据,客户端每隔3秒接收一次数据.因此,即使服务器发送速度远远超过了客户端可以接收数据时,客户端仍然都一个个整齐地接受它.

谁能解释为什么/如何发生这种情况?数据缓冲在哪里?

发送

class CSimpleSend
{
    CSomeObjServer obj = new CSomeObjServer();

    public CSimpleSend()
    {
        obj.changedVar = varUpdated;
        obj.threadedChangeSomeVar();
    }

    private void varUpdated(int var)
    {
        string send = var.ToString();
        byte[] packetData = System.Text.UTF8Encoding.UTF8.GetBytes(send);

        string ip = "127.0.0.1";
        int port = 11000;

        IPEndPoint ep = new IPEndPoint(IPAddress.Parse(ip), port);
        Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
        client.SendTo(packetData, ep);

        Console.WriteLine("Sent Message: " + send);
        Thread.Sleep(100);
    }
}
Run Code Online (Sandbox Code Playgroud)

所有CSomeObjServer都是每半秒递增一个整数

接收

class CSimpleReceive
{
    CSomeObjClient obj = new CSomeObjClient();

    public Action<string> showMessage;
    Int32 port = 11000; …
Run Code Online (Sandbox Code Playgroud)

c# udp

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

标签 统计

c# ×4

c++ ×3

.net ×1

c ×1

cassandra ×1

class ×1

codeblocks ×1

css ×1

curlpp ×1

html ×1

json ×1

mono ×1

newline ×1

object ×1

pointers ×1

struct ×1

text ×1

tombstone ×1

udp ×1

vb.net ×1