问题列表 - 第30475页

在多线程管道中维护订单

我正在考虑处理管道的多线程架构.我的主处理模块有一个输入队列,从中接收数据包.然后,它对这些数据包执行转换(解密等)并将它们放入输出队列.

线程来自于许多输入包可以使它们的内容彼此独立地转换.

但是,妙语是输出队列必须与输入队列具有相同的顺序(即,第一个拉出输入队列必须首先被推入输出队列,无论其转换是否先完成.)

当然,输出队列会有某种同步,所以我的问题是:确保维持这种排序的最佳方法是什么?

multithreading

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

在FlashDevelop中为Halo/Flex 4设置compiler.theme选项

这是与ant build.xml一起使用的:

<mxmlc file="${module.main.dir}/main.mxml" keep-generated-actionscript="false" output="${module.output.dir}/main.swf" fork="${flex.fork}">
    <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
    <source-path path-element="${FLEX_HOME}/frameworks"/>
    <compiler.theme file="${FLEX_HOME}/frameworks/themes/Halo/halo.swc"/>
</mxmlc>
Run Code Online (Sandbox Code Playgroud)

我在项目>属性>编译器选项>附加编译器选项中尝试了以下值,但它们都没有工作:

-theme=PATH_TO/halo.swc
-compiler.theme=PATH_TO/halo.swc
-theme=file=PATH_TO/halo.swc
-compiler.theme.file=PATH_TO/halo.swc
-theme.file=PATH_TO/halo.swc
Run Code Online (Sandbox Code Playgroud)

谢谢.

apache-flex flashdevelop flex4 halo

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

将字符串解析为JSON

我正在用org.json中的lib解析这个JSON字符串,我无法理解为什么我将下面的输出放到日志中.

ArrayList<String> al = new ArrayList<String>();
JSONObject demo = new JSONObject("{\"00408C88A2E6\":{\"id\":\"00408C88A2E6\",\"name\":\"Lab\"},\"00408C91188B\":{\"id\":\"00408C91188B\",\"name\":\"Lab1\"},\"00408C944B99\":{\"id\":\"00408C944B99\",\"name\":\"Lato1\"},\"00408C944BA0\":{\"id\":\"00408C944BA0\",\"name\":\"Lato\"}}");
Iterator<String> iterator =  demo.keys();
while (iterator.hasNext() ){    
  al.add((String)iterator.next());
  Log.i(LOG_TAG, "size al into while " + al.size());
  Log.i(LOG_TAG, "MAC " + iterator.next() + " for the user " + userId);
} 
Run Code Online (Sandbox Code Playgroud)

记录输出

07-12 08:55:34.056: INFO/parse(285): size al into while 1
07-12 08:55:34.056: INFO/parse(285): MAC 00408C91188B for the user nweb
07-12 08:55:34.066: INFO/parse(285): size al into while 2
07-12 08:55:34.066: INFO/parse(285): MAC 00408C944B99 for the user nweb
07-12 08:55:34.066: INFO/parse(285): size …
Run Code Online (Sandbox Code Playgroud)

java parsing json iterator loops

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

如何在Windows Mobile上解码url编码字符串?

我从服务器收到了一个url编码字符串,例如http%3a%2f%2fstatic.csbew.com%2f%2fcreative%2fpd_test_pptv%2f320x60.png

我想将它解码为普通的url字符串.我发现这个方法,但这不适用于紧凑的框架.

string url = System.Web.HttpUtility.UrlDecode(strURL, Encoding.GetEncoding("GB2312"));
Run Code Online (Sandbox Code Playgroud)

有关如何解码字符串的任何想法?

c# urlencode windows-mobile

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

哪种clearfix方法?

/*清除修复*/

.clearfix:after {content: ".";display:block;height:0;clear:both;visibility:hidden;}
* html .clearfix {height:1%;}
Run Code Online (Sandbox Code Playgroud)

要么

