小编For*_*gic的帖子

Android:重新绘制布局中的特定视图

我有一个垂直对齐的LinearLayout,它包含一个TextView,我自己的自定义视图类,我希望在底部放置一个广告.

我在我的自定义视图类(扩展View)中绘制对象,但除非我调用它setContentView(R.layout.myview),否则它不会更新到屏幕,但是这会将我的TextView重置为默认文本(存储在xml文件中的内容)不想要,我认为它会重新制作一个新广告......很烦人.

有没有办法我可以重绘/刷新我的自定义视图到屏幕而不影响我的textview或我的布局上可能有的其他任何东西?

layout android refresh view draw

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

response.sendRedirect无效

方法response.sendRedirect()在我的程序中不起作用.

代码通过并成功打印out.println("wrong user");,但重定向到谷歌分页不起作用.

String id="java";

try 
{
    query = "select Id from Users where Id= ?";
    ps  =Database.getConnection().prepareStatement(query);
    ps.setString(1, id);
    rs  =   ps.executeQuery();

    if(rs.next())
    {
        out.println(rs.getString(1));
    }
    else 
    {
        out.println("wrong user");
        response.sendRedirect("www.google.com");
    }
    rs.close();
}
catch(Exception e)
{
    //e.printStackTrace();
    System.out.print(e);
}   
Run Code Online (Sandbox Code Playgroud)

任何答案?

jsp jdbc response

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

Wordpress禁用用户帐户?

我想禁用用户的帐户.当用户的帐户被禁用时,用户应该无法登录.

如何禁用用户的帐户?

wordpress

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

使用PNG图像的SplashScreen导致Android.Views.InflateException,后跟OutOfMemory

我观看了Google IO 2011大会,几乎每篇文章都有关于OutOfMemory异常和InflateException的内容,没有运气,我找不到任何能解决我问题的答案.

如何从包含背景图像的布局中正确清除内存?我觉得如果InflateException后跟OutOfMemory是相关的,因为背景图像没有被正确清除.

所以我得到了:

Android.Views.InflateException:二进制XML文件行#24:错误类膨胀

其次是 :

Java.Lang.OutOfMemoryError:

我很确定这是由我的背景图片引起的.

我简化了我的代码以尽可能地缩小问题范围.

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12" />
  <activity />
  <application android:theme="@android:style/Theme.NoTitleBar" parent="android:Theme"/>
</manifest>
Run Code Online (Sandbox Code Playgroud)

我补充说parent="android:Theme",这是假设解决问题,没有成功.

SplashScreen.axml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/SplashScreenView"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/splash" />
Run Code Online (Sandbox Code Playgroud)

splash是位于我的drawable文件夹中的.png图像.

SplashScreenActivity.cs

[Activity(Label = "My splash screen", MainLauncher = true)]
public class SplashScreenActivity : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.SplashScreen);
        StartNextActivity();
    }

    private void StartNextActivity()
    {
        var intent = new Intent(this, typeof(SplashScreenActivity)); …
Run Code Online (Sandbox Code Playgroud)

android out-of-memory xamarin.android inflate-exception

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

为什么XUnit插件不能与Jenkins一起使用?

我从jenkins启动了测试IDE(硒),并上传了XUNIT插件以获取一份不错的测试报告,但最后我得到了以下ERROR消息:

测试失败,有关详细信息,请参见结果文件:

D:\FTP\stm_atos_automatisation\rapports\ff39\rapport_ff39.html ERROR: Build step failed with exception java.lang.NullPointerException: The types section is required.
at org.jenkinsci.plugins.xunit.XUnitProcessor.<init>(XUnitProcessor.java:65)
at org.jenkinsci.plugins.xunit.XUnitPublisher.perform(XUnitPublisher.java:111)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1766)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381) Build step 'Publish xUnit test result report' marked build as failure Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)

有什么办法解决这个问题?

selenium xunit jenkins

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

使用onSaveInstanceState保存TextView

