Range class
I just returned to Java after a year in Ruby.
Ruby had this handy loop for processing a range of numbers:
for i in 1..10 do /* handle i in here */ endSo I wrote a Range class. Now the equivalent java, very nearly as handy, is:
for (i: new Range(1,10) ) { /* handle i in here */ }No way to attach a file to these messages? Here's the code:
// \java\lib\Range.java
package library;
import java.util.Iterator;
/** Ruby: for i in 1..10 do ... end
* Java: for ( i : new Range(1,10) ) { ... }
* @author Martin Rinehart
public class Range implements Iterable<Integer> {
private int first, last;
public Range( int first, int last ) {
this.first = first;
this.last = last;
/** iterator() is the entire Iterable interface.
* @return An Iterator to iterate from first through last.
public Iterator<Integer> iterator() {
return new IRange( first, last );
} // end of class Range
/** An IRange is the Iterator that Range returns.
class IRange implements Iterator{
private int first, last, pointer;
/** Create a Range of ints between two integers.
* @param first Starting value.
* @param last Ending value (inclusive).
public IRange( int first, int last ) {
this.first = first;
this.last = last;
this.pointer = first;
/** Part of the Iterator interface.
* @return True until the end of the Range has been returned by next().
public boolean hasNext() {
boolean ret = pointer <= last;
// Reached end? Reset for another iteration.
if ( !ret ) pointer = first;
return ret;
/** Part of the Iterator interface.
* @return The next element in the range.
public Integer next() {
Integer ret = new Integer( pointer );
pointer++;
return ret;
/** Remove operation inappropriate for Range.
public void remove() {
throw new UnsupportedOperationException();
} // end of class IRange
// \java\lib\Range.java
MartinRinehart wrote:
How does making them final improve things?At the very least it documents intent. I would see Range as an immutable class and it makes sense to make that explicit.
Also, the JVM might be able to optimize a bit better if that information is available.
Why do you reject reuse. My first application for this wanted reusable ranges, so I added that little bit.I don't reject reusing the Range (i.e. the Iterable), that's already possible by calling iterator() twice. But you shouldn't reuse the Iterator.
An Iterator has a very specific life-cycle: It gets created, it iterates over its values, it returns false on hasNext() at some point (or throws a NoSuchElementException on next()) and from that point forward it will always return false on hasNext() (i.e. it is depleted).
Similar Messages
-
Unable to get the Text proerty of Range class
Hi,
I am using the Text property of Range class for excel template development using VSTO.While reloading the template i am getting the error "Unable to get the Text proerty of Range class".If i skip this line of code,i am getting similar kind of errors while accessing the properties of Range class(like Range.copy() ,Range.Locked, Range.EntireRow.Hidden).In all these cases i am getting the similar kind of error "unable to get the property of Range Class".
Waiting for a quick response...
Thanks in advance..Hi Besse,
Actully, the error is coming when i try to populate datatable with the the range values in one of the sheet.
I am using the below code.
//"wsInteropMetadata" is the sheet object.
//"RangeName" is the range name in the sheet.
rngConfig = wsInteropMetadata.get_Range("RangeName", Type.Missing);
for (int iRow = 1; iRow <= iRowCnt; iRow++)
dRNew = dTMetadataTable.NewRow();
for (int iCol = 1; iCol <= iColCnt; iCol++)
rngCell = (Excel.Range)rngConfig.Cells[iRow, iCol];
dRNew[iCol - 1] = rngCell.Text.ToString();
dTMetadataTable.Rows.Add(dRNew);
In the first load of the template,this code is working fine.In the reload i am getting the error at "rngCell.Text".If i see in quickwatch,most of the properties of "rngCell" object are throwing "System.Runtime.InteropServices.COMException".See the below exception information.
Exception Information
Exception Type: System.Runtime.InteropServices.COMException
Message: Unable to get the Text property of the Range class
Source: Microsoft Office Excel
ErrorCode: -2146827284
Thanks
Krishna. -
Assembling jar with dependent classes
For efficient Applet use I'd like to copy selectively into a jar my applet classes plus all classes they are dependent on from a set of libraries, thus producing the minimum jar library with which the applets can run (obviously classes which are part of the standard JRE are not to be included.
Now I can see, in outline, how to write a program to achieve this, but I have this feeling I've read about such a facility somewhere. I thought it was in ANT but I can't find it in the ANT documentation now. If someone knows of a utility (preferably free) that can do this please can you save me the trouble.Well, I think I've found one on sourceforge: http://genjar.sourceforge.net/
I've also found out how to get dependant classes from a .class file relatively simply. Class references are listed in the Constants Table which is near the start of the .class file format. I've written a piece of code which seems to fetch them OK.
package org.igis.assjar;
* <p>Read a class file stream and return all the referenced classes from the
* class.</p>
* @author malcolmm
public class GetClassRefs {
private static final byte CONSTANT_Class = 7;
private static final byte CONSTANT_FieldRef = 9;
private static final byte CONSTANT_MethodRef = 10;
private static final byte CONSTANT_InterfaceMethodRef = 11;
private static final byte CONSTANT_String = 8;
private static final byte CONSTANT_Integer = 3;
private static final byte CONSTANT_Float = 4;
private static final byte CONSTANT_Long = 5;
private static final byte CONSTANT_Double = 6;
private static final byte CONSTANT_NameAndType = 12;
private static final byte CONSTANT_Utfs = 1;
private static final int [] lengths = new int[13];
static {
lengths[CONSTANT_Class] = 3;
lengths[CONSTANT_FieldRef] = 5;
lengths[CONSTANT_MethodRef] = 5;
lengths[CONSTANT_InterfaceMethodRef] = 5;
lengths[CONSTANT_String] = 3;
lengths[CONSTANT_Integer] = 5;
lengths[CONSTANT_Float] = 5;
lengths[CONSTANT_Long] = 9;
lengths[CONSTANT_Double] = 9;
lengths[CONSTANT_NameAndType] = 5;
lengths[CONSTANT_Utfs] = 1;
private final static int magic = 0xcafebabe;
String mainClass;
String [] refs;
/** Creates a new instance of GetClassRefs */
public GetClassRefs(java.io.InputStream ins) throws java.io.IOException,java.lang.ClassFormatError {
java.io.DataInputStream in = new java.io.DataInputStream(ins);
Object[] constTable;
int nRefs;
if(in.readInt() != magic)
throw new ClassFormatError("Bad class magic");
in.skipBytes(4);
int cpCount = in.readUnsignedShort();
constTable = new Object[cpCount];
nRefs = 0;
for(int i = 1; i < cpCount; i++) {
int tag = in.readUnsignedByte();
switch(tag) {
case CONSTANT_Utfs:
String clsName = in.readUTF();
if(clsName.length() > 0) {
if(clsName.charAt(0) == '[') {
do
clsName = clsName.substring(1);
while(clsName.charAt(0) == '[');
if(clsName.charAt(0) == 'L' && clsName.endsWith(";"))
clsName = clsName.substring(1, clsName.length() - 1);
constTable[i] = clsName;
break;
case CONSTANT_Class:
nRefs++;
constTable[i] = new Integer(in.readUnsignedShort());
break;
case CONSTANT_Long:
case CONSTANT_Double:
i++;
in.skipBytes(8);
break;
default:
if(tag < 0 || tag >= lengths.length || lengths[tag] == 0)
throw new ClassFormatError("Invalid constants tag " + tag);
in.skipBytes(lengths[tag] - 1);
break;
in.skipBytes(2);
int thisClass = in.readUnsignedShort();
if(!(constTable[thisClass] instanceof Integer))
throw new ClassFormatError("Invalid main class index");
int cpp = ((Integer)constTable[thisClass]).intValue();
if(!(constTable[cpp] instanceof String))
throw new ClassFormatError("Invalid main class pointer");
mainClass = (String)constTable[cpp];
refs = new String[nRefs - 1];
int j = 0;
for(int i = 1; i < constTable.length; i++) {
Object entry = constTable;
if(entry instanceof Integer) {
int idx = ((Integer)entry).intValue();
if(idx < 1 || idx >= constTable.length)
throw new ClassFormatError("Out of range class reference");
if(constTable[idx] instanceof String) {
if(i == thisClass)
mainClass = (String)constTable[idx];
else
refs[j++] = (String)constTable[idx];
else
throw new ClassFormatError("Class reference not string");
public String getMainClass() {
return mainClass;
public String[] getRefs() throws ClassFormatError {
return refs; -
Regular Expression Pattern maching class to Validate Alphanumeric String
Hi
MY DB version is Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
I wanted to use the pattern maching classes given by oracle to check whether a given input string is alphanumeric or not.
Oracle 10g documentation says about the classes like [:digit:], [:alnum:] and many others.
http://www.dba-oracle.com/t_regular_expressions.htm
However these classes seems not to be working with my DB version.
Can someone tell me the DB version in which these classes works ?
Below is the code I am using to validate a input string.
SQL> CREATE OR REPLACE FUNCTION fn_is_alphanumeric
2 (
3 pi_value IN VARCHAR2
4 )
5 RETURN VARCHAR2
6 IS
7 lv_length NUMBER;
8 BEGIN
9 lv_length := length(pi_value);
10 IF ( REGEXP_LIKE(pi_value,'[:alnum:]{'||lv_length||'}')) THEN
11 RETURN 'TRUE';
12 ELSE
13 RETURN 'FALSE';
14 END IF;
15 END fn_is_alphanumeric;
16 /
Function created.
SQL>
SQL>
SQL> SELECT fn_is_alphanumeric('abc123') alpha FROM DUAL;
ALPHA
FALSE
SQL>
SQL>
SQL> CREATE OR REPLACE FUNCTION fn_is_alphanumeric
2 (
3 pi_value IN VARCHAR2
4 )
5 RETURN VARCHAR2
6 IS
7 lv_length NUMBER;
8 BEGIN
9 lv_length := length(pi_value);
10 IF ( REGEXP_LIKE(pi_value,'[A-z0-9]{'||lv_length||'}')) THEN
11 RETURN 'TRUE';
12 ELSE
13 RETURN 'FALSE';
14 END IF;
15 END fn_is_alphanumeric;
16 /
Function created.
SQL> SELECT fn_is_alphanumeric('abc123') alpha FROM DUAL;
ALPHA
TRUECharacter classes are working fine with regexp engine in your database version - simply change your function definition to:
CREATE OR REPLACE FUNCTION fn_is_alphanumeric
pi_value IN VARCHAR2
RETURN VARCHAR2
IS
lv_length NUMBER;
BEGIN
lv_length := length(pi_value);
IF ( REGEXP_LIKE(pi_value,'[[:alnum:]]{'||lv_length||'}')) THEN
RETURN 'TRUE';
ELSE
RETURN 'FALSE';
END IF;
END fn_is_alphanumeric;
/(brackets should be doubled as compared with your original version).
You can use both , range-based and class-based expressions, but you have to keep in mind, that range-based are nls dependant as opposite to class-based.
SQL> alter session set nls_sort=binary;
Session altered.
SQL> with t as (
2 select 'üäö123' s from dual
3 )
4 select
5 case
6 when regexp_like(s,'^[a-zA-Z0-9]+$') then 'Alphanumeric'
7 else 'Not Alphanumeric'
8 end range,
9 case
10 when regexp_like(s,'^[[:alnum:]]+$') then 'Alphanumeric'
11 else 'Not Alphanumeric'
12 end class
13 from t
14 /
RANGE CLASS
Not Alphanumeric Alphanumeric
SQL>
SQL> alter session set nls_sort='GERMAN';
Session altered.
SQL> with t as (
2 select 'üäö123' s from dual
3 )
4 select
5 case
6 when regexp_like(s,'^[a-zA-Z0-9]+$') then 'Alphanumeric'
7 else 'Not Alphanumeric'
8 end range,
9 case
10 when regexp_like(s,'^[[:alnum:]]+$') then 'Alphanumeric'
11 else 'Not Alphanumeric'
12 end class
13 from t
14 /
RANGE CLASS
Alphanumeric AlphanumericBest regards
Maxim -
I'm trying to use Nokia N9 with long range bluetooth headset (Motorola HX550).
It doesn't seems to me that it works up to 100 m.
Motorola stated that the phone must be BLUETOOTH® RANGE Class 1 compatible.
Is Nokia N9 Class 1 compatible?
Solved!
Go to Solution.Alexander_S wrote:
Is Nokia N9 Class 1 compatible?
Pretty sure that it isn't.
Happy to have helped forum with a Support Ratio = 42.5 -
Random number within TWO ranges
Is there anyway to select a random number within TWO ranges ? For example, a random number between the range (10 to 50) OR (100 to 200).
Thank you !This is a simple class that produces a number between a range:
class RandomRange
static java.util.Random random= new java.util.Random();
* Return an int between n1 and n2
static int getIntBetween(int n1, int n2) // n2 must be greater than n1 or n2-n1 must be positive
// get random number between 0 and the range(n2 - n1)
int result= random.nextInt(n2- n1);
// plus the offset
result += n1;
return result;
// return random.nextInt(n2 - n1) + n1;
// the result is n2 exclusive, to make it inclusive return (result + 1)
* Return a double between d1 and d2
static double getDoubleBetween(double d1, double d2)
return random.nextDouble()*(d2 - d1) + d1;
// d1 and d2 can be any value
* Return a float between f1 and f2
static float getFloatBetween(float f1, float f2)
// similar
}---------------------------------- -
Gtk Theme - Lack of Sepators makes it unuseable
hi!
i installed this really nice gtk-theme 'Elegant Brit' (http://www.gnome-look.org/content/show. … tent=74553) yesterday. it looks great, but has a big problem (in my eyes): there are no separators in the menu and in some applications. and this makes it unuseable for me. does anybody know how to fix this?
this is the gtkrc file:
# Elegant Brit by fmrbpensador (AKA What is in a name?)
# Mod of Elegant one, by Dzakusek, and Black and White, by Lyrae
# Inspired by the colors of GlossyFall, by Crimesaucer
include "panel.rc"
#include "menubar.rc"
include "menubar-black.rc"
gtk-icon-sizes = "panel-menu=24,24:panel=16,16:gtk-button=16,16:gtk-large-toolbar=24,24"
gtk-button-images = 1
gtk-menu-images = 1
gtk-panel-images = 0
style "default"
GtkWidget::interior_focus = 7
GtkWidget::focus_padding = 0
GtkButton::default_border = { 0, 0, 0, 0 }
GtkButton::default_outside_border = { 0, 0, 0, 0 }
GtkRange::trough_border = 0
GtkRange::slider_width = 15
GtkRange::stepper_size = 15
GtkVScale::slider_length = 11
GtkVScale::slider_width = 21
GtkHScale::slider_length = 11
GtkHScale::slider_width = 21
GtkPaned::handle_size = 6
GtkScrollbar::min_slider_length = 50
GtkCheckButton::indicator_size = 12
GtkCheckButton::indicator_spacing = 3
GtkMenuBar::internal_padding = 1
GtkOptionMenu::indicator_size = { 15, 8 }
GtkOptionMenu::indicator_spacing = { 8, 2, 0, 0 }
GtkStatusbar::shadow_type = GTK_SHADOW_NONE
GtkSpinButton::shadow_type = GTK_SHADOW_NONE
xthickness = 2
ythickness = 2
fg[NORMAL] = "#262729" # Metacity and mouseover, Most text
fg[ACTIVE] = "#262729"
fg[PRELIGHT] = "#FFFFFF"
fg[SELECTED] = "#FFFFFF"
fg[INSENSITIVE] = "#808080776c58"
bg[NORMAL] = "#FAFAFA" # Normal Background
bg[ACTIVE] = "#FAFAFA" # Mouseclicking, Tabs, active window list
bg[PRELIGHT] = "#FAFAFA" # Expand prelight bg
bg[SELECTED] = "#262729"
bg[INSENSITIVE] = "#FAFAFA"
base[NORMAL] = "#FAFAFA" # Background, most
base[ACTIVE] = "#e04613" # Menu active item in inactive window
base[PRELIGHT] = "#FAFAFA"
base[INSENSITIVE] = "#FAFAFA" # Inactive Entry bg
base[SELECTED] = "#e04613" # Menu active item in active window
text[NORMAL] = "#262729" # Text in window, arrows
text[INSENSITIVE] = "#262729" # Insensitive arrows
text[SELECTED] = "#FFFFFF" # Active text in active window
text[ACTIVE] = "#FFFFFF" # Active text in inactive window
text[PRELIGHT] = "#FFFFFF" # Text on Mouseover
engine "pixmap"
image
function = HANDLE
recolorable = TRUE
overlay_file = "Panel/handle-v.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
image
function = HANDLE
recolorable = TRUE
overlay_file = "Panel/handle-h.png"
overlay_stretch = FALSE
orientation = VERTICAL
####################### SHADOWS ############################x
image
function = SHADOW
shadow = IN
recolorable = FALSE
file = "Shadows/shadow-in.png"
border = { 3, 3, 2, 2 }
stretch = TRUE
image
function = SHADOW
shadow = OUT
recolorable = TRUE
file = "Shadows/shadow-out.png"
stretch = TRUE
image
function = SHADOW
shadow = ETCHED_IN
recolorable = TRUE
file = "Frame-Gap/frame1.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = SHADOW
shadow = ETCHED_OUT
recolorable = TRUE
file = "Shadows/shadow-none.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = SHADOW_GAP
recolorable = TRUE
file = "Frame-Gap/frame1.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
gap_start_file = "Frame-Gap/frame-gap-start.png"
gap_start_border = { 2, 0, 2, 0 }
gap_end_file = "Frame-Gap/frame-gap-end.png"
gap_end_border = { 0, 2, 2, 0 }
gap_side = TOP
image
function = VLINE
recolorable = TRUE
file = "Lines/line-v.png"
border = { 1, 1, 0, 0 }
stretch = TRUE
image
function = HLINE
recolorable = TRUE
file = "Lines/line-h.png"
border = { 0, 0, 1, 1 }
stretch = TRUE
# focus
image
function = FOCUS
recolorable = TRUE
file = "Others/focus.png"
border = { 6, 0, 6, 0 }
stretch = TRUE
# arrows
image
function = ARROW
recolorable = TRUE
overlay_file = "Arrows/arrow-up.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = UP
image
function = ARROW
state = NORMAL
recolorable = TRUE
overlay_file = "Arrows/arrow-down.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
image
function = ARROW
state = PRELIGHT
recolorable = TRUE
overlay_file = "Arrows/arrow-down-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
image
function = ARROW
state = ACTIVE
recolorable = TRUE
overlay_file = "Arrows/arrow-down-pressed.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
image
function = ARROW
state = INSENSITIVE
recolorable = TRUE
overlay_file = "Arrows/arrow-down-insens.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = DOWN
image
function = ARROW
recolorable = TRUE
overlay_file = "Arrows/arrow-left.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = LEFT
image
function = ARROW
recolorable = TRUE
overlay_file = "Arrows/arrow-right.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
arrow_direction = RIGHT
image
function = BOX
recolorable = TRUE
file = "Others/null.png"
border = { 3, 3, 3, 3 }
stretch = TRUE
class "GtkWidget" style "default"
style "inactivetext"
engine "mist"
widget_class "*.<GtkLabel>" style "inactivetext"
widget_class "*.<GtkCellLayout>" style "inactivetext"
#widget_class "*.<Combo>" style "inactivetext"
style "inactivetext2"
fg[NORMAL] = "#16778f"
fg[PRELIGHT] = "#6c9eab"
text[PRELIGHT] = "#6c9eab"
engine "mist"
widget_class "*.<GtkMenuItem>.*" style "inactivetext2"
#################### BUTTONS #######################
style "button" = "default"
engine "pixmap"
image
function = BOX
detail = "buttondefault"
recolorable = TRUE
file = "Buttons/button-default.png"
border = {4, 4, 4, 4}
stretch = TRUE
image
function = BOX
state = PRELIGHT
recolorable = TRUE
file = "Buttons/button-prelight.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
image
function = BOX
state = ACTIVE
file = "Buttons/button-pressed.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
image
function = BOX
state = INSENSITIVE
file = "Buttons/button-insensitive.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
image
function = BOX
file = "Buttons/button-normal.png"
border = { 4, 4, 4, 4 }
stretch = TRUE
style "checkradiobutton" {
engine "pixmap" {
image
function = FLAT_BOX
recolorable = TRUE
file = "Check-Radio/highlight.png"
border = { 2, 5, 2, 5 }
stretch = TRUE
class "GtkRadioButton" style "checkradiobutton"
class "GtkCheckButton" style "checkradiobutton"
style "optionmenu" = "default"
engine "pixmap"
image
function = BOX
recolorable = TRUE
state = PRELIGHT
file = "Combo/combo-prelight.png"
border = { 5, 5, 5, 5}
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = NORMAL
file = "Combo/combo-normal.png"
border = { 5, 5, 5, 5}
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = ACTIVE
file = "Combo/combo-pressed.png"
border = { 5, 5, 5, 5}
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = INSENSITIVE
file = "Combo/combo-inactive.png"
border = { 5, 5, 5, 5}
stretch = TRUE
image
function = TAB
state = INSENSITIVE
recolorable = TRUE
overlay_file = "Combo/combo-arrow-insens.png"
overlay_stretch = FALSE
image
function = TAB
recolorable = TRUE
state = NORMAL
overlay_file = "Combo/combo-arrow.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
image
function = TAB
recolorable = TRUE
state = PRELIGHT
overlay_file = "Combo/combo-arrow-prelight.png"
overlay_border = { 0, 0, 0, 0 }
overlay_stretch = FALSE
widget_class "*Combo*" style "optionmenu"
style "radiobutton" = "default"
engine "pixmap"
image
function = OPTION
recolorable = TRUE
state = NORMAL
shadow = OUT
overlay_file = "Check-Radio/option1.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = PRELIGHT
shadow = OUT
overlay_file = "Check-Radio/option3.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = ACTIVE
shadow = OUT
overlay_file = "Check-Radio/option3.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = INSENSITIVE
shadow = OUT
overlay_file = "Check-Radio/option1.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = NORMAL
shadow = IN
overlay_file = "Check-Radio/option2.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = PRELIGHT
shadow = IN
overlay_file = "Check-Radio/option4.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = ACTIVE
shadow = IN
overlay_file = "Check-Radio/option4.png"
overlay_stretch = FALSE
image
function = OPTION
recolorable = TRUE
state = INSENSITIVE
shadow = IN
overlay_file = "Check-Radio/option1.png"
overlay_stretch = FALSE
image
function = FLAT_BOX
recolorable = TRUE
stretch = TRUE
file = "Check-Radio/checklight.png"
border = { 2, 2, 2, 2 }
style "checkbutton" = "default"
engine "pixmap"
image
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = OUT
overlay_file = "Check-Radio/check1.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = OUT
overlay_file = "Check-Radio/check3.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = OUT
overlay_file = "Check-Radio/check3.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = OUT
overlay_file = "Check-Radio/check1.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = NORMAL
shadow = IN
overlay_file = "Check-Radio/check2.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = PRELIGHT
shadow = IN
overlay_file = "Check-Radio/check4.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = ACTIVE
shadow = IN
overlay_file = "Check-Radio/check4.png"
overlay_stretch = FALSE
image
function = CHECK
recolorable = TRUE
state = INSENSITIVE
shadow = IN
overlay_file = "Check-Radio/check1.png"
overlay_stretch = FALSE
image
function = FLAT_BOX
recolorable = TRUE
stretch = TRUE
file = "Check-Radio/checklight.png"
border = { 2, 2, 2, 2 }
####################### ENTRY #####################xx
style "entry" = "default"
xthickness = 3
ythickness = 2
GtkWidget::interior_focus = 0
engine "pixmap"
image
function = FOCUS
recolorable = TRUE
file = "Shadows/entry-shadow-in.png"
border = { 3,3,3,3 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
shadow = IN
state = NORMAL
file = "Shadows/entry-shadow-in.png"
border = { 3,3,3,3 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
shadow = OUT
state = NORMAL
file = "Shadows/text-entry.png"
border = { 3,3,3,3 }
stretch = TRUE
image
function = SHADOW
detail = "entry"
shadow = IN
recolorable = FALSE
file = "Shadows/text-entry.png"
border = { 3,3,3,3 }
stretch = TRUE
################x SPINBUTTONS ################
style "spinbutton" = "default"
xthickness = 3
ythickness = 1
GtkWidget::interior_focus = 0
engine "pixmap"
image
function = ARROW
############################# UP ######################xx
image
function = BOX
state = NORMAL
detail = "spinbutton_up"
recolorable = TRUE
file = "Spin/spin-up-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-up.png"
overlay_stretch = FALSE
image
function = BOX
state = PRELIGHT
detail = "spinbutton_up"
recolorable = TRUE
file = "Spin/spin-up-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-up-prelight.png"
overlay_stretch = FALSE
image
function = BOX
state = INSENSITIVE
detail = "spinbutton_up"
recolorable = TRUE
file = "Spin/spin-up-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-up-disable.png"
overlay_stretch = FALSE
image
function = BOX
state = ACTIVE
detail = "spinbutton_up"
recolorable = TRUE
file = "Spin/spin-up-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
########################x DOWN ########################
image
function = BOX
state = NORMAL
detail = "spinbutton_down"
recolorable = TRUE
file = "Spin/spin-down-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-down.png"
overlay_stretch = FALSE
image
function = BOX
state = PRELIGHT
detail = "spinbutton_down"
recolorable = TRUE
file = "Spin/spin-down-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-down-prelight.png"
overlay_stretch = FALSE
image
function = BOX
state = INSENSITIVE
detail = "spinbutton_down"
recolorable = TRUE
file = "Spin/spin-down-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-down-disable.png"
overlay_stretch = FALSE
image
function = BOX
state = ACTIVE
detail = "spinbutton_down"
recolorable = TRUE
file = "Spin/spin-down-bg.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
overlay_file = "Spin/arrow-down-prelight.png"
overlay_stretch = FALSE
########################## SPIN ENTRY ###########################
image
function = FOCUS
recolorable = TRUE
file = "Spin/text-entry-focus.png"
border = { 3,3,3,3 }
stretch = TRUE
image
function = SHADOW
detail = "entry"
shadow = IN
recolorable = FALSE
file = "Spin/text-entry.png"
border = { 3,3,3,3 }
stretch = TRUE
############################# SCROLLBAR ####################
style "scrollbar" = "default"
engine "pixmap"
image
function = BOX
recolorable = TRUE
detail = "trough"
file = "Scrollbars/trough-scrollbar-horiz.png"
border = { 19, 19, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
image
function = BOX
recolorable = TRUE
detail = "trough"
file = "Scrollbars/trough-scrollbar-vert.png"
border = { 2, 2, 19, 19 }
stretch = TRUE
orientation = VERTICAL
###########x SLIDERS ##################x
image
function = SLIDER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/slider-horiz.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
image
function = SLIDER
recolorable = TRUE
state = ACTIVE
shadow = IN
file = "Scrollbars/slider-horiz.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
image
function = SLIDER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/slider-horiz-prelight.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
image
function = SLIDER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/slider-horiz-insens.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
#############x verticals################xx
image
function = SLIDER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/slider-vert.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = VERTICAL
image
function = SLIDER
recolorable = TRUE
state = ACTIVE
shadow = IN
file = "Scrollbars/slider-vert.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = VERTICAL
image
function = SLIDER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/slider-vert-prelight.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = VERTICAL
image
function = SLIDER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/slider-vert-insens.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = VERTICAL
###########x END SLIDERS ##################x
########### Steppers ######################
#### UP #######
image
function = STEPPER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/stepper-up.png"
stretch = TRUE
arrow_direction = UP
image
function = STEPPER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/stepper-up-prelight.png"
stretch = TRUE
arrow_direction = UP
image
function = STEPPER
recolorable = TRUE
state = ACTIVE
file = "Scrollbars/stepper-up-prelight.png"
stretch = TRUE
arrow_direction = UP
image
function = STEPPER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/stepper-up-insens.png"
stretch = TRUE
arrow_direction = UP
######### DOWN ############
image
function = STEPPER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/stepper-down.png"
stretch = TRUE
arrow_direction = DOWN
image
function = STEPPER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/stepper-down-prelight.png"
stretch = TRUE
arrow_direction = DOWN
image
function = STEPPER
recolorable = TRUE
state = ACTIVE
file = "Scrollbars/stepper-down-prelight.png"
stretch = TRUE
arrow_direction = DOWN
image
function = STEPPER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/stepper-down-insens.png"
stretch = TRUE
arrow_direction = DOWN
############ RIGHT ################
image
function = STEPPER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/stepper-right.png"
stretch = TRUE
arrow_direction = RIGHT
image
function = STEPPER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/stepper-right-prelight.png"
stretch = TRUE
arrow_direction = RIGHT
image
function = STEPPER
recolorable = TRUE
state = ACTIVE
file = "Scrollbars/stepper-right-prelight.png"
stretch = TRUE
arrow_direction = RIGHT
image
function = STEPPER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/stepper-right-insens.png"
stretch = TRUE
arrow_direction = RIGHT
############### LEFT ###################
image
function = STEPPER
recolorable = TRUE
state = NORMAL
file = "Scrollbars/stepper-left.png"
stretch = TRUE
arrow_direction = LEFT
image
function = STEPPER
recolorable = TRUE
state = PRELIGHT
file = "Scrollbars/stepper-left-prelight.png"
stretch = TRUE
arrow_direction = LEFT
image
function = STEPPER
recolorable = TRUE
state = ACTIVE
file = "Scrollbars/stepper-left-prelight.png"
stretch = TRUE
arrow_direction = LEFT
image
function = STEPPER
recolorable = TRUE
state = INSENSITIVE
file = "Scrollbars/stepper-left-insens.png"
stretch = TRUE
arrow_direction = LEFT
##################### PROGRESSBAR ###################x
style "progressbar" {
fg[PRELIGHT] = "#FAFAFA"
xthickness = 1
ythickness = 1
engine "pixmap"
image
function = BOX
detail = "trough"
file = "ProgressBar/trough-progressbar-horiz.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = BOX
detail = "bar"
file = "ProgressBar/progressbar-horiz.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = HORIZONTAL
image
function = BOX
detail = "bar"
file = "ProgressBar/progressbar-vert.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
orientation = VERTICAL
############################# RANGE #######################
style "range" = "default"
engine "pixmap"
image
function = BOX
recolorable = TRUE
detail = "trough"
file = "Range/trough-horizontal.png"
border = { 10, 10, 1, 19 }
stretch = TRUE
orientation = HORIZONTAL
image
function = BOX
recolorable = TRUE
detail = "trough"
file = "Range/trough-vertical.png"
border = { 0, 19, 10, 10 }
stretch = TRUE
orientation = VERTICAL
############### the sliders ###############
image
function = SLIDER
recolorable = TRUE
state = NORMAL
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-horiz.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
image
function = SLIDER
recolorable = TRUE
state = PRELIGHT
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-horiz-prelight.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
image
function = SLIDER
recolorable = TRUE
state = INSENSITIVE
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-horiz.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
######################### VERTICAL ###########################
image
function = SLIDER
recolorable = TRUE
state = NORMAL
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-vert.png"
overlay_stretch = FALSE
orientation = VERTICAL
image
function = SLIDER
recolorable = TRUE
state = PRELIGHT
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-vert-prelight.png"
overlay_stretch = FALSE
orientation = VERTICAL
image
function = SLIDER
recolorable = TRUE
state = INSENSITIVE
file = "Range/null.png"
border = { 0, 0, 0, 0 }
stretch = TRUE
overlay_file = "Range/slider-vert.png"
overlay_stretch = FALSE
orientation = VERTICAL
################### TOOLBAR ###########################
style "toolbar"
engine "pixmap"
image
function = BOX
file = "Others/null.png"
border = { 4, 4, 4, 4}
stretch = TRUE
widget_class "*BonoboDockItem" style "toolbar"
class "*BonoboDockItem" style "toolbar"
widget_class "*HandleBox" style "toolbar"
class "*HandleBox" style "toolbar"
widget_class "*Toolbar" style "toolbar"
class "*Toolbar" style "toolbar"
##################### TOOLBAR BUTTONS ###############################
style "toolbuttons" = "default"
xthickness = 1
ythickness = 1
GtkWidget::focus_padding = 2
engine "pixmap" {
image
function = BOX
recolorable = TRUE
state = NORMAL
file = "Toolbar/toolbutton-normal.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = PRELIGHT
file = "Toolbar/toolbutton-prelight.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = ACTIVE
file = "Toolbar/toolbutton-pressed.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = INSENSITIVE
file = "Toolbar/toolbutton-normal.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
widget_class "*Tool*GtkToggleButton" style "toolbuttons"
widget_class "*Tool*GtkButton" style "toolbuttons"
################### PANEL GRAPHICS #################################
################### MENU #################################
style "menu" = "default"
xthickness = 2
ythickness = 1
engine "pixmap"
image
function = BOX
recolorable = TRUE
detail = "menu"
file = "Menu-Menubar/menu.png"
border = { 34, 3, 3, 3 }
stretch = TRUE
########################### Menuitem #############################
style "menuitem" = "default"
xthickness = 1
fg[PRELIGHT] = "#FFFFFF"
engine "pixmap"
image
function = BOX
recolorable = TRUE
file = "Menu-Menubar/menuitem.png"
border = { 10, 10, 10, 10 }
stretch = TRUE
image
function = ARROW
recolorable = TRUE
state = NORMAL
overlay_file = "Arrows/arrow-right-norm.png"
overlay_stretch = FALSE
arrow_direction = RIGHT
image
function = ARROW
recolorable = TRUE
state = PRELIGHT
overlay_file = "Arrows/arrow-right-prelight.png"
overlay_stretch = FALSE
arrow_direction = RIGHT
style "tearoffmenuitem" = "menuitem"
engine "pixmap"
image
function = ARROW
file = "Arrows/arrow-left.png"
stretch = TRUE
arrow_direction = LEFT
style "notebook" = "default"
xthickness = 2
ythickness = 2
engine "pixmap"
image
function = EXTENSION
recolorable = TRUE
state = ACTIVE
file = "Tabs/tab-bottom.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = TOP
image
function = EXTENSION
recolorable = TRUE
state = ACTIVE
file = "Tabs/tab-top.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = BOTTOM
image
function = EXTENSION
recolorable = TRUE
state = ACTIVE
file = "Tabs/tab-left.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = RIGHT
image
function = EXTENSION
recolorable = TRUE
state = ACTIVE
file = "Tabs/tab-right.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = LEFT
image
function = EXTENSION
recolorable = TRUE
file = "Tabs/tab-top-active.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = BOTTOM
image
function = EXTENSION
recolorable = TRUE
file = "Tabs/tab-bottom-active.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = TOP
image
function = EXTENSION
recolorable = TRUE
file = "Tabs/tab-left-active.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = RIGHT
image
function = EXTENSION
recolorable = TRUE
file = "Tabs/tab-right-active.png"
border = { 4,4,4,4}
stretch = TRUE
gap_side = LEFT
# How to draw boxes with a gap on one side (ie the page of a notebook)
image
function = BOX_GAP
recolorable = TRUE
file = "Tabs/notebook.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
gap_file = "Tabs/gap-top.png"
gap_border = { 5, 5, 5, 5 }
gap_start_file = "Others/null.png"
gap_start_border = { 0, 0, 0, 0 }
gap_end_file = "Others/null.png"
gap_end_border = { 0, 0, 0, 0 }
gap_side = TOP
image
function = BOX_GAP
recolorable = TRUE
file = "Tabs/notebook.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
gap_file = "Tabs/gap-bottom.png"
gap_border = { 5, 5, 5, 5 }
gap_start_file = "Others/null.png"
gap_start_border = { 0, 0, 0, 0 }
gap_end_file = "Others/null.png"
gap_end_border = { 0, 0, 0, 0 }
gap_side = BOTTOM
image
function = BOX_GAP
recolorable = TRUE
file = "Tabs/notebook.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
gap_file = "Tabs/gap-left.png"
gap_border = { 5, 5, 5, 5 }
gap_start_file = "Others/null.png"
gap_start_border = { 0, 0, 0, 0 }
gap_end_file = "Others/null.png"
gap_end_border = { 0, 0, 0, 0 }
gap_side = LEFT
image
function = BOX_GAP
recolorable = TRUE
file = "Tabs/notebook.png"
border = { 5, 5, 5, 5 }
stretch = TRUE
gap_file = "Tabs/gap-right.png"
gap_border = { 5, 5, 5, 5 }
gap_start_file = "Others/null.png"
gap_start_border = { 0, 0, 0, 0 }
gap_end_file = "Others/null.png"
gap_end_border = { 0, 0, 0, 0 }
gap_side = RIGHT
# How to draw the box of a notebook when it isnt attached to a tab
image
function = BOX
recolorable = TRUE
file = "Tabs/notebook.png"
border = { 6,6,6,6 }
stretch = TRUE
style "tooltips" = "default"
bg[NORMAL] = "#FAFAFA"
##################### RULER ##################
style "ruler" = "default"
engine "pixmap"
image
function = BOX
recolorable = TRUE
detail = "vruler"
file = "Others/ruler.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
detail = "hruler"
file = "Others/ruler.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
################# HANDLES ###################x
style "handlebox" = "default"
engine "pixmap"
image
function = HANDLE
recolorable = TRUE
overlay_file = "Others/null.png"
# overlay_file = "Handles/handle-v.png"
overlay_stretch = FALSE
orientation = VERTICAL
image
function = HANDLE
overlay_file = "Others/null.png"
# overlay_file = "Handles/handle-h.png"
overlay_stretch = FALSE
orientation = HORIZONTAL
style "flat" = "default"
engine "pixmap"
image
function = SHADOW
style "layout" = "default"
engine "pixmap"
image
function = SHADOW
detail = "entry"
shadow = IN
recolorable = FALSE
file = "Shadows/text.png"
border = { 1, 1, 1, 1 }
stretch = TRUE
image
function = BOX
detail = "button"
state = NORMAL
file = "Buttons/button-normal.png"
recolorable = TRUE
border = { 2, 3, 2, 3 }
stretch = TRUE
##################### STATUSBAR ###############################
style "statusbar" = "default"
# xthickness = 1
# ythickness = 1
engine "pixmap"
image
function = RESIZE_GRIP
recolorable = TRUE
#state = NORMAL
detail = "statusbar"
overlay_file = "Handles/resize-grip.png"
overlay_border = {0,0,0,0 }
overlay_stretch = FALSE
##################### LISTHEADERS ###################x
style "list-header"
#Comment out the ythickness setting below for thicker column headers.
#ythickness = 0
GtkTreeView::odd_row_color = "#F0F0F0"
GtkTreeView::even_row_color = "#FAFAFA"
# fg[NORMAL] = "#FAFAFA"
# text[NORMAL] = "#FAFAFA"
engine "pixmap"
#This image is used to draw the headers of columns in list views when they are
#not selected.
image
function = BOX
recolorable = TRUE
state = NORMAL
file = "ListHeaders/list_header.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
#This image is used to draw the column headers in list views when they are
#clicked.
image
function = BOX
recolorable = TRUE
state = PRELIGHT
file = "ListHeaders/list_header-prelight.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
#Does this do anything?
image
function = BOX
recolorable = TRUE
state = ACTIVE
file = "ListHeaders/list_header-pressed.png"
border = { 2, 2, 2, 2}
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = SELECTED
file = "ListHeaders/list_header-prelight.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = BOX
recolorable = TRUE
state = INSENSITIVE
file = "ListHeaders/list_header-insens.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
widget_class "*List" style "list-header"
widget_class "*GtkTree*" style "list-header"
widget_class "*GtkCList*" style "list-header"
#widget_class "*Tree*" style "list-header"
# This prevents Sodipodi from crashing while opening the
# Object-Style dialog.
style "unstyle"
engine ""
# recognizable pressed toggle buttons
# SPIcons seem to erase the background first. That's why I can't use
# the button style.
style "SPbutton"
engine "pixmap"
image
function = BOX
shadow = IN
recolorable = TRUE
file = "Shadows/shadow-out.png"
border = { 2, 2, 2, 2 }
stretch = TRUE
image
function = BOX
style "theme-etree" = "list-header"
bg[ACTIVE] = "#47494d"
# widget styles
class "GtkButton" style "button"
class "GtkRadioButton" style "radiobutton"
class "GtkRadioMenuItem" style "radiobutton"
class "GtkCheckButton" style "checkbutton"
class "GtkCheckMenuItem" style "checkbutton"
class "GtkOptionMenu" style "optionmenu"
class "GtkCombo*" style "optionmenu"
class "*Font*" style "optionmenu"
class "GtkEntry" style "entry"
class "GtkOldEditable" style "entry"
class "GtkSpinButton" style "spinbutton"
class "GtkRuler" style "ruler"
class "GtkScrollbar" style "scrollbar"
class "GtkStatusbar" style "statusbar"
class "GtkProgressBar" style "progressbar"
class "GtkRange" style "range"
class "GtkMenu" style "menu"
class "GtkMenuBar*" style "menubar"
widget_class "*MenuBar.*" style "menubar"
widget_class "*.<MenuItem>." style "menuitem"
class "GtkMenuItem" style "menuitem"
class "GtkTearoffMenuItem" style "menuitem"
class "GtkNotebook" style "notebook"
class "GtkToolbar" style "flat"
class "GtkHandleBox" style "handlebox"
class "GtkEventBox" style "flat"
class "GtkPaned" style "handlebox"
class "GtkLayout" style "layout"
class "SPButton" style "SPbutton"
widget "gtk-tooltips" style "tooltips"
# prevent Sodipodi from crashing
class "SPColorSlider" style "unstyle"
# Evolution fix
widget_class "*.ETree*" style "theme-etree"
thank you!There is a page on the Wiki specifically to address this issue: https://wiki.archlinux.org/index.php/Un … plications
Please search before posting. -
Apache POI Word support - workaround for a write bug
Hi all,
Just finished battling with the bugs in POI HWPF component. When searching forums, I found more questions than answers so I wanted to save others a significant effort until POI guys implement all the fixes.
Basically, the synopsis is, all the delete() methods are broken and replacing a string with a string of a different size corrupts the document. But insertAfter and insertBefore methods are mostly working.
I did not want to add a method to their class, because it will probably be overwritten. On the other hand, it is unknown when it will be fixed. Therefore, I had to go via reflection.
Here's the method, just attach it to your class and it's ready to use:
* Replaces text in the paragraph by a specified new text.
* @param r A paragraph to replace.
* @param newText A new text.
* @throws Exception if anything goes wrong
protected void setParagraphText(Paragraph r, String newText) throws Exception {
int length = r.text().length() - 1;
Class clRange = Range.class;
Field fldText = clRange.getDeclaredField("_text");
fldText.setAccessible(true);
Field fldTextEnd = clRange.getDeclaredField("_textEnd");
fldTextEnd.setAccessible(true);
Field fldStart = clRange.getDeclaredField("_start");
fldStart.setAccessible(true);
List textPieces = (List)fldText.get(r);
int _textEnd = fldTextEnd.getInt(r);
TextPiece t = (TextPiece)textPieces.get(_textEnd - 1);
StringBuffer sb = t.getStringBuffer();
int offset = fldStart.getInt(r);
int diff = newText.length() - length;
if (diff <= 0) {
// delete doesn't work properly yet, corrupting the documents.
// Therefore a quick and ugly workaround is to pad the new text with spaces
for (int i = 0; i < -diff; i++)
newText += " ";
sb.replace(offset, offset + length, newText);
} else {
// when the new text is longer, the old one must be replaced
// character by character, and the difference is added using
// insertAfter method
if (r.isInTable()) {
// more obstacles when working with tables though.
// Not only the regular insertAfter does not work,
// but also insertAfter called from a cell overruns cell delimiters.
// Needless to say, getTable(r) does not return the required table.
// Fortunately, there's a workaround
TableIterator ti = new TableIterator(range);
TableCell tc;
while (ti.hasNext()) {
Table tbl = ti.next();
for (int i = 0; i < tbl.numRows(); i++) {
TableRow tr = tbl.getRow(i);
for (int j = 0; j < tr.numCells(); j++) {
tc = tr.getCell(j);
if (tc.text().startsWith(sb.substring(offset, offset + length))) {
sb.replace(offset, offset + length,
newText.substring(newText.length() - length));
// only like this, otherwise cell delimiter will be run over
tc.insertBefore(newText.substring(0, newText.length() - length));
return;
sb.replace(offset, offset + length, newText.substring(0, length));
} else {
sb.replace(offset, offset + length, newText.substring(0, length));
r.insertAfter(newText.substring(length));
}user8984775 wrote:
My requirement is I need to apply this formula for Entire column to achieve the need like
When user enters data in col2 (B) of greater than the number specified in col1 (A) and then show the ErrorBox.
I am able to get the formula working through code only for first cell as per below code... I want it to dynamically apply for the entire column. Well I'm certainly no expert on POI, but that looks like a very odd formula to me.
When you "pull" a formula down a column, Excel automatically changes the formula for each row, but because you've fixed both the column AND the row ($A$1), it'll be the same in all cases.
I don't know if POI allows that sort of "auto-generate" for formulas, but if so try something like $A1 instead; otherwise I suspect you'll need a different formula for each row.
Winston -
Indentifying different fonts in Excel programatically
I have text data with different font in Excel sheet now I want that program should identify that font and apply automatically to that data. any one help plz ......
thanksYou can use the
Font property of the Range class, for example:
Sub CheckFont()
Range("A1").Select
' Determine if the font name for selected cell is Arial.
If Range("A1").Font.Name = "Arial" Then
MsgBox "The font name for this cell is 'Arial'"
Else
MsgBox "The font name for this cell is not 'Arial'"
End If
End Sub
Also you may find the
Font property of the Characters class helpful, for example:
With Worksheets("Sheet1").Range("B1")
.Value = "New Title"
.Characters(5, 5).Font.Bold = True
End With -
OLE Automation: catch error message
Hi, Experts.
I am interested in catching error messages after OLE commands. I show it in Excel example, but interested in general:
REPORT zlcka_ole .
TYPE-POOLS ole2.
DATA h_excel TYPE ole2_object.
DATA h_workbooks TYPE ole2_object.
DATA h_workbook TYPE ole2_object.
DATA h_range TYPE ole2_object.
CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
SET PROPERTY OF h_excel 'Visible' = 1.
CALL METHOD OF h_excel 'Workbooks' = h_workbooks.
CALL METHOD OF h_workbooks 'Add' = h_workbook.
CALL METHOD OF h_excel 'Rows' = h_range
EXPORTING
#1 = 3.
SET PROPERTY OF h_range 'Name' = 'TEST'.
CALL METHOD OF h_excel 'Range' = h_range
EXPORTING
#1 = 'TEST'.
SET PROPERTY OF h_range 'Hidden' = 1.
WRITE / sy-subrc.
WRITE / sy-msgli.
I turned on debuging Automation of GUI and execute program.
Result was sy-subrc = 3 sy-msgli = ''
But in logfile(directory: SapWorkDir) I find:
<275=Automation(Error): *****************************ERROR OCCURED IN MODULE: [CALL METHOD OF 12 ('[Excel.Application.10]') 'Range' Imode 1002]*********************************************************************************************************************************
<275=Automation(Error): PROGRAM_ID |MODULE_NAME |METHOD_NAME |ERROR DESCRIPTION |VERSION |GUI VERSION |MODULE_PATH |
<275=Automation(Error): ********************************************************************************************************************************************************************************************************************************************************
<275=Automation(Error): CALL METHOD OF 12 ('[Excel.Application.10]') 'Range' Imode 1002 |Class name not found |Hidden |Unable to set the Hidden property of the Range class |Version info not found |6206.6.64.970 |Module doesnot exist |
<275=Automation(Error): ********************************************************************************************************************************************************************************************************************************************************
Is there anybody know how to get that error message <i>"Unable to set the Hidden property of the Range class"</i>?
SAP Version: 4.6CHi,
in SRM all messages are stored in the message handler. Also when you set a message within the check BAdI, the message is stored later in the message handler. If you want to know when a message is moved to the message handler, just set a break-point in FM BBP_PD_MSG_ADD.
Regards -
Unable to create PivotChart from build in function in PowerPivot
Hello,
I am trying to create Pivot chart from the ribbon in Power Pivot, but receive the following message:
Unable to get the PivotTable property of the Range class
============================
Call Stack:
============================
Server stack trace:
Exception rethrown at [0]:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at Microsoft.AnalysisServices.XLHost.Addin.GeminiRibbon.InsertPivot(String connectionString, String cubeName, MultiObjectsReportType reportType)
I tried to do it with the file which I downloaded from tutorial on MS site "ContosoSales", if has access database which I downloaded in PowerPivot and it worked with this file, but does not work with any PowerPivot files I create myself which linked
to excel file as I do not have any database software on my computer. I can create a Pivot chart manually linking it from Excel sheet to Pivot table but wanted it to be working when i need quickly create dashboard with several charts.
Thanks
NataliaHi Natalia,
I would like to collect more information to troubleshoot this issue. Please help to collect the following information:
What're the versions of SQL Server PowerPivot for Excel and SQL Server?
What's the underlying data source for your PowerPivot data model.
Is this issue only occured for you?
Currently, please refer to the following actions to deal with this issue:
Please try to reinstall PowerPivot for Excel to see if this helps. If so, please install the latest PowerPivot version.
We can design a small PowerPivot data model to perform a test to reproduce this issue. Please let us know the result.
Hope this helps.
Regards,
Elvis Long
TechNet Community Support -
Hi,
Our workbook has three sheets and each sheet is having one query. i written vba code to remove '#' values. But when i am refresh all the queries at once i am getting the runtime error
run-time error '1004'
select method of Range class failed
How to solve this:
<b>this is my code:</b>
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
If queryID = "SAPBEXq0001" Or queryID = "SAPBEXq0002" Or queryID = "SAPBEXq0003" Then
resultArea.Select
'Remove '#'
Selection.Cells.Replace What:="#", Replacement:="", LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=True
'Remove 'Not assigned'
'Selection.Cells.Replace What:="Not assigned", Replacement:="", LookAt:=xlWhole, _ SearchOrder:=xlByRows, MatchCase:=False, MatchByte:=True
End IfPlease tell us which line creates the error.
If it is the
resultArea.Select?
If so try following:
I assume SAPBEXq0001 to be on sheet 1, SAPBEXq0002 on sheet 2, SAPBEXq0003 on sheet 3 for this coding:
Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
Dim SheetNo As Double
Select Case queryID
Case "SAPBEXq0001"
SheetNo = 1
Case "SAPBEXq0002"
SheetNo = 2
Case "SAPBEXq0003"
SheetNo = 3
Case Else
Exit Sub
End Select
'Remove '#'
Sheets(SheetNo).resultArea.Replace What:="#", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, _
MatchByte:=True
'Remove 'Not assigned'
Sheets(SheetNo).resultArea.Replace What:="Not assigned", Replacement:="", _
LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False, _
MatchByte:=True
End Sub
hope that helps (and runs, not tested.
br
Andreas
Message was edited by:
Andreas Hinrichs -
Connect to PowerPivot engine with c#
I am developing an addin for excel 2010 and i need to interact with powerpivot engine. Is that possible? Can i interact with powerpivot engine using AMO? How can i do that? I am trying with this
Server
svr = new
Server();
svr.Connect(
"Initial Catalog=Microsoft_SQLServer_AnalysisServices;Data Source=$Embedded$");
but, i have "data source must be specified..." error.
ThanksJavier
Correct. Based on the article of Chris Webb I created the VBA routine as below to get an insight of what's available as information in PowerPivot. Like view DBSCHEMA_COLUMNS I use to retrieve the columns for each measuregroup and store it on a worksheet.
Than I can start commenting the meaning of the columns. Sometimes formulas are more complex (when you start with ranking tricks) and need some extra explanation. Currently there are not a lot of people who have much experience
with PowerPivot. This way we lower the barrier and help them to understand more easily the DAX functions and its power.
The problem with the DMV's I have are the missing formulas. This would be handy, now is copy and paste which is realy time consuming.
PS. I used the information of view MDSCHEMA_MEASURES to retrieve PowerPivot data from other workbooks.
The routine below creates for each DMV defined a worksheet.
Some views will return an error:
DISCOVER_DIMENSION_STAT - Application-defined or object-defined error
DISCOVER_INSTANCES - Application-defined or object-defined error
DISCOVER_LOCKS - Application-defined or object-defined error
DISCOVER_PARTITION_DIMENSION_STAT - Application-defined or object-defined error
DISCOVER_PARTITION_STAT - Application-defined or object-defined error
DISCOVER_PERFORMANCE_COUNTERS - Application-defined or object-defined error
MDSCHEMA_PROPERTIES - Cannot rename a sheet to the same name as another sheet, a referenced object library or a workbook referenced by Visual Basic.
MDSCHEMA_PROPERTIES - Select method of Range class failed
Sub GetDMVs()
On Error GoTo Errhandler
Dim sDMV As String
Dim sSheet As String
Dim vArray(56) As String
vArray(0) = "DBSCHEMA_CATALOGS"
vArray(1) = "DBSCHEMA_COLUMNS"
vArray(2) = "DBSCHEMA_PROVIDER_TYPES"
vArray(3) = "DBSCHEMA_TABLES"
vArray(4) = "DISCOVER_COMMAND_OBJECTS"
vArray(5) = "DISCOVER_COMMANDS"
vArray(6) = "DISCOVER_CONNECTIONS"
vArray(7) = "DISCOVER_DB_CONNECTIONS"
vArray(8) = "DISCOVER_DIMENSION_STAT"
vArray(9) = "DISCOVER_ENUMERATORS"
vArray(10) = "DISCOVER_INSTANCES"
vArray(11) = "DISCOVER_JOBS"
vArray(12) = "DISCOVER_KEYWORDS"
vArray(13) = "DISCOVER_LITERALS"
vArray(14) = "DISCOVER_LOCKS"
vArray(15) = "DISCOVER_MASTER_KEY"
vArray(16) = "DISCOVER_MEMORYGRANT"
vArray(17) = "DISCOVER_MEMORYUSAGE"
vArray(18) = "DISCOVER_OBJECT_ACTIVITY"
vArray(19) = "DISCOVER_OBJECT_MEMORY_USAGE"
vArray(20) = "DISCOVER_PARTITION_DIMENSION_STAT"
vArray(21) = "DISCOVER_PARTITION_STAT"
vArray(22) = "DISCOVER_PERFORMANCE_COUNTERS"
vArray(23) = "DISCOVER_PROPERTIES"
vArray(24) = "DISCOVER_SCHEMA_ROWSETS"
vArray(25) = "DISCOVER_SESSIONS"
vArray(26) = "DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS"
vArray(27) = "DISCOVER_STORAGE_TABLE_COLUMNS"
vArray(28) = "DISCOVER_STORAGE_TABLES"
vArray(29) = "DISCOVER_TRACE_COLUMNS"
vArray(30) = "DISCOVER_TRACE_DEFINITION_PROVIDERINFO"
vArray(31) = "DISCOVER_TRACE_EVENT_CATEGORIES"
vArray(32) = "DISCOVER_TRACES"
vArray(33) = "DISCOVER_TRANSACTIONS"
vArray(34) = "DMSCHEMA_MINING_COLUMNS"
vArray(35) = "DMSCHEMA_MINING_FUNCTIONS"
vArray(36) = "DMSCHEMA_MINING_MODEL_CONTENT"
vArray(37) = "DMSCHEMA_MINING_MODEL_CONTENT_PMML"
vArray(38) = "DMSCHEMA_MINING_MODEL_XML"
vArray(39) = "DMSCHEMA_MINING_MODELS"
vArray(40) = "DMSCHEMA_MINING_SERVICE_PARAMETERS"
vArray(41) = "DMSCHEMA_MINING_SERVICES"
vArray(42) = "DMSCHEMA_MINING_STRUCTURE_COLUMNS"
vArray(43) = "DMSCHEMA_MINING_STRUCTURES"
vArray(44) = "MDSCHEMA_CUBES"
vArray(45) = "MDSCHEMA_DIMENSIONS"
vArray(46) = "MDSCHEMA_FUNCTIONS"
vArray(47) = "MDSCHEMA_HIERARCHIES"
vArray(48) = "MDSCHEMA_INPUT_DATASOURCES"
vArray(49) = "MDSCHEMA_KPIS"
vArray(50) = "MDSCHEMA_LEVELS"
vArray(51) = "MDSCHEMA_MEASUREGROUP_DIMENSIONS"
vArray(52) = "MDSCHEMA_MEASUREGROUPS"
vArray(53) = "MDSCHEMA_MEASURES"
vArray(54) = "MDSCHEMA_MEMBERS"
vArray(55) = "MDSCHEMA_PROPERTIES"
vArray(56) = "MDSCHEMA_SETS"
For i = 0 To UBound(vArray, 1)
sDMV = vArray(i)
sSheet = Mid(sDMV, InStr(sDMV, "_") + 1, 22)
Sheets.Add
ActiveSheet.Name = sSheet
Worksheets(sSheet).Range("A1").Select
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
"OLEDB;Provider=MSOLAP.4;Persist Security Info=True;Initial Catalog=Microsoft_SQLServer_AnalysisServices;Data Source=$Embedded$;MDX Compatibility=1;Safety Options=2;MDX Missing Member Mode=Error;Optimize
Response=3;Cell Error Mode=TextValue"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdDefault
'.CommandText = Array("select TABLE_NAME, COLUMN_NAME from $system." & sDMV)
.CommandText = Array("select * from $system." & sDMV)
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = sDMV
.Refresh BackgroundQuery:=False
End With
Next i
Exit Sub
Errhandler:
Debug.Print sDMV & " - " & Err.Description
Resume Next
End Sub
Eddy N. -
Vaibility of RTP relay server using JMF
Hello!
I am thinking of making an RTP server that would just relay the streams received from single user to multiple users.
I want to ask following questions:
1- Is it viable to make such a Server using JMF?
2- If it is, then how should I proceed?
3- Should I need to create Processor for each recieved stream at the server or just cloning the DataSource received and sending them using separate RTPManagers would solve my problem?
4- Is cloning of data source needed at all?
I am asking this before doing any coding just in case if it is not possible than you warn me ,and because I had real bad experiences while cloning the data source and this server, I think depends on cloning.
Else, I want some help regarding code. I would highly appreciate some code snippets.
Thanks in advance.
Thanks!
P.S.: captfoss, Are you listening?Now some simple questions from a novice, thats me:I will answer them out of order
3- Are these terms specific to JMF or are they general Networking terms?They are general networking terms.
2- What is difference b/w unicasting and multicasting?Uni = Latin prefix for "one".
Multi = Latin prefix for "many"
Broad = Latin prefix for "all" (okay, this one is probably not true, but...)
unicast = sending data to a single recipient.
broadcast = sending data to all recipients.
multicasting = sending data to many recipients.
It deals with how the underlaying UDP packets are handled.
Unicast addresses the packets to a specific host, so all other hosts that receive those packets go "Not for me" and ignore it.
Broadcast addresses the packets to a special IP address, the broadcast ip, so all hosts that receive it say "Oh, this is a broadcast message so it's for me"
Multicast addresses the packets to an IP address in a special range (Class D addresses), and all hosts can opt to join in to the "multicast session". If they join the multicast session, it basiclly means when they receive packets addressed to any multicast addresses that they have joined the session of, they will consider those packets to be "for them".
1- What exactly is multicasting in JMF?JMF multicasting is basiclly where the "host" can send out a single stream, and any number of "clients" can receive the stream.
4- How multicasting is handled at Transmitter and Reciever side using JMF, some java statements please.Multicasting is almost handled "automaticlly".
It's handled by giving the transmitter a multicast IP address to send to. "224.123.123.123" is an example of the one I always used for testing (because it was easy to remember). Transmitting multicast packets is handled automaticlly.
Receiving multicast packets requires a little special handling.
From AVReceive2.java
if( ipAddr.isMulticastAddress()) {
// local and remote address pairs are identical:
localAddr= new SessionAddress( ipAddr,
session.port,
session.ttl);
destAddr = new SessionAddress( ipAddr,
session.port,
session.ttl);
} else {
localAddr= new SessionAddress( InetAddress.getLocalHost(),
session.port);
destAddr = new SessionAddress( ipAddr, session.port);
}The main difference here is that your "local" address isn't going to be LocalHost address, "127.0.0.1", it's going to be the multicast address.
And you should define the TTL (time to live) for the SessionAddress because multicast packets can only travel a certain number of "hops" (number of times forwarded).
But honestly, I'm pretty sure I ripped that IF statement out and multicasting still worked (but I define the TTL for unicast as well, so bear that in mind...)
Ignoring all of the stuff above, multicasting is a great idea for a local LAN application where there are no routers between the host and the clients. If you've got a router between them, then the router may not forward the multicast packets and your stream may never get to the remote clients.
That's why in my project, which is web based, clients attempt to get the multicast packets and if they fail at that, then they request a unicast from my server. -
Hi,
I have a workbook with different slides. I use a macro for different things but one of them is for hidding some columns in the slide in which I have the result from the query. In one of the slides there is a table in which, it´s supposed, the user should enter data. Each time the user enter data, when I try to run the workbook, afterwards, I get the next error message.
Error 1004. Error in the Select method from the Range Class.
Does anyone know anything about this error message ?
Thanks and regards
JesúHi,
I guess its Microsoft Excel error message, try debugging the macro and you will find why the error is coming from.
Regards.
Maybe you are looking for
-
How to create ONE graph with a growth trend ($ and %)?
I would like to create a graph with a growth trend. The graph should have figures on one side reflecting $ values and on the other % growth. I cannot make a trend on the same graph and usually spend ages adding another graph to show the trend. I end
-
How do i customize a drop down list in adobe muse without css?
I'm a complete noob when it comes to anything code. I tinker in design and ran into a bit of a snag. I'm involved in a start up and our coders apparently only know how to code software and back end stuff. I know it's probably not the best route to go
-
FPN: No ESID found error while invoking BEx iviews for Reports.
Hi Everybody, We have a federated portal network [FPN] setup. We are EP 7 SP15 for both Consumer portal and BI producer portal. The content is delivered to users via RRA Remote Role Assignment ] in consumer portal for BI portal roles from Producer bi
-
Text box ignores spacing settings.
Using the tooltip widget. Put a text box inside the trigger. Set left, right, and bottom spacing. Right spacing is ignored. Removed spacing and used left and right margin instead (in text settings), this worked fine. See attached images, showing how
-
Executing SQL statements in container managed transactions
I have a problem when using TopLink 9.0.3 with WebSphere 4, Oracle 9i and J2EE container managed transactions. The data changing SQL statements are executed at the end of the (container managed) transaction, not at the time of the calls to UnitOfWork