小编Har*_*M V的帖子

Cakephp - 如何使错误页面有自己的布局?

我想为找不到404页面的页面设置不同的布局.如何为该页面设置不同的布局?

cakephp cakephp-1.3

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

Twitter BootStrap模态窗口后备链接

我正在使用Twitter Bootstrap模态窗口.只是因为js错误导致模态窗口不起作用 - 有一个后退页面.如果模态窗口没有加载,我如何确保页面加载?

链接到打开的模态窗口

<a href="#login-modal" data-toggle="modal" data-target="#login-modal">Login</a>
Run Code Online (Sandbox Code Playgroud)

模态窗口

<!-- Login Modal -->
        <div id="login-modal" class="modal hide fade landing-modal" tabindex="-2" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    ×
                </button>
                <h3>Login</h3>
            </div>
            <div class="modal-body">
                <form>
                    <div class="control-group">
                        <label for="email">Email Address</label>
                        <div class="controls">
                            <input class="input-medium" name="email" type="text"  />
                        </div>
                    </div>
                    <div class="control-group">
                        <label for="password">Password</label>
                        <div class="controls">
                            <input class="input-medium" name="password" type="password" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="checkbox">
                            <input type="checkbox" value="">
                            Remember me</label>
                    </div>
                    <div class="control-group">
                        <div class="controls">
                            <button …
Run Code Online (Sandbox Code Playgroud)

css jquery modal-dialog twitter-bootstrap

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

Java三元运算符设置为True或false

我试图设置一个条件,并设置如下所示的true或false,但它始终返回false.

boolean checked = (categoriesCursor.getString(3) == "1") ? true
                    : false;

Log.i("Nomad",categoriesCursor.getString(3)+ " "+checked);
Run Code Online (Sandbox Code Playgroud)

当我尝试输出值时,我得到以下内容.

01-12 00:05:38.072: I/Nomad(23625): 1 false
01-12 00:05:38.072: I/Nomad(23625): 1 false
01-12 00:05:38.072: I/Nomad(23625): 1 false
01-12 00:05:38.072: I/Nomad(23625): 1 false
01-12 00:05:38.072: I/Nomad(23625): 1 false
01-12 00:05:38.072: I/Nomad(23625): 0 false
01-12 00:05:38.072: I/Nomad(23625): 0 false
Run Code Online (Sandbox Code Playgroud)

java ternary-operator

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

React 和 React Router 中的子域路由

我有 3 种类型的用户,我们希望为项目维护相同的代码库,而不是在大多数视图只是对用户类型主观的情况下拥有 3-4 个代码库。

管理员 > admin.example.com

版主 > moderator.example.com

品牌 >brands.example.com

我的 React App 结构

src
-BaseRoutes.js <--- Should handle by subdomain logic
- modules
-- admin
---- AdminRoutes.js <---- handles all Admin route logic
---- components
---- pages
-- moderator
---- ModeratorRoutes.js <---- handles all Moderator route logic
---- components
---- pages
-- brands
---- BrandsRoutes.js <---- handles all Brands route logic
---- components
---- pages
- components
- pages
Run Code Online (Sandbox Code Playgroud)

每种类型的用户都有自己的身份验证,以允许访问内部路由。我找到了一个函数来拆分域并使用以下方法进行路由:

let host = window.location.host;
let protocol …
Run Code Online (Sandbox Code Playgroud)

javascript subdomain reactjs react-router

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

Google图表为图片

我正在尝试使用Google图表在电子邮件中嵌入图表图像.因此每个用户都将拥有一个独特的图表.

我们是否可以使用API​​并嵌入一个唯一的URL来呈现图表并将图像传送到电子邮件客户端.

charts google-visualization

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

意外的令牌运算符«=»,预期的punc«,»

我收到以下错误

解析错误:意外的令牌运算符«=»,预期的punc«,»第159行,第26列

