小编Mor*_*sen的帖子

为什么facebook使用了提交按钮,而不仅仅是类似按钮的链接?

在此输入图像描述

我一直想知道为什么facebook使用像按钮提交而不只是简单的链接来执行操作,下面就像按钮代码一样.

<form rel="async" class="live_184361748268334 commentable_item autoexpand_mode" method="post" action="/ajax/ufi/modify.php" data-live="{&quot;seq&quot;:0}" onsubmit="return Event.__inlineSubmit(this,event)">
  <input name="charset_test" value="€,´,€,´,?,?,?" type="hidden">
  <input autocomplete="off" name="post_form_id" value="1ef694751d74ce24382cfa6181f1adfe" type="hidden">
  <input name="fb_dtsg" value="_19R5" autocomplete="off" type="hidden">
  <input autocomplete="off" name="feedback_params" value="{&quot;actor&quot;:&quot;514782389&quot;,&quot;target_fbid&quot;:&quot;184361748268334&quot;,&quot;target_profile_id&quot;:&quot;514782389&quot;,&quot;type_id&quot;:&quot;17&quot;,&quot;source&quot;:&quot;1&quot;,&quot;assoc_obj_id&quot;:&quot;&quot;,&quot;source_app_id&quot;:&quot;2309869772&quot;,&quot;extra_story_params&quot;:[],&quot;content_timestamp&quot;:&quot;1298066944&quot;,&quot;check_hash&quot;:&quot;e76c88ca6e20b4a0&quot;}" type="hidden">
  <div class="UIImageBlock clearfix"><i class="UIImageBlock_Image UIImageBlock_ICON_Image img sp_4b2fk0 sx_b64365"></i>
    <div class="UIImageBlock_Content UIImageBlock_ICON_Content"><span class="uiStreamSource"><a href="/aleem.sheikh/posts/184361748268334"><abbr title="Saturday, February 19, 2011 at 3:09am" data-date="Fri, 18 Feb 2011 14:09:04 -0800" class="timestamp">4 hours ago</abbr></a></span><span class="UIActionLinks UIActionLinks_bottom" data-ft="{&quot;type&quot;:&quot;action&quot;}"> ·
        <button class="like_link stat_elem as_link" title="Like this item" type="submit" name="like" onclick="fc_click(this, false); return true;"><span class="default_message">Like</span><span class="saving_message">Unlike</span></button>
        ·
        <label class="uiLinkButton …
Run Code Online (Sandbox Code Playgroud)

html forms ajax button hyperlink

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

双指针问题

我正在尝试制作一个树模板,每个节点上可以有任意数量的子节点.这是我在节点类中的addChild函数的代码 -

template<typename T>
void Tree<T>::Node::addChild(T& value) {
    Node* temp = new Node(value, this); //second parameter is for parent
    numOfChildren++;
    children*[numOfChildren] = temp;
}
Run Code Online (Sandbox Code Playgroud)

而不是有一个左右孩子的指针,我想我应该做一个双指针(指向Node*数组的指针).

节点**儿童;

我不断收到"''令牌"错误之前的"预期主要表达式".我猜我正在错误地访问2D数组?或许我应该以不同的方式去做?如果我只是生孩子,你认为它会起作用吗?

节点*孩子?

如果我只有一个Node*并且每个元素都是不同的节点,我觉得它可能会起作用.

任何帮助表示赞赏.

c++ tree pointers data-structures

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

尽管采用了错误数据类型的地址,代码仍会编译

#include <iostream>
#define n 255

using namespace std;


int main()
{
int i=n;
int *ptr=&i;
int const *ptr_1=&i;
const int *ptr_2=&i;
const int * const ptr_3=&i;
}
Run Code Online (Sandbox Code Playgroud)

为什么这个代码在Visual C++,Dev C++和G ++中编译?链接到- Ideone -

c++ const

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

将MongoDb与Java Servlet一起使用

我在Java servlet上使用Mongo DB时遇到了问题.

我的servlet有很多方法(~20)访问数据库以检索和添加数据.一个非常简短的例子:

