问题列表 - 第32487页

jQuery~在跟随它之前调整href

我有一系列复选框的链接,由于遗留代码,当用户点击复选框时,它的值被作为逗号分隔列表附加到href.

问题是,现在我正在更新代码,我发现href的跟踪速度比href更快,因此排除了列表.

我尝试过使用preventDefault()哪个很棒,但我不知道如何在更改href后继续默认操作以包含所选值.

我还应该提一下,将其更改为常规形式是不可行的,因为提交后灯箱中设置了其他选项.(不要问我为什么,这是我书中的疯狂)

到目前为止,我必须这样做

$(function(){
    $('#cnt-area form table tbody').dragCheck();

    // I just split up the .each and .click to see if it mattered, which it doesnt
    $('.multi_assign_link').each(function(){
        $(this).click(function(e){

            e.preventDefault();
            var href = $(this).attr('href');

            $('#cnt-area form input:checkbox').each(function(){
                if($(this).attr('checked')){
                    if(href.search(','+$(this).val()) == -1){
                        href += ','+$(this).val();
                    }
                }else{
                    var s = ','+$(this).val();
                    s.toString();
                    href = href.replace(s, '');
                }
            });
            $(this).attr('href',href);
            // Continue to follow the link
            // Faking a user click here with $(this).click(); obviously throws …
Run Code Online (Sandbox Code Playgroud)

javascript jquery dom

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

Maxmind - 邮政编码的纬度和经度

我正在使用Maxmind的免费DAT文件来计算来自IP地址的纬度和经度 - 这很好用并且非常简单易用.

但是,我遇到了一个问题,我希望用户输入他们的邮政编码并自动计算该邮政编码的纬度和经度.

有没有人有任何使用Maxmind数据库的经验?如果是这样,你是如何实现它的.

提前致谢

J.P

c# geospatial

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

在BlackBerry上开发多种屏幕尺寸

Android和iOS具有"密度独立像素"的概念,因此您的布局在具有不同密度和屏幕尺寸的设备上看起来相同.

到目前为止,我已经编写了使用像素手动空间元素的代码(即我希望此按钮距离屏幕左侧10个像素).这在曲线上很棒,但是当我在Bold上加载时,分辨率要高得多,因此10像素是一个小得多的物理空间.

BlackBerry上多种屏幕尺寸的最佳做法是什么?有没有简单的方法来定义密度无关的像素?RIM似乎没有在文档或API方面提供太多便利.

blackberry ui-design

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

让流畅的NHibernate构建数据库表

我正在使用ASP.NET MVC2,Fluent NHibernate,StructureMap和PostgreSQL构建应用程序.当谈到Fluent NHibernate时,我是一个全新的人.我从几个不同的来源获得了一个设置但是当我构建并运行我的应用程序时,它不会在我的连接字符串中为数据库创建数据库表.我有几个不同文件的代码,所以我不知道我需要发布哪个代码,如果我应该发布所有它.如果有一个要检查的密钥请告诉我或让我知道发布所有代码.谢谢!

structuremap postgresql asp.net-mvc fluent-nhibernate

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

如何在python中动态创建类的实例?

我有类名列表,想要动态创建它们的实例.例如:

names=[
'foo.baa.a',
'foo.daa.c',
'foo.AA',
 ....
]

def save(cName, argument):
 aa = create_instance(cName) # how to do it?
 aa.save(argument)

save(random_from(names), arg)
Run Code Online (Sandbox Code Playgroud)

如何在Python中动态创建该实例?谢谢!

python

39
推荐指数
5
解决办法
7万
查看次数

指针阻力

如果*get_ii()返回堆内存而不是堆栈内存,是否会消除此问题?

01 int *get_ii()  
02 {  
03    int ii;        // Local stack variable  
04    ii = 2;  
05    return ⅈ  
06 }  
07 main()  
08 {  
09   int *ii;  
10   ii = get_ii();  // After this call the stack is given up by the routine   
11                   // get_ii() and its values are no longer safe.  
12    
13   ... Do stuff  
14   ..  ii may be corrupt by this point.  
15 }  
Run Code Online (Sandbox Code Playgroud)

来源 - http://www.yolinux.com/TUTORIALS/C++MemoryCorruptionAndMemoryLeaks.html

谢谢

c c++ pointers

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

尝试将“ExtraSamples”标签应用到要写入的 TIFF 文件时出现错误

我有一个程序可以获取图像并将其写入 TIFF 文件。图像可以是灰度(8 位)、带 Alpha 通道的灰度(16 位)、RGB(24 位)或 ARGB(32 位)。写出没有 Alpha 通道的图像时没有任何问题,但对于带有 Alpha 的图像,当我尝试设置额外的样本标记时,我会被发送到 TIFFSetErrorHandler 设置的 TIFF 错误处理例程。传入的消息<filename>: Bad value 1 for "ExtraSamples"位于 _TIFFVSetField 模块中。下面是一些示例代码:

#include "tiff.h"
#include "tiffio.h"
#include "xtiffio.h"
//Other includes

class MyTIFFWriter
{
public:
    MyTIFFWriter(void);

    ~MyTIFFWriter(void);

    bool writeFile(MyImage* outputImage);
    bool openFile(std::string filename);
    void closeFile();

private:
    TIFF* m_tif;
};

//...

bool MyTIFFWriter::writeFile(MyImage* outputImage)
{
    // check that we have data and that the tiff is ready for writing
    if (outputImage->getHeight() == 0 || outputImage->getWidth() == 0 …
Run Code Online (Sandbox Code Playgroud)

c++ file-io tiff libtiff

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

在C#中自动生成接口实现?

我知道这很懒,但有没有什么办法在Visual C#2010 Express上自动生成接口实现?(我不是说在运行时但是在设计时,就像代码片段一样).也许有第三方实用程序?

c# auto-generate visual-studio-express

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

如何在Java中更改字符串到日期

我需要在java中将字符串转换为日期格式我有一个从torrent文件中获取的字符串

the string is like 1278622088 
Run Code Online (Sandbox Code Playgroud)

java

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

在Windows 7上使用GCC进行编译:\ mingw32\bin\ld.exe:无法打开输出文件a.exe

这是我在尝试用gcc编译一个简单的hello world程序时得到的.

c:\>gcc hello.c
hello.c:9:2: warning: no newline at end of file
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot open output file a.exe
: Permission denied
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

它与Windows 7管理权限有关吗?

如果正在创建输出文件但无法打开,它位于何处?

对不起,如果这是一个noobie问题太多了.到目前为止,我一直在使用Dev-C++来编译我的源代码.我尝试使用谷歌搜索错误,但我发现所有文件已经打开,但在任务管理器中没有提到这样的exe.

编辑:该文件也位于C:\ hello.c

如果我把它放在其他驱动器中,我能做到吗?

当我将文件放在D:\并尝试使用cd d:\将其更改为任何其他驱动器时不会更改驱动器.

c gcc compilation permission-denied

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