半城柳色半声笛

文章 评论 浏览 26

半城柳色半声笛 2024-12-30 22:35:48

我只编辑并发布了相关部分以找到最大值。

int i;
float largest = 0;

for (i = 0; i<numberOfPixels; i++)
{
    //NSLog(@"i is: %i", i); 
    int j;
    int numberOfSamplesPerPixel = bufferSize/numberOfPixels;
    float average = 0;

    for (j=i*numberOfSamplesPerPixel; j<(i+1)*numberOfSamplesPerPixel; j++){

        average += frame[j];
        average = average/numberOfSamplesPerPixel;
    }

    waveDisplayArray[i] = average;

    if( largest < average )
    {
        largest = average;
    }

    NSLog(@"Average %i is %f",i,average);
    NSLog(@"waveDisplay Array %i: %f",i, waveDisplayArray[i]);

}
NSLog(@"Largest  %f",largest);

I have edited and posted only relevant part to find the largest value.

int i;
float largest = 0;

for (i = 0; i<numberOfPixels; i++)
{
    //NSLog(@"i is: %i", i); 
    int j;
    int numberOfSamplesPerPixel = bufferSize/numberOfPixels;
    float average = 0;

    for (j=i*numberOfSamplesPerPixel; j<(i+1)*numberOfSamplesPerPixel; j++){

        average += frame[j];
        average = average/numberOfSamplesPerPixel;
    }

    waveDisplayArray[i] = average;

    if( largest < average )
    {
        largest = average;
    }

    NSLog(@"Average %i is %f",i,average);
    NSLog(@"waveDisplay Array %i: %f",i, waveDisplayArray[i]);

}
NSLog(@"Largest  %f",largest);

从数组中提取最大元素

半城柳色半声笛 2024-12-30 17:46:39

QUiLoader 中有一个 load(),但没有 save():

http://developer.qt.nokia.com/doc/qt-4.8/quiloader.html#load

UI 文件格式已记录,并且是 XML。因此,您可以编写自己的 .UI 文件生成器:

http://developer.qt.nokia.com/doc/qt-4.8/designer-ui-file-format.html

事实上,您可以用相反的方式解决这个问题。不是使用编程小部件 API 调用生成对话框...而是使用 XML 生成 .UI 文件。然后您可以将其加载到您的应用程序中或通过 QtDesigner。

(根据您的应用程序的用途或用途,您还可以考虑将其重新考虑为 QtDesigner 插件......在这种情况下,此功能可能是免费的。)

There is a load(), but no save() in the QUiLoader:

http://developer.qt.nokia.com/doc/qt-4.8/quiloader.html#load

The UI file format is documented, and is XML. So you could write your own .UI file generator:

http://developer.qt.nokia.com/doc/qt-4.8/designer-ui-file-format.html

In fact, you could attack this problem the other way around. Instead of generating the dialog using programmatic widget API calls...instead generate a .UI file with XML. Then you can load it in your app or through QtDesigner.

(Depending on what your app is or is intended to do, you might also look into rethinking it as a QtDesigner plug-in...in which case this functionality might come for free.)

将现有 QDialog 保存到 *.ui 文件

半城柳色半声笛 2024-12-30 16:00:29

以下是如何做到这一点(经过大量测试):

var xhr = Titanium.Network.createHTTPClient();
xhr.open("GET", "https://stream.twitter.com/1/statuses/filter.json?track=<Your-keyword-to-track>", true, '<Your-twitter-nickname>', '<Your-twitter-password>');
xhr.send();

var last_index = 0;
function parse() {
    var curr_index = xhr.responseText.length;
    if (last_index == curr_index) return; // No new data
    var s = xhr.responseText.substring(last_index, curr_index);
    last_index = curr_index;
    console.log(s);
}

var interval = setInterval(parse, 5000);
setTimeout(function(){
    clearInterval(interval);
    parse();
    xhr.abort();
}, 25000);

Here's how to do it (after LOTS of testing):