这是我的代码

  function fitBounds(type="all", shape=null) {
    var bounds = new google.maps.LatLngBounds();

    if ( type == "all" ){
      if ((circles.length > 0) | (polygons.length > 0)){
        $.each(circles, function(index, circle){
          bounds.union(circle.getBounds());
        });
        $.each(polygons, function(index, polygon){
          polygon.getPath().getArray().forEach(function(latLng){
            bounds.extend(latLng);
          });
        });
      }
    }
    else if ( (type == "single") && (shape != null) ) {
      if (shape.type == google.maps.drawing.OverlayType.MARKER) {
        marker_index = markers.indexOf(shape);
        bounds.union(circles[marker_index].getBounds());
      }
      else {
        shape.getPath().getArray().forEach(function(latLng){
          bounds.extend(latLng);
        });
      }
    }

    if (bounds.isEmpty() != true)
    {
      map.fitBounds(bounds);
    }
  }
Run Code Online (Sandbox Code Playgroud)

javascript jslint

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

使用哪个适配器 - BaseAdapter或ArrayAdapter?

我有一个JSON字符串,其中包含以下多个实例

  1. 名称
  2. 信息
  3. 时间戳
  4. 个人资料照片网址

我想创建一个ListView,其中每个列表将具有上述内容.对于这种特殊情况,我需要扩展哪个更好的适配器来创建自定义适配器?

android listview android-arrayadapter baseadapter

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

带有标签的Android Actionbar Sherlock

在此输入图像描述

我正在尝试使用下面的Tabs实现ActionBar Sherlock,如上面的线框所示.

我应该使用TabActivity吗? - 因为我看到它被弃用了.这是实现同样目标的最佳方式.

android android-fragments android-viewpager actionbarsherlock android-tabs

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

Android表格布局对齐

我正在使用表格布局来显示数据,如下所示. 在此输入图像描述

我想做的事 ?

我希望第二列中的文本对齐到左侧,文本应该换行并显示在下一行中,并且如图所示.

码:

    <TableLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/tableLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="10dp" >

            <ImageView
                android:id="@+id/place_category_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:contentDescription="ss"
                android:paddingRight="10dp"
                android:src="@drawable/icon_category"
                android:textAlignment="textStart" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_gravity="center"
                android:text="230 kms"
                android:textSize="16sp" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="10dp" >

            <ImageView
                android:id="@+id/place_category_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:contentDescription="ss"
                android:paddingRight="10dp"
                android:src="@drawable/icon_category"
                android:textAlignment="textStart" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_gravity="center"
                android:text="Hill Station, Wild Life"
                android:textSize="16sp" >
            </TextView>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingBottom="10dp" >

            <ImageView
                android:id="@+id/place_category_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true" …
Run Code Online (Sandbox Code Playgroud)

android alignment android-tablelayout

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

Google商家信息获得了LatLng

我正在使用自动填充方法获取地方建议,当我点击我想要选择的地方时,我想要提取,Lat并将Lng其放在place.geometry.location下面.

Firebug截图

根据我的观察,关键ibjb随着每个会话不断变化.有什么方法可以提取LatLng可预测吗?

$(document).ready(function() {

    var mapOptions = {
        center : new google.maps.LatLng(-33.8688, 151.2195),
        zoom : 13,
        mapTypeId : google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById('map'), mapOptions);

    $('#searchTextField').bind('keydown keypress', function() {
        setTimeout(function() {
            var inputQuery = $('#searchTextField').val();

            if (inputQuery.length >= 2) {
                //console.log(inputQuery);

                /*
                var service = new google.maps.places.AutocompleteService();

                service.getPlacePredictions({
                    input : inputQuery
                }, callback);
                */

                var input = document.getElementById('searchTextField');
                var options = {
                    types : ['geocode'] …
Run Code Online (Sandbox Code Playgroud)

google-maps geocoding google-maps-api-3 google-places-api

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