问题列表 - 第47540页

Android LinearGradient和奇怪的相对定位

我有以下代码和LinearGradient,它与其他所有示例看起来非常相似.

public class CustomColourBar extends View
{

public CustomColourBar( Context context, AttributeSet attribs )
{
    super( context, attribs );
}    

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
    setMeasuredDimension(170, 40);
}

@Override
protected synchronized void onDraw( Canvas canvas )
{
    int height = this.getMeasuredHeight();
    int width = this.getMeasuredWidth();

    LinearGradient shader = new LinearGradient(
        0, 0, 0, height, 
        Color.RED, Color.YELLOW,
        Shader.TileMode.CLAMP );

    Paint paint = new Paint(); 
    paint.setShader(shader);
    RectF fgRect = new RectF( 0, 0, width, height);

    canvas.drawRoundRect(fgRect, 7f, 7f, paint); …
Run Code Online (Sandbox Code Playgroud)

layout android gradient

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

PHP if语句与isset不起作用

我认为这是简单的代码,但这不能按预期工作:

$id = $_GET['id'];
if (!isset($id)){
    header("HTTP/1.1 404 not found");
    include("404.php");
}
else {
    include('includes/functions.php'); 
}
Run Code Online (Sandbox Code Playgroud)

所以我从URL获取了get参数但我没有收到404错误?

有任何想法吗?

php http-status-code-404

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

使用带有Rails的Eco模板引擎

Eco是一种嵌入式Coffeescript模板语言.它类似于ERB.有没有办法在Rails应用程序中将其用作服务器端模板语言?

最终目标是在客户端和服务器上使用Eco编写的部分部分.

templates ruby-on-rails coffeescript

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

gradle在Intellij中不起作用 - 与JAVA_HOME有关

  • 我可以从命令行运行gradle来查看它的版本.
  • 我可以在IntelliJ(版本10.0或版本10.2)中运行,编译和调试grails应用程序
  • 我安装了IntelliJ Gradle插件.

每当我尝试使用Intellij中的gradle做任何事情时,我都会收到如下错误:

Executing command: "tasks"
Failed to connect to gradle process for command 'tasks'

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.0\jre

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Run Code Online (Sandbox Code Playgroud)

但是在我的环境中,我已经JAVA_HOME在不同的目录中设置了正确的JDK.此外,当我查看IntelliJ项目时,它还会在正确的JDK位置显示JDK.我找不到任何试图将JDK指向Intellij JRE位置的东西.

有什么想法吗?

intellij-idea gradle

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

为什么浏览器不会在其包中放置像jquery或extjs这样的重要javascript库?

为什么Web浏览器不会在其包中放置像jquery或extjs这样的重要javascript库?有了这个工作网站加载时间很短.

javascript browser

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

将nan值转换为零

我有一个2D numpy数组.这个数组中的一些值是NaN.我想使用这个数组执行某些操作.例如,考虑数组:

[[   0.   43.   67.    0.   38.]
 [ 100.   86.   96.  100.   94.]
 [  76.   79.   83.   89.   56.]
 [  88.   NaN   67.   89.   81.]
 [  94.   79.   67.   89.   69.]
 [  88.   79.   58.   72.   63.]
 [  76.   79.   71.   67.   56.]
 [  71.   71.   NaN   56.  100.]]
Run Code Online (Sandbox Code Playgroud)

我试图逐行取一行,按相反顺序对其进行排序,以从行中获取最多3个值并取其平均值.我试过的代码是:

# nparr is a 2D numpy array
for entry in nparr:
    sortedentry = sorted(entry, reverse=True)
    highest_3_values = sortedentry[:3]
    avg_highest_3 = float(sum(highest_3_values)) / 3
Run Code Online (Sandbox Code Playgroud)

这不适用于包含的行NaN.我的问题是,是否有一种快速方法可以NaN …

python numpy nan

66
推荐指数
5
解决办法
17万
查看次数

另一个CoffeeScript错误

嘿,我正在学习CoffeeScript而且我一直在犯错误.这是我的代码:

Db   = require('./lib/mongodb').Db
ObjectID = require('./lib/mongodb').ObjectID
Server   = require('./lib/mongodb').Server

class UserDataProvider
    constructor = (host,port)->
        this.db = new Db( 'test' , new Server(host ,port,{}))
    getCollection = (callback) ->
        this.db.collection 'data',(error,data)->
            if error then callback(error)
            else callback(data)
    findAll = (callback) ->
        this.getCollection (error,data)->
            if error then callback error
            else
                data.find (error, cursor) ->
                    if error then callback error
                    else
                        cursor.toArray (error, results)->
                            if error then callback error
                            else callback(null,results)
    findById = (id,callback)->
        this.getCollection (error, data)->
          if error then callback error
          else …
Run Code Online (Sandbox Code Playgroud)

javascript compiler-errors coffeescript

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

然后滚动到顶部

只是想知道是否有人知道我如何重新创建我刚才看到的导航栏样式,我刚刚找到了我看到它的网站,但我不确定它们是如何到达那里的.基本上希望它与页面滚动然后锁定到顶部...

http://lesscss.org/

javascript jquery positioning

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

使用Castle Windsor在ASP.NET MVC中设置控制反转(IoC)

我正在讨论Sanderson的Pro ASP.NET MVC框架,在第4章他讨论了创建一个自定义控制器工厂,似乎现在不推荐使用原始方法,AddComponentLifeStyleAddComponentWithLifeStyle用于注册控制器:

public class WindsorControllerFactory : DefaultControllerFactory
{
    IWindsorContainer container;

    public WindsorControllerFactory()
    {
        container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));

        // register all the controller types as transient
        var controllerTypes = from t in Assembly.GetExecutingAssembly().GetTypes()
                              where typeof(IController).IsAssignableFrom(t)
                              select t;

        //[Obsolete("Use Register(Component.For<I>().ImplementedBy<T>().Named(key).Lifestyle.Is(lifestyle)) instead.")]
        //IWindsorContainer AddComponentLifeStyle<I, T>(string key, LifestyleType lifestyle) where T : class;
        foreach (Type t in controllerTypes)
        {
            container.Register(Component.For<IController>().ImplementedBy<???>().Named(t.FullName).LifeStyle.Is(LifestyleType.Transient));
        }
    }

    // Constructs the controller instance needed to service each request
    protected override IController …
Run Code Online (Sandbox Code Playgroud)

reflection asp.net-mvc castle-windsor inversion-of-control

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

我怎样才能让我的qtip决定他自己的左或右尖端属性

$('a.tooltip').each(function(){

$(this).qtip({
    content: { url: 'includes/qtip.php?'+$(this).attr('rel')+' #'+$(this).attr('div'), text:'loading...'  },
    show: { delay: 400},
    hide: { fixed: true, delay: 200 },
    position: {
        corner: {
            target: 'bottomLeft',
            tooltip: 'right'
        }
     },
     style: {
         name: 'light',
         width: 700
     }
});
});
Run Code Online (Sandbox Code Playgroud)

我喜欢wto .tooltip项目在我网站的右侧面板上,但如果没有看不到它完整,

我怎么能tooltip:'right'在别的地方做到这一点?我的意思是,我怎么知道?

css jquery position qtip

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