首页 \ 问答 \ 如何与其他开发人员共享Java项目?(How to share Java project with other developers? [closed])

如何与其他开发人员共享Java项目?(How to share Java project with other developers? [closed])

我正在与一个协作者一起开发一个Java项目,我们都在使用Eclipse编辑器。 我想要做的是能够与他共享.java文件,以便我们可以单独编辑它,但看看对方写了什么。 目前,我这样做是通过共享包含项目的Dropbox文件夹的一种临时方式。 但是,这种方法效果不佳,因为他使用的是不同版本的Java(因为他在使用Windows时运行Mac)。 对于我来运行项目,我必须清除他创建的所有.class文件,这些文件将出现在我的计算机上,因为Dropbox只是共享所有文件。

我听说CVS是管理开发人员之间文件共享的一种方式,但听起来好像很多工作。 我不知道如何获得CVS服务器或如何使其工作。 是否有一种简单直接的方法使我们能够在同一个Java项目上一起工作? GitHub是答案吗?


I am working on a Java project together with a collaborator, and we are both using the Eclipse editor. What I want to do is to be able to share the .java files with him so that we can both edit it separately but see what has the other has written. Currently, I am doing this is an ad-hoc way by sharing a Dropbox folder that contains the project. However, this approach does not work well because he is using a different version of Java (as he runs a Mac while I am using Windows). For me to run the project, I would have to clear all the .class files that he has created which will appear on my computer since Dropbox just shares all the files.

I have heard of CVS as a way to manage file sharing among developers, but it sounds like a lot of work. I don't know for example how to get a CVS server or what to do to get it to work. Is there an easy and straightforward way to enable us to work together on the same Java project? Is GitHub the answer?


原文:https://stackoverflow.com/questions/11510415
更新时间:2021-09-08 21:09

最满意答案

如果将它分成以下任务应该很容易:

  • 使用Row Generator方法生成两个给定日期之间的所有日期,如下所示。
  • 忽略周末的日期,即周六和周日
  • 检查范围中的日期是否与假日表中的任何匹配项。

以下行生成器查询将为您提供工作日总计数 ,即包括星期六和星期日

SQL> WITH dates AS
  2    (SELECT to_date('01/01/2014', 'DD/MM/YYYY') date1,
  3      to_date('31/12/2014', 'DD/MM/YYYY') date2
  4    FROM dual
  5    )
  6  SELECT SUM(weekday) weekday_count
  7  FROM
  8    (SELECT
  9      CASE
 10        WHEN TO_CHAR(date1+LEVEL-1, 'DY','NLS_DATE_LANGUAGE=AMERICAN')
 11             NOT IN ('SAT', 'SUN')
 12        THEN 1
 13        ELSE 0
 14      END weekday
 15    FROM dates
 16      CONNECT BY LEVEL <= date2-date1+1
 17    )
 18  /

WEEKDAY_COUNT
-------------
          261

SQL>

现在,基于上面的行生成器查询,让我们看一个测试用例。

以下查询将计算2014年1月1日 至2014年12月31日之间的工作日数,不包括表中提到的假日。

WITH子句仅用于表格,在您的情况下,您只需使用您的假期表

SQL> WITH dates
  2       AS (SELECT To_date('01/01/2014', 'DD/MM/YYYY') date1,
  3                  To_date('31/12/2014', 'DD/MM/YYYY') date2
  4           FROM   dual),
  5       holidays
  6       AS (SELECT To_date('12.06.2011', 'DD.MM.YYYY') holiday FROM   dual UNION ALL
  7           SELECT To_date('19.06.2014', 'DD.MM.YYYY') holiday FROM   dual UNION ALL
  8           SELECT To_date('09.05.2013', 'DD.MM.YYYY') holiday FROM   dual),
  9       count_of_weekdays
 10       AS (SELECT SUM(weekday) weekday_count
 11           FROM   (SELECT CASE
 12                            WHEN To_char(date1 + LEVEL - 1, 'DY',
 13                                 'NLS_DATE_LANGUAGE=AMERICAN')
 14                                 NOT IN (
 15                                 'SAT',
 16                                 'SUN' ) THEN 1
 17                            ELSE 0
 18                          END weekday
 19                   FROM   dates
 20                   CONNECT BY LEVEL <= date2 - date1 + 1)),
 21       count_of_holidays
 22       AS (SELECT Count(*) holiday_count
 23           FROM   holidays
 24           WHERE  holiday NOT BETWEEN To_date('01/01/2015', 'DD/MM/YYYY') AND
 25                                      To_date('31/03/2015', 'DD/MM/YYYY'))
 26  SELECT weekday_count - holiday_count as working_day_count
 27  FROM   count_of_weekdays,
 28         count_of_holidays
 29  /

