标签: nested

线程阻止我的Android UI

我的Android应用程序中的java Threads有问题.我的嵌套线程阻止了我的UI,我该如何解决这个问题呢?

MyClass.java

package com.knobik.gadu;

import android.util.Log;

public class MyClass {

    public void StartTheThread() {

        Thread Nested = new Thread( new NestedThread() );
        Nested.run();
    }

    private class NestedThread implements Runnable {

        public void run() {

            while (true) {
                Log.d( "DUPA!", "debug log SPAM!!" );
            }

        }

    }

}
Run Code Online (Sandbox Code Playgroud)

这就是我运行它的方式:

package com.knobik.gadu;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class AndroidGadu extends Activity {
    public …
Run Code Online (Sandbox Code Playgroud)

java multithreading android nested class

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

使用WPF和C#嵌套数据绑定

我正在尝试制定预算计划.我需要在哪里放置带有文本块列表的分组框.

<ItemsControl DataContext="{Binding}">
  <ItemsControl.ItemTemplate>
    <DataTemplate>
      <GroupBox Header="{Binding}">
        <ItemsControl DataContext="{Binding}">
          <ItemsControl.ItemTemplate>
            <DataTemplate>
              <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Text}" />
                <TextBlock Text="{Binding Value}" />
              </StackPanel>
            </DataTemplate>
          </ItemsControl.ItemTemplate>
        </ItemsControl>
      </GroupBox>
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)

我需要以某种方式将一个列表(可能是?)与groupboxs数据绑定,所以我创建了一个组合框列表,其中一些行是一个带有货币值的文本.这样我就可以创建一个名为"Apartment"的组,其中包含两行"Rent $ 3000"和"Maintenance $ 150".然后我可以有一个名为"Car"的第二组,例如"保险","贷款"和"维护".

但是我该如何对此进行数据处理呢?我将如何在C#中执行此操作.我不知所措.

c# data-binding wpf xaml nested

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

CodeIgniter嵌套控制器?

我是CodeIgniter的新手,我希望我的问题能有一个简单的答案.

我有一个网站,里面有几个菜单项(menuA,menuB和menuC).我用控制器中的一个主控制器,index(),menuA(),menuB()和menuC()对其进行了建模.被调用函数设置会话值currentMenu并包括标题,X,页脚.其中X取决于所调用的函数.然后标题高亮显示选择的菜单.

在menuC(我的webapp中的帐户设置)中,我想有一个不同的控制器来控制AccountSettings/NotLoggedIn的子视图.

从逻辑上讲,我希望menuC()包含页眉和页脚,然后将调用转发给管理登录或子页面的子控制器.

我使用错误的框架还是有直接的方法来实现这一目标?

nested codeigniter controllers

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

在ArrayList中创建ArrayList

因此,对于我正在处理的程序,我正在尝试创建一个解析文本文件的方法.使用文本文件中的值,创建一个ArrayListArrayList.到目前为止,这是我的代码:

