exists

UiPath之文件操作

瘦欲@ 提交于 2019-12-03 07:09:11
今天给大家介绍一下,在UiPath中如何操作文件,比如需要在某个文件夹中自动创建一个当天日期的文本。 主要使用的activity有: l Assign l Path Exists l If l Create Directory l Move File l Create File 本例中实现的功能如下: 判断文件是否存在, 如果存在,则新建一个今天日期的文件夹,并将文件移动到文件夹中; 如果不存在,则新建一个文件夹A,并新增一个今天日期的文件 定义一个String类型的字符串变量file,将我们需要的操作的文件路径(绝对路径)赋值给他。 2.追加一个Path Exists的activity,判断我们的文件是否存在, l PathType有两个选择,File:判断文件是否存在;Folder:判断文件夹是否存在。 l 返回值为Boolean类型。新建一个bool类型的变量exists 3.添加一个If的activity,用来判断文件是否存在以后的操作。 为真:新建一个今天日期的文件夹,并将指定的文件移动到指定目录中 为假:新建一个A的文件夹,并创建一个今天日期的文本文件。 实现的过程如下。 条件为真的时候,进行如下操作: 条件为假的时候,进行如下操作: 好了,以上就是我们整个的实现过程,有兴趣的小伙伴可以自己尝试着做一下 如果大家在实现的过程中有任何问题,欢迎大家关注下方的微信公众

detect if contact has photo

廉价感情. 提交于 2019-12-03 07:01:22
I've got an ImageView which I'm displaying a contacts picture using a Uri which always looks similar to this: content://com.android.contacts/contacts/34/photo How would I be able to detect whether this photo exists, as if it doesn't then I want to use a placeholder instead (stored in my drawable folder). At the moment it just shows a blank image. ng93 a function to get a contacts photo uri: public Uri getPhotoUri(Integer contactid) { Cursor photoCur = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'", null,

30个Oracle语句优化规则详解

一世执手 提交于 2019-12-03 04:33:13
选用适合的Oracle优化器 Oracle的优化器共有3种: a.RULE(基于规则) b.COST(基于成本) c.CHOOSE(选择性) 设置缺省的优化器,可以通过对init.ora文件中OPTIMIZER_MODE参数的各种声明,如RULE、COST、CHOOSE、ALL_ROWS、FIRST_ROWS。你当然也在SQL句级或是会话(session)级对其进行覆盖。 为了使用基于成本的优化器(CBO,Cost-Based Optimizer),你必须经常运行analyze命令,以增加数据库中的对象统计信息(object statistics)的准确性。 如果数据库的优化器模式设置为选择性(CHOOSE),那么实际的优化器模式将和是否运行过analyze命令有关。如果table已经被analyze过,优化器模式将自动成为CBO,反之,数据库将采用RULE形式的优化器。 在缺省情况下,Oracle采用CHOOSE优化器,为了避免那些不必要的全表扫描(full table scan),你必须尽量避免使用CHOOSE优化器,而直接采用基于规则或者基于成本的优化器。 访问Table的方式Oracle采用两种访问表中记录的方式: a.全表扫描 全表扫描就是顺序地访问表中每条记录。Oracle采用一次读入多个数据块(database block)的方式优化全表扫描。 b.

SQLSERVER SQL性能优化

北城以北 提交于 2019-12-03 03:35:07
SQLSERVER SQL 性能优化系列      1. 选择最有效率的表名顺序 ( 只在基于规则的优化器中有效 )       SQLSERVER 的解析器按照从右到左的顺序处理 FROM 子句中的表名,因此 FROM 子句中写在最后的表(基础表 driving table )将被最先处理,在 FROM 子句中包含多个表的情况下,必须选择记录条数最少的表作为基础表,当 SQLSERVER 处理多个表时,会运用排序及合并的方式连接它们,    首先,扫描第一个表( FROM 子句中最后的那个表 ) 并对记录进行排序;然后扫描第二个表( FROM 子句中最后第二个表 ) ;最后将所有从第二个表中检索出的记录与第一个表中合适记录进行合并    例如 : 表 TAB1 16,384 条记录表 TAB2 5 条记录,选择 TAB2 作为基础表 ( 最好的方法 ) select count(*) from tab1,tab2 执行时间 0.96 秒,选择 TAB2 作为基础表 ( 不佳的方法 ) select count(*) from tab2,tab1 执行时间 26.09 秒; 如果有 3 个以上的表连接查询,那就需要选择交叉表( intersection table )作为基础表,交叉表是指那个被其他表所引用的表      例如 :    EMP 表描述了 LOCATION 表和

Validate struct field if it exists

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm POSTing a JSON user object to my Golang application where I decode the 'req.body' into a 'User' struct. err := json.NewDecoder(req.Body).Decode(user) //handle err if there is one and the 'User' struct: type User struct { Name string `json:"name,omitempty"` Username string `json:"username,omitempty"` Email string `json:"email,omitempty"` Town string `json:"town,omitempty"` //more fields here } While I don't need help with the actual validation, I would like know how to validate usernames only if it is included as part of the JSON object.

SQLiteException: table already exists

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I added to my DB the table called "MEDIA_TABLE" and i got the following error code: 05-15 20:56:22.976: E/AndroidRuntime(5968): android.database.sqlite.SQLiteException: table personal_stats already exists (code 1): , while compiling: CREATE TABLE personal_stats (_id INTEGER PRIMARY KEY AUTOINCREMENT, pictures TEXT, videos TEXT); My second table works fine. i tried to uninstall my app and install it and it wont work, maybe there is a limit of tables in DB? Here is my onCreate code: @Override public void onCreate(SQLiteDatabase db) { db

Handlebars #if and numeric zeroes

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my Handlebars template I check for the existence of a variable, and render some text if it's there: {{#if foo}} some text {{/if}} This works fine if foo is text or if foo is numeric but not zero. But if var foo = 0; then {{#if foo}} returns false. This appears to be yet another Javascript oddity, because Javascript itself behaves the same way. In Javascript code, though, you could get around this by checking if the variable is 'undefined'. How can I do the same thing in Handlebars? I could write an {{#exists}} helper, but I was hoping

Check if IndexedDB database exists

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way to check if an IndexedDB database already exists? When a program tries to open a database that does not exists the database is created. The only way that I can think of is something like the following, where I test if an objectStore already exists, if it doesn't, the database is deleted: var dbexists=false; var request = window.indexedDB.open("TestDatabase"); request.onupgradeneeded = function(e) { db = e.target.result; if (!db.objectStoreNames.contains('todo')) { db.close(); indexedDB.deleteDatabase("TestDatabase"); } else {

File.Exists() returns false, but not in debug

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm being completely confused here folks, My code throws an exception because File.Exists() returns false public override sealed TCargo ReadFile(string fileName) { if (!File.Exists(fileName)) { throw new ArgumentException("Provided file name does not exist", "fileName"); } Visual studio breaks at the throw statement, and I immediately check the value of File.Exists(fileName) in the immediate window. It returns true . When I drag the breakpoint back up to the if statement and execute it again, it throws again. fileName is an absolute path to

Check if Cookie exists with JSP EL

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to check if a cookie exists on a JSP page using the Expression Language. I have a cookie called persist which is set to either empty string or "checked". If would like to check if the persist cookie exists. I have tried the following: <c:if test="${cookie.persist == null}"> <c:if test="${empty cookie.persist}"> Both of the above statements are true when the value of the persist cookie is the empty string and false when the value of the cookie is checked . How do I distinguish between a cookie with the empty string as its value,