程序设计

专业和发烧友程序员的问答


10
如何在angular.js中实现history.back()
我有指令,它是带有后退按钮的网站标题,我想单击可返回上一页。我如何以有角度的方式做到这一点? 我努力了: <header class="title"> <a class="back" ng-class="icons"><img src="../media/icons/right_circular.png" ng-click="history.back()" /></a> <h1>{{title}}</h1> <a href="/home" class="home" ng-class="icons"><img src="../media/icons/53-house.png" /></a> </header> 这是指令js: myApp.directive('siteHeader', function () { return { restrict: 'E', templateUrl: 'partials/siteHeader.html', scope: { title: '@title', icons: '@icons' } }; }); 但什么也没发生。我查看了有关$ location的angular.js API,但未找到有关后退按钮或的任何信息history.back()。


8
Apache Proxy:没有协议处理程序有效
我正在尝试将子目录代理到另一台服务器。我的httpd.conf: RewriteEngine On ProxyPreserveHost On RewriteRule .*subdir/ https://anotherserver/subdir/ [P] 问题在于Apache始终在记录以下内容: AH01144: No protocol handler was valid for the URL /subdir/. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: http://localhost/ 因此,在搜索互联网后,我激活了以下模块: LoadModule headers_module modules/mod_headers.so LoadModule proxy_module modules/mod_proxy.so …


7
sqlite数据库默认时间值“现在”
在sqlite数据库中是否可以创建一个带有默认为timestamp列的表DATETIME('now')? 像这样: CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT, t TIMESTAMP DEFAULT DATETIME('now') ); 这给出了一个错误...如何解决?
190 sql  sqlite 

22
以编程方式将EditText的输入类型从PASSWORD更改为NORMAL,反之亦然
在我的应用程序中,我EditText的默认输入类型android:inputType="textPassword"由deault 设置为。它CheckBox在其右侧具有,选中该复选框时,会将那个EditText的输入类型更改为NORMAL PLAIN TEXT。的代码是 password.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); 我的问题是,当未选中CheckBox时,应再次将输入类型设置为PASSWORD。我已经使用- password.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); 但是,该edittext中的文本仍然可见。令我惊讶的是,当我更改方向时,它会自动将输入类型设置为PASSWORD,并且其中的文本会显示为项目符号(如密码所示)。 有什么办法可以做到这一点?

18
Android-SPAN_EXCLUSIVE_EXCLUSIVE跨度不能为零长度
我有以下布局(实际上是空的): <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/set_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="content desc" android:orientation="vertical" > <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello, I am a TextView" /> </LinearLayout> Activity类包含以下内容: public class TestActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); } } 在移动设备上运行此命令时,出现以下错误: SpannableStringBuilder SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length 无论是否使用TextView我都尝试过,并且错误仍然存​​在,对于这样的基本布局,我必须做一些根本错误的事情。 …
190 java  android 


12
WPF和最初的重点
似乎当WPF应用程序启动时,没有焦点。 这真的很奇怪。我使用过的所有其他框架都可以实现您所期望的:将最初的焦点放在制表符顺序中的第一个控件上。但是我已经确认它是WPF,而不仅仅是我的应用程序-如果我创建一个新的Window,然后在其中放置一个TextBox,然后运行该应用程序,则在我单击它或按Tab之前,TextBox不会具有焦点。uck 我的实际应用程序比仅TextBox更复杂。我在UserControls中有几层UserControls。这些用户控件之一具有Focusable =“ True”和KeyDown / KeyUp处理程序,我希望它在窗口打开后立即具有焦点。不过,我还是WPF的新手,我不太想办法。 如果启动我的应用程序并按Tab键,则焦点将移到我的可聚焦控件上,并且它将按照我想要的方式开始工作。但是我不希望我的用户在开始使用该窗口之前必须先按下Tab键。 我已经使用过FocusManager.FocusedElement,但是我不确定要在哪个控件上进行设置(顶级Window?包含可聚焦控件的父级?可聚焦控件本身?)或将其设置为什么。 窗口打开后,我该怎么做才能使深层嵌套的控件具有最初的焦点?还是更好地将第一个可聚焦控件按选项卡顺序聚焦?
190 wpf  focus 

10
如何使用jQuery / JavaScript解析JSON数据?
我有一个AJAX调用,返回的是这样的JSON: $(document).ready(function () { $.ajax({ type: 'GET', url: 'http://example/functions.php', data: { get_param: 'value' }, success: function (data) { var names = data $('#cand').html(data); } }); }); 在#canddiv中,我将得到: [ { "id" : "1", "name" : "test1" }, { "id" : "2", "name" : "test2" }, { "id" : "3", "name" : …
190 jquery  ajax  json  parsing 

6
在Jinja2中,如何测试变量是否未定义?
从Django转换后,我习惯于执行以下操作: {% if not var1 %} {% endif %} 如果我没有将var1放入上下文中,它就可以工作。Jinja2给了我一个未定义的错误。有没有简单的说法{% if var1 == None %}或类似的说法?
190 jinja2 

5
获取程序集名称
C#的异常类具有一个source属性,该属性默认情况下设置为程序集的名称。 是否有另一种方法来获取此确切的字符串(不分析其他字符串)? 我尝试了以下方法: catch(Exception e) { string str = e.Source; //"EPA" - what I want str = System.Reflection.Assembly.GetExecutingAssembly().FullName; //"EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" str = typeof(Program).FullName; //"EPA.Program" str = typeof(Program).Assembly.FullName; //"EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" str = typeof(Program).Assembly.ToString(); //"EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" str = typeof(Program).AssemblyQualifiedName; //"EPA.Program, EPA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" }



By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.