.clearfix:after {content: ".";display:block;height:0;clear:both;visibility:hidden;}
* html .clearfix, *:first-child+html .clearfix {zoom:1;}
Run Code Online (Sandbox Code Playgroud)

哪种方法效果最好?我现在使用第一个,从来没有问题..谢谢.

html css css-float

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

本地通知"didReceiveLocalNotification"调用两次

我使用以下方式处理本地通知:

- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif
Run Code Online (Sandbox Code Playgroud)

并安排本地通知:

- (void)scheduleNotificationWithInterval:(int)minutesBefore {
    UILocalNotification *localNotif = [[UILocalNotification alloc] init];

    if (localNotif == nil)
        return;

    NSDate *fireDate = [NSDate date];
    localNotif.fireDate = [fireDate dateByAddingTimeInterval:minutesBefore*60];
    localNotif.timeZone = [NSTimeZone defaultTimeZone];
    localNotif.repeatInterval = kCFCalendarUnitMinute;
    localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"LocalEvent notification in %i minutes.", nil),minutesBefore];
    localNotif.alertAction = NSLocalizedString(@"View Details", nil);
    localNotif.applicationIconBadgeNumber = 1;

    NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"This is dict, you can pass info for your notification",@"info",nil];
    localNotif.userInfo = infoDict;

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotif];

    [localNotif release];
    NSLog(@"Event scheduled");
}
Run Code Online (Sandbox Code Playgroud)

当我收到通知时, …

iphone notifications ios uilocalnotification

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

MediaRecorder.setMaxDuration(int timer)当计时器到期时会发生什么

根据文档,http://developer.android.com/reference/android/media/MediaRecorder.html#setMaxDuration(int)

计时器到期时录制停止.

通过停止,它们是否意味着它在内部调用recorder.stop()然后在调用recorder.start()之前恢复应用程序所处的状态?

android

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

请帮我使用对象的继承

我尝试在所有对象类中使用继承.下面是我的例子

public class Member : Order
{
   private string _employeeId;
   private string _employeeName;

   public string EmployeeId
   {
       get { return _employeeId; }
       set { _employeeId = value; }
   }

   public string EmployeeName
   {
       get { return _employeeName; }
       set { _employeeName = value; }
   }

}


public class Order
{
    private int _id;
   private string _itemName;

   public string ID
   {
       get { return _id; }
       set { _id = value; }
   }

   public string ItemName
   {
       get { return _itemName; …
Run Code Online (Sandbox Code Playgroud)

c#

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

LINQ.OrderBy单个字母,然后另一个字母

我试图与Linq做一个特殊的订单.它必须按S然后按P然后NB然后V然后NC.我不确定它是否是最好的方法,但这就是我所拥有的:

repeater.DataSource = query.OrderBy(p => p.Title ?).ThenBy(?).ThenBy(?);
Run Code Online (Sandbox Code Playgroud)

c# linq sorting lambda

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

错误:可写原子属性无法将合成的setter/getter与用户定义的setter/getter配对

我最近尝试编译一个较旧的Xcode项目(曾经编译得很好),现在我看到了很多这种形式的错误:

error: writable atomic property 'someProperty' cannot pair a synthesized setter/getter with a user defined setter/getter

导致这些错误的代码模式总是如下所示:

// Interface:

@property (retain) NSObject * someProperty;

// Implementation:

@synthesize someProperty; // to provide the getter
- (void)setSomeProperty:(NSObject *)newValue
{
    //..
}
Run Code Online (Sandbox Code Playgroud)

我可以看到为什么会生成错误.我告诉编译器合成我的属性访问器(getter和setter),然后立即手动覆盖setter.那段代码总是闻到一点点气味.

那么,这样做的正确方法是什么?如果我使用@dynamic而不是@synthesize,我将不得不写入getter.这是唯一的方法吗?

compiler-construction xcode properties objective-c

127
推荐指数
3
解决办法
3万
查看次数