WORKING_DAY_COUNT
-----------------
              258

SQL>

平日共有261个 ,其中假期表中3个假期 。 因此,输出中的工作日总数为261 - 3 = 258


It should be easy if you divide it into following tasks:

  • Generate all the dates between the two given dates using Row Generator method as shown here.
  • Ignore the dates which are weekend, i.e. Saturdays and Sundays
  • Check whether the dates in the range are having any match in the holiday table.

The following row generator query will give you the total count of weekdays, i.e. not including Saturdays and Sundays:

SQL> WITH dates AS
  2    (SELECT to_date('01/01/2014', 'DD/MM/YYYY') date1,
  3      to_date('31/12/2014', 'DD/MM/YYYY') date2
  4    FROM dual
  5    )
  6  SELECT SUM(weekday) weekday_count
  7  FROM
  8    (SELECT
  9      CASE
 10        WHEN TO_CHAR(date1+LEVEL-1, 'DY','NLS_DATE_LANGUAGE=AMERICAN')
 11             NOT IN ('SAT', 'SUN')
 12        THEN 1
 13        ELSE 0
 14      END weekday
 15    FROM dates
 16      CONNECT BY LEVEL <= date2-date1+1
 17    )
 18  /

WEEKDAY_COUNT
-------------
          261

SQL>

Now, based on above row generator query, let's see a test case.

The following query will calculate the count of working days between 1st Jan 2014 and 31st Dec 2014 excluding the holidays as mentioned in the table.

The WITH clause is only to use it as tables, in your case you can simply use your holiday table.

SQL> WITH dates
  2       AS (SELECT To_date('01/01/2014', 'DD/MM/YYYY') date1,
  3                  To_date('31/12/2014', 'DD/MM/YYYY') date2
  4           FROM   dual),
  5       holidays
  6       AS (SELECT To_date('12.06.2011', 'DD.MM.YYYY') holiday FROM   dual UNION ALL
  7           SELECT To_date('19.06.2014', 'DD.MM.YYYY') holiday FROM   dual UNION ALL
  8           SELECT To_date('09.05.2013', 'DD.MM.YYYY') holiday FROM   dual),
  9       count_of_weekdays
 10       AS (SELECT SUM(weekday) weekday_count
 11           FROM   (SELECT CASE
 12                            WHEN To_char(date1 + LEVEL - 1, 'DY',
 13                                 'NLS_DATE_LANGUAGE=AMERICAN')
 14                                 NOT IN (
 15                                 'SAT',
 16                                 'SUN' ) THEN 1
 17                            ELSE 0
 18                          END weekday
 19                   FROM   dates
 20                   CONNECT BY LEVEL <= date2 - date1 + 1)),
 21       count_of_holidays
 22       AS (SELECT Count(*) holiday_count
 23           FROM   holidays
 24           WHERE  holiday NOT BETWEEN To_date('01/01/2015', 'DD/MM/YYYY') AND
 25                                      To_date('31/03/2015', 'DD/MM/YYYY'))
 26  SELECT weekday_count - holiday_count as working_day_count
 27  FROM   count_of_weekdays,
 28         count_of_holidays
 29  /

WORKING_DAY_COUNT
-----------------
              258

