Search Results

Search found 736 results on 30 pages for 'degenerate dimension'.

Page 5/30 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • HPCM 11.1.2.x - Outline Optimisation for Calculation Performance

    - by Jane Story
    When an HPCM application is first created, it is likely that you will want to carry out some optimisation on the HPCM application’s Essbase outline in order to improve calculation execution times. There are several things that you may wish to consider. Because at least one dense dimension for an application is required to deploy from HPCM to Essbase, “Measures” and “AllocationType”, as the only required dimensions in an HPCM application, are created dense by default. However, for optimisation reasons, you may wish to consider changing this default dense/sparse configuration. In general, calculation scripts in HPCM execute best when they are targeting destinations with one or more dense dimensions. Therefore, consider your largest target stage i.e. the stage with the most assignment destinations and choose that as a dense dimension. When optimising an outline in this way, it is not possible to have a dense dimension in every target stage and so testing with the dense/sparse settings in every stage is the key to finding the best configuration for each individual application. It is not possible to change the dense/sparse setting of individual cloned dimensions from EPMA. When a dimension that is to be repeated in multiple stages, and therefore cloned, is defined in EPMA, every instance of that dimension has the same storage setting. However, such manual changes may not be preserved in all cases. Please see below for full explanation. However, once the application has been deployed from EPMA to HPCM and from HPCM to Essbase, it is possible to make the dense/sparse changes to a cloned dimension directly in Essbase. This can be done by editing the properties of the outline in Essbase Administration Services (EAS) and manually changing the dense/sparse settings of individual dimensions. There are two methods of deployment from HPCM to Essbase from 11.1.2.1. There is a “replace” deploy method and an “update” deploy method: “Replace” will delete the Essbase application and replace it. If this method is chosen, then any changes made directly on the Essbase outline will be lost. If you use the update deploy method (with or without archiving and reloading data), then the Essbase outline, including any manual changes you have made (i.e. changes to dense/sparse settings of the cloned dimensions), will be preserved. Notes If you are using the calculation optimisation technique mentioned in a previous blog to calculate multiple POVs (https://blogs.oracle.com/pa/entry/hpcm_11_1_2_optimising) and you are calculating all members of that POV dimension (e.g. all months in the Period dimension) then you could consider making that dimension dense. Always review Block sizes after all changes! The maximum block size recommended in the Essbase Database Administrator’s Guide is 100k for 32 bit Essbase and 200k for 64 bit Essbase. However, calculations may perform better with a larger than recommended block size provided that sufficient memory is available on the Essbase server. Test different configurations to determine the most optimal solution for your HPCM application. Please note that this blog article covers HPCM outline optimisation only. Additional performance tuning can be achieved by methodically testing database settings i.e data cache, index cache and/or commit block settings. For more information on Essbase tuning best practices, please review these items in the Essbase Database Administrators Guide. For additional information on the commit block setting, please see the previous PA blog article https://blogs.oracle.com/pa/entry/essbase_11_1_2_commit

    Read the article

  • How to recover data from Dell dimension 9150 RAID 0 on another system?

    - by Adam
    I have a Dell Dimension 9150 which has failed. I'm trying to recover the data. It had two SATA 250GB drives in RAID 0 configuration. I'm trying to use a shuttle PC running Windows7 to recover the data from the drives which contained an XP boot volume. I just want the data, it doesn't have to boot. What program would I need to rebuild / interrogate the drives (one of them is failing the onboard hardware test)? What drivers would I need to install? Windows7 sees the drive as one partition but doesn't see volume information. Ubuntu can see the drive as one partition and also can tell what the drive is called, but can't access the data Any help appreciated!! :)

    Read the article

  • regular expression to get the filename from urls

    - by robert
    if i have a textbox with severals urls rapidshare.com/files/379028801/Fringe.S02E19.HDTV.XviD-LOL.avi rapidshare.com/files/379182651/Fringe.S02E19.720p.HDTV.X264-DIMENSION.mkv rapidshare.com/files/379180004/Fringe.S02E19.720p.HDTV.X264-DIMENSION.part1.rar rapidshare.com/files/379180444/Fringe.S02E19.720p.HDTV.X264-DIMENSION.part2.rar rapidshare.com/files/379181251/Fringe.S02E19.720p.HDTV.X264-DIMENSION.part3.rar rapidshare.com/files/379181743/Fringe.S02E19.720p.HDTV.X264-DIMENSION.part4.rar i need a the files name and its urls textbox2.text = Fringe.S02E19.HDTV.XviD-LOL.avi from here rapidshare.com/files/379028801/Fringe.S02E19.HDTV.XviD-LOL.avi Fringe.S02E19.720p.HDTV.X264-DIMENSION.part1.rar from here rapidshare.com/files/379180004/Fringe.S02E19.720p.HDTV.X264-DIMENSION.part1.rar and so on Thanks :)

    Read the article

  • Create user in Oracle 11g with same priviledges as in Oracle 10g XE

    - by Álvaro G. Vicario
    I'm a PHP developer (not a DBA) and I've been working with Oracle 10g XE for a while. I'm used to XE's simplified user management: Go to Administration/ Users/ Create user Assign user name and password Roles: leave the default ones (connect and resource) Privileges: click on "Enable all" to select the 11 possible ones Create This way I get a user that has full access to its data and no access to everything else. This is fine since I only need it to develop my app. When the app is to be deployed, the client's DBAs configure the environment. Now I have to create users in a full Oracle 11g server and I'm completely lost. I have a new concept (profiles) and there're like 20 roles and hundreds of privileges in various categories. What steps do I need to complete in Oracle Enterprise Manager in order to obtain a user with the same privileges I used to assign in XE? ==== UPDATE ==== I think I'd better provide a detailed explanation so I make myself clearer. This is how I create a user in 10g XE: Roles: [X] CONNECT [X] RESOURCE [ ] DBA Direct Asignment System Privileges: [ ] CREATE DATABASE LINK [ ] CREATE MATERIALIZED VIEW [ ] CREATE PROCEDURE [ ] CREATE PUBLIC SYNONYM [ ] CREATE ROLE [ ] CREATE SEQUENCE [ ] CREATE SYNONYM [ ] CREATE TABLE [ ] CREATE TRIGGER [ ] CREATE TYPE [ ] CREATE VIEW I click on Enable All and I'm done. This is what I'm asked when doing the same in 11g: Profile: (*) DEFAULT ( ) WKSYS_PROF ( ) MONITORING_PROFILE Roles: CONNECT: [ ] Admin option [X] Default value Edit List: AQ_ADMINISTRATOR_ROLE AQ_USER_ROLE AUTHENTICATEDUSER CSW_USR_ROLE CTXAPP CWM_USER DATAPUMP_EXP_FULL_DATABASE DATAPUMP_IMP_FULL_DATABASE DBA DELETE_CATALOG_ROLE EJBCLIENT EXECUTE_CATALOG_ROLE EXP_FULL_DATABASE GATHER_SYSTEM_STATISTICS GLOBAL_AQ_USER_ROLE HS_ADMIN_ROLE IMP_FULL_DATABASE JAVADEBUGPRIV JAVAIDPRIV JAVASYSPRIV JAVAUSERPRIV JAVA_ADMIN JAVA_DEPLOY JMXSERVER LOGSTDBY_ADMINISTRATOR MGMT_USER OEM_ADVISOR OEM_MONITOR OLAPI_TRACE_USER OLAP_DBA OLAP_USER OLAP_XS_ADMIN ORDADMIN OWB$CLIENT OWB_DESIGNCENTER_VIEW OWB_USER RECOVERY_CATALOG_OWNER RESOURCE SCHEDULER_ADMIN SELECT_CATALOG_ROLE SPATIAL_CSW_ADMIN SPATIAL_WFS_ADMIN WFS_USR_ROLE WKUSER WM_ADMIN_ROLE XDBADMIN XDB_SET_INVOKER XDB_WEBSERVICES XDB_WEBSERVICES_OVER_HTTP XDB_WEBSERVICES_WITH_PUBLIC System Privileges: <Empty> Edit List: ACCESS_ANY_WORKSPACE ADMINISTER ANY SQL TUNING SET ADMINISTER DATABASE TRIGGER ADMINISTER RESOURCE MANAGER ADMINISTER SQL MANAGEMENT OBJECT ADMINISTER SQL TUNING SET ADVISOR ALTER ANY ASSEMBLY ALTER ANY CLUSTER ALTER ANY CUBE ALTER ANY CUBE DIMENSION ALTER ANY DIMENSION ALTER ANY EDITION ALTER ANY EVALUATION CONTEXT ALTER ANY INDEX ALTER ANY INDEXTYPE ALTER ANY LIBRARY ALTER ANY MATERIALIZED VIEW ALTER ANY MINING MODEL ALTER ANY OPERATOR ALTER ANY OUTLINE ALTER ANY PROCEDURE ALTER ANY ROLE ALTER ANY RULE ALTER ANY RULE SET ALTER ANY SEQUENCE ALTER ANY SQL PROFILE ALTER ANY TABLE ALTER ANY TRIGGER ALTER ANY TYPE ALTER DATABASE ALTER PROFILE ALTER RESOURCE COST ALTER ROLLBACK SEGMENT ALTER SESSION ALTER SYSTEM ALTER TABLESPACE ALTER USER ANALYZE ANY ANALYZE ANY DICTIONARY AUDIT ANY AUDIT SYSTEM BACKUP ANY TABLE BECOME USER CHANGE NOTIFICATION COMMENT ANY MINING MODEL COMMENT ANY TABLE CREATE ANY ASSEMBLY CREATE ANY CLUSTER CREATE ANY CONTEXT CREATE ANY CUBE CREATE ANY CUBE BUILD PROCESS CREATE ANY CUBE DIMENSION CREATE ANY DIMENSION CREATE ANY DIRECTORY CREATE ANY EDITION CREATE ANY EVALUATION CONTEXT CREATE ANY INDEX CREATE ANY INDEXTYPE CREATE ANY JOB CREATE ANY LIBRARY CREATE ANY MATERIALIZED VIEW CREATE ANY MEASURE FOLDER CREATE ANY MINING MODEL CREATE ANY OPERATOR CREATE ANY OUTLINE CREATE ANY PROCEDURE CREATE ANY RULE CREATE ANY RULE SET CREATE ANY SEQUENCE CREATE ANY SQL PROFILE CREATE ANY SYNONYM CREATE ANY TABLE CREATE ANY TRIGGER CREATE ANY TYPE CREATE ANY VIEW CREATE ASSEMBLY CREATE CLUSTER CREATE CUBE CREATE CUBE BUILD PROCESS CREATE CUBE DIMENSION CREATE DATABASE LINK CREATE DIMENSION CREATE EVALUATION CONTEXT CREATE EXTERNAL JOB CREATE INDEXTYPE CREATE JOB CREATE LIBRARY CREATE MATERIALIZED VIEW CREATE MEASURE FOLDER CREATE MINING MODEL CREATE OPERATOR CREATE PROCEDURE CREATE PROFILE CREATE PUBLIC DATABASE LINK CREATE PUBLIC SYNONYM CREATE ROLE CREATE ROLLBACK SEGMENT CREATE RULE CREATE RULE SET CREATE SEQUENCE CREATE SESSION CREATE SYNONYM CREATE TABLE CREATE TABLESPACE CREATE TRIGGER CREATE TYPE CREATE USER CREATE VIEW CREATE_ANY_WORKSPACE DEBUG ANY PROCEDURE DEBUG CONNECT SESSION DELETE ANY CUBE DIMENSION DELETE ANY MEASURE FOLDER DELETE ANY TABLE DEQUEUE ANY QUEUE DROP ANY ASSEMBLY DROP ANY CLUSTER DROP ANY CONTEXT DROP ANY CUBE DROP ANY CUBE BUILD PROCESS DROP ANY CUBE DIMENSION DROP ANY DIMENSION DROP ANY DIRECTORY DROP ANY EDITION DROP ANY EVALUATION CONTEXT DROP ANY INDEX DROP ANY INDEXTYPE DROP ANY LIBRARY DROP ANY MATERIALIZED VIEW DROP ANY MEASURE FOLDER DROP ANY MINING MODEL DROP ANY OPERATOR DROP ANY OUTLINE DROP ANY PROCEDURE DROP ANY ROLE DROP ANY RULE DROP ANY RULE SET DROP ANY SEQUENCE DROP ANY SQL PROFILE DROP ANY SYNONYM DROP ANY TABLE DROP ANY TRIGGER DROP ANY TYPE DROP ANY VIEW DROP PROFILE DROP PUBLIC DATABASE LINK DROP PUBLIC SYNONYM DROP ROLLBACK SEGMENT DROP TABLESPACE DROP USER ENQUEUE ANY QUEUE EXECUTE ANY ASSEMBLY EXECUTE ANY CLASS EXECUTE ANY EVALUATION CONTEXT EXECUTE ANY INDEXTYPE EXECUTE ANY LIBRARY EXECUTE ANY OPERATOR EXECUTE ANY PROCEDURE EXECUTE ANY PROGRAM EXECUTE ANY RULE EXECUTE ANY RULE SET EXECUTE ANY TYPE EXECUTE ASSEMBLY EXPORT FULL DATABASE FLASHBACK ANY TABLE FLASHBACK ARCHIVE ADMINISTER FORCE ANY TRANSACTION FORCE TRANSACTION FREEZE_ANY_WORKSPACE GLOBAL QUERY REWRITE GRANT ANY OBJECT PRIVILEGE GRANT ANY PRIVILEGE GRANT ANY ROLE IMPORT FULL DATABASE INSERT ANY CUBE DIMENSION INSERT ANY MEASURE FOLDER INSERT ANY TABLE LOCK ANY TABLE MANAGE ANY FILE GROUP MANAGE ANY QUEUE MANAGE FILE GROUP MANAGE SCHEDULER MANAGE TABLESPACE MERGE ANY VIEW MERGE_ANY_WORKSPACE ON COMMIT REFRESH QUERY REWRITE READ ANY FILE GROUP REMOVE_ANY_WORKSPACE RESTRICTED SESSION RESUMABLE ROLLBACK_ANY_WORKSPACE SELECT ANY CUBE SELECT ANY CUBE DIMENSION SELECT ANY DICTIONARY SELECT ANY MINING MODEL SELECT ANY SEQUENCE SELECT ANY TABLE SELECT ANY TRANSACTION UNDER ANY TABLE UNDER ANY TYPE UNDER ANY VIEW UNLIMITED TABLESPACE UPDATE ANY CUBE UPDATE ANY CUBE BUILD PROCESS UPDATE ANY CUBE DIMENSION UPDATE ANY TABLE Object Privileges: <Empty> Add: Clase Java Clases de Trabajos Cola Columna de Tabla Columna de Vista Espacio de Trabajo Función Instantánea Origen Java Paquete Planificaciones Procedimiento Programas Secuencia Sinónimo Tabla Tipos Trabajos Vista Consumer Group Privileges: <Empty> Default Consumer Group: (*) None Edit List: AUTO_TASK_CONSUMER_GROUP BATCH_GROUP DEFAULT_CONSUMER_GROUP INTERACTIVE_GROUP LOW_GROUP ORA$AUTOTASK_HEALTH_GROUP ORA$AUTOTASK_MEDIUM_GROUP ORA$AUTOTASK_SPACE_GROUP ORA$AUTOTASK_SQL_GROUP ORA$AUTOTASK_STATS_GROUP ORA$AUTOTASK_URGENT_GROUP ORA$DIAGNOSTICS SYS_GROUP And, of course, I wonder what options I should pick.

    Read the article

  • Window's content disappears when minimized

    - by Carmen Cojocaru
    I have a simple class that draws a line when mouse dragging or a dot when mouse pressing(releasing). When I minimize the application and then restore it, the content of the window disappears except the last dot (pixel). I understand that the method super.paint(g) repaints the background every time the window changes, but the result seems to be the same whether I use it or not. The difference between the two of them is that when I don't use it there's more than a pixel painted on the window, but not all my painting. How can I fix this? Here is the class. package painting; import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionAdapter; import javax.swing.JFrame; import javax.swing.JPanel; class CustomCanvas extends Canvas{ Point oldLocation= new Point(10, 10); Point location= new Point(10, 10); Dimension dimension = new Dimension(2, 2); CustomCanvas(Dimension dimension){ this.dimension = dimension; this.init(); addListeners(); } private void init(){ oldLocation= new Point(0, 0); location= new Point(0, 0); } public void paintLine(){ if ((location.x!=oldLocation.x) || (location.y!=oldLocation.y)) { repaint(location.x,location.y,1,1); } } private void addListeners(){ addMouseListener(new MouseAdapter(){ @Override public void mousePressed(MouseEvent me){ oldLocation = location; location = new Point(me.getX(), me.getY()); paintLine(); } @Override public void mouseReleased(MouseEvent me){ oldLocation = location; location = new Point(me.getX(), me.getY()); paintLine(); } }); addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(MouseEvent me){ oldLocation = location; location = new Point(me.getX(), me.getY()); paintLine(); } }); } @Override public void paint(Graphics g){ super.paint(g); g.setColor(Color.red); g.drawLine(location.x, location.y, oldLocation.x, oldLocation.y); } @Override public Dimension getMinimumSize() { return dimension; } @Override public Dimension getPreferredSize() { return dimension; } } class CustomFrame extends JPanel { JPanel displayPanel = new JPanel(new BorderLayout()); CustomCanvas canvas = new CustomCanvas(new Dimension(200, 200)); public CustomFrame(String titlu) { canvas.setBackground(Color.white); displayPanel.add(canvas, BorderLayout.CENTER); this.add(displayPanel); } } public class CustomCanvasFrame { public static void main(String args[]) { CustomFrame panel = new CustomFrame("Test Paint"); JFrame f = new JFrame(); f.add(panel); f.pack(); SwingConsole.run(f, 700, 700); } }

    Read the article

  • SSAS dimension source table changed - how to propagate changes to analysis server?

    - by Phil
    Hi, Sorry if the question isn't phrased very well but I'm new to SSAS and don't know the correct terms. I have changed the name of a table and its columns. I am using said table as a dimension for my cube, so now the cube won't process. Presumably I need to make updates in the analysis server to reflect changes to the source database? I have no idea where to start - any help gratefully received. Thanks Phil

    Read the article

  • Number of 0/1 colorings of a m X n rectangle which have no monochromatic subrectangles with both dimension greater than 1.

    - by acbruptenda
    A m x n rectangular matrix is give, and each cell is to be filled with 0/1 colour. I have to find number of colorings possible so that there is no monochromatic coloured (same colour) sub-rectangle whose both dimension is greater than 1 (eg - 2x2, 2x3,4x3) I have found a slightly different version of it here But they have said nothing about the algorithm. So, I am looking for an algorithm here !!

    Read the article

  • The new workflow management of Oracle´s Hyperion Planning: Define more details with Planning Unit Hierarchies and Promotional Paths

    - by Alexandra Georgescu
    After having been almost unchanged for several years, starting with the 11.1.2 release of Oracle´s Hyperion Planning the Process Management has not only got a new name: “Approvals” now is offering the possibility to further split Planning Units (comprised of a unique Scenario-Version-Entity combination) into more detailed combinations along additional secondary dimensions, a so called Planning Unit Hierarchy, and also to pre-define a path of planners, reviewers and approvers, called Promotional Path. I´d like to introduce you to changes and enhancements in this new process management and arouse your curiosity for checking out more details on it. One reason of using the former process management in Planning was to limit data entry rights to one person at a time based on the assignment of a planning unit. So the lowest level of granularity for this assignment was, for a given Scenario-Version combination, the individual entity. Even if in many cases one person wasn´t responsible for all data being entered into that entity, but for only part of it, it was not possible to split the ownership along another additional dimension, for example by assigning ownership to different accounts at the same time. By defining a so called Planning Unit Hierarchy (PUH) in Approvals this gap is now closed. Complementing new Shared Services roles for Planning have been created in order to manage set up and use of Approvals: The Approvals Administrator consisting of the following roles: Approvals Ownership Assigner, who assigns owners and reviewers to planning units for which Write access is assigned (including Planner responsibilities). Approvals Supervisor, who stops and starts planning units and takes any action on planning units for which Write access is assigned. Approvals Process Designer, who can modify planning unit hierarchy secondary dimensions and entity members for which Write access is assigned, can also modify scenarios and versions that are assigned to planning unit hierarchies and can edit validation rules on data forms for which access is assigned. (this includes as well Planner and Ownership Assigner responsibilities) Set up of a Planning Unit Hierarchy is done under the Administration menu, by selecting Approvals, then Planning Unit Hierarchy. Here you create new PUH´s or edit existing ones. The following window displays: After providing a name and an optional description, a pre-selection of entities can be made for which the PUH will be defined. Available options are: All, which pre-selects all entities to be included for the definitions on the subsequent tabs None, manual entity selections will be made subsequently Custom, which offers the selection for an ancestor and the relative generations, that should be included for further definitions. Finally a pattern needs to be selected, which will determine the general flow of ownership: Free-form, uses the flow/assignment of ownerships according to Planning releases prior to 11.1.2 In Bottom-up, data input is done at the leaf member level. Ownership follows the hierarchy of approval along the entity dimension, including refinements using a secondary dimension in the PUH, amended by defined additional reviewers in the promotional path. Distributed, uses data input at the leaf level, while ownership starts at the top level and then is distributed down the organizational hierarchy (entities). After ownership reaches the lower levels, budgets are submitted back to the top through the approval process. Proceeding to the next step, now a secondary dimension and the respective members from that dimension might be selected, in order to create more detailed combinations underneath each entity. After selecting the Dimension and a Parent Member, the definition of a Relative Generation below this member assists in populating the field for Selected Members, while the Count column shows the number of selected members. For refining this list, you might click on the icon right beside the selected member field and use the check-boxes in the appearing list for deselecting members. -------------------------------------------------------------------------------------------------------- TIP: In order to reduce maintenance of the PUH due to changes in the dimensions included (members added, moved or removed) you should consider to dynamically link those dimensions in the PUH with the dimension hierarchies in the planning application. For secondary dimensions this is done using the check-boxes in the Auto Include column. For the primary dimension, the respective selection criteria is applied by right-clicking the name of an entity activated as planning unit, then selecting an item of the shown list of include or exclude options (children, descendants, etc.). Anyway in order to apply dimension changes impacting the PUH a synchronization must be run. If this is really necessary or not is shown on the first screen after selecting from the menu Administration, then Approvals, then Planning Unit Hierarchy: under Synchronized you find the statuses Yes, No or Locked, where the last one indicates, that another user is just changing or synchronizing the PUH. Select one of the not synchronized PUH´s (status No) and click the Synchronize option in order to execute. -------------------------------------------------------------------------------------------------------- In the next step owners and reviewers are assigned to the PUH. Using the icons with the magnifying glass right besides the columns for Owner and Reviewer the respective assignments can be made in the ordermthat you want them to review the planning unit. While it is possible to assign only one owner per entity or combination of entity+ member of the secondary dimension, the selection for reviewers might consist of more than one person. The complete Promotional Path, including the defined owners and reviewers for the entity parents, can be shown by clicking the icon. In addition optional users might be defined for being notified about promotions for a planning unit. -------------------------------------------------------------------------------------------------------- TIP: Reviewers cannot change data, but can only review data according to their data access permissions and reject or promote planning units. -------------------------------------------------------------------------------------------------------- In order to complete your PUH definitions click Finish - this saves the PUH and closes the window. As a final step, before starting the approvals process, you need to assign the PUH to the Scenario-Version combination for which it should be used. From the Administration menu select Approvals, then Scenario and Version Assignment. Expand the PUH in order to see already existing assignments. Under Actions click the add icon and select scenarios and versions to be assigned. If needed, click the remove icon in order to delete entries. After these steps, set up is completed for starting the approvals process. Start, stop and control of the approvals process is now done under the Tools menu, and then Manage Approvals. The new PUH feature is complemented by various additional settings and features; some of them at least should be mentioned here: Export/Import of PUHs: Out of Office agent: Validation Rules changing promotional/approval path if violated (including the use of User-defined Attributes (UDAs)): And various new and helpful reviewer actions with corresponding approval states. About the Author: Bernhard Kinkel started working for Hyperion Solutions as a Presales Consultant and Consultant in 1998 and moved to Hyperion Education Services in 1999. He joined Oracle University in 2007 where he is a Principal Education Consultant. Based on these many years of working with Hyperion products he has detailed product knowledge across several versions. He delivers both classroom and live virtual courses. His areas of expertise are Oracle/Hyperion Essbase, Oracle Hyperion Planning and Hyperion Web Analysis.

    Read the article

  • Distributing a function over a single dimension of an array in MATLAB?

    - by Alex Feinman
    I often find myself wanting to collapse an n-dimensional matrix across one dimension, and can't figure out if there is a concise incantation I can use to do this. For example, when parsing an image, I often want to do something like this. (Note! Illustrative example only. I know about rgb2gray for this specific case.) img = imread('whatever.jpg'); s = size(img); for i=1:s(1) for j=1:s(2) bw_img = mean(img(i,j,:)); end end I would love to express this as something like: bw = on(color, 3, @mean); or bw(:,:,1) = mean(color); Is there a short way to do this?

    Read the article

  • C++, is it possible to obtain the dimension of an array?

    - by aaa
    hi. Suppose I have some pointer, which I want to reinterpret as static dimension array reference: double *p; double (&r)[4] = ?(p); // some construct? // clarify template< size_t N> void function(double (&a)[N]); ... double *p; function(p); // this will not work. // I would like to cast p as to make it appear as double[N] Is it possible to do so? how do I do it?

    Read the article

  • Data Warehouse ETL slow - change primary key in dimension?

    - by Jubbles
    I have a working MySQL data warehouse that is organized as a star schema and I am using Talend Open Studio for Data Integration 5.1 to create the ETL process. I would like this process to run once per day. I have estimated that one of the dimension tables (dimUser) will have approximately 2 million records and 23 columns. I created a small test ETL process in Talend that worked, but given the amount of data that may need to be updated daily, the current performance will not cut it. It takes the ETL process four minutes to UPDATE or INSERT 100 records to dimUser. If I assumed a linear relationship between the count of records and the amount of time to UPDATE or INSERT, then there is no way the ETL can finish in 3-4 hours (my hope), let alone one day. Since I'm unfamiliar with Java, I wrote the ETL as a Python script and ran into the same problem. Although, I did discover that if I did only INSERT, the process went much faster. I am pretty sure that the bottleneck is caused by the UPDATE statements. The primary key in dimUser is an auto-increment integer. My friend suggested that I scrap this primary key and replace it with a multi-field primary key (in my case, 2-3 fields). Before I rip the test data out of my warehouse and change the schema, can anyone provide suggestions or guidelines related to the design of the data warehouse the ETL process how realistic it is to have an ETL process INSERT or UPDATE a few million records each day will my friend's suggestion significantly help If you need any further information, just let me know and I'll post it. UPDATE - additional information: mysql> describe dimUser; Field Type Null Key Default Extra user_key int(10) unsigned NO PRI NULL auto_increment id_A int(10) unsigned NO NULL id_B int(10) unsigned NO NULL field_4 tinyint(4) unsigned NO 0 field_5 varchar(50) YES NULL city varchar(50) YES NULL state varchar(2) YES NULL country varchar(50) YES NULL zip_code varchar(10) NO 99999 field_10 tinyint(1) NO 0 field_11 tinyint(1) NO 0 field_12 tinyint(1) NO 0 field_13 tinyint(1) NO 1 field_14 tinyint(1) NO 0 field_15 tinyint(1) NO 0 field_16 tinyint(1) NO 0 field_17 tinyint(1) NO 1 field_18 tinyint(1) NO 0 field_19 tinyint(1) NO 0 field_20 tinyint(1) NO 0 create_date datetime NO 2012-01-01 00:00:00 last_update datetime NO 2012-01-01 00:00:00 run_id int(10) unsigned NO 999 I used a surrogate key because I had read that it was good practice. Since, from a business perspective, I want to keep aware of potential fraudulent activity (say for 200 days a user is associated with state X and then the next day they are associated with state Y - they could have moved or their account could have been compromised), so that is why geographic data is kept. The field id_B may have a few distinct values of id_A associated with it, but I am interested in knowing distinct (id_A, id_B) tuples. In the context of this information, my friend suggested that something like (id_A, id_B, zip_code) be the primary key. For the large majority of daily ETL processes (80%), I only expect the following fields to be updated for existing records: field_10 - field_14, last_update, and run_id (this field is a foreign key to my etlLog table and is used for ETL auditing purposes).

    Read the article

  • Problem with my whiteboard application

    - by swift
    I have to develop a whiteboard application in which both the local user and the remote user should be able to draw simultaneously, is this possible? If possible then any logic? I have already developed a code but in which i am not able to do this, when the remote user starts drawing the shape which i am drawing is being replaced by his shape and co-ordinates. This problem is only when both draw simultaneously. any idea guys? Here is my code class Paper extends JPanel implements MouseListener,MouseMotionListener,ActionListener { static BufferedImage image; int bpressed; Color color; Point start; Point end; Point mp; Button elipse=new Button("elipse"); Button rectangle=new Button("rect"); Button line=new Button("line"); Button empty=new Button(""); JButton save=new JButton("Save"); JButton erase=new JButton("Erase"); String selected; int ex,ey;//eraser DatagramSocket dataSocket; JButton button = new JButton("test"); Client client; Point p=new Point(); int w,h; public Paper(DatagramSocket dataSocket) { this.dataSocket=dataSocket; client=new Client(dataSocket); System.out.println("paper"); setBackground(Color.white); addMouseListener(this); addMouseMotionListener(this); color = Color.black; setBorder(BorderFactory.createLineBorder(Color.black)); //save.setPreferredSize(new Dimension(100,20)); save.setMaximumSize(new Dimension(75,27)); erase.setMaximumSize(new Dimension(75,27)); } public void paintComponent(Graphics g) { try { g.drawImage(image, 0, 0, this); Graphics2D g2 = (Graphics2D)g; g2.setPaint(Color.black); if(selected==("elipse")) g2.drawOval(start.x, start.y,(end.x-start.x),(end.y-start.y)); else if(selected==("rect")) g2.drawRect(start.x, start.y, (end.x-start.x),(end.y-start.y)); else if(selected==("line")) g2.drawLine(start.x,start.y,end.x,end.y); } catch(Exception e) {} } //Function to draw the shape on image public void draw() { Graphics2D g2 = image.createGraphics(); g2.setPaint(color); if(selected=="line") g2.drawLine(start.x, start.y, end.x, end.y); if(selected=="elipse") g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y)); if(selected=="rect") g2.drawRect(start.x, start.y, (end.x-start.x),(end.y-start.y)); repaint(); g2.dispose(); start=null; } //To add the point to the board which is broadcasted by the server public synchronized void addPoint(Point ps,String varname,String shape,String event) { try { if(end==null) end = new Point(); if(start==null) start = new Point(); if(shape.equals("elipse")) selected="elipse"; else if(shape.equals("line")) selected="line"; else if(shape.equals("rect")) selected="rect"; else if(shape.equals("erase")) { selected="erase"; erase(); } if(end!=null && start!=null) { if(varname.equals("end")) end=ps; if(varname.equals("mp")) mp=ps; if(varname.equals("start")) start=ps; if(event.equals("drag")) repaint(); else if(event.equals("release")) draw(); } } catch(Exception e) { e.printStackTrace(); } } //To set the size of the image public void setWidth(int x,int y) { System.out.println("("+x+","+y+")"); w=x; h=y; image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); g2.setPaint(Color.white); g2.fillRect(0,0,w,h); g2.dispose(); } //Function which provides the erase functionality public void erase() { Graphics2D pic=(Graphics2D) image.getGraphics(); pic.setPaint(Color.white); pic.fillRect(start.x, start.y, 10, 10); } //Function to add buttons into the panel, calling this function returns a panel public JPanel addButtons() { JPanel buttonpanel=new JPanel(); JPanel row1=new JPanel(); JPanel row2=new JPanel(); JPanel row3=new JPanel(); JPanel row4=new JPanel(); buttonpanel.setPreferredSize(new Dimension(80,80)); //buttonpanel.setMinimumSize(new Dimension(150,150)); row1.setLayout(new BoxLayout(row1,BoxLayout.X_AXIS)); row1.setPreferredSize(new Dimension(150,150)); row2.setLayout(new BoxLayout(row2,BoxLayout.X_AXIS)); row3.setLayout(new BoxLayout(row3,BoxLayout.X_AXIS)); row4.setLayout(new BoxLayout(row4,BoxLayout.X_AXIS)); buttonpanel.setLayout(new BoxLayout(buttonpanel,BoxLayout.Y_AXIS)); elipse.addActionListener(this); rectangle.addActionListener(this); line.addActionListener( this); save.addActionListener( this); erase.addActionListener( this); buttonpanel.add(Box.createRigidArea(new Dimension(10,10))); row1.add(elipse); row1.add(Box.createRigidArea(new Dimension(5,0))); row1.add(rectangle); buttonpanel.add(row1); buttonpanel.add(Box.createRigidArea(new Dimension(10,10))); row2.add(line); row2.add(Box.createRigidArea(new Dimension(5,0))); row2.add(empty); buttonpanel.add(row2); buttonpanel.add(Box.createRigidArea(new Dimension(10,10))); row3.add(save); buttonpanel.add(row3); buttonpanel.add(Box.createRigidArea(new Dimension(10,10))); row4.add(erase); buttonpanel.add(row4); return buttonpanel; } //To save the image drawn public void save() { try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(bos); JFileChooser fc = new JFileChooser(); fc.showSaveDialog(this); encoder.encode(image); byte[] jpgData = bos.toByteArray(); FileOutputStream fos = new FileOutputStream(fc.getSelectedFile()+".jpeg"); fos.write(jpgData); fos.close(); //add replce confirmation here } catch (IOException e) { System.out.println(e); } } public void mouseClicked(MouseEvent arg0) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { if(selected=="line"||selected=="erase") { start=e.getPoint(); client.broadcast(start,"start", selected,"press"); } else if(selected=="elipse"||selected=="rect") { mp = e.getPoint(); client.broadcast(mp,"mp", selected,"press"); } } public void mouseReleased(MouseEvent e) { if(start!=null) { if(selected=="line") { end=e.getPoint(); client.broadcast(end,"end", selected,"release"); } else if(selected=="elipse"||selected=="rect") { end.x = Math.max(mp.x,e.getX()); end.y = Math.max(mp.y,e.getY()); client.broadcast(end,"end", selected,"release"); } draw(); } //start=null; } public void mouseDragged(MouseEvent e) { if(end==null) end = new Point(); if(start==null) start = new Point(); if(selected=="line") { end=e.getPoint(); client.broadcast(end,"end", selected,"drag"); } else if(selected=="erase") { start=e.getPoint(); erase(); client.broadcast(start,"start", selected,"drag"); } else if(selected=="elipse"||selected=="rect") { start.x = Math.min(mp.x,e.getX()); start.y = Math.min(mp.y,e.getY()); end.x = Math.max(mp.x,e.getX()); end.y = Math.max(mp.y,e.getY()); client.broadcast(start,"start", selected,"drag"); client.broadcast(end,"end", selected,"drag"); } repaint(); } @Override public void mouseMoved(MouseEvent arg0) { // TODO Auto-generated method stub } public void actionPerformed(ActionEvent e) { if(e.getSource()==elipse) selected="elipse"; if(e.getSource()==line) selected="line"; if(e.getSource()==rectangle) selected="rect"; if(e.getSource()==save) save(); if(e.getSource()==erase) { selected="erase"; erase(); } } } class Button extends JButton { String name; public Button(String name) { this.name=name; Dimension buttonSize = new Dimension(35,35); setMaximumSize(buttonSize); } public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //g2.setStroke(new BasicStroke(1.2f)); if (name == "line") g.drawLine(5,5,30,30); if (name == "elipse") g.drawOval(5,7,25,20); if (name== "rect") g.drawRect(5,5,25,23); } }

    Read the article

  • Relational vs. Dimensional Databases, what's the difference?

    - by grautur
    I'm trying to learn about OLAP and data warehousing, and I'm confused about the difference between relational and dimensional modeling. Is dimensional modeling basically relational modeling, but allowing for redundant/un-normalized data? For example, let's say I have historical sales data on (product, city, # sales). I understand that the following would be a relational point-of-view: Product | City | # Sales Apples, San Francisco, 400 Apples, Boston, 700 Apples, Seattle, 600 Oranges, San Francisco, 550 Oranges, Boston, 500 Oranges, Seattle, 600 While the following is a more dimensional point-of-view: Product | San Francisco | Boston | Seattle Apples, 400, 700, 600 Oranges, 550, 500, 600 But it seems like both points of view would nonetheless be implemented in an identical star schema: Fact table: Product ID, Region ID, # Sales Product dimension: Product ID, Product Name City dimension: City ID, City Name And it's not until you start adding some additional details to each dimension that the differences start popping up. For instance, if you wanted to track regions as well, a relational database would tend to have a separate region table, in order to keep everything normalized: City dimension: City ID, City Name, Region ID Region dimension: Region ID, Region Name, Region Manager, # Regional Stores While a dimensional database would allow for denormalization to keep the region data inside the city dimension, in order to make it easier to slice the data: City dimension: City ID, City Name, Region Name, Region Manager, # Regional Stores Is this correct?

    Read the article

  • How should a new programmers behave at their first job? [on hold]

    - by Dimension
    What are programmers expected to know at their first job and how old will they typically be? I'm not going to school so I'm not around other programmers, therefore I have no idea what kind of programmers they are when they first get hired. I just want to get an idea what the median programmer's knowledge looks like. Will they already have had experience with version control? Are they writing good maintainable code? And what are they expected to do do? I'm programming my own software at home and because of the complexities of it and how new I am to programming I'm sometimes throwing all the code out and starting again with a better design. Aren't new programmers going to write terribly structured software for their employer, or is someone else going to be making the decisions on how everything is laid out?

    Read the article

  • How do I remove an array dimension where the elements sum to zero?

    - by James
    I am assigning a 3D array, which contains some information for a number of different loadcases. Each row in the array defines a particular loadcase (of which there are 3) and I would like to remove the loadcase (i.e. the row) if ALL the elements of the row (in 3D) are equal to zero. The code I have at the moment is: Array = zeros(3,5) %# Initialise array Numloadcases = 3; Array(:,:,1) = [10 10 10 10 10; 0 0 0 0 0; 0 0 0 0 0;]; %# Expand to a 3D array Array(:,:,2) = [10 10 10 10 10; 0 0 0 0 0; 0 0 0 0 0;]; Array(:,:,3) = [10 10 10 10 10; 0 0 0 0 0; 0 0 20 0 0;]; Array(:,:,4) = [10 10 10 10 10; 0 0 0 0 0; 0 0 20 0 0;]; %# And to remove the second row: for i = 1:Numloadcases if sum(Array(i,:,:)) == 0 Array(i,:,:) = []; end end At the moment, the for loop I have to remove the rows causes an indexing error, as the size of the array changes in the loop. Can anyone see a work around for this?

    Read the article

  • Expression Encoder - Limitations for file Dimension - min size of 64 * 64 and must be a multiple of

    - by PortageMonkey
    I receive error messages when attempting to encode files in Expression Encoder when the file width or height is not a multiple of four, or is smaller than 64. I have been able to find very little in the documentation / web searches on this, and nothing that explains what settings may cause / alleviate these limitations. I assume it has something to do with the underlying data type. Error Message: Invalid Width Specified. The value must be an integer between 64 - and 4096 and be a multiple of 4. Can anyone provide further details on why / what settings can be manipulated to change this behavior: I.E. quality, compression etc.

    Read the article

  • How can we make a single dimension array to multidimensional Hierarchical ?

    - by Chetan sharma
    I have an single array of Hierarchical categories. Index of the array is the category_id like:: [8846] => Array ( [category_id] => 8846 [title] => Tsting two [description] => Tsting two [subtype] => categories [type] => object [level] => 2 [parent_category] => 8841 [tags] => new [name] => Tsting two ) each value has its parent_category value, I have around 500 elements in the array, what is the best way to make it. Process i followed: krsort categories array, so that all the child categories are at the beginning, then function makeHierarchical() { foreach($this->categories as $guid => $category) { if($category['level'] != 1) $this->multilevel_categories[$category['parent_category']][$guid] = $category; } } but this is not working, it does it only for first level. Can someone point out me the error.

    Read the article

  • JavaScript/HTML: How do I display an IMG with a set dimension and if the image is wider or taller th

    - by NickNick
    I have a bunch of images that are guaranteed to have: minimum width = 200px maximum width = 250px minimum height = 150px maximum height = 175px What I want to do is display a consist 200px by 150px rectangle of the image while maintaining scale (no stretching or shrinking). Which means, I might have some overflow. How can I display the image so that it keeps porpotions to the original image size, yet displayed inside a 200x150 px window and hiding any overflow?

    Read the article

  • Why setPreferredSize does not change the size of the button?

    - by Roman
    Here is the code: import javax.swing.*; import java.awt.event.*; import java.awt.*; public class TestGrid { public static void main(String[] args) { JFrame frame = new JFrame("Colored Trails"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(4, 9)); panel.setMaximumSize(new Dimension(9*30-20,4*30)); JButton btn; for (int i=1; i<=4; i++) { for (int j=1; j<=4; j++) { btn = new JButton(); btn.setPreferredSize(new Dimension(30, 30)); panel.add(btn); } btn = new JButton(); btn.setPreferredSize(new Dimension(30, 10)); panel.add(btn); for (int j=1; j<=4; j++) { btn = new JButton(); btn.setPreferredSize(new Dimension(30, 30)); panel.add(btn); } } mainPanel.add(panel); frame.add(mainPanel); frame.setSize(450,950); frame.setVisible(true); } } I suppose to have a table of buttons with 4 rows and 9 columns. And the middle column should be narrower that other columns. I tried Dimension(30, 10) and Dimension(30, 10) both have no effect on the width of the middle column. Why?

    Read the article

  • update jframe in java or revalidate/repaint/ panel

    - by user1516251
    How to update a java frame with changed content I want to update a frame or just the panel with updated content. What do I use for this Here is where i want to revalidate the frame or repaint mainpanel or whatever will work I have tried a number of things, but none of them have worked. public void actionPerformed(ActionEvent e) { //System.out.println(e.getActionCommand()); if (e.getActionCommand().equals("advance")) { multi--; // Revalidate update repaint here <<<<<<<<<<<<<<<<<<< } else if (e.getActionCommand().equals("reverse")) { multi++; // Revalidate update repaint here <<<<<<<<<<<<<<<<<<< } else { openURL(e.getActionCommand()); } } Here is the whole java file /* * * */ package build; import java.lang.reflect.Method; import javax.swing.JOptionPane; import java.util.Arrays; import java.util.*; import java.util.ArrayList; import javax.swing.*; import javax.swing.AbstractButton; import javax.swing.JScrollPane; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JFrame; import javax.swing.ImageIcon; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; /* * ButtonDemo.java requires the following files: * images/right.gif * images/middle.gif * images/left.gif */ public class StockTable extends JPanel implements ActionListener { static int multi = 1; int roll = 0; static TextVars textvars = new TextVars(); static final String[] browsers = { "firefox", "opera", "konqueror", "epiphany", "seamonkey", "galeon", "kazehakase", "mozilla", "netscape" }; JFrame frame; JPanel mainpanel, panel1, panel2, panel3, panel4, panel2left, panel2center, panel2right; JButton stknames_btn[] = new JButton[textvars.getNumberOfStocks()]; JLabel label[] = new JLabel[textvars.getNumberOfStocks()]; JLabel headlabel, dayspan, namelabel; JRadioButton radioButton; JButton button; JScrollPane scrollpane; int wid = 825; public JPanel createContentPane() { mainpanel = new JPanel(); mainpanel.setPreferredSize(new Dimension(wid, 800)); mainpanel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); panel1 = new JPanel(); panel1.setPreferredSize(new Dimension(wid, 25)); c.gridx = 0; c.gridy = 0; c.insets = new Insets(0,0,0,0); mainpanel.add(panel1, c); // Panel 2------------ panel2 = new JPanel(); panel2.setPreferredSize(new Dimension(wid, 51)); c.gridx = 0; c.gridy = 1; c.insets = new Insets(0,0,0,0); mainpanel.add(panel2, c); panel2left = new JPanel(); panel2left.setPreferredSize(new Dimension(270, 51)); c.gridx = 0; c.gridy = 1; c.insets = new Insets(0,0,0,0); panel2.add(panel2left, c); panel2center = new JPanel(); panel2center.setPreferredSize(new Dimension(258, 51)); c.gridx = 1; c.gridy = 1; c.insets = new Insets(0,0,0,0); panel2.add(panel2center, c); panel2right = new JPanel(); panel2right.setPreferredSize(new Dimension(270, 51)); c.gridx = 2; c.gridy = 1; c.insets = new Insets(0,0,0,0); panel2.add(panel2right, c); // ------------------ panel3 = new JPanel(); panel3.setLayout(new GridBagLayout()); scrollpane = new JScrollPane(panel3); scrollpane.setPreferredSize(new Dimension(wid, 675)); c.gridx = 0; c.gridy = 2; c.insets = new Insets(0,0,0,0); mainpanel.add(scrollpane, c); ImageIcon leftButtonIcon = createImageIcon("images/right.gif"); //b1 = new JButton("Disable middle button", leftButtonIcon); //b1.setVerticalTextPosition(AbstractButton.CENTER); //b1.setHorizontalTextPosition(AbstractButton.LEADING); //aka LEFT, for left-to-right locales //b1.setMnemonic(KeyEvent.VK_D); //b1.setActionCommand("disable"); //Listen for actions on buttons 1 //b1.addActionListener(this); //b1.setToolTipText("Click this button to disable the middle button."); //Add Components to this container, using the default FlowLayout. //add(b1); headlabel = new JLabel("hellorow1"); c.gridx = 0; c.gridy = 0; c.insets = new Insets(0, 0, 0, 0); panel1.add(headlabel, c); radioButton = new JRadioButton("Percentage"); c.gridx = 2; c.gridy = 0; c.insets = new Insets(0, 0, 0, 0); panel1.add(radioButton, c); radioButton = new JRadioButton("Days Range"); c.gridx = 3; c.gridy = 0; c.insets = new Insets(0, 0, 0, 0); panel1.add(radioButton, c); radioButton = new JRadioButton("Open / Close"); c.gridx = 4; c.gridy = 0; c.insets = new Insets(0, 0, 0,0 ); panel1.add(radioButton, c); button = new JButton("<<"); button.setPreferredSize(new Dimension(50, 50)); button.setActionCommand("reverse"); button.addActionListener(this); c.gridx = 0; c.gridy = 1; c.insets = new Insets(0, 0, 0, 0); panel2left.add(button, c); dayspan = new JLabel("hellorow2"); dayspan.setHorizontalAlignment(JLabel.CENTER); dayspan.setVerticalAlignment(JLabel.CENTER); dayspan.setPreferredSize(new Dimension(270, 50)); c.gridx = 1; c.gridy = 1; c.insets = new Insets(0, 0, 0, 0); panel2center.add(dayspan, c); button = new JButton(">>"); button.setPreferredSize(new Dimension(50, 50)); button.setActionCommand("advance"); button.addActionListener(this); if (multi == 0) { button.setEnabled(false); } else { button.setEnabled(true); } c.gridx = 2; c.gridy = 1; c.insets = new Insets(0, 0, 0, 0); panel2right.add(button, c); int availSpace_int = textvars.getStocks().size()-textvars.getNumberOfStocks()*7; ArrayList<String[]> stocknames = textvars.getStockNames(); ArrayList<String[]> stocks = textvars.getStocks(); for (int column = 0; column < 8; column++) { for (int row = 0; row < textvars.getNumberOfStocks(); row++) { if (column==0) { if (row==0) { namelabel = new JLabel(stocknames.get(0)[0]); namelabel.setVerticalAlignment(JLabel.CENTER); namelabel.setHorizontalAlignment(JLabel.CENTER); namelabel.setPreferredSize(new Dimension(100, 25)); c.gridx = column; c.gridy = row; c.insets = new Insets(0, 0, 0, 0); panel3.add(namelabel, c); } else { stknames_btn[row] = new JButton(stocknames.get(row)[0], leftButtonIcon); stknames_btn[row].setVerticalTextPosition(AbstractButton.CENTER); stknames_btn[row].setActionCommand(stocknames.get(row)[1]); stknames_btn[row].addActionListener(this); stknames_btn[row].setToolTipText("go to Google Finance "+stocknames.get(row)[0]); stknames_btn[row].setPreferredSize(new Dimension(100, 25)); c.gridx = column; c.gridy = row; c.insets = new Insets(0, 0, 0, 0); //scrollpane.add(stknames[row], c); panel3.add(stknames_btn[row], c); } } else { label[row]= new JLabel(textvars.getStocks().get(columnMulti(multi))[1]); label[row].setBorder(BorderFactory.createLineBorder(Color.black)); label[row].setVerticalAlignment(JLabel.CENTER); label[row].setHorizontalAlignment(JLabel.CENTER); label[row].setPreferredSize(new Dimension(100, 25)); c.gridx = column; c.gridy = row; c.insets = new Insets(0,0,0,0); panel3.add(label[row], c); } } } return mainpanel; } public void actionPerformed(ActionEvent e) { //System.out.println(e.getActionCommand()); if (e.getActionCommand().equals("advance")) { multi--; } else if (e.getActionCommand().equals("reverse")) { multi++; } else { openURL(e.getActionCommand()); } } /** Returns an ImageIcon, or null if the path was invalid. */ protected static ImageIcon createImageIcon(String path) { java.net.URL imgURL = StockTable.class.getResource(path); if (imgURL != null) { return new ImageIcon(imgURL); } else { System.err.println("Couldn't find file: " + path); return null; } } public static void openURL(String url) { String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class<?> fileMgr = Class.forName("com.apple.eio.FileManager"); Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {String.class}); openURL.invoke(null, new Object[] {url}); } else if (osName.startsWith("Windows")) { Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url); } else { //assume Unix or Linux boolean found = false; for (String browser : browsers) if (!found) { found = Runtime.getRuntime().exec( new String[] {"which", browser}).waitFor() == 0; if (found) Runtime.getRuntime().exec(new String[] {browser, url}); } if (!found) throw new Exception(Arrays.toString(browsers)); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Error attempting to launch web browser\n" + e.toString()); } } int reit = 0; int start = textvars.getStocks().size()-((textvars.getNumberOfStocks()*5)*7)-1; public int columnMulti(int multi) { reit++; start++; if (reit == textvars.getNumberOfStocks()) { reit = 0; start=start+64; } //start = start - (multi*(textvars.getNumberOfStocks())); return start; } /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Create and set up the window. JFrame frame = new JFrame("Stock Table"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. StockTable newContentPane = new StockTable(); //newContentPane.setOpaque(true); //content panes must be opaque //frame.setContentPane(newContentPane); frame.setContentPane(newContentPane.createContentPane()); frame.setSize(800, 800); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }

    Read the article

  • "Simple" sort a nested array using array_multisort or native PHP functions instead of my own foreach loop

    - by Ana Ban
    I have the following array of days of the week, with each day having hours of the day (the whole array represents the schedule of a part-time employee): Array ( [7] => Array ( [0] => 15 [1] => 14 [2] => 13 [3] => 11 [4] => 12 [5] => 10 ) [1] => Array ( [0] => 10 [1] => 13 [2] => 12 ) [6] => Array ( [0] => 14 ) [3] => Array ( [0] => 4 [1] => 5 [2] => 6 ) ) and I simply need to: sort asc each sub-array (2nd dimension) - no need to maintain the numeric keys, values are integers sort asc the 1st dimension and maintain the numeric, integer keys ie: Array ( [1] => Array ( [0] => 10 [1] => 12 [2] => 13 ) [3] => Array ( [0] => 4 [1] => 5 [2] => 6 ) [6] => Array ( [0] => 14 ) [7] => Array ( [0] => 10 [1] => 11 [2] => 12 [3] => 13 [4] => 14 [5] => 15 ) ) Additional info: only the keys of the 1st dimension and the values of the 2nd dimension (and of course their association) are meaningful to my use-case the 1st dimension can have at most 7 values, ranging from 1-7 (days of the week), and will have at least 1 value (1 day) the 2nd dimension can have at most 24 values, ranging from 0-23 (hours of each day), and will have at least 1 value (1 hour per day) I know I can do this with a foreach on the whole ksorted array and sort each 2nd dimension array: ksort($sched); foreach ($sched as &$array) sort($array); unset($array); but I was hoping I could achieve this with native php array function(s) instead. My search led me to try array_multisort(array_values($array), array_keys($array), $array) but I just can't make it work.

    Read the article

  • Line up swing components by edges

    - by rasen58
    Is it possible to line up swing components? The components are in separate panels which both use flow layout. These two panels are in another panel which is using a grid layout. As you can see there is a subtle difference and I find it annoying. I know that all of the jlabels [the rectangles in blue/purple all have the same size, so i think it might be because of the '+' and '*', but I'm not sure because the left sides of the first two boxes aren't lined up. the panels JPanel panel2 = new JPanel(new GridLayout(4, 1)); JPanel panel2a = new JPanel(new FlowLayout()); JPanel panel2b = new JPanel(new FlowLayout()); the first two rectangles (purple) add1 = new JLabel("", JLabel.CENTER); add1.setTransferHandler(new TransferHandler("text")); add1.setBorder(b2); add2 = new JLabel("", JLabel.CENTER); add2.setTransferHandler(new TransferHandler("text")); add2.setBorder(b2); the two blue rectangles textFieldA = new JTextField(); textFieldA.setHorizontalAlignment(JTextField.CENTER); textFieldA.setEditable(false); textFieldA.setBorder(new LineBorder(Color.blue)); textFieldM = new JTextField(); textFieldM.setHorizontalAlignment(JTextField.CENTER); textFieldM.setEditable(false); textFieldM.setBorder(new LineBorder(Color.blue)); the + and * opA = new JLabel("+", JLabel.CENTER); opS = new JLabel("*", JLabel.CENTER); Showing that the rectangles are the same size Dimension d = card1.getPreferredSize(); int width = d.width + 100; int height = d.height + 50; add1.setPreferredSize(new Dimension(width, height)); add2.setPreferredSize(new Dimension(width, height)); mult1.setPreferredSize(new Dimension(width, height)); mult2.setPreferredSize(new Dimension(width, height)); textFieldA.setPreferredSize(new Dimension(width, height)); textFieldM.setPreferredSize(new Dimension(width, height)); Adding to the panels panel2a.add(add1); panel2a.add(opA); panel2a.add(add2); panel2a.add(enterA); panel2a.add(textFieldA); panel2c.add(mult1); panel2c.add(opM); panel2c.add(mult2); panel2c.add(enterM); panel2c.add(textFieldM); panel2.add(panel2a); panel2.add(panel2c);

    Read the article

  • Why can't mythtv backend see my HDHomeRun tuner?

    - by Jeff
    Ran a fresh install of Mythbuntu 12.04.1 32 bit. Went through the backend setup and was able to see my HDHomeRun Prime (HDHR3) device, scan, and detect channels. Cannot get to live TV on frontend. Backend log seems to indicate it's not detecting my tuner, even though I configured it in the setup. Sep 8 15:03:33 Dimension-8300 mythbackend[1668]: E TVRecEvent dtvmultiplex.cpp:325 (ParseTuningParams) DTVMux: ParseTuningParams -- Unknown tuner type = 0x2000 Sep 8 15:03:33 Dimension-8300 mythbackend[1668]: E TVRecEvent dtvchannel.cpp:308 (SetChannelByString) DTVChan(192.168.1.12-0): SetChannelByString(3_1): Failed to initialize multiplex options Sep 8 15:03:33 Dimension-8300 mythbackend[1668]: E TVRecEvent tv_rec.cpp:3681 (TuningFrequency) TVRec(1): Failed to set channel to 3_1. Reverting to kState_None

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >