灯角

文章 0 评论 0 浏览 23

灯角 2024-12-08 19:30:06

您所描述的内容在编程语言研究中被称为“记录串联”。已经有一些关于用于记录串联的静态类型系统的工作,主要是在 Haskell 或 ML 等自动类型推断的上下文中。据我所知,它尚未对任何主流编程语言产生影响。

What you're describing is known in programming language research as record concatenation. There has been some work on static type systems for record concatenation, mostly in the context of automatic type inference a la Haskell or ML. To the best of my knowledge it has not yet made an impact on any mainstream programming languages.

可以操作对象属性的静态语言?

灯角 2024-12-08 16:11:49

我已经找到了问题的答案,但可能不是最佳答案:

<?php
$Mage_Catalog_Block_Navigation = new Mage_Catalog_Block_Navigation();
$categories = $Mage_Catalog_Block_Navigation->getStoreCategories();

function render_flat_nav($categories) {
    $html = '<ul>';
    foreach($categories as $category) {
        $html .= '<li><a href="' . $category->getCategoryUrl($cat) . '">' . 
                  $category->getName() . "</a>\n";
        if($category->hasChildren()) {
            $children = Mage::getModel('catalog/category')->getCategories($category->entity_id);
            $html .= render_flat_nav($children);
            }
        $html .= '</li>';
    }
    return $html . '</ul>';
}
echo render_flat_nav($categories); ?>

I have found an answer to the problem, but it could be sub-optimal:

<?php
$Mage_Catalog_Block_Navigation = new Mage_Catalog_Block_Navigation();
$categories = $Mage_Catalog_Block_Navigation->getStoreCategories();

function render_flat_nav($categories) {
    $html = '<ul>';
    foreach($categories as $category) {
        $html .= '<li><a href="' . $category->getCategoryUrl($cat) . '">' . 
                  $category->getName() . "</a>\n";
        if($category->hasChildren()) {
            $children = Mage::getModel('catalog/category')->getCategories($category->entity_id);
            $html .= render_flat_nav($children);
            }
        $html .= '</li>';
    }
    return $html . '</ul>';
}
echo render_flat_nav($categories); ?>

使用递归函数从 Magento 打印类别的嵌套列表

灯角 2024-12-08 15:40:42

@ sudhir chauhan:如果尚未选择代码折叠,则其他 php 文件将不会有折叠。

这是 Netbeans 的一个已知错误,非常烦人,在我编辑 PHP 时偶尔也会发生这种情况。唯一的解决方案是保存文件,关闭 Netbeans IDE,然后重新打开 Netbeans。

有时,您展开代码并单击重新折叠,但无法..要解决此相关问题,只需单击折叠外的一行(即上面的函数),然后单击“-”重新折叠代码。

@ sudhir chauhan: If code folds wasn't already selected the other php files would not have folds alredy.

This is a known bug with Netbeans that is very annoying and happens occasionally to me as well when editing PHP. The only solution is to save the file, close the Netbeans IDE and re-open Netbeans.

Also sometimes you unfold code and click to refold and you cant.. to resolve this related issue just click on a line outside the fold (ie. the function above) then click on the "-" to refold the code.

NetBeans:代码折叠没有出现在我的 PHP 文件之一上

灯角 2024-12-08 09:49:30

您可以将以下代码放入文件中,然后向其发送 xhr 请求以调用该文件。或者您可以尝试在单独的工具中打开该文件,而不需要弹出窗口。

$result = mysql_query("SHOW COLUMNS FROM `$table`");
$i = 0;
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_assoc($result)) {
       $csv_output .= $row['Field'].", ";
       $i++;
    }
}
$csv_output .= "\n";

$values = mysql_query("SELECT * FROM `$table`");
while ($rowr = mysql_fetch_row($values)) {
    for ($j=0;$j<$i;$j++) {
        $csv_output .= $rowr[$j].", ";
    }
    $csv_output .= "\n";
}

$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;

You can put the following code in a file and then send an xhr request to it invoking the file. Or you can try opening the file in a separate tool less pop up.

$result = mysql_query("SHOW COLUMNS FROM `$table`");
$i = 0;
if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_assoc($result)) {
       $csv_output .= $row['Field'].", ";
       $i++;
    }
}
$csv_output .= "\n";

