I need to query single bytes - Pls help
Hi, I have got a method which performs different operations. I would like to update the state of a variable with the different steps occurred in the code execution and, at a later time, to query this variable to check what to do.
Example:
variable = -1;//This is an instance variable
if (cacheCleared) {
variable &= PageCanvas.CACHE_CLEARED;
if (imagesCleared) {
variable &= PageCanvas.IMAGES_CLEARED;
if (xmlCleared) {
variable &= PageCanvas.XML_CLEARED;
//And so on...Then, after the method returns, I'd like to be able to to query 'variable' to check which steps have been performed with something like:
if ((variable == PageCanvas.CACHE_CLEARED & PageCanvas.IMAGES_CLEARED)) {
//do something;
} else if (variable == PageCanvas.CACHE_CLEARED & PageCanvas.XML_CLEARED) {
//do something else
}I saw somewhere something like offset concepts, but I don't know how to implement it. Could you keep in mind that we run in a memory constrained environment, therefore I'd like to use, let's say, an int and having the constants as bytes?
Thanks for any help.
Hi, I have tried the following code:
byte b1 = 1;
byte b2 = 2;
byte b3 = 4;
byte b4 = 8;
byte results = 0;
results |= b1;
results |= b3;
results |= b4;
System.out.println(results == (results | b1));
System.out.println(results == (results | b2));
System.out.println(results == (results | b3));
System.out.println(results == (results | b4));And the result is:
true
false
true
true
However, I noticed that it's important to assign the bytes the values of the bits right to left:
0000 0001
0000 0010
0000 0100
0000 1000
The first byte should have value 1
The second should have value 2
The third should have value 4
The fourth should have value 8
So that the | operator works.
Similar Messages
-
Hi,
I am unable to add my bank/card details in my apple account, every time i am getting a message that it has been declined. kindly help me in authorise my bank card in my apple account i need to purchase few apps, pls help meWhat sort of card are you trying to use ? If it's a debit card then I don't think that they are still accepted as a valid payment method - they are not listed on this page and there have been a number of posts recently about them being declined
If it's a credit card then is it registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, it was issued by a bank in your country and you are currently in that country ? If it is then you could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes support and see if they know why it's being declined : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management -
SQL query...pls help ASAP
Actor (Aname: varchar(40), Ano: varchar(6)) Ano is pk
Movie (Mname: varchar(40),mno: varchar(8)) Mno is pk
PlayIn (Ano, Mno, Pay: Integer) Ano and Mno are fk referencing Acotr and Movie respectively.
Actor(Aname, Ano)
A Bingo, A1
B Castro, A2
C Katie, A3
S Hommy, A4
J Tammy, A5
K loren, A6
Movie(Mname, Mno)
Gladiator, M1
Cast, M2
Dog, M3
Jilters, M4
PlayIn(Ano,Mno,Pay)
A1 M1 800
A1 M2 1500
A2 M2 78
A2 M3 1750
A2 M4 2301
A3 M2 904
A3 M3 629
A4 M2 565
A4 M3 5695
A4 M4 1255
A5 M1 989
A5 M4 238
A6 M2 137
A6 M3 236
A6 M4 545
QUESTION: write SQL query to find the names of actors who earned less than 'B Castro' in each movie that 'B Castro' played in.thanks so so much.....
another question:
for each movie, list the movie number, the average
pay and the total number of actors in the movie.....Rather than just asking homework questions and expecting everyone else to do your work for you, why don't you at least have a go at it yourself and post the query that you've tried, then we'll tell you where you are going wrong. You won't learn anything if we just write it for you.
Also, your use of "pls help ASAP" in the subject title is not polite.
This forum is manned by volunteers who have their own jobs and offer their help free of charge.
Everyone who posts an issue on here would love to have it answered as soon as possible, but nobody has the right to assume that their issue is any more important, urgent or requires a quicker answer than anybody elses.
If you need urgent help then you should pay someone to do the work for you. -
Consecutive Absent Days Query.. Pls Help Gurus
I have a table which stores attendance information
For eg:
Emp_No Date
100 01-APR-2010
102 05-APR-2010
100 02-APR-2010
I need a query with parameter From Date and To date..
My Query Output should be like this .. considering that employee 100 is absent for 8 consecutive days and employee number 102 is absent for 2 consecutive days..
It should return number of consecutive days he is absent.
Empno Consecutive Days
100 8 Days
102 2 Days
Pls Help Gurus.
Edited by: suzvino on Jun 21, 2010 12:14 AMTUBBY_TUBBZ?with data as
2 (
3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
14 )
15 select
16 emp_no, max(level)
17 from data
18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
19 group by emp_no
20 having max(level) >= 8;
EMP_NO MAX(LEVEL)
100 9
1 row selected.
Elapsed: 00:00:00.01
TUBBY_TUBBZ?Think i misread the post, so the query should be
TUBBY_TUBBZ?with data as
2 (
3 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
4 select 102 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
5 select 100 as emp_no, to_date('02-APR-2010','dd-mon-yyyy') as absent_date from dual union all
6 select 100 as emp_no, to_date('01-APR-2010','dd-mon-yyyy') as absent_date from dual union all
7 select 100 as emp_no, to_date('03-APR-2010','dd-mon-yyyy') as absent_date from dual union all
8 select 100 as emp_no, to_date('04-APR-2010','dd-mon-yyyy') as absent_date from dual union all
9 select 100 as emp_no, to_date('05-APR-2010','dd-mon-yyyy') as absent_date from dual union all
10 select 100 as emp_no, to_date('06-APR-2010','dd-mon-yyyy') as absent_date from dual union all
11 select 100 as emp_no, to_date('07-APR-2010','dd-mon-yyyy') as absent_date from dual union all
12 select 100 as emp_no, to_date('08-APR-2010','dd-mon-yyyy') as absent_date from dual union all
13 select 100 as emp_no, to_date('09-APR-2010','dd-mon-yyyy') as absent_date from dual
14 )
15 select
16 emp_no, max(level)
17 from data
18 connect by prior emp_no = emp_no and prior absent_date = absent_date - 1
19 group by emp_no;
EMP_NO MAX(LEVEL)
100 9
102 1
2 rows selected.
Elapsed: 00:00:00.01Edited by: Tubby on May 30, 2010 11:00 PM
Added second query since i misread the post originally. -
Need SQL query using View - Please help
Hi,
I have similar requirement like below.
I have two tables DEPT and EMP and some departments may not have employees. I have created below view, which displays all DEPT records, even though there are no emplyees.
CREATE OR REPLACE VIEW dept_emp_vw AS
SELECT deptno, empid, 0 AS selected
FROM dept d, emp e
WHERE d.deptno = e.deptnno (+);
Ex.
DEPTNO EMPID SELECTED
10 101 0
10 102 0
20 103 0
30 103 0
40 104 0
50 <null> 0
Application will pass "empid" to the view (for ex. empid = 103) and I want result like below.
Ex.
DEPTNO EMPID SELECTED
10 101 0
10 102 0
20 103 1
30 103 1
40 104 0
50 <null> 0
Can you please let me know the query using "dept_emp_vw" view. We have Oracle 11g Release 2.
Thanks a lot for the help.Not possible using normal SQL - as SQL is not a procedure language and does not support variable declaration and use (e.g. passing empid as a variable and using it both as a predicate and as a condition in the SQL projection).
That said - SQL can be "+parameterised+". An approach that is ugly and contrary to the basic design and use of SQL. But it can support the (very weird) view definition of yours.
E.g.
SQL> create or replace procedure SetVariable( name varchar2, value varchar2 ) is
2 begin
3 DBMS_SESSION.set_context( 'MyVariables', name, value );
4 end;
5 /
Procedure created.
SQL>
SQL>
SQL> create or replace context MyVariables using SetVariable;
Context created.
SQL>
SQL> create or replace view my_funky_weird_view as
2 select
3 e.empno,
4 e.ename,
5 e.job,
6 case e.empno
7 when to_number(sys_context( 'MyVariables', 'empid' )) then
8 0
9 else
10 1
11 end as "SELECTED"
12 from emp e
13 /
View created.
SQL>
SQL> exec SetVariable( 'empid', 7499 )
PL/SQL procedure successfully completed.
SQL>
SQL> select * from session_context where namespace = 'MYVARIABLES';
NAMESPACE ATTRIBUTE VALUE
MYVARIABLES EMPID 7499
SQL>
SQL> select * from my_funky_weird_view order by selected;
EMPNO ENAME JOB SELECTED
7499 ALLEN SALESMAN 0
7521 WARD SALESMAN 1
7566 JONES MANAGER 1
7654 MARTIN SALESMAN 1
7698 BLAKE MANAGER 1
7934 MILLER CLERK 1
7788 SCOTT ANALYST 1
7839 KING PRESIDENT 1
7844 TURNER SALESMAN 1
7876 ADAMS CLERK 1
7900 JAMES CLERK 1
7902 FORD ANALYST 1
7369 SMITH CLERK 1
7782 CLARK MANAGER 1
14 rows selected.
SQL>But I will N\OT recommend doing it this way. It is not natural SQL as PL/SQL is needed to "+inject+" name-value pairs into the context for the SQL view to use. It is ugly. It is not standard. It cannot scale. It is complex to use. Etc.
Yes, there are instances when this approach is exactly what one needs - when for example dealing with a trusted context and using the contents for implementing a security layer. But in the above case - I would rather want to see the actual business requirement first, as I think you're barking up the wrong tree with the view solution you have imagined. -
SQL Query Urgent..pls help
Dear Experts,
Table.
C_id Purity
1 100
2 100
10 100
11 100
12 100
Ranking Regions by Size You have to list all regions in the table, and you have to list them according to their size.
you need to list all regions of two or more containers with a purity of 100, and you need to sort that list by the number of containers in each region.
The output should be something like this:
RegBeg RegEnd RegionSize
10 12 3
1 2 2
Kindly help me,
BasavLooks like a homework assignment.
Perhaps you can explain to your tutor how the tabbibitosan method works...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as C_id, 100 as Purity from dual union all
2 select 2, 100 from dual union all
3 select 4, 100 from dual union all
4 select 5, 100 from dual union all
5 select 6, 50 from dual union all
6 select 7, 100 from dual union all
7 select 10, 100 from dual union all
8 select 11, 100 from dual union all
9 select 12, 100 from dual)
10 --
11 -- use tabbibitosan method to group data
12 select min(c_id) as min_c_id
13 ,max(c_id) as max_c_id
14 ,count(*) as grp_size
15 from t
16 where purity = 100
17 group by c_id-rownum
18 having count(*) > 1
19* order by 3 desc, 1
SQL> /
MIN_C_ID MAX_C_ID GRP_SIZE
10 12 3
1 2 2
4 5 2... if you can understand it. ;) -
I am creating an apple account on my phone but it says i need to pay, can anyone pls help
I am creating an apple account on my phone but it says i need to pay before i can get an account. i really need help on this
if you mean it is asking for credit card information when setting up an apple id and you do not have one or do not want to provide it, read this: http://support.apple.com/kb/HT2534
-
I need solutions for the following pls help
1) what is the difference between doPost() and doGet()
2) what is difference between sendRedirect() and forward()
3) can we call destroy() in servlet class
4) advantages and disadvantages of Hidden Form fields,URLRewritting,Cookies
5) can we write a constructor for a servlet class1) in get request parameters are sent as part of request URL and its size is limited to some houndreds of KB (can't remember this limit) in case of post data is sent within request body. So in servlet you can have seaparate handling for get and post methods. I most cases you can create single routine like processRequest and call it from doGet and doPost
2) Send redirect sends request to browser to redirect to different URL. Then browser redirects and user can see new URL (its done by browser), forward is used to move request processing to other servlet or JSP in SAME container. Client knows nothing and URL in browser does not change. It is typical approach used when implementing MVC approach. Eg. server gets request and process it eg. query data from database and puts result as request attribute (not parameter) then servlet forwards rerquest to JSP which is responsible for display (view).
3) this is a public method of servlet so of course you can call it as any other visible method, but it is intended to let you make some cleansing when container is going to remove servlet.
4) You shoud find some article on it, too large topic. Generally: url rewriting will work if cookies are enabled or disabled, when you use cookies for session id storage it won't work if cookies are disabled on client side. I can't see good reason to use hidden form fields when you can user URL rewriting.
5) Of course you can but it won't be used by servlet container. Servlt's init method is the one you should use for initialization tasks. -
first
There's a number of potential problems here, and they may not necessarily be at your end.
First of all, it should be clear that CMYK is not so much a generic "image mode" as it is a description of specific press conditions. If you produce final CMYK, you must have the right profile. Don't use Image > Mode, use Convert to Profile.
Given that, I would question anyone who doesn't accept Adobe RGB photographs for a magazine article, because it implies a process that isn't properly color managed and generally not up to date. A standard workflow today would use InDesign, where images are normally placed in their original RGB space whatever that is. Then the conversion to final output CMYK is done as the last step, when producing a press-ready PDF from InDesign.
It helps tremendously if you know that final CMYK, because then you can proof to that so your file survives the CMYK conversion with the least possible damage (we're talking gamut clipping here; not general color shifts). But it's not absolutely required, which is why this workflow is relaitively safe.
Third, CMYK jpeg is in itself risky, because many jpeg decoders (in some software) don't have proper CMYK support. The result can be weird colors. This could well be the problem here, because it sounds as if your client uses a non-standard workflow.
So what to do? I would send two files. One sRGB as reference, which is guaranteed to come through correctly. Then find a way to send TIFF for the CMYK version if they insist, or ask them to try opening it in different software. Of course you should have a calibrated and profiled display, but I agree that's probably not the immediate problem here. There's no particular reason a CMYK file should come back with twisted colors if it's opened and processed in properly color managed software. -
i have use my iphone always for music on car etc etc so now i get the new Update and i cant make playlist with music videos so far, BTW some else have same problem or how do i fix this somebody know how to make a playlist with music videos
well thax i check out the apps and are good for me but the last version allowed u to close de ipod app then u push button x2 then u clear all open apps or just ipod app then u push play on the mini remote on same place then u lock down the phone push again the button and push play and it run the ipod with lock screen thats what i mean
hope u understand mee ! =) -
N95-1 FW V21.0.016 query...pls help!!!
anybody suffer any problems for this new FW v21.0.016 for N95-1 upgrade? if i don insert memory card , everything seem OK after fresh upgrade...but when i restore back back-up folder via PC suite b4 upgrade (only bac up all phone memory data) & insert my Sandisk 4GB memory card which got mp3, photos...& start my phone...cannot boot up forever...hang..no choices u hav to take out battery...when open menu also very slow like goin to stop...
Yes I have problems too, I backed it up, charged it, connected to Nokia Charger with Nokia supplied memory in. Half way through it said error, remove battery and power, reapply and push power switch. Then it said it was disconnected but it was not and it has been dead ever since. I have tried other usb slots, battery only, battery and another charger.
One thing though. With battery only at least it vibrates when you push the power switch. Add the charger and it does not. Also on battery only, a few devices momentarily show up as being connected, just to vanish again.
I have a feeling it is dead now as it just sits saying nokia.
Message Edited by 1tonnefc on 16-Apr-2008 11:24 AM -
so seriously wat is the security code there talking about
I believe you are correct. I had to replace my phone and it was necessary to enter the (3 digit) security code from the credit card the first time I updated some apps on the new phone. Thereafter only the password was requested.
-
Hi,
first one is old query ,I re write this query as second query with using WITH clause,Both are returning same rows but Oder is missing,
Java developers need same order.Could you pls help to get same order for second query as 1st query .And i tried Order by clause for second query all possibilities but i did't get same order as 1st.
*1st query*
SELECT a.test_session_id, c.roster_domain_name, a.sem
FROM test_session_detail a, test_session b, test_detail c
WHERE a.test_session_id = b.test_session_id
AND c.test_detail_id = a.test_detail_id
AND EXISTS
(SELECT td.test_detail_id
FROM test_detail td
WHERE domain_map_id IS NOT NULL
AND c.test_detail_id = td.test_detail_id
AND domain_map_id IN ('303', '306', '305', '304'))
AND b.test_session_id IN ('4047','4086','4087','4165','4167','4169')
AND domain_group_id NOT IN
(SELECT domain_group_id
FROM test_session_detail a, test_session b
WHERE a.test_session_id = b.test_session_id
AND a.domain_group_id IS NOT NULL
AND b.test_session_status_id = 4
AND a.test_session_status_id <> 3
AND b.test_session_id IN
('4047','4086','4087','4165','4167','4169'))
sample output of 1st query
TEST_SESSION_ID ROSTER_DOMAIN_NAME SEM
4047 AR - Integers and Fractions 2
4047 AR - Integers and Fractions 2
4047 AR - Decimal Numbers 1
4047 AR - Decimal Numbers 1
4047 AR - Percent 1
4047 AR - Percent 1.52
4047 AR - Estim, Ordering, Numb. Sense 11.34
4047 AR - Estim, Ordering, Numb. Sense 11.34
4047 AR - Word Problems 0.401
4047 AR - Word Problems 1
4086 AR - Integers and Fractions 1.5
4086 AR - Decimal Numbers 1.342
4086 AR - Percent 1
4086 AR - Estim, Ordering, Numb. Sense 11.34
4086 AR - Word Problems 2second query
WITH exist_1 AS
(SELECT td.test_detail_id
FROM test_detail td
WHERE domain_map_id IS NOT NULL
AND domain_map_id IN ('303', '306', '305', '304')),
domain_group AS
(SELECT domain_group_id
FROM test_session_detail a, test_session b
WHERE a.test_session_id = b.test_session_id
AND a.domain_group_id IS NOT NULL
AND b.test_session_status_id = 4
AND a.test_session_status_id <> 3
AND b.test_session_id IN
('4047','4086','4087','4165','4167','4169'))
SELECT a.test_session_id, c.roster_domain_name, a.sem
FROM test_session_detail a, test_session b, test_detail c,exist_1 ex, domain_group dg
WHERE a.test_session_id = b.test_session_id
AND c.test_detail_id = a.test_detail_id
AND dg.domain_group_id(+) =A.DOMAIN_GROUP_ID
AND dg.domain_group_id IS NULL
AND ex.test_detail_id = c.test_detail_id
AND b.test_session_id IN ('4047','4086','4087','4165','4167','4169')
sample output of second query
TEST_SESSION_ID ROSTER_DOMAIN_NAME SEM
4086 AR - Word Problems 2
4086 AR - Estim, Ordering, Numb. Sense 11.34
4086 AR - Percent 1
4086 AR - Decimal Numbers 1.342
4086 AR - Integers and Fractions 1.5
4047 AR - Word Problems 0.401
4047 AR - Estim, Ordering, Numb. Sense 11.34
4047 AR - Percent 1.52
4047 AR - Decimal Numbers 1
4047 AR - Integers and Fractions 2
4047 AR - Word Problems 1
4047 AR - Estim, Ordering, Numb. Sense 11.34
4047 AR - Percent 1
4047 AR - Decimal Numbers 1
4047 AR - Integers and Fractions 2Hi,
user575115 wrote:
Hi,
Even if i give order by a.test_session_id in both queries not ordering properly in second query as 1st query.When you say
ORDER BY a.test_session_id DESCin your main query, then you can be sure that all the rows where a.test_session_id=4086 will be together, before any rows with a.test_session_id=4047. But if you have 5 rows where a.test_session_id=4086, there is no telling what order those 5 rows will be in, and it will not necessarily be the same every time you run the exact same query with the exact same data. You can ORDER BY additional columns or expressions, even columns or expressions that are not in the SELECT clause.
For example, if you say:ORDER BY a.test_session_id DESC
, a.test_detail_idthen you can be sure the rows where a.test_session_id=4086 will be together, before any rows with a.test_session_id=4047, as before, but you can also be sure that the rows where a.test_session_id=4086 will be in order by a.test_detail_id. If that is not unique, keep adding more columns.
If the ORDER BY clause includes the primary key (or any unique key) from each table, then you can be sure that the results will always be in the same order. -
hi all,
How to delete a SET name in EAM- Preventive Maintenence. To avoid duplications the SET names needs to be deleted. Pls help
Thanks
DineshHi,
Please try this and use BSEG as an example.
1. Go to SE12.
2. Enter BSEG
3. Click Display button
4. Go to Delivery and Maintenance' tab.
5. You should be able to see Pool/cluster RFBLG.
6. Double click RFBLG and then click Where-Used list button (CTRLSHIFTF3).
7. Select Table option and click Execute button.
8. System will show all the table that belong to this pool/cluster.
For Pool/Cluster REGUC, it is only used in table REGUP.
Look at the below link
Re: Define view for cluster table?
Regards,
Priyanka. -
Hi, i forgot my macbook pro(snow leopard) password and i tried to reset it through single user mode, but whenever i type, everything comes out in CAPs instead of lower case. Each time i press the minus(-), it always comes out as an underscore(_).Pls help.
Well, you can try easing the shift key up with something thin but flexible (credit card sort of thing) but if the contacts below are stuck you may need to get it seen to by an authorised repairer.
If you can borrow a keyboard (a PC one will probably work as long as the password is alpha-numeric with no special characters) you can at least get in to backup your HD before going for repair.
Maybe you are looking for
-
After iOS 8.2 upgrade, screen no longer displays color.
I have restarted the phone several times.I have played with the accessibility settings (grayscale and invert colors) but that has not solved the problem. when I turn my phone and the orientation switches, I see a brief flash of color, but then it is
-
Wifi connection intermittently randomly stops and later reconnects randomly
When I am at work, my wifi connection will randomly disconnect. Nothing I do seems to make it reconnect. The problem is not the router or the internet service. It is my macbook pro. At some random time later, hours or days later, it will just rec
-
Need to attach my custom find form to the torch found in the EBS
I have a custom find form AS found in for example "human resources vision operations -------> people------> enter & maintain" it shows find screen then when i finish the find screen it send me to the main form , then while i'm in the main form there
-
i have been trying for three days to try and get this working , and tried a few of the forum suggestions already and this is just to try them ... so glad i haven't pais anything yet . i get the signed out loop no matter what i try
-
The woes of multithreading and writing a scheduler
Hi Gurus I had no idea where to put this particular question but i fugured this should be the best place( moderators if this is not so please transfer this to the appropriate forum) My problem is that of writing an age old task of a schedualar and ju