var xhr = Titanium.Network.createHTTPClient();
xhr.open("GET", "https://stream.twitter.com/1/statuses/filter.json?track=<Your-keyword-to-track>", true, '<Your-twitter-nickname>', '<Your-twitter-password>');
xhr.send();

var last_index = 0;
function parse() {
    var curr_index = xhr.responseText.length;
    if (last_index == curr_index) return; // No new data
    var s = xhr.responseText.substring(last_index, curr_index);
    last_index = curr_index;
    console.log(s);
}

var interval = setInterval(parse, 5000);
setTimeout(function(){
    clearInterval(interval);
    parse();
    xhr.abort();
}, 25000);

架构:Titanium Desktop 与 Twitter Streaming API

半城柳色半声笛 2024-12-30 14:24:06

选择您的构建目标并在“构建阶段”->; “目标依赖项”,将您使用的项目(我猜是 RestKit)添加到列表中。

Choose your build target and in "Build Phases" -> "Target Dependencies", add the project you used (which I guess is RestKit) to the list.

命令 /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang 失败

半城柳色半声笛 2024-12-30 09:54:40

您可以通过持久存储来实现它。

查看这个关于存储持久数据的好教程

您也可以使用 SQLite。描述如何在 Java® 应用程序中使用 SQLite 数据库的开发指南链接:将数据存储在 SQLite 数据库中

您可以借助持久数据,使用您自己的逻辑限制用户最多尝试您的应用程序 100 次。但我认为可能有一些约定,所以尝试谷歌一下。

You can achieve it with Persistent Storage.

Check this nice tutorial about storing persistent data.

Also you can use SQLite. Link to a development guide which describes how to use SQLite databases in Java® applications: Storing data in SQLite databases.

You can restrict user for trying your application at most 100 times using your own logic with the help of persistent data. But I think there may be some convention, so try Google for that.

使用持久性显示 BB 应用程序的访问次数?

半城柳色半声笛 2024-12-30 05:31:36

当我仅选择包树中的项目节点并选择“选定资源”单选按钮时,它会在我的 Eclipse 版本中搜索该项目的所有文件。

您还可以选择项目中的任意文件,然后选择“封闭项目”。

When I select just the project node in the package tree and choose the "Selected Resources" radio button, it searches all the files of the project in my version of Eclipse.

You can also select an arbitrary file in a project, and choose "Enclosing project".

如何在Eclipse中搜索项目中的所有文件

半城柳色半声笛 2024-12-30 05:18:46

尝试#1

http://jsfiddle.net/DwApF/3/

这会隐藏阴影并然后在幻灯片完成后恢复它。这是一种破解解决方案,但这是一种可以规避多种行为的方式。

尝试#2

http://jsfiddle.net/DwApF/11/

这会执行同步动画外容器和内容器。它可以毫无瑕疵地滑动投影。但是,您需要手动操纵外部容器的高度,并隐藏内部容器的内容。不过,它确实消除了伪影问题。

尝试 #3 - 我的首选解决方案

http://jsfiddle.net/DwApF/12/

这个仍然使用外部/内部容器的同步动画。我在 IE9 中没有看到任何瑕疵。它还使用overflow:hidden来隐藏内部容器的内容。

外容器的尺寸仍然必须手动完成,但我认为这是一个足够的解决方案。应该有一种方法可以使用 jQuery 确定折叠高度,这样就不需要对该值进行硬编码。

该解决方案适用于 IE9、Chrome 和 Firefox。请注意,我添加了一些颜色/边框,以便更容易看到不同的容器。

Attempt #1

http://jsfiddle.net/DwApF/3/

This hides the shadow and then restores it after the slide is complete. It's a hack of a solution but this is a manner in which a variety of behaviors can be circumvented.

Attempt #2

http://jsfiddle.net/DwApF/11/

This does a simultaneous animation of both outer and inner containers. It slides the drop shadow with no artifacts. However, you will need to manually manipulate the height of the outer container, and also deal with hiding the contents of the inner container. It does eliminate the artifact issue though.

Attempt #3 - My Preferred Solution