$values = mysql_query("SELECT * FROM `$table`");
while ($rowr = mysql_fetch_row($values)) {
    for ($j=0;$j<$i;$j++) {
        $csv_output .= $rowr[$j].", ";
    }
    $csv_output .= "\n";
}

$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;

如何使用 PHP 通过 AJAX 调用将 CSV 文件发送给用户?

灯角 2024-12-08 09:02:47

这里有两件事。术语 INode,以及使用 INode 术语或类似 INode 的术语代替的文件系统实现。

我所知道的所有 Windows 文件系统(FAT*、NTFS)在实际实现中都使用类似 Inode 的结构。

为了进一步简化答案

(将 INode 视为有关文件的元数据块。)

INode 作为术语:没有 Windows 文件系统没有它。

INode 作为概念:Windows 将有一些其他结构,属性和用法类似,但使用不同的名称

There are two things here. The term INode, and a file-system implementation that uses either INode terminology or something like INode in its place.

All Windows file-systems(FAT*,NTFS) I know of, use Inode-like structures in actual implementation.

To further simplify the answer

(Think of INode as a block of metadata about a file.)

INode as term : No windows file system dont have it.

INode as concept : Windows will have some other structures, similar in property and usage but used with different name

Windows 也像 Linux 一样有 Inode 编号吗?

灯角 2024-12-08 08:53:36

我不认为问题出在您的代码中...如果不允许 PUT 动词,则没有客户端能够 PUT 文件。它也没有说“未经授权”,如果是权限问题就会出现这种情况...我认为这仍然是 IIS 配置问题。查看此链接:

http://support.microsoft.com/kb/942051/en-我们

为了让事情变得更简单,你可以看看这个我听说对这件事很有用的工具:

http://www.microsoft.com/download/en/details .aspx?displaylang=en&id=21625

HTH。

I don't think the problem is in your code...if the PUT verb is not allowed, no client is going to be able to PUT files. It's not saying "Unauthorized" either, which would be the case if it were a permissions problem...I think this is still an IIS configuration one. Check this link out:

http://support.microsoft.com/kb/942051/en-us

To make things simpler on yourself, you might check out this tool that I've heard is good for this stuff:

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21625

HTH.

HTTPWeb请求“PUT”错误状态 405 IIS7 中不允许使用该方法

灯角 2024-12-08 08:33:19

你可以试试滑动抽屉。

或者对于这种类型的动画,您将需要一个放置在底部的布局并添加一个 onThumbTouchListener。

像这样的

OnTouchListener onThumbTouch = new OnTouchListener()
    {
        @Override
        public boolean onTouch(View v, MotionEvent event) 
        {   
            switch(v.getId())
            {
                case R.id.slider_thumb_id:
                {
                    switch(event.getAction())
                    {
                        case MotionEvent.ACTION_MOVE:
                        {                           
                            if(v.getTop()>=0 && v.getBottom()<sliderFrame.getMeasuredHeight()){
                                int topPos = (int)event.getRawY()-(v.getHeight()*2+v.getHeight());
                                if(topPos < 0) {
                                    topPos=0;
                                } else if(topPos > (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight())){
                                    topPos = (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight()) -1;
                                }   
                                iconParams.topMargin = topPos;
                                v.setLayoutParams(iconParams);
                                sliderThumbFake.setLayoutParams(iconParams);
                            }                           
                            break;
                        }
                        case MotionEvent.ACTION_UP:
                        {                           

                        }
                    }
                    break;
                }
            }
            return true;
        }
    };

案例语句中的代码可能没有用,因为它是我根据我的要求起诉的。但这就是拖动视图的方法。

You could tryout the sliding drawer.

Or for this sort of animation you will need a layout which you place in the bottom and add a onThumbTouchListener.

Something like this

OnTouchListener onThumbTouch = new OnTouchListener()
    {
        @Override
        public boolean onTouch(View v, MotionEvent event) 
        {   
            switch(v.getId())
            {
                case R.id.slider_thumb_id:
                {
                    switch(event.getAction())
                    {
                        case MotionEvent.ACTION_MOVE:
                        {                           
                            if(v.getTop()>=0 && v.getBottom()<sliderFrame.getMeasuredHeight()){
                                int topPos = (int)event.getRawY()-(v.getHeight()*2+v.getHeight());
                                if(topPos < 0) {
                                    topPos=0;
                                } else if(topPos > (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight())){
                                    topPos = (sliderFrame.getMeasuredHeight()-v.getMeasuredHeight()) -1;
                                }   
                                iconParams.topMargin = topPos;
                                v.setLayoutParams(iconParams);
                                sliderThumbFake.setLayoutParams(iconParams);
                            }                           
                            break;
                        }
                        case MotionEvent.ACTION_UP:
                        {                           

                        }
                    }
                    break;
                }
            }
            return true;
        }
    };