我正在努力保存和恢复TextView和按钮.似乎我无法保存TextView,因为"outState"需要一个String.

我做了一个TicTacToe游戏,但是我希望在方向为"风景"时保存所有东西

这是我正在尝试做的一部分:

private Button lesBoutons[];
private Button rejouer;
private Jeu jeu;
private TextView leTexte;
private int[] tabGagne;
public boolean fini;

@Override
public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.PutString("savText", leTexte);
   //TextView savTexte = leTexte;
   //String phrase=leTexte.toString();
   //outState.putString("TEST", phrase);
   //leTexte.getResources();
}

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
 super.onRestoreInstanceState(savedInstanceState);
// leTexte.setText(savedInstanceState.getString("TEST"));
}
Run Code Online (Sandbox Code Playgroud)

如何保存此TextView和所有按钮?

android textview orientation

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

Moq是具有私有集的虚拟ICollection <>属性:"非虚拟上的无效设置"

我遇到了一个问题,我试图模拟一个包含Items类型属性的对象ICollection<>.我收到以下错误:

System.NotSupportedException:非虚拟(在VB中可覆盖)成员上的无效设置:m => m.Items

问题是属性Items已经是虚拟的.

我在下面的Sandbox中重现了我在项目中遇到的错误:

public class ItemList
{
    public virtual int Id { get; set; }
}

public class SpecialList
{
    public virtual string Token { get; internal set; }
    public virtual ICollection<ItemList> Items { get; private set; }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试SetupProperty这样时,在我的测试中发生了这个错误:

[TestFixture]
public class TestSpecialList
{
    [Test]
    public void Mocking_Virtual_ICollection()
    {
        var mockModel = new Mock<SpecialList>();
        var listItem = new List<ItemList> {new ItemList {Id = 007}};

        mockModel.SetupProperty(m => m.Items, listItem); …
Run Code Online (Sandbox Code Playgroud)

c# nunit moq icollection

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

Excel VBA:通过快捷键运行时打开文档后宏挂起,但在 VB 编辑器中完美运行

我遇到了一个奇怪的问题,我决定Ctrl + Shift + P在 VBA 中为我的一个例程分配一个键盘快捷键。此例程假设打开现有的 excel 工作簿,复制一些信息和.SaveAs另一个名称。

当我在 Visual Basic 编辑器中点击播放时,这实际上运行良好。但是,当我使用 Excel 中的键盘快捷键运行我的代码时,它在打开文档后停止工作。

我在此示例中重现了该问题:

Public Sub WriteData()
    Dim templatePath As String
    Dim templateWorkbook As Workbook

    'it seems to hang on the following line
    Set templateWorkbook = Application.Workbooks.Open(templatePath)

    With templateWorkbook.Worksheets.Application
        .Range("B3") = "Employee name"
        .Range("B4") = "Employee first name"
        .Range("B5") = "Employee email"
    End With

    templateWorkbook.SaveAs(ThisWorkbook.Path & "Test")
    templateWorkbook.close
End Sub
Run Code Online (Sandbox Code Playgroud)

我正在使用 Excel 2007。

excel vba keyboard-shortcuts

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

从选择下拉列表中创建查询字符串链接?

我想构建一个带有查询字符串的简单URL,该字符串可以通过javascript/jquery从下拉框中进行操作.

像这样......

<select id="query">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>

<a onclick="window.location='http://www.website.com/?title=' + $(#query);"></a>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

javascript php jquery html5

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

我想对我的天蓝网站进行负载均衡

abc.azurewebsites.net使用Visual Studio 将我的网站()托管到Azure Web Apps.

现在1个月后,我面临交通管理方面的问题.由于请求数量太多,我的CPU总是90-95%.

有没有人知道如何在不更改域名的情况下在此Web应用程序中添加流量管理abc.azurewebsites.net?它是否在我的应用程序中硬编码?

我想过将Web应用程序更改为虚拟机,但现在已经部署了,我害怕域名丢失.

load-balancing azure

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