http://jsfiddle.net/DwApF/12/

This still uses a simultaneous animation of both outer/inner containers. I see no artifacts in IE9. It also handles hiding the inner container's content using overflow: hidden.

The sizing of the outer container still must be done manually, but I think this is an adequate solution. There should be a way to determine the collapsed height using jQuery so that this value doesn't need to be hard-coded.

This solution works in IE9, Chrome, and Firefox. Note that I have added some colors/borders so that it's easier to see the different containers.

IE9 动画期间的阴影伪像

半城柳色半声笛 2024-12-30 00:44:06

您引用的弹出窗口称为 UIMenuController。您可以访问[UIMenuController sharedMenuController]方法来获取菜单控制器。然后,您可以将自己的 UIMenuItems 添加到菜单控制器。

UIMenuItem* myBtn1 = [[[UIMenuItem alloc] initWithTitle: @"Button 1" action:@selector( onButton1: )] autorelease];
UIMenuItem* myBtn2 = [[[UIMenuItem alloc] initWithTitle: @"Button 2" action:@selector( onButton2: )] autorelease];
UIMenuController* mc = [UIMenuController sharedMenuController];
mc.menuItems = [NSArray arrayWithObjects: myBtn1, myBtn2, nil];

现在实现这些方法

- (void) onButton1: (UIMenuController*) sender
{
}

- (void) onButton2: (UIMenuController*) sender
{
}

有关更多详细信息,请参阅 Apple 的文档。< /a>

编辑

你可以实现长手势

UILongPressGestureRecognizer* gr = [[[UILongPressGestureRecognizer alloc] initWithTarget: self action: @selector( onShowMenu: ) ] autorelease];
   [_myview addGestureRecognizer: gr];



- (void) onShowMenu: (UIGestureRecognizer*) sender
{
    [sender.view becomeFirstResponder];

    UIMenuController* mc = [UIMenuController sharedMenuController];

    CGRect bounds = sender.view.bounds;

    [mc setTargetRect: sender.view.frame inView: sender.view.superview];
    [mc setMenuVisible: YES animated: YES];
}

The popup you refer to is called a UIMenuController. You can access the [UIMenuController sharedMenuController] method to get the menu controller. You can then add your own UIMenuItems to the menu controller.

UIMenuItem* myBtn1 = [[[UIMenuItem alloc] initWithTitle: @"Button 1" action:@selector( onButton1: )] autorelease];
UIMenuItem* myBtn2 = [[[UIMenuItem alloc] initWithTitle: @"Button 2" action:@selector( onButton2: )] autorelease];
UIMenuController* mc = [UIMenuController sharedMenuController];
mc.menuItems = [NSArray arrayWithObjects: myBtn1, myBtn2, nil];

Now implement the methods

- (void) onButton1: (UIMenuController*) sender
{
}

- (void) onButton2: (UIMenuController*) sender
{
}

For more detail refer apple's Doc.

Edit

you can implement Long Gesture

UILongPressGestureRecognizer* gr = [[[UILongPressGestureRecognizer alloc] initWithTarget: self action: @selector( onShowMenu: ) ] autorelease];
   [_myview addGestureRecognizer: gr];



- (void) onShowMenu: (UIGestureRecognizer*) sender
{
    [sender.view becomeFirstResponder];

    UIMenuController* mc = [UIMenuController sharedMenuController];

    CGRect bounds = sender.view.bounds;

    [mc setTargetRect: sender.view.frame inView: sender.view.superview];
    [mc setMenuVisible: YES animated: YES];
}

iphone:UIWebView中的弹出按钮

半城柳色半声笛 2024-12-29 20:26:35

BOOTSTRAP 4

如果你不想用火箭筒杀死苍蝇,可以使用 -webkit-appearance:none;顺便说一句,这也会杀死漂亮的 sliderinputs ,并假设您正在使用引导表单 css 选择器“form-control”作为输入。

这就是解决方案:

.form-control:focus {
    box-shadow: none!important;
    border-color: #ced4da!important;
}

