Deleting bits in a int
how do u remove bits from within a int, i wnat to remove the first 8 bits.
thanks,
kelvin
I used your above code however it doesnt work, i used it in the following way:
System.out.println("old combined code: " +convertCode(totalBitLen,combinedCodes));
totalBitLen-=8;
combinedCodes<<=8;
System.out.println("new combined code: "+ convertCode(totalBitLen,combinedCodes));the code for convertCode is as followes:
public String convertCode(int bitLen, int bitCode)
//This is used to convertthe integer representation of the code into binary representation
int displayMask = 1 << (bitLen-1);
StringBuffer buf = new StringBuffer(bitLen);
for (int c =1; c<=bitLen; c++)
buf.append((bitCode & displayMask) ==0?'0':'1');
bitCode<<=1;
return(buf.toString());
}im using the convertCode method just so i can see if its working. If i use <<= it returns a 1 when there is suppose to be a 0.
any ideas,
thansk for your help,
kelvin
Similar Messages
-
Waiting for file redraws after deleting bits of audio
I keep looking in the prefs for something to alleviate this.
This being, that if I have a big audio file loaded (hundreds to over a gig in size)
and as I'm editing it (going along and deleting sections) most of the time I have to wait a while for the darn waveform to redraw itself.
Sometimes it doesn't do this, less often though, and I'm clueless as to why it behaves this way.
I used to use Peak on my old OS9 machine and it never did this (probably because it always referenced the actual file)
Why does STP do this? Is there a way to not get the waveform to redraw whenever I want to delete a bit of audio?
ThanksGerald,
your will run into an error during the event afterOpen if there are no documents open and you want to adress the being opened document with
app.activeDocument.
You better adress it with
app.documents[0].
But - funny - if there is already a document opened, then app.documents[0] won't adress the new document (which is opened and calls the event afterOpen), but the old document which has been active before.
So you will have to adress the document which gets opened with
app.documents[-1].
(excuse my english)
Martin -
what the max number of bits you can have in a integer????
thanks,
kelvinthanks for some daft reason i thought it was 8, yet another school boy error.
thanks,
kelvin -
Casting int to a byte -- retreiving the lowest 8 bits
Yo, thought i'd try to open up some debate on this topic. I wrote a data feed that needed to grab the lower 8 bits out of an int, so i wrote what i believed to be the standard way of doing this, which was effectively
public static byte intToByte( int c ) {
return (byte) (c & 0xff);
}A colleague looking through my code asked whether the & 0xff was necessary, and did i believe that there was any value of c for which it made a difference, as he believed that this was equivalent to just
return (byte)c; My immediate thought was worrying about byte in java being signed, and having data screwed up, so i ran some tests.. and on every value i tried (byte)c is indeed equivalent to (byte)( c & 0xff ).
My argument was to be that (byte)( c & 0xFF ); is great code to read as a maintainer, because it;'s immediately obvious that you are strictly interested in the lowest 8 bits of the int, and nothing else is of importance, and a simple (byte)c; can look naive and make every developer looking at the code for the first time think it's incorrect.
However, i knew his comeback would be that the datafeed has an overriding need for speed, so i ran some tests comparing the repeated operation of (byte)c to (byte)(c & 0xff ) over a range of 100,000 numbers (test repeated several times to obviate startup times). It turned out that doing the & 0xff added about 30% to execution time on my machine (java 1.5 on WinXP). That's quite a severe penalty for a very common operation! I think i'm going to change the code to cast straight to a byte and leave a big comment beforehand explaining how it's equivalent to (byte)(c & 0xff );
This got me wondering how it was implemented in the core java libraries though, since OutputStream has a method to write a byte that actually takes an int parameter. How does this work? Most of the lowest level OutputStream implementations seem to end up going to native to do this (understandably), so i dug out ByteArrayOutputStream. This class does optimise away the & 0xFF and is roughly
public synchronized void write(int b) {
�
buf[count] = (byte)b;
�
}No problems with that, so writing to these babies will be fast. But then i started wondering about the methods of DataOutputStream, which is heavily used by use for serialising (a great deal of) internal data flow. Unfortunately in this class there are a lot of redundant & 0xFFs:
public final void writeShort(int v) throws IOException {
out.write((v >>> 8) & 0xFF);
out.write((v >>> 0) & 0xFF);
incCount(2);
public final void writeInt(int v) throws IOException {
out.write((v >>> 24) & 0xFF);
out.write((v >>> 16) & 0xFF);
out.write((v >>> 8) & 0xFF);
out.write((v >>> 0) & 0xFF);
incCount(4);
}[The v >>> 0 seems to be optimised out at runtime and i get no execution time difference between ( v >>> 0) & 0xff that and ( v & 0xff ) so i got no problems with that]
which again seems ok on inspection because the code looks tidy and clean and easy to understand, but i need to hit these things very heavily so would rather they were 30% faster than easy to read. Interestingly they've taken an entirely different approach for writing out a long value:
public final void writeLong(long v) throws IOException {
writeBuffer[0] = (byte)(v >>> 56);
writeBuffer[1] = (byte)(v >>> 48);
writeBuffer[2] = (byte)(v >>> 40);
writeBuffer[3] = (byte)(v >>> 32);
writeBuffer[4] = (byte)(v >>> 24);
writeBuffer[5] = (byte)(v >>> 16);
writeBuffer[6] = (byte)(v >>> 8);
writeBuffer[7] = (byte)(v >>> 0);
out.write(writeBuffer, 0, 8);
incCount(8);
}both using a private buffer field for the writing before squirting it all out, and not bothering to mask the lower 8 bits. It seems strange that writeLong appears optimised, but writeInt and writeShort are not.
What does everyone else think? Are there any other heavy users of DataOutputStream out there that would rather have things written faster? I guess i'm going to be writing my own version of DataOutputStream in the meantime, because we're writing so much data over these and i'm in an industry where milliseconds matter.To my knowledge, in your situation, the & 0xFF is not necessary. I believe that the most common use of the mask in this case is actually to treat the lower 8 bits as an unsigned integer. For example:
int value = 65530;
int anotherValue = value & 0xFF; // anotherValue == 250Anyway, the case space is small enough that I just brute forced your problem. Under v1.5.0_07 on Linux, (byte)i and (btye)(i & 0xFF) are definitely the same:
for (int i=Integer.MIN_VALUE;i<Integer.MAX_VALUE;i++)
byte a = (byte)i;
byte b = (byte)(i & 0xFF);
if (a!=b) System.out.println(i);
byte a = (byte)(Integer.MAX_VALUE);
byte b = (byte)(Integer.MAX_VALUE & 0xFF);
if (a!=b) System.out.println(Integer.MAX_VALUE);Perhaps the & 0xFF was in response to some older bug or other behavior. -
SQL Query with a little bit more complicated WHERE clause performance issue
Hello, I have some performance issue in this case:
Very simplified query:
SELECT COUNT(*) FROM Items
WHERE
ConditionA OR
ConditionB OR
ConditionC OR ...
Simply I have to determine how many Items the user has access through some complicated conditions.
When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only
10 Items from 100,000.
How can I improve the performace in this "Get my items" case?
Additional information:
the query is generated by EF 6.1
MS SQL 2012 Express
Here is the main part of the real SQL Execution Plan:Can you post table/index DDL? Query?
Sample query:
exec sp_executesql N'SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[Tickets] AS [Extent1]
LEFT OUTER JOIN [dbo].[Services] AS [Extent2] ON [Extent1].[ServiceId] = [Extent2].[Id]
WHERE (@p__linq__0 = 1) OR ([Extent1].[SubmitterKey] = @p__linq__1) OR ([Extent1].[OperatorKey] = @p__linq__2) OR (([Extent1].[OperatorKey] IS NULL) AND (@p__linq__2 IS NULL)) OR ([Extent1].[SolverKey] = @p__linq__3) OR (([Extent1].[SolverKey] IS NULL) AND (@p__linq__3 IS NULL)) OR ([Extent1].[Incident2ndLineSupportKey] = @p__linq__4) OR (([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (@p__linq__4 IS NULL)) OR ((@p__linq__5 = 1) AND ((1 = CAST( [Extent1].[TicketType] AS int)) OR ((@p__linq__6 = 1) AND (((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[IncidentManager] = @p__linq__7) OR (([Extent2].[IncidentManager] IS NULL) AND (@p__linq__7 IS NULL)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ServiceRequestManager] = @p__linq__8) OR (([Extent2].[ServiceRequestManager] IS NULL) AND (@p__linq__8 IS NULL)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ProblemManager] = @p__linq__9) OR (([Extent2].[ProblemManager] IS NULL) AND (@p__linq__9 IS NULL)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ChangeManager] = @p__linq__10) OR (([Extent2].[ChangeManager] IS NULL) AND (@p__linq__10 IS NULL)))))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceDeputyManagers] AS [Extent3]
WHERE ([Extent1].[ServiceId] = [Extent3].[ServiceId]) AND ( CAST( [Extent3].[TicketType] AS int) = CAST( [Extent1].[TicketType] AS int)) AND ([Extent3].[UserProviderKey] = @p__linq__11)
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[Incident1stLineSupportLimitedAccess] <> cast(1 as bit))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ServiceRequestLimitedAccess] <> cast(1 as bit))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND ([Extent2].[ProblemLimitedAccess] <> cast(1 as bit))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ChangeLimitedAccess] <> cast(1 as bit))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent4]
WHERE ([Extent1].[ServiceId] = [Extent4].[ServiceId]) AND (2 = CAST( [Extent4].[TicketType] AS int)) AND ([Extent4].[UserProviderKey] = @p__linq__12) AND (1 = [Extent4].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent5]
WHERE ([Extent5].[UserProviderKey] = @p__linq__13) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent6]
WHERE ([Extent6].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent6].[TicketType] AS int)) AND (1 = [Extent6].[SupportLine]) AND ([Extent6].[OperatorGroupId] = [Extent5].[OperatorGroupId])
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent1].[IncidentFunctionEscalatedTo2ndLineSupport] = 1) AND ([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (([Extent2].[Incident2ndLineSupportLimitedAccess] <> cast(1 as bit)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent7]
WHERE ([Extent1].[ServiceId] = [Extent7].[ServiceId]) AND (2 = CAST( [Extent7].[TicketType] AS int)) AND ([Extent7].[UserProviderKey] = @p__linq__14) AND (2 = [Extent7].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent8]
WHERE ([Extent8].[UserProviderKey] = @p__linq__15) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent9]
WHERE ([Extent9].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent9].[TicketType] AS int)) AND (2 = [Extent9].[SupportLine]) AND ([Extent9].[OperatorGroupId] = [Extent8].[OperatorGroupId])
)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = CAST( [Extent1].[TicketState] AS int)) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent10]
WHERE ([Extent1].[ServiceId] = [Extent10].[ServiceId]) AND (3 = CAST( [Extent10].[TicketType] AS int)) AND ([Extent10].[UserProviderKey] = @p__linq__16)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent11]
WHERE ([Extent11].[UserProviderKey] = @p__linq__17) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent12]
WHERE ([Extent12].[ServiceId] = [Extent1].[ServiceId]) AND (3 = CAST( [Extent12].[TicketType] AS int)) AND ([Extent12].[OperatorGroupId] = [Extent11].[OperatorGroupId])
)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent13]
WHERE ([Extent1].[ServiceId] = [Extent13].[ServiceId]) AND (4 = CAST( [Extent13].[TicketType] AS int)) AND ([Extent13].[UserProviderKey] = @p__linq__18)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent14]
WHERE ([Extent14].[UserProviderKey] = @p__linq__19) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent15]
WHERE ([Extent15].[ServiceId] = [Extent1].[ServiceId]) AND (4 = CAST( [Extent15].[TicketType] AS int)) AND ([Extent15].[OperatorGroupId] = [Extent14].[OperatorGroupId])
)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent16]
WHERE ([Extent1].[ServiceId] = [Extent16].[ServiceId]) AND (5 = CAST( [Extent16].[TicketType] AS int)) AND ([Extent16].[UserProviderKey] = @p__linq__20)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent17]
WHERE ([Extent17].[UserProviderKey] = @p__linq__21) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent18]
WHERE ([Extent18].[ServiceId] = [Extent1].[ServiceId]) AND (5 = CAST( [Extent18].[TicketType] AS int)) AND ([Extent18].[OperatorGroupId] = [Extent17].[OperatorGroupId])
)))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[TicketInvitations] AS [Extent19]
WHERE ([Extent19].[TicketId] = [Extent1].[Id]) AND (([Extent19].[InvitedUserProviderKey] = @p__linq__22) OR (([Extent19].[InvitedUserProviderKey] IS NULL) AND (@p__linq__22 IS NULL)))
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent20].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent20]
WHERE ([Extent20].[UserProviderKey] = @p__linq__23) AND ([Extent20].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent21].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent21]
WHERE [Extent21].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect1]
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent22].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent22]
WHERE ([Extent22].[UserProviderKey] = @p__linq__24) AND ([Extent22].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent23].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent23]
WHERE [Extent23].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect2]
) AS [GroupBy1]',N'@p__linq__0 bit,@p__linq__1 varchar(8000),@p__linq__2 varchar(8000),@p__linq__3 varchar(8000),@p__linq__4 varchar(8000),@p__linq__5 bit,@p__linq__6 bit,@p__linq__7 varchar(8000),@p__linq__8 varchar(8000),@p__linq__9 varchar(8000),@p__linq__10 varchar(8000),@p__linq__11 varchar(8000),@p__linq__12 varchar(8000),@p__linq__13 varchar(8000),@p__linq__14 varchar(8000),@p__linq__15 varchar(8000),@p__linq__16 varchar(8000),@p__linq__17 varchar(8000),@p__linq__18 varchar(8000),@p__linq__19 varchar(8000),@p__linq__20 varchar(8000),@p__linq__21 varchar(8000),@p__linq__22 varchar(8000),@p__linq__23 varchar(8000),@p__linq__24 varchar(8000)',@p__linq__0=0,@p__linq__1='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__2='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__3='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__4='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__5=1,@p__linq__6=0,@p__linq__7='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__8='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__9='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__10='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__11='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__12='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__13='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__14='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__15='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__16='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__17='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__18='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__19='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__20='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__21='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__22='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__23='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__24='31555851-b89d-4a15-bb05-5a6fd42f9552'
Generated DDL for related tables: (indexes are primary on PKs and FKs)
CREATE TABLE [dbo].[CustomerUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[CustomerId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.CustomerUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[InternalGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[InternalGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[InternalGroupId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.InternalGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[OperatorGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[OperatorGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[OperatorGroupId] [int] NOT NULL,
CONSTRAINT [PK_dbo.OperatorGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceDeputyManagers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceDeputyManagers](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceDeputyManagers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceOperatorGroups] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceOperatorGroups](
[ServiceId] [int] NOT NULL,
[OperatorGroupId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperatorGroups] PRIMARY KEY CLUSTERED
[ServiceId] ASC,
[OperatorGroupId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ServiceOperators] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceOperators](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperators] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Services] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Services](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[Name] [nvarchar](256) NOT NULL,
[Description] [nvarchar](max) NULL,
[Disabled] [bit] NOT NULL,
[NewTicketLimitedAccess] [bit] NOT NULL,
[Incident1stLineSupportLimitedAccess] [bit] NOT NULL,
[Incident2ndLineSupportLimitedAccess] [bit] NOT NULL,
[ServiceRequestLimitedAccess] [bit] NOT NULL,
[ProblemLimitedAccess] [bit] NOT NULL,
[ServiceRequestManager] [varchar](184) NOT NULL,
[IncidentManager] [varchar](184) NOT NULL,
[ProblemManager] [varchar](184) NOT NULL,
[Deleted] [bit] NOT NULL,
[WfDisableIncidentAssignedState] [bit] NOT NULL,
[WfDisableIncidentConfirmedState] [bit] NOT NULL,
[WfDisableIncidentTakeFromQueueAction] [bit] NOT NULL,
[WfDisableIncidentFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestAssignedState] [bit] NOT NULL,
[WfDisableServiceRequestConfirmedState] [bit] NOT NULL,
[WfDisableServiceRequestTakeFromQueueAction] [bit] NOT NULL,
[WfDisableServiceRequestFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestPostponeAction] [bit] NOT NULL,
[ChangeLimitedAccess] [bit] NOT NULL,
[ChangeManager] [varchar](184) NOT NULL,
[WfDisableChangeTakeFromQueueAction] [bit] NOT NULL,
[WfDisableChangeAssignedState] [bit] NOT NULL,
[WfDisableChangeStartPreparationAction] [bit] NOT NULL,
[IsDepartment] [bit] NOT NULL,
[InheritsFromDepartment] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForIncidents] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForServiceRequests] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForProblems] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForChanges] [bit] NOT NULL,
[AllowAccessToOtherOperatorsIncidents] [bit] NOT NULL,
[AllowAccessToOtherOperatorsServiceRequests] [bit] NOT NULL,
[AllowAccessToOtherOperatorsProblems] [bit] NOT NULL,
[AllowAccessToOtherOperatorsChanges] [bit] NOT NULL,
[AllowChangeDeadlineForIncidents] [bit] NOT NULL,
[AllowChangeDeadlineForServiceRequests] [bit] NOT NULL,
[AllowChangeDeadlineForProblems] [bit] NOT NULL,
[AllowChangeDeadlineForChanges] [bit] NOT NULL,
[AllowSelectPriorityForServiceRequests] [bit] NOT NULL,
[WfDisableIncidentCompletedState] [bit] NOT NULL,
[WfDoIncidentCompleteActionBySubmittersMessage] [bit] NOT NULL,
[WfDisableServiceRequestCompletedState] [bit] NOT NULL,
[WfDoServiceRequestCompleteActionBySubmittersMessage] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Services] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[TicketInvitations] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TicketInvitations](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TicketId] [int] NOT NULL,
[InitiatorUserProviderKey] [varchar](184) NULL,
[InitiatorFullName] [nvarchar](max) NULL,
[InvitedUserProviderKey] [varchar](184) NULL,
[InvitedFullName] [nvarchar](max) NULL,
[Type] [int] NOT NULL,
[CreatedUTC] [datetime] NOT NULL,
CONSTRAINT [PK_dbo.TicketInvitations] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Tickets] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tickets](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[ServiceId] [int] NULL,
[ServiceMailboxId] [int] NULL,
[TicketTypeValue] [int] NOT NULL,
[TicketTypeIdREF] [int] NOT NULL,
[SubmitterKey] [varchar](184) NOT NULL,
[SubmitterFullName] [nvarchar](256) NULL,
[CustomerId] [int] NULL,
[SolverKey] [varchar](184) NULL,
[SolverFullName] [nvarchar](256) NULL,
[Subject] [nvarchar](max) NULL,
[CreatedUTC] [datetime] NOT NULL,
[Archived] [bit] NOT NULL,
[MarkedAsSolvedUTC] [datetime] NULL,
[ArchivedUTC] [datetime] NULL,
[TicketSourceValue] [int] NOT NULL,
[OperatorKey] [varchar](184) NULL,
[DeadlineUTC] [datetime] NULL,
[DeadlineLastNotificatedPercentage] [int] NULL,
[UrgencyValue] [int] NULL,
[ImpactValue] [int] NULL,
[PriorityValue] [int] NULL,
[TicketStateValue] [int] NOT NULL,
[IncidentFunctionEscalatedTo2ndLineSupport] [bit] NOT NULL,
[Incident2ndLineSupportKey] [varchar](184) NULL,
[Incident2ndLineSupportFullName] [nvarchar](max) NULL,
[TicketType] [int] NOT NULL,
[Source] [int] NOT NULL,
[TicketState] [int] NOT NULL,
[Urgency] [int] NULL,
[Impact] [int] NULL,
[TicketSummaryState] [int] NOT NULL,
[ResolutionText] [nvarchar](max) NULL,
[ResolutionModifiedUTC] [datetime] NULL,
[ResolutionEdited] [bit] NOT NULL,
[ResolutionUserProviderKey] [varchar](184) NULL,
[ResolutionFullName] [nvarchar](max) NULL,
[TicketSubType] [int] NULL,
[ChangeRiskProbabilityValue] [int] NULL,
[ChangeImpactValue] [int] NULL,
[ChangeRiskCategoryValue] [int] NULL,
[RfcText] [nvarchar](max) NULL,
[RfcModifiedUTC] [datetime] NULL,
[RfcEdited] [bit] NOT NULL,
[RfcUserProviderKey] [varchar](184) NULL,
[RfcFullName] [nvarchar](max) NULL,
[ManualDeadline] [bit] NOT NULL,
[ContactInformation] [nvarchar](256) NULL,
[Imported] [bit] NOT NULL,
[ForceClosed] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Tickets] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[CustomerUsers]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_InternalGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_InternalGroupId] ON [dbo].[InternalGroupUsers]
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[OperatorGroupUsers]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceDeputyManagers]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[ServiceOperatorGroups]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperatorGroups]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperators]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Services]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_TicketId] ON [dbo].[TicketInvitations]
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_TicketInvitations_InvitedUserProviderKey_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_TicketInvitations_InvitedUserProviderKey_TicketId] ON [dbo].[TicketInvitations]
[InvitedUserProviderKey] ASC,
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[Tickets]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Tickets]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[Tickets]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceMailboxId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceMailboxId] ON [dbo].[Tickets]
[ServiceMailboxId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverFullName] ON [dbo].[Tickets]
[SolverFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverKey] ON [dbo].[Tickets]
[SolverKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterFullName] ON [dbo].[Tickets]
[SubmitterFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterKey] ON [dbo].[Tickets]
[SubmitterKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_Tickets_TicketType_TicketTypeIdREF] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Tickets_TicketType_TicketTypeIdREF] ON [dbo].[Tickets]
[TicketType] ASC,
[TicketTypeIdREF] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CustomerUsers] CHECK CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[InternalGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId] FOREIGN KEY([InternalGroupId])
REFERENCES [dbo].[InternalGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternalGroupUsers] CHECK CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId]
GO
ALTER TABLE [dbo].[OperatorGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OperatorGroupUsers] CHECK CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] CHECK CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperators] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperators] CHECK CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Services] WITH CHECK ADD CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Services] CHECK CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId]
GO
ALTER TABLE [dbo].[TicketInvitations] WITH CHECK ADD CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId] FOREIGN KEY([TicketId])
REFERENCES [dbo].[Tickets] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[TicketInvitations] CHECK CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId] FOREIGN KEY([ServiceMailboxId])
REFERENCES [dbo].[ServiceMailboxes] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Tickets] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId]
GO -
How can I convert a 64 bits of binary to 56 bits by deleting bits number 8,16, 24 ,..., 64.
ThanksWell one way you may approach this problem would be to convert the 64 bits to a char array. Let's say:
char[] bits;
Imagine that this array has a total of 64 elements (one for each bit; a nought or a one). You could then do a loop from 0 to 63 (as the first array element is [0]). You would have a loop and a string where you put the 56 bits one by one. Concatenating them to the string as you go. In the loop there will be a conditional statement making sure that the current bit isn't a multipul of 8 (because that's the pattern your example seems to show. For example:
// The main output string
String the56Bits = "";
for(int i = 0; i < 64; i++)
if((i < 7) || ((i + 1) % 8) != 0)
the56Bits += bits;
// the 56 bits is now stored in the stirng variable 'the56Bits' -
How to delete the fist 10 recods from a table ? The problem is real.
Hi,
the code below shows that deleting a records using a cursor works well, if your table is out of a environment, but if you are using a environment the things goes different. Please help me, what i am doing wrong ?
This code is the most clean code i now to do.
// THE CODE (BEGIN).
// BDBTEST.cpp : Clean code.
#include "X:\include\berkeleydb\db_cxx.h"
#define DWORD unsigned long int
#define UINT unsigned int
#define DB_ENV_PATH "Z:\\Test"
#define DB_FULL_NAME "Z:\\Test\\Test.db"
typedef struct STRTEST
DWORD dwID;
char caTxt[64];
} strTest;
// Functions.
int compare_int ( Db *dbp,
const Dbt *a,
const Dbt *b);
void Save();
void Load();
void DeleteAll();
// Global variables.
DbEnv *g_penvDbEnv;
Db *g_pdbTest;
Dbc *g_pdbcCursor;
Dbt g_dbtTestKey;
Dbt g_dbtTestData;
UINT g_ui32ENVOpenFlags;
char g_caError[256];
int g_iResult;
// Main function.
int main(int argc, char* argv[])
g_penvDbEnv = NULL;
g_pdbTest = NULL;
// First we run without environment (NO ERROR USING g_pdbcCursor->Del(0)).
remove(DB_FULL_NAME);
Save();
Load();
DeleteAll();
Load();
// Now we run with environment ("Dbc::del: Invalid argument" (err_ = 22) - ERROR USING g_pdbcCursor->Del(0)).
try
g_penvDbEnv = new DbEnv(0);
if(g_penvDbEnv == NULL)
return 0;
catch(DbException &e)
sprintf(g_caError, "ERRO -> DSDBBD: %s\n", e.what());
return 0;
// Set the normal flags for a transactional subsystem. Note that
// we DO NOT specify DB_RECOVER.
g_ui32ENVOpenFlags = DB_CREATE | // If the environment does not exist, create it.
DB_INIT_LOCK | // Initialize locking.
DB_INIT_LOG | // Initialize logging.
DB_INIT_MPOOL | // Initialize the cache.
DB_THREAD | // Free-thread the env handle.
DB_INIT_TXN; // Initialize transactions.
// Open/Create environment.
try
// Environment settings.
g_iResult = g_penvDbEnv->set_encrypt("1234", DB_ENCRYPT_AES);
g_iResult = g_penvDbEnv->set_lg_bsize (1024 * 256); // LOG MEMORY FILE MAX SIZE.
g_iResult = g_penvDbEnv->set_cachesize(0, 1024 * 512, 0);
g_iResult = g_penvDbEnv->set_flags (DB_AUTO_COMMIT, 1);
g_iResult = g_penvDbEnv->set_flags (DB_LOG_AUTOREMOVE, 1);
g_iResult = g_penvDbEnv->set_lg_max (1025 * 1024); // LOG FILE MAX SIZE.
// Open the environment with full transactional support.
g_iResult = g_penvDbEnv->open(DB_ENV_PATH, g_ui32ENVOpenFlags, 0);
catch(DbException &e)
sprintf(g_caError, "ERRO -> DSDBBD: %s\n", e.what());
return 0;
remove(DB_FULL_NAME);
Save();
Load();
DeleteAll(); // Error goes here.
Load();
g_penvDbEnv->close(0);
delete g_penvDbEnv;
g_penvDbEnv = NULL;
return 0;
void Save()
int i;
int iResult;
DWORD dwID;
strTest sttTest;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
dwID = 1;
for(i=0;i<100;i++)
sttTest.dwID = dwID;
sprintf(sttTest.caTxt, "ID = %04u", sttTest.dwID);
g_dbtTestKey .set_data((void*) &sttTest.dwID);
g_dbtTestKey .set_size(sizeof(DWORD));
g_dbtTestData .set_data((void*) &sttTest);
g_dbtTestData .set_size(sizeof(sttTest));
iResult = g_pdbTest->put(0, &g_dbtTestKey, &g_dbtTestData, DB_NOOVERWRITE);
dwID++;
g_pdbTest->sync(0);
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
void Load()
strTest *psttTest;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
// Get a cursor
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_pdbcCursor->close();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
void DeleteAll()
strTest *psttTest;
try
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
// Get a cursor
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_iResult = g_pdbcCursor->del(0);
catch (DbException &dbe)
sprintf(g_caError,
"%s",
dbe.what());
g_pdbcCursor->close();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
int compare_int(Db dbp, const Dbt a, const Dbt *b)
int iReturn;
DWORD dwKey1;
DWORD dwKey2;
dwKey1 = 0;
dwKey2 = 0;
iReturn = 0;
dwKey1 = *((DWORD*) a->get_data());
dwKey2 = *((DWORD*) b->get_data());
if(dwKey1 > dwKey2)
iReturn = 1;
else
if(dwKey1 < dwKey2)
iReturn = -1;
return iReturn;
// THE CODE (END).
Thanks,
DelNetoHi all
I solved it. No documentation about it, but the solution is to use transaction.
Just use this DeleteAll function that all works fine.
void DeleteAll()
strTest *psttTest;
DbTxn *pTxn;
try
pTxn = NULL;
g_pdbTest = NULL;
if(g_penvDbEnv == NULL)
g_pdbTest = new Db(NULL, 0);
else
g_pdbTest = new Db(g_penvDbEnv, 0);
// Setting databases flags (Just use with environment).
g_pdbTest ->set_flags(DB_CHKSUM | DB_ENCRYPT);
if(g_penvDbEnv == NULL)
g_pdbTest ->set_encrypt("1234", DB_ENCRYPT_AES);
g_pdbTest->set_bt_compare(compare_int);
g_iResult = g_pdbTest->open(NULL, DB_FULL_NAME, NULL, DB_BTREE, DB_CREATE | DB_THREAD, 0);
if(g_penvDbEnv == NULL)
g_pdbTest->cursor(NULL, &g_pdbcCursor, 0);
else
// Get a cursor.
g_penvDbEnv->txn_begin(NULL, &pTxn, 0);
g_pdbTest->cursor(pTxn, &g_pdbcCursor, 0);
// Iterate over the database, retrieving each record in turn.
while((g_iResult = g_pdbcCursor->get(&g_dbtTestKey, &g_dbtTestData, DB_NEXT)) == 0)
// Get temp struct.
psttTest = (strTest*) g_dbtTestData.get_data();
g_iResult = g_pdbcCursor->del(0);
g_pdbcCursor->close();
if(g_penvDbEnv != NULL)
pTxn->commit(0);
catch (DbException &dbe)
sprintf(g_caError,
"%s",
dbe.what());
g_pdbcCursor->close();
if(g_penvDbEnv != NULL)
pTxn->abort();
g_pdbTest->close(0);
delete g_pdbTest;
g_pdbTest = NULL;
Thanks to all readers,
DelNeto -
I Need Help In Deleting Table row by clicking on "Delete" button inside the
Dear all,
first i'm new to Swing
i have created table with customized table model, i fill this table using 2d array, this table rows contains JButtons rendered using ButtonRenderer.java class and action listeners attached by the AbstractButtonEditor.java
what iam trying to do is when i click on a specified button in table row i want this row to be deleted, i found some examples that uses defaultTableModelRef.removeRow(index), but iam using customized table model and the following is my code
JTable tblPreview = new JTable();
DbExpFormTableModel model = new DbExpFormTableModel();
tblPreview.setModel(model);
//adding the edit button
tblPreview.getColumn("Edit").setCellRenderer(new ButtonRenderer());
tblPreview.getColumn("Edit").setCellEditor(new AbstractButtonEditor(new JCheckBox()));
//adding the delete button
tblPreview.getColumn("Delete").setCellRenderer(new ButtonRenderer());
tblPreview.getColumn("Delete").setCellEditor(new AbstractButtonEditor(new JCheckBox()));
and here is the code of the code of my customized table model ( DbExpFormTableModel )
public class DbExpFormTableModel extends GeneralTableModel
public DbExpFormTableModel()
setColumnsNames();
fillTable();
private void setColumnsNames()
columnNames = new String [5];
columnNames[0] = "ID";
columnNames[1] = "Database ID";
columnNames[2] = "Prestatement";
columnNames[3] = "Edit";
columnNames[4] = "Delete";
private void fillTable()
int numOfRows = 2; // = getNumberOfRows();
data = new Object[numOfRows][5];
data[0][0] = "1"; //we must get this value from the database, it is incremental identity
data[0][1] = "AAA";
data[0][2] = "insert into table 1 values(? , ? , ?)";
data[0][3] = "Edit";
data[0][4] = "Del";
data[1][0] = "2"; //we must get this value from the database, it is incremental identity
data[1][1] = "BBB";
data[1][2] = "insert into table2 values(? , ? , ? , ?)";
data[1][3] = "Edit";
data[1][4] = "Del";
and this is the GeneralTableModel class
public class GeneralTableModel extends AbstractTableModel implements Serializable
public static Object [][] data;
public static String[] columnNames;
//these functions should be implemented to fill the grid
public int getRowCount()
return data.length;
public int getColumnCount()
return columnNames.length;
public String getColumnName(int col)
return columnNames[col];
public Object getValueAt(int row , int col)
return data[row][col];
//i've implemented this function to enable events on added buttons
public boolean isCellEditable(int rowIndex, int columnIndex)
return true;
public Class getColumnClass(int c)
return getValueAt(0, c).getClass();
public void setValueAt(Object value, int row, int col)
//fireTableDataChanged();
data[row][col] = value;
fireTableCellUpdated(row, col);
And Now what i want to do is to delete the clicked row from the table, so please help me...
thank you in advanceHi Sureshkumar,
1. Create a value attribute named <b>select</b> of type boolean.
2. Bind the <b>checked property</b> of all the checkboxes to this attribute.
3. Create an action called <b>click</b> and bind it to <b>OnAction</b> event of the button(whose click will check all the checkboxes) and write this code in that action.
<b>wdContext.currentContextElement().setSelect(true);</b>
Warm Regards,
Murtuza -
How do I delete duplicate emails in Mail 6.2?
I imported emails from thunderbird, realising I have hundreds of duplicates. Have you any idea how to remove duplicates in Mail 6.2? I tried Mail Scripts but they are not working with Mac OS 10.8.
Thanks!Are the duplicates in the same directory? One way to do this would be to use a UNIX shell script, which could compare each of the email files, identify duplicates and delete them.
If you are feeling adventurous, there is a thread in a forum (http://forums.devshed.com/unix-help-35/bash-script-to-find-and-get-rid-of-duplic ate-files-184849.html) that has a pretty interesting looking script at the end. It does and md5 sum on each file (which should always be the same for identical emails), and then deletes the second file. (Actually the deleteing bit is commented out, it just prints what it would do if you remove the '#' before the "rm".
The principle looks good - but I cannot vouch for it at all!
Cheers,
Rodney
p.s. PLEASE back up before trying anything. -
Hi everyone!
I have a question about bit shifting. When I attempt to shift 32 bit on a int value, the output is the same value. It doesn't matter if I try to make a rigth or left shifting. It also hapend when I make 64 bit shifting on a long value. I supposed it should be 0. This is the code I'm woking with:
int x = 2147483647;
System.out.println("Output1 = " + (x >> 32));
System.out.println("Output2 = " + (x << 32));
Output:
Output1 = 2147483647
Output2 = 2147483647
Could someone help me to understand why this happend?
Thanks in advance.GerSua wrote:
Hi everyone!
I have a question about bit shifting. When I attempt to shift 32 bit on a int value, the output is the same value. It doesn't matter if I try to make a rigth or left shifting. It also hapend when I make 64 bit shifting on a long value. I supposed it should be 0. This is the code I'm woking with:
int x = 2147483647;
System.out.println("Output1 = " + (x >> 32));
System.out.println("Output2 = " + (x << 32));
Output:
Output1 = 2147483647
Output2 = 2147483647
Could someone help me to understand why this happend?
Thanks in advance.It is supposed to work this way. I know that's not alot of info, but you have not discovered a bug or anything like that. -
Delete only the child object and not the parent object
Hi,
I have the below code:-
TAnswer
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "question_id", nullable = false)
// @Cascade(value=CascadeType.ALL)
public TQuestion getTQuestion() {
return this.TQuestion;
} TQuestion
@OneToMany(fetch = FetchType.LAZY, mappedBy = "TQuestion", orphanRemoval = true)
@Cascade(value=CascadeType.ALL)
/*@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
org.hibernate.annotations.CascadeType.DELETE,
org.hibernate.annotations.CascadeType.MERGE,
org.hibernate.annotations.CascadeType.PERSIST,
org.hibernate.annotations.CascadeType.DELETE_ORPHAN})*/
public List<TAnswer> getTAnswers() {
return this.TAnswers;
In Java:-
public void removeAnswers(TQuestion question)
throws ApplicationException {
List<TAnswer> answerList = question.getTAnswers();
deleteall(answerList);
public void deleteall(Collection objects) {
try {
getHibernateTemplate().deleteAll(objects);
getHibernateTemplate().flush();
} catch (Exception e) {
throw new ServerSystemException(ErrorConstants.DATA_LAYER_ERR, e);
} Here the "deleteall" will delete both the answer records and question records, I don't want the questions
records to be deleted. I have tried making the question as null when we set the answer object to be passed for delete
bit still it is deleting the question records as well.How to achieve the above in deleting only the answer (child) records
and not the question(parent) record? Is there any thing we need to do with @Cascade for Question object? Please clarify.
Thanks.What does deleteAll do, it doesn't look like a JPA method. You might want to ask your question on your provider forum, or use straight JPA methods as a simple EntityManager.remove(answer) on each answer in the collection should work.
Regards,
Chris -
what would i need to do to write a program to display the bits in a carrier file.
Do you want to scrape off the LSBs (Least Significant Bits)? Have a look
at this for starters:public class LSBInputStream extends InputStream {
private InputStream carrier; // the carrier input
public LSBInputStream(InputStream carrier) { this.carrier= carrier; }
public void close() throws IOException { carrier.close(); }
public int read() throw IOException {
int bits= 0;
for (int i= 0; i < 8; i++) { // read 8 bytes
int byte= carrier.read();
if (byte == -1) return (i == 0)?-1:bits; // eof reached in the middle?
bits<<= 1; // roll in the next bit
bits|= byte&1;
return bits;
}This was from the top of my head, but I hope you get the picture
kind regards,
Jos -
About method 'write(int b)' in class 'OutputStream'
Hello, everyone,
In OutputStream class, there is a method called "write(int b)". In the API Specification, the explanation of this method is: Writes the specified byte to this output stream.
I am just wondering, if the type of b is 'int', then how can it say " to write the byte to the stream"?Because the lower 8 bits of an int are the same value as a byte.
-1 ==> 11111111 11111111 11111111 11111111 ==> 11111111
0 ==> 00000000 00000000 00000000 00000000 ==> 00000000
1 ==> 00000000 00000000 00000000 00000001 ==> 00000001
255 ==> 00000000 00000000 00000000 11111111 ==> 11111111
So it's essentially the same thing. Just chops off the upper 24 bits. The other thing is it's not uncommon to maintain byte values in ints for unsigned-ness, and if the method took a byte, it would require an explicit cast do to possible loss of precision, whereas a byte can be implicitly cast to an int with no alteration to the actual value represented. -
I have created 5 elements of a node . I want to delete nodes. But it is giving error .
Context
sample (node ) [ cardinality 0...n , selection 0..1 ]
name (attr)
number(attr)
code :
public void onActioncreate(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActioncreate(ServerEvent)
for(int i=0;i<5;i++){
IPrivateClearnodeElements.ISampleNode node =wdContext.nodeSample();
IPrivateClearnodeElements.ISampleElement ele = node.createSampleElement();
ele.setName("Name "+i +" : " );
ele.setNumber(i+"");
node.addElement(ele);
//@@end
public void onActionclear(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionclear(ServerEvent)
wdComponentAPI.getMessageManager().reportSuccess(wdContext.nodeSample().size()+"");
for(int i=0;i<5;i++)
try{
wdContext.nodeSample().removeElement(wdContext.nodeSample().getSampleElementAt(i));
wdComponentAPI.getMessageManager().reportSuccess("Deleted : "+ i+"");
catch(Exception e)
wdComponentAPI.getMessageManager().reportSuccess(e.getMessage()" : " i+"");
//@@end
output :
5
Deleted : 0
Deleted : 1
Deleted : 2
Index: 3, Size: 2 : 3
Index: 4, Size: 2 : 4
Why it is not able to delete the last two node elements ????????????????//
Also any other way is there to delete elements of the node?
SriniHi srinivasa,
You have used the code to delete the element
for(int i=0;i<5;i++)
try{
wdContext.nodeSample().removeElement(wdContext.nodeSample().getSampleElementAt(i));
wdComponentAPI.getMessageManager().reportSuccess("Deleted : "+ i+"");
catch(Exception e)
wdComponentAPI.getMessageManager().reportSuccess(e.getMessage()" : " i+"");
Now.. See getSampleElementAt(i) method returns the element of i th element. On that case you have to use
getSampleElementAt(0). In that case it wiil return 0ih element end 0th element will be deleted. After deletion the 0th element 1st element will move to the 0th position.
So. in that way you can delete all the elements. -
Bit operations are very strange help me
class BitDemo {
public static void main(String[] args) {
int bitmask = 0x0000000F;
int val = -3;
System.out.println(val & bitmask); // prints "13" why not 3
int zmienna = -3; // 1000 ... 0011 ( 2^31 = 2 147 483 647 )
System.out.println("zmienna >> 1 = "+ ( zmienna >> 1 ) ); //print -2 why not -1What do you think the the bits in an int variable set to -3 look like?
Remember that negative numbers are stored in two's complement (http://en.wikipedia.org/wiki/Two%27s_complement that's the second time I post this link today and I didn't need it for a long time before, strange).
Maybe you are looking for
-
Could not find the main class ! exception.
hi, I create one java project. for this I am using netbeans 5. I try to run the project jar file stff.jar. When run using "java -jar stff.jar " , it throws error "could not find the main class. program will exit". I am extracting this jar file, in ma
-
Unable to install drivers for Intel 1218-V LAN.
Yesterday I built a new computer with an Asus Z97 board, which has an integrated Intel 1218-v LAN. All of the drivers installed correctly from the drivers disc in W10TP, except for the LAN. The error given is that an Intel(R) Adapter is not found in
-
Difference between PIP extension and customization?
Hi All, I want to understand what is the difference between AIA PIP customization and extension and also adding new mappings in custom xslt comes into which part? Regards, Shailesh
-
I didn't deactivate my iTunes on a previous computer and can no longer access it.
OK, so I'm not totally computer svey. My ITunes account won't allow me to access some of my music from previous purchases because I was unaware I needed to deactive my account on old computers. I am now over my 5 computer limit but have no access t
-
Microsoft XP Pro amazon link https://www.amazon.com/gp/digital/fiona/manage?ie=UTF8&ref_=kinw_myk_surl_2&signInRedirect=1&#All