public static String getSomething(String s) {
  String json = "[]";
  JSONArray jsonArray = new JSONArray();
  DBCollection table;

  try {
    Mongo mongo = new Mongo("localhost", 27017);
    DB db = mongo.getDB( "myDb" );  
        BasicDBObject quoteQuery = new BasicDBObject("abc", abc);
    DBCursor cursor = table.find(quoteQuery);

    try {
      while(cursor.hasNext()) {
        jsonArray.put(cursor.next());
      }
    } finally {
      cursor.close();
    }

// ...
Run Code Online (Sandbox Code Playgroud)

现在问题是当这个Java servlet部署在linux服务器上时,它可以正常工作10天左右.

之后它崩溃了.

当我去我的var/log目录中的mongodb.log时,我得到以下重复输出:

"因为太多的开放连接而拒绝连接"

我不确定现在在哪里编辑或如何处理这个问题.我试图增加服务器中打开连接的限制,但仍然有相同的结果.

有什么建议?

java servlets mongodb

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

Java - for循环问题

我有两节课.我希望下面的类中的for循环中的代码运行两次,但是当我发送int i = 0和条件时i < 2,它似乎只运行一次.正如你所看到的,我必须将它设置i < 3为让它运行两次.

import java.util.Scanner;

public class LPrint {       
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("sender: ");

        String a = input.next();

        System.out.println("recepiant: ");

        String b = input.next();

        Letter one = new Letter(a, b);

        System.out.println("letter: ");

        for (int i = 0; i < 3; i++) {
            one.body = one.body.concat(input.nextLine() + "\n");
        }

        System.out.print(one.getLetter());
    }
}
Run Code Online (Sandbox Code Playgroud)

在另一个类中,String body = ""它只用于String result = ("to …

java for-loop class

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

不支持C++类型槽参数

我正在尝试发出信号并发送两个参数,一个是Song对象列表,第二个是QtGui.QTableView对象.

我试过这样做:

self.emit(QtCore.SIGNAL("searchOutput(list, QtGui.QTableView)"), songsObjs, self.table)
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

TypeError: C++ type 'list' is not supported as a slot argument type
Run Code Online (Sandbox Code Playgroud)

我能做什么?

python qt4 pyqt4

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

将状态栏添加到状态栏 - Qt

我有一个以下列格式保存的图标:

//icon.h
extern const unsigned char icon[];

//icon.cpp
const unsigned char icon[]={0x17,0x3f,0x0c,....,0x10,0x06}
Run Code Online (Sandbox Code Playgroud)

现在我想将此图标添加到状态栏.

我该怎么做?

谢谢.

c++ icons qt

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

将字符串放入堆栈C++时出错

我的"程序语言"(C++)存在很大问题.我想打印一堆字符串.

void show(stack<string> stos) {
  while (!stos.empty()) {
    cout << stos.pop() << endl;
  }
}
Run Code Online (Sandbox Code Playgroud)

c++ stack

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

如何为使用java.util.regex的函数编写JUnit

这是我写的功能:

private String getPatternFromLogFile() {
    final File dir = new File(".");
    try {
        String fileContents = readFile(dir.getCanonicalPath()
                + "\\sshxcute.log");
        Pattern patternDefinition = Pattern.compile(
                ".*Start to run command(.*)Connection channel closed",
                Pattern.DOTALL);
        Matcher inputPattern = patternDefinition.matcher(fileContents);
        if (inputPattern.find()) {
            return inputPattern.group(1);
        }
    } catch (IOException e) {
        LOGGER.log(Level.DEBUG, e.getMessage());
    }
    return "";
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试获取文件"sshxcute.log"的内容. readFile()是这个类本身的一个函数.

我想编写一个测试用例,它进入if块内并返回我想要的任何内容,以便我可以断言它.

这是正确的方法吗?

有人可以帮我写JUnit吗?我是JUnit的新手,任何帮助都会很棒.

谢谢.

java junit

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

如何使用PHP显示MySQL的多行?

name|fileid|refferer|clicks|
good|same  |asda.com|20    |
good|same  |bsad.com|500   |
good|diffnt|csad.com|600   |
dddd|dasdds|asad.com|200   |
Run Code Online (Sandbox Code Playgroud)

输出:

[asda.com,20],[bsda.com,500]
Run Code Online (Sandbox Code Playgroud)

我尝试了什么:

$result = mysql_query("SELECT * FROM `ios7_refclean`.`graph_refferer_table` WHERE Name = 'good'");
$rowz = mysql_fetch_assoc($result);
foreach ($rowz as $col => $value) {
  if (($col !== "fileid") && ($col !== "name")) {
  echo ",['" . $col . "'," . $value . "]";
}
Run Code Online (Sandbox Code Playgroud)

然而,只有一排商品即将到来,其他行不会到来.此外,我无法将$colrefferer与$value带方括号的点击链接起来.

php mysql select

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

无法在system.diagnosis中获取startinfo方法

Error   1   'WindowsFormsApplication1.Process' does not contain a definition for 'StartInfo' and no extension method 'StartInfo' accepting a first argument of type 'WindowsFormsApplication1.Process' could be found (are you missing a using directive or an assembly reference?) 
D:\Anas Work\ANAS FOLDER\4th Semester\Introduction To operating System\Programs\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs  24  16  WindowsFormsApplication1
Run Code Online (Sandbox Code Playgroud)

我的代码如下:

process p1= new process();
p1.startinfo.filename="chorome.exe";
Run Code Online (Sandbox Code Playgroud)

c#

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

C++中的字符串:good()和get()的问题

我想从一个文件中读取.我用的代码是

      ifstream is;char c;
      is.open("text.txt");
      while(is.good() && !isdigit(is.peek()))
      {     is.get(c)
            word+=c;

       }
Run Code Online (Sandbox Code Playgroud)

问题是最后一个字符被读取两次(为什么?)例如,如果文件中的单词是粉红色的,那么单词的值在循环后变为粉红色请建议解决方案

c++ string file-io

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

标签 统计

c++ ×5

java ×3

ajax ×1

button ×1

c# ×1

class ×1

const ×1

data-structures ×1

file-io ×1

for-loop ×1

forms ×1

html ×1

hyperlink ×1

icons ×1

junit ×1

mongodb ×1

mysql ×1

php ×1

pointers ×1

pyqt4 ×1

python ×1

qt ×1

qt4 ×1

select ×1

servlets ×1

stack ×1

string ×1

tree ×1