如果您想保留一个微小的蓝色轮廓,请保留边框颜色。

BOOTSTRAP 4

If you do not want to kill a fly with bazooka by use -webkit-appearance:none; which also kills nice sliderinputs btw and presuming you are working with the bootstrap form css selector "form-control" for your input.

This is the solution:

.form-control:focus {
    box-shadow: none!important;
    border-color: #ced4da!important;
}

If you want to keep a tiny small blue outline the leave border-color out.

为什么我无法删除 Twitter Bootstrap 中的蓝色文本区域边框?

半城柳色半声笛 2024-12-29 20:01:34

是的,您应该检查iis应用程序池并确保它正在运行.net 4.0。 (右键单击 iis 中的站点并查看属性,您应该也能够更改它在那里使用的框架。)

并确保稍后在命令提示符中运行“iisreset”命令。

Yes, you should check the iis application pool and make sure it is running .net 4.0. (Right click on the site in iis and see the property, and you should be able to change the framework it uses there too.)

and make sure you run "iisreset" command in command prompt later.

无法识别的配置节 system.web.extensions

半城柳色半声笛 2024-12-29 15:45:01

“启动项目”只是指当您在 Visual Studio IDE 中按 F5 时启动哪些项目。

它们对已部署的 Web 应用程序没有影响。


本着假期的精神,我决定问自己是否有任何方法可以在除零以外的任何程度上都是正确的。我发现了“5%”的可能性:

这些其他项目对于您的 Web 应用程序的正确行为是必要的吗?您提到它们是“控制台应用程序/计划任务”。您的应用程序是否要求这些控制台应用程序或计划任务在您的 Web 应用程序运行之前在 Web 服务器上运行?

如果是这种情况,那么您应该被告知启动项目“对已部署的 Web 应用程序没有影响”。事实上,您将此代码列为启动项目不会导致控制台应用程序或计划任务在 Web 服务器上运行,甚至不会部署到 Web 服务器。您必须将这些 .exe 文件部署到服务器,并且必须自己启动它们。 “启动项目”不会为你做到这一点。


如果不是这样,那么我认为这个问题应该作为“不是真正的问题”而结束,直到你缩小问题的范围。我的回答告诉你启动项目不做什么,但为了解决你的问题,你需要弄清楚实际的问题是什么。

"Startup project" simply means which projects start when you press F5 in the Visual Studio IDE.

They have no impact on the deployed web application.


In the spirit of the holidays, I decided to ask myself if there was any way you could be correct in any degree other than zero. I found a "5%" possibility:

Are these other projects necessary for the correct behavior of your web application? You mentioned that they are "Console apps/scheduled tasks". Does your application require that these console apps or scheduled tasks are running on the web server before your web application will function?

If that's the case, then you should be informed that startup projects "have no impact on the deployed web application". The fact that you have this code listed as startup projects will not cause the console apps or scheduled tasks to run on, or even to be deployed to, the web server. You will have to deploy these .exe files to the server and you will have to start them yourself. "Startup projects" won't do this for you.


If that's not it, then I think this question should be closed as "not a real question" until you narrow down what your problem is. My answer has told you what startup projects do not do, but in order to solve your problem, you'll need to figure out what the actual problem is.

当我发布具有多个启动项目的基于 MVC3 的 Web 解决方案时会发生什么?

半城柳色半声笛 2024-12-29 15:33:01

如果“安全”页面意味着不是管理员,而是为了区分登录用户和注销用户,您可能会发现使用用户帐户框架 webapp2 提供 python 2.7。您可以在 https://github.com/fredrikbonander/Webapp2-Sample-Applications< 找到示例应用程序< /a>

If by "secure" pages you mean that not admin but to distinguish between a logged in user and a logged out user you might find using the framework for user accounts that webapp2 provides for python 2.7. You can find an example app at https://github.com/fredrikbonander/Webapp2-Sample-Applications

谷歌应用引擎 + Python - 教育网站:需要专家的帮助

