小编Onl*_*ere的帖子

如何从位置N获取子串到Ruby 1.8.7中的最后一个字符串?

我想从位置N到字符串末尾的字符串中获取子字符串.

在Ruby中用它做什么的方法是什么?

ruby string substring

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

SpecialFolder.Desktop和SpecialFolder.DesktopDirectory有什么区别?

我对这两个特殊文件夹之间的差异感到困惑.

这是一个代码片段,用于编写每个输出,但它们输出相同的内容.

string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string pathTwo = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

Console.WriteLine(path);
Console.WriteLine(pathTwo);

Console.ReadKey();
Run Code Online (Sandbox Code Playgroud)

根据MSDN文档(适用于.NET 1.1):

桌面
逻辑桌面而不是物理文件系统位置.

DesktopDirectory
用于在桌面上物理存储文件对象的目录.不要将此目录与桌面文件夹本身混淆,后者是一个虚拟文件夹.

这说the logical Desktop rather than the physical file system location什么意思?另外,virtual folder简单来说是什么?

在较新的.NET 4版本的文档中,我注意到他们删除了Desktop完全和唯一的左侧DesktopDirectory.为什么是这样?

.net c# desktop special-folders

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

在ASP.NET中使用MasterPages时使用JQuery的正确方法?

在没有母版页的aspx页面中使用JQuery时没有问题,但是当我尝试在具有母版页的页面中使用它时,它不起作用,所以我最终将jquery文件和其他脚本文件放在页面而不是主页.现在,如果我有10页,我正在为所有10个页面执行此操作,我知道这是不正确的.在下面的示例主页中,我将在哪里放置我的脚本文件.

<html>
<head runat="server">
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <asp:ContentPlaceHolder ID="ContentPanel" runat="server">
    </asp:ContentPlaceHolder>            
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我最近使用了fancybox插件,而我所做的不是将jquery脚本和fancybox脚本放在母版页中,因为我对它的工作感到沮丧,我只是把它放在我希望脚本运行的页面中,特别是在在关闭asp之前的底部:内容.当然,现在我有一个问题,如果我想在其他页面中使用fancybox插件,我会将jquery脚本和fancybox脚本放在所有5个页面而不仅仅是母版页上.在处理主页时,使用上面的示例,一切都在哪里?

asp.net jquery master-pages fancybox

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

使用.NET 4将程序最小化到系统托盘的最简单方法

我正在制作一个新的WPF应用程序,我需要能够最小化应用程序,并且在系统托盘中,在时钟旁边(或在那个一般区域)中保持良好和舒适.

这必须适用于Windows XP,Vista和7.我不必支持旧版本的Windows.

如果我使用.NET 4,最简单的方法是什么?

c# wpf system-tray .net-4.0 minimize

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

无法加载此类文件 - 运行heroku create --stack cedar时的readline(LoadError)

我正在尝试将我的Rails应用程序部署到Heroku,按照以下说明进行测试:

http://devcenter.heroku.com/articles/rails3#prerequisites

这是我正在尝试运行的命令:

heroku create --stack cedar
Run Code Online (Sandbox Code Playgroud)

我收到此错误消息:

/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- readline (LoadError)
    from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command/run.rb:1:in `<top (required)>'
    from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:14:in `block in load'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:13:in `each'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:13:in `load'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/cli.rb:8:in `start'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/bin/heroku:15:in `<top (required)>'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/bin/heroku:19:in `load'
    from /home/sergio/.rvm/gems/ruby-1.9.3-p125/bin/heroku:19:in `<main>'
Run Code Online (Sandbox Code Playgroud)

这是相关文件的内容:

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

module Kernel …
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails heroku ruby-on-rails-3

30
推荐指数
7
解决办法
6万
查看次数

如何在GitHub上处理你的第一个Pull请求?

我对Git比较新.我的知识迄今包括git add push commit.这是关于它,直到现在它对我很好.:)

然而今天早上有人发给我一个拉请求,正如我读过的那样,有人分叉了我的存储库,做了一些调整并且正在骂我说:"嘿塞尔吉奥,我做了一些改进.考虑一下他们的主分支."

我对么?

https://github.com/sergiotapia/CherryTomato/pulls

如果是这样,我如何轻松地将此用户更改合并到存储库的主分支?我需要点什么命令?更重要的是,有人可以用外行的术语来说明必须发生的事情吗?

谢谢.

git github pull-request

26
推荐指数
2
解决办法
8530
查看次数

在Ubuntu 12.04上使用RVM来使用Rails.目前尚未安装"rails"程序

我按照官方网站上的安装指南从头开始安装RVM.我安装了Rails,创建了一个虚拟应用程序,一切正常.

我关掉了我的机器.

第二天早上,我再次打开机器(冷启动)和rails -v从控制台尝试运行" ",但是我收到以下错误消息:

塞尔吉奥@塞尔吉奥 - 工作〜$ rails -v

目前尚未安装"rails"程序.您可以通过键入以下命令安装它:sudo apt-get install rails

我可以运行ruby -v得很好,并得到以下消息:

sergio @ Sergio-work~ $ ruby​​ -v

ruby 1.9.3p194(2012-04-20修订版35410)[x86_64-linux]

我也可以运行gem list得很好,输出:

