小编Joh*_*nde的帖子

Google地图不会在Phonegap iOS App中显示

我有一个PhoneGap iOS应用程序,并且这个HTML不会在应用程序中显示地图.我在Safari或FF中完全看到了地图,但在应用程序中却没有.我怎样才能让它发挥作用?

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>  
    <script type="text/javascript">

        $(document).ready(function(){
                    var initialLocation = new google.maps.LatLng(37.654,-77.980);
                        var myOptions = {
                                        zoom: 12,
                                        center: initialLocation,
                                        mapTypeId: google.maps.MapTypeId.ROADMAP
                        };
                        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
            });
</script>   
</head> 
<body>
<div data-role="content">   
    <!--images go here -->
    <div class="img_shadow" style="padding:4px;">
                    <div id="map_canvas" style="height:130px;"></div>
    </div>
</div>      
</div><!-- /page -->

</body>
Run Code Online (Sandbox Code Playgroud)

html google-maps-api-3 ios cordova

9
推荐指数
2
解决办法
9045
查看次数

如何在MVC3上使用authorize属性

我已经读过要[Authorize]在MVC 上使用该属性,你只需将它放在一个动作或你要保护的控制器类上.

我的问题是:该Authorize属性如何知道用户是否已登录?我是否必须提供任何Session对象才能Authorize知道用户是否获得授权?

asp.net-mvc-3

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

如何直接从服务器使用python发送电子邮件而不使用smtp

我是 php 程序员,使用 php 您可以直接向服务器发送电子邮件,例如此代码向客户端发送电子邮件:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 
Run Code Online (Sandbox Code Playgroud)

但在 python 中,您必须使用 smtplib 和 gmail 或 hotmail 服务器来发送电子邮件。我想知道是否可以直接从服务器发送带有 python 的电子邮件?

python email smtp python-3.x

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

Using spl_autoload() not able to load class

I'm playing around with the SPL autoload functionality and seem to be missing something important as I am currently unable to get it to work. Here is the snippet I am currently using:

// ROOT_DIRECTORY translates to /home/someuser/public_html/subdomains/test
define('ROOT_DIRECTORY', realpath(dirname(__FILE__)));
define('INCLUDE_DIRECTORY', ROOT_DIRECTORY . '/includes/classes/');
set_include_path(get_include_path() . PATH_SEPARATOR . INCLUDE_DIRECTORY);
spl_autoload_extensions('.class.php, .interface.php, .abstract.php');
spl_autoload_register();
Run Code Online (Sandbox Code Playgroud)

When I echo get_include_path() I do get the path I expected:

// Output echo get_include_path();
.:/usr/lib/php:/usr/local/lib/php:/home/someuser/public_html/subdomains/test/includes/classes/
Run Code Online (Sandbox Code Playgroud)

However when I run the code I get this error message: …

php spl spl-autoloader

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

将字符串中以空格分隔的数字的字符串转换为整数,并将它们放在变量中

我正在尝试编写一个函数来接受一个由字符串中的4个空格分隔的数字组成的字符串,将它们分开并转换为整数,然后将它们放在4个单独的整数变量中.我知道我可以用它splitWs来分割成一个字符串数组,用于!!访问各个元素,以及类似下面的内容转换为整数:

f :: [String] -> [Int]
f = map read
Run Code Online (Sandbox Code Playgroud)

但我无法弄清楚如何把它们放在一起.

haskell

8
推荐指数
2
解决办法
2720
查看次数

jquery停止调用其他处理程序

假设我有标签,我附加了两个点击事件:

$('#l1').bind('click',function(){
 alert('label clicked');
}
$('#l2').bind('click',function(){
 alert('label2 clicked');
}
$('#l3').bind('click',function(){
 alert('label3 clicked');
}

$('label').bind('click',function(){
 if($(this).hasClass('disabled')
return false
}
<label id='l1'>hi</label>
<label id='l2' class="disabled">bye</label>
<label id='l3'>hi</label>
Run Code Online (Sandbox Code Playgroud)

现在,我不希望在disabled单击具有类的标签时显示警报.有可能吗?

注意:alert只是一个虚拟的东西..我正在执行一组操作,而不是那个...每个不同的实际标签

javascript jquery javascript-events

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

是否可以使用Spring MVC + PrimeFaces?

我想知道它是否可行以及如何在PrimeFaces中使用Spring MVC.

spring-mvc primefaces

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

从region_id Magento 1.6.2获取州名

我需要通过转换在Magento 1.6.2显示一个国家名称region_idstate name.

我有,region_id并且可以返回美国所有州的阵列

$states = Mage::getModel('directory/country')->load('US')->getRegions();
Run Code Online (Sandbox Code Playgroud)

但是找不到转换它的帮助类region_id.

class magento

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

以编程方式更改EditText IME_ACTION

在我的应用程序中,我需要显示一个或两个edittexts来收集信息(e1和e2),具体取决于用户通过radiobutton进行的选择.这是通过将edittext的可见性状态设置为GONE来完成的,并且工作正常.

我的问题是如何以编程方式为每种情况将IME_ACTION从"完成"设置为"下一步",即:

1)只有e1可见 - 将e1的IME_ACTION设置为DONE

2)e1和e2是可见的 - 将e1的IME_ACTION设置为NEXT,将e2的IME_ACTION设置为DONE.

我正在使用android:minSdkVersion ="4"和android:targetSdkVersion ="16"并在Android 2.2设备上进行测试.

这是我的布局:

<EditText
android:id="@+id/e1"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/sh15"
android:textColor="@android:color/black"
android:textSize="@dimen/s">
</EditText>         
<EditText
android:id="@+id/e2"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:inputType="text"
android:maxLines="1"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/sh16"
android:textColor="@android:color/black"
android:textSize="@dimen/s">
</EditText> 
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

RadioGroup r= (RadioGroup) dialog.findViewById(R.id.rg);
  r.setOnCheckedChangeListener(new OnCheckedChangeListener() 
  {
   public void onCheckedChanged(RadioGroup group, int checkedId) 
   {
    switch(checkedId)
    {
     case R.id.rb1: //show one edittext
         e1.setVisibility(View.VISIBLE);             
         e2.setVisibility(View.GONE);
         e1.setImeOptions(EditorInfo.IME_ACTION_DONE);
     break;
     case R.id.rb2: //show two edittext
         e1.setVisibility(View.VISIBLE);
         e2.setVisibility(View.VISIBLE);
         e1.setImeOptions(EditorInfo.IME_ACTION_NEXT);
         e2.setImeOptions(EditorInfo.IME_ACTION_DONE);
     break;

    }
   }
  });  
Run Code Online (Sandbox Code Playgroud)

android

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

PDOException:SQLSTATE [HY000] [2002]没有这样的文件或目录

我已将PushChatServer目录放在htdocs文件夹中并创建数据库puschat尝试运行@" http://localhost/PushChatServer/api/test/database.php "

然后我得到了以下异常.

我想做同样的事来解释这个链接http://www.raywenderlich.com/32963/apple-push-notification-services-in-ios-6-tutorial-part-2

我做了所有这些,但我得到了这个例外

无法连接到数据库.原因:异常'PDOException',消息'SQLSTATE [HY000] [2002]没有这样的文件或目录'在/Applications/MAMP/htdocs/PushChatServer/api/test/database.php:17堆栈跟踪:#0/Applications/MAMP /htdocs/PushChatServer/api/test/database.php(17):PDO - > __ construct('mysql:host = loca ...','root','root',Array)#1 {main}

php mamp

8
推荐指数
4
解决办法
5万
查看次数