小编Sha*_*ard的帖子

从ASPX页面运行命令行,并将输出返回到页面

我正在尝试访问命令行并执行命令,然后将输出返回到我的aspx页面.一个很好的例子是在aspx页面的页面加载上运行dir并通过Response.Write()返回输出.我尝试过使用下面的代码.当我尝试调试它时,它会运行,但永远不会完成加载,也不会呈现输出.我正在使用C#和.NET Framework 3.5sp1.任何帮助非常感谢.

谢谢,布莱恩

public partial class CommandLine : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Diagnostics.Process si = new System.Diagnostics.Process();
        si.StartInfo.WorkingDirectory = @"c:\";
        si.StartInfo.UseShellExecute = false;
        si.StartInfo.FileName = "cmd.exe";
        si.StartInfo.Arguments = "dir";
        si.StartInfo.CreateNoWindow = true;
        si.StartInfo.RedirectStandardInput = true;
        si.StartInfo.RedirectStandardOutput = true;
        si.StartInfo.RedirectStandardError = true;
        si.Start();
        string output = si.StandardOutput.ReadToEnd();
        si.Close();
        Response.Write(output);
    }
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

黑莓浏览器后退点击

我正在尝试在加载浏览器后返回上一页,但需要三次后退才能执行此操作.我尝试覆盖后退按钮单击,但仍然需要三次单击.我使用以下代码加载浏览器:

BrowserSession browserSession;
browserSession = Browser.getDefaultSession();
try{
   browserSession.displayPage(mapLocation);
}catch(Exception e){
   e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)

EDIT从用户回答中复制:

我想转到上一个屏幕而不是浏览器中的上一页.后退按钮的代码:

protected boolean keyDown(int keycode, int status) {
  if(Keypad.key(keycode) == Keypad.KEY_ESCAPE) {
      _theApp.popScreen(this);
      return true;
  }
  return false;
}
Run Code Online (Sandbox Code Playgroud)

java browser blackberry blackberry-simulator

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

如何修复加载配置文件时"配置系统初始化失败/ Root元素丢失"错误?

我在c#windows应用程序中遇到此错误:"配置系统无法初始化".

它工作正常.突然间我得到了这个例外.它显示内部异常细节为"缺少根元素".(C:\ Users\company\AppData\Local\Clickbase_Corp_Sverige_AB\TouchStation.vshost.exe_Url_no1nets4fg3oy2p2q2pnwgulbvczlv33\1.1.0.12\user.config)"}.当我尝试从Settings.cs类中获取值时会发生这种情况.

在program.cs文件中,编写了以下代码

if (Properties.Settings.Default.CallUpgrade)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.CallUpgrade = false;
                Properties.Settings.Default.Save();                
            }
Run Code Online (Sandbox Code Playgroud)

并调用settings.cs类,其中下面的代码抛出异常

    [global::System.Configuration.UserScopedSettingAttribute()]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Configuration.DefaultSettingValueAttribute("True")]

    public bool CallUpgrade {
        get {
            return ((bool)(this["CallUpgrade"]));
        }
        set {
            this["CallUpgrade"] = value;
        }
    }
Run Code Online (Sandbox Code Playgroud)

以下是我的整个app.config

<configuration>
  <configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="TouchStation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
      <section name="TouchStation.TouchStation" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="TouchStation.TouchStation" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> …
Run Code Online (Sandbox Code Playgroud)

c# config

10
推荐指数
3
解决办法
5万
查看次数

Android 2.3.3上的图片挂起

我有一些拍照的代码在Android 2.1和2.2中有效.但这些代码在Android 2.3上爆发.花了一些时间来解决这个徒劳的问题后,我想在这里寻求帮助.

我拍照的代码流是这样的:

创建一个类Camlayer扩展了SurfaceView

public class CamLayer extends SurfaceView implements SurfaceHolder.Callback {
    private void init(Context context){
        // Install a SurfaceHolder.Callback so we get notified when the
        // underlying surface is created and destroyed.
        mHolder = getHolder();
        mHolder.addCallback(this);
        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        mCamera = Camera.open();
    }

    public CamLayer(Context context) {
        super(context);
        init(context);
    }

