Slackdemic
Replies to this thread:
More by Slackdemic
What people are reading
Subscribers
Please log in to subscribe to Slackdemic's postings.
:: Subscribe
|
[Please view other pages to see the rest of the postings. Total posts: 37]
[VIEWED 20855
TIMES]
|
SAVE! for ease of future access.
|
|
The postings in this thread span 2 pages, go to PAGE 1.
This page is only showing last 20 replies
|
|
Slackdemic
Please log in to subscribe to Slackdemic's postings.
Posted on 09-28-06 6:38
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Any serious Java people in here? For some reasons, the following code doesn't work for leap year. Any help/suggestion is appreciated. The classes are Date and TestDate: public void addMonth(int m) { month = month + m; if (month>12) { month-=12; addYear(1); } } public boolean isLeap(int y) { if (y%100==0) { if (y%400==0) return true; else return false; } else if (y%4==0) return true; return false; } public void addDay(int d) { day = day + 1; if (day>28) { if (month==2) { if (isLeap(year)) { if (day>29) { day-=29; addMonth(1); return; } else return; } day-=28; addMonth(1); } else if ((month==4||month==6||month==9||month==11)&&day>30) { day-=30; addMonth(1); } else if (day>31) { day-=31; addMonth(1); } } } public void addYear(int y) { { year += y; if (month==2) if (day==29) if (!isLeap(year)) { setMonth(3); setDay(1); } } } public String toString() { String d=""+day,m=""+month,y=""+year; if (d.length()<2) d="0"+d; if (m.length()<2) m="0"+m; while (y.length()<4) y="0"+y; return m + "/"+ d + "/" + y; //return the value of } //concatenated month, day, and year }
|
|
|
The postings in this thread span 2 pages, go to PAGE 1.
This page is only showing last 20 replies
|
|
lootekukur
Please log in to subscribe to lootekukur's postings.
Posted on 09-28-06 10:58
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
| |
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:14 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
lootekukur
Please log in to subscribe to lootekukur's postings.
Posted on 09-28-06 11:03
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:11 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
sajhauser
Please log in to subscribe to sajhauser's postings.
Posted on 09-28-06 11:25
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:09 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
anonymous
Please log in to subscribe to anonymous's postings.
Posted on 09-29-06 12:09
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:12 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
Gajedi
Please log in to subscribe to Gajedi's postings.
Posted on 09-29-06 12:15
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
the best way to check for the leap year is to use the simple date format class in java. Read the documentation, its pretty straight forward.
|
|
|
Slackdemic
Please log in to subscribe to Slackdemic's postings.
Posted on 09-29-06 11:50
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Lootekukur, I copied and pasted your logic; it didn't work. (And, it looks correct to me when I just see the code. I didn't take C or C++ before taking this class; although, if/else doesn't ruin my present life, it greatly confuses me time and again.) Here's what I said about leap year: 1. Anything divisible by 4 is leap year. 2. BUT if it is not leap year if it is divisible by 100. 3. It is leap year if it is divisible by 100 and 400. If you omit "if" after BUT, I think it gives sense. You wrote this: 1. Anything divisible by 4 is leap year. -----NO 2. BUT if it is not leap year if it is divisible by 100. 3. It is leap year if it is divisible by 100 and 400. I think you are incorrect in #1. Something that is divisible by 4 IS leap year UNLESS it is also divisible by 100! To sum up all three #s: Anything divisible by 4 IS leap year UNLESS it is NOT divisible by 100. BUT, it IS leap year if it is divisible by 100 AND 400. Sajhauser, I juxtaposed the code I had with the code you claimed it was mine; and which really was, and I got more mixed up. This is what I just did. if (y % 4 ==0 && y % 100 != 0 || y%100 == 0 && y % 400 == 0) return true; else return false; Do you all buy it that logic? Let me know!
|
|
|
lootekukur
Please log in to subscribe to lootekukur's postings.
Posted on 09-29-06 12:00
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Slack, i don't understand, why you are having a tough time with the logic. it's pretty straightforward. anyways, you can either use the nested loop (that i coded) or one or two if statements. it's all up to you. I think you are incorrect in #1. Something that is divisible by 4 IS leap year UNLESS it is also divisible by 100! that is exactly what i said ONLY if you had read my last post clearly. see what i wrote: 1) is not sufficient....if a year is divisible by 4, it should NOT be divisible by 100 or if it is divisible by 100 then it should be by 400 AS WELL.. NOW that you have understood the logic, WHY your code still not right? if (y % 4 ==0 && y % 100 != 0 || y%100 == 0 && y % 400 == 0) return true; else return false; Either use the nested loop logic that i coded in my last post or use this: if( year%4==0&&year%!=100)|| if( year%4==0&&year%100==0&&year%400==0) return 1; else return 0;
|
|
|
lootekukur
Please log in to subscribe to lootekukur's postings.
Posted on 09-29-06 12:03
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
sorry about the typo (it's been a while since i last used C hehe) if((year%4==0&&year%!=100)|| (year%4==0&&year%100==0&&year%400==0)) return 1; else return 0; either use this, or the nested loop one and see the output. LooTe
|
|
|
sajhauser
Please log in to subscribe to sajhauser's postings.
Posted on 09-29-06 12:12
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
slack, I just pointed out your mistake. you had the nested loop in, but, the logic was wrong... I think you're not listening with an open mind. too much of hw??? have some patience....it's the best tool for sucess in programming :D
|
|
|
batuwa
Please log in to subscribe to batuwa's postings.
Posted on 09-29-06 1:11
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Slack, I had done this leap thing in C.... I hope the following code help you understand the LOGIC. I don't think you have to care about Julian or Gregorial calender, which creates even more confusion... but third section if if/else may help you... good luck! if ((inputYear >= -46) && (inputYear <= -1)) { inputYear = (-1*inputYear); printf("\nYou entered %d BCE",inputYear); if ((inputYear % 4) == 0) printf("\n\nThe year %d BCE is a leap year in Julian Calender.",inputYear); else printf("\n\nThe year %d BCE is not a leap year in Julian Calender.",inputYear); } else if ((inputYear >= 1) && (inputYear <= 1752)) { printf("\nYou entered %d CE",inputYear); if ((inputYear % 4) == 0) printf("\n\nThe year %d CE is a leap year in Julian Calender.",inputYear); else printf("\n\nThe year %d CE is not a leap year in Julian Calender.",inputYear); } else if (inputYear >= 1753 && inputYear <= 4000) { printf("\n\nYou entered %d CE",inputYear); if ((inputYear % 4) == 0) { if ((inputYear % 100) == 0) { if ((inputYear % 400) == 0) printf("\n\nThe year %d CE is a leap year in Gregorian Calender.",inputYear); else printf("\n\nThe year %d CE is not a leap year in Gregorian Calender.",inputYear); } else if ((inputYear % 100) != 0) printf("\n\nThe year %d CE is a leap year in Gregorian Calender.",inputYear); } else printf("\n\nThe year %d CE is not a leap year in Gregorian Calender.",inputYear); } else if (inputYear <= - 47) { printf("You entered %d BCE",inputYear); printf("\n\nThe year %d BCE is below the valid range",inputYear); } else { printf("You entered %d CE",inputYear); printf("\n\nThe year %d CE is above the valid range",inputYear); }
|
|
|
batuwa
Please log in to subscribe to batuwa's postings.
Posted on 09-29-06 1:14
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
jeez.. indent screwed up when I posted it, which makes it harder to read if/else statements.
|
|
|
Slackdemic
Please log in to subscribe to Slackdemic's postings.
Posted on 09-29-06 6:33
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I did submit with the last logic I put here, i.e. if (y % 4 ==0 && y % 100 != 0 || y%100 == 0 && y % 400 == 0) return true; else return false; Still, some of my friends are still not happy with my logic...
|
|
|
Slackdemic
Please log in to subscribe to Slackdemic's postings.
Posted on 09-29-06 6:54
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Sajhauser, looking back what I did, and what you told I was wrong; I think, the conditions are well met. It had worked for the program and it gave right output for ever date I checked. However, I ended up using this code: if (y % 4 ==0 && y % 100 != 0 || y%100 == 0 && y % 400 == 0) return true; else return false; Not that I can change my codes back, but let me know if you still think it is incorrect:
|
|
|
lootekukur
Please log in to subscribe to lootekukur's postings.
Posted on 09-29-06 8:09
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
slack, i wrote the code BASED on the definition from the link given by sajhauser. --so what I coded is right--"&&" has higher precedence than "||", so one can remove the brackets. I kept it SO THAT you understand what i was doing, it's NOT wrong syntatically to have more brackets, of course one can remove it if/when he gets the logic. --what you coded also turns out to be correct! Tell you what? You need NOT even check if a year is divisible by 100, if it is divisible by 400. coz anything divisible by 400 must also be divisible by 100. Look at this. This is perhaps the most terse and effective one. if (y % 4 ==0 && y % 100 != 0 || y % 400 == 0) return true; else return false; One request slack. when you post questions in sajha, you have to be open minded and be ready to learn what others suggest rather than having prejudice about them due to their nicks and other stuffs. THis is a virtual world my friend, you never know who is who in reality ;). Secondly programming needs a lot of practice and patience. I am sure you are hardworking, but what i saw (at least from this thread) is you are bit too impatient at times. No body is born perfect. You've got to practice to hone your skills. Please take this as a compliment from your elder brother. Good luck and have fun programming! LooTe
|
|
|
Slackdemic
Please log in to subscribe to Slackdemic's postings.
Posted on 09-29-06 8:53
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Yes, I also think (y % 4 ==0 && y % 100 != 0 || y % 400 == 0) is the most concised form to code the definition of leap year. "One request slack. when you post questions in sajha, you have to be open minded and be ready to learn what others suggest rather than having prejudice about them due to their nicks and other stuffs. THis is a virtual world my friend, you never know who is who in reality ;)." I am truly sorry if somebody was offended by my being what you called closed minded. I overlooked sajhauser's definition of leap year that s/he found on some website, because that was they very website I had refrenced to code the program. I did not or do not have prejuidice about you either, I was simply saying that my code was not wrong. I had successfully tested it and had it worked fine. I think I am sure that there are really good programmers in Sajha, and for that very reason I used this platform hoping that somebody would help me. And, I am not a good programmer myself. While one can tell me a computer guy, I do not have specific programming background. I "touched" the computer for the first time only about 6 years ago. And, what's more, Java is my very first programming class (and without C or C++, and which are pre-requisite for this class). Even the people who are into C and C++ can be of great help to me. It's all good, though. I am just thankful to you all who tried to help me out. :)
|
|
|
sajhauser
Please log in to subscribe to sajhauser's postings.
Posted on 09-30-06 1:16
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:08 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
thapap
Please log in to subscribe to thapap's postings.
Posted on 09-30-06 9:48
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
sajhauser, programming expert po hunu hudho rahechha....... loote... u r dog with brain (O: LOL....
|
|
|
sajhauser
Please log in to subscribe to sajhauser's postings.
Posted on 09-30-06 10:59
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
|
Error Occurred While Processing Request
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
The following information is meant for the website developer for debugging purposes. |
Error Occurred While Processing Request |
Datasource spradhan-sajhadb could not be found. | | | The error occurred in D:\inetpub\ramjham\fixunicode\fixunicode.cfm: line 5 | 3 : </cfquery> 4 : <cfif getthread.recordcount eq 0>error<cfelse> 5 : <cfoutput>#getthread.threadname#</cfoutput></cfif><cfelseif isdefined("url.articleid")><cfquery username="spradha_sanman" password="sajhasql" name="getthread" datasource="spradhan-sajhadb" dbtype="ODBC"> 6 : select message from tblarticles where articleid = '#url.articleid#' 7 : </cfquery> | | DATASOURCE | spradhan-sajhadb | | Resources: | Browser | ColdFusion | Remote Address | 74.86.124.120 | Referrer | | Date/Time | 19-Nov-09 03:07 AM | | Stack Trace | at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5) java.sql.SQLException: Datasource spradhan-sajhadb could not be found.
at coldfusion.sql.DataSrcImpl.validate(DataSrcImpl.java:95)
at coldfusion.sql.SqlImpl.validate(SqlImpl.java:279)
at coldfusion.tagext.sql.QueryTag.doStartTag(QueryTag.java:467)
at cffixunicode2ecfm1866134693.runPage(D:\inetpub\ramjham\fixunicode\fixunicode.cfm:5)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74)
at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)
at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)
at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
at coldfusion.CfmServlet.service(CfmServlet.java:175)
at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
| |
|
|
thapap
Please log in to subscribe to thapap's postings.
Posted on 10-03-06 4:04
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
sajhauser, hajur ta ma bhandha thulo hola ni ta tesaile hajur bhaneko ni... "as a respect" of age and knowlege kya... testo khatra programmer sanga daraunu parena ta.. pheri.. katra program lekhera malai mutate garaidiyo bhane ta tension hunchha ni ta )O:
|
|
|
sajhauser
Please log in to subscribe to sajhauser's postings.
Posted on 10-03-06 4:52
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
chyaaa please thapap...hehehehe...if you don't stop it, i'll also start calling you thapap ji hajur :P and that wasn't such a khatra program ke... but i do mutate people without having to write programs :P
|
|
Please Log in! to be able to reply! If you don't have a login, please register here.
YOU CAN ALSO
IN ORDER TO POST!
Within last 90 days
Recommended Popular Threads |
Controvertial Threads |
TPS Re-registration case still pending .. |
Toilet paper or water? |
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants |
I hope all the fake Nepali refugee get deported |
From Trump “I will revoke TPS, and deport them back to their country.” |
Tourist Visa - Seeking Suggestions and Guidance |
advanced parole |
Sajha Poll: Who is your favorite Nepali actress? |
ढ्याउ गर्दा दसैँको खसी गनाउच |
To Sajha admin |
Problems of Nepalese students in US |
Mamta kafle bhatt is still missing |
अरुणिमाले दोस्रो पोई भेट्टाइछिन् |
Are Nepalese cheapstakes? |
Nepali Psycho |
MAGA denaturalization proposal!! |
How to Retrieve a Copy of Domestic Violence Complaint??? |
wanna be ruled by stupid or an Idiot ? |
Those who are in TPS, what’s your backup plan? |
All the Qatar ailines from Nepal canceled to USA |
|
|
NOTE: The opinions
here represent the opinions of the individual posters, and not of Sajha.com.
It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address
if you want any posting to be considered for deletion. Your request will be
handled on a one to one basis. Sajha.com is a service please don't abuse it.
- Thanks.