sergio@Sergio-work ~ $ gem list

*** LOCAL GEMS ***

actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
arel (3.0.2)
builder (3.0.0)
bundler (1.1.4)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.3.3)
erubis (2.7.0)
execjs (1.4.0)
faraday (0.8.0)
google_drive (0.3.0)
hike (1.2.1)
httpauth (0.1)
i18n (0.6.0)
journey …
Run Code Online (Sandbox Code Playgroud)

ruby linux ubuntu ruby-on-rails rvm

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

如何垂直居中ComboBox的内容?

例如,请注意文本不完全位于ComboBox的垂直中心.

在此输入图像描述

这是我的XAML:

<Window x:Class="_24HoursBook.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="450" Width="350" MinHeight="450" MinWidth="350">


    <Grid ShowGridLines="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="0.15*" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Image Grid.Row="0" Stretch="Fill" Source="Image/topBarBg.png" />
        <StackPanel Orientation="Horizontal" Grid.Row="0">            
            <TextBlock Text="Platform" 
                       Foreground="White" 
                       FontFamily="Georgia"
                       FontSize="15" 
                       Margin="10"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center"/>
            <ComboBox x:Name="cmbPlatform" 
                      Margin="10"
                      FontFamily="Georgia"
                      FontSize="15"
                      MinHeight="30"
                      MinWidth="140"
                      VerticalAlignment="Center">
                <ComboBoxItem>All Platforms</ComboBoxItem>
                <ComboBoxItem>Playstation 3</ComboBoxItem>
                <ComboBoxItem>XBox 360</ComboBoxItem>
                <ComboBoxItem>Wii</ComboBoxItem>
                <ComboBoxItem>PSP</ComboBoxItem>
                <ComboBoxItem>DS</ComboBoxItem>
            </ComboBox>            
        </StackPanel>
        <Image Grid.Row="0" Source="Image/about.png" 
               Height="16" HorizontalAlignment="Right"
               VerticalAlignment="Center"
               Margin="0 0 10 0"    />

        <ListView Grid.Row="1" Background="#343434">

        </ListView>
    </Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)

wpf xaml combobox

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

如何使用CIDR表示法查看IP地址是否属于一系列IP?

这里我有一个静态参考我需要检查的范围:

private static List<string> Ip_Range = new List<string>()
{
    "12.144.86.0/23",
    "31.201.1.176/30",
    "46.36.198.101/32",
    "46.36.198.102/31",
    "46.36.198.104/31",
    "46.136.172.0/24",
    "63.65.11.0/24",
    "63.65.12.0/25",
    "63.65.12.128/26",
    "63.65.12.192/27",
    "63.65.12.224/28",
    "63.65.12.240/29",
    "63.65.12.248/30",
    "63.65.12.252/31",
    "63.65.12.254/32",
    "65.173.56.0/21",
    "67.23.241.179/32",
    "67.23.241.180/30",
    "67.23.241.184/29",
    "67.23.241.192/30",
    "67.23.241.196/31",
    "67.23.241.198/32",
    "72.32.164.56/29",
    "72.46.244.32/28",
    "74.91.16.48/29",
    "74.91.16.208/29",
    "74.91.20.48/28",
    "74.91.20.64/29",
    "74.112.134.120/29",
    "74.112.135.104/29",
    "74.205.37.16/29",
    "78.24.205.32/28",
    "98.129.27.88/29",
    "98.129.91.40/29",
    "166.114.0.0/16",
    "167.157.0.0/16",
    "174.143.165.80/29",
    "186.0.156.0/22",
    "186.2.0.0/17",
    "186.27.0.0/17",
    "190.0.248.0/21",
    "190.3.184.0/21"
};
Run Code Online (Sandbox Code Playgroud)

这是我看到它如何工作的一些伪代码:

public static bool IpIsWithinRange(string ip) //Something like 127.0.0.1 or 184.56.26.35
{
    IPAddress incomingIp = IPAddress.Parse(ip);
    foreach (var subnet in Ip_Range)
    {
        IPAddress sub = IPAddress.Parse(subnet); ?????
        if …
Run Code Online (Sandbox Code Playgroud)

c# ip cidr

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

如何在Rails 3.2.1中使用特定于控制器的样式表?

使用Rails 3.2.1


我使用命令创建了一个名为Home的简单控制器:

rails g controller Home index
Run Code Online (Sandbox Code Playgroud)

它为我创建了一个新的控制器和视图:

在此输入图像描述

注意有两个样式表,一个是"应用程序",另一个是"主页".我找不到任何文档来支持这个假设,但我猜你把样式只应用于Home.css.scss文件中的"Home"视图,对吗?

因此,作为测试,我在Application.css.scss.erb中添加了一些全局样式并运行了应用程序.

样式按预期应用.

接下来,我在Home.css.scss文件中添加了一些规则,并访问了一个"Home/index"视图,但该文件中的样式未附加,既不作为单独的CSS引用链接,也不附加到单个Application.css.scss文件.这对我来说非常困惑,因为评论说:

// Place all the styles related to the Home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Run Code Online (Sandbox Code Playgroud)

为什么Home.css.scss中写的规则不适用于我的网站?

css ruby-on-rails sass ruby-on-rails-3.1

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