SQL>

There were total 261 weekdays, out of which there were 3 holidays in holiday table. So, total count of working days in the output is 261 - 3 = 258.

相关问答

更多
  • 左外连接用left join,右外连接用right join语句。 比如 Oracle: select * from a, b where a.id=b.id(+) SQL: select * from a left join b on a.id=b.id 反过来a.id(+)=b.id 就是right join
  • 由于grade是一个数字,因此您需要将其转换为字符,以便它适合R1和R2 。 CASE WHEN grade = 0 THEN 'R2' WHEN grade = -1 THEN 'R1' ELSE to_char(grade) END AS "Grade level" Since grade is a number, you need to convert it to a character so it'll fit with R1 and R2. CASE WHEN grade = 0 THEN 'R ...
  • 你可以使用regex_like WHERE REGEXP_LIKE (CUSTOMER_ADDRESS , '^[A-Z]'); You could use regex_like WHERE REGEXP_LIKE (CUSTOMER_ADDRESS , '^[A-Z]');
  • 这是一种方式: SELECT LEAST(COALESCE(DATE_1, DATE_2, DATE_3), COALESCE(DATE_2, DATE_1, DATE_3), COALESCE(DATE_3, DATE_2, DATE_1) ) FROM MYTABLE Here is one way: SELECT LEAST(COALESCE(DATE_1, DATE_2, DATE_3), COA ...
  • 如果将它分成以下任务应该很容易: 使用Row Generator方法生成两个给定日期之间的所有日期,如下所示。 忽略周末的日期,即周六和周日 检查范围中的日期是否与假日表中的任何匹配项。 以下行生成器查询将为您提供工作日的总计数 ,即不包括星期六和星期日 : SQL> WITH dates AS 2 (SELECT to_date('01/01/2014', 'DD/MM/YYYY') date1, 3 to_date('31/12/2014', 'DD/MM/YYYY') date ...
  • 假设column1为NOT NULL您可以使用: SELECT DISTINCT t.column1 FROM table_name t WHERE t.column1 NOT IN (SELECT column1 FROM table_name WHERE column2 = 'apple'); LiveDemo 要获取所有列和行, DISTINCT t.column1更改为* 。 Assuming that ...
  • 您具有日期/时间参数DATEFIRST ,并且您希望选择DateCalled值不超过3个工作日之前DATEFIRST的行 。 我将其解释为意味着这些是您希望为每个参数值设置的最新日期... DATEFIRST 3 workdays previous --------------- ------------------- Mon, 01/28/2013 Wed, 01/23/2013 Tue, 01/29/2013 Thu, 01/24/2013 Wed, 01/30/2013 ...
  • 理念: SQL Server代理运行作业 第一步是“检查假期” 代码抛出错误 工作步骤默默地失败 要点3:要从存储过程到SQL Server代理获取错误,请使用RAISERROR ... IF EXISTS (SELECT * FROM Holidays WHERE Date = GETDATE()) RAISERROR ('Do nothing: relax: chill out', 16, 1); ... 要点4:在这种情况下,使用“退出成功”(1)将@on_fail_action参数添加到sp ...
  • 尝试这个: SELECT evnt.event_id, evnt.date_from, evnt.date_to, DATEDIFF(DD, evnt.date_from, evnt.date_to) - (DATEDIFF(WK, evnt.date_from, evnt.date_to) * 2) - CASE WHEN DATEPART(DW, evnt.date_from) = 1 THEN 1 ELSE 0 END + CASE WHEN DATEPART ...
  • 如果您决定坚持使用INSERTs ,则可以通过使用约束(无论是主键还是唯一键)来阻止重复行的插入。 如果它碰巧违反了一个唯一的约束,那么你的脚本就会停止,并且你必须对先前插入所做的所有更改进行回滚(除非你已经提交了所有这些更改)。 要处理该异常,您可以编写类似的pls / sql块。 declare l_unique_exception exception; pragma exception_init(l_unique_exception, -1); begin insert into test ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。