Strange CBO choice
Hi guys,
I'm runing some tests to check weather processed_flag should have NULL for already processed values or not. I thought that having a smaller index on the processed_flag column should be better.
Check the following example:
CREATE TABLE processed_flag_not_null AS
SELECT LEVEL id,
lpad('A', 10, 'A') VALUE,
CASE
WHEN MOD(LEVEL, 100) = 0 THEN
0
ELSE
1
END processed_flag
FROM dual
CONNECT BY LEVEL <= 1000000;
CREATE INDEX IDX_PROCESSED_FLAG_NOT_NULL ON PROCESSED_FLAG_NOT_NULL (PROCESSED_FLAG);
CREATE TABLE processed_flag_null AS
SELECT LEVEL id,
lpad('A', 10, 'A') VALUE,
CASE
WHEN MOD(LEVEL, 100) = 0 THEN
0
END processed_flag
FROM dual
CONNECT BY LEVEL <= 1000000;
CREATE INDEX IDX_PROCESSED_FLAG_NULL ON PROCESSED_FLAG_NULL (PROCESSED_FLAG);
BEGIN
dbms_stats.gather_table_stats(USER, 'PROCESSED_FLAG_NOT_NULL', cascade => TRUE);
dbms_stats.gather_table_stats(USER, 'PROCESSED_FLAG_NULL', cascade => TRUE);
END;The first strange thing I've found was in all_tab_histograms:
SELECT *
FROM all_tab_histograms
WHERE table_name IN ('PROCESSED_FLAG_NOT_NULL', 'PROCESSED_FLAG_NULL')
AND column_name = 'PROCESSED_FLAG'
ORDER BY 2,4;
TABLE_NAME COLUMN_NAME ENDPOINT_NUMBER ENDPOINT_VALUE
PROCESSED_FLAG_NOT_NULL PROCESSED_FLAG 0 0
PROCESSED_FLAG_NOT_NULL PROCESSED_FLAG 1 1
PROCESSED_FLAG_NULL PROCESSED_FLAG 0 0
PROCESSED_FLAG_NULL PROCESSED_FLAG 1 0Only after running queries against both tables with ("where processed_flag = 0") and gathering table stats again I get the following histograms:
TABLE_NAME COLUMN_NAME ENDPOINT_NUMBER ENDPOINT_VALUE
PROCESSED_FLAG_NOT_NULL PROCESSED_FLAG 59 0
PROCESSED_FLAG_NOT_NULL PROCESSED_FLAG 5598 1
PROCESSED_FLAG_NULL PROCESSED_FLAG 10000 0Can someone explain to me this behaviour?
Now for the main question, I don't understand why the CBO chooses an Index Range Scan for the PROCESSED_FLAG_NOT_NULL table, and a Full Table Scan for the PROCESSED_FLAG_NULL:
SQL> set timing on
SQL> set autotrace traceonly
SQL> SELECT *
2 FROM processed_flag_not_null
3 WHERE processed_flag = 0;
10000 rows selected.
Elapsed: 00:00:00.20
Execution Plan
Plan hash value: 3652560023
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 10539 | 195K| 93 (0)| 00:00:02 |
| 1 | TABLE ACCESS BY INDEX ROWID| PROCESSED_FLAG_NOT_NULL | 10539 | 195K| 93 (0)| 00:00:02 |
|* 2 | INDEX RANGE SCAN | IDX_PROCESSED_FLAG_NOT_NULL | 10539 | | 23 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("PROCESSED_FLAG"=0)
Statistics
1 recursive calls
0 db block gets
4444 consistent gets
0 physical reads
0 redo size
306954 bytes sent via SQL*Net to client
7745 bytes received via SQL*Net from client
668 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processed
SQL> SELECT *
2 FROM processed_flag_null
3 WHERE processed_flag = 0;
10000 rows selected.
Elapsed: 00:00:00.22
Execution Plan
Plan hash value: 1150676937
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 10000 | 166K| 802 (2)| 00:00:10 |
|* 1 | TABLE ACCESS FULL| PROCESSED_FLAG_NULL | 10000 | 166K| 802 (2)| 00:00:10 |
Predicate Information (identified by operation id):
1 - filter("PROCESSED_FLAG"=0)
Statistics
1 recursive calls
0 db block gets
3571 consistent gets
0 physical reads
0 redo size
174974 bytes sent via SQL*Net to client
7745 bytes received via SQL*Net from client
668 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
10000 rows processedIf I compare both aproaches using Runstats:
BEGIN
runstats_pkg.rs_start;
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT *
FROM processed_flag_not_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
runstats_pkg.rs_middle;
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT *
FROM processed_flag_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
runstats_pkg.rs_stop;
END;
-- Output
Run1 ran in 4295 hsecs
Run2 ran in 5123 hsecs
run 1 ran in 83.84% of the timeIf I compare the processed_flag_null without hints versus processed_flag_null with index hint this are the results:
BEGIN
runstats_pkg.rs_start;
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT *
FROM processed_flag_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
runstats_pkg.rs_middle;
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT /*+ index(processed_flag_null IDX_PROCESSED_FLAG_NULL) */
FROM processed_flag_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
runstats_pkg.rs_stop;
END;
-- Output
Run1 ran in 5017 hsecs
Run2 ran in 2212 hsecs
run 1 ran in 226.81% of the timeAs I expected using the hint is more than twices fast of not using the index, why doesn't the CBO choose the index aproach? Can I tune the stats to give the CBO more information?
Thanks in advance,
Manuel Vidigal
EDIT:
Forgot to mention the tests were done using my laptop with Oracle 11.2.0.1.0.
Edited by: Manuel Vidigal on 16/Set/2010 11:53
I don't have runstats installed on my 11.2 instance so i can't reproduce your findings there, however with a simple SET TIMING ON and observing the results i get no noticeable difference between the INDEX hinted query and the not hinted query (i have an isolated sandbox where i am on the only user on the server so this is a reasonably safe method in my opinion).
TUBBY_TUBBZ?
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT *
FROM processed_flag_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
12 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:51.26
BEGIN
FOR i IN 1 .. 1000
LOOP
FOR x IN (SELECT /*+ index(processed_flag_null IDX_PROCESSED_FLAG_NULL) */
FROM processed_flag_null
WHERE processed_flag = 0)
LOOP
NULL;
END LOOP;
END LOOP;
END;
13 /
PL/SQL procedure successfully completed.
Elapsed: 00:00:50.53The results you are seeing are a consequence of the tiny nature of your table. The way you have set it up you should be seeing roughly 300 rows fitting on to a single data block (i observed 325 on my instance running on ASM) and you are only interested in returning every 100th row (again the way you set up your data) but to get every 100th row means you will have to visit EVERY block in the table.
select
blocks
from dba_segments
where segment_name = 'PROCESSED_FLAG_NULL';
PL/SQL procedure successfully completed.
Elapsed: 00:00:04.51
TUBBY_TUBBZ?
BLOCKS
3072
1 row selected.
Elapsed: 00:00:00.13Since you haven't ordered your data it's going to be inserted as the rows are generated from DUAL (so ordered by LEVEL asc). That means that you will need to get every block from the table (getting roughly 3 results per block).
In order to visit every block in the table via an index access you cannot utilize multi-block IO, so that would be the reason the optimizer took the FULL table scan as it's choice.
So in terms of 'fixing' this you have a couple of options.
1) change the order of the data so it's not so evenly distributed across the blocks in the table (or possibly create this table as an index organized one so the values are sorted upon insertion and kept physically close to each other)
2) change the size of a row such that less rows will fit on a single data block meaning that you will not actually have to return every data block for this table via your query
lpad('A', 1000, 'A') VALUE,Would be a sufficient change to shift things in favor of index access in your example.
Similar Messages
-
View joining two spatial tables and strange CBO behaviour
Hi all,
I've following view in my database:
CREATE OR REPLACE VIEW my_view AS
SELECT id, 'table1' AS source, location FROM my_table1
UNION ALL
SELECT id, 'table2' AS source, location FROM my_table2;
When I execute query:
SELECT * FROM my_view WHERE SDO_RELATE(location, SDO_GEOMETRY(...), 'mask=anyinteract') = 'TRUE';
It works as expected.
When running query like (getting location with subquery):
SELECT * FROM my_view WHERE SDO_RELATE(location, (SELECT location FROM my_table3 WHERE id = 123, 'mask=anyinteract') = 'TRUE';
It doesn't work. Oracle Throws "DatabaseError: ORA-13226: interface not supported without a spatial index"
Further investigation revealed strange behaviour of CBO:
In first case Oracle CBO uses Spatial index just fine and as expected.
But second query and CBO get's a bit strange - unique index scan is used for subselect, but for view tables is full table scan is used and SDO_RELATE is not happy with that since no spatial index is used.
How I can use spatial indexes regardless of that subselect?Hi folks,
Looking over these responses and not finding a lot of clarity yet in terms of leaving a trail for future readers to glean an answer from. I was just looking through the back-and-forth and curious myself about the issue First of all I think Jani's observations are quite on target. This CBO reaction is weird and does not work they way most Oracle users would expect it to work. Secondly, Jani really should tell us his Oracle version and folks providing answers should as well - the CBO is always being tweaked. Thirdly, Stefan provides a solution though it's a rather expensive solution to my taste. And finally, I think we as a group need to spend a bit more time reproducing things in code. I will give it a shot, feel free to correct anything I got wrong.
So first of all, I wrote this up quick on 12.1.0.2 and verified it was the same on 11.2.0.4
DROP TABLE my_table1 PURGE;
CREATE TABLE my_table1(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
DROP TABLE my_table2 PURGE;
CREATE TABLE my_table2(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
DROP TABLE my_table3 PURGE;
CREATE TABLE my_table3(
objectid INTEGER NOT NULL
,tsource VARCHAR2(30 Char)
,shape MDSYS.SDO_GEOMETRY
,PRIMARY KEY(objectid)
CREATE OR REPLACE PROCEDURE seeder(
p_count IN NUMBER
AS
sdo_foo MDSYS.SDO_GEOMETRY;
int_counter NUMBER := 1;
FUNCTION random_line
RETURN MDSYS.SDO_GEOMETRY
AS
num_x1 NUMBER;
num_y1 NUMBER;
num_offx NUMBER;
num_offy NUMBER;
BEGIN
num_x1 := dbms_random.value(-179,179);
num_y1 := dbms_random.value(-89,89);
RETURN MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
num_x1
,num_y1
,num_x1 + 0.0001
,num_y1 + 0.0001
END random_line;
BEGIN
FOR i IN 1 .. p_count
LOOP
sdo_foo := random_line();
INSERT INTO my_table1
VALUES (
int_counter
,'table1'
,sdo_foo
int_counter := int_counter + 1;
sdo_foo := random_line();
INSERT INTO my_table2
VALUES (
int_counter
,'table2'
,sdo_foo
int_counter := int_counter + 1;
sdo_foo := random_line();
INSERT INTO my_table3
VALUES (
int_counter
,'table3'
,sdo_foo
int_counter := int_counter + 1;
END LOOP;
INSERT INTO my_table1
VALUES (
0
,'table1'
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5847222
,-87.8212
,42.5848
INSERT INTO my_table3
VALUES (
0
,'table3'
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5848
,-87.8212
,42.5847222
COMMIT;
END seeder;
BEGIN
seeder(100000);
END;
SELECT 'my_table1: ' || COUNT(*) AS invalid_count FROM my_table1 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE'
UNION ALL
SELECT 'my_table2: ' || COUNT(*) AS invalid_count FROM my_table2 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE'
UNION ALL
SELECT 'my_table3: ' || COUNT(*) AS invalid_count FROM my_table3 WHERE MDSYS.SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(shape,0.05) <> 'TRUE';
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE1'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE2'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
BEGIN
INSERT INTO user_sdo_geom_metadata(
table_name
,column_name
,diminfo
,srid
) VALUES (
'MY_TABLE3'
,'SHAPE'
,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
,8265
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
NULL;
END;
CREATE INDEX my_table1_spx ON my_table1
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
CREATE INDEX my_table2_spx ON my_table2
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
CREATE INDEX my_table3_spx ON my_table3
(shape)
INDEXTYPE IS MDSYS.SPATIAL_INDEX
NOPARALLEL;
BEGIN
dbms_stats.gather_table_stats(USER, 'MY_TABLE1');
dbms_stats.gather_index_stats(USER, 'MY_TABLE1_SPX');
dbms_stats.gather_table_stats(USER, 'MY_TABLE2');
dbms_stats.gather_index_stats(USER, 'MY_TABLE2_SPX');
dbms_stats.gather_table_stats(USER, 'MY_TABLE3');
dbms_stats.gather_index_stats(USER, 'MY_TABLE3_SPX');
END;
CREATE OR REPLACE VIEW my_view
AS
SELECT
objectid
,'table1' AS tsource
,shape
FROM
my_table1
UNION ALL
SELECT
objectid
,'table2' AS tsource
,shape
FROM my_table2;
set timing on;
-- QUERY #1
-- Jani's original setup, works as expected
SELECT
COUNT(*) AS single_geom_counter
FROM
my_view a
WHERE
MDSYS.SDO_RELATE(
a.shape
,MDSYS.SDO_GEOMETRY(
2002
,8265
,NULL
,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1)
,MDSYS.SDO_ORDINATE_ARRAY(
-87.8211111
,42.5848
,-87.8212
,42.5847222
,'mask=anyinteract'
) = 'TRUE';
-- QUERY #2
-- Now the problem statement
SELECT
COUNT(*) AS table_problem_counter
FROM
my_view a
WHERE
MDSYS.SDO_RELATE(
a.shape
,(SELECT b.shape FROM my_table3 b WHERE b.objectid = 0)
,'mask=anyinteract'
) = 'TRUE';
-- QUERY #3
-- Stefan's solution
SELECT /*+ ORDERED */
COUNT(*) AS stefans_solution
FROM
my_table3 a
,my_view b
WHERE
a.objectid = 0
AND MDSYS.SDO_RELATE(
a.shape
,b.shape
,'mask=anyinteract'
) = 'TRUE';
Anyhow, so the hard coded query #1 that Jani provided works exactly the way most folks would expect, the second item in the relate is applied to each spatial index participating in the view. I think we can agree this is what we want.
Now when we move on to the problem, well its all goes off the rails as I think its looks to apply the spatial filter to the view itself which lacks an index (not sure really)
So as Stefan says, you can work around this by rewriting things as query #3 does above though now its a full table scan of both tables in the view. This is a long way performance wise from Query #1!
So on my 12c test box
query #1 Elapsed: 00:00:00.016
query #3 Elapsed: 00:00:33.534
On 11g production box
query #1 Elapsed: 00:00:00.49
query #3 Elapsed: 00:02:31.45 (ouch!)
So hopefully someone else can jump in with more information on better solutions?
I overall tend to avoid the kind of unioned views that Jani is using here. I have a hard time recalling why but I must have been burned similarly many years ago when I was first starting with Oracle spatial. I tend to always want my spatial indexes right there where I can keep a grim stink eye on them. It may be that a unioned view with multiple spatial indexes behind it might just be a bad practice better done with a materialized view? Or maybe a lesser term? Unprofitable practice? fraught? "Best if you don't do that"?
Anyhow, I would be interested in what others have as input on the matter.
Cheers,
Paul -
I use Nokia 5800 (v.20.0.012) in Russia. My phone and input languages are Russian.
During editing of notes or contacts from time to time I need as Russin letters as English (Latin). But keyboard panel let me input only Russian letters, numerals and "strange" simbols (I don't know their names and where they are used...).
I've found only one way to get English letters - change input language in phone setup. But it's very hard to do every time when you are input Russian/English text!!!
How can I change "strange" simbols choice in keyboard to the NORMAL ENGLISH LETTERS?
Or it's bag of the firmware and it will be solved later?Hello! Can somebody explain me what means this key on keyboard (see attachment)? Can I change function this button?
My native language is Russian. I want change type language between Russian and English quick. Now I must do at least three step for change language (= (input menu) > Language >English), and three for return back Russian.
Can I do this quickly (at one step/tap)?
Why developers can't change function for this strange button on something usefull (for ex. switch between two favorite languages)?
Message Edited by club_s on 23-May-2009 07:25 AM
Attachments:
3052626298_d59c8b8ff4.jpg 29 KB -
PreparedStatement.setTimestamp does not allo use of DATE index..
(...although they' re not suposed be related)
Hi;
I use Oracle 10g with Java JDBC driver ojdbc14.jar and I have a PreparedStatement on which among other "bind" JDBC parameters I have a java.util.Date. The ORM that we use (Hibernate 2.0.3) passes this Date instance as a java.sql.Timestamp binding it with setTimestamp on the PreparedStatement.
Interestingly enaugh, this way of binding the value does not make the database use the date column index, although the explain available from TOAD / Session browse, for instance, tells me the planner first demands an index scan there (it is possible i think that explain only operates on prepared SQL alone, disregarding value initial types and values). Doing a preparedStatement.setDate(value) instead, passing a java.sql.Date, uses the index and probably fully respects the Explain Plan that I have seen.
I assure you I have done many tests, with exact same query, parameter types and values, session origination and environment and changing one thing at a time. The only thing that being changed enables the query to make use of the DATE column index and return under a second, compared to tens of seconds of full table scan with expensive function calls, is to replace the preparedStatement.setTimestamp with setDate.
This can only be a JDBC bug, as far as I can tell. Do you know of this problem? What may be the cause?
As a note, since I need to continue to use that version of Hibernate on that spot, I momentarily worked around this apparent bug by modifying the SQL WHERE clause in order to provide the DATE value as to_date function output from a String bind, so doing date_col = to_date('YYYY-MM-DD', :value) instead of date_col = :value. Works fain, but just a work around.
Looking forward for your answer and suggestions,
Nicu MarasoiuA few remarks:
- Toad explain plans can be frought by implicit data type conversions.
Generally speaking everything is treated as a varchar2.
- You would need to show the plan from v$sql_plan.
- It would be a JDBC bug if you can show 'correct' behavior from sql*plus, making sure you actually do use bind variables of the correct type (so VARIABLE foo date prior to running the SQL, the SELECT referencing :foo)
- In the past I have observed strange CBO behavior because the date wasn't a complete date (ie time was missing). This can be rectified by function based indexes.
- You probably can enable event 10053 in your JDBC session, or event 10046 level 12
Sybrand Bakker
Senior Oracle DBA -
9i performance issues in windows 2000
I have imported the database from 8.0.5 to 9i recently and have been facing performance degradation although 9i is running in a better server with more memory and processor speed.
The same application, use to run more efficiently with lesser db_block_buffers & shared_pool parameters.
I have modified various parameters recommended to run 9i on win 2000 but still there is no great improvement.
One of the key area where I suspect the problem could be is, I see more wait in control file parallel writes/reads events.
Can someone help me out on this. Also it will be more useful if someone can help me to find a document to optimize win 2000 for 9i.
Thanks
RamDid you reanalyze all your objects using a large sample size?
With every upgrade a few queries could change plans and the plan changes are not always for the best. Just one or two poorly performing queries could adversely affect the entire system.
Have you reviewed your physical and logical IO hog lists to be sure that you just do not need to tune a couple of queries.
Remember also that at least 6 common init.ora parameters affect CBO choices and you should look very carefully at any changes made to the init.ora (db_file_multiblock_read_count, sort_area_size, hash_join_enabled, optimizer_index_caching, optimizer_index_cost_adj)
Finally a big part of overall database performance is disk layout and performance. Even with a faster cpu and more memory if your reduced the number of spindals available to support your db activity you could have shot yourself in the foot (so to speak).
HTH -- Mark D Powell -- -
[SOLVED]Xmonad bitmap workspace names not working?
I don't have a great deal of space on my screen, so I thought I'd save some by using icons instead of names for my workspaces. I have written my xmonad.hs as closely to every example I've found without redoing my entire xmonad.hs and it still puts '^p(5)^i(/home/nfarley88/.dzenicons/terminal.xbm)^p(5)' instead of the actual bitmap for the workspace title!
import XMonad
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.Man
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig
import XMonad.Hooks.UrgencyHook
import XMonad.Layout
import XMonad.Layout.Grid
import XMonad.Layout.Accordion
import XMonad.Layout.Tabbed
import XMonad.Layout.PerWorkspace
import XMonad.Layout.NoBorders
import XMonad.Layout.IM
import XMonad.Layout.Named
import XMonad.Actions.CycleWS
import XMonad.Actions.MouseGestures
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.Ratio ((%))
import Graphics.X11.Xlib
--import XMonad.Actions.NoBorders
import System.IO
fgColor = "#FF0000"
bgColor = "#000000"
wrapBitmap bitmap = "^p(5)^i(" ++ myBitmapsPath ++ bitmap ++ ")^p(5)"
w1 = wrapBitmap ".dzenicons/terminal.xbm"
w2 = wrapBitmap ".dzenicons/terminal.xbm"
w3 = wrapBitmap ".dzenicons/terminal.xbm"
terminality = (myWorkspaces !! 0)
internet = (myWorkspaces !! 1)
instantmessaging = (myWorkspaces !! 2)
myWorkspaces :: [String]
myBitmapsPath = "/home/nfarley88/"
myWorkspaces = clickable . (map dzenEscape) $ [ w1, w2, w3 ]
where clickable l = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
(i,ws) <- zip [1..] l,
let n = i ]
wrapBitmap bitmap = "^p(5)^i(" ++ myBitmapsPath ++ bitmap ++ ")^p(5)"
myManageHook = composeAll
[ className =? "Chromium" --> doShift internet
, className =? "Firefox" --> doShift internet
, className =? "Pidgin" --> doShift instantmessaging
--, appName =? "Buddy List" --> doFloat
--, manageDocks
myLayoutHookinternet = named "Tabbed" (noBorders tabs)
||| noBorders Full
||| Mirror tiled
||| tiled
where
tabs = tabbedBottom shrinkText oxyDarkTheme
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio -- see how there's 3 arguments to "Tall"
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 3/100
oxyDarkTheme = defaultTheme { inactiveBorderColor = "#aaaaaa"
, activeBorderColor = "#000000"
, activeColor = "#000"
, inactiveColor = "#000000"
, inactiveTextColor = "#aaaaaa"
, activeTextColor = "red"
, fontName = "xft:nu-8"
, decoHeight = 8
, urgentColor = "#ffff00"
, urgentTextColor = "#63b8ff"
myLayoutHook = avoidStruts $ terminal $ www $ instantmessage $ layoutHook defaultConfig
where
terminal = onWorkspace terminality ( Grid ||| Full)
www = onWorkspace (myWorkspaces !! 1) ( avoidStruts $ myLayoutHookinternet )
instantmessage = onWorkspace instantmessaging (withIM (1%7) sidepanel (Mirror (GridRatio (1/1))))
where
sidepanel = (ClassName "Pidgin") `And` (Role "buddy_list") `And` (Not (Role "convsersation")) --(Title "Buddy List")
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))
myStatusBar = "dzen2 -x '0' -y '0' -h '16' -w '590' -ta 'l' -fg '#FFFFFF' -bg '#000000' -fn '-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*'"
conkyStatsBar = "conky -c .conkyrc_console | dzen2 -x '590' -y '0' -h '16' -w '485' -ta 'r' -fg '#FFFFFF' -bg '#000000' -fn '-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*'"
conkyClockBar = "conky -c .conkyrc_clock | dzen2 -x '1075' -y '0' -h '16' -w '120' -ta 'r' -fg '#FFFFFF' -bg '#000000' -fn '-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*'"
myLogHook h = defaultPP
ppCurrent = wrapFgBg "#3EB5FF" "black" -- . pad
--, ppVisible = dzenColor "white" "black" . pad
--, ppHidden = dzenColor "white" "black" . pad
--, ppHiddenNoWindows = dzenColor "#444444" "black" . pad
, ppUrgent = wrapBg myUrgentWsBgColor--dzenColor "red" "yellow" -- . pad
, ppWsSep = "^bg(" ++ myBgBgColor ++ ")^r(1,15)^bg()"
, ppSep = " | "
, ppTitle = (\x -> " " ++ wrapFg myTitleFgColor x) --("" ++) . dzenColor "white" "black" . dzenEscape
, ppOutput = hPutStrLn h
where
wrapFgBg fgColor bgColor content= wrap ("^fg(" ++ fgColor ++ ")^bg(" ++ bgColor ++ ")") "^fg()^bg()" content
wrapFg color content = wrap ("^fg(" ++ color ++ ")") "^fg()" content
wrapBg color content = wrap ("^bg(" ++ color ++ ")") "^bg()" content
wrapBitmap bitmap = "^p(5)^i(" ++ myBitmapsPath ++ bitmap ++ ")^p(5)"
myTitleFgColor = "#FF0000"
myBgBgColor = "#00FF00"
myUrgentWsBgColor = "#00FF00"
main = do
--xmproc <- spawnPipe "/usr/bin/xmobar /home/nfarley88/.xmobarrc"
workspaceBar <- spawnPipe myStatusBar
spawn conkyStatsBar
spawn conkyClockBar
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
{ --workspaces = ["terminality", "internet", "IM", "4", "5", "6", "7", "8"]
workspaces = myWorkspaces
, manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
, layoutHook = myLayoutHook
, logHook = dynamicLogWithPP $ myLogHook workspaceBar
, modMask = mod4Mask --rebind Mod to the Windows key
, terminal = "urxvt"
, focusedBorderColor = "#000000"
--, mouseBindings = myMouseBindings
} --`additionalMouseBinding`
--[ ((mod4Mask .|. shiftMask, button3), mouseGesture gestures)
`additionalKeys`
[ ((mod4Mask .|. shiftMask, xK_z), spawn "xscreensaver-command -lock")
, ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
, ((mod4Mask, xK_u), focusUrgent )
, ((mod4Mask , xK_b ), sendMessage ToggleStruts)
, ((mod4Mask .|. shiftMask, xK_r), spawn "killall conky dzen2 && xmonad --recompile && xmonad --restart")
-- Application launching keys
, ((mod4Mask , xK_p ), spawn "dmenu_run")
, ((mod4Mask , xK_g ), spawn "chromium")
, ((mod4Mask , xK_f ), spawn "firefox")
, ((mod4Mask , xK_i ), spawn "pidgin")
] `additionalKeysP`
[ ("<XF86Calculator>", toggleWS)
The conky dzen has icons working. I cannot understand why it's not working!
Any help would be greatly appreciated.
PS some of the options are a bit strange (colour choices and such); I have some odd ones so I know what affects what.
Last edited by Rubbishbook (2011-08-20 00:15:52)I've fixed it! A combination of https://bbs.archlinux.org/viewtopic.php?id=108968 and http://pastebin.com/hXD9YDRW. For reference, here are the bits that changed:
myWorkspaces :: [String]
myBitmapsPath = "/home/nfarley88/"
myWorkspaces = clickable $ [ " ^i(/home/nfarley88/.dzenicons/terminal.xbm) ", " ^i(/home/nfarley88/.dzenicons/internet.xbm) ", " ^i(/home/nfarley88/.dzenicons/im.xbm) " ]
where clickable l = [ "^ca(1,xdotool key super+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
(i,ws) <- zip [1..] l,
let n = i ]
wrapBitmap bitmap = "^p(5)^i(" ++ myBitmapsPath ++ bitmap ++ ")^p(5)"
and
myLogHook h = defaultPP
{ ppOutput = hPutStrLn h
, ppSep = ""
, ppWsSep = ""
, ppCurrent = wrap "^fg(#ffffff)^bg(#60a0c0)" "^fg()^bg()"
, ppUrgent = wrap "^fg(#ffffff)^bg(#aff73e)" "^fg()^bg()"
, ppVisible = wrap "^fg(#b8bcb8)^bg(#484848)" "^fg()^bg()"
, ppHidden = wrap "^fg(#b8bcb8)^bg(#484848)" "^fg()^bg()"
, ppHiddenNoWindows = wrap "^fg(#484848)^bg(#000000)" "^fg()^bg()"
, ppTitle = wrap "^fg(#9d9d9d)^bg(#000000)" "^fg()^bg()" . wrap "" " ^fg(#a488d9)>^fg(#60a0c0)>^fg(#444444)>"
, ppLayout = wrap "^fg(#60a0c0)^bg(#000000)" "^fg()^bg()" -
Web module - Upload settings not saved in preset
Hi,
When creating a new preset in the Web module, the current upload settings are not saved. Which constantly leads to annoying mistakes when updating a site. I'm aware of bug reports that have been filed about this issue and the answer was "as designed". I tend to consider this as a bug.
Could someone explain this very strange design choice?
Thanks.
Patricknike air max 2011 is the most successful in recent years, a shoe. Not only because of the quality and 100% price guarantee and also we supply all nike shox welcomed by many customers from around the world, they often found that the length of the right to run. air jordan 2010 as the world's most popular shoe, its unique appearance, quiet feel, can show you better have a good taste, at the same time, nike shox torch can slso support cutting breathable, flexible design, open cage net cage covered by combination of insole molds to your feet in the quiet and the shape of the foot support. new jordan shoes 2010, jordan retro shoes can increase the length of the quiet end of the degree. The new damping system, combined with a suitable natural gait movement works, all are designed to bring you the most tranquil experience.Welcome to visit us:http://www.nikejordanlink.com .
-
Pixma MG7120 owners, is this sound normal?
I have a brand new Pixma MG7120 and I'm concerned it may be faulty, I did call Canon support and they claimed to test and unconvincingly said their printer made some noise too - although I will say it's hard to describe a noise over the phone.
Issue:
After powering on (or off) when it spins the rollers backwards slow and fast I hear a clicking/tapping sound, but only when the front door is closed, so it would seem to be something to do with the door latching mechanism.
Is this normal, it prints fine, I'm just concerned of part failure out of warranty if this isn't normal.
Thanks in advance.I'm surpised I didn't get more replies, but I feel happier at least someone else hears exacty the same thing... I wasn't sure the person at Canon support 100% understood what I was describing so I posted here to be sure. The noise does appear to come from the printer door hinge area, so must be something to do with the release mecanism - maybe it rachects when the rollers spin backwards as when forwards it would normally open the door for printing... Still a strange design choice.
My printer does print 100% fine.
Thanks for your reply. -
Support warranty Lenovo Miix 2 10" Touchscreen failure
Dear Lenovo Support!I have purchased 01 Lenovo Miix 2 form Amazon with S/N: QB08221114Now, the Touchscreen will stop respondingIn Control Panel, Device Manager show: I2C HID Device with note Yellow (picture att)I checked it in the device manager: Touchscreen is not listed under HID-Devices and the I2C HID-Device got an error I had try worked all help in topic: https://forums.lenovo.com/t5/Windows-based-Tablets/Re-Miix-2-Touchscreen-failure/td-p/1441509, it's not workingMy Lenovo Miix 2 is using in Vietnam, I had call Lenovo in Vietnam, not support Lenovo Miix 2 10". I want to Lenovo help me support warranty Miix 2. Best Regard Khanh Trinh
Hi
I have a same problem
For me it s not a touchad with this simple feature...
Is not possible to install Synaptics Drivers (standard touchpad...)...
It s a simple mouse device
It s a strange technical choice, but we have a tactil screen for that... (stupid monkey engineer)
Aida64 says; Mouse HID
Field Value
Mouse Properties
Mouse Name Souris HID
Mouse Buttons 2
Mouse Hand Right
Pointer Speed 1
Double-Click Time 500 msec
X/Y Threshold 6 / 10
Wheel Scroll Lines 3
Mouse Features
Active Window Tracking Disabled
ClickLock Disabled
Hide Pointer While Typing Enabled
Mouse Wheel Not Present
Move Pointer To Default Button Disabled
Pointer Trails Disabled
Sonar Disabled -
New N73 firmware v3.x support 2GB miniSD ?
Hi,
The music edition supports 2GB miniSD. Does the new v3.x N73 firmware support 2GB?
Thanks for the help.
Regards,
Alan
N73 RM-133
Firmware: v4.0735.3.0.2
SanDisk 2GB UltraII19-Dec-2006
06:37 AM
korngear wrote:
Yeah it fully supports.
But u need to consider 3 things.
1.Dont use PC suite for transfer data such as M VP and docs use USB Mode.
2. Keep at least 200 Mbyte of space bcoz of slow processor.
3. Buy card carefully.
Cheers
I'll agree with point 1, but point 2 I won't agree with.
The phone will hardly use the SD card for temporary storage - thats the purpose of the D drive/RAM. And if the N73 is using the SD storage for a swap file, then that seems like a strange design choice. You are using PC ideas on something that isn't directly applicable.
I was running a 2gig card on the original v2 firmware without any problems. No problems either on the V3 firmware either. -
Strange error in a multiple choice quiz
Hi - this is strange. I get no error statement BUT the third text option box does a false answer BUT not always - damn strange.
var qno=0;
var rnd1;
var rnd2;
tick.visible=false;
cross.visible=false;
var right_answers=0;
var wrong_answers=0;
Grammar.visible = false;
Grammar.addEventListener(MouseEvent.CLICK, GrammarAction);
function GrammarAction(eventObject:MouseEvent) {
Grammar.visible = false;
function change_question() {
if (tick.visible) {
right_answers++;
if (cross.visible) {
wrong_answers++;
if (qno==questions.length) {
gotoAndPlay(2);
} else {
tick.visible=false;
cross.visible=false;
rnd1=Math.ceil(Math.random()*4); // randomise the answers
rnd2=Math.ceil(Math.random()*questions.length)-1; // randomise the questions
q.text=questions[rnd2];
if (questions[rnd2]=="x") {
change_question();
questions[rnd2]="x";
enable_disable(1);
if (rnd1==1) {
opt1.text=answers[rnd2][0];
opt2.text=answers[rnd2][1];
opt3.text=answers[rnd2][2];
opt4.text=answers[rnd2][3];
if (rnd1==2) {
opt1.text=answers[rnd2][2];
opt2.text=answers[rnd2][0];
opt3.text=answers[rnd2][1];
opt4.text=answers[rnd2][3];
if (rnd1==3) {
opt1.text=answers[rnd2][1];
opt2.text=answers[rnd2][2];
opt3.text=answers[rnd2][0];
opt4.text=answers[rnd2][3];
if (rnd1==4) {
opt1.text=answers[rnd2][1];
opt2.text=answers[rnd2][2];
opt3.text=answers[rnd2][0];
opt4.text=answers[rnd2][3];
function enable_disable(a) {
if (a==0) {
shade1.mouseEnabled=false;
shade2.mouseEnabled=false;
shade3.mouseEnabled=false;
shade4.mouseEnabled=false;
if (a==1) {
shade1.mouseEnabled=true;
shade2.mouseEnabled=true;
shade3.mouseEnabled=true;
shade4.mouseEnabled=true;
change_question();
next_b.addEventListener(MouseEvent.CLICK, ButtonAction1);
function ButtonAction1(eventObject:MouseEvent) {
qno++;
change_question();
shade1.addEventListener(MouseEvent.CLICK, ButtonAction2);
shade2.addEventListener(MouseEvent.CLICK, ButtonAction3);
shade3.addEventListener(MouseEvent.CLICK, ButtonAction4);
shade4.addEventListener(MouseEvent.CLICK, ButtonAction5);
function ButtonAction2(eventObject:MouseEvent) {
enable_disable(0);
if (rnd1==1) {
tick.visible=true;
tick.y=shade1.y;
} else {
cross.visible=true;
cross.y=shade1.y;
Grammar.visible = true;
trace (rnd1);
function ButtonAction3(eventObject:MouseEvent) {
enable_disable(0);
if (rnd1==2) {
tick.visible=true;
tick.y=shade2.y;
} else {
cross.visible=true;
cross.y=shade2.y;
Grammar.visible = true;
trace (rnd1);
function ButtonAction4(eventObject:MouseEvent) {
enable_disable(0);
if (rnd1==3) {
tick.visible=true;
tick.y=shade3.y;
} else {
cross.visible=true;
cross.y=shade3.y;
Grammar.visible = true;
trace (rnd1);
function ButtonAction5(eventObject:MouseEvent) {
enable_disable(0);
if (rnd1==4) {
tick.visible=true;
tick.y=shade4.y;
} else {
cross.visible=true;
cross.y=shade4.y;
Grammar.visible = true;
trace (rnd1);
stop();Hi
Your rnd1...Try this..
trace(Math.ceil(Math.random()*3)+1);
Best regards
Peter -
K7N2 Delta ILSR Strange network problems
K7N2 Delta ILSR
2500+ AMD Barton
Radeon 9600 PRO
Windows XP
Hi there,
My network was working fine yesterday but now whenever I plug a cable into the onboard network card, my computer starts having these strange flucuations...Every few seconds the CPU usage jumps from 0% to about 50% which causes the system to freeze for a second, making it a real pain to do anything.
Does anyone have any idea whats causing this?
Thanks,
ShimQuote
Originally posted by deftonie
The kingston memory I have is on the memory compatibility list.
kingston removed k7n2 from their supported list.
kingston is not on the Good Memory Choices for ALL K7N2 nF2 released boards
for some reason msi have not removed kingston from their supported list.
Quote
Originally posted by pseudemys
So (and I'm addressing the question in particular to Raven): shoud i wait for a some kinda accident, crash, whatever sooner or later? I'm really scared about such things. You know... everything seems ok and then, suddenly, a nasty surprise. Which is the problem with kingston and k7n2 series? Further, I'd like to buy another 512 M stick and honestly it seems more sensible to me to mount two equal sticks. And I feel somewhat stuck...
a memory can be incompatible but still work.
alot of people buy any memory they can and throw in and it may work.
but it can start crashing after installing some program or updating bios or drivers.
thats the reason i posted the memtest program.
worry about a crash....no reason for that as you self said memtest reported no errors prime95 no errors and doom3 worked good.
kingston uses many different chips on their memory and its those chips that is the problem.
one guy found out that on the specific memory he bought kingston used 3 different chips on.
only 1 of them worked good on k7n2.
so a 33% chans of success in getting a good module is considered bad.
so write down the numbers on the chips and take it with you to the store and compare it to the memories they got. -
"Print" to pdf function missing in Word and other strange print behaviour
I'm trying to narrow down an issue I'm having with printing. I just noticed that the ability to creat a pdf in Word (print -> save as pdf) has disappeared. The button is now gone for some strange reason. I also noticed when trying to print a Keynote outline, when selecting ColorSync (print -> copies and pages [click and select ColorSync]) all my choices are gone (grayscale, b&w, etc.). Something's obviously wrong, but is it my printer software (HP 7310 aio) or OSX? My guess is the two issues are tied together.
Also, I haven't added any new software to my computer and all software updates have been installed.
Thanks in advance for any help!I have no idea whether this will help you or not, but IF some system software somewhow got corrupted, it should help.
1. Download either OS 10.4.10 COMBO update for Intel or OS 10.4.10 COMBO update for PPC
2. Run disk Utility Verify Disk
3. Run Disk Utility Repair Permissions
4. Reinstall OS 10.4.10 from the combo installer that you downloaded in (1).
5. Run Disk Utility Repair Permissions
6. Run Software Update to make sure you have all the security patches that were released since the COMBO update was released.
7. If you got downloads in (6), run Disk Utility Repair Permissions
8. See whether you are working now -
How to match the width of the choice box's dropdown to the choice box
Hi there,
I'm using a ChoiceBox control. The choice box seems to be composed of two parts: the box(displaying the current selection) and a context menu(dropdown). What I find strange is that the dropdown of the choice box(the context menu) has different size than the choice box by default:
http://manvox.com/javafx1.3/choice-box-dropdown.jpeg
I can style the choiceBox's box element by modifying the +.choice-box+ CSS selector. I can also style the dropdown using the +.context-menu+ and +.menu-item+ selectors.
How can I ensure that the dropdown has the same size of it's parent choice box and is aligned to it?@alabala: Please, if you can spare a few minutes, can you file a bug report for this at the JavaFX Jira issue tracker here: http://javafx-jira.kenai.com
If you set the 'project' to 'runtime', and 'component' to controls, it'll end up on my desk and I'll get the owner of the ChoiceBox control to take a look at it.
Thanks,
-- Jonathan -
Sp4 strange error: Browser goes for a spin
We have an application developed in iAS SP1. We installed SP4 recently and ported the application to SP4. We are facing a strange problem, which I'm describing below,
We have a login page named "home.jsp" which submits uid/password to a "LoginServlet" and authenticates/ authorises a user against an LDAP directory. We construct a "UserProfile" object and place it in session. The Login servlt forwards to a page index.html.
"index.html" is a page containing four frames ( heading, bottom. navigation menu and content frame ). Each frame has a src tag, pointing to a relative link in the web application.
Now here, is the problem,
After a fresh restart of the application, when we access the application for the first time, we get the home page correctly. Login is successful (from the kjs logs). index.jsp is called. Now the browser sends fresh request to each frame's source and hangs eternally.
We have no other choice but kill the browser. When we open a new instance of the browser and try the same again, the application works fine. I get all my pages properly as required.
Why is this happening?
I have another such page in my application which has roughly the same pattern, (servlet calling first.jsp. and first.jsp having three frame tags.). In this case the page works correctly for the first time i access it. From the next time the browser hangs and CPU load goes to 100%.
I see some pattern here, but cannot zero in on the problem.
Looks to be something to do with URL rewriting. The same code works without such problems on SP1 server. So it cant be a browser issue.I hear that there are some session concurrency problems in sp4. My first guess is that you are probably running into this bug. Because you have a frameset that is making several simultaneous requests to iAS (for each frame) you are probably getting into some sort of deadlock condition in the session manager.
Possible solutions (if this is the correct diagnosis):
* Contact tech support, who (I believe) has a patch for this concurrency problem.
* Enable sticky loadbalancing. This may relieve enough stress on the session manager to prevent the deadlock.
* Move to a different service pack or iAS 6.5
David
http://www.amazon.com/exec/obidos/ASIN/076454909X/
Maybe you are looking for
-
My mouse scrolls shows each line moving up instead of moving one line at a time annoying
Since downloading firefox 3.6 when I scroll down a page it shows each line moving up instead of just moving one line up its very annoying
-
Reg: Html file download from server
My requirement is download file from server. Am using jsp and servlet this. While downloading the file a dialog box with open, save and cancel option. When try to open html file it, open in the same window . Req: it should be open in seperate window
-
Page not rendering the values as expected...?
i had a situation in which on click of each and every link a common pop up will be called and the field values in the page are changed depending on the link clicked.... its working as expected for the first click when i click other link its showing t
-
Servlet - database connection usage
Hi I am writing a servlet based upon the multi thread model (default in many cases).In the servlet, I go to database 2 or 3 times per request and get data. I have broken down my main method into 4 methods. so method 1 calls method 2 with some params,
-
Printing with Epson/PS CS3- missing color sync options
When I try to print images from PS CS3 with my Epson Stylus Photo 2100, my print-box doesn't give me option "Color sync" anymore. I used to be able to choose whether to use Color sync or No Color management. I have downloaded all the latest drivers I