    public CamLayer(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
        Log.i(TAG+".surfaceChanged", "being called!");
        Log.i(TAG+".surfaceChanged", "w="+w); 
        Log.i(TAG+".surfaceChanged", "h="+h);
        if (isPreviewRunning) …
Run Code Online (Sandbox Code Playgroud)

camera android

10
推荐指数
3
解决办法
6448
查看次数

获取电子邮件类型和电话号码类型的标签使用android

我想获取所使用的类型email typephone number type's标签但是当我使用这些代码获取数据时,它给出的标签使用位置意味着返回integer值,但我想要使用标签.

我的代码错在哪里?

成功完全获得电子邮件ID,但类型给予int.值为1,2.

那么如何获得类型的标签?

public String [] getEmailid(long _id) {
    String emailid = null ;
    String emailType = null ;
    try {
        Cursor cursor = getContentResolver().query(  
            ContactsContract.CommonDataKinds.Email.CONTENT_URI,  
            new String[]{Email.DATA,Email.TYPE},
            ContactsContract.CommonDataKinds.Email.CONTACT_ID +" = "+ _id, 
            // We need to add more selection for phone type
            null,
            null);

        if(cursor != null) {
            while (cursor.moveToNext()) {  
                // This would allow you get several email addresses  
                // if the email addresses were stored …
Run Code Online (Sandbox Code Playgroud)

android contact

10
推荐指数
2
解决办法
9174
查看次数

使用JQuery preventDefault(),但仍然添加URL的路径

我正在一个网站上工作,点击某个链接会在登录面板上滑下来.我event.preventDefault()用来阻止网站重定向以及动画事件滑动面板.单击链接时,面板向下滑动,网址保持不变.

单击链接时我想要发生的是面板正常动画,但链接的href属性将显示在URL中.在这种情况下,它将是这样的:http://domain_name/#login.

这是我现在要去的代码:

$("#login_link").click(function (e) {
    e.preventDefault();
    $("#login").animate({ 'margin-top': 0 }, 600, 'linear');

    window.location.hash = $(this).attr('href');
});
Run Code Online (Sandbox Code Playgroud)

此代码根据需要成功地将"#login"添加到URL,但它会跳过登录面板的动画.单击链接时,面板会立即显示.我想保留动画和更新的url行为.这可能吗?

javascript jquery preventdefault

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

Native Activity应用程序中的"无法找到本机库"错误

我的Native Activity应用程序有一些问题.它在99%的设备上运行良好.但有时用户会收到以下错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{nightradio.sunvox/nightradio.sunvox.MyNativeActivity}: 
java.lang.IllegalArgumentException: Unable to find native library: sundog
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2095)
at android.app.ActivityThread.access$600(ActivityThread.java:134)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4830)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
...
Run Code Online (Sandbox Code Playgroud)

我不明白为什么.该应用程序在armeabi,armeabi-v7a和x86文件夹中包含所有必需的库.它已经在许多具有不同架构的设备上进行了测试.

android:hasCode ="true"选项存在.

另外我注意到,这些有问题的设备大多数都有Rockchip CPU(RK3066,RK2928,RK2926).但不是所有的.最新的一款拥有华为K3V2 CPU和大量可用内存.另一个Native Activity应用程序(不是我的)也不适用于最新的设备.

android android-ndk native-activity

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

prev/next图标未显示在自定义的jquery datepicker主题中

我在我的VS2010项目中实现了jQuery DatePicker,它可以解决一个小问题.当我实现一个自定义主题时,我丢失了我的上一个和下一个图标(为了移动几个月).

这是图像:

预习

以下是jquery库引用:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
<script type="text/javascript" src="~/lightbox/js/prototype.js"></script>
<script type="text/javascript" src="~/lightbox/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="~/lightbox/js/lightbox.js"></script>
<link type="text/css" rel="stylesheet" href="~/lightbox/css/lightbox.css" media="screen" />
<link type="text/css" rel="Stylesheet" href="~/Scripts/jquery-ui-1.8.9.custom.css" />
Run Code Online (Sandbox Code Playgroud)

这是我在jquery-ui-1.8.9-custom.css中的图像引用

/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(~/images/jquery/ui-icons_469bdd_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(~/images/jquery/ui-icons_469bdd_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(~/images/jquery/ui-icons_d8e7f3_256x240.png); }
.ui-state-default .ui-icon { background-image: url(~/images/jquery/ui-icons_6da8d5_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(~/images/jquery/ui-icons_217bc0_256x240.png); }
.ui-state-active .ui-icon {background-image: url(~/images/jquery/ui-icons_f9bd01_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(~/images/jquery/ui-icons_2e83ff_256x240.png); }
.ui-state-error .ui-icon, …
Run Code Online (Sandbox Code Playgroud)

jquery-ui jquery-ui-datepicker

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

使用OnKeyUp在TextBox中按Enter键时避免使用Windows"Ding"

如果用户点击带有KeyUp事件的Windows窗体文本框,则会发出哔哔声或叮当声.我无法确定为什么会发生这种情况以及如何避免这种情况.

任何帮助,将不胜感激.

.net beep winforms

9
推荐指数
2
解决办法
8276
查看次数

read.fwf和数字符号

我正在尝试使用其固定宽度结构读取此文件(3.8mb),如以下链接中所述.

这个命令:

a <- read.fwf('~/ccsl.txt',c(2,30,6,2,30,8,10,11,6,8))
Run Code Online (Sandbox Code Playgroud)

产生错误:

第37行没有10个元素

在使用不同的跳过选项值复制问题后,我认为导致问题的行都包含"#"符号.

有没有办法绕过它?

r read.table

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