public ArrayList<ArrayList<String>> getRels(String relsFile)
{
   String[] currentId;
   int i = -1;

   ArrayList<ArrayList<String>> relsList = new ArrayList<ArrayList<String>>();
   relsList.add(new ArrayList<String>());

   try
   {
      // Open the file that is the first 
      // command line parameter
      FileInputStream fstream = new FileInputStream(relsFile);
      BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
      String strLine;

      while ((strLine = br.readLine()) != null)
      {
         // Add values to array list
         currentId = strLine.split(",");
         relsList.get(++i).add(currentId[0]);
         //???????????          
      }   
      //Close the input stream
      in.close();
   }        
   catch (Exception e)
   {
      System.err.println("Error: …
Run Code Online (Sandbox Code Playgroud)

java nested arraylist nested-class text-files

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

Rails 3.1 - 使用范围查找未注册的学生

# student.rb
has_and_belongs_to_many :courses

# course.rb
has_and_belongs_to_many :students
Run Code Online (Sandbox Code Playgroud)

我正在尝试在学生模型中创建一个范围,以检查他们是否注册了课程.

我提出的最好的是:

scope :unenrolled, where(Student.courses.count => 0)
Run Code Online (Sandbox Code Playgroud)

但后来我得到了错误信息

未定义的方法`课程'

有人提出任何建议吗?

scope nested associations ruby-on-rails-3.1

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

PHP每个循环在数组中更深一层

我正在尝试遍历一个数组,每次都向另一个数组添加一个新级别.让我举例说明 - 变量$ arr的值每次都不同

$arr = array("1","5","6");
Run Code Online (Sandbox Code Playgroud)

循环

$index[$arr[0]];
Run Code Online (Sandbox Code Playgroud)

循环

$index["1"][$arr[1]]  // "1" since this key was filled in by the previous loop, continuing with a new key
Run Code Online (Sandbox Code Playgroud)

循环

$index["1"]["5"][$arr[2]] // same as previous loop
Run Code Online (Sandbox Code Playgroud)

- 完成所有$ arr的项目,结果是$ index ["1"] ["5"] ["6"] -

问题是我不知道$arr数组包含多少值.然后,我不知道如何继续,例如,$index["1"]当第一个值$arr已经循环到下一个数组级别时(换句话说:添加另一个键).

任何人?

php arrays loops nested

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

嵌套字典python

如何在python中创建嵌套字典所以,我希望数据采用这种形式.

{Category_id: {Product_id:... productInstance},{prod_id_1: this instance}}
Run Code Online (Sandbox Code Playgroud)

基本上如果我做这样的事情让我说要检查是否

product_id = 5 is in category 1.
Run Code Online (Sandbox Code Playgroud)

所以,如果我这样做

Dict[1].has_key(5)--> be true or false..
Run Code Online (Sandbox Code Playgroud)

我的错误代码是

fin = readFile(db)
categoryDict = defaultdict(list)
itemDict ={}
for line in fin:
    itemInstance = setItemInstances(line)

    itemDict[itemInstance._product_id] = itemInstance
    categoryDict[itemInstance._category_id].append(itemDict)




EDIT: example
dict = {1: { p_id: p_instance_1,
           p_id_2: p_ins_2}
     2:{ p_in_this_cat_id: this isntance}}
Run Code Online (Sandbox Code Playgroud)

谢谢

python dictionary nested

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

深层复制结构到POSIX共享内存

我有两个结构:

struct bets{
   int bets[36];
   int last_bet;
}bets
struct board{
   int type;
   bets *bet;
 }board
Run Code Online (Sandbox Code Playgroud)

我创造了一大块鲥鱼记忆sizeof(board).所以,我在共享内存中得到了一个指向Board的指针(以免称之为ptr).我创建了一个新的boardbets结构 board *b,bets * bts....添加board->bet = bts.现在,我将"b"复制到了ptr memcpy(ptr, bts, sizeof(board)).我可以访问ptr->type.但是当我尝试访问时 ptr->bet->last_bet,我遇到了分段错误错误.

我也试过像这样复制:

board *b;
memcpy(ptr, b, sizeof(board));
bets *bts;
memcpy(ptr->bet, bts, sizeof(bets)).
Run Code Online (Sandbox Code Playgroud)

仍然得到分段错误错误.

如何将两个struct one复制到另一个内部并仍然可以访问嵌套的?

c memory shared nested structure

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

在scss中进行后向嵌套?

有没有办法在scss中向后嵌套?在css中,当我想覆盖IE或其他浏览器特定样式的样式时,我喜欢选择器在它选择它覆盖的样式之后.像这样

CSS

.class-a .class-b{ color: pink }
.ie6 .class-a .class-b{ color: blue}
Run Code Online (Sandbox Code Playgroud)

这可能在scss?因为现在我这样写(我不喜欢)

SCSS

.class-a{
  .class-b { color: pink }
  .othercss { bla bla bla: sdfsd }
  .fsdfsd { dfsdfs: sdfsd }
  }
}

body.ie7 .class-a .class-b{ color:blue }
Run Code Online (Sandbox Code Playgroud)

nested sass

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

jQuery scale div内容(嵌套div)

如何让红色框与红色框一起缩放?(使用jQuery-UI)

http://jsfiddle.net/Y54EB/1/

这是基本代码,CSS:

#outer {
    position:relative;
    height:100px;
    width:150px;
    z-index:1;
    background:#F00;
}
#nested {
    position:absolute;
    left:50px; top:20px;
    width:50px; height:20px;
    z-index:2;
    background:#00F;
    cursor:pointer;
}
Run Code Online (Sandbox Code Playgroud)

和HTML:

<div id="outer">
<div id="nested" onclick="$('#outer').effect('scale', {scale:'content',percent:50}, 1000);" />
</div>
Run Code Online (Sandbox Code Playgroud)

html jquery nested absolute scale

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