小编xyz*_*xyz的帖子

IE 6/7的大纲属性的替代方案

我很高兴使用outline属性,直到我知道它在IE 6/7中不受支持.
我试过但找不到任何其他选择.
如何outline在IE 6/7中实现与属性相同的效果?


编辑:
我想将它应用于input,radiocheckbox.所以解决方法应该(希望)适用于所有这些.

谢谢!

css outline internet-explorer-7 internet-explorer-6

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

如何在android中按主题级联样式

基本上,我想有一个单一的布局,我可以skin在主题上有所不同.这个网站上的许多示例和条目似乎都围绕这个问题跳了一下,所以我不完全确定它可以做到.或者我只是不明白.

这是概念.

假设我的应用程序与运动相关......应用程序默认为'SportTheme'我想用户也要说他们想要'足球'或'棒球'主题,并且在指定<TextView>元素上,我想要文本(默认为'Sport')更改为'Football'或'Baseball',因为整体主题适用于activity

在strings.xml中

<string name="label_sport">Sport</string>
<string name="label_football">Football</string>
<string name="label_baseball">Baseball</string>
Run Code Online (Sandbox Code Playgroud)

在activityA.java中 - 这里重要的是为活动设置主题(或者应用程序也很好).

@Override
protected void onCreate(Bundle savedInstanceState)
{
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.layout_a);

    switch (user.ThemePreference)
    {
        case FOOTBALL_THEME:
            this.setTheme(R.style.FootballTheme);
            break;
        case BASEBALL_THEME:
            this.setTheme(R.style.BaseballTheme);
            break;
        default:
            this.setTheme(R.style.SportTheme);
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

在layout_a.xml中

...
<TextView
   android:id="@+id/tvSport"
   android:layout_height="wrap_content"
   android:layout_width="match_parent"
   android:text="@string/label_sport"
   android:style="@style/SportLabel"></TextView>
Run Code Online (Sandbox Code Playgroud)

我在主题/风格中做什么?像这样的东西?这里重要的是TextView中的文本.我将在整个应用程序中的几个不同活动中使用相同的textView.

<theme name="SportTheme" parent="android:Theme" />

<theme name="FootballTheme" parent="SportTheme">
   <item name="android:background">@color/brown</item>
</theme>

<theme name="BaseballTheme" parent="SportTheme">
   <item name="android:background">@color/green</item>
</theme>


<theme name="SportTheme.SportLabel">
   <item name="android:text">@string/label_sport</item>
</theme>

<theme name="FootballTheme.SportLabel">
   <item name="android:text">@string/label_football</item>
   <item …
Run Code Online (Sandbox Code Playgroud)

android text themes coding-style textview

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

Prepare语句无效的列索引错误

invalid column index准备接受准备好的陈述.
这是我的代码

// Excluding some unnecessary code
counter = 1;
if (rsTableNames.next()) 
{
    // Creating Query for prepared statement
    String getCode = "select * from ( select c_name from " 
          + rsTableNames.getString(1)+ " where lower(c_name) like ?%'";
    while (rsTableNames.next()) 
    {
      getCode += " union select c_name from " + 
      rsTableNames.getString(1)+ " where lower(c_name) like ?%'";
      counter++;
    }
    getCode += " ) where rownum <= " + maxRecords;
        // Now  The getCode contains 3 place holders ie …
Run Code Online (Sandbox Code Playgroud)

java sql prepared-statement

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

如何在Jquery选择器中使用JSTL var

我正在使用以下Jquery选择器

$("#selectedQuery td input:radio").attr('checked', true);
Run Code Online (Sandbox Code Playgroud)

selectedQuery声明为JSTL变量的位置 在哪里

<c:set var="selectedQuery" value="${dataRequestForm.queryMasterId}" />  
Run Code Online (Sandbox Code Playgroud)

我用硬编码值测试了选择器,它工作正常,但使用时没有运气selectedQuery.
我们如何<c:set>在Jquery中使用JSTL var?有什么工作吗?

jquery jstl jquery-selectors

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

如何使用thenAnswer返回void的方法

我想单元测试以下方法

public void addRecord(Record record)  
{  
   Myclass newObj = new Mycalss();  
   // It creates newObj object, set some values using record object.  
   // and it adds the newObj in daatbase.
   dataReqDao.persist(newObj);
}    
Run Code Online (Sandbox Code Playgroud)

我有模拟dataReqDao.persist方法但是如何验证是否将正确的值复制到newObj对象中?我想获得newObj对象.

我认为thenAnswer将是检测newObj即方法参数的合适方法,但不知道如何使用它返回void的方法.

更新:
我试过了

doAnswer(new Answer<Myclass>() {
              public Myclass answer(InvocationOnMock invocation) {
                  Object[] args = invocation.getArguments();
                  return (Myclass)args[0];
              }

        }).when(dataReqDao.persist(any(Myclass.class)));
Run Code Online (Sandbox Code Playgroud)

编辑:
应该是(谢谢大卫)

 doAnswer(new Answer<Myclass>() {
                  public Myclass answer(InvocationOnMock invocation) {
                      Object[] args = invocation.getArguments();
                      return (Myclass)args[0];
                  }

            }).when(dataReqDao).persist(any(Myclass.class));
Run Code Online (Sandbox Code Playgroud)

unit-testing mockito

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

填写raphael js的财产

我想在Raphael中创建一个看起来像的球体
在此输入图像描述

我使用Paper.ellipse相同的水平和垂直半径来绘制球体.
我想我需要调整fill属性来实现效果,如图所示.我也想要不同颜色的球体,效果相同.
任何人都可以指出fill拉斐尔有关房产的任何有用的链接,因为我找不到足够的信息?

javascript raphael

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

同步对象

我有简单的代码:

public class testing {
    private static Object objToSync = new Object();

    public static void main(String[] args) {
        String obj1 = null;
        synchronized(objToSync){
            System.out.println("something one");                    
            doSomething();
            System.out.println("something three ");         
        }

        doSomething();      
    }

    private static void doSomething() {
        synchronized(objToSync){
            System.out.println("something two");
        }       
    }
Run Code Online (Sandbox Code Playgroud)

我已经阅读了几件事,但仍然对这个问题感到困惑.为什么主要的doSomething被调用?是不是要等到同步对象解锁?对不起,如果我听起来很愚蠢,我只是感到困惑.

java synchronized

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

模拟String.valueof()

我正在测试我的弹簧控制器并尝试执行以下操作

调节器

Authentication authentication = SecurityContextHolder.getContext()
            .getAuthentication();
    String role = String.valueOf(authentication.getAuthorities());
    if(role.contains("user")) {
        ...
    }
Run Code Online (Sandbox Code Playgroud)

测试

@Test
public void testLoginUser() throws Exception {
    User user = new User();
    user.setLogin("user");
    user.setRoleid(1L);
    SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(user,user));
    when(String.valueOf(Collection.class)).thenReturn("user");
Run Code Online (Sandbox Code Playgroud)

但我明白了

org.mockito.exceptions.misusing.MissingMethodInvocationException
Run Code Online (Sandbox Code Playgroud)

我需要我的if块才能true执行.
有什么办法可以做到吗?

java mocking mockito

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

在Java中执行类的构造函数

我的预订课程中有一个构造函数如下:

public Booking (String name, String phone, int [] adultSeats, int [] childSeats )
{
    this.name = name;
    this.phone = phone;

    this.adultSeats = adultSeats;
    this.childSeats = childSeats;

}
Run Code Online (Sandbox Code Playgroud)

我想通过创建Booking对象来编写一个Tester类来执行构造函数.

我做了很多尝试,例如:

试试1: Booking b1 = new Booking ("Ali","32788943",{0,1},{3,4,5}) ;

试试2: Booking b1 = new Booking ("Ali","32788943",2,3) ;

如何在Tester类中执行构造函数?

谢谢.

java constructor

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

有什么方法可以让我们从 catch 返回到 try 块

我在 Selenium webdriver 中运行代码,每当找不到元素时,它就会被捕获。但我希望 java 在跳过该元素后继续执行。

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import net.sourceforge.htmlunit.corejs.javascript.ast.LabeledStatement;

import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.google.protobuf.DescriptorProtos.FieldDescriptorProto.Label;
import com.sun.org.apache.bcel.internal.generic.GOTO;

public class try_zencart {
  private WebDriver driver;
  private String baseUrl;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new FirefoxDriver();
    baseUrl = "http://ipadress/"; //I am providing an ip adress
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testTryZencart() …
Run Code Online (Sandbox Code Playgroud)

java selenium selenium-webdriver

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