Getting incorrect week while using Calendar class
when i ran the following file , I am getting the incorrect results.
import java.util.*;
public class Week
public static void main( String args[] ) throws Exception
//String sdate = "30-DEC-2006";
String sdate = "31-DEC-2006";
String sdate1 = "01-JAN-2007";
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd-MMM-yyyy");
java.util.Date dt = sdf.parse(sdate);
java.util.Date dt1 = sdf.parse(sdate1);
Calendar calendar = Calendar.getInstance();
calendar.setFirstDayOfWeek(Calendar.SUNDAY);
calendar.setMinimalDaysInFirstWeek(7);
calendar.setTime(dt);
System.out.println("Week of year for 31-DEC-2006 is : =>"+calendar.get(Calendar.WEEK_OF_YEAR));
calendar.setTime(dt1);
System.out.println("Week of year for 01-JAN-2007 is : =>"+calendar.get(Calendar.WEEK_OF_YEAR));
output:
Week of year for 31-DEC-2006 is : =>53
Week of year for 01-JAN-2007 is : =>53
Can anyone tell me how to fix this issues.
Thanks
Did you listen about documentation? It takes about one minute to find followed:
For example, a specific Calendar subclass may designate the week before week 1 of a year as week n of the previous year.
You should spend few minutes more to find how to fix it.
Similar Messages
-
Getting incorrect values while using getLineMetrics()
following e.g. finding x position of word "Adobe flex".
if container of TextArea is not scaled then its giving
correct value
but after doing zoomin/zoomout its giving incorrect value
Plz help me to figure out this.
Thanks
Kaushal
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private function onClick():void{
cnvs.scaleX = cnvs.scaleY = 1;
cnvs.validateNow();
var obj:TextLineMetrics = ta.getLineMetrics(0);
lbl.text = "X: " + String(obj.x);
private function onZoom(val:Number):void{
cnvs.scaleX = cnvs.scaleY += (0.25 * val);
]]>
</mx:Script>
<mx:Button x="75" y="285" label="Find X"
click="onClick()"/>
<mx:Canvas x="75" y="10" width="382" height="201"
id="cnvs">
<mx:TextArea x="4" y="46" color="#000000" id="ta"
borderStyle="none" textDecoration="underline" text="adobe
flex"
fontSize="28" width="361" height="54" textAlign="center"/>
</mx:Canvas>
<mx:Button x="75" y="219" label="-"
click="onZoom(-1)"/>
<mx:Button x="123" y="219" label="+"
click="onZoom(1)"/>
<mx:Label x="159" y="287" text="" fontSize="13"
fontWeight="bold"
id="lbl"/>
</mx:Application>Yes number of pages are correct even though the values are different
If I drilldown these reports for week 04.2008 09.2008 by Sales office only and add the totals in Excel to double check then they are more or less the same. Then I drilldown by Sales Office, ASM, Week & Sub Trade Channel. Then export this into excel and add the totals to double check but then I get totally different amounts as to what they are supposed to be.
Please waiting for help
Thanks
S
Edited by: Shiva on Mar 6, 2008 12:52 PM -
On MacBook Pro unable to print webpage; I get a single blank page. But I can print using Safari. Started last week while using Firefox 3.6. I downloaded Firefox 5.0--same problem.
I am now able to do live broadcasts with my i-sight, but my original problem still exisits....
Unsolved Problem:I need to be able to broadcast from CamTwist as CamTwist is the only program that will allow me to do what I need to do. Justin.tv and Ustream.tv do not recognize CamTwist for reasons I can not explain. -
Getting Error while using CallTarget class
I am getting following error while using the CallTarget.
"Exception in thread "main" java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Ant.init(Ant.java:147)
at org.apache.tools.ant.taskdefs.CallTarget.init(CallTarget.java:85)
at org.apache.tools.ant.taskdefs.CallTarget.setTarget(CallTarget.java:150
at AntCallTarget.main(AntCallTarget.java:7)"
Can anyone please help me solve this problem.
The code where i am getting this error is
CallTarget antCall = new CallTarget();
antCall.setTarget("Main");I am getting following error while using the CallTarget.
"Exception in thread "main" java.lang.NullPointerException
at org.apache.tools.ant.taskdefs.Ant.init(Ant.java:147)
at org.apache.tools.ant.taskdefs.CallTarget.init(CallTarget.java:85)
at org.apache.tools.ant.taskdefs.CallTarget.setTarget(CallTarget.java:150
at AntCallTarget.main(AntCallTarget.java:7)"
Can anyone please help me solve this problem.
The code where i am getting this error is
CallTarget antCall = new CallTarget();
antCall.setTarget("Main"); -
Hi all,
can anybody help me for developing a program using Calendar class.what i am trying to do is
I have javascript calendar file. daily working hours in perticular project (user give input).
when i am selecting whole week days can i get total of weekly working hours and total in the next page or same page.
please help me. I am strucking here
thanks®ards
VijayaDo you want a Java program, or a JavaScript program. Java != JavaScript
-
Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
code I have used:
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "";
Also I have used,
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "ou=ibmgroups,o=ibm.com";
But in both cases I am getting value for Total groups as 0.
Code Reference:
* memberof.java
* December 2004
* Sample JNDI application to determine what groups a user belongs to
import java.util.Hashtable;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
public class memberof {
public static void main (String[] args) {
Hashtable env = new Hashtable();
String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
String adminPassword = "XXXXXXX";
String ldapURL = "ldap://mydc.antipodes.com:389";
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials, note using simple cleartext authentication
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
//Create the initial directory context
LdapContext ctx = new InitialLdapContext(env,null);
//Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
//Specify the Base for the search
String searchBase = "DC=antipodes,DC=com";
//initialize counter to total the group members
int totalResults = 0;
//Specify the attributes to return
String returnedAtts[]={"memberOf"};
searchCtls.setReturningAttributes(returnedAtts);
//Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
System.out.println(">>>" + sr.getName());
//Print out the groups
Attributes attrs = sr.getAttributes();
if (attrs != null) {
try {
for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("Attribute: " + attr.getID());
for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
System.out.println(" " + totalResults + ". " + e.next());
catch (NamingException e) {
System.err.println("Problem listing membership: " + e);
System.out.println("Total groups: " + totalResults);
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
Any help will be highly appreciated.Not able to get group name by using memberof class, getting Total groups as 0 even I am member of that group. Through this memberof class I am trying to find full qualified name(DN) of my group.
code I have used:
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "";
Also I have used,
String searchFilter = "(&(objectClass=user)(CN=Username))";
//Specify the Base for the search
String searchBase = "ou=ibmgroups,o=ibm.com";
But in both cases I am getting value for Total groups as 0.
Code Reference:
* memberof.java
* December 2004
* Sample JNDI application to determine what groups a user belongs to
import java.util.Hashtable;
import javax.naming.*;
import javax.naming.ldap.*;
import javax.naming.directory.*;
public class memberof {
public static void main (String[] args) {
Hashtable env = new Hashtable();
String adminName = "CN=Administrator,CN=Users,DC=ANTIPODES,DC=COM";
String adminPassword = "XXXXXXX";
String ldapURL = "ldap://mydc.antipodes.com:389";
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
//set security credentials, note using simple cleartext authentication
env.put(Context.SECURITY_AUTHENTICATION,"simple");
env.put(Context.SECURITY_PRINCIPAL,adminName);
env.put(Context.SECURITY_CREDENTIALS,adminPassword);
//connect to my domain controller
env.put(Context.PROVIDER_URL,ldapURL);
try {
//Create the initial directory context
LdapContext ctx = new InitialLdapContext(env,null);
//Create the search controls
SearchControls searchCtls = new SearchControls();
//Specify the search scope
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
//specify the LDAP search filter
String searchFilter = "(&(objectClass=user)(CN=Andrew Anderson))";
//Specify the Base for the search
String searchBase = "DC=antipodes,DC=com";
//initialize counter to total the group members
int totalResults = 0;
//Specify the attributes to return
String returnedAtts[]={"memberOf"};
searchCtls.setReturningAttributes(returnedAtts);
//Search for objects using the filter
NamingEnumeration answer = ctx.search(searchBase, searchFilter, searchCtls);
//Loop through the search results
while (answer.hasMoreElements()) {
SearchResult sr = (SearchResult)answer.next();
System.out.println(">>>" + sr.getName());
//Print out the groups
Attributes attrs = sr.getAttributes();
if (attrs != null) {
try {
for (NamingEnumeration ae = attrs.getAll();ae.hasMore();) {
Attribute attr = (Attribute)ae.next();
System.out.println("Attribute: " + attr.getID());
for (NamingEnumeration e = attr.getAll();e.hasMore();totalResults++) {
System.out.println(" " + totalResults + ". " + e.next());
catch (NamingException e) {
System.err.println("Problem listing membership: " + e);
System.out.println("Total groups: " + totalResults);
ctx.close();
catch (NamingException e) {
System.err.println("Problem searching directory: " + e);
Any help will be highly appreciated. -
How to get default values while using the transaction "BP"
Hi Group,
I have a query on how to get default values while using the transaction <b>BP</b>?
The thing is:
when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
how can I achieve this?
So please kindly let me know the procedure to achieve this.
Thanks & Regards,
Vishnu.Hi,
The events of BDT can be used to default some fields on creating a partner.
For this create a function module for ISDAT. attach that event in BUS7.
In the ISDAT funtion modulethe following code should be used.
For example to set the nationality:
I_BUSDEFAULT-NATIO = 'DE.
CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
EXPORTING
i_busdefault = I_BUSDEFAULT
Regards, Smita. -
My iphone get's hanged while using facebook,what to do???
my iphone get's hanged while using facebook,what to do???
What buttons did you try? IF you haven't already, try a reset, no data loss.
Hold down the home/sleep button together until you see the Apple logo and then release, then wait for the phone to boot back up. -
i was using ios 7.0.3 nd it was working very nice but before some days i got an update 7.0.4 nd i updated and now my iphone is getting switch off while using nd restarts..???? what to do
Sorry you cannot go back to previous version once your are updated to the latest iOS version.
Apple prevents downgrading your phone. -
My iPhone 5 gets really hot while using it.. its only my 2nd day with it is this normal?
I had same issue, apple give me a new phone, they say it might be software problem, but the 2nd phone has fast drain too, I took it to apple , they restored my phone as new, and iCloud backed up my contact. I thought about the whole thing, I used to sync it to my window, but this time I synced it with my Mac. 87% at 3:30pm. I think that window has bugs. It is not my iPhone 5's problem. After all those stressful days.
-
From the day I bought it I realized the phone heats up after a little use. It gets really hot while using Wifi and downloading. Anyone else having these issues? What's the solution to this?
Your VGA is definitely corrupted and it is irreparable, so just make the HP to change your vga.
Also next time read my post on how to keep your laptop cool to avoid same issues again.
I assume your laptop was pretty hot during some time and that's the result you've got.
Make it easier for other people to find solutions, by marking my answer with 'Accept as Solution', if it solves your problem.
Click on the BLUE KUDOS button on the left to say "Thanks" -
My iPhone gets really hot while using YouTube. Is/has anyone else experienced this? Should I be concerned?I did a search and only came up with threads talking about the phone getting warm while charging, my phone does not get hot/warm while charging, only when using YouTube and sometimes while using Safari. Any input will be greatly appreciated!
When connected via WiFi or EDGE or no difference.
My iPhone sometimes gets considerable warm when connected via EDGE with low reception but this is rare when connected via WiFi or with good reception. -
Not getting PO printed while using bursting pls help
Hi All,
Working on converting PO report to XML. While using bursting to print the pdf file the document is not sent to the printer..
But in the output file of the "XML Publisher Report Bursting Program" getting success.
Not sure why report output is not sent to the printer.
Pls help......
Thanks
Rajesh
Edited by: Badsha on Jun 17, 2010 2:19 AMHi...Please check the Burst Control file with the printer & IP details.
Look for the file below.
<?xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
<xapi:globalData location="stream">
</xapi:globalData >
<xapi:request select="/DATA/LIST_DEPT/DEPT/LIST_EMPLOYEE/EMPLOYEE">
<xapi:delivery>
<xapi:email server="${EMAIL_SERVER}" port="${EMAIL_PORT}"
from="${FROM_EMAIL_ADDRESS}"
reply-to ="${REPL_TO_ADDRESS}">
<xapi:message id="email1" to="${TO_EMAIL_ADDRESS}" cc="${CC_EMAIL_ADDRESS}"
attachment="true" content-type="html/text"
subject="Employee Report for Empno ${EMPNO}">
Dear ${ENAME}, Please review the attached document.</xapi:message>
</xapi:email>
<xapi:filesystem id="file1"
output="C:\burst\sample\${EMPNO}_${ENAME}_${MGR}_PRINT.pdf"/>
<xapi:print id="print1" printer="${PRINT_URL}" copies="2"
orientation-requested="3" />
</xapi:delivery>
<xapi:document key="${EMPNO}"
output-type="pdf" delivery="email1">
<xapi:template type="rtf" location="${TEMPLATE_LOC}"
filter=".//EMPLOYEE[DEL_CHANNEL='EMAIL']" >
</xapi:template>
</xapi:document>
<xapi:document key="${EMPNO}" output-type="pdf" delivery="print1">
<xapi:template type="rtf" location="${TEMPLATE_LOC}"
filter=".//EMPLOYEE[DEL_CHANNEL='PRINT']" >
</xapi:template>
</xapi:document>
<xapi:document key="${EMPNO}" output-type="pdf" delivery="file1">
<xapi:template type="rtf" location="${TEMPLATE_LOC}"
filter=".//EMPLOYEE[DEL_CHANNEL='FILE_SYSTEM']" >
</xapi:template>
</xapi:document>
</xapi:request>
</xapi:requestset>
check the printers setting as required....aslo check what printer you are using for pdf printing...Pasta Printing??
Thanks
Ratnesh -
How can I get HD quality while using my iSight on my MBP?
Hey Folks.
Im interested in knowing a little more information regarding the isight cam... I want to get HD quality while video chatting with family & friends on skype & iChat. Please let me know.
I know that there are other webcams that have HD capabilities.
http://www.huehd.com/
http://benchmarkreviews.com/index.php?option=com_content&task=view&id=98&Itemid= 1
http://digitalurban.blogspot.com/2008/11/tutorial-torch-webcam-hd-timelapse.html
http://www.logitech.com/index.cfm/webcam_communications/webcams/devices/4528&cl= us,en
Let me know.
Thanks.
-JoeyYes.
I have a web cam that can do 1.3Mp
This App can get those that Can, to Display (And Display Only) the native format of the camera.
iMovie is likely to be able to see it as it can handle Camcorder feeds.
The difference you see in iMovie to iChat is the difference.
iChat, MSN (If connected via a Exchange Server to do Video), Yahoo (Vid only no Audio) and Skype on the IM apps use 640 X 480 or in Skype's case less.
Photo Booth seems to use the same as iChat to allow for the Composition tweaks (It uses the same Quartz files in the Compositions Folder)
By eye Comic Life that came bundled with some Intels also seems to use 640 X 480
So to an extent it depends what you are going to use the camera for.
iGlasses is a cross app Add-On that can "improve" and tweak the picture in various applications such as iChat outside of what the OS and Application Software have commonly set as Defaults.
the Adjustments tend to be within the scope set up by the manufacturer (i.e. allowing colour, white balance and Contrast and other settings the camera may have been designed for but not in the app settings)
Quicktime Pro, if you have it, can be set in Preferences > Recording to "Device Native" which tends to allow a sort of in-between iChat and iGlasses control (some features but not all) but will work with iGlasses as well.
It is restricted to a 4:3 format window though but this would apply to most Web cams anyway.
10:38 AM Saturday; May 2, 2009 -
Function module equivalent to SWE_EVENT_CREATE while using ABAP classes
Hi there,
I used to use SWE_CREATE_EVENT to fire the events linked to my BOR objects, in order to start certain workflows.
Now I am using ABAP classes within the WorkFlows, and the name of the classes MUST (in my case) be longer than 10 characters, and SWE_EVENT_CREATE is cutting the name so it does not work
Do you know any FM equivalent to start an event from a ABAP class (SE24) object?
I have tried to use SAP_WAPI_START_WORKFLOW, but I cannot find the way to include my object in the container. Any ideas on this point would be welcome as well
Thanks so much,
MiguelThanks for such a quick reply,
You were right. I actually did follow Jocelyn's blogs, but somehow I skipped the raising event section.
Just for information, the URL with the solution to this problem is:
/people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow
Have a good one
Maybe you are looking for
-
How do I get the music back on my iPhone after manually deleting it from the device (to get space for photos/videos)? I can sync with iTunes but it doesn't copy these songs back, even though they still appear in my iTunes library. I can click on th
-
How to open a PDF file using forms 9i
Hi guys!!! Could you please help me with this? Using the webutil library, i've found the function FILE_OPEN_DIALOG which yes, it is like windows' dialog box, but it doesn't open the specific file. If i have the PDF software, and a pdf file, and i use
-
128 bit encryption requirement not working
Using S1 6.0 sp5 on solaris 8, connecting to WAS 4.5 application servers. The require 128 bit encryption setting is in obj.conf with an error page to serve if lower than 128 bit encryption is used. This works fine for all plain text html requests, ho
-
10.4.7 can't open dmg files
Not only that: Protools 7.1.1 doesn't launch any more. Nor does Reason 3.0.5. Please help!!! MacBook Pro 1.83 Mac OS X (10.4.6) OS X in spanish
-
Macbook pro 2011 screen doesn't dim all the way in part of the screen
Hi, all-- This is really puzzling me so I hope someone can help me out. My Macbook Pro 13 inch (2011, Sept.) screen, when you dim it about halfway or less, shows something like a yellowish splotch in the middle of the screen, the size of around 4 qua