问题列表 - 第45889页

以编程方式在DataGridView中设置列宽

我有一个DGV我绑定到一个对象列表.我将AutoSizeColumnsMode设置为Fill,以便列伸展以填充整个DGV,但是,目前它们以某种方式伸展,因此所有列的宽度相等.如何指定重量,使第一列为宽度的30%,另一列为70%?

c# datagridview winforms

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

使用Javascript将IP映射到位置

<script type="application/javascript">
    function getip(json){
      alert(json.ip); // alerts the ip address
    }
</script>

<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"></script>
Run Code Online (Sandbox Code Playgroud)

我可以通过此代码获取用户IP ...

我想找到这个IP的位置.我怎么能够?

javascript ip jquery

37
推荐指数
6
解决办法
10万
查看次数

通过Linux中的SIOCGIFCONF轮询接口名称

我正在尝试轮询网络设备名称.我从各种片段拼凑出来,

  1. http://unixhelp.ed.ac.uk/CGI/man-cgi?netdevice+7
  2. http://lists.apple.com/archives/Unix-porting/2002/Apr/msg00134.html
  3. http://ubuntuforums.org/showthread.php?t=1421487

但我的输出只是胡言乱语.

#include <stdio.h>
#include <stdlib.h>
#include <net/route.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>

#define BUFLEN 1024
#define SEQ 9999

int main (int argc, const char* argv[])
{
  // File descriptor for socket
  int socketfd;
  struct ifconf conf;
  struct ifreq req[10];
  struct ifreq *ifr;

  printf("Opening socket...");
  socketfd = socket(AF_ROUTE, SOCK_RAW, 0);
  if (socketfd >= 0) {
    printf(" OK\n");
    conf.ifc_len = sizeof(req);
    conf.ifc_buf = (__caddr_t) req;
    ioctl(socketfd,SIOCGIFCONF,&conf);

    printf("Discovering interfaces...\n");
    int i;
    for (i=0; i<conf.ifc_len/sizeof(req[0]); i++) {
      ifr = …
Run Code Online (Sandbox Code Playgroud)

c linux networking

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

Python:名称解析; 函数def的顺序

我有一个非常简单的例子:

#!/usr/bin/env python

#a()  # 1: NameError: name 'a' is not defined
#b()  # 1: NameError: name 'b' is not defined
#c()  # 1: NameError: name 'c' is not defined

def a():
    c()   # note the forward use here...

#a()  #2: NameError: global name 'c' is not defined 
#b()  #2: NameError: name 'b' is not defined
#c()  #2: NameError: name 'c' is not defined

def b():
    a()

#a()   #3: NameError: global name 'c' is not defined    
#b()   #3: NameError: global …
Run Code Online (Sandbox Code Playgroud)

python namespaces function

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

视觉树中的WP7 Popup不尊重方向

我知道弹出窗口和方向存在问题.我已经读过,如果弹出窗口在可视化树中,它应该尊重方向.我有两种类型的弹出窗口,一种是全局的(不在可视化树中),另一种是在特定页面xaml上定义的.我还没有去处理全球问题,但是我希望得到一个具体的页面工作.

这是我的xaml:

    x:Class="Views.MainPanorama"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
    xmlns:toolkitPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="PortraitOrLandscape"
    shell:SystemTray.IsVisible="False">

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>

<ScrollViewer x:Name="mainScroll">
    <Grid x:Name="LayoutRoot" Style="{StaticResource BackgroundStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Image x:Name="icon" Source="/Folder;component/Images/Icons/logo.png" Height="24" Width="175" HorizontalAlignment="Left" Margin="20, 15, 0, 0" />
        <controls:Panorama Name="panMain" HeaderTemplate="{StaticResource PanoramaHeaderTemplate}" Grid.Row="1" Margin="0, -10, …
Run Code Online (Sandbox Code Playgroud)

c# xaml popup orientation windows-phone-7

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

Azure中的ASP.NET会话状态提供程序

据我所知,目前的情况如下:

  1. 可以使用SQL会话状态提供程序(正如我在某处读到的那样),但Microsoft不支持它.所以它可能在将来停止工作.它还需要一个WorkerRole来删除过时的数据.
  2. Azure AppFabric缓存服务仍在CTP中.
  3. TableStorageSessionProvider是Azure培训工具包中的一段代码,不建议用于生产代码.

你会选择什么?

asp.net session azure asp.net-session azure-web-roles

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

是否有任何宝石通过authlogic支持单点登录

我在我的应用程序中实现了authlogic来处理用户身份验证.我也使用omniauth进行外部身份验证.但是,该应用程序将是其他开发人员将与现有网站集成的服务,我想允许他们支持使用我们的应用程序进行单点登录.是否有支持单点登录的gem还是我需要创建自己的登录系统吗?

ruby-on-rails single-sign-on

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

等待一组异步Java调用的轻量级方法

我们在一个阻塞方法中编写了一些代码,它们异步调用多个慢速第三方服务.这些异步调用包含在实现相同接口方法的代码中.我们希望触发异步调用并等待它们全部返回后再返回我们的阻塞方法调用.

我希望这很清楚!

有没有合适的设计模式/库来实现它...它必须是一个相当常见的模式.提前致谢.

java asynchronous synchronous

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

bash选项卡完成没有变量扩展?

假设我在这里定义了这些变量bashrc:

i='cgi-bin/internal';  
e='cgi-bin/external';  
f='cgi-bin/foo';  
b='cgi-bin/bar';  
ad='cgi-bin/admin';  
#etc...
Run Code Online (Sandbox Code Playgroud)

当我在命令行上使用变量时vim $i/edit_TAB,它将扩展变量并且命令行上的输入变为vim /www/productX/subdomain_x/cgi-bin/internal/edit_(相应于我所在的任何站点)然后我TABTAB获得可能的完成.

没关系,功能不是问题.只是每次看到完整路径而不仅仅是变量的值会变得烦人.

有没有办法不在命令行上扩展bash变量而不影响功能?
是这样做的bash完成吗?

期望的结果$i不会扩展到它的价值(视觉上)或$i扩展到相对路径而不是完整路径.

variables bash expansion bash-completion

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

在Python中,如何比较两个列表并获取匹配的所有索引?

这可能是一个简单的问题,我只是缺少但我有两个包含字符串的列表,我想逐个元素地"反弹"一个,而另一个返回匹配的索引.我希望有多个匹配,并希望所有的指数.我知道list.index()获得第一个,你可以很容易地得到最后一个.例如:

list1 = ['AS144','401M','31TP01']

list2 = ['HDE342','114','M9553','AS144','AS144','401M']
Run Code Online (Sandbox Code Playgroud)

然后我将遍历list1,比较list2和输出:
[0,0,0,1,1,0] , [3,4] 或者等,第一次迭代
[0,0,0,0,0,1] , [6]为第二次
和/ [0,0,0,0,0,0][]第三次

编辑:抱歉任何混乱.我希望以某种方式获得结果,然后我可以像这样使用它们 - 我有第三个列表可以调用list3,我想从输出的索引中获取该列表中的值.即list3[previousindexoutput]=list of cooresponding values

python

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