exists

python - pandas - check if date exists in dataframe

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a dataframe like this: category date number 0 Cat1 2010-03-01 1 1 Cat2 2010-09-01 1 2 Cat3 2010-10-01 1 3 Cat4 2010-12-01 1 4 Cat5 2012-04-01 1 5 Cat2 2013-02-01 1 6 Cat3 2013-07-01 1 7 Cat4 2013-11-01 2 8 Cat5 2014-11-01 5 9 Cat2 2015-01-01 1 10 Cat3 2015-03-01 1 I would like to check if a date is exist in this dataframe but I am unable to. I tried various ways as below but still no use: if pandas.Timestamp("2010-03-01 00:00:00", tz=None) in df['date'].values: print 'date exist' if datetime.strptime('2010-03-01', '%Y-%m-%d') in df[

ajax - check if a username exists + return message if it does

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: im trying to check if a username a user wants is already taken without having to send the form, basically onBlur of the username field. I'm having some trouble and have a few questions. I have my input field plus js: <script src="js/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('#username').on('blur', checkdb); function checkdb(){ var desiredUsername = $(this).val(); $.ajaxSetup({ url: "check-db.php", type: "POST", }); $.ajax({ data: 'desiredUsername='+desiredUsername, success

Warning: strpos() expects parameter 1 to be string, resource

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I recently migrated a PHP site to my server and after migration I receive this error message. As I'm not really familiar with PHP, I'd really appreciate any help. Thanks. Warning: strpos() expects parameter 1 to be string, resource given in .../public_html/store /product_list.php on line 121 Line 121 is as follows... $exists = (strpos($handle, "Resource id") !== false) ? true : false; Here is the rest of the code on the top of the page for relevance. <?php session_start(); include_once("../includes/define.inc.php"); include("../includes

Cannot create a file when that file already exists when using Directory.Move

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to move the directory from one location to another location on the same drive. I am getting " Cannot create a file when that file already exists " error. Below is my code. could any one suggest on this? string sourcedirectory = @ "F:\source" ; string destinationdirectory = @ "F:\destination" ; try { if ( Directory . Exists ( sourcedirectory )) { if ( Directory . Exists ( destinationdirectory )) { Directory . Move ( sourcedirectory , destinationdirectory ); } else { Directory . CreateDirectory ( destinationdirectory );

A database with the same name exists, or specified file cannot be opened, or it is located on UNC share

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Getting this error when I run my project in new PC. TO avoid this I have to copy paste the new Connection string every time .. Is there any way to avoid that ... I have 3 different database and its very annoying O_O SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Users\\Yoro\\Desktop\\WAPent 3.0 (1)\\WAPent 3.0\\WAPent 3.0\\WAPent 2.0\\WAPent 2.0\\App_Data\\LoginStuff.mdf;Integrated Security=True;User Instance=True"); Web Config code <connectionStrings> <add name="ApplicationServices" connectionString=

check file exists java

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want create text file but if the file already exists it should not create new file but should append the text to the content (at the end) of the existing file. How can I do it in Java? for every one second I'm reading data from inputstream when i stop reading and again i start reading data at that time i should write to same file if file already exist does I have to check the condition: if(file.exists){ } else{ new File(); } What I have to do? 回答1: You can use the following code to append to a file which already exists - try {

How to check if a database exists with ODBC

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hello fellow programmers I have been searching the internet for a few days now and can't find a generic method to solve this with only ODBC and SQL. Is there a way to see if a database already exist, only using ODBC . It has to be standard SQL because the user can chose a DSN of his choice (meaning his own SQL Server). This means I can't check the master table on the server because they are named different on different SQL servers. Thanks. 回答1: Don't know if this is too late, or even sufficiently "portable" for you. I only have to deal with

How to determine what is more effective: DISTINCT or WHERE EXISTS?

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For example, I have 3 tables: user , group and permission , and two many2many relationships between them: user_groups and group_permissions . I need to select all permissions of given user, without repeats. Every time I encounter a similar problem, I can not determine which version of a query better: SELECT permisson_id FROM group_permission WHERE EXISTS( SELECT 1 FROM user_groups WHERE user_groups.user_id = 42 AND user_groups.group_id = group_permission.group_id ) SELECT DISTINCT permisson_id FROM group_permission INNER JOIN user_groups ON

How to determine what is more effective: DISTINCT or WHERE EXISTS?

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For example, I have 3 tables: user , group and permission , and two many2many relationships between them: user_groups and group_permissions . I need to select all permissions of given user, without repeats. Every time I encounter a similar problem, I can not determine which version of a query better: SELECT permisson_id FROM group_permission WHERE EXISTS( SELECT 1 FROM user_groups WHERE user_groups.user_id = 42 AND user_groups.group_id = group_permission.group_id ) SELECT DISTINCT permisson_id FROM group_permission INNER JOIN user_groups ON

Oracle - no function with name X exists in this scope

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The function is clearly there, because I can navigate to it using SQL Developer and it compiles all fine, but when I try to use the function with or without "call", it throws: Error(36,24): PLS-00222: no function with name 'x' exists in this scope This is how the function looks like: create or replace function testfunction ( somevalue in varchar2 ) return varchar2 AS cursor testcursor IS select column1, column2 from table1 t where t.column1 = somevalue; testcursorrec testcursor %rowtype; messaget VARCHAR2(500); begin open testcursor ; fetch