一些三星设备具有超省电模式,可关闭wifi,转动屏幕灰度并限制几个基本应用的使用.
但它确实允许您添加一些可以使用的应用程序.这些应用包括Facebook和WhatsApp.如何让我的应用程序出现在此列表中?我必须对应用程序进行哪些更改才能显示在此列表中?或者此列表是否基于三星维护的白名单?
我目前正在审查一个非常古老的C++项目,并在那里看到许多代码重复.
例如,有一个包含5个MFC消息处理程序的类,每个消息处理程序包含10行相同的代码.或者,每个地方都有一个5行代码段用于非常具体的字符串转换.在这些情况下,减少代码重复不是问题.
但我有一种奇怪的感觉,我可能会误解某些东西,并且最初有这种重复的原因.
什么可能是重复代码的正当理由?
有吨的有关设计和安全发展(甚至在SO一堆职位)好论文,但他们似乎专注于什么,你应该做的.
然而,我所追求的是一个像黑客一样的思维清单.完成开发后应该完成的简单操作列表,以确保解决方案的安全性.
(更新:我最感兴趣的是黑盒清单 - "去一个页面,试试这个和那个"的东西,但白盒清单也可能是有意义的.)
这是我到目前为止所提出的:
HtmlEncode和编码UrlEncodehttp://www.example.com/foo?bar=HugeAmountOfData以确保约束输入并进行边界检查.Web层.
[ValidateAntiForgeryToken]属性以防止跨站点请求伪造攻击.Response.Write(直接或间接)永远不会用于显示用户输入.服务层.
数据库层.
SELECT *但始终明确指定列列表.@@TRANCOUNT等)中运行并显式提交/回滚它.评论?更正?缺少步骤?
使其成为社区维基,您可以随意编辑.
我正在使用.NET Framework版本4.5.1的WebForms的新模型绑定功能.我希望实现的是,根据一些条件排除一些双向绑定.
我非常喜欢Scott Guthrie撰写的(希望现在很有名)博客文章系列.我使用Web Forms Model Binding Part 3:更新和验证(ASP.NET 4.5系列)中的第二种方法实现编辑页面
这就是我所拥有的:(简化,在ElementEdit.aspx中):
<asp:FormView runat="server" ID="FormViewElement" RenderOuterTable="false" DefaultMode="Edit" DataKeyNames="ElementId"
ItemType="Business.Entities.Element"
SelectMethod="GetElement"
UpdateMethod="UpdateElement">
<EditItemTemplate>
<asp:Panel runat="server" DefaultButton="ButtonSpeichern">
<fieldset>
/*some databound controls*/
<asp:Panel runat="server" Visible="<%# !Item.CurrentElementData.SomeCondition() %>">
/*more databound controls*/
</asp:Panel>
/*the submit button ("ButtonSpeichern")*/
</fieldset>
</asp:Panel>
</EditItemTemplate>
</asp:FormView>
Run Code Online (Sandbox Code Playgroud)
如您所见,包裹的内部面板上的可见性存在"更多数据绑定控制"的条件.当条件为真时,这些应该仅绑定,并且它们是可见的.否则它们不应该绑定而不能更改值.
更新的工作方式类似于Scott的帖子(简化,在xxPage.cs中),它是Type Element的通用基类:
protected virtual bool UpdateEntity(int id) {
T existing = UseCase.GetItem(id); //gets the original element
TryUpdateModel(existing); //SHOULD NOT update the invisible databound controls, but …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置NGINX和cloudflare.我在谷歌上读过这个,但没有解决我的问题.我的cloudflare目前很活跃.我删除了cloudflare中的所有页面规则,但之前有domain.com和www.domain.com使用HTTPS.我认为这可能导致问题所以我删除了它.这是我的defaultNGINX文件,目的是只允许通过域名访问,并禁止访问网站的IP值:
server{
#REDIRECT HTTP TO HTTPS
listen 80 default;
listen [::]:80 default ipv6only=on; ## listen for ipv6
rewrite ^ https://$host$request_uri? permanent;
}
server{
#REDIRECT IP HTTPS TO DOMAIN HTTPS
listen 443;
server_name numeric_ip;
rewrite ^ https://www.domain.com;
}
server{
#REDIRECT IP HTTP TO DOMAIN HTTPS
listen 80;
server_name numeric_ip;
rewrite ^ https://www.domain.com;
}
server {
listen 443 ssl;
server_name www.domain.com domain.com;
#rewrite ^ https://$host$request_uri? permanent;
keepalive_timeout 70;
ssl_certificate /ssl/is/working.crt;
ssl_certificate_key /ssl/is/working.key;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
#ssl_dhparam /path/to/dhparam.pem; …Run Code Online (Sandbox Code Playgroud) 我的Linux rhel-5中有python2.6.我已经安装了pip和所需的CFFI包.当我尝试运行示例CFFI程序时,它说:
ffi = FFI()
初始化文件"/usr/lib/python2.6/site-packages/cffi/api.py",第56行
import _cffi_backend as backend
Run Code Online (Sandbox Code Playgroud)
ImportError:没有名为_cffi_backend的模块
什么可能是错误的错误.我在安装过程中遗漏了什么.我已经安装了pip,wheel,pycparser,pytest,cffi ....
我目前正在探索使用基本容器为FRP网络提供更多结构的可能性,从而更容易创建更复杂的事件网络.
注意:我使用ordrea但反应性香蕉也有同样的问题,所以我想这个问题不是特定于所选的frp实现.
在这个特殊情况下,我使用一个简单Matrix的存储Events:
newtype Matrix (w :: Nat) (h :: Nat) v a where
Matrix :: Vector a -> Matrix w h v a
-- deriving instances: Functor, Foldable, Traversable, Applicative
Run Code Online (Sandbox Code Playgroud)
Matrix基本上只是一个薄的包装器Data.Vector,我将使用的大多数功能基本上与相应Vector的功能相同.值得注意的例外是索引,但这应该是自我解释的.
有了这个,我可以定义事件的矩阵,Matrix 10 10 (Event Double)并且能够定义基本的卷积算法:
applyStencil :: (KnownNat w, KnownNat h, KnownNat w', KnownNat h')
=> M.Matrix w' h' (a -> c)
-> M.Matrix w h (Event a)
-> M.Matrix w h …Run Code Online (Sandbox Code Playgroud) 编辑:我需要使用键盘,但它隐藏了我的EditText,我需要它滚动,所以键盘没有隐藏它.
我正在使用三星平板电脑.
我的风格:
parent="android:Theme.Holo.NoActionBar.Fullscreen"
Run Code Online (Sandbox Code Playgroud)
这些EditText字段位于可滚动视图中,如下所示:
片段布局:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<ScrollView
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/depot_code"/>
<EditText
android:hint="@string/enter_depot_code"
android:id="@+id/etlocationId"
android:imeOptions="actionNext"
android:inputType="number"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="12"
android:singleLine="true">
<requestFocus/>
</EditText>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/name"/>
<EditText
android:hint="@string/enter_name"
android:id="@+id/etname"
android:imeOptions="actionNext"
android:inputType="textPersonName"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="24"
android:singleLine="true"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:text="@string/street"/>
<EditText
android:hint="@string/enter_street"
android:id="@+id/etstreet"
android:imeOptions="actionNext"
android:inputType="textPostalAddress"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:lines="1"
android:maxLength="24"
android:singleLine="true"/>
<TextView
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_width="wrap_content" …Run Code Online (Sandbox Code Playgroud) android android-fragments samsung-mobile window-soft-input-mode imeoptions
我们调整了我们对Oreo的持续通知,并且效果很好.现在,仅在Pie上(在Oreo设备上没有发生),我们得到了标题错误.Pie中的前台服务有什么变化我错过了吗?
这是前台服务的onCreate代码 - >
override fun onCreate() {
super.onCreate()
val notification: Notification = NotificationCompat.Builder(this, packageName)
.setSmallIcon(R.drawable.status_notification_icon)
.setContentTitle(getString(R.string.ongoing_notify_temp_title))
.setContentText(getString(R.string.ongoing_notify_temp_message))
.setGroup(AppConstants.NOTIFICATION_GROUP_ONGOING)
.setColor(ContextCompat.getColor(this, R.color.custom_blue))
.build()
startForeground(ONGOING_NOTIFY_ID, notification)
appSettings = AppSettings(this)
weatherLookUpHelper = WeatherLookUpHelper()
MyRoomDatabase.getInstance().invalidationTracker.addObserver(onChange)
retrieveCurrentLocation()
createAlarmManager()
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我们只是创建通知然后调用startForeground.关于为什么这段代码会产生标题错误的任何想法?
侧注:Fabric Crashlytics显示此崩溃仅发生在运行Pie的像素设备(像素,像素xl,像素2,像素2 xl)上
编辑:我们的清单中有前台权限
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
Run Code Online (Sandbox Code Playgroud) android ×3
c# ×2
asp.net ×1
asp.net-mvc ×1
c++ ×1
cloudflare ×1
controls ×1
fold ×1
frp ×1
haskell ×1
imeoptions ×1
nginx ×1
power-saving ×1
python-2.6 ×1
redirect ×1
security ×1
webforms ×1