我的问题类似于这个2岁的问题,我只是发布相同的问题来获得更新的答案,因为很多事情在两年内发生了变化.
我正在开发一个GingerBread +设备的应用程序,我有很多活动,在后台我收到服务器的一些数据.现在基于该数据在某些情况下我需要向Dialog用户显示一个.问题是我如何知道当前最活跃的活动?
我试过,
我曾试图给getApplicationContext()而Dialog创作,但是不工作.抛出一些例外.
一个办法 ?(我真的讨厌它),
一个解决方案可能是通过在Application类中使用变量并在onResume()每个活动上设置它来跟踪当前可见的活动.如果他们有更明智的方法来实现这一点,我真的不想做这本书,我相信他们是更明智的方法来实现这一目标,
我的简单问题是,
如何在当前可见活动上显示对话框?,所以我可以提供对AlertDialog.Builder的引用,我认为这将完成我的工作.如果不是我怎么能在最顶层的Activity上显示一个对话框?
编辑,我使用以下代码私有View.OnClickListener创建一个简单的对话框cancelClickListener = new OnClickListener(){
@Override
public void onClick(View v) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
LoginActivity.this);
// set title
alertDialogBuilder.setTitle("Roobroo will exit..");
// set dialog message
alertDialogBuilder
.setMessage("Are you sure you want to exit ?")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
// if this button is clicked, close
// …Run Code Online (Sandbox Code Playgroud) 我的要求类似于2009年这个老问题.我只是重新发布,因为OP有点2岁了,问题现在关闭了.
如何使用Flex/ActionScript 3.0通过Socket传输实时视频流?
我正在开发一个适用于P2P架构的应用程序,所以我不能使用FMS进行实时媒体流.我已阅读NetConnection and NetStream classes但无法开始使用它们,因为所有示例都使用FMS.我是怎么做到的
其次,我还需要一个合适的库/工具/技术来在显示和传输之前对视频帧进行编码(和解码).为此,我已经阅读了X264编解码器,但在Flex中使用它似乎太复杂了.还有其他选择吗?
任何教程/博客都会有很大的帮助......
我的要求与此问题类似,因为问题现在已经3年了,我正在重新发布具有我特定信息的问题,我想创建一个采用.wav(或任何其他标准音频文件格式)并转换的应用程序它发短信.
对于语音识别,我决定使用sphinx4,我正在尝试增强sphinx提供的Transcriber演示.它很好,但只适用于特定的语法(用.gram和.gxml文件编写).
编辑 能够用英语吗?我正在尝试使用VoxForge_en_0.4进行配置.我的config.XML文件如下: -
<?xml version="1.0" encoding="UTF-8"?>
<!--
Sphinx-4 Configuration file
-->
<!-- ******************************************************** -->
<!-- biship configuration file -->
<!-- ******************************************************** -->
<config>
<!-- ******************************************************** -->
<!-- frequently tuned properties -->
<!-- ******************************************************** -->
<property name="absoluteBeamWidth" value="500"/>
<property name="relativeBeamWidth" value="1E-80"/>
<property name="absoluteWordBeamWidth" value="20"/>
<property name="relativeWordBeamWidth" value="1E-60"/>
<property name="wordInsertionProbability" value="1E-16"/>
<property name="languageWeight" value="7.0"/>
<property name="silenceInsertionProbability" value=".1"/>
<property name="frontend" value="epFrontEnd"/>
<property name="recognizer" value="recognizer"/>
<property name="showCreations" value="false"/>
<!-- ******************************************************** -->
<!-- word recognizer configuration -->
<!-- ******************************************************** -->
<component …Run Code Online (Sandbox Code Playgroud) 我正在使用一个线程,它使用AudioRecord类记录音频,并放在recorderBUffer(这是Short []的链接列表)中,这是一个单独的线程,它对这些数据进行编码并将其放入playerBuffer(链表[]) .为了播放音频我正在使用AudioTrack类和onPeriodicNotification()我从playerBuffer读取数据并将其写入轨道.
代码很简单,直观.但它不应该按照它的方式工作.GC_CONCURRENT一直吃掉,这导致AudioTrack如此频繁地重启(我猜!).我从LogCat收到以下消息: -
04-09 12:25:13.757: E/Constructor(10100): inside constructor
04-09 12:25:13.757: I/ApplicationPackageManager(10100): cscCountry is not German : INS
04-09 12:25:17.429: E/startRecording(10100): start Recording
04-09 12:25:17.445: I/AudioCapturer(10100): Audio Recorder created
04-09 12:25:17.546: I/Audio Player(10100): Audio Track instance created buffer Size : 2972
04-09 12:25:17.546: I/SpeexThread(10100): Thread Started Successfully..
04-09 12:25:17.734: D/dalvikvm(10100): GC_CONCURRENT freed 55K, 44% free 3208K/5639K, external 408K/517K, paused 4ms+6ms
04-09 12:25:17.945: D/dalvikvm(10100): GC_CONCURRENT freed 1K, 39% free 3765K/6151K, external 408K/517K, paused 3ms+8ms
04-09 12:25:18.148: D/dalvikvm(10100): GC_CONCURRENT freed <1K, …Run Code Online (Sandbox Code Playgroud) 我试图在下面的XSD架构文件中插入主键和外键: -
主键是StudentID,外键是courseID,AddressID,GradeID.
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Student">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="xs:string"/>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
<xs:element name="Dateborn" type="xs:date"/>
<xs:element name="Gender" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)
但是上面的代码在我的设置中不起作用请帮我跟踪问题,
免责声明:我的问题有点类似于这个问题和这个问题,但我已经尝试过在这些主题中提出的所有答案,并且已经花了几天时间来解决这个问题.
我在现有的应用程序(JSP,Servlet)中介绍了Spring Security 3.2.6,我使用的是Java配置.我的应用程序将被浏览器和非浏览器客户端使用.我希望所有对URL(即/webpages/webVersion/和/webpages/webVersion2/)的浏览器请求都启用CSRF,并且所有其他请求都禁用CSRF.非浏览器客户端从不访问上述两个URL,而浏览器应用程序也可以访问CSRF禁用的URL.
我尝试了各种选择:
仅在前面提到的URL上启用Spring Security:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/","/resources/****").permitAll()
.antMatchers("/webpages/webVersion/****", "/webpages/webVersion2/****").authenticated()
.antMatchers("/webpages/****").permitAll()
.anyRequest().anonymous()
.and()
.formLogin().loginPage("/webpages/webVersion/login/newLogin.jsp").failureUrl("/webpages/webVersion/login/newLogin.jsp?error=true").loginProcessingUrl("/j_spring_security_check")
.usernameParameter("username").passwordParameter("password").defaultSuccessUrl("/webpages/webVersion/login/loginSuccess.jsp", true).permitAll()
.and()
.logout().logoutUrl("/webpages/webVersion/logout.jsp").permitAll()
.and().exceptionHandling().accessDeniedPage("/webpages/webVersion/404-error-page.jsp")
.and()
.csrf();
}
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为我观察到所有URL都启用了CSRF.
尝试使用CSRFProtectionMatcher:
.csrf().requireCsrfProtectionMatcher(csrfRequestMatcher);
Run Code Online (Sandbox Code Playgroud)
CSRF仅针对预期的URL启用,但是甚/resources/**至/webpages/**需要在匹配函数内检查URL.考虑到它将适用于所有请求似乎有点多.
尝试使用该configure方法的另一个版本:
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().regexMatchers(".*?/jsp/(?!webVersion|webVersion2).*?");
}
Run Code Online (Sandbox Code Playgroud)
我不确定我是否正确地做到了但这并没有产生我想要的结果.
以上哪种方法是正确的(Spring Security)做我想要的方式?如何从Spring Security配置中实现所需的行为?
我创建了一个自定义的静态窗口,该窗口显示位图图像,该窗口是其他窗口的子窗口。现在,我想捕获此窗口的鼠标事件,以便可以提供裁剪图像的功能。
但是问题是Mouse事件没有传递到此子窗口。...以下是该子窗口的代码段WndProc。
WNDPROC origStatProc;
// Variable which stores the handle of BITMAP image
HBITMAP hBitmap=NULL;
LRESULT CALLBACK dispWndProc(HWND hwnd,UINT msg, WPARAM wParam, LPARAM lParam)
{
static HDC hdc;
static PAINTSTRUCT paintSt;
static RECT aRect;
switch(msg)
{
case WM_PAINT:
{
hdc = BeginPaint(hwnd,&paintSt);
GetClientRect(hwnd,&aRect);
if(hBitmap!=NULL)
{
HDC memDC = CreateCompatibleDC(hdc);
if(memDC!=NULL)
{
BITMAP bmp;
GetObject(hBitmap,sizeof(bmp),&bmp);
SelectObject(memDC,hBitmap);
SetStretchBltMode(hdc,HALFTONE);
StretchBlt(hdc,0,0,aRect.right,aRect.bottom,
memDC,0,0,bmp.bmWidth,bmp.bmHeight,
SRCCOPY);
DeleteObject(&bmp);
ReleaseDC(hwnd,memDC);
}
}
// the code for painting
EndPaint(hwnd,&paintSt);
}
break;
case STM_SETIMAGE:
{
InvalidateRect(hwnd,&aRect,true);
}
break;
case …Run Code Online (Sandbox Code Playgroud) 我使用NetBeans 7.0和Glassfish 3.1与Spring,版本3.0.2,我经常收到像这样的错误:
"someProjectName \nbproject\build-impl.xml:1060:无法删除文件SomeProjectname\build\web\WEB-INF\lib\antlr-2.7.6.jar"
任何人有任何想法可能是什么原因?
我有一个简单的登录活动有两个编辑文本文件,用于用户名和密码..现在我想实现以下两个功能,
我的XML文件看起来像这样
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/online" >
<TextView
android:id="@+id/userNamelbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/userNameLbl" />
<EditText
android:id="@+id/userNametxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/userNamelbl"
android:background="@android:drawable/editbox_background"
android:hint="@string/userNameTxt"
android:maxLines="1"
android:nextFocusDown="@+id/passwordtxt"
android:singleLine="true" />
<TextView
android:id="@+id/passwordlbl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/userNametxt"
android:text="@string/passwordLbl" />
<EditText
android:id="@+id/passwordtxt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/passwordlbl"
android:background="@android:drawable/editbox_background"
android:hint="@string/passwordTxt"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
<Button
android:id="@+id/okBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/passwordtxt"
android:layout_marginLeft="10dip"
android:text="@string/okLbl" />
<Button
android:id="@+id/cancelBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/okBtn"
android:layout_toLeftOf="@id/okBtn"
android:text="@string/cancelLbl" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在尝试为构建过程配置 jenkins 服务器。我的目录结构如下
/home/<user>/projects/MyProject
/home/<user>/projects/MyProject/scripts
/home/<user>/projects/MyProject/trunk
Run Code Online (Sandbox Code Playgroud)
我已经给出了 jenkins 中自定义工作区的路径 upto scrips 即 /home/<user>/projects/MyProject/scripts现在我想将项目从 SVN 主干签出到我的本地主干。当我/home/<user>/projects/MyProject/trunk为本地检出目录(应检出项目的位置)提供主干 ( )路径时,jenkins 向我显示“不允许使用绝对路径”。我怎样才能通过 jenkins 为 svn checkouts 提供 upto trunk 的路径。
我花了几个小时来寻找解决方案,即 jenkins doc、jenkins 论坛、hudson docs、hudson 论坛和这里的 SO,但找不到解决方案。请帮忙..
android ×3
spring ×2
apache-flex ×1
audio ×1
c++ ×1
cmusphinx ×1
foreign-keys ×1
glassfish-3 ×1
hudson ×1
java ×1
jenkins ×1
netbeans ×1
p2p ×1
primary-key ×1
sockets ×1
sphinx4 ×1
svn ×1
visual-c++ ×1
winapi ×1
xsd ×1