半城柳色半声笛 2024-12-29 11:50:45

如果对于输入,您的意思是“请求中出现的所有内容”(因此,需要验证的内容等),则应包括:

  • POST/GET vars ($_POST, $_GET)
  • Cookie ($_COOKIE)
  • 请求路径 ($_SERVER["REQUEST_URI"])
  • HTTP 方法($_SERVER["REQUEST_METHOD"])
  • HTTP 标头(通常在 $_SERVER["HTTP_"*] 中)

会话是一种特殊情况,因为所有会话变量都是存储在服务器端,即用户无法像使用 cookie 那样修改它们。无论如何,客户端会保存一个 cookie 来存储会话 ID,用户可以将其重置/设置为自定义值。

更新 - 关于 $_REQUEST

如前所述,在 PHP 中您还可以访问 $_REQUEST,它是来自 $_GET 的变量的组合, $_POST$_COOKIE
$_REQUEST 的具体内容由 php.ini 中的 request_order 指令确定。

If for input you mean "all the things coming in the request" (so, things that need validation, etc.), you should include:

  • POST/GET vars ($_POST, $_GET)
  • Cookies ($_COOKIE)
  • The request path ($_SERVER["REQUEST_URI"])
  • The HTTP method ($_SERVER["REQUEST_METHOD"])
  • The HTTP headers (usually in $_SERVER["HTTP_"*])

The session is a special case since all the session variables are stored on the server-side, i.e. the user cannot modify them as it would with cookies. Anyways, a single cookie is saved on the client-side to store the session ID, that can be reset / set to a custom value by the user.

Update - about $_REQUEST

As pointed out, in PHP you also have access to $_REQUEST, that is a mix of variables from $_GET, $_POST, $_COOKIE.
The exact content of $_REQUEST is determined by the request_order directive in php.ini.

会话和cookie通常被视为输入吗?

半城柳色半声笛 2024-12-29 11:12:48

这意味着变量 list 是最终的。

这意味着您不能再次为其分配其他内容。

完成后为其分配一个值(引用),如下所示:

private final List<Integer> list = new ArrayList<Integer>();

您不能再执行以下操作:

list = new ArrayList<Integer>(); //this is invalid because you are trying to assign something else the variable list

list.add(new Integer(123)); 此代码有效吗?

这是完全有效的。您只需将一个对象添加到变量 list 引用的 ArrayList 中即可。

final 关键字的使用限制变量 list 而不是它引用的 ArrayList 对象。

That means the variable list is final.

Which means you can not assign something else to it again.

Once you are done assign a value (reference) to it as follows:

private final List<Integer> list = new ArrayList<Integer>();

You can not do something as below again:

list = new ArrayList<Integer>(); //this is invalid because you are trying to assign something else the variable list

list.add(new Integer(123)); is this code valid?

It's perfectly valid. You are just adding an object to the ArrayList that variable list is referencing.

The usage of final keyword is restricting the variable list not the ArrayList object that it's referencing.

下面的java行将final修饰符分配给列表表示什么?

半城柳色半声笛 2024-12-29 10:59:47

对于你的问题:如何在循环中解决它就像

        var e1 = new Entity();
        var e2 = // Get Entity 

        foreach (var p in e1.GetType().GetProperties())
        { 
            p.SetValue(e1 , e2.GetType().GetProperty(p.Name ).GetValue(e2 , null) , null );
        }

这样,你可以通过循环将值从entity2复制到entity1

For your question : How to solve it in the loop is like

        var e1 = new Entity();
        var e2 = // Get Entity 

        foreach (var p in e1.GetType().GetProperties())
        { 
            p.SetValue(e1 , e2.GetType().GetProperty(p.Name ).GetValue(e2 , null) , null );
        }

So that , you can copy the value from entity2 to entity1 by looping

在 2 个实体之间映射属性值

更多

推荐作者

冷血

文章 0 评论 0

隔岸观火

文章 0 评论 0

昔梦

文章 0 评论 0

最终幸福

文章 0 评论 0

世界等同你

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文