The code inside the case statements might not be useful as it was something I sued for my requirement. But this how you do a drag of a view.

Android - 创建动画“向上拖动以锁定”

灯角 2024-12-08 08:27:49

这是我之前使用过的一个非常有用的代码片段,它将整个文本文件存储在一个字符串中,然后您可以对其进行处理(就像使用正则表达式)。

Dim strFile As String
Dim intFile As Long

intFile = FreeFile

Open "C:\File.txt" For Input As #intFile
   strFile = Input$(LOF(intFile), #intFile)  '  LOF returns Length of File
Close #intFile

'Do what you want with strFile

更新
实际上,这是我认为更安全的方法。我什至展示了如何使用打开的对话框获取文件名,这非常方便:

Sub test()

Dim fileString As String
Dim fileName As String

' You can use GetOpenFilename() if you like
fileName = Application.GetOpenFilename("Text Files (*.txt,*.txt")
fileString = Space(FileLen(fileName))

Open fileName For Binary As #1
    Get #1, , fileString
Close #1

' Do what you wish with fileString
MsgBox Len(fileString)
End Sub

Here is a very useful code sniplet I've used before that will store an entire text file in a string that you can then work on (like using regex).

Dim strFile As String
Dim intFile As Long

intFile = FreeFile

Open "C:\File.txt" For Input As #intFile
   strFile = Input$(LOF(intFile), #intFile)  '  LOF returns Length of File
Close #intFile

'Do what you want with strFile

UPDATE:
Actually, here's a method I find more safe. I have even shown how to get the file name using the open dialogue box, which is very convenient:

Sub test()

Dim fileString As String
Dim fileName As String

' You can use GetOpenFilename() if you like
fileName = Application.GetOpenFilename("Text Files (*.txt,*.txt")
fileString = Space(FileLen(fileName))

Open fileName For Binary As #1
    Get #1, , fileString
Close #1

' Do what you wish with fileString
MsgBox Len(fileString)
End Sub

读取文本文件并在结果字符串上使用正则表达式应用

灯角 2024-12-08 02:03:39

当您执行“查看源代码”时,您并不是在查看页面的 HTML,因为它存在于您面前 - 浏览器会专门获取页面的副本以向您显示源代码。这样做时,它不会解释 javascript - 因此您通过 javascript 对文档所做的任何更改都不会反映在“查看源代码”窗口中。

为了实时查看 DOM 的更改,您必须使用 Firebug 等开发工具(链接< /a>)。当然,成为 Firefox 扩展并不意味着 Internet Explorer 运气好,这就是为什么开发人员经常以 Firefox 为开发目标,并在一切合理启动和运行后担心 Internet Explorer。

IE 中有 Firebug 的替代工具(如 Firebug Lite),但没有一个工具的功能和实用性接近。

When you do "view source", you are not looking at the HTML of the page as it exists in front of you - the browser fetches a copy of the page specifically to show you the source. When doing so, it does not interpret javascript - so any changes to the document you make via javascript will not be reflected in the "view source" window.

In order to view the changes to DOM live, you will have to use a development tool like Firebug (link). Being a Firefox extension of course means no luck in Internet Explorer, which is why developers often target Firefox for development and worry about Internet Explorer after everything is reasonably up and running.

There ARE alternative tools for Firebug in IE (like Firebug Lite), but none come close to the functionality and utility.

JavaScript setAttribute 不起作用

灯角 2024-12-08 01:44:39

如果您只需要追加字符缓冲区,您也可以简单地使用 std::string 和成员函数append。除此之外,stringstream 为您提供格式、功能,因此您可以添加数字、填充等,但从您的描述来看,您似乎不需要这些。

If you just need to append char buffers, you can also simply use std::string and the member function append. On top of that stringstream gives you formatting, functionality, so you can add numbers, padding etc., but from your description you appear not to need that.

C++ 的可调整大小的字符缓冲区容器类型

灯角 2024-12-08 01:24:26

每次调用类中不存在的静态方法时都会调用 __callStatic()。

The __callStatic() is called everytime you call not existing static method of a class.

PHP 中静态方法的构造函数替代方案

灯角 2024-12-07 21:10:54

如果您将音频播放构建为 AudioUnit 图表,您应该能够使用内置的 iPod EQ AudioUnit,以及与 iPod 应用程序中类似的预设。看看这个示例,希望能有所帮助你知道如何做到这一点。

当您阅读代码时,请确保您了解音频单元是图形中的节点,其中音频信号通过回调方式流过图形,并且每个节点都可以修改流向输出节点的信号(因此,您要做的就是将文件加载到内存中,然后在您指定的回调中将 PCM(声音样本)数据提供给音频单元。当缓冲区为空时,将调用回调,您可以填充它。

链接的示例设置了混音器节点、输出节点和均衡器节点,将它们连接在一起,并在将它们加载到内存后开始播放多个声音文件。

如果 iPod EQ AU 没有实现您想要的功能,您可以构建自己的 AudioUnit 并稍后替换它,但这需要一些 DSP 知识。您也许还可以找到一些作为音频单元实现的开源均衡器(这是 Mac 平台上用于音乐制作工具中使用的效果的常见格式。)

If you build your audio playback as an AudioUnit graph, you should be able to use the built-in iPod EQ AudioUnit, with presets like those in the iPod application. Have a look at this example which will hopefully help you understand how to do this.

As you're reading the code, make sure you understand that Audio Units are nodes in a graph, where the audio signal flows through the graph by means of callbacks, and that each node can modify the signal on it's way towards the output node (essentially the speaker.) So what you do is you load your file into memory, and you then feed the PCM (sound sample) data to the audio unit in a callback that you have specified. When the buffer is empty, the callback will be invoked and you can fill it up.

The linked example sets up a mixer node, an output node and the equalizer node, connects them together, and starts playing a number of sound files after having loaded them into memory.

If the iPod EQ AU doesn't do what you want it to do, you can build your own AudioUnit and replace it later, but that requires some DSP knowledge. You may also be able to find some open-source equalizers out there that have been implemented as Audio Units (which is a common format on the Mac platform for effects used in music production tools for example.)

如何在音频播放器中实现iPhone的均衡器设置

灯角 2024-12-07 17:18:31

#join-wrapper-scroll 在内容之前有一个内层吗?即

<div id="join-wrapper-scroll">
    <ul> <!-- inner layer -->
        <li>Content that scrolls.</li>
        <li>Content that scrolls.</li>
    </ul>
</div>

你需要一个“内层”,否则插件将无法理解它正在滚动的内容。

Does #join-wrapper-scroll have an inside layer before the content? I.e.

<div id="join-wrapper-scroll">
    <ul> <!-- inner layer -->
        <li>Content that scrolls.</li>
        <li>Content that scrolls.</li>
    </ul>
</div>

You need an "inner layer" or else the plugin won't understand what it's scrolling.

jQuery的scrollTo插件问题。没有什么动静吗?

灯角 2024-12-07 12:10:45

尝试使用 Invalidate(rectangle) 或 Invalidate(Region) 方法将重绘量限制为实际需要完成的量。您当前正在每个 OnPaint 事件期间重绘完整的控件。

Try using the Invalidate(rectangle) or Invalidate(Region) methods to limit the amount of repainting to that which actually needs to be done. You are currently redrawing the complete control during every OnPaint Event.

尽管有双缓冲,股票行情仍然闪烁

灯角 2024-12-07 10:34:02

您是否尝试过 php somescript.php & ?末尾的 & 使 sh 脚本继续执行。

如果您希望 php 脚本比 shell 脚本更长寿,请尝试以下操作:

nohup php somescript.php >/dev/null 2>&1 &

Have you tried php somescript.php & ? The & at the end causes the sh script to continue executing.

If you want the php script to outlive the shell script, try this:

nohup php somescript.php >/dev/null 2>&1 &

PHP CLi - 设置在命令行上运行然后继续?不希望 bash 脚本等待

更多

推荐作者

小瓶盖

文章 0 评论 0

wxsp_Ukbq8xGR

文章 0 评论 0

1638627670

文章 0 评论 0

仅一夜美梦

文章 0 评论 0

夜访吸血鬼

文章 0 评论 0

近卫軍团

文章 0 评论 0

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